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/helper-split-export-declaration
>
See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/next/babel-helper-split-export-declaration.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-split-export-declaration
```
or using yarn:
```sh
yarn add @babel/helper-split-export-declaration --dev
```

View File

@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = splitExportDeclaration;
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration()) {
throw new Error("Only export declarations can be splitted.");
}
const isDefault = exportDeclaration.isExportDefaultDeclaration();
const declaration = exportDeclaration.get("declaration");
const isClassDeclaration = declaration.isClassDeclaration();
if (isDefault) {
const standaloneDeclaration = declaration.isFunctionDeclaration() || isClassDeclaration;
const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope;
let id = declaration.node.id;
let needBindingRegistration = false;
if (!id) {
needBindingRegistration = true;
id = scope.generateUidIdentifier("default");
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) {
declaration.node.id = t().cloneNode(id);
}
}
const updatedDeclaration = standaloneDeclaration ? declaration : t().variableDeclaration("var", [t().variableDeclarator(t().cloneNode(id), declaration.node)]);
const updatedExportDeclaration = t().exportNamedDeclaration(null, [t().exportSpecifier(t().cloneNode(id), t().identifier("default"))]);
exportDeclaration.insertAfter(updatedExportDeclaration);
exportDeclaration.replaceWith(updatedDeclaration);
if (needBindingRegistration) {
scope.registerBinding(isClassDeclaration ? "let" : "var", exportDeclaration);
}
return exportDeclaration;
}
if (exportDeclaration.get("specifiers").length > 0) {
throw new Error("It doesn't make sense to split exported specifiers.");
}
const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
const specifiers = Object.keys(bindingIdentifiers).map(name => {
return t().exportSpecifier(t().identifier(name), t().identifier(name));
});
const aliasDeclar = t().exportNamedDeclaration(null, specifiers);
exportDeclaration.insertAfter(aliasDeclar);
exportDeclaration.replaceWith(declaration.node);
return exportDeclaration;
}

View File

@@ -0,0 +1,84 @@
{
"_args": [
[
"@babel/helper-split-export-declaration@7.0.0-beta.54",
"/home/bernhard/freifunk-app/node_modules/@babel/traverse"
]
],
"_from": "@babel/helper-split-export-declaration@7.0.0-beta.54",
"_id": "@babel/helper-split-export-declaration@7.0.0-beta.54",
"_inCache": true,
"_installable": true,
"_location": "/@babel/helper-split-export-declaration",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/helper-split-export-declaration_7.0.0-beta.54_1531763994280_0.31231247567945286"
},
"_npmUser": {
"email": "hi@henryzoo.com",
"name": "hzoo"
},
"_phantomChildren": {},
"_requested": {
"name": "@babel/helper-split-export-declaration",
"raw": "@babel/helper-split-export-declaration@7.0.0-beta.54",
"rawSpec": "7.0.0-beta.54",
"scope": "@babel",
"spec": "7.0.0-beta.54",
"type": "version"
},
"_requiredBy": [
"/@babel/helper-module-transforms",
"/@babel/plugin-transform-classes",
"/@babel/traverse"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.54.tgz",
"_shasum": "89cd8833c95481a0827ac6a1bfccddb92b75a109",
"_shrinkwrap": null,
"_spec": "@babel/helper-split-export-declaration@7.0.0-beta.54",
"_where": "/home/bernhard/freifunk-app/node_modules/@babel/traverse",
"dependencies": {
"@babel/types": "7.0.0-beta.54"
},
"description": ">",
"devDependencies": {},
"directories": {},
"dist": {
"fileCount": 5,
"shasum": "89cd8833c95481a0827ac6a1bfccddb92b75a109",
"tarball": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.54.tgz",
"unpackedSize": 3492
},
"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/helper-split-export-declaration",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration"
},
"version": "7.0.0-beta.54"
}