forked from enviPath/enviPy
Current Dev State
This commit is contained in:
24
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/README.md
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/README.md
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# babel-helper-builder-react-jsx
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
type ElementState = {
|
||||
tagExpr: Object; // tag node
|
||||
tagName: string; // raw string tag name
|
||||
args: Array<Object>; // array of call arguments
|
||||
call?: Object; // optional call property that can be set to override the call expression returned
|
||||
pre?: Function; // function called with (state: ElementState) before building attribs
|
||||
post?: Function; // function called with (state: ElementState) after building attribs
|
||||
};
|
||||
|
||||
require("babel-helper-builder-react-jsx")({
|
||||
pre: function (state: ElementState) {
|
||||
// called before building the element
|
||||
},
|
||||
|
||||
post: function (state: ElementState) {
|
||||
// called after building the element
|
||||
}
|
||||
});
|
||||
```
|
||||
163
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/lib/index.js
generated
vendored
Normal file
163
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function (opts) {
|
||||
var visitor = {};
|
||||
|
||||
visitor.JSXNamespacedName = function (path) {
|
||||
throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML.");
|
||||
};
|
||||
|
||||
visitor.JSXElement = {
|
||||
exit: function exit(path, file) {
|
||||
var callExpr = buildElementCall(path.get("openingElement"), file);
|
||||
|
||||
callExpr.arguments = callExpr.arguments.concat(path.node.children);
|
||||
|
||||
if (callExpr.arguments.length >= 3) {
|
||||
callExpr._prettyCall = true;
|
||||
}
|
||||
|
||||
path.replaceWith(t.inherits(callExpr, path.node));
|
||||
}
|
||||
};
|
||||
|
||||
return visitor;
|
||||
|
||||
function convertJSXIdentifier(node, parent) {
|
||||
if (t.isJSXIdentifier(node)) {
|
||||
if (node.name === "this" && t.isReferenced(node, parent)) {
|
||||
return t.thisExpression();
|
||||
} else if (_esutils2.default.keyword.isIdentifierNameES6(node.name)) {
|
||||
node.type = "Identifier";
|
||||
} else {
|
||||
return t.stringLiteral(node.name);
|
||||
}
|
||||
} else if (t.isJSXMemberExpression(node)) {
|
||||
return t.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node));
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function convertAttributeValue(node) {
|
||||
if (t.isJSXExpressionContainer(node)) {
|
||||
return node.expression;
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
function convertAttribute(node) {
|
||||
var value = convertAttributeValue(node.value || t.booleanLiteral(true));
|
||||
|
||||
if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
|
||||
value.value = value.value.replace(/\n\s+/g, " ");
|
||||
}
|
||||
|
||||
if (t.isValidIdentifier(node.name.name)) {
|
||||
node.name.type = "Identifier";
|
||||
} else {
|
||||
node.name = t.stringLiteral(node.name.name);
|
||||
}
|
||||
|
||||
return t.inherits(t.objectProperty(node.name, value), node);
|
||||
}
|
||||
|
||||
function buildElementCall(path, file) {
|
||||
path.parent.children = t.react.buildChildren(path.parent);
|
||||
|
||||
var tagExpr = convertJSXIdentifier(path.node.name, path.node);
|
||||
var args = [];
|
||||
|
||||
var tagName = void 0;
|
||||
if (t.isIdentifier(tagExpr)) {
|
||||
tagName = tagExpr.name;
|
||||
} else if (t.isLiteral(tagExpr)) {
|
||||
tagName = tagExpr.value;
|
||||
}
|
||||
|
||||
var state = {
|
||||
tagExpr: tagExpr,
|
||||
tagName: tagName,
|
||||
args: args
|
||||
};
|
||||
|
||||
if (opts.pre) {
|
||||
opts.pre(state, file);
|
||||
}
|
||||
|
||||
var attribs = path.node.attributes;
|
||||
if (attribs.length) {
|
||||
attribs = buildOpeningElementAttributes(attribs, file);
|
||||
} else {
|
||||
attribs = t.nullLiteral();
|
||||
}
|
||||
|
||||
args.push(attribs);
|
||||
|
||||
if (opts.post) {
|
||||
opts.post(state, file);
|
||||
}
|
||||
|
||||
return state.call || t.callExpression(state.callee, args);
|
||||
}
|
||||
|
||||
function buildOpeningElementAttributes(attribs, file) {
|
||||
var _props = [];
|
||||
var objs = [];
|
||||
|
||||
var useBuiltIns = file.opts.useBuiltIns || false;
|
||||
if (typeof useBuiltIns !== "boolean") {
|
||||
throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useBuiltIns (defaults to false)");
|
||||
}
|
||||
|
||||
function pushProps() {
|
||||
if (!_props.length) return;
|
||||
|
||||
objs.push(t.objectExpression(_props));
|
||||
_props = [];
|
||||
}
|
||||
|
||||
while (attribs.length) {
|
||||
var prop = attribs.shift();
|
||||
if (t.isJSXSpreadAttribute(prop)) {
|
||||
pushProps();
|
||||
objs.push(prop.argument);
|
||||
} else {
|
||||
_props.push(convertAttribute(prop));
|
||||
}
|
||||
}
|
||||
|
||||
pushProps();
|
||||
|
||||
if (objs.length === 1) {
|
||||
attribs = objs[0];
|
||||
} else {
|
||||
if (!t.isObjectExpression(objs[0])) {
|
||||
objs.unshift(t.objectExpression([]));
|
||||
}
|
||||
|
||||
var helper = useBuiltIns ? t.memberExpression(t.identifier("Object"), t.identifier("assign")) : file.addHelper("extends");
|
||||
|
||||
attribs = t.callExpression(helper, objs);
|
||||
}
|
||||
|
||||
return attribs;
|
||||
}
|
||||
};
|
||||
|
||||
var _esutils = require("esutils");
|
||||
|
||||
var _esutils2 = _interopRequireDefault(_esutils);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = exports["default"];
|
||||
13
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/package-lock.json
generated
vendored
Normal file
13
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/package-lock.json
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "babel-helper-builder-react-jsx",
|
||||
"version": "6.24.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
|
||||
}
|
||||
}
|
||||
}
|
||||
41
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/package.json
generated
vendored
Normal file
41
static/js/ketcher2/node_modules/babel-helper-builder-react-jsx/package.json
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"_from": "babel-helper-builder-react-jsx@^6.24.1",
|
||||
"_id": "babel-helper-builder-react-jsx@6.26.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Of+DE7dci2Xc7/HzHTg+D/KkCKA=",
|
||||
"_location": "/babel-helper-builder-react-jsx",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "babel-helper-builder-react-jsx@^6.24.1",
|
||||
"name": "babel-helper-builder-react-jsx",
|
||||
"escapedName": "babel-helper-builder-react-jsx",
|
||||
"rawSpec": "^6.24.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.24.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-plugin-transform-react-jsx"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.26.0.tgz",
|
||||
"_shasum": "39ff8313b75c8b65dceff1f31d383e0ff2a408a0",
|
||||
"_spec": "babel-helper-builder-react-jsx@^6.24.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/babel-plugin-transform-react-jsx",
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"esutils": "^2.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to build react jsx",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "babel-helper-builder-react-jsx",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx"
|
||||
},
|
||||
"version": "6.26.0"
|
||||
}
|
||||
Reference in New Issue
Block a user