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,19 @@
# @babel/plugin-transform-react-jsx
> Turn JSX into React function calls
See our website [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/en/next/babel-plugin-transform-react-jsx.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-react-jsx
```
or using yarn:
```sh
yarn add @babel/plugin-transform-react-jsx --dev
```

View File

@@ -0,0 +1,133 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
return data;
};
return data;
}
function _pluginSyntaxJsx() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-jsx"));
_pluginSyntaxJsx = function () {
return data;
};
return data;
}
function _helperBuilderReactJsx() {
const data = _interopRequireDefault(require("@babel/helper-builder-react-jsx"));
_helperBuilderReactJsx = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils().declare)((api, options) => {
api.assertVersion(7);
const THROW_IF_NAMESPACE = options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace;
const PRAGMA_DEFAULT = options.pragma || "React.createElement";
const PRAGMA_FRAG_DEFAULT = options.pragmaFrag || "React.Fragment";
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
const JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/;
const createIdentifierParser = id => () => {
return id.split(".").map(name => _core().types.identifier(name)).reduce((object, property) => _core().types.memberExpression(object, property));
};
const visitor = (0, _helperBuilderReactJsx().default)({
pre(state) {
const tagName = state.tagName;
const args = state.args;
if (_core().types.react.isCompatTag(tagName)) {
args.push(_core().types.stringLiteral(tagName));
} else {
args.push(state.tagExpr);
}
},
post(state, pass) {
state.callee = pass.get("jsxIdentifier")();
},
throwIfNamespace: THROW_IF_NAMESPACE
});
visitor.Program = {
enter(path, state) {
const {
file
} = state;
let pragma = PRAGMA_DEFAULT;
let pragmaFrag = PRAGMA_FRAG_DEFAULT;
let pragmaSet = !!options.pragma;
let pragmaFragSet = !!options.pragmaFrag;
for (const comment of file.ast.comments) {
const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value);
if (jsxMatches) {
pragma = jsxMatches[1];
pragmaSet = true;
}
const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value);
if (jsxFragMatches) {
pragmaFrag = jsxFragMatches[1];
pragmaFragSet = true;
}
}
state.set("jsxIdentifier", createIdentifierParser(pragma));
state.set("jsxFragIdentifier", createIdentifierParser(pragmaFrag));
state.set("usedFragment", false);
state.set("pragmaSet", pragmaSet);
state.set("pragmaFragSet", pragmaFragSet);
},
exit(path, state) {
if (state.get("pragmaSet") && state.get("usedFragment") && !state.get("pragmaFragSet")) {
throw new Error("transform-react-jsx: pragma has been set but " + "pragmafrag has not been set");
}
}
};
visitor.JSXAttribute = function (path) {
if (_core().types.isJSXElement(path.node.value)) {
path.node.value = _core().types.jsxExpressionContainer(path.node.value);
}
};
return {
inherits: _pluginSyntaxJsx().default,
visitor
};
});
exports.default = _default;

View File

@@ -0,0 +1,93 @@
{
"_args": [
[
"@babel/plugin-transform-react-jsx@^7.0.0-beta",
"/home/bernhard/freifunk-app/node_modules/metro"
]
],
"_from": "@babel/plugin-transform-react-jsx@>=7.0.0-beta <8.0.0",
"_id": "@babel/plugin-transform-react-jsx@7.0.0-beta.54",
"_inCache": true,
"_installable": true,
"_location": "/@babel/plugin-transform-react-jsx",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/plugin-transform-react-jsx_7.0.0-beta.54_1531764019550_0.8602626220778054"
},
"_npmUser": {
"email": "hi@henryzoo.com",
"name": "hzoo"
},
"_phantomChildren": {},
"_requested": {
"name": "@babel/plugin-transform-react-jsx",
"raw": "@babel/plugin-transform-react-jsx@^7.0.0-beta",
"rawSpec": "^7.0.0-beta",
"scope": "@babel",
"spec": ">=7.0.0-beta <8.0.0",
"type": "range"
},
"_requiredBy": [
"/metro"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0-beta.54.tgz",
"_shasum": "7e9b6a624b6406d438b44a8fad23d437a7613b66",
"_shrinkwrap": null,
"_spec": "@babel/plugin-transform-react-jsx@^7.0.0-beta",
"_where": "/home/bernhard/freifunk-app/node_modules/metro",
"dependencies": {
"@babel/helper-builder-react-jsx": "7.0.0-beta.54",
"@babel/helper-plugin-utils": "7.0.0-beta.54",
"@babel/plugin-syntax-jsx": "7.0.0-beta.54"
},
"description": "Turn JSX into React function calls",
"devDependencies": {
"@babel/core": "7.0.0-beta.54",
"@babel/helper-plugin-test-runner": "7.0.0-beta.54"
},
"directories": {},
"dist": {
"fileCount": 5,
"shasum": "7e9b6a624b6406d438b44a8fad23d437a7613b66",
"tarball": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0-beta.54.tgz",
"unpackedSize": 4571
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"maintainers": [
{
"name": "danez",
"email": "daniel@tschinder.de"
},
{
"name": "existentialism",
"email": "bng412@gmail.com"
},
{
"name": "hzoo",
"email": "hi@henryzoo.com"
},
{
"name": "loganfsmyth",
"email": "loganfsmyth@gmail.com"
},
{
"name": "xtuc",
"email": "contact@xtuc.fr"
}
],
"name": "@babel/plugin-transform-react-jsx",
"optionalDependencies": {},
"peerDependencies": {
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx"
},
"version": "7.0.0-beta.54"
}