Commit 99033d7d authored by Patrick's avatar Patrick
Browse files

first commit

Showing with 911 additions and 0 deletions
+911 -0
# @babel/helper-regex
> Helper function to check for literal RegEx
See our website [@babel/helper-regex](https://babeljs.io/docs/en/next/babel-helper-regex.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-regex
```
or using yarn:
```sh
yarn add @babel/helper-regex --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.is = is;
exports.pullFlag = pullFlag;
function _pull() {
const data = _interopRequireDefault(require("lodash/pull"));
_pull = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function is(node, flag) {
return node.type === "RegExpLiteral" && node.flags.indexOf(flag) >= 0;
}
function pullFlag(node, flag) {
const flags = node.flags.split("");
if (node.flags.indexOf(flag) < 0) return;
(0, _pull().default)(flags, flag);
node.flags = flags.join("");
}
\ No newline at end of file
{
"_from": "@babel/helper-regex@^7.4.4",
"_id": "@babel/helper-regex@7.5.5",
"_inBundle": false,
"_integrity": "sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw==",
"_location": "/@babel/helper-regex",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-regex@^7.4.4",
"name": "@babel/helper-regex",
"escapedName": "@babel%2fhelper-regex",
"scope": "@babel",
"rawSpec": "^7.4.4",
"saveSpec": null,
"fetchSpec": "^7.4.4"
},
"_requiredBy": [
"/@babel/helper-create-regexp-features-plugin",
"/@babel/plugin-transform-sticky-regex"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.5.5.tgz",
"_shasum": "0aa6824f7100a2e0e89c1527c23936c152cab351",
"_spec": "@babel/helper-regex@^7.4.4",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-create-regexp-features-plugin",
"bundleDependencies": false,
"dependencies": {
"lodash": "^4.17.13"
},
"deprecated": false,
"description": "Helper function to check for literal RegEx",
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-regex",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex"
},
"version": "7.5.5"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/helper-remap-async-to-generator
> Helper function to remap async functions to generators
See our website [@babel/helper-remap-async-to-generator](https://babeljs.io/docs/en/next/babel-helper-remap-async-to-generator.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-remap-async-to-generator
```
or using yarn:
```sh
yarn add @babel/helper-remap-async-to-generator --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _helperWrapFunction = _interopRequireDefault(require("@babel/helper-wrap-function"));
var _helperAnnotateAsPure = _interopRequireDefault(require("@babel/helper-annotate-as-pure"));
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const awaitVisitor = {
Function(path) {
path.skip();
},
AwaitExpression(path, {
wrapAwait
}) {
const argument = path.get("argument");
if (path.parentPath.isYieldExpression()) {
path.replaceWith(argument.node);
return;
}
path.replaceWith(t.yieldExpression(wrapAwait ? t.callExpression(t.cloneNode(wrapAwait), [argument.node]) : argument.node));
}
};
function _default(path, helpers) {
path.traverse(awaitVisitor, {
wrapAwait: helpers.wrapAwait
});
const isIIFE = checkIsIIFE(path);
path.node.async = false;
path.node.generator = true;
(0, _helperWrapFunction.default)(path, t.cloneNode(helpers.wrapAsync));
const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty();
if (!isProperty && !isIIFE && path.isExpression()) {
(0, _helperAnnotateAsPure.default)(path);
}
function checkIsIIFE(path) {
if (path.parentPath.isCallExpression({
callee: path.node
})) {
return true;
}
const {
parentPath
} = path;
if (parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, {
name: "bind"
})) {
const {
parentPath: bindCall
} = parentPath;
return bindCall.isCallExpression() && bindCall.node.arguments.length === 1 && t.isThisExpression(bindCall.node.arguments[0]) && bindCall.parentPath.isCallExpression({
callee: bindCall.node
});
}
return false;
}
}
\ No newline at end of file
{
"_from": "@babel/helper-remap-async-to-generator@^7.7.0",
"_id": "@babel/helper-remap-async-to-generator@7.7.0",
"_inBundle": false,
"_integrity": "sha512-pHx7RN8X0UNHPB/fnuDnRXVZ316ZigkO8y8D835JlZ2SSdFKb6yH9MIYRU4fy/KPe5sPHDFOPvf8QLdbAGGiyw==",
"_location": "/@babel/helper-remap-async-to-generator",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-remap-async-to-generator@^7.7.0",
"name": "@babel/helper-remap-async-to-generator",
"escapedName": "@babel%2fhelper-remap-async-to-generator",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/plugin-proposal-async-generator-functions",
"/@babel/plugin-transform-async-to-generator"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.0.tgz",
"_shasum": "4d69ec653e8bff5bce62f5d33fc1508f223c75a7",
"_spec": "@babel/helper-remap-async-to-generator@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-proposal-async-generator-functions",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.7.0",
"@babel/helper-wrap-function": "^7.7.0",
"@babel/template": "^7.7.0",
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Helper function to remap async functions to generators",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-remap-async-to-generator",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/helper-replace-supers
> Helper function to replace supers
See our website [@babel/helper-replace-supers](https://babeljs.io/docs/en/next/babel-helper-replace-supers.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-replace-supers
```
or using yarn:
```sh
yarn add @babel/helper-replace-supers --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.environmentVisitor = void 0;
var _traverse = _interopRequireDefault(require("@babel/traverse"));
var _helperMemberExpressionToFunctions = _interopRequireDefault(require("@babel/helper-member-expression-to-functions"));
var _helperOptimiseCallExpression = _interopRequireDefault(require("@babel/helper-optimise-call-expression"));
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
objectRef = t.cloneNode(objectRef);
const targetRef = isStatic || isPrivateMethod ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
}
function skipAllButComputedKey(path) {
if (!path.node.computed) {
path.skip();
return;
}
const keys = t.VISITOR_KEYS[path.type];
for (const key of keys) {
if (key !== "key") path.skipKey(key);
}
}
const environmentVisitor = {
TypeAnnotation(path) {
path.skip();
},
Function(path) {
if (path.isMethod()) return;
if (path.isArrowFunctionExpression()) return;
path.skip();
},
"Method|ClassProperty|ClassPrivateProperty"(path) {
skipAllButComputedKey(path);
}
};
exports.environmentVisitor = environmentVisitor;
const visitor = _traverse.default.visitors.merge([environmentVisitor, {
Super(path, state) {
const {
node,
parentPath
} = path;
if (!parentPath.isMemberExpression({
object: node
})) return;
state.handle(parentPath);
}
}]);
const specHandlers = {
memoise(superMember, count) {
const {
scope,
node
} = superMember;
const {
computed,
property
} = node;
if (!computed) {
return;
}
const memo = scope.maybeGenerateMemoised(property);
if (!memo) {
return;
}
this.memoiser.set(property, memo, count);
},
prop(superMember) {
const {
computed,
property
} = superMember.node;
if (this.memoiser.has(property)) {
return t.cloneNode(this.memoiser.get(property));
}
if (computed) {
return t.cloneNode(property);
}
return t.stringLiteral(property.name);
},
get(superMember) {
return t.callExpression(this.file.addHelper("get"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod), this.prop(superMember), t.thisExpression()]);
},
set(superMember, value) {
return t.callExpression(this.file.addHelper("set"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod), this.prop(superMember), value, t.thisExpression(), t.booleanLiteral(superMember.isInStrictMode())]);
},
destructureSet(superMember) {
throw superMember.buildCodeFrameError(`Destructuring to a super field is not supported yet.`);
},
call(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args);
}
};
const looseHandlers = Object.assign({}, specHandlers, {
prop(superMember) {
const {
property
} = superMember.node;
if (this.memoiser.has(property)) {
return t.cloneNode(this.memoiser.get(property));
}
return t.cloneNode(property);
},
get(superMember) {
const {
isStatic,
superRef
} = this;
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
let object;
if (isStatic) {
object = superRef ? t.cloneNode(superRef) : t.memberExpression(t.identifier("Function"), t.identifier("prototype"));
} else {
object = superRef ? t.memberExpression(t.cloneNode(superRef), t.identifier("prototype")) : t.memberExpression(t.identifier("Object"), t.identifier("prototype"));
}
return t.memberExpression(object, prop, computed);
},
set(superMember, value) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return t.assignmentExpression("=", t.memberExpression(t.thisExpression(), prop, computed), value);
},
destructureSet(superMember) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return t.memberExpression(t.thisExpression(), prop, computed);
}
});
class ReplaceSupers {
constructor(opts) {
const path = opts.methodPath;
this.methodPath = path;
this.isStatic = path.isObjectMethod() || path.node.static;
this.isPrivateMethod = path.isPrivate() && path.isMethod();
this.file = opts.file;
this.superRef = opts.superRef;
this.isLoose = opts.isLoose;
this.opts = opts;
}
getObjectRef() {
return t.cloneNode(this.opts.objectRef || this.opts.getObjectRef());
}
replace() {
const handler = this.isLoose ? looseHandlers : specHandlers;
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
file: this.file,
isStatic: this.isStatic,
isPrivateMethod: this.isPrivateMethod,
getObjectRef: this.getObjectRef.bind(this),
superRef: this.superRef
}, handler));
}
}
exports.default = ReplaceSupers;
\ No newline at end of file
{
"_from": "@babel/helper-replace-supers@^7.7.0",
"_id": "@babel/helper-replace-supers@7.7.0",
"_inBundle": false,
"_integrity": "sha512-5ALYEul5V8xNdxEeWvRsBzLMxQksT7MaStpxjJf9KsnLxpAKBtfw5NeMKZJSYDa0lKdOcy0g+JT/f5mPSulUgg==",
"_location": "/@babel/helper-replace-supers",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-replace-supers@^7.7.0",
"name": "@babel/helper-replace-supers",
"escapedName": "@babel%2fhelper-replace-supers",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-create-class-features-plugin",
"/@babel/plugin-transform-classes",
"/@babel/plugin-transform-object-super"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.7.0.tgz",
"_shasum": "d5365c8667fe7cbd13b8ddddceb9bd7f2b387512",
"_spec": "@babel/helper-replace-supers@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-create-class-features-plugin",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-member-expression-to-functions": "^7.7.0",
"@babel/helper-optimise-call-expression": "^7.7.0",
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Helper function to replace supers",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-replace-supers",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/helper-simple-access
> Babel helper for ensuring that access to a given value is performed through simple accesses
See our website [@babel/helper-simple-access](https://babeljs.io/docs/en/next/babel-helper-simple-access.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-simple-access
```
or using yarn:
```sh
yarn add @babel/helper-simple-access --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = simplifyAccess;
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function simplifyAccess(path, bindingNames) {
path.traverse(simpleAssignmentVisitor, {
scope: path.scope,
bindingNames,
seen: new WeakSet()
});
}
const simpleAssignmentVisitor = {
UpdateExpression: {
exit(path) {
const {
scope,
bindingNames
} = this;
const arg = path.get("argument");
if (!arg.isIdentifier()) return;
const localName = arg.node.name;
if (!bindingNames.has(localName)) return;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) {
const operator = path.node.operator == "++" ? "+=" : "-=";
path.replaceWith(t.assignmentExpression(operator, arg.node, t.numericLiteral(1)));
} else if (path.node.prefix) {
path.replaceWith(t.assignmentExpression("=", t.identifier(localName), t.binaryExpression(path.node.operator[0], t.unaryExpression("+", arg.node), t.numericLiteral(1))));
} else {
const old = path.scope.generateUidIdentifierBasedOnNode(arg.node, "old");
const varName = old.name;
path.scope.push({
id: old
});
const binary = t.binaryExpression(path.node.operator[0], t.identifier(varName), t.numericLiteral(1));
path.replaceWith(t.sequenceExpression([t.assignmentExpression("=", t.identifier(varName), t.unaryExpression("+", arg.node)), t.assignmentExpression("=", t.cloneNode(arg.node), binary), t.identifier(varName)]));
}
}
},
AssignmentExpression: {
exit(path) {
const {
scope,
seen,
bindingNames
} = this;
if (path.node.operator === "=") return;
if (seen.has(path.node)) return;
seen.add(path.node);
const left = path.get("left");
if (!left.isIdentifier()) return;
const localName = left.node.name;
if (!bindingNames.has(localName)) return;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
path.node.right = t.binaryExpression(path.node.operator.slice(0, -1), t.cloneNode(path.node.left), path.node.right);
path.node.operator = "=";
}
}
};
\ No newline at end of file
{
"_from": "@babel/helper-simple-access@^7.7.0",
"_id": "@babel/helper-simple-access@7.7.0",
"_inBundle": false,
"_integrity": "sha512-AJ7IZD7Eem3zZRuj5JtzFAptBw7pMlS3y8Qv09vaBWoFsle0d1kAn5Wq6Q9MyBXITPOKnxwkZKoAm4bopmv26g==",
"_location": "/@babel/helper-simple-access",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-simple-access@^7.7.0",
"name": "@babel/helper-simple-access",
"escapedName": "@babel%2fhelper-simple-access",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-module-transforms",
"/@babel/plugin-transform-modules-commonjs"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.7.0.tgz",
"_shasum": "97a8b6c52105d76031b86237dc1852b44837243d",
"_spec": "@babel/helper-simple-access@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-module-transforms",
"author": {
"name": "Logan Smyth",
"email": "loganfsmyth@gmail.com"
},
"bundleDependencies": false,
"dependencies": {
"@babel/template": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-simple-access",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-simple-access"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @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
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = splitExportDeclaration;
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } 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.registerDeclaration(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;
}
\ No newline at end of file
{
"_from": "@babel/helper-split-export-declaration@^7.7.0",
"_id": "@babel/helper-split-export-declaration@7.7.0",
"_inBundle": false,
"_integrity": "sha512-HgYSI8rH08neWlAH3CcdkFg9qX9YsZysZI5GD8LjhQib/mM0jGOZOVkoUiiV2Hu978fRtjtsGsW6w0pKHUWtqA==",
"_location": "/@babel/helper-split-export-declaration",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-split-export-declaration@^7.7.0",
"name": "@babel/helper-split-export-declaration",
"escapedName": "@babel%2fhelper-split-export-declaration",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-create-class-features-plugin",
"/@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.7.0.tgz",
"_shasum": "1365e74ea6c614deeb56ebffabd71006a0eb2300",
"_spec": "@babel/helper-split-export-declaration@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\traverse",
"bundleDependencies": false,
"dependencies": {
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": ">",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-split-export-declaration",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment