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

first commit

parents
# @babel/plugin-proposal-async-generator-functions
> Turn async generator functions into ES2015 generators
See our website [@babel/plugin-proposal-async-generator-functions](https://babeljs.io/docs/en/next/babel-plugin-proposal-async-generator-functions.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-async-generator-functions
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-async-generator-functions --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _core = require("@babel/core");
const buildForAwait = (0, _core.template)(`
async function wrapper() {
var ITERATOR_COMPLETION = true;
var ITERATOR_HAD_ERROR_KEY = false;
var ITERATOR_ERROR_KEY;
try {
for (
var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;
(
STEP_KEY = await ITERATOR_KEY.next(),
ITERATOR_COMPLETION = STEP_KEY.done,
STEP_VALUE = await STEP_KEY.value,
!ITERATOR_COMPLETION
);
ITERATOR_COMPLETION = true) {
}
} catch (err) {
ITERATOR_HAD_ERROR_KEY = true;
ITERATOR_ERROR_KEY = err;
} finally {
try {
if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {
await ITERATOR_KEY.return();
}
} finally {
if (ITERATOR_HAD_ERROR_KEY) {
throw ITERATOR_ERROR_KEY;
}
}
}
}
`);
function _default(path, {
getAsyncIterator
}) {
const {
node,
scope,
parent
} = path;
const stepKey = scope.generateUidIdentifier("step");
const stepValue = scope.generateUidIdentifier("value");
const left = node.left;
let declar;
if (_core.types.isIdentifier(left) || _core.types.isPattern(left) || _core.types.isMemberExpression(left)) {
declar = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, stepValue));
} else if (_core.types.isVariableDeclaration(left)) {
declar = _core.types.variableDeclaration(left.kind, [_core.types.variableDeclarator(left.declarations[0].id, stepValue)]);
}
let template = buildForAwait({
ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
ITERATOR_KEY: scope.generateUidIdentifier("iterator"),
GET_ITERATOR: getAsyncIterator,
OBJECT: node.right,
STEP_VALUE: stepValue,
STEP_KEY: stepKey
});
template = template.body.body;
const isLabeledParent = _core.types.isLabeledStatement(parent);
const tryBody = template[3].block.body;
const loop = tryBody[0];
if (isLabeledParent) {
tryBody[0] = _core.types.labeledStatement(parent.label, loop);
}
return {
replaceParent: isLabeledParent,
node: template,
declar,
loop
};
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperRemapAsyncToGenerator = _interopRequireDefault(require("@babel/helper-remap-async-to-generator"));
var _pluginSyntaxAsyncGenerators = _interopRequireDefault(require("@babel/plugin-syntax-async-generators"));
var _core = require("@babel/core");
var _forAwait = _interopRequireDefault(require("./for-await"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);
const yieldStarVisitor = {
Function(path) {
path.skip();
},
YieldExpression({
node
}, state) {
if (!node.delegate) return;
const callee = state.addHelper("asyncGeneratorDelegate");
node.argument = _core.types.callExpression(callee, [_core.types.callExpression(state.addHelper("asyncIterator"), [node.argument]), state.addHelper("awaitAsyncGenerator")]);
}
};
const forAwaitVisitor = {
Function(path) {
path.skip();
},
ForOfStatement(path, {
file
}) {
const {
node
} = path;
if (!node.await) return;
const build = (0, _forAwait.default)(path, {
getAsyncIterator: file.addHelper("asyncIterator")
});
const {
declar,
loop
} = build;
const block = loop.body;
path.ensureBlock();
if (declar) {
block.body.push(declar);
}
block.body = block.body.concat(node.body.body);
_core.types.inherits(loop, node);
_core.types.inherits(loop.body, node.body);
if (build.replaceParent) {
path.parentPath.replaceWithMultiple(build.node);
} else {
path.replaceWithMultiple(build.node);
}
}
};
const visitor = {
Function(path, state) {
if (!path.node.async) return;
path.traverse(forAwaitVisitor, state);
if (!path.node.generator) return;
path.traverse(yieldStarVisitor, state);
(0, _helperRemapAsyncToGenerator.default)(path, {
wrapAsync: state.addHelper("wrapAsyncGenerator"),
wrapAwait: state.addHelper("awaitAsyncGenerator")
});
}
};
return {
name: "proposal-async-generator-functions",
inherits: _pluginSyntaxAsyncGenerators.default,
visitor: {
Program(path, state) {
path.traverse(visitor, state);
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-proposal-async-generator-functions@^7.2.0",
"_id": "@babel/plugin-proposal-async-generator-functions@7.7.0",
"_inBundle": false,
"_integrity": "sha512-ot/EZVvf3mXtZq0Pd0+tSOfGWMizqmOohXmNZg6LNFjHOV+wOPv7BvVYh8oPR8LhpIP3ye8nNooKL50YRWxpYA==",
"_location": "/@babel/plugin-proposal-async-generator-functions",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-proposal-async-generator-functions@^7.2.0",
"name": "@babel/plugin-proposal-async-generator-functions",
"escapedName": "@babel%2fplugin-proposal-async-generator-functions",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.0.tgz",
"_shasum": "83ef2d6044496b4c15d8b4904e2219e6dccc6971",
"_spec": "@babel/plugin-proposal-async-generator-functions@^7.2.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/helper-remap-async-to-generator": "^7.7.0",
"@babel/plugin-syntax-async-generators": "^7.2.0"
},
"deprecated": false,
"description": "Turn async generator functions into ES2015 generators",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-proposal-async-generator-functions",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-async-generator-functions"
},
"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/plugin-proposal-class-properties
> This plugin transforms static class properties as well as properties declared with the property initializer syntax
See our website [@babel/plugin-proposal-class-properties](https://babeljs.io/docs/en/next/babel-plugin-proposal-class-properties.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-class-properties
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-class-properties --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
var _default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
name: "proposal-class-properties",
feature: _helperCreateClassFeaturesPlugin.FEATURES.fields,
loose: options.loose,
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("classProperties", "classPrivateProperties");
}
});
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-proposal-class-properties@^7.0.0",
"_id": "@babel/plugin-proposal-class-properties@7.7.0",
"_inBundle": false,
"_integrity": "sha512-tufDcFA1Vj+eWvwHN+jvMN6QsV5o+vUlytNKrbMiCeDL0F2j92RURzUsUMWE5EJkLyWxjdUslCsMQa9FWth16A==",
"_location": "/@babel/plugin-proposal-class-properties",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-proposal-class-properties@^7.0.0",
"name": "@babel/plugin-proposal-class-properties",
"escapedName": "@babel%2fplugin-proposal-class-properties",
"scope": "@babel",
"rawSpec": "^7.0.0",
"saveSpec": null,
"fetchSpec": "^7.0.0"
},
"_requiredBy": [
"/@vue/babel-preset-app"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.0.tgz",
"_shasum": "ac54e728ecf81d90e8f4d2a9c05a890457107917",
"_spec": "@babel/plugin-proposal-class-properties@^7.0.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@vue\\babel-preset-app",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0"
},
"deprecated": false,
"description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-proposal-class-properties",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties"
},
"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/plugin-proposal-decorators
> Compile class and object decorators to ES5
See our website [@babel/plugin-proposal-decorators](https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-decorators
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-decorators --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxDecorators = _interopRequireDefault(require("@babel/plugin-syntax-decorators"));
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
var _transformerLegacy = _interopRequireDefault(require("./transformer-legacy"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
const {
legacy = false
} = options;
if (typeof legacy !== "boolean") {
throw new Error("'legacy' must be a boolean.");
}
const {
decoratorsBeforeExport
} = options;
if (decoratorsBeforeExport === undefined) {
if (!legacy) {
throw new Error("The decorators plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you want to use the legacy" + " decorators semantics, you can set the 'legacy: true' option.");
}
} else {
if (legacy) {
throw new Error("'decoratorsBeforeExport' can't be used with legacy decorators.");
}
if (typeof decoratorsBeforeExport !== "boolean") {
throw new Error("'decoratorsBeforeExport' must be a boolean.");
}
}
if (legacy) {
return {
name: "proposal-decorators",
inherits: _pluginSyntaxDecorators.default,
manipulateOptions({
generatorOpts
}) {
generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
},
visitor: _transformerLegacy.default
};
}
return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
name: "proposal-decorators",
feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
manipulateOptions({
generatorOpts,
parserOpts
}) {
parserOpts.plugins.push(["decorators", {
decoratorsBeforeExport
}]);
generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
}
});
});
exports.default = _default;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _core = require("@babel/core");
const buildClassDecorator = (0, _core.template)(`
DECORATOR(CLASS_REF = INNER) || CLASS_REF;
`);
const buildClassPrototype = (0, _core.template)(`
CLASS_REF.prototype;
`);
const buildGetDescriptor = (0, _core.template)(`
Object.getOwnPropertyDescriptor(TARGET, PROPERTY);
`);
const buildGetObjectInitializer = (0, _core.template)(`
(TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {
enumerable: true,
configurable: true,
writable: true,
initializer: function(){
return TEMP;
}
})
`);
const WARNING_CALLS = new WeakSet();
function applyEnsureOrdering(path) {
const decorators = (path.isClass() ? [path].concat(path.get("body.body")) : path.get("properties")).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []);
const identDecorators = decorators.filter(decorator => !_core.types.isIdentifier(decorator.expression));
if (identDecorators.length === 0) return;
return _core.types.sequenceExpression(identDecorators.map(decorator => {
const expression = decorator.expression;
const id = decorator.expression = path.scope.generateDeclaredUidIdentifier("dec");
return _core.types.assignmentExpression("=", id, expression);
}).concat([path.node]));
}
function applyClassDecorators(classPath) {
if (!hasClassDecorators(classPath.node)) return;
const decorators = classPath.node.decorators || [];
classPath.node.decorators = null;
const name = classPath.scope.generateDeclaredUidIdentifier("class");
return decorators.map(dec => dec.expression).reverse().reduce(function (acc, decorator) {
return buildClassDecorator({
CLASS_REF: _core.types.cloneNode(name),
DECORATOR: _core.types.cloneNode(decorator),
INNER: acc
}).expression;
}, classPath.node);
}
function hasClassDecorators(classNode) {
return !!(classNode.decorators && classNode.decorators.length);
}
function applyMethodDecorators(path, state) {
if (!hasMethodDecorators(path.node.body.body)) return;
return applyTargetDecorators(path, state, path.node.body.body);
}
function hasMethodDecorators(body) {
return body.some(node => node.decorators && node.decorators.length);
}
function applyObjectDecorators(path, state) {
if (!hasMethodDecorators(path.node.properties)) return;
return applyTargetDecorators(path, state, path.node.properties);
}
function applyTargetDecorators(path, state, decoratedProps) {
const name = path.scope.generateDeclaredUidIdentifier(path.isClass() ? "class" : "obj");
const exprs = decoratedProps.reduce(function (acc, node) {
const decorators = node.decorators || [];
node.decorators = null;
if (decorators.length === 0) return acc;
if (node.computed) {
throw path.buildCodeFrameError("Computed method/property decorators are not yet supported.");
}
const property = _core.types.isLiteral(node.key) ? node.key : _core.types.stringLiteral(node.key.name);
const target = path.isClass() && !node.static ? buildClassPrototype({
CLASS_REF: name
}).expression : name;
if (_core.types.isClassProperty(node, {
static: false
})) {
const descriptor = path.scope.generateDeclaredUidIdentifier("descriptor");
const initializer = node.value ? _core.types.functionExpression(null, [], _core.types.blockStatement([_core.types.returnStatement(node.value)])) : _core.types.nullLiteral();
node.value = _core.types.callExpression(state.addHelper("initializerWarningHelper"), [descriptor, _core.types.thisExpression()]);
WARNING_CALLS.add(node.value);
acc = acc.concat([_core.types.assignmentExpression("=", descriptor, _core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier("configurable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("enumerable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("writable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("initializer"), initializer)])]))]);
} else {
acc = acc.concat(_core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.isObjectProperty(node) || _core.types.isClassProperty(node, {
static: true
}) ? buildGetObjectInitializer({
TEMP: path.scope.generateDeclaredUidIdentifier("init"),
TARGET: _core.types.cloneNode(target),
PROPERTY: _core.types.cloneNode(property)
}).expression : buildGetDescriptor({
TARGET: _core.types.cloneNode(target),
PROPERTY: _core.types.cloneNode(property)
}).expression, _core.types.cloneNode(target)]));
}
return acc;
}, []);
return _core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(name), path.node), _core.types.sequenceExpression(exprs), _core.types.cloneNode(name)]);
}
function decoratedClassToExpression({
node,
scope
}) {
if (!hasClassDecorators(node) && !hasMethodDecorators(node.body.body)) {
return;
}
const ref = node.id ? _core.types.cloneNode(node.id) : scope.generateUidIdentifier("class");
return _core.types.variableDeclaration("let", [_core.types.variableDeclarator(ref, _core.types.toExpression(node))]);
}
var _default = {
ExportDefaultDeclaration(path) {
const decl = path.get("declaration");
if (!decl.isClassDeclaration()) return;
const replacement = decoratedClassToExpression(decl);
if (replacement) {
const [varDeclPath] = path.replaceWithMultiple([replacement, _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(replacement.declarations[0].id), _core.types.identifier("default"))])]);
if (!decl.node.id) {
path.scope.registerDeclaration(varDeclPath);
}
}
},
ClassDeclaration(path) {
const replacement = decoratedClassToExpression(path);
if (replacement) {
path.replaceWith(replacement);
}
},
ClassExpression(path, state) {
const decoratedClass = applyEnsureOrdering(path) || applyClassDecorators(path, state) || applyMethodDecorators(path, state);
if (decoratedClass) path.replaceWith(decoratedClass);
},
ObjectExpression(path, state) {
const decoratedObject = applyEnsureOrdering(path) || applyObjectDecorators(path, state);
if (decoratedObject) path.replaceWith(decoratedObject);
},
AssignmentExpression(path, state) {
if (!WARNING_CALLS.has(path.node.right)) return;
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("left.object").node), _core.types.stringLiteral(path.get("left.property").node.name || path.get("left.property").node.value), _core.types.cloneNode(path.get("right.arguments")[0].node), _core.types.cloneNode(path.get("right.arguments")[1].node)]));
},
CallExpression(path, state) {
if (path.node.arguments.length !== 3) return;
if (!WARNING_CALLS.has(path.node.arguments[2])) return;
if (path.node.callee.name !== state.addHelper("defineProperty").name) {
return;
}
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("arguments")[0].node), _core.types.cloneNode(path.get("arguments")[1].node), _core.types.cloneNode(path.get("arguments.2.arguments")[0].node), _core.types.cloneNode(path.get("arguments.2.arguments")[1].node)]));
}
};
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-proposal-decorators@^7.1.0",
"_id": "@babel/plugin-proposal-decorators@7.7.0",
"_inBundle": false,
"_integrity": "sha512-dMCDKmbYFQQTn1+VJjl5hbqlweuHl5oDeMU9B1Q7oAWi0mHxjQQDHdJIK6iW76NE1KJT3zA6dDU3weR1WT5D4A==",
"_location": "/@babel/plugin-proposal-decorators",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-proposal-decorators@^7.1.0",
"name": "@babel/plugin-proposal-decorators",
"escapedName": "@babel%2fplugin-proposal-decorators",
"scope": "@babel",
"rawSpec": "^7.1.0",
"saveSpec": null,
"fetchSpec": "^7.1.0"
},
"_requiredBy": [
"/@vue/babel-preset-app"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.7.0.tgz",
"_shasum": "d386a45730a4eb8c03e23a80b6d3dbefd761c9c9",
"_spec": "@babel/plugin-proposal-decorators@^7.1.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@vue\\babel-preset-app",
"author": {
"name": "Logan Smyth",
"email": "loganfsmyth@gmail.com"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-decorators": "^7.2.0"
},
"deprecated": false,
"description": "Compile class and object decorators to ES5",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel",
"babel-plugin",
"decorators"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-proposal-decorators",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-decorators"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-2018 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/plugin-proposal-json-strings
> Escape U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings
See our website [@babel/plugin-proposal-json-strings](https://babeljs.io/docs/en/next/babel-plugin-proposal-json-strings.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-json-strings
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-json-strings --dev
```
"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 _pluginSyntaxJsonStrings() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-json-strings"));
_pluginSyntaxJsonStrings = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
const regex = /(\\*)([\u2028\u2029])/g;
function replace(match, escapes, separator) {
const isEscaped = escapes.length % 2 === 1;
if (isEscaped) return match;
return `${escapes}\\u${separator.charCodeAt(0).toString(16)}`;
}
return {
name: "proposal-json-strings",
inherits: _pluginSyntaxJsonStrings().default,
visitor: {
"DirectiveLiteral|StringLiteral"({
node
}) {
const {
extra
} = node;
if (!extra || !extra.raw) return;
extra.raw = extra.raw.replace(regex, replace);
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-proposal-json-strings@^7.2.0",
"_id": "@babel/plugin-proposal-json-strings@7.2.0",
"_inBundle": false,
"_integrity": "sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg==",
"_location": "/@babel/plugin-proposal-json-strings",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-proposal-json-strings@^7.2.0",
"name": "@babel/plugin-proposal-json-strings",
"escapedName": "@babel%2fplugin-proposal-json-strings",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz",
"_shasum": "568ecc446c6148ae6b267f02551130891e29f317",
"_spec": "@babel/plugin-proposal-json-strings@^7.2.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-json-strings": "^7.2.0"
},
"deprecated": false,
"description": "Escape U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings",
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-proposal-json-strings",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-json-strings"
},
"version": "7.2.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/plugin-proposal-object-rest-spread
> Compile object rest and spread to ES5
See our website [@babel/plugin-proposal-object-rest-spread](https://babeljs.io/docs/en/next/babel-plugin-proposal-object-rest-spread.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-object-rest-spread
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-object-rest-spread --dev
```
"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 _pluginSyntaxObjectRestSpread() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-object-rest-spread"));
_pluginSyntaxObjectRestSpread = 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 }; }
const ZERO_REFS = (() => {
const node = _core().types.identifier("a");
const property = _core().types.objectProperty(_core().types.identifier("key"), node);
const pattern = _core().types.objectPattern([property]);
return _core().types.isReferenced(node, property, pattern) ? 1 : 0;
})();
var _default = (0, _helperPluginUtils().declare)((api, opts) => {
api.assertVersion(7);
const {
useBuiltIns = false,
loose = false
} = opts;
if (typeof loose !== "boolean") {
throw new Error(".loose must be a boolean, or undefined");
}
function getExtendsHelper(file) {
return useBuiltIns ? _core().types.memberExpression(_core().types.identifier("Object"), _core().types.identifier("assign")) : file.addHelper("extends");
}
function hasRestElement(path) {
let foundRestElement = false;
visitRestElements(path, restElement => {
foundRestElement = true;
restElement.stop();
});
return foundRestElement;
}
function hasObjectPatternRestElement(path) {
let foundRestElement = false;
visitRestElements(path, restElement => {
if (restElement.parentPath.isObjectPattern()) {
foundRestElement = true;
restElement.stop();
}
});
return foundRestElement;
}
function visitRestElements(path, visitor) {
path.traverse({
Expression(path) {
const parentType = path.parent.type;
if (parentType === "AssignmentPattern" && path.key === "right" || parentType === "ObjectProperty" && path.parent.computed && path.key === "key") {
path.skip();
}
},
RestElement: visitor
});
}
function hasSpread(node) {
for (const prop of node.properties) {
if (_core().types.isSpreadElement(prop)) {
return true;
}
}
return false;
}
function extractNormalizedKeys(path) {
const props = path.node.properties;
const keys = [];
let allLiteral = true;
for (const prop of props) {
if (_core().types.isIdentifier(prop.key) && !prop.computed) {
keys.push(_core().types.stringLiteral(prop.key.name));
} else if (_core().types.isTemplateLiteral(prop.key)) {
keys.push(_core().types.cloneNode(prop.key));
} else if (_core().types.isLiteral(prop.key)) {
keys.push(_core().types.stringLiteral(String(prop.key.value)));
} else {
keys.push(_core().types.cloneNode(prop.key));
allLiteral = false;
}
}
return {
keys,
allLiteral
};
}
function replaceImpureComputedKeys(path) {
const impureComputedPropertyDeclarators = [];
for (const propPath of path.get("properties")) {
const key = propPath.get("key");
if (propPath.node.computed && !key.isPure()) {
const name = path.scope.generateUidBasedOnNode(key.node);
const declarator = _core().types.variableDeclarator(_core().types.identifier(name), key.node);
impureComputedPropertyDeclarators.push(declarator);
key.replaceWith(_core().types.identifier(name));
}
}
return impureComputedPropertyDeclarators;
}
function removeUnusedExcludedKeys(path) {
const bindings = path.getOuterBindingIdentifierPaths();
Object.keys(bindings).forEach(bindingName => {
const bindingParentPath = bindings[bindingName].parentPath;
if (path.scope.getBinding(bindingName).references > ZERO_REFS || !bindingParentPath.isObjectProperty()) {
return;
}
bindingParentPath.remove();
});
}
function createObjectSpread(path, file, objRef) {
const props = path.get("properties");
const last = props[props.length - 1];
_core().types.assertRestElement(last.node);
const restElement = _core().types.cloneNode(last.node);
last.remove();
const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path);
const {
keys,
allLiteral
} = extractNormalizedKeys(path);
if (keys.length === 0) {
return [impureComputedPropertyDeclarators, restElement.argument, _core().types.callExpression(getExtendsHelper(file), [_core().types.objectExpression([]), _core().types.cloneNode(objRef)])];
}
let keyExpression;
if (!allLiteral) {
keyExpression = _core().types.callExpression(_core().types.memberExpression(_core().types.arrayExpression(keys), _core().types.identifier("map")), [file.addHelper("toPropertyKey")]);
} else {
keyExpression = _core().types.arrayExpression(keys);
}
return [impureComputedPropertyDeclarators, restElement.argument, _core().types.callExpression(file.addHelper(`objectWithoutProperties${loose ? "Loose" : ""}`), [_core().types.cloneNode(objRef), keyExpression])];
}
function replaceRestElement(parentPath, paramPath) {
if (paramPath.isAssignmentPattern()) {
replaceRestElement(parentPath, paramPath.get("left"));
return;
}
if (paramPath.isArrayPattern() && hasRestElement(paramPath)) {
const elements = paramPath.get("elements");
for (let i = 0; i < elements.length; i++) {
replaceRestElement(parentPath, elements[i]);
}
}
if (paramPath.isObjectPattern() && hasRestElement(paramPath)) {
const uid = parentPath.scope.generateUidIdentifier("ref");
const declar = _core().types.variableDeclaration("let", [_core().types.variableDeclarator(paramPath.node, uid)]);
parentPath.ensureBlock();
parentPath.get("body").unshiftContainer("body", declar);
paramPath.replaceWith(_core().types.cloneNode(uid));
}
}
return {
name: "proposal-object-rest-spread",
inherits: _pluginSyntaxObjectRestSpread().default,
visitor: {
Function(path) {
const params = path.get("params");
for (let i = params.length - 1; i >= 0; i--) {
replaceRestElement(params[i].parentPath, params[i]);
}
},
VariableDeclarator(path, file) {
if (!path.get("id").isObjectPattern()) {
return;
}
let insertionPath = path;
const originalPath = path;
visitRestElements(path.get("id"), path => {
if (!path.parentPath.isObjectPattern()) {
return;
}
if (originalPath.node.id.properties.length > 1 && !_core().types.isIdentifier(originalPath.node.init)) {
const initRef = path.scope.generateUidIdentifierBasedOnNode(originalPath.node.init, "ref");
originalPath.insertBefore(_core().types.variableDeclarator(initRef, originalPath.node.init));
originalPath.replaceWith(_core().types.variableDeclarator(originalPath.node.id, _core().types.cloneNode(initRef)));
return;
}
let ref = originalPath.node.init;
const refPropertyPath = [];
let kind;
path.findParent(path => {
if (path.isObjectProperty()) {
refPropertyPath.unshift(path.node.key.name);
} else if (path.isVariableDeclarator()) {
kind = path.parentPath.node.kind;
return true;
}
});
if (refPropertyPath.length) {
refPropertyPath.forEach(prop => {
ref = _core().types.memberExpression(ref, _core().types.identifier(prop));
});
}
const objectPatternPath = path.findParent(path => path.isObjectPattern());
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectSpread(objectPatternPath, file, ref);
if (loose) {
removeUnusedExcludedKeys(objectPatternPath);
}
_core().types.assertIdentifier(argument);
insertionPath.insertBefore(impureComputedPropertyDeclarators);
insertionPath.insertAfter(_core().types.variableDeclarator(argument, callExpression));
insertionPath = insertionPath.getSibling(insertionPath.key + 1);
path.scope.registerBinding(kind, insertionPath);
if (objectPatternPath.node.properties.length === 0) {
objectPatternPath.findParent(path => path.isObjectProperty() || path.isVariableDeclarator()).remove();
}
});
},
ExportNamedDeclaration(path) {
const declaration = path.get("declaration");
if (!declaration.isVariableDeclaration()) return;
const hasRest = declaration.get("declarations").some(path => hasRestElement(path.get("id")));
if (!hasRest) return;
const specifiers = [];
for (const name of Object.keys(path.getOuterBindingIdentifiers(path))) {
specifiers.push(_core().types.exportSpecifier(_core().types.identifier(name), _core().types.identifier(name)));
}
path.replaceWith(declaration.node);
path.insertAfter(_core().types.exportNamedDeclaration(null, specifiers));
},
CatchClause(path) {
const paramPath = path.get("param");
replaceRestElement(paramPath.parentPath, paramPath);
},
AssignmentExpression(path, file) {
const leftPath = path.get("left");
if (leftPath.isObjectPattern() && hasRestElement(leftPath)) {
const nodes = [];
const refName = path.scope.generateUidBasedOnNode(path.node.right, "ref");
nodes.push(_core().types.variableDeclaration("var", [_core().types.variableDeclarator(_core().types.identifier(refName), path.node.right)]));
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectSpread(leftPath, file, _core().types.identifier(refName));
if (impureComputedPropertyDeclarators.length > 0) {
nodes.push(_core().types.variableDeclaration("var", impureComputedPropertyDeclarators));
}
const nodeWithoutSpread = _core().types.cloneNode(path.node);
nodeWithoutSpread.right = _core().types.identifier(refName);
nodes.push(_core().types.expressionStatement(nodeWithoutSpread));
nodes.push(_core().types.toStatement(_core().types.assignmentExpression("=", argument, callExpression)));
nodes.push(_core().types.expressionStatement(_core().types.identifier(refName)));
path.replaceWithMultiple(nodes);
}
},
ForXStatement(path) {
const {
node,
scope
} = path;
const leftPath = path.get("left");
const left = node.left;
if (!hasObjectPatternRestElement(leftPath)) {
return;
}
if (!_core().types.isVariableDeclaration(left)) {
const temp = scope.generateUidIdentifier("ref");
node.left = _core().types.variableDeclaration("var", [_core().types.variableDeclarator(temp)]);
path.ensureBlock();
if (node.body.body.length === 0 && path.isCompletionRecord()) {
node.body.body.unshift(_core().types.expressionStatement(scope.buildUndefinedNode()));
}
node.body.body.unshift(_core().types.expressionStatement(_core().types.assignmentExpression("=", left, _core().types.cloneNode(temp))));
} else {
const pattern = left.declarations[0].id;
const key = scope.generateUidIdentifier("ref");
node.left = _core().types.variableDeclaration(left.kind, [_core().types.variableDeclarator(key, null)]);
path.ensureBlock();
node.body.body.unshift(_core().types.variableDeclaration(node.left.kind, [_core().types.variableDeclarator(pattern, _core().types.cloneNode(key))]));
}
},
ArrayPattern(path) {
const objectPatterns = [];
visitRestElements(path, path => {
if (!path.parentPath.isObjectPattern()) {
return;
}
const objectPattern = path.parentPath;
const uid = path.scope.generateUidIdentifier("ref");
objectPatterns.push(_core().types.variableDeclarator(objectPattern.node, uid));
objectPattern.replaceWith(_core().types.cloneNode(uid));
path.skip();
});
if (objectPatterns.length > 0) {
const statementPath = path.getStatementParent();
statementPath.insertAfter(_core().types.variableDeclaration(statementPath.node.kind || "var", objectPatterns));
}
},
ObjectExpression(path, file) {
if (!hasSpread(path.node)) return;
const args = [];
let props = [];
function push() {
args.push(_core().types.objectExpression(props));
props = [];
}
for (const prop of path.node.properties) {
if (_core().types.isSpreadElement(prop)) {
push();
args.push(prop.argument);
} else {
props.push(prop);
}
}
if (props.length) {
push();
}
let helper;
if (loose) {
helper = getExtendsHelper(file);
} else {
try {
helper = file.addHelper("objectSpread2");
} catch (_unused) {
this.file.declarations["objectSpread2"] = null;
helper = file.addHelper("objectSpread");
}
}
path.replaceWith(_core().types.callExpression(helper, args));
}
}
};
});
exports.default = _default;
\ No newline at end of file
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