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-function-name
> Apply ES2015 function.name semantics to all functions
See our website [@babel/plugin-transform-function-name](https://babeljs.io/docs/en/next/babel-plugin-transform-function-name.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-function-name
```
or using yarn:
```sh
yarn add @babel/plugin-transform-function-name --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperFunctionName = _interopRequireDefault(require("@babel/helper-function-name"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);
return {
name: "transform-function-name",
visitor: {
FunctionExpression: {
exit(path) {
if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
const replacement = (0, _helperFunctionName.default)(path);
if (replacement) path.replaceWith(replacement);
}
}
},
ObjectProperty(path) {
const value = path.get("value");
if (value.isFunction()) {
const newNode = (0, _helperFunctionName.default)(value);
if (newNode) value.replaceWith(newNode);
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-function-name@^7.2.0",
"_id": "@babel/plugin-transform-function-name@7.7.0",
"_inBundle": false,
"_integrity": "sha512-P5HKu0d9+CzZxP5jcrWdpe7ZlFDe24bmqP6a6X8BHEBl/eizAsY8K6LX8LASZL0Jxdjm5eEfzp+FIrxCm/p8bA==",
"_location": "/@babel/plugin-transform-function-name",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-function-name@^7.2.0",
"name": "@babel/plugin-transform-function-name",
"escapedName": "@babel%2fplugin-transform-function-name",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.0.tgz",
"_shasum": "0fa786f1eef52e3b7d4fc02e54b2129de8a04c2a",
"_spec": "@babel/plugin-transform-function-name@^7.2.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-function-name": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0"
},
"deprecated": false,
"description": "Apply ES2015 function.name semantics to all functions",
"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-function-name",
"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-function-name"
},
"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-transform-literals
> Compile ES2015 unicode string and number literals to ES5
See our website [@babel/plugin-transform-literals](https://babeljs.io/docs/en/next/babel-plugin-transform-literals.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-literals
```
or using yarn:
```sh
yarn add @babel/plugin-transform-literals --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 _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
return {
name: "transform-literals",
visitor: {
NumericLiteral({
node
}) {
if (node.extra && /^0[ob]/i.test(node.extra.raw)) {
node.extra = undefined;
}
},
StringLiteral({
node
}) {
if (node.extra && /\\[u]/gi.test(node.extra.raw)) {
node.extra = undefined;
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-literals@^7.2.0",
"_id": "@babel/plugin-transform-literals@7.2.0",
"_inBundle": false,
"_integrity": "sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg==",
"_location": "/@babel/plugin-transform-literals",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-literals@^7.2.0",
"name": "@babel/plugin-transform-literals",
"escapedName": "@babel%2fplugin-transform-literals",
"scope": "@babel",
"rawSpec": "^7.2.0",
"saveSpec": null,
"fetchSpec": "^7.2.0"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz",
"_shasum": "690353e81f9267dad4fd8cfd77eafa86aba53ea1",
"_spec": "@babel/plugin-transform-literals@^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 unicode string and number literals 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-literals",
"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-literals"
},
"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-modules-amd
> This plugin transforms ES2015 modules to AMD
See our website [@babel/plugin-transform-modules-amd](https://babeljs.io/docs/en/next/babel-plugin-transform-modules-amd.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-modules-amd
```
or using yarn:
```sh
yarn add @babel/plugin-transform-modules-amd --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 _helperModuleTransforms() {
const data = require("@babel/helper-module-transforms");
_helperModuleTransforms = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _utils() {
const data = require("babel-plugin-dynamic-import-node/utils");
_utils = function () {
return data;
};
return data;
}
const buildWrapper = (0, _core().template)(`
define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {
})
`);
const buildAnonymousWrapper = (0, _core().template)(`
define(["require"], function(REQUIRE) {
})
`);
function injectWrapper(path, wrapper) {
const {
body,
directives
} = path.node;
path.node.directives = [];
path.node.body = [];
const amdWrapper = path.pushContainer("body", wrapper)[0];
const amdFactory = amdWrapper.get("expression.arguments").filter(arg => arg.isFunctionExpression())[0].get("body");
amdFactory.pushContainer("directives", directives);
amdFactory.pushContainer("body", body);
}
var _default = (0, _helperPluginUtils().declare)((api, options) => {
api.assertVersion(7);
const {
loose,
allowTopLevelThis,
strict,
strictMode,
noInterop
} = options;
return {
name: "transform-modules-amd",
pre() {
this.file.set("@babel/plugin-transform-modules-*", "amd");
},
visitor: {
CallExpression(path, state) {
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) return;
if (!path.get("callee").isImport()) return;
let {
requireId,
resolveId,
rejectId
} = state;
if (!requireId) {
requireId = path.scope.generateUidIdentifier("require");
state.requireId = requireId;
}
if (!resolveId || !rejectId) {
resolveId = path.scope.generateUidIdentifier("resolve");
rejectId = path.scope.generateUidIdentifier("reject");
state.resolveId = resolveId;
state.rejectId = rejectId;
}
let result = _core().types.identifier("imported");
if (!noInterop) result = (0, _helperModuleTransforms().wrapInterop)(path, result, "namespace");
path.replaceWith(_core().template.expression.ast`
new Promise((${resolveId}, ${rejectId}) =>
${requireId}(
[${(0, _utils().getImportSource)(_core().types, path.node)}],
imported => ${resolveId}(${result}),
${rejectId}
)
)`);
},
Program: {
exit(path, {
requireId
}) {
if (!(0, _helperModuleTransforms().isModule)(path)) {
if (requireId) {
injectWrapper(path, buildAnonymousWrapper({
REQUIRE: requireId
}));
}
return;
}
const amdArgs = [];
const importNames = [];
if (requireId) {
amdArgs.push(_core().types.stringLiteral("require"));
importNames.push(requireId);
}
let moduleName = this.getModuleName();
if (moduleName) moduleName = _core().types.stringLiteral(moduleName);
const {
meta,
headers
} = (0, _helperModuleTransforms().rewriteModuleStatementsAndPrepareHeader)(path, {
loose,
strict,
strictMode,
allowTopLevelThis,
noInterop
});
if ((0, _helperModuleTransforms().hasExports)(meta)) {
amdArgs.push(_core().types.stringLiteral("exports"));
importNames.push(_core().types.identifier(meta.exportName));
}
for (const [source, metadata] of meta.source) {
amdArgs.push(_core().types.stringLiteral(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 = metadata.loc;
headers.push(header);
}
}
headers.push(...(0, _helperModuleTransforms().buildNamespaceInitStatements)(meta, metadata, loose));
}
(0, _helperModuleTransforms().ensureStatementsHoisted)(headers);
path.unshiftContainer("body", headers);
injectWrapper(path, buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: _core().types.arrayExpression(amdArgs),
IMPORT_NAMES: importNames
}));
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-modules-amd@^7.2.0",
"_id": "@babel/plugin-transform-modules-amd@7.5.0",
"_inBundle": false,
"_integrity": "sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg==",
"_location": "/@babel/plugin-transform-modules-amd",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-modules-amd@^7.2.0",
"name": "@babel/plugin-transform-modules-amd",
"escapedName": "@babel%2fplugin-transform-modules-amd",
"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-amd/-/plugin-transform-modules-amd-7.5.0.tgz",
"_shasum": "ef00435d46da0a5961aa728a1d2ecff063e4fb91",
"_spec": "@babel/plugin-transform-modules-amd@^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.1.0",
"@babel/helper-plugin-utils": "^7.0.0",
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"deprecated": false,
"description": "This plugin transforms ES2015 modules to AMD",
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "49da9a07c81156e997e60146eb001ea77b7044c4",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-modules-amd",
"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-amd"
},
"version": "7.5.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-modules-commonjs
> This plugin transforms ES2015 modules to CommonJS
See our website [@babel/plugin-transform-modules-commonjs](https://babeljs.io/docs/en/next/babel-plugin-transform-modules-commonjs.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-modules-commonjs
```
or using yarn:
```sh
yarn add @babel/plugin-transform-modules-commonjs --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperModuleTransforms = require("@babel/helper-module-transforms");
var _helperSimpleAccess = _interopRequireDefault(require("@babel/helper-simple-access"));
var _core = require("@babel/core");
var _utils = require("babel-plugin-dynamic-import-node/utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
const transformImportCall = (0, _utils.createDynamicImportTransform)(api);
const {
loose,
strictNamespace = false,
mjsStrictNamespace = true,
allowTopLevelThis,
strict,
strictMode,
noInterop,
lazy = false,
allowCommonJSExports = true
} = options;
if (typeof lazy !== "boolean" && typeof lazy !== "function" && (!Array.isArray(lazy) || !lazy.every(item => typeof item === "string"))) {
throw new Error(`.lazy must be a boolean, array of strings, or a function`);
}
if (typeof strictNamespace !== "boolean") {
throw new Error(`.strictNamespace must be a boolean, or undefined`);
}
if (typeof mjsStrictNamespace !== "boolean") {
throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`);
}
const getAssertion = localName => _core.template.expression.ast`
(function(){
throw new Error(
"The CommonJS '" + "${localName}" + "' variable is not available in ES6 modules." +
"Consider setting setting sourceType:script or sourceType:unambiguous in your " +
"Babel config for this file.");
})()
`;
const moduleExportsVisitor = {
ReferencedIdentifier(path) {
const localName = path.node.name;
if (localName !== "module" && localName !== "exports") return;
const localBinding = path.scope.getBinding(localName);
const rootBinding = this.scope.getBinding(localName);
if (rootBinding !== localBinding || path.parentPath.isObjectProperty({
value: path.node
}) && path.parentPath.parentPath.isObjectPattern() || path.parentPath.isAssignmentExpression({
left: path.node
}) || path.isAssignmentExpression({
left: path.node
})) {
return;
}
path.replaceWith(getAssertion(localName));
},
AssignmentExpression(path) {
const left = path.get("left");
if (left.isIdentifier()) {
const localName = path.node.name;
if (localName !== "module" && localName !== "exports") return;
const localBinding = path.scope.getBinding(localName);
const rootBinding = this.scope.getBinding(localName);
if (rootBinding !== localBinding) return;
const right = path.get("right");
right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)]));
} else if (left.isPattern()) {
const ids = left.getOuterBindingIdentifiers();
const localName = Object.keys(ids).filter(localName => {
if (localName !== "module" && localName !== "exports") return false;
return this.scope.getBinding(localName) === path.scope.getBinding(localName);
})[0];
if (localName) {
const right = path.get("right");
right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)]));
}
}
}
};
return {
name: "transform-modules-commonjs",
pre() {
this.file.set("@babel/plugin-transform-modules-*", "commonjs");
},
visitor: {
CallExpression(path) {
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) return;
if (!path.get("callee").isImport()) return;
let {
scope
} = path;
do {
scope.rename("require");
} while (scope = scope.parent);
transformImportCall(this, path.get("callee"));
},
Program: {
exit(path, state) {
if (!(0, _helperModuleTransforms.isModule)(path)) return;
path.scope.rename("exports");
path.scope.rename("module");
path.scope.rename("require");
path.scope.rename("__filename");
path.scope.rename("__dirname");
if (!allowCommonJSExports) {
(0, _helperSimpleAccess.default)(path, new Set(["module", "exports"]));
path.traverse(moduleExportsVisitor, {
scope: path.scope
});
}
let moduleName = this.getModuleName();
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
const {
meta,
headers
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
exportName: "exports",
loose,
strict,
strictMode,
allowTopLevelThis,
noInterop,
lazy,
esNamespaceOnly: typeof state.filename === "string" && /\.mjs$/.test(state.filename) ? mjsStrictNamespace : strictNamespace
});
for (const [source, metadata] of meta.source) {
const loadExpr = _core.types.callExpression(_core.types.identifier("require"), [_core.types.stringLiteral(source)]);
let header;
if ((0, _helperModuleTransforms.isSideEffectImport)(metadata)) {
if (metadata.lazy) throw new Error("Assertion failure");
header = _core.types.expressionStatement(loadExpr);
} else {
const init = (0, _helperModuleTransforms.wrapInterop)(path, loadExpr, metadata.interop) || loadExpr;
if (metadata.lazy) {
header = _core.template.ast`
function ${metadata.name}() {
const data = ${init};
${metadata.name} = function(){ return data; };
return data;
}
`;
} else {
header = _core.template.ast`
var ${metadata.name} = ${init};
`;
}
}
header.loc = metadata.loc;
headers.push(header);
headers.push(...(0, _helperModuleTransforms.buildNamespaceInitStatements)(meta, metadata, loose));
}
(0, _helperModuleTransforms.ensureStatementsHoisted)(headers);
path.unshiftContainer("body", headers);
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-modules-commonjs@^7.2.0",
"_id": "@babel/plugin-transform-modules-commonjs@7.7.0",
"_inBundle": false,
"_integrity": "sha512-KEMyWNNWnjOom8vR/1+d+Ocz/mILZG/eyHHO06OuBQ2aNhxT62fr4y6fGOplRx+CxCSp3IFwesL8WdINfY/3kg==",
"_location": "/@babel/plugin-transform-modules-commonjs",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-modules-commonjs@^7.2.0",
"name": "@babel/plugin-transform-modules-commonjs",
"escapedName": "@babel%2fplugin-transform-modules-commonjs",
"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-commonjs/-/plugin-transform-modules-commonjs-7.7.0.tgz",
"_shasum": "3e5ffb4fd8c947feede69cbe24c9554ab4113fe3",
"_spec": "@babel/plugin-transform-modules-commonjs@^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",
"@babel/helper-simple-access": "^7.7.0",
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"deprecated": false,
"description": "This plugin transforms ES2015 modules to CommonJS",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/plugin-syntax-object-rest-spread": "^7.2.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-modules-commonjs",
"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-commonjs"
},
"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-modules-systemjs
> This plugin transforms ES2015 modules to SystemJS
See our website [@babel/plugin-transform-modules-systemjs](https://babeljs.io/docs/en/next/babel-plugin-transform-modules-systemjs.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-modules-systemjs
```
or using yarn:
```sh
yarn add @babel/plugin-transform-modules-systemjs --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperHoistVariables = _interopRequireDefault(require("@babel/helper-hoist-variables"));
var _core = require("@babel/core");
var _utils = require("babel-plugin-dynamic-import-node/utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const buildTemplate = (0, _core.template)(`
SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {
"use strict";
BEFORE_BODY;
return {
setters: SETTERS,
execute: function () {
BODY;
}
};
});
`);
const buildExportAll = (0, _core.template)(`
for (var KEY in TARGET) {
if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];
}
`);
const MISSING_PLUGIN_WARNING = `\
WARNING: Dynamic import() transformation must be enabled using the
@babel/plugin-proposal-dynamic-import plugin. Babel 8 will
no longer transform import() without using that plugin.
`;
function constructExportCall(path, exportIdent, exportNames, exportValues, exportStarTarget) {
const statements = [];
if (exportNames.length === 1) {
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.stringLiteral(exportNames[0]), exportValues[0]])));
} else if (!exportStarTarget) {
const objectProperties = [];
for (let i = 0; i < exportNames.length; i++) {
const exportName = exportNames[i];
const exportValue = exportValues[i];
objectProperties.push(_core.types.objectProperty(_core.types.identifier(exportName), exportValue));
}
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.objectExpression(objectProperties)])));
} else {
const exportObj = path.scope.generateUid("exportObj");
statements.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(exportObj), _core.types.objectExpression([]))]));
statements.push(buildExportAll({
KEY: path.scope.generateUidIdentifier("key"),
EXPORT_OBJ: _core.types.identifier(exportObj),
TARGET: exportStarTarget
}));
for (let i = 0; i < exportNames.length; i++) {
const exportName = exportNames[i];
const exportValue = exportValues[i];
statements.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.identifier(exportObj), _core.types.identifier(exportName)), exportValue)));
}
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.identifier(exportObj)])));
}
return statements;
}
var _default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
const {
systemGlobal = "System"
} = options;
const IGNORE_REASSIGNMENT_SYMBOL = Symbol();
const reassignmentVisitor = {
"AssignmentExpression|UpdateExpression"(path) {
if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return;
path.node[IGNORE_REASSIGNMENT_SYMBOL] = true;
const arg = path.get(path.isAssignmentExpression() ? "left" : "argument");
if (arg.isObjectPattern() || arg.isArrayPattern()) {
const exprs = [path.node];
for (const name of Object.keys(arg.getBindingIdentifiers())) {
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) {
return;
}
const exportedNames = this.exports[name];
if (!exportedNames) return;
for (const exportedName of exportedNames) {
exprs.push(this.buildCall(exportedName, _core.types.identifier(name)).expression);
}
}
path.replaceWith(_core.types.sequenceExpression(exprs));
return;
}
if (!arg.isIdentifier()) return;
const name = arg.node.name;
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
const exportedNames = this.exports[name];
if (!exportedNames) return;
let node = path.node;
const isPostUpdateExpression = path.isUpdateExpression({
prefix: false
});
if (isPostUpdateExpression) {
node = _core.types.binaryExpression(node.operator[0], _core.types.unaryExpression("+", _core.types.cloneNode(node.argument)), _core.types.numericLiteral(1));
}
for (const exportedName of exportedNames) {
node = this.buildCall(exportedName, node).expression;
}
if (isPostUpdateExpression) {
node = _core.types.sequenceExpression([node, path.node]);
}
path.replaceWith(node);
}
};
return {
name: "transform-modules-systemjs",
pre() {
this.file.set("@babel/plugin-transform-modules-*", "systemjs");
},
visitor: {
CallExpression(path, state) {
if (_core.types.isImport(path.node.callee)) {
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) {
console.warn(MISSING_PLUGIN_WARNING);
}
path.replaceWith(_core.types.callExpression(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("import")), [(0, _utils.getImportSource)(_core.types, path.node)]));
}
},
MetaProperty(path, state) {
if (path.node.meta.name === "import" && path.node.property.name === "meta") {
path.replaceWith(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("meta")));
}
},
ReferencedIdentifier(path, state) {
if (path.node.name === "__moduleName" && !path.scope.hasBinding("__moduleName")) {
path.replaceWith(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("id")));
}
},
Program: {
enter(path, state) {
state.contextIdent = path.scope.generateUid("context");
},
exit(path, state) {
const undefinedIdent = path.scope.buildUndefinedNode();
const exportIdent = path.scope.generateUid("export");
const contextIdent = state.contextIdent;
const exportMap = Object.create(null);
const modules = [];
let beforeBody = [];
const setters = [];
const sources = [];
const variableIds = [];
const removedPaths = [];
function addExportName(key, val) {
exportMap[key] = exportMap[key] || [];
exportMap[key].push(val);
}
function pushModule(source, key, specifiers) {
let module;
modules.forEach(function (m) {
if (m.key === source) {
module = m;
}
});
if (!module) {
modules.push(module = {
key: source,
imports: [],
exports: []
});
}
module[key] = module[key].concat(specifiers);
}
function buildExportCall(name, val) {
return _core.types.expressionStatement(_core.types.callExpression(_core.types.identifier(exportIdent), [_core.types.stringLiteral(name), val]));
}
const exportNames = [];
const exportValues = [];
const body = path.get("body");
for (const path of body) {
if (path.isFunctionDeclaration()) {
beforeBody.push(path.node);
removedPaths.push(path);
} else if (path.isClassDeclaration()) {
variableIds.push(path.node.id);
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(path.node.id), _core.types.toExpression(path.node))));
} else if (path.isImportDeclaration()) {
const source = path.node.source.value;
pushModule(source, "imports", path.node.specifiers);
for (const name of Object.keys(path.getBindingIdentifiers())) {
path.scope.removeBinding(name);
variableIds.push(_core.types.identifier(name));
}
path.remove();
} else if (path.isExportAllDeclaration()) {
pushModule(path.node.source.value, "exports", path.node);
path.remove();
} else if (path.isExportDefaultDeclaration()) {
const declar = path.get("declaration");
const id = declar.node.id;
if (declar.isClassDeclaration()) {
if (id) {
exportNames.push("default");
exportValues.push(undefinedIdent);
variableIds.push(id);
addExportName(id.name, "default");
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(id), _core.types.toExpression(declar.node))));
} else {
exportNames.push("default");
exportValues.push(_core.types.toExpression(declar.node));
removedPaths.push(path);
}
} else if (declar.isFunctionDeclaration()) {
if (id) {
beforeBody.push(declar.node);
exportNames.push("default");
exportValues.push(_core.types.cloneNode(id));
addExportName(id.name, "default");
} else {
exportNames.push("default");
exportValues.push(_core.types.toExpression(declar.node));
}
removedPaths.push(path);
} else {
path.replaceWith(buildExportCall("default", declar.node));
}
} else if (path.isExportNamedDeclaration()) {
const declar = path.get("declaration");
if (declar.node) {
path.replaceWith(declar);
if (path.isFunction()) {
const node = declar.node;
const name = node.id.name;
addExportName(name, name);
beforeBody.push(node);
exportNames.push(name);
exportValues.push(_core.types.cloneNode(node.id));
removedPaths.push(path);
} else if (path.isClass()) {
const name = declar.node.id.name;
exportNames.push(name);
exportValues.push(undefinedIdent);
variableIds.push(declar.node.id);
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(declar.node.id), _core.types.toExpression(declar.node))));
addExportName(name, name);
} else {
for (const name of Object.keys(declar.getBindingIdentifiers())) {
addExportName(name, name);
}
}
} else {
const specifiers = path.node.specifiers;
if (specifiers && specifiers.length) {
if (path.node.source) {
pushModule(path.node.source.value, "exports", specifiers);
path.remove();
} else {
const nodes = [];
for (const specifier of specifiers) {
const binding = path.scope.getBinding(specifier.local.name);
if (binding && _core.types.isFunctionDeclaration(binding.path.node)) {
exportNames.push(specifier.exported.name);
exportValues.push(_core.types.cloneNode(specifier.local));
} else if (!binding) {
nodes.push(buildExportCall(specifier.exported.name, specifier.local));
}
addExportName(specifier.local.name, specifier.exported.name);
}
path.replaceWithMultiple(nodes);
}
} else {
path.remove();
}
}
}
}
modules.forEach(function (specifiers) {
let setterBody = [];
const target = path.scope.generateUid(specifiers.key);
for (let specifier of specifiers.imports) {
if (_core.types.isImportNamespaceSpecifier(specifier)) {
setterBody.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", specifier.local, _core.types.identifier(target))));
} else if (_core.types.isImportDefaultSpecifier(specifier)) {
specifier = _core.types.importSpecifier(specifier.local, _core.types.identifier("default"));
}
if (_core.types.isImportSpecifier(specifier)) {
setterBody.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", specifier.local, _core.types.memberExpression(_core.types.identifier(target), specifier.imported))));
}
}
if (specifiers.exports.length) {
const exportNames = [];
const exportValues = [];
let hasExportStar = false;
for (const node of specifiers.exports) {
if (_core.types.isExportAllDeclaration(node)) {
hasExportStar = true;
} else if (_core.types.isExportSpecifier(node)) {
exportNames.push(node.exported.name);
exportValues.push(_core.types.memberExpression(_core.types.identifier(target), node.local));
} else {}
}
setterBody = setterBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, hasExportStar ? _core.types.identifier(target) : null));
}
sources.push(_core.types.stringLiteral(specifiers.key));
setters.push(_core.types.functionExpression(null, [_core.types.identifier(target)], _core.types.blockStatement(setterBody)));
});
let moduleName = this.getModuleName();
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
(0, _helperHoistVariables.default)(path, (id, name, hasInit) => {
variableIds.push(id);
if (!hasInit) {
exportNames.push(name);
exportValues.push(undefinedIdent);
}
}, null);
if (variableIds.length) {
beforeBody.unshift(_core.types.variableDeclaration("var", variableIds.map(id => _core.types.variableDeclarator(id))));
}
if (exportNames.length) {
beforeBody = beforeBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, null));
}
path.traverse(reassignmentVisitor, {
exports: exportMap,
buildCall: buildExportCall,
scope: path.scope
});
for (const path of removedPaths) {
path.remove();
}
path.node.body = [buildTemplate({
SYSTEM_REGISTER: _core.types.memberExpression(_core.types.identifier(systemGlobal), _core.types.identifier("register")),
BEFORE_BODY: beforeBody,
MODULE_NAME: moduleName,
SETTERS: _core.types.arrayExpression(setters),
SOURCES: _core.types.arrayExpression(sources),
BODY: path.node.body,
EXPORT_IDENTIFIER: _core.types.identifier(exportIdent),
CONTEXT_IDENTIFIER: _core.types.identifier(contextIdent)
})];
}
}
}
};
});
exports.default = _default;
\ No newline at end of file
{
"_from": "@babel/plugin-transform-modules-systemjs@^7.3.4",
"_id": "@babel/plugin-transform-modules-systemjs@7.7.0",
"_inBundle": false,
"_integrity": "sha512-ZAuFgYjJzDNv77AjXRqzQGlQl4HdUM6j296ee4fwKVZfhDR9LAGxfvXjBkb06gNETPnN0sLqRm9Gxg4wZH6dXg==",
"_location": "/@babel/plugin-transform-modules-systemjs",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-transform-modules-systemjs@^7.3.4",
"name": "@babel/plugin-transform-modules-systemjs",
"escapedName": "@babel%2fplugin-transform-modules-systemjs",
"scope": "@babel",
"rawSpec": "^7.3.4",
"saveSpec": null,
"fetchSpec": "^7.3.4"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.0.tgz",
"_shasum": "9baf471213af9761c1617bb12fd278e629041417",
"_spec": "@babel/plugin-transform-modules-systemjs@^7.3.4",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\preset-env",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-hoist-variables": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0",
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"deprecated": false,
"description": "This plugin transforms ES2015 modules to SystemJS",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-transform-modules-systemjs",
"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-systemjs"
},
"version": "7.7.0"
}
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