Commit 2101a218 authored by Alfakhori's avatar Alfakhori
Browse files

Merge branch 'Rosenstein' into 'master'

update some ui

See merge request !1
parents bf137ad8 91e89eab
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = convertFunctionRest;
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
const buildRest = (0, _core().template)(`
for (var LEN = ARGUMENTS.length,
ARRAY = new Array(ARRAY_LEN),
KEY = START;
KEY < LEN;
KEY++) {
ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];
}
`);
const restIndex = (0, _core().template)(`
(INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]
`);
const restIndexImpure = (0, _core().template)(`
REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]
`);
const restLength = (0, _core().template)(`
ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET
`);
function referencesRest(path, state) {
if (path.node.name === state.name) {
return path.scope.bindingIdentifierEquals(state.name, state.outerBinding);
}
return false;
}
const memberExpressionOptimisationVisitor = {
Scope(path, state) {
if (!path.scope.bindingIdentifierEquals(state.name, state.outerBinding)) {
path.skip();
}
},
Flow(path) {
if (path.isTypeCastExpression()) return;
path.skip();
},
Function(path, state) {
const oldNoOptimise = state.noOptimise;
state.noOptimise = true;
path.traverse(memberExpressionOptimisationVisitor, state);
state.noOptimise = oldNoOptimise;
path.skip();
},
ReferencedIdentifier(path, state) {
const {
node
} = path;
if (node.name === "arguments") {
state.deopted = true;
}
if (!referencesRest(path, state)) return;
if (state.noOptimise) {
state.deopted = true;
} else {
const {
parentPath
} = path;
if (parentPath.listKey === "params" && parentPath.key < state.offset) {
return;
}
if (parentPath.isMemberExpression({
object: node
})) {
const grandparentPath = parentPath.parentPath;
const argsOptEligible = !state.deopted && !(grandparentPath.isAssignmentExpression() && parentPath.node === grandparentPath.node.left || grandparentPath.isLVal() || grandparentPath.isForXStatement() || grandparentPath.isUpdateExpression() || grandparentPath.isUnaryExpression({
operator: "delete"
}) || (grandparentPath.isCallExpression() || grandparentPath.isNewExpression()) && parentPath.node === grandparentPath.node.callee);
if (argsOptEligible) {
if (parentPath.node.computed) {
if (parentPath.get("property").isBaseType("number")) {
state.candidates.push({
cause: "indexGetter",
path
});
return;
}
} else if (parentPath.node.property.name === "length") {
state.candidates.push({
cause: "lengthGetter",
path
});
return;
}
}
}
if (state.offset === 0 && parentPath.isSpreadElement()) {
const call = parentPath.parentPath;
if (call.isCallExpression() && call.node.arguments.length === 1) {
state.candidates.push({
cause: "argSpread",
path
});
return;
}
}
state.references.push(path);
}
},
BindingIdentifier(path, state) {
if (referencesRest(path, state)) {
state.deopted = true;
}
}
};
function hasRest(node) {
const length = node.params.length;
return length > 0 && _core().types.isRestElement(node.params[length - 1]);
}
function optimiseIndexGetter(path, argsId, offset) {
const offsetLiteral = _core().types.numericLiteral(offset);
let index;
if (_core().types.isNumericLiteral(path.parent.property)) {
index = _core().types.numericLiteral(path.parent.property.value + offset);
} else if (offset === 0) {
index = path.parent.property;
} else {
index = _core().types.binaryExpression("+", path.parent.property, _core().types.cloneNode(offsetLiteral));
}
const {
scope
} = path;
if (!scope.isPure(index)) {
const temp = scope.generateUidIdentifierBasedOnNode(index);
scope.push({
id: temp,
kind: "var"
});
path.parentPath.replaceWith(restIndexImpure({
ARGUMENTS: argsId,
OFFSET: offsetLiteral,
INDEX: index,
REF: _core().types.cloneNode(temp)
}));
} else {
const parentPath = path.parentPath;
parentPath.replaceWith(restIndex({
ARGUMENTS: argsId,
OFFSET: offsetLiteral,
INDEX: index
}));
const offsetTestPath = parentPath.get("test").get("left");
const valRes = offsetTestPath.evaluate();
if (valRes.confident) {
if (valRes.value === true) {
parentPath.replaceWith(parentPath.scope.buildUndefinedNode());
} else {
parentPath.get("test").replaceWith(parentPath.get("test").get("right"));
}
}
}
}
function optimiseLengthGetter(path, argsId, offset) {
if (offset) {
path.parentPath.replaceWith(restLength({
ARGUMENTS: argsId,
OFFSET: _core().types.numericLiteral(offset)
}));
} else {
path.replaceWith(argsId);
}
}
function convertFunctionRest(path) {
const {
node,
scope
} = path;
if (!hasRest(node)) return false;
let rest = node.params.pop().argument;
const argsId = _core().types.identifier("arguments");
if (_core().types.isPattern(rest)) {
const pattern = rest;
rest = scope.generateUidIdentifier("ref");
const declar = _core().types.variableDeclaration("let", [_core().types.variableDeclarator(pattern, rest)]);
node.body.body.unshift(declar);
}
const state = {
references: [],
offset: node.params.length,
argumentsNode: argsId,
outerBinding: scope.getBindingIdentifier(rest.name),
candidates: [],
name: rest.name,
deopted: false
};
path.traverse(memberExpressionOptimisationVisitor, state);
if (!state.deopted && !state.references.length) {
for (const _ref of state.candidates) {
const {
path,
cause
} = _ref;
const clonedArgsId = _core().types.cloneNode(argsId);
switch (cause) {
case "indexGetter":
optimiseIndexGetter(path, clonedArgsId, state.offset);
break;
case "lengthGetter":
optimiseLengthGetter(path, clonedArgsId, state.offset);
break;
default:
path.replaceWith(clonedArgsId);
}
}
return true;
}
state.references = state.references.concat(state.candidates.map(({
path
}) => path));
const start = _core().types.numericLiteral(node.params.length);
const key = scope.generateUidIdentifier("key");
const len = scope.generateUidIdentifier("len");
let arrKey, arrLen;
if (node.params.length) {
arrKey = _core().types.binaryExpression("-", _core().types.cloneNode(key), _core().types.cloneNode(start));
arrLen = _core().types.conditionalExpression(_core().types.binaryExpression(">", _core().types.cloneNode(len), _core().types.cloneNode(start)), _core().types.binaryExpression("-", _core().types.cloneNode(len), _core().types.cloneNode(start)), _core().types.numericLiteral(0));
} else {
arrKey = _core().types.identifier(key.name);
arrLen = _core().types.identifier(len.name);
}
const loop = buildRest({
ARGUMENTS: argsId,
ARRAY_KEY: arrKey,
ARRAY_LEN: arrLen,
START: start,
ARRAY: rest,
KEY: key,
LEN: len
});
if (state.deopted) {
node.body.body.unshift(loop);
} else {
let target = path.getEarliestCommonAncestorFrom(state.references).getStatementParent();
target.findParent(path => {
if (path.isLoop()) {
target = path;
} else {
return path.isFunction();
}
});
target.insertBefore(loop);
}
return true;
}
\ No newline at end of file
{
"_from": "@babel/plugin-transform-parameters@^7.2.0",
"_id": "@babel/plugin-transform-parameters@7.4.4",
"_inBundle": false,
"_integrity": "sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==",
"_location": "/@babel/plugin-transform-parameters",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-parameters@^7.2.0",
"name": "@babel/plugin-transform-parameters",
"escapedName": "@babel%2fplugin-transform-parameters",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz",
"_shasum": "7556cf03f318bd2719fe4c922d2d808be5571e16",
"_spec": "@babel/plugin-transform-parameters@^7.2.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-call-delegate": "^7.4.4",
"@babel/helper-get-function-arity": "^7.0.0",
"@babel/helper-plugin-utils": "^7.0.0"
},
"deprecated": false,
"description": "Compile ES2015 default and rest parameters to ES5",
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-parameters",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-parameters"
},
"version": "7.4.4"
}
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-transform-regenerator
> Explode async and generator functions into a state machine.
See our website [@babel/plugin-transform-regenerator](https://babeljs.io/docs/en/next/babel-plugin-transform-regenerator.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-regenerator
```
or using yarn:
```sh
yarn add @babel/plugin-transform-regenerator --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _regeneratorTransform.default;
}
});
var _regeneratorTransform = _interopRequireDefault(require("regenerator-transform"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
\ No newline at end of file
{
"_from": "@babel/plugin-transform-regenerator@^7.3.4",
"_id": "@babel/plugin-transform-regenerator@7.7.0",
"_inBundle": false,
"_integrity": "sha512-AXmvnC+0wuj/cFkkS/HFHIojxH3ffSXE+ttulrqWjZZRaUOonfJc60e1wSNT4rV8tIunvu/R3wCp71/tLAa9xg==",
"_location": "/@babel/plugin-transform-regenerator",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-regenerator@^7.3.4",
"name": "@babel/plugin-transform-regenerator",
"escapedName": "@babel%2fplugin-transform-regenerator",
"scope": "@babel",
"rawSpec": "^7.3.4",
"saveSpec": null,
"fetchSpec": "^7.3.4"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.0.tgz",
"_shasum": "f1b20b535e7716b622c99e989259d7dd942dd9cc",
"_spec": "@babel/plugin-transform-regenerator@^7.3.4",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"author": {
"name": "Ben Newman",
"email": "bn@cs.stanford.edu"
},
"bundleDependencies": false,
"dependencies": {
"regenerator-transform": "^0.14.0"
},
"deprecated": false,
"description": "Explode async and generator functions into a state machine.",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-regenerator",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator"
},
"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-transform-runtime
> Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
See our website [@babel/plugin-transform-runtime](https://babeljs.io/docs/en/next/babel-plugin-transform-runtime.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-runtime
```
or using yarn:
```sh
yarn add @babel/plugin-transform-runtime --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hasMinVersion = hasMinVersion;
exports.typeAnnotationToString = typeAnnotationToString;
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = 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 }; }
function hasMinVersion(minVersion, runtimeVersion) {
if (!runtimeVersion) return true;
if (_semver().default.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`;
return !_semver().default.intersects(`<${minVersion}`, runtimeVersion) && !_semver().default.intersects(`>=8.0.0`, runtimeVersion);
}
function typeAnnotationToString(node) {
switch (node.type) {
case "GenericTypeAnnotation":
if (_core().types.isIdentifier(node.id, {
name: "Array"
})) return "array";
break;
case "StringTypeAnnotation":
return "string";
}
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _resolve() {
const data = _interopRequireDefault(require("resolve"));
_resolve = function () {
return data;
};
return data;
}
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
return data;
};
return data;
}
function _helperModuleImports() {
const data = require("@babel/helper-module-imports");
_helperModuleImports = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
var _runtimeCorejs2Definitions = _interopRequireDefault(require("./runtime-corejs2-definitions"));
var _runtimeCorejs3Definitions = _interopRequireDefault(require("./runtime-corejs3-definitions"));
var _helpers = require("./helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveAbsoluteRuntime(moduleName, dirname) {
try {
return _path().default.dirname(_resolve().default.sync(`${moduleName}/package.json`, {
basedir: dirname
}));
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err;
throw Object.assign(new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), {
code: "BABEL_RUNTIME_NOT_FOUND",
runtime: moduleName,
dirname
});
}
}
function supportsStaticESM(caller) {
return !!(caller && caller.supportsStaticESM);
}
var _default = (0, _helperPluginUtils().declare)((api, options, dirname) => {
api.assertVersion(7);
const {
corejs,
helpers: useRuntimeHelpers = true,
regenerator: useRuntimeRegenerator = true,
useESModules = false,
version: runtimeVersion = "7.0.0-beta.0",
absoluteRuntime = false
} = options;
let proposals = false;
let rawVersion;
if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
const corejsVersion = rawVersion ? Number(rawVersion) : false;
if (![false, 2, 3].includes(corejsVersion)) {
throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(rawVersion)}.`);
}
if (proposals && (!corejsVersion || corejsVersion < 3)) {
throw new Error("The 'proposals' option is only supported when using 'corejs: 3'");
}
if (typeof useRuntimeRegenerator !== "boolean") {
throw new Error("The 'regenerator' option must be undefined, or a boolean.");
}
if (typeof useRuntimeHelpers !== "boolean") {
throw new Error("The 'helpers' option must be undefined, or a boolean.");
}
if (typeof useESModules !== "boolean" && useESModules !== "auto") {
throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.");
}
if (typeof absoluteRuntime !== "boolean" && typeof absoluteRuntime !== "string") {
throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.");
}
if (typeof runtimeVersion !== "string") {
throw new Error(`The 'version' option must be a version string.`);
}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function hasMapping(methods, name) {
return has(methods, name) && (proposals || methods[name].stable);
}
function hasStaticMapping(object, method) {
return has(StaticProperties, object) && hasMapping(StaticProperties[object], method);
}
function isNamespaced(path) {
const binding = path.scope.getBinding(path.node.name);
if (!binding) return false;
return binding.path.isImportNamespaceSpecifier();
}
function maybeNeedsPolyfill(path, methods, name) {
if (isNamespaced(path.get("object"))) return false;
if (!methods[name].types) return true;
const typeAnnotation = path.get("object").getTypeAnnotation();
const type = (0, _helpers.typeAnnotationToString)(typeAnnotation);
if (!type) return true;
return methods[name].types.some(name => name === type);
}
function resolvePropertyName(path, computed) {
const {
node
} = path;
if (!computed) return node.name;
if (path.isStringLiteral()) return node.value;
const result = path.evaluate();
return result.value;
}
if (has(options, "useBuiltIns")) {
if (options.useBuiltIns) {
throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime " + "module now uses builtins by default.");
} else {
throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime.");
}
}
if (has(options, "polyfill")) {
if (options.polyfill === false) {
throw new Error("The 'polyfill' option has been removed. The @babel/runtime " + "module now skips polyfilling by default.");
} else {
throw new Error("The 'polyfill' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime.");
}
}
if (has(options, "moduleName")) {
throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime " + "no longer supports arbitrary runtimes. If you were using this to " + "set an absolute path for Babel's standard runtimes, please use the " + "'absoluteRuntime' option.");
}
const esModules = useESModules === "auto" ? api.caller(supportsStaticESM) : useESModules;
const injectCoreJS2 = corejsVersion === 2;
const injectCoreJS3 = corejsVersion === 3;
const injectCoreJS = corejsVersion !== false;
const moduleName = injectCoreJS3 ? "@babel/runtime-corejs3" : injectCoreJS2 ? "@babel/runtime-corejs2" : "@babel/runtime";
const corejsRoot = injectCoreJS3 && !proposals ? "core-js-stable" : "core-js";
const {
BuiltIns,
StaticProperties,
InstanceProperties
} = (injectCoreJS2 ? _runtimeCorejs2Definitions.default : _runtimeCorejs3Definitions.default)(runtimeVersion);
const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"];
let modulePath = moduleName;
if (absoluteRuntime !== false) {
modulePath = resolveAbsoluteRuntime(moduleName, _path().default.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime));
}
return {
name: "transform-runtime",
pre(file) {
if (useRuntimeHelpers) {
file.set("helperGenerator", name => {
if (file.availableHelper && !file.availableHelper(name, runtimeVersion)) {
return;
}
const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1;
const blockHoist = isInteropHelper && !(0, _helperModuleImports().isModule)(file.path) ? 4 : undefined;
const helpersDir = esModules && file.path.node.sourceType === "module" ? "helpers/esm" : "helpers";
return this.addDefaultImport(`${modulePath}/${helpersDir}/${name}`, name, blockHoist);
});
}
const cache = new Map();
this.addDefaultImport = (source, nameHint, blockHoist) => {
const cacheKey = (0, _helperModuleImports().isModule)(file.path);
const key = `${source}:${nameHint}:${cacheKey || ""}`;
let cached = cache.get(key);
if (cached) {
cached = _core().types.cloneNode(cached);
} else {
cached = (0, _helperModuleImports().addDefault)(file.path, source, {
importedInterop: "uncompiled",
nameHint,
blockHoist
});
cache.set(key, cached);
}
return cached;
};
},
visitor: {
ReferencedIdentifier(path) {
const {
node,
parent,
scope
} = path;
const {
name
} = node;
if (name === "regeneratorRuntime" && useRuntimeRegenerator) {
path.replaceWith(this.addDefaultImport(`${modulePath}/regenerator`, "regeneratorRuntime"));
return;
}
if (!injectCoreJS) return;
if (_core().types.isMemberExpression(parent)) return;
if (!hasMapping(BuiltIns, name)) return;
if (scope.getBindingIdentifier(name)) return;
path.replaceWith(this.addDefaultImport(`${modulePath}/${corejsRoot}/${BuiltIns[name].path}`, name));
},
CallExpression(path) {
if (!injectCoreJS) return;
const {
node
} = path;
const {
callee
} = node;
if (!_core().types.isMemberExpression(callee)) return;
const {
object
} = callee;
const propertyName = resolvePropertyName(path.get("callee.property"), callee.computed);
if (injectCoreJS3 && !hasStaticMapping(object.name, propertyName)) {
if (hasMapping(InstanceProperties, propertyName) && maybeNeedsPolyfill(path.get("callee"), InstanceProperties, propertyName)) {
let context1, context2;
if (_core().types.isIdentifier(object)) {
context1 = object;
context2 = _core().types.cloneNode(object);
} else {
context1 = path.scope.generateDeclaredUidIdentifier("context");
context2 = _core().types.assignmentExpression("=", context1, object);
}
node.callee = _core().types.memberExpression(_core().types.callExpression(this.addDefaultImport(`${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`), [context2]), _core().types.identifier("call"));
node.arguments.unshift(context1);
return;
}
}
if (node.arguments.length) return;
if (!callee.computed) return;
if (!path.get("callee.property").matchesPattern("Symbol.iterator")) {
return;
}
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${modulePath}/core-js/get-iterator`, "getIterator"), [object]));
},
BinaryExpression(path) {
if (!injectCoreJS) return;
if (path.node.operator !== "in") return;
if (!path.get("left").matchesPattern("Symbol.iterator")) return;
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${modulePath}/core-js/is-iterable`, "isIterable"), [path.node.right]));
},
MemberExpression: {
enter(path) {
if (!injectCoreJS) return;
if (!path.isReferenced()) return;
const {
node
} = path;
const {
object
} = node;
if (!_core().types.isReferenced(object, node)) return;
if (!injectCoreJS2 && node.computed && path.get("property").matchesPattern("Symbol.iterator")) {
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/core-js/get-iterator-method`, "getIteratorMethod"), [object]));
return;
}
const objectName = object.name;
const propertyName = resolvePropertyName(path.get("property"), node.computed);
if (path.scope.getBindingIdentifier(objectName) || !hasStaticMapping(objectName, propertyName)) {
if (injectCoreJS3 && hasMapping(InstanceProperties, propertyName) && maybeNeedsPolyfill(path, InstanceProperties, propertyName)) {
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`), [object]));
}
return;
}
path.replaceWith(this.addDefaultImport(`${modulePath}/${corejsRoot}/${StaticProperties[objectName][propertyName].path}`, `${objectName}$${propertyName}`));
},
exit(path) {
if (!injectCoreJS) return;
if (!path.isReferenced()) return;
if (path.node.computed) return;
const {
node
} = path;
const {
object
} = node;
const {
name
} = object;
if (!hasMapping(BuiltIns, name)) return;
if (path.scope.getBindingIdentifier(name)) return;
path.replaceWith(_core().types.memberExpression(this.addDefaultImport(`${modulePath}/${corejsRoot}/${BuiltIns[name].path}`, name), node.property));
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helpers = require("./helpers");
var _default = runtimeVersion => {
const includeMathModule = (0, _helpers.hasMinVersion)("7.0.1", runtimeVersion);
return {
BuiltIns: {
Symbol: {
stable: true,
path: "symbol"
},
Promise: {
stable: true,
path: "promise"
},
Map: {
stable: true,
path: "map"
},
WeakMap: {
stable: true,
path: "weak-map"
},
Set: {
stable: true,
path: "set"
},
WeakSet: {
stable: true,
path: "weak-set"
},
setImmediate: {
stable: true,
path: "set-immediate"
},
clearImmediate: {
stable: true,
path: "clear-immediate"
},
parseFloat: {
stable: true,
path: "parse-float"
},
parseInt: {
stable: true,
path: "parse-int"
}
},
StaticProperties: Object.assign({
Array: {
from: {
stable: true,
path: "array/from"
},
isArray: {
stable: true,
path: "array/is-array"
},
of: {
stable: true,
path: "array/of"
}
},
JSON: {
stringify: {
stable: true,
path: "json/stringify"
}
},
Object: {
assign: {
stable: true,
path: "object/assign"
},
create: {
stable: true,
path: "object/create"
},
defineProperties: {
stable: true,
path: "object/define-properties"
},
defineProperty: {
stable: true,
path: "object/define-property"
},
entries: {
stable: true,
path: "object/entries"
},
freeze: {
stable: true,
path: "object/freeze"
},
getOwnPropertyDescriptor: {
stable: true,
path: "object/get-own-property-descriptor"
},
getOwnPropertyDescriptors: {
stable: true,
path: "object/get-own-property-descriptors"
},
getOwnPropertyNames: {
stable: true,
path: "object/get-own-property-names"
},
getOwnPropertySymbols: {
stable: true,
path: "object/get-own-property-symbols"
},
getPrototypeOf: {
stable: true,
path: "object/get-prototype-of"
},
isExtensible: {
stable: true,
path: "object/is-extensible"
},
isFrozen: {
stable: true,
path: "object/is-frozen"
},
isSealed: {
stable: true,
path: "object/is-sealed"
},
is: {
stable: true,
path: "object/is"
},
keys: {
stable: true,
path: "object/keys"
},
preventExtensions: {
stable: true,
path: "object/prevent-extensions"
},
seal: {
stable: true,
path: "object/seal"
},
setPrototypeOf: {
stable: true,
path: "object/set-prototype-of"
},
values: {
stable: true,
path: "object/values"
}
}
}, includeMathModule ? {
Math: {
acosh: {
stable: true,
path: "math/acosh"
},
asinh: {
stable: true,
path: "math/asinh"
},
atanh: {
stable: true,
path: "math/atanh"
},
cbrt: {
stable: true,
path: "math/cbrt"
},
clz32: {
stable: true,
path: "math/clz32"
},
cosh: {
stable: true,
path: "math/cosh"
},
expm1: {
stable: true,
path: "math/expm1"
},
fround: {
stable: true,
path: "math/fround"
},
hypot: {
stable: true,
path: "math/hypot"
},
imul: {
stable: true,
path: "math/imul"
},
log10: {
stable: true,
path: "math/log10"
},
log1p: {
stable: true,
path: "math/log1p"
},
log2: {
stable: true,
path: "math/log2"
},
sign: {
stable: true,
path: "math/sign"
},
sinh: {
stable: true,
path: "math/sinh"
},
tanh: {
stable: true,
path: "math/tanh"
},
trunc: {
stable: true,
path: "math/trunc"
}
}
} : {}, {
Symbol: {
for: {
stable: true,
path: "symbol/for"
},
hasInstance: {
stable: true,
path: "symbol/has-instance"
},
isConcatSpreadable: {
stable: true,
path: "symbol/is-concat-spreadable"
},
iterator: {
stable: true,
path: "symbol/iterator"
},
keyFor: {
stable: true,
path: "symbol/key-for"
},
match: {
stable: true,
path: "symbol/match"
},
replace: {
stable: true,
path: "symbol/replace"
},
search: {
stable: true,
path: "symbol/search"
},
species: {
stable: true,
path: "symbol/species"
},
split: {
stable: true,
path: "symbol/split"
},
toPrimitive: {
stable: true,
path: "symbol/to-primitive"
},
toStringTag: {
stable: true,
path: "symbol/to-string-tag"
},
unscopables: {
stable: true,
path: "symbol/unscopables"
}
},
String: {
at: {
stable: true,
path: "string/at"
},
fromCodePoint: {
stable: true,
path: "string/from-code-point"
},
raw: {
stable: true,
path: "string/raw"
}
},
Number: {
EPSILON: {
stable: true,
path: "number/epsilon"
},
isFinite: {
stable: true,
path: "number/is-finite"
},
isInteger: {
stable: true,
path: "number/is-integer"
},
isNaN: {
stable: true,
path: "number/is-nan"
},
isSafeInteger: {
stable: true,
path: "number/is-safe-integer"
},
MAX_SAFE_INTEGER: {
stable: true,
path: "number/max-safe-integer"
},
MIN_SAFE_INTEGER: {
stable: true,
path: "number/min-safe-integer"
},
parseFloat: {
stable: true,
path: "number/parse-float"
},
parseInt: {
stable: true,
path: "number/parse-int"
}
},
Reflect: {
apply: {
stable: true,
path: "reflect/apply"
},
construct: {
stable: true,
path: "reflect/construct"
},
defineProperty: {
stable: true,
path: "reflect/define-property"
},
deleteProperty: {
stable: true,
path: "reflect/delete-property"
},
getOwnPropertyDescriptor: {
stable: true,
path: "reflect/get-own-property-descriptor"
},
getPrototypeOf: {
stable: true,
path: "reflect/get-prototype-of"
},
get: {
stable: true,
path: "reflect/get"
},
has: {
stable: true,
path: "reflect/has"
},
isExtensible: {
stable: true,
path: "reflect/is-extensible"
},
ownKeys: {
stable: true,
path: "reflect/own-keys"
},
preventExtensions: {
stable: true,
path: "reflect/prevent-extensions"
},
setPrototypeOf: {
stable: true,
path: "reflect/set-prototype-of"
},
set: {
stable: true,
path: "reflect/set"
}
},
Date: {
now: {
stable: true,
path: "date/now"
}
}
})
};
};
exports.default = _default;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = () => {
return {
BuiltIns: {
AggregateError: {
stable: false,
path: "aggregate-error"
},
Map: {
stable: true,
path: "map"
},
Observable: {
stable: false,
path: "observable"
},
Promise: {
stable: true,
path: "promise"
},
Set: {
stable: true,
path: "set"
},
Symbol: {
stable: true,
path: "symbol"
},
URL: {
stable: true,
path: "url"
},
URLSearchParams: {
stable: true,
path: "url-search-params"
},
WeakMap: {
stable: true,
path: "weak-map"
},
WeakSet: {
stable: true,
path: "weak-set"
},
clearImmediate: {
stable: true,
path: "clear-immediate"
},
compositeKey: {
stable: false,
path: "composite-key"
},
compositeSymbol: {
stable: false,
path: "composite-symbol"
},
globalThis: {
stable: false,
path: "global-this"
},
parseFloat: {
stable: true,
path: "parse-float"
},
parseInt: {
stable: true,
path: "parse-int"
},
queueMicrotask: {
stable: true,
path: "queue-microtask"
},
setImmediate: {
stable: true,
path: "set-immediate"
},
setInterval: {
stable: true,
path: "set-interval"
},
setTimeout: {
stable: true,
path: "set-timeout"
}
},
StaticProperties: {
Array: {
from: {
stable: true,
path: "array/from"
},
isArray: {
stable: true,
path: "array/is-array"
},
of: {
stable: true,
path: "array/of"
}
},
Date: {
now: {
stable: true,
path: "date/now"
}
},
JSON: {
stringify: {
stable: true,
path: "json/stringify"
}
},
Math: {
DEG_PER_RAD: {
stable: false,
path: "math/deg-per-rad"
},
RAD_PER_DEG: {
stable: false,
path: "math/rad-per-deg"
},
acosh: {
stable: true,
path: "math/acosh"
},
asinh: {
stable: true,
path: "math/asinh"
},
atanh: {
stable: true,
path: "math/atanh"
},
cbrt: {
stable: true,
path: "math/cbrt"
},
clamp: {
stable: false,
path: "math/clamp"
},
clz32: {
stable: true,
path: "math/clz32"
},
cosh: {
stable: true,
path: "math/cosh"
},
degrees: {
stable: false,
path: "math/degrees"
},
expm1: {
stable: true,
path: "math/expm1"
},
fround: {
stable: true,
path: "math/fround"
},
fscale: {
stable: false,
path: "math/fscale"
},
hypot: {
stable: true,
path: "math/hypot"
},
iaddh: {
stable: false,
path: "math/iaddh"
},
imul: {
stable: true,
path: "math/imul"
},
imulh: {
stable: false,
path: "math/imulh"
},
isubh: {
stable: false,
path: "math/isubh"
},
log10: {
stable: true,
path: "math/log10"
},
log1p: {
stable: true,
path: "math/log1p"
},
log2: {
stable: true,
path: "math/log2"
},
radians: {
stable: false,
path: "math/radians"
},
scale: {
stable: false,
path: "math/scale"
},
seededPRNG: {
stable: false,
path: "math/seeded-prng"
},
sign: {
stable: true,
path: "math/sign"
},
signbit: {
stable: false,
path: "math/signbit"
},
sinh: {
stable: true,
path: "math/sinh"
},
tanh: {
stable: true,
path: "math/tanh"
},
trunc: {
stable: true,
path: "math/trunc"
},
umulh: {
stable: false,
path: "math/umulh"
}
},
Number: {
EPSILON: {
stable: true,
path: "number/epsilon"
},
MAX_SAFE_INTEGER: {
stable: true,
path: "number/max-safe-integer"
},
MIN_SAFE_INTEGER: {
stable: true,
path: "number/min-safe-integer"
},
fromString: {
stable: false,
path: "number/from-string"
},
isFinite: {
stable: true,
path: "number/is-finite"
},
isInteger: {
stable: true,
path: "number/is-integer"
},
isNaN: {
stable: true,
path: "number/is-nan"
},
isSafeInteger: {
stable: true,
path: "number/is-safe-integer"
},
parseFloat: {
stable: true,
path: "number/parse-float"
},
parseInt: {
stable: true,
path: "number/parse-int"
}
},
Object: {
assign: {
stable: true,
path: "object/assign"
},
create: {
stable: true,
path: "object/create"
},
defineProperties: {
stable: true,
path: "object/define-properties"
},
defineProperty: {
stable: true,
path: "object/define-property"
},
entries: {
stable: true,
path: "object/entries"
},
freeze: {
stable: true,
path: "object/freeze"
},
fromEntries: {
stable: true,
path: "object/from-entries"
},
getOwnPropertyDescriptor: {
stable: true,
path: "object/get-own-property-descriptor"
},
getOwnPropertyDescriptors: {
stable: true,
path: "object/get-own-property-descriptors"
},
getOwnPropertyNames: {
stable: true,
path: "object/get-own-property-names"
},
getOwnPropertySymbols: {
stable: true,
path: "object/get-own-property-symbols"
},
getPrototypeOf: {
stable: true,
path: "object/get-prototype-of"
},
isExtensible: {
stable: true,
path: "object/is-extensible"
},
isFrozen: {
stable: true,
path: "object/is-frozen"
},
isSealed: {
stable: true,
path: "object/is-sealed"
},
is: {
stable: true,
path: "object/is"
},
keys: {
stable: true,
path: "object/keys"
},
preventExtensions: {
stable: true,
path: "object/prevent-extensions"
},
seal: {
stable: true,
path: "object/seal"
},
setPrototypeOf: {
stable: true,
path: "object/set-prototype-of"
},
values: {
stable: true,
path: "object/values"
}
},
Reflect: {
apply: {
stable: true,
path: "reflect/apply"
},
construct: {
stable: true,
path: "reflect/construct"
},
defineMetadata: {
stable: false,
path: "reflect/define-metadata"
},
defineProperty: {
stable: true,
path: "reflect/define-property"
},
deleteMetadata: {
stable: false,
path: "reflect/delete-metadata"
},
deleteProperty: {
stable: true,
path: "reflect/delete-property"
},
getMetadata: {
stable: false,
path: "reflect/get-metadata"
},
getMetadataKeys: {
stable: false,
path: "reflect/get-metadata-keys"
},
getOwnMetadata: {
stable: false,
path: "reflect/get-own-metadata"
},
getOwnMetadataKeys: {
stable: false,
path: "reflect/get-own-metadata-keys"
},
getOwnPropertyDescriptor: {
stable: true,
path: "reflect/get-own-property-descriptor"
},
getPrototypeOf: {
stable: true,
path: "reflect/get-prototype-of"
},
get: {
stable: true,
path: "reflect/get"
},
has: {
stable: true,
path: "reflect/has"
},
hasMetadata: {
stable: false,
path: "reflect/has-metadata"
},
hasOwnMetadata: {
stable: false,
path: "reflect/has-own-metadata"
},
isExtensible: {
stable: true,
path: "reflect/is-extensible"
},
metadata: {
stable: false,
path: "reflect/metadata"
},
ownKeys: {
stable: true,
path: "reflect/own-keys"
},
preventExtensions: {
stable: true,
path: "reflect/prevent-extensions"
},
set: {
stable: true,
path: "reflect/set"
},
setPrototypeOf: {
stable: true,
path: "reflect/set-prototype-of"
}
},
String: {
fromCodePoint: {
stable: true,
path: "string/from-code-point"
},
raw: {
stable: true,
path: "string/raw"
}
},
Symbol: {
asyncIterator: {
stable: true,
path: "symbol/async-iterator"
},
dispose: {
stable: false,
path: "symbol/dispose"
},
for: {
stable: true,
path: "symbol/for"
},
hasInstance: {
stable: true,
path: "symbol/has-instance"
},
isConcatSpreadable: {
stable: true,
path: "symbol/is-concat-spreadable"
},
iterator: {
stable: true,
path: "symbol/iterator"
},
keyFor: {
stable: true,
path: "symbol/key-for"
},
match: {
stable: true,
path: "symbol/match"
},
observable: {
stable: false,
path: "symbol/observable"
},
patternMatch: {
stable: false,
path: "symbol/pattern-match"
},
replace: {
stable: true,
path: "symbol/replace"
},
search: {
stable: true,
path: "symbol/search"
},
species: {
stable: true,
path: "symbol/species"
},
split: {
stable: true,
path: "symbol/split"
},
toPrimitive: {
stable: true,
path: "symbol/to-primitive"
},
toStringTag: {
stable: true,
path: "symbol/to-string-tag"
},
unscopables: {
stable: true,
path: "symbol/unscopables"
}
}
},
InstanceProperties: {
at: {
stable: false,
path: "at"
},
bind: {
stable: true,
path: "bind"
},
codePointAt: {
stable: true,
path: "code-point-at"
},
codePoints: {
stable: false,
path: "code-points"
},
concat: {
stable: true,
path: "concat",
types: ["array"]
},
copyWithin: {
stable: true,
path: "copy-within"
},
endsWith: {
stable: true,
path: "ends-with"
},
entries: {
stable: true,
path: "entries"
},
every: {
stable: true,
path: "every"
},
fill: {
stable: true,
path: "fill"
},
filter: {
stable: true,
path: "filter"
},
find: {
stable: true,
path: "find"
},
findIndex: {
stable: true,
path: "find-index"
},
flags: {
stable: true,
path: "flags"
},
flatMap: {
stable: true,
path: "flat-map"
},
flat: {
stable: true,
path: "flat"
},
forEach: {
stable: true,
path: "for-each"
},
includes: {
stable: true,
path: "includes"
},
indexOf: {
stable: true,
path: "index-of"
},
keys: {
stable: true,
path: "keys"
},
lastIndexOf: {
stable: true,
path: "last-index-of"
},
map: {
stable: true,
path: "map"
},
matchAll: {
stable: false,
path: "match-all"
},
padEnd: {
stable: true,
path: "pad-end"
},
padStart: {
stable: true,
path: "pad-start"
},
reduce: {
stable: true,
path: "reduce"
},
reduceRight: {
stable: true,
path: "reduce-right"
},
repeat: {
stable: true,
path: "repeat"
},
replaceAll: {
stable: false,
path: "replace-all"
},
reverse: {
stable: true,
path: "reverse"
},
slice: {
stable: true,
path: "slice"
},
some: {
stable: true,
path: "some"
},
sort: {
stable: true,
path: "sort"
},
splice: {
stable: true,
path: "splice"
},
startsWith: {
stable: true,
path: "starts-with"
},
trim: {
stable: true,
path: "trim"
},
trimEnd: {
stable: true,
path: "trim-end"
},
trimLeft: {
stable: true,
path: "trim-left"
},
trimRight: {
stable: true,
path: "trim-right"
},
trimStart: {
stable: true,
path: "trim-start"
},
values: {
stable: true,
path: "values"
}
}
};
};
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-runtime@^7.4.0",
"_id": "@babel/plugin-transform-runtime@7.6.2",
"_inBundle": false,
"_integrity": "sha512-cqULw/QB4yl73cS5Y0TZlQSjDvNkzDbu0FurTZyHlJpWE5T3PCMdnyV+xXoH1opr1ldyHODe3QAX3OMAii5NxA==",
"_location": "/@babel/plugin-transform-runtime",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-runtime@^7.4.0",
"name": "@babel/plugin-transform-runtime",
"escapedName": "@babel%2fplugin-transform-runtime",
"scope": "@babel",
"rawSpec": "^7.4.0",
"saveSpec": null,
"fetchSpec": "^7.4.0"
},
"_requiredBy": [
"/@vue/babel-preset-app"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.2.tgz",
"_shasum": "2669f67c1fae0ae8d8bf696e4263ad52cb98b6f8",
"_spec": "@babel/plugin-transform-runtime@^7.4.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@vue\\babel-preset-app",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/helper-plugin-utils": "^7.0.0",
"resolve": "^1.8.1",
"semver": "^5.5.1"
},
"deprecated": false,
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/helpers": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@babel/template": "^7.6.0",
"@babel/types": "7.0.0-beta.53"
},
"gitHead": "b9cb4af953afb1a5aeed9b18526192ab15bb45c1",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-runtime",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime"
},
"version": "7.6.2"
}
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-transform-shorthand-properties
> Compile ES2015 shorthand properties to ES5
See our website [@babel/plugin-transform-shorthand-properties](https://babeljs.io/docs/en/next/babel-plugin-transform-shorthand-properties.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-shorthand-properties
```
or using yarn:
```sh
yarn add @babel/plugin-transform-shorthand-properties --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 _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
return {
name: "transform-shorthand-properties",
visitor: {
ObjectMethod(path) {
const {
node
} = path;
if (node.kind === "method") {
const func = _core().types.functionExpression(null, node.params, node.body, node.generator, node.async);
func.returnType = node.returnType;
path.replaceWith(_core().types.objectProperty(node.key, func, node.computed));
}
},
ObjectProperty({
node
}) {
if (node.shorthand) {
node.shorthand = false;
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-shorthand-properties@^7.2.0",
"_id": "@babel/plugin-transform-shorthand-properties@7.2.0",
"_inBundle": false,
"_integrity": "sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg==",
"_location": "/@babel/plugin-transform-shorthand-properties",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-shorthand-properties@^7.2.0",
"name": "@babel/plugin-transform-shorthand-properties",
"escapedName": "@babel%2fplugin-transform-shorthand-properties",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz",
"_shasum": "6333aee2f8d6ee7e28615457298934a3b46198f0",
"_spec": "@babel/plugin-transform-shorthand-properties@^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"
},
"deprecated": false,
"description": "Compile ES2015 shorthand properties to ES5",
"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-transform-shorthand-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-transform-shorthand-properties"
},
"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-transform-spread
> Compile ES2015 spread to ES5
See our website [@babel/plugin-transform-spread](https://babeljs.io/docs/en/next/babel-plugin-transform-spread.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-spread
```
or using yarn:
```sh
yarn add @babel/plugin-transform-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 _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
var _default = (0, _helperPluginUtils().declare)((api, options) => {
api.assertVersion(7);
const {
loose
} = options;
function getSpreadLiteral(spread, scope) {
if (loose && !_core().types.isIdentifier(spread.argument, {
name: "arguments"
})) {
return spread.argument;
} else {
return scope.toArray(spread.argument, true);
}
}
function hasSpread(nodes) {
for (let i = 0; i < nodes.length; i++) {
if (_core().types.isSpreadElement(nodes[i])) {
return true;
}
}
return false;
}
function push(_props, nodes) {
if (!_props.length) return _props;
nodes.push(_core().types.arrayExpression(_props));
return [];
}
function build(props, scope) {
const nodes = [];
let _props = [];
for (const prop of props) {
if (_core().types.isSpreadElement(prop)) {
_props = push(_props, nodes);
nodes.push(getSpreadLiteral(prop, scope));
} else {
_props.push(prop);
}
}
push(_props, nodes);
return nodes;
}
return {
name: "transform-spread",
visitor: {
ArrayExpression(path) {
const {
node,
scope
} = path;
const elements = node.elements;
if (!hasSpread(elements)) return;
const nodes = build(elements, scope);
let first = nodes[0];
if (nodes.length === 1 && first !== elements[0].argument) {
path.replaceWith(first);
return;
}
if (!_core().types.isArrayExpression(first)) {
first = _core().types.arrayExpression([]);
} else {
nodes.shift();
}
path.replaceWith(_core().types.callExpression(_core().types.memberExpression(first, _core().types.identifier("concat")), nodes));
},
CallExpression(path) {
const {
node,
scope
} = path;
const args = node.arguments;
if (!hasSpread(args)) return;
const calleePath = path.get("callee");
if (calleePath.isSuper()) return;
let contextLiteral = scope.buildUndefinedNode();
node.arguments = [];
let nodes;
if (args.length === 1 && args[0].argument.name === "arguments") {
nodes = [args[0].argument];
} else {
nodes = build(args, scope);
}
const first = nodes.shift();
if (nodes.length) {
node.arguments.push(_core().types.callExpression(_core().types.memberExpression(first, _core().types.identifier("concat")), nodes));
} else {
node.arguments.push(first);
}
const callee = node.callee;
if (calleePath.isMemberExpression()) {
const temp = scope.maybeGenerateMemoised(callee.object);
if (temp) {
callee.object = _core().types.assignmentExpression("=", temp, callee.object);
contextLiteral = temp;
} else {
contextLiteral = _core().types.cloneNode(callee.object);
}
_core().types.appendToMemberExpression(callee, _core().types.identifier("apply"));
} else {
node.callee = _core().types.memberExpression(node.callee, _core().types.identifier("apply"));
}
if (_core().types.isSuper(contextLiteral)) {
contextLiteral = _core().types.thisExpression();
}
node.arguments.unshift(_core().types.cloneNode(contextLiteral));
},
NewExpression(path) {
const {
node,
scope
} = path;
let args = node.arguments;
if (!hasSpread(args)) return;
const nodes = build(args, scope);
const first = nodes.shift();
if (nodes.length) {
args = _core().types.callExpression(_core().types.memberExpression(first, _core().types.identifier("concat")), nodes);
} else {
args = first;
}
path.replaceWith(_core().types.callExpression(path.hub.addHelper("construct"), [node.callee, 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