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
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-modules-umd
> This plugin transforms ES2015 modules to UMD
See our website [@babel/plugin-transform-modules-umd](https://babeljs.io/docs/en/next/babel-plugin-transform-modules-umd.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-modules-umd
```
or using yarn:
```sh
yarn add @babel/plugin-transform-modules-umd --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _path = require("path");
var _helperModuleTransforms = require("@babel/helper-module-transforms");
var _core = require("@babel/core");
const buildPrerequisiteAssignment = (0, _core.template)(`
GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}
`);
const buildWrapper = (0, _core.template)(`
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(MODULE_NAME, AMD_ARGUMENTS, factory);
} else if (typeof exports !== "undefined") {
factory(COMMONJS_ARGUMENTS);
} else {
var mod = { exports: {} };
factory(BROWSER_ARGUMENTS);
GLOBAL_TO_ASSIGN;
}
})(
typeof globalThis === "object" ? globalThis
: typeof self === "object" ? self
: this,
function(IMPORT_NAMES) {
})
`);
var _default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
const {
globals,
exactGlobals,
loose,
allowTopLevelThis,
strict,
strictMode,
noInterop
} = options;
function buildBrowserInit(browserGlobals, exactGlobals, filename, moduleName) {
const moduleNameOrBasename = moduleName ? moduleName.value : (0, _path.basename)(filename, (0, _path.extname)(filename));
let globalToAssign = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(moduleNameOrBasename)));
let initAssignments = [];
if (exactGlobals) {
const globalName = browserGlobals[moduleNameOrBasename];
if (globalName) {
initAssignments = [];
const members = globalName.split(".");
globalToAssign = members.slice(1).reduce((accum, curr) => {
initAssignments.push(buildPrerequisiteAssignment({
GLOBAL_REFERENCE: _core.types.cloneNode(accum)
}));
return _core.types.memberExpression(accum, _core.types.identifier(curr));
}, _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(members[0])));
}
}
initAssignments.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", globalToAssign, _core.types.memberExpression(_core.types.identifier("mod"), _core.types.identifier("exports")))));
return initAssignments;
}
function buildBrowserArg(browserGlobals, exactGlobals, source) {
let memberExpression;
if (exactGlobals) {
const globalRef = browserGlobals[source];
if (globalRef) {
memberExpression = globalRef.split(".").reduce((accum, curr) => _core.types.memberExpression(accum, _core.types.identifier(curr)), _core.types.identifier("global"));
} else {
memberExpression = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(source)));
}
} else {
const requireName = (0, _path.basename)(source, (0, _path.extname)(source));
const globalName = browserGlobals[requireName] || requireName;
memberExpression = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(globalName)));
}
return memberExpression;
}
return {
name: "transform-modules-umd",
visitor: {
Program: {
exit(path) {
if (!(0, _helperModuleTransforms.isModule)(path)) return;
const browserGlobals = globals || {};
let moduleName = this.getModuleName();
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
const {
meta,
headers
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
loose,
strict,
strictMode,
allowTopLevelThis,
noInterop
});
const amdArgs = [];
const commonjsArgs = [];
const browserArgs = [];
const importNames = [];
if ((0, _helperModuleTransforms.hasExports)(meta)) {
amdArgs.push(_core.types.stringLiteral("exports"));
commonjsArgs.push(_core.types.identifier("exports"));
browserArgs.push(_core.types.memberExpression(_core.types.identifier("mod"), _core.types.identifier("exports")));
importNames.push(_core.types.identifier(meta.exportName));
}
for (const [source, metadata] of meta.source) {
amdArgs.push(_core.types.stringLiteral(source));
commonjsArgs.push(_core.types.callExpression(_core.types.identifier("require"), [_core.types.stringLiteral(source)]));
browserArgs.push(buildBrowserArg(browserGlobals, exactGlobals, source));
importNames.push(_core.types.identifier(metadata.name));
if (!(0, _helperModuleTransforms.isSideEffectImport)(metadata)) {
const interop = (0, _helperModuleTransforms.wrapInterop)(path, _core.types.identifier(metadata.name), metadata.interop);
if (interop) {
const header = _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.identifier(metadata.name), interop));
header.loc = meta.loc;
headers.push(header);
}
}
headers.push(...(0, _helperModuleTransforms.buildNamespaceInitStatements)(meta, metadata, loose));
}
(0, _helperModuleTransforms.ensureStatementsHoisted)(headers);
path.unshiftContainer("body", headers);
const {
body,
directives
} = path.node;
path.node.directives = [];
path.node.body = [];
const umdWrapper = path.pushContainer("body", [buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: _core.types.arrayExpression(amdArgs),
COMMONJS_ARGUMENTS: commonjsArgs,
BROWSER_ARGUMENTS: browserArgs,
IMPORT_NAMES: importNames,
GLOBAL_TO_ASSIGN: buildBrowserInit(browserGlobals, exactGlobals, this.filename || "unknown", moduleName)
})])[0];
const umdFactory = umdWrapper.get("expression.arguments")[1].get("body");
umdFactory.pushContainer("directives", directives);
umdFactory.pushContainer("body", body);
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-modules-umd@^7.2.0",
"_id": "@babel/plugin-transform-modules-umd@7.7.0",
"_inBundle": false,
"_integrity": "sha512-u7eBA03zmUswQ9LQ7Qw0/ieC1pcAkbp5OQatbWUzY1PaBccvuJXUkYzoN1g7cqp7dbTu6Dp9bXyalBvD04AANA==",
"_location": "/@babel/plugin-transform-modules-umd",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-modules-umd@^7.2.0",
"name": "@babel/plugin-transform-modules-umd",
"escapedName": "@babel%2fplugin-transform-modules-umd",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.0.tgz",
"_shasum": "d62c7da16670908e1d8c68ca0b5d4c0097b69966",
"_spec": "@babel/plugin-transform-modules-umd@^7.2.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-module-transforms": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0"
},
"deprecated": false,
"description": "This plugin transforms ES2015 modules to UMD",
"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-transform-modules-umd",
"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-modules-umd"
},
"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-named-capturing-groups-regex
> Compile regular expressions using named groups to ES5.
See our website [@babel/plugin-transform-named-capturing-groups-regex](https://babeljs.io/docs/en/next/babel-plugin-transform-named-capturing-groups-regex.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-named-capturing-groups-regex
```
or using yarn:
```sh
yarn add @babel/plugin-transform-named-capturing-groups-regex --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _helperCreateRegexpFeaturesPlugin = require("@babel/helper-create-regexp-features-plugin");
function _default(core, options) {
const {
runtime = true
} = options;
if (typeof runtime !== "boolean") {
throw new Error("The 'runtime' option must be boolean");
}
return (0, _helperCreateRegexpFeaturesPlugin.createRegExpFeaturePlugin)({
name: "transform-named-capturing-groups-regex",
feature: "namedCaptureGroups",
options: {
runtime
}
});
}
\ No newline at end of file
{
"_from": "@babel/plugin-transform-named-capturing-groups-regex@^7.3.0",
"_id": "@babel/plugin-transform-named-capturing-groups-regex@7.7.0",
"_inBundle": false,
"_integrity": "sha512-+SicSJoKouPctL+j1pqktRVCgy+xAch1hWWTMy13j0IflnyNjaoskj+DwRQFimHbLqO3sq2oN2CXMvXq3Bgapg==",
"_location": "/@babel/plugin-transform-named-capturing-groups-regex",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-named-capturing-groups-regex@^7.3.0",
"name": "@babel/plugin-transform-named-capturing-groups-regex",
"escapedName": "@babel%2fplugin-transform-named-capturing-groups-regex",
"scope": "@babel",
"rawSpec": "^7.3.0",
"saveSpec": null,
"fetchSpec": "^7.3.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.0.tgz",
"_shasum": "358e6fd869b9a4d8f5cbc79e4ed4fc340e60dcaf",
"_spec": "@babel/plugin-transform-named-capturing-groups-regex@^7.3.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.7.0"
},
"deprecated": false,
"description": "Compile regular expressions using named groups to ES5.",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0",
"core-js": "^3.2.1",
"core-js-pure": "^3.2.1"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"homepage": "https://babeljs.io/",
"keywords": [
"babel-plugin",
"regex",
"regexp",
"regular expressions"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-named-capturing-groups-regex",
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-transform-named-capturing-groups-regex"
},
"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-new-target
> Transforms new.target meta property
See our website [@babel/plugin-transform-new-target](https://babeljs.io/docs/en/next/babel-plugin-transform-new-target.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-new-target
```
or using yarn:
```sh
yarn add @babel/plugin-transform-new-target --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-new-target",
visitor: {
MetaProperty(path) {
const meta = path.get("meta");
const property = path.get("property");
const {
scope
} = path;
if (meta.isIdentifier({
name: "new"
}) && property.isIdentifier({
name: "target"
})) {
const func = path.findParent(path => {
if (path.isClass()) return true;
if (path.isFunction() && !path.isArrowFunctionExpression()) {
if (path.isClassMethod({
kind: "constructor"
})) {
return false;
}
return true;
}
return false;
});
if (!func) {
throw path.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.");
}
const {
node
} = func;
if (!node.id) {
if (func.isMethod()) {
path.replaceWith(scope.buildUndefinedNode());
return;
}
node.id = scope.generateUidIdentifier("target");
}
const constructor = _core().types.memberExpression(_core().types.thisExpression(), _core().types.identifier("constructor"));
if (func.isClass()) {
path.replaceWith(constructor);
return;
}
path.replaceWith(_core().types.conditionalExpression(_core().types.binaryExpression("instanceof", _core().types.thisExpression(), _core().types.cloneNode(node.id)), constructor, scope.buildUndefinedNode()));
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-new-target@^7.0.0",
"_id": "@babel/plugin-transform-new-target@7.4.4",
"_inBundle": false,
"_integrity": "sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==",
"_location": "/@babel/plugin-transform-new-target",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-new-target@^7.0.0",
"name": "@babel/plugin-transform-new-target",
"escapedName": "@babel%2fplugin-transform-new-target",
"scope": "@babel",
"rawSpec": "^7.0.0",
"saveSpec": null,
"fetchSpec": "^7.0.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz",
"_shasum": "18d120438b0cc9ee95a47f2c72bc9768fbed60a5",
"_spec": "@babel/plugin-transform-new-target@^7.0.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": "Transforms new.target meta property",
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-transform-arrow-functions": "^7.0.0"
},
"gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-new-target",
"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-new-target"
},
"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-object-super
> Compile ES2015 object super to ES5
See our website [@babel/plugin-transform-object-super](https://babeljs.io/docs/en/next/babel-plugin-transform-object-super.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-object-super
```
or using yarn:
```sh
yarn add @babel/plugin-transform-object-super --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 _helperReplaceSupers() {
const data = _interopRequireDefault(require("@babel/helper-replace-supers"));
_helperReplaceSupers = 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 replacePropertySuper(path, getObjectRef, file) {
const replaceSupers = new (_helperReplaceSupers().default)({
getObjectRef: getObjectRef,
methodPath: path,
file: file
});
replaceSupers.replace();
}
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
return {
name: "transform-object-super",
visitor: {
ObjectExpression(path, state) {
let objectRef;
const getObjectRef = () => objectRef = objectRef || path.scope.generateUidIdentifier("obj");
path.get("properties").forEach(propPath => {
if (!propPath.isMethod()) return;
replacePropertySuper(propPath, getObjectRef, state);
});
if (objectRef) {
path.scope.push({
id: _core().types.cloneNode(objectRef)
});
path.replaceWith(_core().types.assignmentExpression("=", _core().types.cloneNode(objectRef), path.node));
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-object-super@^7.2.0",
"_id": "@babel/plugin-transform-object-super@7.5.5",
"_inBundle": false,
"_integrity": "sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ==",
"_location": "/@babel/plugin-transform-object-super",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-object-super@^7.2.0",
"name": "@babel/plugin-transform-object-super",
"escapedName": "@babel%2fplugin-transform-object-super",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz",
"_shasum": "c70021df834073c65eb613b8679cc4a381d1a9f9",
"_spec": "@babel/plugin-transform-object-super@^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-replace-supers": "^7.5.5"
},
"deprecated": false,
"description": "Compile ES2015 object super to ES5",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-object-super",
"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-object-super"
},
"version": "7.5.5"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/plugin-transform-parameters
> Compile ES2015 default and rest parameters to ES5
See our website [@babel/plugin-transform-parameters](https://babeljs.io/docs/en/next/babel-plugin-transform-parameters.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-parameters
```
or using yarn:
```sh
yarn add @babel/plugin-transform-parameters --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;
}
var _params = _interopRequireDefault(require("./params"));
var _rest = _interopRequireDefault(require("./rest"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils().declare)((api, options) => {
api.assertVersion(7);
const {
loose
} = options;
return {
name: "transform-parameters",
visitor: {
Function(path) {
if (path.isArrowFunctionExpression() && path.get("params").some(param => param.isRestElement() || param.isAssignmentPattern())) {
path.arrowFunctionToExpression();
}
const convertedRest = (0, _rest.default)(path);
const convertedParams = (0, _params.default)(path, loose);
if (convertedRest || convertedParams) {
path.scope.crawl();
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = convertFunctionParams;
function _helperCallDelegate() {
const data = _interopRequireDefault(require("@babel/helper-call-delegate"));
_helperCallDelegate = 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 buildDefaultParam = (0, _core().template)(`
let VARIABLE_NAME =
arguments.length > ARGUMENT_KEY && arguments[ARGUMENT_KEY] !== undefined ?
arguments[ARGUMENT_KEY]
:
DEFAULT_VALUE;
`);
const buildLooseDefaultParam = (0, _core().template)(`
if (ASSIGNMENT_IDENTIFIER === UNDEFINED) {
ASSIGNMENT_IDENTIFIER = DEFAULT_VALUE;
}
`);
const buildLooseDestructuredDefaultParam = (0, _core().template)(`
let ASSIGNMENT_IDENTIFIER = PARAMETER_NAME === UNDEFINED ? DEFAULT_VALUE : PARAMETER_NAME ;
`);
const buildSafeArgumentsAccess = (0, _core().template)(`
let $0 = arguments.length > $1 ? arguments[$1] : undefined;
`);
function isSafeBinding(scope, node) {
if (!scope.hasOwnBinding(node.name)) return true;
const {
kind
} = scope.getOwnBinding(node.name);
return kind === "param" || kind === "local";
}
const iifeVisitor = {
ReferencedIdentifier(path, state) {
const {
scope,
node
} = path;
if (node.name === "eval" || !isSafeBinding(scope, node)) {
state.iife = true;
path.stop();
}
},
Scope(path) {
path.skip();
}
};
function convertFunctionParams(path, loose) {
const {
node,
scope
} = path;
const state = {
iife: false,
scope: scope
};
const body = [];
const params = path.get("params");
let firstOptionalIndex = null;
for (let i = 0; i < params.length; i++) {
const param = params[i];
const paramIsAssignmentPattern = param.isAssignmentPattern();
if (paramIsAssignmentPattern && (loose || node.kind === "set")) {
const left = param.get("left");
const right = param.get("right");
const undefinedNode = scope.buildUndefinedNode();
if (left.isIdentifier()) {
body.push(buildLooseDefaultParam({
ASSIGNMENT_IDENTIFIER: _core().types.cloneNode(left.node),
DEFAULT_VALUE: right.node,
UNDEFINED: undefinedNode
}));
param.replaceWith(left.node);
} else if (left.isObjectPattern() || left.isArrayPattern()) {
const paramName = scope.generateUidIdentifier();
body.push(buildLooseDestructuredDefaultParam({
ASSIGNMENT_IDENTIFIER: left.node,
DEFAULT_VALUE: right.node,
PARAMETER_NAME: _core().types.cloneNode(paramName),
UNDEFINED: undefinedNode
}));
param.replaceWith(paramName);
}
} else if (paramIsAssignmentPattern) {
if (firstOptionalIndex === null) firstOptionalIndex = i;
const left = param.get("left");
const right = param.get("right");
if (!state.iife) {
if (right.isIdentifier() && !isSafeBinding(scope, right.node)) {
state.iife = true;
} else {
right.traverse(iifeVisitor, state);
}
}
const defNode = buildDefaultParam({
VARIABLE_NAME: left.node,
DEFAULT_VALUE: right.node,
ARGUMENT_KEY: _core().types.numericLiteral(i)
});
body.push(defNode);
} else if (firstOptionalIndex !== null) {
const defNode = buildSafeArgumentsAccess([param.node, _core().types.numericLiteral(i)]);
body.push(defNode);
} else if (param.isObjectPattern() || param.isArrayPattern()) {
const uid = path.scope.generateUidIdentifier("ref");
const defNode = _core().types.variableDeclaration("let", [_core().types.variableDeclarator(param.node, uid)]);
body.push(defNode);
param.replaceWith(_core().types.cloneNode(uid));
}
if (!state.iife && !param.isIdentifier()) {
param.traverse(iifeVisitor, state);
}
}
if (body.length === 0) return false;
if (firstOptionalIndex !== null) {
node.params = node.params.slice(0, firstOptionalIndex);
}
path.ensureBlock();
if (state.iife) {
body.push((0, _helperCallDelegate().default)(path, scope));
path.set("body", _core().types.blockStatement(body));
} else {
path.get("body").unshiftContainer("body", body);
}
return true;
}
\ 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