initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
src
test
node_modules

24
node_modules/babel-helper-builder-react-jsx/README.md generated vendored Normal file
View 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
}
});
```

View 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"];

View 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="
}
}
}

View File

@@ -0,0 +1,85 @@
{
"_args": [
[
"babel-helper-builder-react-jsx@^6.24.1",
"/home/bernhard/freifunk-app/node_modules/babel-plugin-transform-react-jsx"
]
],
"_from": "babel-helper-builder-react-jsx@>=6.24.1 <7.0.0",
"_id": "babel-helper-builder-react-jsx@6.26.0",
"_inCache": true,
"_installable": true,
"_location": "/babel-helper-builder-react-jsx",
"_nodeVersion": "6.9.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/babel-helper-builder-react-jsx-6.26.0.tgz_1502898854587_0.9402090664952993"
},
"_npmUser": {
"email": "hi@henryzoo.com",
"name": "hzoo"
},
"_npmVersion": "4.6.1",
"_phantomChildren": {},
"_requested": {
"name": "babel-helper-builder-react-jsx",
"raw": "babel-helper-builder-react-jsx@^6.24.1",
"rawSpec": "^6.24.1",
"scope": null,
"spec": ">=6.24.1 <7.0.0",
"type": "range"
},
"_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",
"_shrinkwrap": null,
"_spec": "babel-helper-builder-react-jsx@^6.24.1",
"_where": "/home/bernhard/freifunk-app/node_modules/babel-plugin-transform-react-jsx",
"dependencies": {
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"esutils": "^2.0.2"
},
"description": "Helper function to build react jsx",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "39ff8313b75c8b65dceff1f31d383e0ff2a408a0",
"tarball": "https://registry.npmjs.org/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.26.0.tgz"
},
"license": "MIT",
"main": "lib/index.js",
"maintainers": [
{
"name": "thejameskyle",
"email": "me@thejameskyle.com"
},
{
"name": "sebmck",
"email": "sebmck@gmail.com"
},
{
"name": "danez",
"email": "daniel@tschinder.de"
},
{
"name": "hzoo",
"email": "hi@henryzoo.com"
},
{
"name": "loganfsmyth",
"email": "loganfsmyth@gmail.com"
}
],
"name": "babel-helper-builder-react-jsx",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx"
},
"scripts": {},
"version": "6.26.0"
}