Upload folder using huggingface_hub (part 7)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/@babel/plugin-transform-member-expression-literals/package.json +34 -0
- node_modules/@babel/plugin-transform-modules-amd/LICENSE +22 -0
- node_modules/@babel/plugin-transform-modules-amd/README.md +19 -0
- node_modules/@babel/plugin-transform-modules-amd/lib/index.js +144 -0
- node_modules/@babel/plugin-transform-modules-amd/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-amd/package.json +36 -0
- node_modules/@babel/plugin-transform-modules-commonjs/LICENSE +22 -0
- node_modules/@babel/plugin-transform-modules-commonjs/README.md +19 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js +16 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/hooks.js +37 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/hooks.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js +192 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js +44 -0
- node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-commonjs/package.json +36 -0
- node_modules/@babel/plugin-transform-modules-systemjs/LICENSE +22 -0
- node_modules/@babel/plugin-transform-modules-systemjs/README.md +19 -0
- node_modules/@babel/plugin-transform-modules-systemjs/lib/index.js +407 -0
- node_modules/@babel/plugin-transform-modules-systemjs/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-systemjs/package.json +39 -0
- node_modules/@babel/plugin-transform-modules-umd/LICENSE +22 -0
- node_modules/@babel/plugin-transform-modules-umd/README.md +19 -0
- node_modules/@babel/plugin-transform-modules-umd/lib/index.js +156 -0
- node_modules/@babel/plugin-transform-modules-umd/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-modules-umd/package.json +36 -0
- node_modules/@babel/plugin-transform-named-capturing-groups-regex/LICENSE +22 -0
- node_modules/@babel/plugin-transform-named-capturing-groups-regex/README.md +19 -0
- node_modules/@babel/plugin-transform-named-capturing-groups-regex/lib/index.js +25 -0
- node_modules/@babel/plugin-transform-named-capturing-groups-regex/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-named-capturing-groups-regex/package.json +40 -0
- node_modules/@babel/plugin-transform-new-target/LICENSE +22 -0
- node_modules/@babel/plugin-transform-new-target/README.md +19 -0
- node_modules/@babel/plugin-transform-new-target/lib/index.js +71 -0
- node_modules/@babel/plugin-transform-new-target/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-new-target/package.json +36 -0
- node_modules/@babel/plugin-transform-nullish-coalescing-operator/LICENSE +22 -0
- node_modules/@babel/plugin-transform-nullish-coalescing-operator/README.md +19 -0
- node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js +49 -0
- node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-nullish-coalescing-operator/package.json +34 -0
- node_modules/@babel/plugin-transform-numeric-separator/LICENSE +22 -0
- node_modules/@babel/plugin-transform-numeric-separator/README.md +19 -0
- node_modules/@babel/plugin-transform-numeric-separator/lib/index.js +31 -0
- node_modules/@babel/plugin-transform-numeric-separator/lib/index.js.map +1 -0
- node_modules/@babel/plugin-transform-numeric-separator/package.json +36 -0
- node_modules/@babel/plugin-transform-object-rest-spread/LICENSE +22 -0
- node_modules/@babel/plugin-transform-object-rest-spread/README.md +19 -0
- node_modules/@babel/plugin-transform-object-rest-spread/lib/index.js +550 -0
node_modules/@babel/plugin-transform-member-expression-literals/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-member-expression-literals",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "Ensure that reserved words are quoted in property accesses",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-member-expression-literals"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-member-expression-literals",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"keywords": [
|
| 17 |
+
"babel-plugin"
|
| 18 |
+
],
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 21 |
+
},
|
| 22 |
+
"peerDependencies": {
|
| 23 |
+
"@babel/core": "^7.0.0-0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"@babel/core": "^7.29.7",
|
| 27 |
+
"@babel/helper-plugin-test-runner": "^7.29.7"
|
| 28 |
+
},
|
| 29 |
+
"engines": {
|
| 30 |
+
"node": ">=6.9.0"
|
| 31 |
+
},
|
| 32 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 33 |
+
"type": "commonjs"
|
| 34 |
+
}
|
node_modules/@babel/plugin-transform-modules-amd/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-modules-amd/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-modules-amd
|
| 2 |
+
|
| 3 |
+
> This plugin transforms ES2015 modules to AMD
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-modules-amd](https://babeljs.io/docs/babel-plugin-transform-modules-amd) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-modules-amd
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-modules-amd --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-modules-amd/lib/index.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 8 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 9 |
+
var _core = require("@babel/core");
|
| 10 |
+
const buildWrapper = _core.template.statement(`
|
| 11 |
+
define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {
|
| 12 |
+
})
|
| 13 |
+
`);
|
| 14 |
+
const buildAnonymousWrapper = _core.template.statement(`
|
| 15 |
+
define(["require"], function(REQUIRE) {
|
| 16 |
+
})
|
| 17 |
+
`);
|
| 18 |
+
function injectWrapper(path, wrapper) {
|
| 19 |
+
const {
|
| 20 |
+
body,
|
| 21 |
+
directives
|
| 22 |
+
} = path.node;
|
| 23 |
+
path.node.directives = [];
|
| 24 |
+
path.node.body = [];
|
| 25 |
+
const amdFactoryCall = path.pushContainer("body", wrapper)[0].get("expression");
|
| 26 |
+
const amdFactoryCallArgs = amdFactoryCall.get("arguments");
|
| 27 |
+
const amdFactory = amdFactoryCallArgs[amdFactoryCallArgs.length - 1].get("body");
|
| 28 |
+
amdFactory.pushContainer("directives", directives);
|
| 29 |
+
amdFactory.pushContainer("body", body);
|
| 30 |
+
}
|
| 31 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
| 32 |
+
var _api$assumption, _api$assumption2;
|
| 33 |
+
api.assertVersion(7);
|
| 34 |
+
const {
|
| 35 |
+
allowTopLevelThis,
|
| 36 |
+
strict,
|
| 37 |
+
strictMode,
|
| 38 |
+
importInterop,
|
| 39 |
+
noInterop
|
| 40 |
+
} = options;
|
| 41 |
+
const constantReexports = (_api$assumption = api.assumption("constantReexports")) != null ? _api$assumption : options.loose;
|
| 42 |
+
const enumerableModuleMeta = (_api$assumption2 = api.assumption("enumerableModuleMeta")) != null ? _api$assumption2 : options.loose;
|
| 43 |
+
return {
|
| 44 |
+
name: "transform-modules-amd",
|
| 45 |
+
pre() {
|
| 46 |
+
this.file.set("@babel/plugin-transform-modules-*", "amd");
|
| 47 |
+
},
|
| 48 |
+
visitor: {
|
| 49 |
+
["CallExpression" + (api.types.importExpression ? "|ImportExpression" : "")](path, state) {
|
| 50 |
+
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) return;
|
| 51 |
+
if (path.isCallExpression() && !path.get("callee").isImport()) return;
|
| 52 |
+
let {
|
| 53 |
+
requireId,
|
| 54 |
+
resolveId,
|
| 55 |
+
rejectId
|
| 56 |
+
} = state;
|
| 57 |
+
if (!requireId) {
|
| 58 |
+
requireId = path.scope.generateUidIdentifier("require");
|
| 59 |
+
state.requireId = requireId;
|
| 60 |
+
}
|
| 61 |
+
if (!resolveId || !rejectId) {
|
| 62 |
+
resolveId = path.scope.generateUidIdentifier("resolve");
|
| 63 |
+
rejectId = path.scope.generateUidIdentifier("reject");
|
| 64 |
+
state.resolveId = resolveId;
|
| 65 |
+
state.rejectId = rejectId;
|
| 66 |
+
}
|
| 67 |
+
let result = _core.types.identifier("imported");
|
| 68 |
+
if (!noInterop) {
|
| 69 |
+
result = (0, _helperModuleTransforms.wrapInterop)(this.file.path, result, "namespace");
|
| 70 |
+
}
|
| 71 |
+
path.replaceWith((0, _helperModuleTransforms.buildDynamicImport)(path.node, false, false, specifier => _core.template.expression.ast`
|
| 72 |
+
new Promise((${resolveId}, ${rejectId}) =>
|
| 73 |
+
${requireId}(
|
| 74 |
+
[${specifier}],
|
| 75 |
+
imported => ${_core.types.cloneNode(resolveId)}(${result}),
|
| 76 |
+
${_core.types.cloneNode(rejectId)}
|
| 77 |
+
)
|
| 78 |
+
)
|
| 79 |
+
`));
|
| 80 |
+
},
|
| 81 |
+
Program: {
|
| 82 |
+
exit(path, {
|
| 83 |
+
requireId
|
| 84 |
+
}) {
|
| 85 |
+
if (!(0, _helperModuleTransforms.isModule)(path)) {
|
| 86 |
+
if (requireId) {
|
| 87 |
+
injectWrapper(path, buildAnonymousWrapper({
|
| 88 |
+
REQUIRE: _core.types.cloneNode(requireId)
|
| 89 |
+
}));
|
| 90 |
+
}
|
| 91 |
+
return;
|
| 92 |
+
}
|
| 93 |
+
const amdArgs = [];
|
| 94 |
+
const importNames = [];
|
| 95 |
+
if (requireId) {
|
| 96 |
+
amdArgs.push(_core.types.stringLiteral("require"));
|
| 97 |
+
importNames.push(_core.types.cloneNode(requireId));
|
| 98 |
+
}
|
| 99 |
+
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
|
| 100 |
+
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
|
| 101 |
+
const {
|
| 102 |
+
meta,
|
| 103 |
+
headers
|
| 104 |
+
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
|
| 105 |
+
enumerableModuleMeta,
|
| 106 |
+
constantReexports,
|
| 107 |
+
strict,
|
| 108 |
+
strictMode,
|
| 109 |
+
allowTopLevelThis,
|
| 110 |
+
importInterop,
|
| 111 |
+
noInterop,
|
| 112 |
+
filename: this.file.opts.filename
|
| 113 |
+
});
|
| 114 |
+
if ((0, _helperModuleTransforms.hasExports)(meta)) {
|
| 115 |
+
amdArgs.push(_core.types.stringLiteral("exports"));
|
| 116 |
+
importNames.push(_core.types.identifier(meta.exportName));
|
| 117 |
+
}
|
| 118 |
+
for (const [source, metadata] of meta.source) {
|
| 119 |
+
amdArgs.push(_core.types.stringLiteral(source));
|
| 120 |
+
importNames.push(_core.types.identifier(metadata.name));
|
| 121 |
+
if (!(0, _helperModuleTransforms.isSideEffectImport)(metadata)) {
|
| 122 |
+
const interop = (0, _helperModuleTransforms.wrapInterop)(path, _core.types.identifier(metadata.name), metadata.interop);
|
| 123 |
+
if (interop) {
|
| 124 |
+
const header = _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.identifier(metadata.name), interop));
|
| 125 |
+
header.loc = metadata.loc;
|
| 126 |
+
headers.push(header);
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
headers.push(...(0, _helperModuleTransforms.buildNamespaceInitStatements)(meta, metadata, constantReexports));
|
| 130 |
+
}
|
| 131 |
+
(0, _helperModuleTransforms.ensureStatementsHoisted)(headers);
|
| 132 |
+
path.unshiftContainer("body", headers);
|
| 133 |
+
injectWrapper(path, buildWrapper({
|
| 134 |
+
MODULE_NAME: moduleName,
|
| 135 |
+
AMD_ARGUMENTS: _core.types.arrayExpression(amdArgs),
|
| 136 |
+
IMPORT_NAMES: importNames
|
| 137 |
+
}));
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
};
|
| 142 |
+
});
|
| 143 |
+
|
| 144 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-modules-amd/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_helperModuleTransforms","_core","buildWrapper","template","statement","buildAnonymousWrapper","injectWrapper","path","wrapper","body","directives","node","amdFactoryCall","pushContainer","get","amdFactoryCallArgs","amdFactory","length","_default","exports","default","declare","api","options","_api$assumption","_api$assumption2","assertVersion","allowTopLevelThis","strict","strictMode","importInterop","noInterop","constantReexports","assumption","loose","enumerableModuleMeta","name","pre","file","set","visitor","types","importExpression","state","has","isCallExpression","isImport","requireId","resolveId","rejectId","scope","generateUidIdentifier","result","t","identifier","wrapInterop","replaceWith","buildDynamicImport","specifier","expression","ast","cloneNode","Program","exit","isModule","REQUIRE","amdArgs","importNames","push","stringLiteral","moduleName","getModuleName","opts","meta","headers","rewriteModuleStatementsAndPrepareHeader","filename","hasExports","exportName","source","metadata","isSideEffectImport","interop","header","expressionStatement","assignmentExpression","loc","buildNamespaceInitStatements","ensureStatementsHoisted","unshiftContainer","MODULE_NAME","AMD_ARGUMENTS","arrayExpression","IMPORT_NAMES"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport {\n buildDynamicImport,\n isModule,\n rewriteModuleStatementsAndPrepareHeader,\n type RewriteModuleStatementsAndPrepareHeaderOptions,\n hasExports,\n isSideEffectImport,\n buildNamespaceInitStatements,\n ensureStatementsHoisted,\n wrapInterop,\n getModuleName,\n} from \"@babel/helper-module-transforms\";\nimport { template, types as t } from \"@babel/core\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\nimport type { NodePath, PluginPass } from \"@babel/core\";\n\nconst buildWrapper = template.statement(`\n define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {\n })\n`);\n\nconst buildAnonymousWrapper = template.statement(`\n define([\"require\"], function(REQUIRE) {\n })\n`);\n\nfunction injectWrapper(\n path: NodePath<t.Program>,\n wrapper: t.ExpressionStatement,\n) {\n const { body, directives } = path.node;\n path.node.directives = [];\n path.node.body = [];\n const amdFactoryCall = path\n .pushContainer(\"body\", wrapper)[0]\n .get(\"expression\") as NodePath<t.CallExpression>;\n const amdFactoryCallArgs = amdFactoryCall.get(\"arguments\");\n const amdFactory = (\n amdFactoryCallArgs[\n amdFactoryCallArgs.length - 1\n ] as NodePath<t.FunctionExpression>\n ).get(\"body\");\n amdFactory.pushContainer(\"directives\", directives);\n amdFactory.pushContainer(\"body\", body);\n}\n\nexport interface Options extends PluginOptions {\n allowTopLevelThis?: boolean;\n importInterop?: RewriteModuleStatementsAndPrepareHeaderOptions[\"importInterop\"];\n loose?: boolean;\n noInterop?: boolean;\n strict?: boolean;\n strictMode?: boolean;\n}\n\ntype State = {\n requireId?: t.Identifier;\n resolveId?: t.Identifier;\n rejectId?: t.Identifier;\n};\n\nexport default declare<State>((api, options: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const { allowTopLevelThis, strict, strictMode, importInterop, noInterop } =\n options;\n\n const constantReexports =\n api.assumption(\"constantReexports\") ?? options.loose;\n const enumerableModuleMeta =\n api.assumption(\"enumerableModuleMeta\") ?? options.loose;\n\n return {\n name: \"transform-modules-amd\",\n\n pre() {\n this.file.set(\"@babel/plugin-transform-modules-*\", \"amd\");\n },\n\n visitor: {\n [\"CallExpression\" +\n (api.types.importExpression ? \"|ImportExpression\" : \"\")](\n this: State & PluginPass,\n path: NodePath<t.CallExpression | t.ImportExpression>,\n state: State,\n ) {\n if (!this.file.has(\"@babel/plugin-proposal-dynamic-import\")) return;\n if (path.isCallExpression() && !path.get(\"callee\").isImport()) return;\n\n let { requireId, resolveId, rejectId } = state;\n if (!requireId) {\n requireId = path.scope.generateUidIdentifier(\"require\");\n state.requireId = requireId;\n }\n if (!resolveId || !rejectId) {\n resolveId = path.scope.generateUidIdentifier(\"resolve\");\n rejectId = path.scope.generateUidIdentifier(\"reject\");\n state.resolveId = resolveId;\n state.rejectId = rejectId;\n }\n\n let result: t.Node = t.identifier(\"imported\");\n if (!noInterop) {\n result = wrapInterop(this.file.path, result, \"namespace\");\n }\n\n path.replaceWith(\n buildDynamicImport(\n path.node,\n false,\n false,\n specifier => template.expression.ast`\n new Promise((${resolveId}, ${rejectId}) =>\n ${requireId}(\n [${specifier}],\n imported => ${t.cloneNode(resolveId)}(${result}),\n ${t.cloneNode(rejectId)}\n )\n )\n `,\n ),\n );\n },\n Program: {\n exit(path, { requireId }) {\n if (!isModule(path)) {\n if (requireId) {\n injectWrapper(\n path,\n buildAnonymousWrapper({\n REQUIRE: t.cloneNode(requireId),\n }) as t.ExpressionStatement,\n );\n }\n return;\n }\n\n const amdArgs = [];\n const importNames = [];\n if (requireId) {\n amdArgs.push(t.stringLiteral(\"require\"));\n importNames.push(t.cloneNode(requireId));\n }\n\n let moduleName = getModuleName(this.file.opts, options);\n // @ts-expect-error todo(flow->ts): do not reuse variables\n if (moduleName) moduleName = t.stringLiteral(moduleName);\n\n const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(\n path,\n {\n enumerableModuleMeta,\n constantReexports,\n strict,\n strictMode,\n allowTopLevelThis,\n importInterop,\n noInterop,\n filename: this.file.opts.filename,\n },\n );\n\n if (hasExports(meta)) {\n amdArgs.push(t.stringLiteral(\"exports\"));\n\n importNames.push(t.identifier(meta.exportName));\n }\n\n for (const [source, metadata] of meta.source) {\n amdArgs.push(t.stringLiteral(source));\n importNames.push(t.identifier(metadata.name));\n\n if (!isSideEffectImport(metadata)) {\n const interop = wrapInterop(\n path,\n t.identifier(metadata.name),\n metadata.interop,\n );\n if (interop) {\n const header = t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.identifier(metadata.name),\n interop,\n ),\n );\n header.loc = metadata.loc;\n headers.push(header);\n }\n }\n\n headers.push(\n ...buildNamespaceInitStatements(\n meta,\n metadata,\n constantReexports,\n ),\n );\n }\n\n ensureStatementsHoisted(headers);\n path.unshiftContainer(\"body\", headers);\n\n injectWrapper(\n path,\n buildWrapper({\n MODULE_NAME: moduleName,\n\n AMD_ARGUMENTS: t.arrayExpression(amdArgs),\n IMPORT_NAMES: importNames,\n }) as t.ExpressionStatement,\n );\n },\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAYA,IAAAE,KAAA,GAAAF,OAAA;AAIA,MAAMG,YAAY,GAAGC,cAAQ,CAACC,SAAS,CAAC;AACxC;AACA;AACA,CAAC,CAAC;AAEF,MAAMC,qBAAqB,GAAGF,cAAQ,CAACC,SAAS,CAAC;AACjD;AACA;AACA,CAAC,CAAC;AAEF,SAASE,aAAaA,CACpBC,IAAyB,EACzBC,OAA8B,EAC9B;EACA,MAAM;IAAEC,IAAI;IAAEC;EAAW,CAAC,GAAGH,IAAI,CAACI,IAAI;EACtCJ,IAAI,CAACI,IAAI,CAACD,UAAU,GAAG,EAAE;EACzBH,IAAI,CAAC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AAC;YACzC2B,YAAY,EAAE1B;UAChB,CAAC,CACH,CAAC;QACH;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-modules-amd/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-modules-amd",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "This plugin transforms ES2015 modules to AMD",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-modules-amd"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-amd",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"dependencies": {
|
| 17 |
+
"@babel/helper-module-transforms": "^7.29.7",
|
| 18 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 19 |
+
},
|
| 20 |
+
"keywords": [
|
| 21 |
+
"babel-plugin"
|
| 22 |
+
],
|
| 23 |
+
"peerDependencies": {
|
| 24 |
+
"@babel/core": "^7.0.0-0"
|
| 25 |
+
},
|
| 26 |
+
"devDependencies": {
|
| 27 |
+
"@babel/core": "^7.29.7",
|
| 28 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 29 |
+
"@babel/plugin-external-helpers": "^7.29.7"
|
| 30 |
+
},
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=6.9.0"
|
| 33 |
+
},
|
| 34 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 35 |
+
"type": "commonjs"
|
| 36 |
+
}
|
node_modules/@babel/plugin-transform-modules-commonjs/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-modules-commonjs/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-modules-commonjs
|
| 2 |
+
|
| 3 |
+
> This plugin transforms ES2015 modules to CommonJS
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-modules-commonjs](https://babeljs.io/docs/babel-plugin-transform-modules-commonjs) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-modules-commonjs
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-modules-commonjs --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.transformDynamicImport = transformDynamicImport;
|
| 7 |
+
var _core = require("@babel/core");
|
| 8 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 9 |
+
const requireNoInterop = source => _core.template.expression.ast`require(${source})`;
|
| 10 |
+
const requireInterop = (source, file) => _core.types.callExpression(file.addHelper("interopRequireWildcard"), [requireNoInterop(source)]);
|
| 11 |
+
function transformDynamicImport(path, noInterop, file) {
|
| 12 |
+
const buildRequire = noInterop ? requireNoInterop : requireInterop;
|
| 13 |
+
path.replaceWith((0, _helperModuleTransforms.buildDynamicImport)(path.node, true, false, specifier => buildRequire(specifier, file)));
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
//# sourceMappingURL=dynamic-import.js.map
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/dynamic-import.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_core","require","_helperModuleTransforms","requireNoInterop","source","template","expression","ast","requireInterop","file","t","callExpression","addHelper","transformDynamicImport","path","noInterop","buildRequire","replaceWith","buildDynamicImport","node","specifier"],"sources":["../src/dynamic-import.ts"],"sourcesContent":["// Heavily inspired by\n// https://github.com/airbnb/babel-plugin-dynamic-import-node/blob/master/src/utils.js\n\nimport type { File, NodePath } from \"@babel/core\";\nimport { types as t, template } from \"@babel/core\";\nimport { buildDynamicImport } from \"@babel/helper-module-transforms\";\n\nconst requireNoInterop = (source: t.Expression) =>\n template.expression.ast`require(${source})`;\n\nconst requireInterop = (source: t.Expression, file: File) =>\n t.callExpression(file.addHelper(\"interopRequireWildcard\"), [\n requireNoInterop(source),\n ]);\n\nexport function transformDynamicImport(\n path: NodePath<t.CallExpression | t.ImportExpression>,\n noInterop: boolean,\n file: File,\n) {\n const buildRequire = noInterop ? requireNoInterop : requireInterop;\n\n path.replaceWith(\n buildDynamicImport(path.node, true, false, specifier =>\n buildRequire(specifier, file),\n ),\n );\n}\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,MAAME,gBAAgB,GAAIC,MAAoB,IAC5CC,cAAQ,CAACC,UAAU,CAACC,GAAG,WAAWH,MAAM,GAAG;AAE7C,MAAMI,cAAc,GAAGA,CAACJ,MAAoB,EAAEK,IAAU,KACtDC,WAAC,CAACC,cAAc,CAACF,IAAI,CAACG,SAAS,CAAC,wBAAwB,CAAC,EAAE,CACzDT,gBAAgB,CAACC,MAAM,CAAC,CACzB,CAAC;AAEG,SAASS,sBAAsBA,CACpCC,IAAqD,EACrDC,SAAkB,EAClBN,IAAU,EACV;EACA,MAAMO,YAAY,GAAGD,SAAS,GAAGZ,gBAAgB,GAAGK,cAAc;EAElEM,IAAI,CAACG,WAAW,CACd,IAAAC,0CAAkB,EAACJ,IAAI,CAACK,IAAI,EAAE,IAAI,EAAE,KAAK,EAAEC,SAAS,IAClDJ,YAAY,CAACI,SAAS,EAAEX,IAAI,CAC9B,CACF,CAAC;AACH","ignoreList":[]}
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/hooks.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.defineCommonJSHook = defineCommonJSHook;
|
| 7 |
+
exports.makeInvokers = makeInvokers;
|
| 8 |
+
const commonJSHooksKey = "@babel/plugin-transform-modules-commonjs/customWrapperPlugin";
|
| 9 |
+
function defineCommonJSHook(file, hook) {
|
| 10 |
+
let hooks = file.get(commonJSHooksKey);
|
| 11 |
+
if (!hooks) file.set(commonJSHooksKey, hooks = []);
|
| 12 |
+
hooks.push(hook);
|
| 13 |
+
}
|
| 14 |
+
function findMap(arr, cb) {
|
| 15 |
+
if (arr) {
|
| 16 |
+
for (const el of arr) {
|
| 17 |
+
const res = cb(el);
|
| 18 |
+
if (res != null) return res;
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
function makeInvokers(file) {
|
| 23 |
+
const hooks = file.get(commonJSHooksKey);
|
| 24 |
+
return {
|
| 25 |
+
getWrapperPayload(...args) {
|
| 26 |
+
return findMap(hooks, hook => hook.getWrapperPayload == null ? void 0 : hook.getWrapperPayload(...args));
|
| 27 |
+
},
|
| 28 |
+
wrapReference(...args) {
|
| 29 |
+
return findMap(hooks, hook => hook.wrapReference == null ? void 0 : hook.wrapReference(...args));
|
| 30 |
+
},
|
| 31 |
+
buildRequireWrapper(...args) {
|
| 32 |
+
return findMap(hooks, hook => hook.buildRequireWrapper == null ? void 0 : hook.buildRequireWrapper(...args));
|
| 33 |
+
}
|
| 34 |
+
};
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
//# sourceMappingURL=hooks.js.map
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/hooks.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["commonJSHooksKey","defineCommonJSHook","file","hook","hooks","get","set","push","findMap","arr","cb","el","res","makeInvokers","getWrapperPayload","args","wrapReference","buildRequireWrapper"],"sources":["../src/hooks.ts"],"sourcesContent":["import type { types as t, File } from \"@babel/core\";\nimport type { isSideEffectImport } from \"@babel/helper-module-transforms\";\n\nconst commonJSHooksKey =\n \"@babel/plugin-transform-modules-commonjs/customWrapperPlugin\";\n\ntype SourceMetadata = Parameters<typeof isSideEffectImport>[0];\n\n// A hook exposes a set of function that can customize how `require()` calls and\n// references to the imported bindings are handled. These functions can either\n// return a result, or return `null` to delegate to the next hook.\nexport interface CommonJSHook {\n name: string;\n version: string;\n wrapReference?(ref: t.Expression, payload: unknown): t.CallExpression | null;\n // Optionally wrap a `require` call. If this function returns `false`, the\n // `require` call is removed from the generated code.\n buildRequireWrapper?(\n name: string,\n init: t.Expression,\n payload: unknown,\n referenced: boolean,\n ): t.Statement | false | null;\n getWrapperPayload?(\n source: string,\n metadata: SourceMetadata,\n importNodes: t.Node[],\n ): string | null;\n}\n\nexport function defineCommonJSHook(file: File, hook: CommonJSHook) {\n let hooks = file.get(commonJSHooksKey);\n if (!hooks) file.set(commonJSHooksKey, (hooks = []));\n hooks.push(hook);\n}\n\nfunction findMap<T, U>(arr: T[] | null, cb: (el: T) => U): U | null {\n if (arr) {\n for (const el of arr) {\n const res = cb(el);\n if (res != null) return res;\n }\n }\n}\n\nexport function makeInvokers(\n file: File,\n): Pick<\n CommonJSHook,\n \"wrapReference\" | \"getWrapperPayload\" | \"buildRequireWrapper\"\n> {\n const hooks: CommonJSHook[] | null = file.get(commonJSHooksKey);\n\n return {\n getWrapperPayload(...args) {\n return findMap(hooks, hook => hook.getWrapperPayload?.(...args));\n },\n wrapReference(...args) {\n return findMap(hooks, hook => hook.wrapReference?.(...args));\n },\n buildRequireWrapper(...args) {\n return findMap(hooks, hook => hook.buildRequireWrapper?.(...args));\n },\n };\n}\n"],"mappings":";;;;;;;AAGA,MAAMA,gBAAgB,GACpB,8DAA8D;AA0BzD,SAASC,kBAAkBA,CAACC,IAAU,EAAEC,IAAkB,EAAE;EACjE,IAAIC,KAAK,GAAGF,IAAI,CAACG,GAAG,CAACL,gBAAgB,CAAC;EACtC,IAAI,CAACI,KAAK,EAAEF,IAAI,CAACI,GAAG,CAACN,gBAAgB,EAAGI,KAAK,GAAG,EAAG,CAAC;EACpDA,KAAK,CAACG,IAAI,CAACJ,IAAI,CAAC;AAClB;AAEA,SAASK,OAAOA,CAAOC,GAAe,EAAEC,EAAgB,EAAY;EAClE,IAAID,GAAG,EAAE;IACP,KAAK,MAAME,EAAE,IAAIF,GAAG,EAAE;MACpB,MAAMG,GAAG,GAAGF,EAAE,CAACC,EAAE,CAAC;MAClB,IAAIC,GAAG,IAAI,IAAI,EAAE,OAAOA,GAAG;IAC7B;EACF;AACF;AAEO,SAASC,YAAYA,CAC1BX,IAAU,EAIV;EACA,MAAME,K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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
Object.defineProperty(exports, "defineCommonJSHook", {
|
| 8 |
+
enumerable: true,
|
| 9 |
+
get: function () {
|
| 10 |
+
return _hooks.defineCommonJSHook;
|
| 11 |
+
}
|
| 12 |
+
});
|
| 13 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 14 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 15 |
+
var _core = require("@babel/core");
|
| 16 |
+
var _dynamicImport = require("./dynamic-import.js");
|
| 17 |
+
var _lazy = require("./lazy.js");
|
| 18 |
+
var _hooks = require("./hooks.js");
|
| 19 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
| 20 |
+
var _api$assumption, _api$assumption2, _api$assumption3;
|
| 21 |
+
api.assertVersion(7);
|
| 22 |
+
const {
|
| 23 |
+
strictNamespace = false,
|
| 24 |
+
mjsStrictNamespace = strictNamespace,
|
| 25 |
+
allowTopLevelThis,
|
| 26 |
+
strict,
|
| 27 |
+
strictMode,
|
| 28 |
+
noInterop,
|
| 29 |
+
importInterop,
|
| 30 |
+
lazy = false,
|
| 31 |
+
allowCommonJSExports = true,
|
| 32 |
+
loose = false
|
| 33 |
+
} = options;
|
| 34 |
+
const constantReexports = (_api$assumption = api.assumption("constantReexports")) != null ? _api$assumption : loose;
|
| 35 |
+
const enumerableModuleMeta = (_api$assumption2 = api.assumption("enumerableModuleMeta")) != null ? _api$assumption2 : loose;
|
| 36 |
+
const noIncompleteNsImportDetection = (_api$assumption3 = api.assumption("noIncompleteNsImportDetection")) != null ? _api$assumption3 : false;
|
| 37 |
+
if (typeof lazy !== "boolean" && typeof lazy !== "function" && (!Array.isArray(lazy) || !lazy.every(item => typeof item === "string"))) {
|
| 38 |
+
throw new Error(`.lazy must be a boolean, array of strings, or a function`);
|
| 39 |
+
}
|
| 40 |
+
if (typeof strictNamespace !== "boolean") {
|
| 41 |
+
throw new Error(`.strictNamespace must be a boolean, or undefined`);
|
| 42 |
+
}
|
| 43 |
+
if (typeof mjsStrictNamespace !== "boolean") {
|
| 44 |
+
throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`);
|
| 45 |
+
}
|
| 46 |
+
const getAssertion = localName => _core.template.expression.ast`
|
| 47 |
+
(function(){
|
| 48 |
+
throw new Error(
|
| 49 |
+
"The CommonJS '" + "${localName}" + "' variable is not available in ES6 modules." +
|
| 50 |
+
"Consider setting setting sourceType:script or sourceType:unambiguous in your " +
|
| 51 |
+
"Babel config for this file.");
|
| 52 |
+
})()
|
| 53 |
+
`;
|
| 54 |
+
const moduleExportsVisitor = {
|
| 55 |
+
ReferencedIdentifier(path) {
|
| 56 |
+
const localName = path.node.name;
|
| 57 |
+
if (localName !== "module" && localName !== "exports") return;
|
| 58 |
+
const localBinding = path.scope.getBinding(localName);
|
| 59 |
+
const rootBinding = this.scope.getBinding(localName);
|
| 60 |
+
if (rootBinding !== localBinding || path.parentPath.isObjectProperty({
|
| 61 |
+
value: path.node
|
| 62 |
+
}) && path.parentPath.parentPath.isObjectPattern() || path.parentPath.isAssignmentExpression({
|
| 63 |
+
left: path.node
|
| 64 |
+
}) || path.isAssignmentExpression({
|
| 65 |
+
left: path.node
|
| 66 |
+
})) {
|
| 67 |
+
return;
|
| 68 |
+
}
|
| 69 |
+
path.replaceWith(getAssertion(localName));
|
| 70 |
+
},
|
| 71 |
+
UpdateExpression(path) {
|
| 72 |
+
const arg = path.get("argument");
|
| 73 |
+
if (!arg.isIdentifier()) return;
|
| 74 |
+
const localName = arg.node.name;
|
| 75 |
+
if (localName !== "module" && localName !== "exports") return;
|
| 76 |
+
const localBinding = path.scope.getBinding(localName);
|
| 77 |
+
const rootBinding = this.scope.getBinding(localName);
|
| 78 |
+
if (rootBinding !== localBinding) return;
|
| 79 |
+
path.replaceWith(_core.types.assignmentExpression(path.node.operator[0] + "=", arg.node, getAssertion(localName)));
|
| 80 |
+
},
|
| 81 |
+
AssignmentExpression(path) {
|
| 82 |
+
const left = path.get("left");
|
| 83 |
+
if (left.isIdentifier()) {
|
| 84 |
+
const localName = left.node.name;
|
| 85 |
+
if (localName !== "module" && localName !== "exports") return;
|
| 86 |
+
const localBinding = path.scope.getBinding(localName);
|
| 87 |
+
const rootBinding = this.scope.getBinding(localName);
|
| 88 |
+
if (rootBinding !== localBinding) return;
|
| 89 |
+
const right = path.get("right");
|
| 90 |
+
right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)]));
|
| 91 |
+
} else if (left.isPattern()) {
|
| 92 |
+
const ids = left.getOuterBindingIdentifiers();
|
| 93 |
+
const localName = Object.keys(ids).find(localName => {
|
| 94 |
+
if (localName !== "module" && localName !== "exports") return false;
|
| 95 |
+
return this.scope.getBinding(localName) === path.scope.getBinding(localName);
|
| 96 |
+
});
|
| 97 |
+
if (localName) {
|
| 98 |
+
const right = path.get("right");
|
| 99 |
+
right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)]));
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
};
|
| 104 |
+
return {
|
| 105 |
+
name: "transform-modules-commonjs",
|
| 106 |
+
pre() {
|
| 107 |
+
this.file.set("@babel/plugin-transform-modules-*", "commonjs");
|
| 108 |
+
if (lazy) (0, _hooks.defineCommonJSHook)(this.file, (0, _lazy.lazyImportsHook)(lazy));
|
| 109 |
+
},
|
| 110 |
+
visitor: {
|
| 111 |
+
["CallExpression" + (api.types.importExpression ? "|ImportExpression" : "")](path) {
|
| 112 |
+
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) return;
|
| 113 |
+
if (path.isCallExpression() && !_core.types.isImport(path.node.callee)) return;
|
| 114 |
+
let {
|
| 115 |
+
scope
|
| 116 |
+
} = path;
|
| 117 |
+
do {
|
| 118 |
+
scope.rename("require");
|
| 119 |
+
} while (scope = scope.parent);
|
| 120 |
+
(0, _dynamicImport.transformDynamicImport)(path, noInterop, this.file);
|
| 121 |
+
},
|
| 122 |
+
Program: {
|
| 123 |
+
exit(path, state) {
|
| 124 |
+
if (!(0, _helperModuleTransforms.isModule)(path)) return;
|
| 125 |
+
path.scope.rename("exports");
|
| 126 |
+
path.scope.rename("module");
|
| 127 |
+
path.scope.rename("require");
|
| 128 |
+
path.scope.rename("__filename");
|
| 129 |
+
path.scope.rename("__dirname");
|
| 130 |
+
if (!allowCommonJSExports) {
|
| 131 |
+
path.traverse(moduleExportsVisitor, {
|
| 132 |
+
scope: path.scope
|
| 133 |
+
});
|
| 134 |
+
}
|
| 135 |
+
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
|
| 136 |
+
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
|
| 137 |
+
const hooks = (0, _hooks.makeInvokers)(this.file);
|
| 138 |
+
const {
|
| 139 |
+
meta,
|
| 140 |
+
headers
|
| 141 |
+
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
|
| 142 |
+
exportName: "exports",
|
| 143 |
+
constantReexports,
|
| 144 |
+
enumerableModuleMeta,
|
| 145 |
+
strict,
|
| 146 |
+
strictMode,
|
| 147 |
+
allowTopLevelThis,
|
| 148 |
+
noInterop,
|
| 149 |
+
importInterop,
|
| 150 |
+
wrapReference: hooks.wrapReference,
|
| 151 |
+
getWrapperPayload: hooks.getWrapperPayload,
|
| 152 |
+
esNamespaceOnly: typeof state.filename === "string" && state.filename.endsWith(".mjs") ? mjsStrictNamespace : strictNamespace,
|
| 153 |
+
noIncompleteNsImportDetection,
|
| 154 |
+
filename: this.file.opts.filename
|
| 155 |
+
});
|
| 156 |
+
for (const [source, metadata] of meta.source) {
|
| 157 |
+
const loadExpr = _core.types.callExpression(_core.types.identifier("require"), [_core.types.stringLiteral(source)]);
|
| 158 |
+
let header;
|
| 159 |
+
if ((0, _helperModuleTransforms.isSideEffectImport)(metadata)) {
|
| 160 |
+
if (lazy && metadata.wrap === "function") {
|
| 161 |
+
throw new Error("Assertion failure");
|
| 162 |
+
}
|
| 163 |
+
header = _core.types.expressionStatement(loadExpr);
|
| 164 |
+
} else {
|
| 165 |
+
const init = (0, _helperModuleTransforms.wrapInterop)(path, loadExpr, metadata.interop) || loadExpr;
|
| 166 |
+
if (metadata.wrap) {
|
| 167 |
+
const res = hooks.buildRequireWrapper(metadata.name, init, metadata.wrap, metadata.referenced);
|
| 168 |
+
if (res === false) continue;else header = res;
|
| 169 |
+
}
|
| 170 |
+
header != null ? header : header = _core.template.statement.ast`
|
| 171 |
+
var ${metadata.name} = ${init};
|
| 172 |
+
`;
|
| 173 |
+
}
|
| 174 |
+
header.loc = metadata.loc;
|
| 175 |
+
headers.push(header);
|
| 176 |
+
headers.push(...(0, _helperModuleTransforms.buildNamespaceInitStatements)(meta, metadata, constantReexports, hooks.wrapReference));
|
| 177 |
+
}
|
| 178 |
+
(0, _helperModuleTransforms.ensureStatementsHoisted)(headers);
|
| 179 |
+
path.unshiftContainer("body", headers);
|
| 180 |
+
path.get("body").forEach(path => {
|
| 181 |
+
if (!headers.includes(path.node)) return;
|
| 182 |
+
if (path.isVariableDeclaration()) {
|
| 183 |
+
path.scope.registerDeclaration(path);
|
| 184 |
+
}
|
| 185 |
+
});
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
};
|
| 190 |
+
});
|
| 191 |
+
|
| 192 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_helperModuleTransforms","_core","_dynamicImport","_lazy","_hooks","_default","exports","default","declare","api","options","_api$assumption","_api$assumption2","_api$assumption3","assertVersion","strictNamespace","mjsStrictNamespace","allowTopLevelThis","strict","strictMode","noInterop","importInterop","lazy","allowCommonJSExports","loose","constantReexports","assumption","enumerableModuleMeta","noIncompleteNsImportDetection","Array","isArray","every","item","Error","getAssertion","localName","template","expression","ast","moduleExportsVisitor","ReferencedIdentifier","path","node","name","localBinding","scope","getBinding","rootBinding","parentPath","isObjectProperty","value","isObjectPattern","isAssignmentExpression","left","replaceWith","UpdateExpression","arg","get","isIdentifier","t","assignmentExpression","operator","AssignmentExpression","right","sequenceExpression","isPattern","ids","getOuterBindingIdentifiers","Object","keys","find","pre","file","set","defineCommonJSHook","lazyImportsHook","visitor","types","importExpression","has","isCallExpression","isImport","callee","rename","parent","transformDynamicImport","Program","exit","state","isModule","traverse","moduleName","getModuleName","opts","stringLiteral","hooks","makeInvokers","meta","headers","rewriteModuleStatementsAndPrepareHeader","exportName","wrapReference","getWrapperPayload","esNamespaceOnly","filename","endsWith","source","metadata","loadExpr","callExpression","identifier","header","isSideEffectImport","wrap","expressionStatement","init","wrapInterop","interop","res","buildRequireWrapper","referenced","statement","loc","push","buildNamespaceInitStatements","ensureStatementsHoisted","unshiftContainer","forEach","includes","isVariableDeclaration","registerDeclaration"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport {\n isModule,\n rewriteModuleStatementsAndPrepareHeader,\n type RewriteModuleStatementsAndPrepareHeaderOptions,\n isSideEffectImport,\n buildNamespaceInitStatements,\n ensureStatementsHoisted,\n wrapInterop,\n getModuleName,\n} from \"@babel/helper-module-transforms\";\nimport { template, types as t } from \"@babel/core\";\nimport type { PluginPass, Visitor, Scope, NodePath } from \"@babel/core\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\n\nimport { transformDynamicImport } from \"./dynamic-import.ts\";\nimport { lazyImportsHook } from \"./lazy.ts\";\n\nimport { defineCommonJSHook, makeInvokers } from \"./hooks.ts\";\nexport { defineCommonJSHook };\n\nexport interface Options extends PluginOptions {\n allowCommonJSExports?: boolean;\n allowTopLevelThis?: boolean;\n importInterop?: RewriteModuleStatementsAndPrepareHeaderOptions[\"importInterop\"];\n lazy?: RewriteModuleStatementsAndPrepareHeaderOptions[\"lazy\"];\n loose?: boolean;\n mjsStrictNamespace?: boolean;\n noInterop?: boolean;\n strict?: boolean;\n strictMode?: boolean;\n strictNamespace?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n // 'true' for imports to strictly have .default, instead of having\n // destructuring-like behavior for their properties. This matches the behavior\n // of the initial Node.js (v12) behavior when importing a CommonJS without\n // the __esMoule property.\n // .strictNamespace is for non-mjs files, mjsStrictNamespace if for mjs files.\n strictNamespace = false,\n mjsStrictNamespace = strictNamespace,\n\n allowTopLevelThis,\n strict,\n strictMode,\n noInterop,\n importInterop,\n lazy = false,\n // Defaulting to 'true' for now. May change before 7.x major.\n allowCommonJSExports = true,\n loose = false,\n } = options;\n\n const constantReexports = api.assumption(\"constantReexports\") ?? loose;\n const enumerableModuleMeta = api.assumption(\"enumerableModuleMeta\") ?? loose;\n const noIncompleteNsImportDetection =\n api.assumption(\"noIncompleteNsImportDetection\") ?? false;\n\n if (\n typeof lazy !== \"boolean\" &&\n typeof lazy !== \"function\" &&\n (!Array.isArray(lazy) || !lazy.every(item => typeof item === \"string\"))\n ) {\n throw new Error(`.lazy must be a boolean, array of strings, or a function`);\n }\n\n if (typeof strictNamespace !== \"boolean\") {\n throw new Error(`.strictNamespace must be a boolean, or undefined`);\n }\n if (typeof mjsStrictNamespace !== \"boolean\") {\n throw new Error(`.mjsStrictNamespace must be a boolean, or undefined`);\n }\n\n const getAssertion = (localName: string) => template.expression.ast`\n (function(){\n throw new Error(\n \"The CommonJS '\" + \"${localName}\" + \"' variable is not available in ES6 modules.\" +\n \"Consider setting setting sourceType:script or sourceType:unambiguous in your \" +\n \"Babel config for this file.\");\n })()\n `;\n\n const moduleExportsVisitor: Visitor<{ scope: Scope }> = {\n ReferencedIdentifier(path) {\n const localName = path.node.name;\n if (localName !== \"module\" && localName !== \"exports\") return;\n\n const localBinding = path.scope.getBinding(localName);\n const rootBinding = this.scope.getBinding(localName);\n\n if (\n // redeclared in this scope\n rootBinding !== localBinding ||\n (path.parentPath.isObjectProperty({ value: path.node }) &&\n path.parentPath.parentPath.isObjectPattern()) ||\n path.parentPath.isAssignmentExpression({ left: path.node }) ||\n path.isAssignmentExpression({ left: path.node })\n ) {\n return;\n }\n\n path.replaceWith(getAssertion(localName));\n },\n\n UpdateExpression(path) {\n const arg = path.get(\"argument\");\n if (!arg.isIdentifier()) return;\n const localName = arg.node.name;\n if (localName !== \"module\" && localName !== \"exports\") return;\n\n const localBinding = path.scope.getBinding(localName);\n const rootBinding = this.scope.getBinding(localName);\n\n // redeclared in this scope\n if (rootBinding !== localBinding) return;\n\n path.replaceWith(\n t.assignmentExpression(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (path.node.operator[0] + \"=\") as t.AssignmentExpression[\"operator\"],\n arg.node,\n getAssertion(localName),\n ),\n );\n },\n\n AssignmentExpression(path) {\n const left = path.get(\"left\");\n if (left.isIdentifier()) {\n const localName = left.node.name;\n if (localName !== \"module\" && localName !== \"exports\") return;\n\n const localBinding = path.scope.getBinding(localName);\n const rootBinding = this.scope.getBinding(localName);\n\n // redeclared in this scope\n if (rootBinding !== localBinding) return;\n\n const right = path.get(\"right\");\n right.replaceWith(\n t.sequenceExpression([right.node, getAssertion(localName)]),\n );\n } else if (left.isPattern()) {\n const ids = left.getOuterBindingIdentifiers();\n const localName = Object.keys(ids).find(localName => {\n if (localName !== \"module\" && localName !== \"exports\") return false;\n\n return (\n this.scope.getBinding(localName) ===\n path.scope.getBinding(localName)\n );\n });\n\n if (localName) {\n const right = path.get(\"right\");\n right.replaceWith(\n t.sequenceExpression([right.node, getAssertion(localName)]),\n );\n }\n }\n },\n };\n\n return {\n name: \"transform-modules-commonjs\",\n\n pre() {\n this.file.set(\"@babel/plugin-transform-modules-*\", \"commonjs\");\n\n if (lazy) defineCommonJSHook(this.file, lazyImportsHook(lazy));\n },\n\n visitor: {\n [\"CallExpression\" +\n (api.types.importExpression ? \"|ImportExpression\" : \"\")](\n this: PluginPass,\n path: NodePath<t.CallExpression | t.ImportExpression>,\n ) {\n if (!this.file.has(\"@babel/plugin-proposal-dynamic-import\")) return;\n if (path.isCallExpression() && !t.isImport(path.node.callee)) return;\n\n let { scope } = path;\n do {\n scope.rename(\"require\");\n } while ((scope = scope.parent));\n\n transformDynamicImport(path, noInterop, this.file);\n },\n\n Program: {\n exit(path, state) {\n if (!isModule(path)) return;\n\n // Rename the bindings auto-injected into the scope so there is no\n // risk of conflict between the bindings.\n path.scope.rename(\"exports\");\n path.scope.rename(\"module\");\n path.scope.rename(\"require\");\n path.scope.rename(\"__filename\");\n path.scope.rename(\"__dirname\");\n\n // Rewrite references to 'module' and 'exports' to throw exceptions.\n // These objects are specific to CommonJS and are not available in\n // real ES6 implementations.\n if (!allowCommonJSExports) {\n path.traverse(moduleExportsVisitor, {\n scope: path.scope,\n });\n }\n\n let moduleName = getModuleName(this.file.opts, options);\n // @ts-expect-error todo(flow->ts): do not reuse variables\n if (moduleName) moduleName = t.stringLiteral(moduleName);\n\n const hooks = makeInvokers(this.file);\n\n const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(\n path,\n {\n exportName: \"exports\",\n constantReexports,\n enumerableModuleMeta,\n strict,\n strictMode,\n allowTopLevelThis,\n noInterop,\n importInterop,\n wrapReference: hooks.wrapReference,\n getWrapperPayload: hooks.getWrapperPayload,\n esNamespaceOnly:\n typeof state.filename === \"string\" &&\n state.filename.endsWith(\".mjs\")\n ? mjsStrictNamespace\n : strictNamespace,\n noIncompleteNsImportDetection,\n filename: this.file.opts.filename,\n },\n );\n\n for (const [source, metadata] of meta.source) {\n const loadExpr = t.callExpression(t.identifier(\"require\"), [\n t.stringLiteral(source),\n ]);\n\n let header: t.Statement;\n if (isSideEffectImport(metadata)) {\n if (lazy && metadata.wrap === \"function\") {\n throw new Error(\"Assertion failure\");\n }\n\n header = t.expressionStatement(loadExpr);\n } else {\n const init =\n wrapInterop(path, loadExpr, metadata.interop) || loadExpr;\n\n if (metadata.wrap) {\n const res = hooks.buildRequireWrapper(\n metadata.name,\n init,\n metadata.wrap,\n metadata.referenced,\n );\n if (res === false) continue;\n else header = res;\n }\n header ??= template.statement.ast`\n var ${metadata.name} = ${init};\n `;\n }\n header.loc = metadata.loc;\n\n headers.push(header);\n headers.push(\n ...buildNamespaceInitStatements(\n meta,\n metadata,\n constantReexports,\n hooks.wrapReference,\n ),\n );\n }\n\n ensureStatementsHoisted(headers);\n path.unshiftContainer(\"body\", headers);\n path.get(\"body\").forEach(path => {\n if (!headers.includes(path.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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.lazyImportsHook = void 0;
|
| 7 |
+
var _core = require("@babel/core");
|
| 8 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 9 |
+
const lazyImportsHook = lazy => ({
|
| 10 |
+
name: `${"@babel/plugin-transform-modules-commonjs"}/lazy`,
|
| 11 |
+
version: "7.29.7",
|
| 12 |
+
getWrapperPayload(source, metadata) {
|
| 13 |
+
if ((0, _helperModuleTransforms.isSideEffectImport)(metadata) || metadata.reexportAll) {
|
| 14 |
+
return null;
|
| 15 |
+
}
|
| 16 |
+
if (lazy === true) {
|
| 17 |
+
return source.includes(".") ? null : "lazy/function";
|
| 18 |
+
}
|
| 19 |
+
if (Array.isArray(lazy)) {
|
| 20 |
+
return !lazy.includes(source) ? null : "lazy/function";
|
| 21 |
+
}
|
| 22 |
+
if (typeof lazy === "function") {
|
| 23 |
+
return lazy(source) ? "lazy/function" : null;
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
buildRequireWrapper(name, init, payload, referenced) {
|
| 27 |
+
if (payload === "lazy/function") {
|
| 28 |
+
if (!referenced) return false;
|
| 29 |
+
return _core.template.statement.ast`
|
| 30 |
+
function ${name}() {
|
| 31 |
+
const data = ${init};
|
| 32 |
+
${name} = function(){ return data; };
|
| 33 |
+
return data;
|
| 34 |
+
}
|
| 35 |
+
`;
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
wrapReference(ref, payload) {
|
| 39 |
+
if (payload === "lazy/function") return _core.types.callExpression(ref, []);
|
| 40 |
+
}
|
| 41 |
+
});
|
| 42 |
+
exports.lazyImportsHook = lazyImportsHook;
|
| 43 |
+
|
| 44 |
+
//# sourceMappingURL=lazy.js.map
|
node_modules/@babel/plugin-transform-modules-commonjs/lib/lazy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_core","require","_helperModuleTransforms","lazyImportsHook","lazy","name","version","getWrapperPayload","source","metadata","isSideEffectImport","reexportAll","includes","Array","isArray","buildRequireWrapper","init","payload","referenced","template","statement","ast","wrapReference","ref","t","callExpression","exports"],"sources":["../src/lazy.ts"],"sourcesContent":["import { template, types as t } from \"@babel/core\";\nimport { isSideEffectImport } from \"@babel/helper-module-transforms\";\nimport type { CommonJSHook } from \"./hooks.ts\";\n\ntype Lazy = boolean | string[] | ((source: string) => boolean);\n\nexport const lazyImportsHook = (lazy: Lazy): CommonJSHook => ({\n name: `${PACKAGE_JSON.name}/lazy`,\n version: PACKAGE_JSON.version,\n getWrapperPayload(source, metadata) {\n if (isSideEffectImport(metadata) || metadata.reexportAll) {\n return null;\n }\n if (lazy === true) {\n // 'true' means that local relative files are eagerly loaded and\n // dependency modules are loaded lazily.\n return source.includes(\".\") ? null : \"lazy/function\";\n }\n if (Array.isArray(lazy)) {\n return !lazy.includes(source) ? null : \"lazy/function\";\n }\n if (typeof lazy === \"function\") {\n return lazy(source) ? \"lazy/function\" : null;\n }\n },\n buildRequireWrapper(name, init, payload, referenced) {\n if (payload === \"lazy/function\") {\n if (!referenced) return false;\n return template.statement.ast`\n function ${name}() {\n const data = ${init};\n ${name} = function(){ return data; };\n return data;\n }\n `;\n }\n },\n wrapReference(ref, payload) {\n if (payload === \"lazy/function\") return t.callExpression(ref, []);\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAKO,MAAME,eAAe,GAAIC,IAAU,KAAoB;EAC5DC,IAAI,EAAE,oDAA2B;EACjCC,OAAO,UAAsB;EAC7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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-modules-commonjs",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "This plugin transforms ES2015 modules to CommonJS",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-modules-commonjs"
|
| 9 |
+
},
|
| 10 |
+
"license": "MIT",
|
| 11 |
+
"publishConfig": {
|
| 12 |
+
"access": "public"
|
| 13 |
+
},
|
| 14 |
+
"main": "./lib/index.js",
|
| 15 |
+
"dependencies": {
|
| 16 |
+
"@babel/helper-module-transforms": "^7.29.7",
|
| 17 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 18 |
+
},
|
| 19 |
+
"keywords": [
|
| 20 |
+
"babel-plugin"
|
| 21 |
+
],
|
| 22 |
+
"peerDependencies": {
|
| 23 |
+
"@babel/core": "^7.0.0-0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"@babel/core": "^7.29.7",
|
| 27 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 28 |
+
"@babel/plugin-external-helpers": "^7.29.7"
|
| 29 |
+
},
|
| 30 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-commonjs",
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=6.9.0"
|
| 33 |
+
},
|
| 34 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 35 |
+
"type": "commonjs"
|
| 36 |
+
}
|
node_modules/@babel/plugin-transform-modules-systemjs/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-modules-systemjs/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-modules-systemjs
|
| 2 |
+
|
| 3 |
+
> This plugin transforms ES2015 modules to SystemJS
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-modules-systemjs](https://babeljs.io/docs/babel-plugin-transform-modules-systemjs) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-modules-systemjs
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-modules-systemjs --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-modules-systemjs/lib/index.js
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
exports.getExportSpecifierName = getExportSpecifierName;
|
| 8 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 9 |
+
var _core = require("@babel/core");
|
| 10 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 11 |
+
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
| 12 |
+
const buildTemplate = _core.template.statement(`
|
| 13 |
+
SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {
|
| 14 |
+
"use strict";
|
| 15 |
+
BEFORE_BODY;
|
| 16 |
+
return {
|
| 17 |
+
setters: SETTERS,
|
| 18 |
+
execute: EXECUTE,
|
| 19 |
+
};
|
| 20 |
+
});
|
| 21 |
+
`);
|
| 22 |
+
const buildExportAll = _core.template.statement(`
|
| 23 |
+
for (var KEY in TARGET) {
|
| 24 |
+
if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY];
|
| 25 |
+
}
|
| 26 |
+
`);
|
| 27 |
+
const MISSING_PLUGIN_WARNING = `\
|
| 28 |
+
WARNING: Dynamic import() transformation must be enabled using the
|
| 29 |
+
@babel/plugin-transform-dynamic-import plugin. Babel 8 will
|
| 30 |
+
no longer transform import() without using that plugin.
|
| 31 |
+
`;
|
| 32 |
+
const MISSING_PLUGIN_ERROR = `\
|
| 33 |
+
ERROR: Dynamic import() transformation must be enabled using the
|
| 34 |
+
@babel/plugin-transform-dynamic-import plugin. Babel 8
|
| 35 |
+
no longer transforms import() without using that plugin.
|
| 36 |
+
`;
|
| 37 |
+
function getExportSpecifierName(node, stringSpecifiers) {
|
| 38 |
+
if (node.type === "Identifier") {
|
| 39 |
+
return node.name;
|
| 40 |
+
} else if (node.type === "StringLiteral") {
|
| 41 |
+
const stringValue = node.value;
|
| 42 |
+
if (!(0, _helperValidatorIdentifier.isIdentifierName)(stringValue)) {
|
| 43 |
+
stringSpecifiers.add(stringValue);
|
| 44 |
+
}
|
| 45 |
+
return stringValue;
|
| 46 |
+
} else {
|
| 47 |
+
throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${node.type}`);
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
const protoKey = "__proto__";
|
| 51 |
+
function constructExportCall(path, exportIdent, exportNames, exportValues, exportStarTarget, stringSpecifiers) {
|
| 52 |
+
const statements = [];
|
| 53 |
+
if (!exportStarTarget) {
|
| 54 |
+
if (exportNames.length === 1) {
|
| 55 |
+
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.stringLiteral(exportNames[0]), exportValues[0]])));
|
| 56 |
+
} else {
|
| 57 |
+
const objectProperties = [];
|
| 58 |
+
for (let i = 0; i < exportNames.length; i++) {
|
| 59 |
+
const exportName = exportNames[i];
|
| 60 |
+
const computed = exportName === protoKey;
|
| 61 |
+
const exportNameNode = stringSpecifiers.has(exportName) || computed ? _core.types.stringLiteral(exportName) : _core.types.identifier(exportName);
|
| 62 |
+
const exportValue = exportValues[i];
|
| 63 |
+
objectProperties.push(_core.types.objectProperty(exportNameNode, exportValue, computed));
|
| 64 |
+
}
|
| 65 |
+
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.objectExpression(objectProperties)])));
|
| 66 |
+
}
|
| 67 |
+
} else {
|
| 68 |
+
const exportObj = path.scope.generateUid("exportObj");
|
| 69 |
+
statements.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(exportObj), _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier(protoKey), _core.types.nullLiteral())]))]));
|
| 70 |
+
statements.push(buildExportAll({
|
| 71 |
+
KEY: path.scope.generateUidIdentifier("key"),
|
| 72 |
+
EXPORT_OBJ: _core.types.identifier(exportObj),
|
| 73 |
+
TARGET: exportStarTarget
|
| 74 |
+
}));
|
| 75 |
+
for (let i = 0; i < exportNames.length; i++) {
|
| 76 |
+
const exportName = exportNames[i];
|
| 77 |
+
const computed = stringSpecifiers.has(exportName);
|
| 78 |
+
const exportNameNode = computed ? _core.types.stringLiteral(exportName) : _core.types.identifier(exportName);
|
| 79 |
+
const exportValue = exportValues[i];
|
| 80 |
+
statements.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.identifier(exportObj), exportNameNode, computed), exportValue)));
|
| 81 |
+
}
|
| 82 |
+
statements.push(_core.types.expressionStatement(_core.types.callExpression(exportIdent, [_core.types.identifier(exportObj)])));
|
| 83 |
+
}
|
| 84 |
+
return statements;
|
| 85 |
+
}
|
| 86 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
| 87 |
+
api.assertVersion(7);
|
| 88 |
+
const {
|
| 89 |
+
systemGlobal = "System",
|
| 90 |
+
allowTopLevelThis = false
|
| 91 |
+
} = options;
|
| 92 |
+
const reassignmentVisited = new WeakSet();
|
| 93 |
+
const reassignmentVisitor = {
|
| 94 |
+
"AssignmentExpression|UpdateExpression"(path) {
|
| 95 |
+
if (reassignmentVisited.has(path.node)) return;
|
| 96 |
+
reassignmentVisited.add(path.node);
|
| 97 |
+
const arg = path.isAssignmentExpression() ? path.get("left") : path.get("argument");
|
| 98 |
+
if (arg.isObjectPattern() || arg.isArrayPattern()) {
|
| 99 |
+
const exprs = [path.node];
|
| 100 |
+
for (const name of Object.keys(arg.getBindingIdentifiers())) {
|
| 101 |
+
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) {
|
| 102 |
+
return;
|
| 103 |
+
}
|
| 104 |
+
const exportedNames = this.exports[name];
|
| 105 |
+
if (!exportedNames) continue;
|
| 106 |
+
for (const exportedName of exportedNames) {
|
| 107 |
+
exprs.push(this.buildCall(exportedName, _core.types.identifier(name)).expression);
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
path.replaceWith(_core.types.sequenceExpression(exprs));
|
| 111 |
+
return;
|
| 112 |
+
}
|
| 113 |
+
if (!arg.isIdentifier()) return;
|
| 114 |
+
const name = arg.node.name;
|
| 115 |
+
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
|
| 116 |
+
const exportedNames = this.exports[name];
|
| 117 |
+
if (!exportedNames) return;
|
| 118 |
+
let node = path.node;
|
| 119 |
+
const isPostUpdateExpression = _core.types.isUpdateExpression(node, {
|
| 120 |
+
prefix: false
|
| 121 |
+
});
|
| 122 |
+
if (isPostUpdateExpression) {
|
| 123 |
+
node = _core.types.binaryExpression(node.operator[0], _core.types.unaryExpression("+", _core.types.cloneNode(node.argument)), _core.types.numericLiteral(1));
|
| 124 |
+
}
|
| 125 |
+
for (const exportedName of exportedNames) {
|
| 126 |
+
node = this.buildCall(exportedName, node).expression;
|
| 127 |
+
}
|
| 128 |
+
if (isPostUpdateExpression) {
|
| 129 |
+
node = _core.types.sequenceExpression([node, path.node]);
|
| 130 |
+
}
|
| 131 |
+
path.replaceWith(node);
|
| 132 |
+
}
|
| 133 |
+
};
|
| 134 |
+
return {
|
| 135 |
+
name: "transform-modules-systemjs",
|
| 136 |
+
pre() {
|
| 137 |
+
this.file.set("@babel/plugin-transform-modules-*", "systemjs");
|
| 138 |
+
},
|
| 139 |
+
visitor: {
|
| 140 |
+
["CallExpression" + (api.types.importExpression ? "|ImportExpression" : "")](path, state) {
|
| 141 |
+
if (path.isCallExpression() && !_core.types.isImport(path.node.callee)) return;
|
| 142 |
+
if (path.isCallExpression()) {
|
| 143 |
+
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) {
|
| 144 |
+
console.warn(MISSING_PLUGIN_WARNING);
|
| 145 |
+
}
|
| 146 |
+
} else {
|
| 147 |
+
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) {
|
| 148 |
+
throw new Error(MISSING_PLUGIN_ERROR);
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
path.replaceWith((0, _helperModuleTransforms.buildDynamicImport)(path.node, false, true, specifier => _core.types.callExpression(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("import")), [specifier])));
|
| 152 |
+
},
|
| 153 |
+
MetaProperty(path, state) {
|
| 154 |
+
if (path.node.meta.name === "import" && path.node.property.name === "meta") {
|
| 155 |
+
path.replaceWith(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("meta")));
|
| 156 |
+
}
|
| 157 |
+
},
|
| 158 |
+
ReferencedIdentifier(path, state) {
|
| 159 |
+
if (path.node.name === "__moduleName" && !path.scope.hasBinding("__moduleName")) {
|
| 160 |
+
path.replaceWith(_core.types.memberExpression(_core.types.identifier(state.contextIdent), _core.types.identifier("id")));
|
| 161 |
+
}
|
| 162 |
+
},
|
| 163 |
+
Program: {
|
| 164 |
+
enter(path, state) {
|
| 165 |
+
state.contextIdent = path.scope.generateUid("context");
|
| 166 |
+
state.stringSpecifiers = new Set();
|
| 167 |
+
if (!allowTopLevelThis) {
|
| 168 |
+
(0, _helperModuleTransforms.rewriteThis)(path);
|
| 169 |
+
}
|
| 170 |
+
},
|
| 171 |
+
exit(path, state) {
|
| 172 |
+
var _path$scope, _path$scope$hoistVari;
|
| 173 |
+
const scope = path.scope;
|
| 174 |
+
const exportIdent = scope.generateUid("export");
|
| 175 |
+
const {
|
| 176 |
+
contextIdent,
|
| 177 |
+
stringSpecifiers
|
| 178 |
+
} = state;
|
| 179 |
+
const exportMap = Object.create(null);
|
| 180 |
+
const modules = [];
|
| 181 |
+
const beforeBody = [];
|
| 182 |
+
const setters = [];
|
| 183 |
+
const sources = [];
|
| 184 |
+
const variableIds = [];
|
| 185 |
+
const removedPaths = [];
|
| 186 |
+
function addExportName(key, val) {
|
| 187 |
+
exportMap[key] = exportMap[key] || [];
|
| 188 |
+
exportMap[key].push(val);
|
| 189 |
+
}
|
| 190 |
+
function pushModule(source, key, specifiers) {
|
| 191 |
+
let module;
|
| 192 |
+
modules.forEach(function (m) {
|
| 193 |
+
if (m.key === source) {
|
| 194 |
+
module = m;
|
| 195 |
+
}
|
| 196 |
+
});
|
| 197 |
+
if (!module) {
|
| 198 |
+
modules.push(module = {
|
| 199 |
+
key: source,
|
| 200 |
+
imports: [],
|
| 201 |
+
exports: []
|
| 202 |
+
});
|
| 203 |
+
}
|
| 204 |
+
module[key] = module[key].concat(specifiers);
|
| 205 |
+
}
|
| 206 |
+
function buildExportCall(name, val) {
|
| 207 |
+
return _core.types.expressionStatement(_core.types.callExpression(_core.types.identifier(exportIdent), [_core.types.stringLiteral(name), val]));
|
| 208 |
+
}
|
| 209 |
+
const exportNames = [];
|
| 210 |
+
const exportValues = [];
|
| 211 |
+
const body = path.get("body");
|
| 212 |
+
for (const path of body) {
|
| 213 |
+
if (path.isFunctionDeclaration()) {
|
| 214 |
+
beforeBody.push(path.node);
|
| 215 |
+
removedPaths.push(path);
|
| 216 |
+
} else if (path.isClassDeclaration()) {
|
| 217 |
+
variableIds.push(_core.types.cloneNode(path.node.id));
|
| 218 |
+
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(path.node.id), _core.types.toExpression(path.node))));
|
| 219 |
+
} else if (path.isVariableDeclaration()) {
|
| 220 |
+
path.node.kind = "var";
|
| 221 |
+
} else if (path.isImportDeclaration()) {
|
| 222 |
+
const source = path.node.source.value;
|
| 223 |
+
pushModule(source, "imports", path.node.specifiers);
|
| 224 |
+
for (const name of Object.keys(path.getBindingIdentifiers())) {
|
| 225 |
+
scope.removeBinding(name);
|
| 226 |
+
variableIds.push(_core.types.identifier(name));
|
| 227 |
+
}
|
| 228 |
+
path.remove();
|
| 229 |
+
} else if (path.isExportAllDeclaration()) {
|
| 230 |
+
pushModule(path.node.source.value, "exports", path.node);
|
| 231 |
+
path.remove();
|
| 232 |
+
} else if (path.isExportDefaultDeclaration()) {
|
| 233 |
+
const declar = path.node.declaration;
|
| 234 |
+
if (_core.types.isClassDeclaration(declar)) {
|
| 235 |
+
const id = declar.id;
|
| 236 |
+
if (id) {
|
| 237 |
+
exportNames.push("default");
|
| 238 |
+
exportValues.push(scope.buildUndefinedNode());
|
| 239 |
+
variableIds.push(_core.types.cloneNode(id));
|
| 240 |
+
addExportName(id.name, "default");
|
| 241 |
+
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(id), _core.types.toExpression(declar))));
|
| 242 |
+
} else {
|
| 243 |
+
exportNames.push("default");
|
| 244 |
+
exportValues.push(_core.types.toExpression(declar));
|
| 245 |
+
removedPaths.push(path);
|
| 246 |
+
}
|
| 247 |
+
} else if (_core.types.isFunctionDeclaration(declar)) {
|
| 248 |
+
const id = declar.id;
|
| 249 |
+
if (id) {
|
| 250 |
+
beforeBody.push(declar);
|
| 251 |
+
exportNames.push("default");
|
| 252 |
+
exportValues.push(_core.types.cloneNode(id));
|
| 253 |
+
addExportName(id.name, "default");
|
| 254 |
+
} else {
|
| 255 |
+
exportNames.push("default");
|
| 256 |
+
exportValues.push(_core.types.toExpression(declar));
|
| 257 |
+
}
|
| 258 |
+
removedPaths.push(path);
|
| 259 |
+
} else {
|
| 260 |
+
path.replaceWith(buildExportCall("default", declar));
|
| 261 |
+
}
|
| 262 |
+
} else if (path.isExportNamedDeclaration()) {
|
| 263 |
+
const declar = path.node.declaration;
|
| 264 |
+
if (declar) {
|
| 265 |
+
path.replaceWith(declar);
|
| 266 |
+
if (_core.types.isFunction(declar)) {
|
| 267 |
+
const name = declar.id.name;
|
| 268 |
+
addExportName(name, name);
|
| 269 |
+
beforeBody.push(declar);
|
| 270 |
+
exportNames.push(name);
|
| 271 |
+
exportValues.push(_core.types.cloneNode(declar.id));
|
| 272 |
+
removedPaths.push(path);
|
| 273 |
+
} else if (_core.types.isClass(declar)) {
|
| 274 |
+
const name = declar.id.name;
|
| 275 |
+
exportNames.push(name);
|
| 276 |
+
exportValues.push(scope.buildUndefinedNode());
|
| 277 |
+
variableIds.push(_core.types.cloneNode(declar.id));
|
| 278 |
+
path.replaceWith(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(declar.id), _core.types.toExpression(declar))));
|
| 279 |
+
addExportName(name, name);
|
| 280 |
+
} else {
|
| 281 |
+
if (_core.types.isVariableDeclaration(declar)) {
|
| 282 |
+
declar.kind = "var";
|
| 283 |
+
}
|
| 284 |
+
for (const name of Object.keys(_core.types.getBindingIdentifiers(declar))) {
|
| 285 |
+
addExportName(name, name);
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
} else {
|
| 289 |
+
const specifiers = path.node.specifiers;
|
| 290 |
+
if (specifiers != null && specifiers.length) {
|
| 291 |
+
if (path.node.source) {
|
| 292 |
+
pushModule(path.node.source.value, "exports", specifiers);
|
| 293 |
+
path.remove();
|
| 294 |
+
} else {
|
| 295 |
+
const nodes = [];
|
| 296 |
+
for (const specifier of specifiers) {
|
| 297 |
+
const {
|
| 298 |
+
local,
|
| 299 |
+
exported
|
| 300 |
+
} = specifier;
|
| 301 |
+
const binding = scope.getBinding(local.name);
|
| 302 |
+
const exportedName = getExportSpecifierName(exported, stringSpecifiers);
|
| 303 |
+
if (binding && _core.types.isFunctionDeclaration(binding.path.node)) {
|
| 304 |
+
exportNames.push(exportedName);
|
| 305 |
+
exportValues.push(_core.types.cloneNode(local));
|
| 306 |
+
} else if (!binding) {
|
| 307 |
+
nodes.push(buildExportCall(exportedName, local));
|
| 308 |
+
}
|
| 309 |
+
addExportName(local.name, exportedName);
|
| 310 |
+
}
|
| 311 |
+
path.replaceWithMultiple(nodes);
|
| 312 |
+
}
|
| 313 |
+
} else {
|
| 314 |
+
path.remove();
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
modules.forEach(function (specifiers) {
|
| 320 |
+
const setterBody = [];
|
| 321 |
+
const target = scope.generateUid(specifiers.key);
|
| 322 |
+
for (let specifier of specifiers.imports) {
|
| 323 |
+
if (_core.types.isImportNamespaceSpecifier(specifier)) {
|
| 324 |
+
setterBody.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", specifier.local, _core.types.identifier(target))));
|
| 325 |
+
} else if (_core.types.isImportDefaultSpecifier(specifier)) {
|
| 326 |
+
specifier = _core.types.importSpecifier(specifier.local, _core.types.identifier("default"));
|
| 327 |
+
}
|
| 328 |
+
if (_core.types.isImportSpecifier(specifier)) {
|
| 329 |
+
const {
|
| 330 |
+
imported
|
| 331 |
+
} = specifier;
|
| 332 |
+
setterBody.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", specifier.local, _core.types.memberExpression(_core.types.identifier(target), specifier.imported, imported.type === "StringLiteral"))));
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
if (specifiers.exports.length) {
|
| 336 |
+
const exportNames = [];
|
| 337 |
+
const exportValues = [];
|
| 338 |
+
let hasExportStar = false;
|
| 339 |
+
for (const node of specifiers.exports) {
|
| 340 |
+
if (_core.types.isExportAllDeclaration(node)) {
|
| 341 |
+
hasExportStar = true;
|
| 342 |
+
} else if (_core.types.isExportSpecifier(node)) {
|
| 343 |
+
const exportedName = getExportSpecifierName(node.exported, stringSpecifiers);
|
| 344 |
+
exportNames.push(exportedName);
|
| 345 |
+
exportValues.push(_core.types.memberExpression(_core.types.identifier(target), node.local, _core.types.isStringLiteral(node.local)));
|
| 346 |
+
} else {}
|
| 347 |
+
}
|
| 348 |
+
setterBody.push(...constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, hasExportStar ? _core.types.identifier(target) : null, stringSpecifiers));
|
| 349 |
+
}
|
| 350 |
+
sources.push(_core.types.stringLiteral(specifiers.key));
|
| 351 |
+
setters.push(_core.types.functionExpression(null, [_core.types.identifier(target)], _core.types.blockStatement(setterBody)));
|
| 352 |
+
});
|
| 353 |
+
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
|
| 354 |
+
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
|
| 355 |
+
(_path$scope$hoistVari = (_path$scope = path.scope).hoistVariables) != null ? _path$scope$hoistVari : _path$scope.hoistVariables = require("@babel/traverse").Scope.prototype.hoistVariables;
|
| 356 |
+
path.scope.hoistVariables((id, hasInit) => {
|
| 357 |
+
variableIds.push(id);
|
| 358 |
+
if (!hasInit && id.name in exportMap) {
|
| 359 |
+
for (const exported of exportMap[id.name]) {
|
| 360 |
+
exportNames.push(exported);
|
| 361 |
+
exportValues.push(_core.types.buildUndefinedNode());
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
});
|
| 365 |
+
if (variableIds.length) {
|
| 366 |
+
beforeBody.unshift(_core.types.variableDeclaration("var", variableIds.map(id => _core.types.variableDeclarator(id))));
|
| 367 |
+
}
|
| 368 |
+
if (exportNames.length) {
|
| 369 |
+
beforeBody.push(...constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, null, stringSpecifiers));
|
| 370 |
+
}
|
| 371 |
+
path.traverse(reassignmentVisitor, {
|
| 372 |
+
exports: exportMap,
|
| 373 |
+
buildCall: buildExportCall,
|
| 374 |
+
scope
|
| 375 |
+
});
|
| 376 |
+
for (const path of removedPaths) {
|
| 377 |
+
path.remove();
|
| 378 |
+
}
|
| 379 |
+
let hasTLA = false;
|
| 380 |
+
path.traverse({
|
| 381 |
+
AwaitExpression(path) {
|
| 382 |
+
hasTLA = true;
|
| 383 |
+
path.stop();
|
| 384 |
+
},
|
| 385 |
+
Function(path) {
|
| 386 |
+
path.skip();
|
| 387 |
+
},
|
| 388 |
+
noScope: true
|
| 389 |
+
});
|
| 390 |
+
path.node.body = [buildTemplate({
|
| 391 |
+
SYSTEM_REGISTER: _core.types.memberExpression(_core.types.identifier(systemGlobal), _core.types.identifier("register")),
|
| 392 |
+
BEFORE_BODY: beforeBody,
|
| 393 |
+
MODULE_NAME: moduleName,
|
| 394 |
+
SETTERS: _core.types.arrayExpression(setters),
|
| 395 |
+
EXECUTE: _core.types.functionExpression(null, [], _core.types.blockStatement(path.node.body), false, hasTLA),
|
| 396 |
+
SOURCES: _core.types.arrayExpression(sources),
|
| 397 |
+
EXPORT_IDENTIFIER: _core.types.identifier(exportIdent),
|
| 398 |
+
CONTEXT_IDENTIFIER: _core.types.identifier(contextIdent)
|
| 399 |
+
})];
|
| 400 |
+
path.requeue(path.get("body.0"));
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
};
|
| 405 |
+
});
|
| 406 |
+
|
| 407 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-modules-systemjs/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_core","_helperModuleTransforms","_helperValidatorIdentifier","buildTemplate","template","statement","buildExportAll","MISSING_PLUGIN_WARNING","MISSING_PLUGIN_ERROR","getExportSpecifierName","node","stringSpecifiers","type","name","stringValue","value","isIdentifierName","add","Error","protoKey","constructExportCall","path","exportIdent","exportNames","exportValues","exportStarTarget","statements","length","push","t","expressionStatement","callExpression","stringLiteral","objectProperties","i","exportName","computed","exportNameNode","has","identifier","exportValue","objectProperty","objectExpression","exportObj","scope","generateUid","variableDeclaration","variableDeclarator","nullLiteral","KEY","generateUidIdentifier","EXPORT_OBJ","TARGET","assignmentExpression","memberExpression","_default","exports","default","declare","api","options","assertVersion","systemGlobal","allowTopLevelThis","reassignmentVisited","WeakSet","reassignmentVisitor","AssignmentExpression|UpdateExpression","arg","isAssignmentExpression","get","isObjectPattern","isArrayPattern","exprs","Object","keys","getBindingIdentifiers","getBinding","exportedNames","exportedName","buildCall","expression","replaceWith","sequenceExpression","isIdentifier","isPostUpdateExpression","isUpdateExpression","prefix","binaryExpression","operator","unaryExpression","cloneNode","argument","numericLiteral","pre","file","set","visitor","types","importExpression","state","isCallExpression","isImport","callee","console","warn","buildDynamicImport","specifier","contextIdent","MetaProperty","meta","property","ReferencedIdentifier","hasBinding","Program","enter","Set","rewriteThis","exit","_path$scope","_path$scope$hoistVari","exportMap","create","modules","beforeBody","setters","sources","variableIds","removedPaths","addExportName","key","val","pushModule","source","specifiers","module","forEach","m","imports","concat","buildExportCall","body","isFunctionDeclaration","isClassDeclaration","id","toExpression","isVariableDeclaration","kind","isImportDeclaration","removeBinding","remove","isExportAllDeclaration","isExportDefaultDeclaration","declar","declaration","buildUndefinedNode","isExportNamedDeclaration","isFunction","isClass","nodes","local","exported","binding","replaceWithMultiple","setterBody","target","isImportNamespaceSpecifier","isImportDefaultSpecifier","importSpecifier","isImportSpecifier","imported","hasExportStar","isExportSpecifier","isStringLiteral","functionExpression","blockStatement","moduleName","getModuleName","opts","hoistVariables","Scope","prototype","hasInit","unshift","map","traverse","hasTLA","AwaitExpression","stop","Function","skip","noScope","SYSTEM_REGISTER","BEFORE_BODY","MODULE_NAME","SETTERS","arrayExpression","EXECUTE","SOURCES","EXPORT_IDENTIFIER","CONTEXT_IDENTIFIER","requeue"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { template, types as t } from \"@babel/core\";\nimport type { PluginPass, NodePath, Scope, Visitor } from \"@babel/core\";\nimport {\n buildDynamicImport,\n getModuleName,\n rewriteThis,\n} from \"@babel/helper-module-transforms\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\nimport { isIdentifierName } from \"@babel/helper-validator-identifier\";\n\nconst buildTemplate = template.statement(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n \"use strict\";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);\n\nconst buildExportAll = template.statement(`\n for (var KEY in TARGET) {\n if (KEY !== \"default\" && KEY !== \"__esModule\") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);\n\nconst MISSING_PLUGIN_WARNING = `\\\nWARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-transform-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;\n\nconst MISSING_PLUGIN_ERROR = `\\\nERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-transform-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;\n\n//todo: use getExportSpecifierName in `helper-module-transforms` when this library is refactored to NodePath usage.\n\nexport function getExportSpecifierName(\n node: t.Node,\n stringSpecifiers: Set<string>,\n): string {\n if (node.type === \"Identifier\") {\n return node.name;\n } else if (node.type === \"StringLiteral\") {\n const stringValue = node.value;\n // add specifier value to `stringSpecifiers` only when it can not be converted to an identifier name\n // i.e In `import { \"foo\" as bar }`\n // we do not consider `\"foo\"` to be a `stringSpecifier` because we can treat it as\n // `import { foo as bar }`\n // This helps minimize the size of `stringSpecifiers` and reduce overhead of checking valid identifier names\n // when building transpiled code from metadata\n if (!isIdentifierName(stringValue)) {\n stringSpecifiers.add(stringValue);\n }\n return stringValue;\n } else {\n throw new Error(\n `Expected export specifier to be either Identifier or StringLiteral, got ${node.type}`,\n );\n }\n}\n\ntype PluginState = {\n contextIdent: string;\n // List of names that should only be printed as string literals.\n // i.e. `import { \"any unicode\" as foo } from \"some-module\"`\n // `stringSpecifiers` is Set(1) [\"any unicode\"]\n // In most cases `stringSpecifiers` is an empty Set\n stringSpecifiers: Set<string>;\n};\n\ntype ModuleMetadata = {\n key: string;\n imports: any[];\n exports: any[];\n};\n\nconst protoKey = \"__proto__\";\n\nfunction constructExportCall(\n path: NodePath<t.Program>,\n exportIdent: t.Identifier,\n exportNames: string[],\n exportValues: t.Expression[],\n exportStarTarget: t.Identifier | null,\n stringSpecifiers: Set<string>,\n) {\n const statements = [];\n if (!exportStarTarget) {\n if (exportNames.length === 1) {\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [\n t.stringLiteral(exportNames[0]),\n exportValues[0],\n ]),\n ),\n );\n } else {\n const objectProperties = [];\n for (let i = 0; i < exportNames.length; i++) {\n const exportName = exportNames[i];\n const computed = exportName === protoKey;\n const exportNameNode =\n stringSpecifiers.has(exportName) || computed\n ? t.stringLiteral(exportName)\n : t.identifier(exportName);\n const exportValue = exportValues[i];\n objectProperties.push(\n t.objectProperty(exportNameNode, exportValue, computed),\n );\n }\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [t.objectExpression(objectProperties)]),\n ),\n );\n }\n } else {\n const exportObj = path.scope.generateUid(\"exportObj\");\n\n statements.push(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(\n t.identifier(exportObj),\n t.objectExpression([\n t.objectProperty(t.identifier(protoKey), t.nullLiteral()),\n ]),\n ),\n ]),\n );\n\n statements.push(\n buildExportAll({\n KEY: path.scope.generateUidIdentifier(\"key\"),\n EXPORT_OBJ: t.identifier(exportObj),\n TARGET: exportStarTarget,\n }),\n );\n\n for (let i = 0; i < exportNames.length; i++) {\n const exportName = exportNames[i];\n const computed = stringSpecifiers.has(exportName);\n const exportNameNode = computed\n ? t.stringLiteral(exportName)\n : t.identifier(exportName);\n const exportValue = exportValues[i];\n\n statements.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(\n t.identifier(exportObj),\n exportNameNode,\n computed,\n ),\n exportValue,\n ),\n ),\n );\n }\n\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [t.identifier(exportObj)]),\n ),\n );\n }\n return statements;\n}\n\nexport interface Options extends PluginOptions {\n allowTopLevelThis?: boolean;\n systemGlobal?: string;\n}\n\ntype ReassignmentVisitorState = {\n scope: Scope;\n exports: any;\n buildCall: (name: string, value: t.Expression) => t.ExpressionStatement;\n};\n\nexport default declare<PluginState>((api, options: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const { systemGlobal = \"System\", allowTopLevelThis = false } = options;\n const reassignmentVisited = new WeakSet();\n\n const reassignmentVisitor: Visitor<ReassignmentVisitorState> = {\n \"AssignmentExpression|UpdateExpression\"(\n path: NodePath<t.AssignmentExpression | t.UpdateExpression>,\n ) {\n if (reassignmentVisited.has(path.node)) return;\n reassignmentVisited.add(path.node);\n\n const arg = path.isAssignmentExpression()\n ? path.get(\"left\")\n : path.get(\"argument\");\n\n if (arg.isObjectPattern() || arg.isArrayPattern()) {\n const exprs: t.SequenceExpression[\"expressions\"] = [path.node];\n for (const name of Object.keys(arg.getBindingIdentifiers())) {\n if (this.scope.getBinding(name) !== path.scope.getBinding(name)) {\n return;\n }\n const exportedNames = this.exports[name];\n if (!exportedNames) continue;\n for (const exportedName of exportedNames) {\n exprs.push(\n this.buildCall(exportedName, t.identifier(name)).expression,\n );\n }\n }\n path.replaceWith(t.sequenceExpression(exprs));\n return;\n }\n\n if (!arg.isIdentifier()) return;\n\n const name = arg.node.name;\n\n // redeclared in this scope\n if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;\n\n const exportedNames = this.exports[name];\n if (!exportedNames) return;\n\n let node: t.Expression = path.node;\n\n // if it is a non-prefix update expression (x++ etc)\n // then we must replace with the expression (_export('x', x + 1), x++)\n // in order to ensure the same update expression value\n const isPostUpdateExpression = t.isUpdateExpression(node, {\n prefix: false,\n });\n if (isPostUpdateExpression) {\n node = t.binaryExpression(\n // @ts-expect-error The operator of a post-update expression must be \"++\" | \"--\"\n node.operator[0],\n t.unaryExpression(\n \"+\",\n t.cloneNode(\n // @ts-expect-error node is UpdateExpression\n node.argument,\n ),\n ),\n t.numericLiteral(1),\n );\n }\n\n for (const exportedName of exportedNames) {\n node = this.buildCall(exportedName, node).expression;\n }\n\n if (isPostUpdateExpression) {\n node = t.sequenceExpression([node, path.node]);\n }\n\n path.replaceWith(node);\n },\n };\n\n return {\n name: \"transform-modules-systemjs\",\n\n pre() {\n this.file.set(\"@babel/plugin-transform-modules-*\", \"systemjs\");\n },\n\n visitor: {\n [\"CallExpression\" +\n (api.types.importExpression ? \"|ImportExpression\" : \"\")](\n this: PluginPass & PluginState,\n path: NodePath<t.CallExpression | t.ImportExpression>,\n state: PluginState,\n ) {\n if (path.isCallExpression() && !t.isImport(path.node.callee)) return;\n if (path.isCallExpression()) {\n if (!this.file.has(\"@babel/plugin-proposal-dynamic-import\")) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(MISSING_PLUGIN_ERROR);\n } else {\n console.warn(MISSING_PLUGIN_WARNING);\n }\n }\n } else {\n // when createImportExpressions is true, we require the dynamic import transform\n if (!this.file.has(\"@babel/plugin-proposal-dynamic-import\")) {\n throw new Error(MISSING_PLUGIN_ERROR);\n }\n }\n path.replaceWith(\n buildDynamicImport(path.node, false, true, specifier =>\n t.callExpression(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"import\"),\n ),\n [specifier],\n ),\n ),\n );\n },\n\n MetaProperty(path, state: PluginState) {\n if (\n path.node.meta.name === \"import\" &&\n path.node.property.name === \"meta\"\n ) {\n path.replaceWith(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"meta\"),\n ),\n );\n }\n },\n\n ReferencedIdentifier(path, state) {\n if (\n path.node.name === \"__moduleName\" &&\n !path.scope.hasBinding(\"__moduleName\")\n ) {\n path.replaceWith(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"id\"),\n ),\n );\n }\n },\n\n Program: {\n enter(path, state) {\n state.contextIdent = path.scope.generateUid(\"context\");\n state.stringSpecifiers = new Set();\n if (!allowTopLevelThis) {\n rewriteThis(path);\n }\n },\n exit(path, state) {\n const scope = path.scope;\n const exportIdent = scope.generateUid(\"export\");\n const { contextIdent, stringSpecifiers } = state;\n\n const exportMap: Record<string, string[]> = Object.create(null);\n const modules: ModuleMetadata[] = [];\n\n const beforeBody = [];\n const setters: t.Expression[] = [];\n const sources: t.StringLiteral[] = [];\n const variableIds = [];\n const removedPaths = [];\n\n function addExportName(key: string, val: string) {\n exportMap[key] = exportMap[key] || [];\n exportMap[key].push(val);\n }\n\n function pushModule(\n source: string,\n key: \"imports\" | \"exports\",\n specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration,\n ) {\n let module: ModuleMetadata;\n modules.forEach(function (m) {\n if (m.key === source) {\n module = m;\n }\n });\n if (!module) {\n modules.push(\n (module = { key: source, imports: [], exports: [] }),\n );\n }\n module[key] = module[key].concat(specifiers);\n }\n\n function buildExportCall(name: string, val: t.Expression) {\n return t.expressionStatement(\n t.callExpression(t.identifier(exportIdent), [\n t.stringLiteral(name),\n val,\n ]),\n );\n }\n\n const exportNames = [];\n const exportValues: t.Expression[] = [];\n\n const body = path.get(\"body\");\n\n for (const path of body) {\n if (path.isFunctionDeclaration()) {\n beforeBody.push(path.node);\n removedPaths.push(path);\n } else if (path.isClassDeclaration()) {\n variableIds.push(t.cloneNode(path.node.id));\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(path.node.id),\n t.toExpression(path.node),\n ),\n ),\n );\n } else if (path.isVariableDeclaration()) {\n // Convert top-level variable declarations to \"var\",\n // because they must be hoisted\n path.node.kind = \"var\";\n } else if (path.isImportDeclaration()) {\n const source = path.node.source.value;\n pushModule(source, \"imports\", path.node.specifiers);\n for (const name of Object.keys(path.getBindingIdentifiers())) {\n scope.removeBinding(name);\n variableIds.push(t.identifier(name));\n }\n path.remove();\n } else if (path.isExportAllDeclaration()) {\n pushModule(path.node.source.value, \"exports\", path.node);\n path.remove();\n } else if (path.isExportDefaultDeclaration()) {\n const declar = path.node.declaration;\n if (t.isClassDeclaration(declar)) {\n const id = declar.id;\n if (id) {\n exportNames.push(\"default\");\n exportValues.push(scope.buildUndefinedNode());\n variableIds.push(t.cloneNode(id));\n addExportName(id.name, \"default\");\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(id),\n t.toExpression(declar),\n ),\n ),\n );\n } else {\n exportNames.push(\"default\");\n exportValues.push(t.toExpression(declar));\n removedPaths.push(path);\n }\n } else if (t.isFunctionDeclaration(declar)) {\n const id = declar.id;\n if (id) {\n beforeBody.push(declar);\n exportNames.push(\"default\");\n exportValues.push(t.cloneNode(id));\n addExportName(id.name, \"default\");\n } else {\n exportNames.push(\"default\");\n exportValues.push(t.toExpression(declar));\n }\n removedPaths.push(path);\n } else {\n // @ts-expect-error TSDeclareFunction is not expected here\n path.replaceWith(buildExportCall(\"default\", declar));\n }\n } else if (path.isExportNamedDeclaration()) {\n const declar = path.node.declaration;\n\n if (declar) {\n path.replaceWith(declar);\n\n if (t.isFunction(declar)) {\n const name = declar.id.name;\n addExportName(name, name);\n beforeBody.push(declar);\n exportNames.push(name);\n exportValues.push(t.cloneNode(declar.id));\n removedPaths.push(path);\n } else if (t.isClass(declar)) {\n const name = declar.id.name;\n exportNames.push(name);\n exportValues.push(scope.buildUndefinedNode());\n variableIds.push(t.cloneNode(declar.id));\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(declar.id),\n t.toExpression(declar),\n ),\n ),\n );\n addExportName(name, name);\n } else {\n if (t.isVariableDeclaration(declar)) {\n // Convert top-level variable declarations to \"var\",\n // because they must be hoisted\n declar.kind = \"var\";\n }\n for (const name of Object.keys(\n t.getBindingIdentifiers(declar),\n )) {\n addExportName(name, name);\n }\n }\n } else {\n const specifiers = path.node.specifiers;\n if (specifiers?.length) {\n if (path.node.source) {\n pushModule(path.node.source.value, \"exports\", specifiers);\n path.remove();\n } else {\n const nodes = [];\n\n for (const specifier of specifiers) {\n // @ts-expect-error This isn't an \"export ... from\" declaration\n // because path.node.source is falsy, so the local specifier exists.\n const { local, exported } = specifier;\n\n const binding = scope.getBinding(local.name);\n const exportedName = getExportSpecifierName(\n exported,\n stringSpecifiers,\n );\n // hoisted function export\n if (\n binding &&\n t.isFunctionDeclaration(binding.path.node)\n ) {\n exportNames.push(exportedName);\n exportValues.push(t.cloneNode(local));\n }\n // only globals also exported this way\n else if (!binding) {\n nodes.push(buildExportCall(exportedName, local));\n }\n addExportName(local.name, exportedName);\n }\n\n path.replaceWithMultiple(nodes);\n }\n } else {\n path.remove();\n }\n }\n }\n }\n\n modules.forEach(function (specifiers) {\n const setterBody = [];\n const target = scope.generateUid(specifiers.key);\n\n for (let specifier of specifiers.imports) {\n if (t.isImportNamespaceSpecifier(specifier)) {\n setterBody.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n specifier.local,\n t.identifier(target),\n ),\n ),\n );\n } else if (t.isImportDefaultSpecifier(specifier)) {\n specifier = t.importSpecifier(\n specifier.local,\n t.identifier(\"default\"),\n );\n }\n\n if (t.isImportSpecifier(specifier)) {\n const { imported } = specifier;\n setterBody.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n specifier.local,\n t.memberExpression(\n t.identifier(target),\n specifier.imported,\n /* computed */ imported.type === \"StringLiteral\",\n ),\n ),\n ),\n );\n }\n }\n\n if (specifiers.exports.length) {\n const exportNames = [];\n const exportValues = [];\n let hasExportStar = false;\n\n for (const node of specifiers.exports) {\n if (t.isExportAllDeclaration(node)) {\n hasExportStar = true;\n } else if (t.isExportSpecifier(node)) {\n const exportedName = getExportSpecifierName(\n node.exported,\n stringSpecifiers,\n );\n exportNames.push(exportedName);\n exportValues.push(\n t.memberExpression(\n t.identifier(target),\n node.local,\n t.isStringLiteral(node.local),\n ),\n );\n } else {\n // todo\n }\n }\n\n setterBody.push(\n ...constructExportCall(\n path,\n t.identifier(exportIdent),\n exportNames,\n exportValues,\n hasExportStar ? t.identifier(target) : null,\n stringSpecifiers,\n ),\n );\n }\n\n sources.push(t.stringLiteral(specifiers.key));\n setters.push(\n t.functionExpression(\n null,\n [t.identifier(target)],\n t.blockStatement(setterBody),\n ),\n );\n });\n\n let moduleName = getModuleName(this.file.opts, options);\n // @ts-expect-error todo(flow->ts): do not reuse variables\n if (moduleName) moduleName = t.stringLiteral(moduleName);\n\n if (!process.env.BABEL_8_BREAKING && !USE_ESM && !IS_STANDALONE) {\n // polyfill when being run by an older Babel version\n path.scope.hoistVariables ??=\n // eslint-disable-next-line no-restricted-globals\n require(\"@babel/traverse\").Scope.prototype.hoistVariables;\n }\n\n path.scope.hoistVariables((id, hasInit) => {\n variableIds.push(id);\n if (!hasInit && id.name in exportMap) {\n for (const exported of exportMap[id.name]) {\n exportNames.push(exported);\n exportValues.push(t.buildUndefinedNode());\n }\n }\n });\n\n if (variableIds.length) {\n beforeBody.unshift(\n t.variableDeclaration(\n \"var\",\n variableIds.map(id => t.variableDeclarator(id)),\n ),\n );\n }\n\n if (exportNames.length) {\n beforeBody.push(\n ...constructExportCall(\n path,\n t.identifier(exportIdent),\n exportNames,\n exportValues,\n null,\n stringSpecifiers,\n ),\n );\n }\n\n path.traverse(reassignmentVisitor, {\n exports: exportMap,\n buildCall: buildExportCall,\n scope,\n });\n\n for (const path of removedPaths) {\n path.remove();\n }\n\n let hasTLA = false;\n if (process.env.BABEL_8_BREAKING) {\n t.traverseFast(path.node, node => {\n if (t.isFunction(node)) return t.traverseFast.skip;\n if (t.isAwaitExpression(node)) {\n hasTLA = true;\n return t.traverseFast.stop;\n }\n });\n } else {\n path.traverse({\n AwaitExpression(path) {\n hasTLA = true;\n path.stop();\n },\n Function(path) {\n path.skip();\n },\n // @ts-expect-error - todo: add noScope to type definitions\n noScope: true,\n });\n }\n\n path.node.body = [\n buildTemplate({\n SYSTEM_REGISTER: t.memberExpression(\n t.identifier(systemGlobal),\n t.identifier(\"register\"),\n ),\n BEFORE_BODY: beforeBody,\n MODULE_NAME: moduleName,\n SETTERS: t.arrayExpression(setters),\n EXECUTE: t.functionExpression(\n null,\n [],\n t.blockStatement(path.node.body),\n false,\n hasTLA,\n ),\n SOURCES: t.arrayExpression(sources),\n EXPORT_IDENTIFIER: t.identifier(exportIdent),\n CONTEXT_IDENTIFIER: t.identifier(contextIdent),\n }),\n ];\n path.requeue(path.get(\"body.0\"));\n },\n },\n },\n };\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,uBAAA,GAAAF,OAAA;AAMA,IAAAG,0BAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAGC,cAAQ,CAACC,SAAS,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC;AAEF,MAAMC,cAAc,GAAGF,cAAQ,CAACC,SAAS,CAAC;AAC1C;AACA;AACA;AACA,CAAC,CAAC;AAEF,MAAME,sBAAsB,GAAG;AAC/B;AACA;AACA;AACA,CAAC;AAED,MAAMC,oBAAoB,GAAG;AAC7B;AACA;AACA;AACA,CAAC;AAIM,SAASC,sBAAsBA,CACpCC,IAAY,EACZC,gBAA6B,EACrB;EACR,IA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,EACJ,EAAE,EACFjJ,WAAC,CAACkJ,cAAc,CAAC1J,IAAI,CAACX,IAAI,CAACmI,IAAI,CAAC,EAChC,KAAK,EACL6C,MACF,CAAC;YACDY,OAAO,EAAEzK,WAAC,CAACuK,eAAe,CAACtE,OAAO,CAAC;YACnCyE,iBAAiB,EAAE1K,WAAC,CAACU,UAAU,CAACjB,WAAW,CAAC;YAC5CkL,kBAAkB,EAAE3K,WAAC,CAACU,UAAU,CAACqE,YAAY;UAC/C,CAAC,CAAC,CACH;UACDvF,IAAI,CAACoL,OAAO,CAACpL,IAAI,CAACiD,GAAG,CAAC,QAAQ,CAAC,CAAC;QAClC;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-modules-systemjs/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-modules-systemjs",
|
| 3 |
+
"version": "7.29.8",
|
| 4 |
+
"description": "This plugin transforms ES2015 modules to SystemJS",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-modules-systemjs"
|
| 9 |
+
},
|
| 10 |
+
"license": "MIT",
|
| 11 |
+
"publishConfig": {
|
| 12 |
+
"access": "public"
|
| 13 |
+
},
|
| 14 |
+
"main": "./lib/index.js",
|
| 15 |
+
"dependencies": {
|
| 16 |
+
"@babel/helper-module-transforms": "^7.29.7",
|
| 17 |
+
"@babel/helper-plugin-utils": "^7.29.7",
|
| 18 |
+
"@babel/helper-validator-identifier": "^7.29.7",
|
| 19 |
+
"@babel/traverse": "^7.29.8"
|
| 20 |
+
},
|
| 21 |
+
"keywords": [
|
| 22 |
+
"babel-plugin"
|
| 23 |
+
],
|
| 24 |
+
"peerDependencies": {
|
| 25 |
+
"@babel/core": "^7.0.0-0"
|
| 26 |
+
},
|
| 27 |
+
"devDependencies": {
|
| 28 |
+
"@babel/core": "^7.29.7",
|
| 29 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 30 |
+
"@babel/helper-transform-fixture-test-runner": "^7.29.8",
|
| 31 |
+
"core-js": "^3.48.0"
|
| 32 |
+
},
|
| 33 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-systemjs",
|
| 34 |
+
"engines": {
|
| 35 |
+
"node": ">=6.9.0"
|
| 36 |
+
},
|
| 37 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 38 |
+
"type": "commonjs"
|
| 39 |
+
}
|
node_modules/@babel/plugin-transform-modules-umd/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-modules-umd/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-modules-umd
|
| 2 |
+
|
| 3 |
+
> This plugin transforms ES2015 modules to UMD
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-modules-umd](https://babeljs.io/docs/babel-plugin-transform-modules-umd) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-modules-umd
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-modules-umd --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-modules-umd/lib/index.js
ADDED
|
@@ -0,0 +1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|
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 8 |
+
var _path = require("path");
|
| 9 |
+
var _helperModuleTransforms = require("@babel/helper-module-transforms");
|
| 10 |
+
var _core = require("@babel/core");
|
| 11 |
+
const buildPrerequisiteAssignment = (0, _core.template)(`
|
| 12 |
+
GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}
|
| 13 |
+
`);
|
| 14 |
+
const buildWrapper = (0, _core.template)(`
|
| 15 |
+
(function (global, factory) {
|
| 16 |
+
if (typeof define === "function" && define.amd) {
|
| 17 |
+
define(MODULE_NAME, AMD_ARGUMENTS, factory);
|
| 18 |
+
} else if (typeof exports !== "undefined") {
|
| 19 |
+
factory(COMMONJS_ARGUMENTS);
|
| 20 |
+
} else {
|
| 21 |
+
var mod = { exports: {} };
|
| 22 |
+
factory(BROWSER_ARGUMENTS);
|
| 23 |
+
|
| 24 |
+
GLOBAL_TO_ASSIGN;
|
| 25 |
+
}
|
| 26 |
+
})(
|
| 27 |
+
typeof globalThis !== "undefined" ? globalThis
|
| 28 |
+
: typeof self !== "undefined" ? self
|
| 29 |
+
: this,
|
| 30 |
+
function(IMPORT_NAMES) {
|
| 31 |
+
})
|
| 32 |
+
`);
|
| 33 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
| 34 |
+
var _api$assumption, _api$assumption2;
|
| 35 |
+
api.assertVersion(7);
|
| 36 |
+
const {
|
| 37 |
+
globals,
|
| 38 |
+
exactGlobals,
|
| 39 |
+
allowTopLevelThis,
|
| 40 |
+
strict,
|
| 41 |
+
strictMode,
|
| 42 |
+
noInterop,
|
| 43 |
+
importInterop
|
| 44 |
+
} = options;
|
| 45 |
+
const constantReexports = (_api$assumption = api.assumption("constantReexports")) != null ? _api$assumption : options.loose;
|
| 46 |
+
const enumerableModuleMeta = (_api$assumption2 = api.assumption("enumerableModuleMeta")) != null ? _api$assumption2 : options.loose;
|
| 47 |
+
function buildBrowserInit(browserGlobals, exactGlobals, filename, moduleName) {
|
| 48 |
+
const moduleNameOrBasename = moduleName ? moduleName.value : (0, _path.basename)(filename, (0, _path.extname)(filename));
|
| 49 |
+
let globalToAssign = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(moduleNameOrBasename)));
|
| 50 |
+
let initAssignments = [];
|
| 51 |
+
if (exactGlobals) {
|
| 52 |
+
const globalName = browserGlobals[moduleNameOrBasename];
|
| 53 |
+
if (globalName) {
|
| 54 |
+
initAssignments = [];
|
| 55 |
+
const members = globalName.split(".");
|
| 56 |
+
globalToAssign = members.slice(1).reduce((accum, curr) => {
|
| 57 |
+
initAssignments.push(buildPrerequisiteAssignment({
|
| 58 |
+
GLOBAL_REFERENCE: _core.types.cloneNode(accum)
|
| 59 |
+
}));
|
| 60 |
+
return _core.types.memberExpression(accum, _core.types.identifier(curr));
|
| 61 |
+
}, _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(members[0])));
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
initAssignments.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", globalToAssign, _core.types.memberExpression(_core.types.identifier("mod"), _core.types.identifier("exports")))));
|
| 65 |
+
return initAssignments;
|
| 66 |
+
}
|
| 67 |
+
function buildBrowserArg(browserGlobals, exactGlobals, source) {
|
| 68 |
+
let memberExpression;
|
| 69 |
+
if (exactGlobals) {
|
| 70 |
+
const globalRef = browserGlobals[source];
|
| 71 |
+
if (globalRef) {
|
| 72 |
+
memberExpression = globalRef.split(".").reduce((accum, curr) => _core.types.memberExpression(accum, _core.types.identifier(curr)), _core.types.identifier("global"));
|
| 73 |
+
} else {
|
| 74 |
+
memberExpression = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(source)));
|
| 75 |
+
}
|
| 76 |
+
} else {
|
| 77 |
+
const requireName = (0, _path.basename)(source, (0, _path.extname)(source));
|
| 78 |
+
const globalName = browserGlobals[requireName] || requireName;
|
| 79 |
+
memberExpression = _core.types.memberExpression(_core.types.identifier("global"), _core.types.identifier(_core.types.toIdentifier(globalName)));
|
| 80 |
+
}
|
| 81 |
+
return memberExpression;
|
| 82 |
+
}
|
| 83 |
+
return {
|
| 84 |
+
name: "transform-modules-umd",
|
| 85 |
+
visitor: {
|
| 86 |
+
Program: {
|
| 87 |
+
exit(path) {
|
| 88 |
+
if (!(0, _helperModuleTransforms.isModule)(path)) return;
|
| 89 |
+
const browserGlobals = globals || {};
|
| 90 |
+
const moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
|
| 91 |
+
let moduleNameLiteral;
|
| 92 |
+
if (moduleName) moduleNameLiteral = _core.types.stringLiteral(moduleName);
|
| 93 |
+
const {
|
| 94 |
+
meta,
|
| 95 |
+
headers
|
| 96 |
+
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
|
| 97 |
+
constantReexports,
|
| 98 |
+
enumerableModuleMeta,
|
| 99 |
+
strict,
|
| 100 |
+
strictMode,
|
| 101 |
+
allowTopLevelThis,
|
| 102 |
+
noInterop,
|
| 103 |
+
importInterop,
|
| 104 |
+
filename: this.file.opts.filename
|
| 105 |
+
});
|
| 106 |
+
const amdArgs = [];
|
| 107 |
+
const commonjsArgs = [];
|
| 108 |
+
const browserArgs = [];
|
| 109 |
+
const importNames = [];
|
| 110 |
+
if ((0, _helperModuleTransforms.hasExports)(meta)) {
|
| 111 |
+
amdArgs.push(_core.types.stringLiteral("exports"));
|
| 112 |
+
commonjsArgs.push(_core.types.identifier("exports"));
|
| 113 |
+
browserArgs.push(_core.types.memberExpression(_core.types.identifier("mod"), _core.types.identifier("exports")));
|
| 114 |
+
importNames.push(_core.types.identifier(meta.exportName));
|
| 115 |
+
}
|
| 116 |
+
for (const [source, metadata] of meta.source) {
|
| 117 |
+
amdArgs.push(_core.types.stringLiteral(source));
|
| 118 |
+
commonjsArgs.push(_core.types.callExpression(_core.types.identifier("require"), [_core.types.stringLiteral(source)]));
|
| 119 |
+
browserArgs.push(buildBrowserArg(browserGlobals, exactGlobals, source));
|
| 120 |
+
importNames.push(_core.types.identifier(metadata.name));
|
| 121 |
+
if (!(0, _helperModuleTransforms.isSideEffectImport)(metadata)) {
|
| 122 |
+
const interop = (0, _helperModuleTransforms.wrapInterop)(path, _core.types.identifier(metadata.name), metadata.interop);
|
| 123 |
+
if (interop) {
|
| 124 |
+
const header = _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.identifier(metadata.name), interop));
|
| 125 |
+
header.loc = meta.loc;
|
| 126 |
+
headers.push(header);
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
headers.push(...(0, _helperModuleTransforms.buildNamespaceInitStatements)(meta, metadata, constantReexports));
|
| 130 |
+
}
|
| 131 |
+
(0, _helperModuleTransforms.ensureStatementsHoisted)(headers);
|
| 132 |
+
path.unshiftContainer("body", headers);
|
| 133 |
+
const {
|
| 134 |
+
body,
|
| 135 |
+
directives
|
| 136 |
+
} = path.node;
|
| 137 |
+
path.node.directives = [];
|
| 138 |
+
path.node.body = [];
|
| 139 |
+
const umdWrapper = path.pushContainer("body", [buildWrapper({
|
| 140 |
+
MODULE_NAME: moduleNameLiteral,
|
| 141 |
+
AMD_ARGUMENTS: _core.types.arrayExpression(amdArgs),
|
| 142 |
+
COMMONJS_ARGUMENTS: commonjsArgs,
|
| 143 |
+
BROWSER_ARGUMENTS: browserArgs,
|
| 144 |
+
IMPORT_NAMES: importNames,
|
| 145 |
+
GLOBAL_TO_ASSIGN: buildBrowserInit(browserGlobals, exactGlobals, this.filename || "unknown", moduleNameLiteral)
|
| 146 |
+
})])[0];
|
| 147 |
+
const umdFactory = umdWrapper.get("expression.arguments")[1].get("body");
|
| 148 |
+
umdFactory.pushContainer("directives", directives);
|
| 149 |
+
umdFactory.pushContainer("body", body);
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
};
|
| 154 |
+
});
|
| 155 |
+
|
| 156 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-modules-umd/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_path","_helperModuleTransforms","_core","buildPrerequisiteAssignment","template","buildWrapper","_default","exports","default","declare","api","options","_api$assumption","_api$assumption2","assertVersion","globals","exactGlobals","allowTopLevelThis","strict","strictMode","noInterop","importInterop","constantReexports","assumption","loose","enumerableModuleMeta","buildBrowserInit","browserGlobals","filename","moduleName","moduleNameOrBasename","value","basename","extname","globalToAssign","t","memberExpression","identifier","toIdentifier","initAssignments","globalName","members","split","slice","reduce","accum","curr","push","GLOBAL_REFERENCE","cloneNode","expressionStatement","assignmentExpression","buildBrowserArg","source","globalRef","requireName","name","visitor","Program","exit","path","isModule","getModuleName","file","opts","moduleNameLiteral","stringLiteral","meta","headers","rewriteModuleStatementsAndPrepareHeader","amdArgs","commonjsArgs","browserArgs","importNames","hasExports","exportName","metadata","callExpression","isSideEffectImport","interop","wrapInterop","header","loc","buildNamespaceInitStatements","ensureStatementsHoisted","unshiftContainer","body","directives","node","umdWrapper","pushContainer","MODULE_NAME","AMD_ARGUMENTS","arrayExpression","COMMONJS_ARGUMENTS","BROWSER_ARGUMENTS","IMPORT_NAMES","GLOBAL_TO_ASSIGN","umdFactory","get"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { basename, extname } from \"node:path\";\nimport {\n isModule,\n rewriteModuleStatementsAndPrepareHeader,\n type RewriteModuleStatementsAndPrepareHeaderOptions,\n hasExports,\n isSideEffectImport,\n buildNamespaceInitStatements,\n ensureStatementsHoisted,\n wrapInterop,\n getModuleName,\n} from \"@babel/helper-module-transforms\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\nimport { types as t, template, type NodePath } from \"@babel/core\";\n\nconst buildPrerequisiteAssignment = template(`\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n`);\n// Note: we avoid comparing typeof results with \"object\" or \"symbol\" otherwise\n// they will be processed by `transform-typeof-symbol`, which in return could\n// cause typeof helper used before declaration\nconst buildWrapper = template(`\n (function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== \"undefined\") {\n factory(COMMONJS_ARGUMENTS);\n } else {\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n\n GLOBAL_TO_ASSIGN;\n }\n })(\n typeof globalThis !== \"undefined\" ? globalThis\n : typeof self !== \"undefined\" ? self\n : this,\n function(IMPORT_NAMES) {\n })\n`);\n\nexport interface Options extends PluginOptions {\n allowTopLevelThis?: boolean;\n exactGlobals?: boolean;\n globals?: Record<string, string>;\n importInterop?: RewriteModuleStatementsAndPrepareHeaderOptions[\"importInterop\"];\n loose?: boolean;\n noInterop?: boolean;\n strict?: boolean;\n strictMode?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n globals,\n exactGlobals,\n allowTopLevelThis,\n strict,\n strictMode,\n noInterop,\n importInterop,\n } = options;\n\n const constantReexports =\n api.assumption(\"constantReexports\") ?? options.loose;\n const enumerableModuleMeta =\n api.assumption(\"enumerableModuleMeta\") ?? options.loose;\n\n /**\n * Build the assignment statements that initialize the UMD global.\n */\n function buildBrowserInit(\n browserGlobals: Record<string, string>,\n exactGlobals: boolean,\n filename: string,\n moduleName: t.StringLiteral | void,\n ) {\n const moduleNameOrBasename = moduleName\n ? moduleName.value\n : basename(filename, extname(filename));\n let globalToAssign = t.memberExpression(\n t.identifier(\"global\"),\n t.identifier(t.toIdentifier(moduleNameOrBasename)),\n );\n let initAssignments = [];\n\n if (exactGlobals) {\n const globalName = browserGlobals[moduleNameOrBasename];\n\n if (globalName) {\n initAssignments = [];\n\n const members = globalName.split(\".\");\n globalToAssign = members.slice(1).reduce(\n (accum, curr) => {\n initAssignments.push(\n buildPrerequisiteAssignment({\n GLOBAL_REFERENCE: t.cloneNode(accum),\n }),\n );\n return t.memberExpression(accum, t.identifier(curr));\n },\n t.memberExpression(t.identifier(\"global\"), t.identifier(members[0])),\n );\n }\n }\n\n initAssignments.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n globalToAssign,\n t.memberExpression(t.identifier(\"mod\"), t.identifier(\"exports\")),\n ),\n ),\n );\n\n return initAssignments;\n }\n\n /**\n * Build the member expression that reads from a global for a given source.\n */\n function buildBrowserArg(\n browserGlobals: Record<string, string>,\n exactGlobals: boolean,\n source: string,\n ) {\n let memberExpression: t.MemberExpression;\n if (exactGlobals) {\n const globalRef = browserGlobals[source];\n if (globalRef) {\n memberExpression = globalRef\n .split(\".\")\n .reduce(\n (accum: t.Identifier | t.MemberExpression, curr) =>\n t.memberExpression(accum, t.identifier(curr)),\n t.identifier(\"global\"),\n ) as t.MemberExpression;\n } else {\n memberExpression = t.memberExpression(\n t.identifier(\"global\"),\n t.identifier(t.toIdentifier(source)),\n );\n }\n } else {\n const requireName = basename(source, extname(source));\n const globalName = browserGlobals[requireName] || requireName;\n memberExpression = t.memberExpression(\n t.identifier(\"global\"),\n t.identifier(t.toIdentifier(globalName)),\n );\n }\n return memberExpression;\n }\n\n return {\n name: \"transform-modules-umd\",\n\n visitor: {\n Program: {\n exit(path) {\n if (!isModule(path)) return;\n\n const browserGlobals = globals || {};\n\n const moduleName = getModuleName(this.file.opts, options);\n let moduleNameLiteral: void | t.StringLiteral;\n if (moduleName) moduleNameLiteral = t.stringLiteral(moduleName);\n\n const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(\n path,\n {\n constantReexports,\n enumerableModuleMeta,\n strict,\n strictMode,\n allowTopLevelThis,\n noInterop,\n importInterop,\n filename: this.file.opts.filename,\n },\n );\n\n const amdArgs = [];\n const commonjsArgs = [];\n const browserArgs = [];\n const importNames = [];\n\n if (hasExports(meta)) {\n amdArgs.push(t.stringLiteral(\"exports\"));\n commonjsArgs.push(t.identifier(\"exports\"));\n browserArgs.push(\n t.memberExpression(t.identifier(\"mod\"), t.identifier(\"exports\")),\n );\n importNames.push(t.identifier(meta.exportName));\n }\n\n for (const [source, metadata] of meta.source) {\n amdArgs.push(t.stringLiteral(source));\n commonjsArgs.push(\n t.callExpression(t.identifier(\"require\"), [\n t.stringLiteral(source),\n ]),\n );\n browserArgs.push(\n buildBrowserArg(browserGlobals, exactGlobals, source),\n );\n importNames.push(t.identifier(metadata.name));\n\n if (!isSideEffectImport(metadata)) {\n const interop = wrapInterop(\n path,\n t.identifier(metadata.name),\n metadata.interop,\n );\n if (interop) {\n const header = t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.identifier(metadata.name),\n interop,\n ),\n );\n // @ts-expect-error todo(flow->ts)\n header.loc = meta.loc;\n headers.push(header);\n }\n }\n\n headers.push(\n ...buildNamespaceInitStatements(\n meta,\n metadata,\n constantReexports,\n ),\n );\n }\n\n ensureStatementsHoisted(headers);\n path.unshiftContainer(\"body\", headers);\n\n const { body, directives } = path.node;\n path.node.directives = [];\n path.node.body = [];\n const umdWrapper = path.pushContainer(\"body\", [\n buildWrapper({\n //todo: buildWrapper does not handle void moduleNameLiteral\n MODULE_NAME: moduleNameLiteral,\n\n AMD_ARGUMENTS: t.arrayExpression(amdArgs),\n COMMONJS_ARGUMENTS: commonjsArgs,\n BROWSER_ARGUMENTS: browserArgs,\n IMPORT_NAMES: importNames,\n\n GLOBAL_TO_ASSIGN: buildBrowserInit(\n browserGlobals,\n exactGlobals,\n this.filename || \"unknown\",\n moduleNameLiteral,\n ),\n }) as t.Statement,\n ])[0] as NodePath<t.ExpressionStatement>;\n const umdFactory = (\n umdWrapper.get(\"expression.arguments\")[1] as NodePath<t.Function>\n ).get(\"body\") as NodePath<t.BlockStatement>;\n umdFactory.pushContainer(\"directives\", directives);\n umdFactory.pushContainer(\"body\", body);\n },\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,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ChCwB,iBAAiB,EAAEvB,WAAW;YAC9BwB,YAAY,EAAEvB,WAAW;YAEzBwB,gBAAgB,EAAEvE,gBAAgB,CAChCC,cAAc,EACdX,YAAY,EACZ,IAAI,CAACY,QAAQ,IAAI,SAAS,EAC1BqC,iBACF;UACF,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CAAoC;UACxC,MAAMiC,UAAU,GACdT,UAAU,CAACU,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CACzCA,GAAG,CAAC,MAAM,CAA+B;UAC3CD,UAAU,CAACR,aAAa,CAAC,YAAY,EAAEH,UAAU,CAAC;UAClDW,UAAU,CAACR,aAAa,CAAC,MAAM,EAAEJ,IAAI,CAAC;QACxC;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-modules-umd/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-modules-umd",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "This plugin transforms ES2015 modules to UMD",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-modules-umd"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-umd",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"dependencies": {
|
| 17 |
+
"@babel/helper-module-transforms": "^7.29.7",
|
| 18 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 19 |
+
},
|
| 20 |
+
"keywords": [
|
| 21 |
+
"babel-plugin"
|
| 22 |
+
],
|
| 23 |
+
"peerDependencies": {
|
| 24 |
+
"@babel/core": "^7.0.0-0"
|
| 25 |
+
},
|
| 26 |
+
"devDependencies": {
|
| 27 |
+
"@babel/core": "^7.29.7",
|
| 28 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 29 |
+
"@babel/plugin-external-helpers": "^7.29.7"
|
| 30 |
+
},
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=6.9.0"
|
| 33 |
+
},
|
| 34 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 35 |
+
"type": "commonjs"
|
| 36 |
+
}
|
node_modules/@babel/plugin-transform-named-capturing-groups-regex/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-named-capturing-groups-regex/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-named-capturing-groups-regex
|
| 2 |
+
|
| 3 |
+
> Compile regular expressions using named groups to ES5.
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-named-capturing-groups-regex](https://babeljs.io/docs/babel-plugin-transform-named-capturing-groups-regex) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-named-capturing-groups-regex
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-named-capturing-groups-regex --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-named-capturing-groups-regex/lib/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperCreateRegexpFeaturesPlugin = require("@babel/helper-create-regexp-features-plugin");
|
| 8 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 9 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
| 10 |
+
const {
|
| 11 |
+
runtime
|
| 12 |
+
} = options;
|
| 13 |
+
if (runtime !== undefined && typeof runtime !== "boolean") {
|
| 14 |
+
throw new Error("The 'runtime' option must be boolean");
|
| 15 |
+
}
|
| 16 |
+
return (0, _helperCreateRegexpFeaturesPlugin.createRegExpFeaturePlugin)({
|
| 17 |
+
name: "transform-named-capturing-groups-regex",
|
| 18 |
+
feature: "namedCaptureGroups",
|
| 19 |
+
options: {
|
| 20 |
+
runtime
|
| 21 |
+
}
|
| 22 |
+
});
|
| 23 |
+
});
|
| 24 |
+
|
| 25 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-named-capturing-groups-regex/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperCreateRegexpFeaturesPlugin","require","_helperPluginUtils","_default","exports","default","declare","api","options","runtime","undefined","Error","createRegExpFeaturePlugin","name","feature"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\nimport { createRegExpFeaturePlugin } from \"@babel/helper-create-regexp-features-plugin\";\nimport { declare } from \"@babel/helper-plugin-utils\";\n\nexport interface Options {\n runtime?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n const { runtime } = options;\n if (runtime !== undefined && typeof runtime !== \"boolean\") {\n throw new Error(\"The 'runtime' option must be boolean\");\n }\n\n return createRegExpFeaturePlugin({\n name: \"transform-named-capturing-groups-regex\",\n feature: \"namedCaptureGroups\",\n options: { runtime },\n });\n});\n"],"mappings":";;;;;;AACA,IAAAA,iCAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAAqD,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMtC,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChD,MAAM;IAAEC;EAAQ,CAAC,GAAGD,OAAO;EAC3B,IAAIC,OAAO,KAAKC,SAAS,IAAI,OAAOD,OAAO,KAAK,SAAS,EAAE;IACzD,MAAM,IAAIE,KAAK,CAAC,sCAAsC,CAAC;EACzD;EAEA,OAAO,IAAAC,2DAAyB,EAAC;IAC/BC,IAAI,EAAE,wCAAwC;IAC9CC,OAAO,EAAE,oBAAoB;IAC7BN,OAAO,EAAE;MAAEC;IAAQ;EACrB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-named-capturing-groups-regex/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-named-capturing-groups-regex",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "Compile regular expressions using named groups to ES5.",
|
| 5 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-named-capturing-groups-regex",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"publishConfig": {
|
| 8 |
+
"access": "public"
|
| 9 |
+
},
|
| 10 |
+
"main": "./lib/index.js",
|
| 11 |
+
"keywords": [
|
| 12 |
+
"babel-plugin",
|
| 13 |
+
"regex",
|
| 14 |
+
"regexp",
|
| 15 |
+
"regular expressions"
|
| 16 |
+
],
|
| 17 |
+
"repository": {
|
| 18 |
+
"type": "git",
|
| 19 |
+
"url": "https://github.com/babel/babel.git",
|
| 20 |
+
"directory": "packages/babel-plugin-transform-named-capturing-groups-regex"
|
| 21 |
+
},
|
| 22 |
+
"bugs": "https://github.com/babel/babel/issues",
|
| 23 |
+
"dependencies": {
|
| 24 |
+
"@babel/helper-create-regexp-features-plugin": "^7.29.7",
|
| 25 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 26 |
+
},
|
| 27 |
+
"peerDependencies": {
|
| 28 |
+
"@babel/core": "^7.0.0"
|
| 29 |
+
},
|
| 30 |
+
"devDependencies": {
|
| 31 |
+
"@babel/core": "^7.29.7",
|
| 32 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 33 |
+
"core-js": "^3.48.0"
|
| 34 |
+
},
|
| 35 |
+
"engines": {
|
| 36 |
+
"node": ">=6.9.0"
|
| 37 |
+
},
|
| 38 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 39 |
+
"type": "commonjs"
|
| 40 |
+
}
|
node_modules/@babel/plugin-transform-new-target/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-new-target/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-new-target
|
| 2 |
+
|
| 3 |
+
> Transforms new.target meta property
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-new-target](https://babeljs.io/docs/babel-plugin-transform-new-target) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-new-target
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-new-target --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-new-target/lib/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 8 |
+
var _core = require("@babel/core");
|
| 9 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
|
| 10 |
+
api.assertVersion(7);
|
| 11 |
+
return {
|
| 12 |
+
name: "transform-new-target",
|
| 13 |
+
visitor: {
|
| 14 |
+
MetaProperty(path) {
|
| 15 |
+
const meta = path.get("meta");
|
| 16 |
+
const property = path.get("property");
|
| 17 |
+
const {
|
| 18 |
+
scope
|
| 19 |
+
} = path;
|
| 20 |
+
if (meta.isIdentifier({
|
| 21 |
+
name: "new"
|
| 22 |
+
}) && property.isIdentifier({
|
| 23 |
+
name: "target"
|
| 24 |
+
})) {
|
| 25 |
+
const func = path.findParent(path => {
|
| 26 |
+
if (path.isClass()) return true;
|
| 27 |
+
if (path.isFunction() && !path.isArrowFunctionExpression()) {
|
| 28 |
+
if (path.isClassMethod({
|
| 29 |
+
kind: "constructor"
|
| 30 |
+
})) {
|
| 31 |
+
return false;
|
| 32 |
+
}
|
| 33 |
+
return true;
|
| 34 |
+
}
|
| 35 |
+
return false;
|
| 36 |
+
});
|
| 37 |
+
if (!func) {
|
| 38 |
+
throw path.buildCodeFrameError("new.target must be under a (non-arrow) function or a class.");
|
| 39 |
+
}
|
| 40 |
+
const {
|
| 41 |
+
node
|
| 42 |
+
} = func;
|
| 43 |
+
if (_core.types.isMethod(node)) {
|
| 44 |
+
path.replaceWith(scope.buildUndefinedNode());
|
| 45 |
+
return;
|
| 46 |
+
}
|
| 47 |
+
const constructor = _core.types.memberExpression(_core.types.thisExpression(), _core.types.identifier("constructor"));
|
| 48 |
+
if (func.isClass()) {
|
| 49 |
+
path.replaceWith(constructor);
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
if (!node.id) {
|
| 53 |
+
node.id = scope.generateUidIdentifier("target");
|
| 54 |
+
} else {
|
| 55 |
+
let scope = path.scope;
|
| 56 |
+
const name = node.id.name;
|
| 57 |
+
while (scope !== func.parentPath.scope) {
|
| 58 |
+
if (scope.hasOwnBinding(name) && !scope.bindingIdentifierEquals(name, node.id)) {
|
| 59 |
+
scope.rename(name);
|
| 60 |
+
}
|
| 61 |
+
scope = scope.parent;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
path.replaceWith(_core.types.conditionalExpression(_core.types.binaryExpression("instanceof", _core.types.thisExpression(), _core.types.cloneNode(node.id)), constructor, scope.buildUndefinedNode()));
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
};
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-new-target/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_core","_default","exports","default","declare","api","assertVersion","name","visitor","MetaProperty","path","meta","get","property","scope","isIdentifier","func","findParent","isClass","isFunction","isArrowFunctionExpression","isClassMethod","kind","buildCodeFrameError","node","t","isMethod","replaceWith","buildUndefinedNode","constructor","memberExpression","thisExpression","identifier","id","generateUidIdentifier","parentPath","hasOwnBinding","bindingIdentifierEquals","rename","parent","conditionalExpression","binaryExpression","cloneNode"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { types as t, type NodePath } from \"@babel/core\";\n\nexport default declare(api => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n return {\n name: \"transform-new-target\",\n\n visitor: {\n MetaProperty(path) {\n const meta = path.get(\"meta\");\n const property = path.get(\"property\");\n const { scope } = path;\n\n if (\n meta.isIdentifier({ name: \"new\" }) &&\n property.isIdentifier({ name: \"target\" })\n ) {\n const func = path.findParent(path => {\n if (path.isClass()) return true;\n if (path.isFunction() && !path.isArrowFunctionExpression()) {\n if (path.isClassMethod({ kind: \"constructor\" })) {\n return false;\n }\n\n return true;\n }\n return false;\n }) as NodePath<\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.Class\n | t.ClassMethod\n | t.ClassPrivateMethod\n >;\n\n if (!func) {\n throw path.buildCodeFrameError(\n \"new.target must be under a (non-arrow) function or a class.\",\n );\n }\n\n const { node } = func;\n if (t.isMethod(node)) {\n path.replaceWith(scope.buildUndefinedNode());\n return;\n }\n\n const constructor = t.memberExpression(\n t.thisExpression(),\n t.identifier(\"constructor\"),\n );\n\n if (func.isClass()) {\n path.replaceWith(constructor);\n return;\n }\n\n if (!node.id) {\n node.id = scope.generateUidIdentifier(\"target\");\n } else {\n // packages/babel-helper-create-class-features-plugin/src/fields.ts#L192 unshadow\n let scope = path.scope;\n const name = node.id.name;\n while (scope !== func.parentPath.scope) {\n if (\n scope.hasOwnBinding(name) &&\n !scope.bindingIdentifierEquals(name, node.id)\n ) {\n scope.rename(name);\n }\n scope = scope.parent;\n }\n }\n\n path.replaceWith(\n t.conditionalExpression(\n t.binaryExpression(\n \"instanceof\",\n t.thisExpression(),\n t.cloneNode(node.id),\n ),\n constructor,\n scope.buildUndefinedNode(),\n ),\n );\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAwD,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEzC,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAkB,CAAE,CAAC;EAEtC,OAAO;IACLC,IAAI,EAAE,sBAAsB;IAE5BC,OAAO,EAAE;MACPC,YAAYA,CAACC,IAAI,EAAE;QACjB,MAAMC,IAAI,GAAGD,IAAI,CAACE,GAAG,CAAC,MAAM,CAAC;QAC7B,MAAMC,QAAQ,GAAGH,IAAI,CAACE,GAAG,CAAC,UAAU,CAAC;QACrC,MAAM;UAAEE;QAAM,CAAC,GAAGJ,IAAI;QAEtB,IACEC,IAAI,CAACI,YAAY,CAAC;UAAER,IAAI,EAAE;QAAM,CAAC,CAAC,IAClCM,QAAQ,CAACE,YAAY,CAAC;UAAER,IAAI,EAAE;QAAS,CAAC,CAAC,EACzC;UACA,MAAMS,IAAI,GAAGN,IAAI,CAACO,UAAU,CAACP,IAAI,IAAI;YACnC,IAAIA,IAAI,CAACQ,OAAO,CAAC,CAAC,EAAE,OAAO,IAAI;YAC/B,IAAIR,IAAI,CAACS,UAAU,CAAC,CAAC,IAAI,CAACT,IAAI,CAACU,yBAAyB,CAAC,CAAC,EAAE;cAC1D,IAAIV,IAAI,CAACW,aAAa,CAAC;gBAAEC,IAAI,EAAE;cAAc,CAAC,CAAC,EAAE;gB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Y,EACZhB,WAAC,CAACM,cAAc,CAAC,CAAC,EAClBN,WAAC,CAACiB,SAAS,CAAClB,IAAI,CAACS,EAAE,CACrB,CAAC,EACDJ,WAAW,EACXf,KAAK,CAACc,kBAAkB,CAAC,CAC3B,CACF,CAAC;QACH;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-new-target/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-new-target",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "Transforms new.target meta property",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-new-target"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-new-target",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"keywords": [
|
| 17 |
+
"babel-plugin"
|
| 18 |
+
],
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 21 |
+
},
|
| 22 |
+
"peerDependencies": {
|
| 23 |
+
"@babel/core": "^7.0.0-0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"@babel/core": "^7.29.7",
|
| 27 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 28 |
+
"@babel/plugin-transform-arrow-functions": "^7.29.7",
|
| 29 |
+
"@babel/plugin-transform-class-properties": "^7.29.7"
|
| 30 |
+
},
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=6.9.0"
|
| 33 |
+
},
|
| 34 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 35 |
+
"type": "commonjs"
|
| 36 |
+
}
|
node_modules/@babel/plugin-transform-nullish-coalescing-operator/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-nullish-coalescing-operator/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-nullish-coalescing-operator
|
| 2 |
+
|
| 3 |
+
> Remove nullish coalescing operator
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-nullish-coalescing-operator](https://babeljs.io/docs/babel-plugin-transform-nullish-coalescing-operator) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-nullish-coalescing-operator
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-nullish-coalescing-operator --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 8 |
+
var _core = require("@babel/core");
|
| 9 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)((api, {
|
| 10 |
+
loose = false
|
| 11 |
+
}) => {
|
| 12 |
+
var _api$assumption, _api$assumption2;
|
| 13 |
+
api.assertVersion("^7.0.0-0 || ^8.0.0-0 || >8.0.0-alpha <8.0.0-beta");
|
| 14 |
+
const noDocumentAll = (_api$assumption = api.assumption("noDocumentAll")) != null ? _api$assumption : loose;
|
| 15 |
+
const pureGetters = (_api$assumption2 = api.assumption("pureGetters")) != null ? _api$assumption2 : false;
|
| 16 |
+
return {
|
| 17 |
+
name: "transform-nullish-coalescing-operator",
|
| 18 |
+
manipulateOptions: (_, parser) => parser.plugins.push("nullishCoalescingOperator"),
|
| 19 |
+
visitor: {
|
| 20 |
+
LogicalExpression(path) {
|
| 21 |
+
const {
|
| 22 |
+
node,
|
| 23 |
+
scope
|
| 24 |
+
} = path;
|
| 25 |
+
if (node.operator !== "??") {
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
let ref;
|
| 29 |
+
let assignment;
|
| 30 |
+
if (pureGetters && scope.path.isPattern() && _core.types.isMemberExpression(node.left) && !node.left.computed && _core.types.isIdentifier(node.left.object) && _core.types.isIdentifier(node.left.property) || _core.types.isIdentifier(node.left) && (pureGetters || scope.hasBinding(node.left.name))) {
|
| 31 |
+
ref = node.left;
|
| 32 |
+
assignment = _core.types.cloneNode(node.left);
|
| 33 |
+
} else if (scope.path.isPattern()) {
|
| 34 |
+
path.replaceWith(_core.template.statement.ast`(() => ${path.node})()`);
|
| 35 |
+
return;
|
| 36 |
+
} else {
|
| 37 |
+
ref = scope.generateUidIdentifierBasedOnNode(node.left);
|
| 38 |
+
scope.push({
|
| 39 |
+
id: _core.types.cloneNode(ref)
|
| 40 |
+
});
|
| 41 |
+
assignment = _core.types.assignmentExpression("=", ref, node.left);
|
| 42 |
+
}
|
| 43 |
+
path.replaceWith(_core.types.conditionalExpression(noDocumentAll ? _core.types.binaryExpression("!=", assignment, _core.types.nullLiteral()) : _core.types.logicalExpression("&&", _core.types.binaryExpression("!==", assignment, _core.types.nullLiteral()), _core.types.binaryExpression("!==", _core.types.cloneNode(ref), scope.buildUndefinedNode())), _core.types.cloneNode(ref), node.right));
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
};
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","_core","_default","exports","default","declare","api","loose","_api$assumption","_api$assumption2","assertVersion","noDocumentAll","assumption","pureGetters","name","manipulateOptions","_","parser","plugins","push","visitor","LogicalExpression","path","node","scope","operator","ref","assignment","isPattern","t","isMemberExpression","left","computed","isIdentifier","object","property","hasBinding","cloneNode","replaceWith","template","statement","ast","generateUidIdentifierBasedOnNode","id","assignmentExpression","conditionalExpression","binaryExpression","nullLiteral","logicalExpression","buildUndefinedNode","right"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { types as t, template } from \"@babel/core\";\n\nexport interface Options {\n loose?: boolean;\n}\n\nexport default declare((api, { loose = false }: Options) => {\n api.assertVersion(REQUIRED_VERSION(\"^7.0.0-0 || ^8.0.0-0\"));\n const noDocumentAll = api.assumption(\"noDocumentAll\") ?? loose;\n const pureGetters = api.assumption(\"pureGetters\") ?? false;\n\n return {\n name: \"transform-nullish-coalescing-operator\",\n manipulateOptions: process.env.BABEL_8_BREAKING\n ? undefined\n : (_, parser) => parser.plugins.push(\"nullishCoalescingOperator\"),\n\n visitor: {\n LogicalExpression(path) {\n const { node, scope } = path;\n if (node.operator !== \"??\") {\n return;\n }\n\n let ref;\n let assignment;\n // skip creating extra reference when `left` is pure\n if (\n (pureGetters &&\n scope.path.isPattern() &&\n t.isMemberExpression(node.left) &&\n !node.left.computed &&\n t.isIdentifier(node.left.object) &&\n t.isIdentifier(node.left.property)) ||\n (t.isIdentifier(node.left) &&\n (pureGetters ||\n // globalThis\n scope.hasBinding(node.left.name)))\n ) {\n ref = node.left;\n assignment = t.cloneNode(node.left);\n } else if (scope.path.isPattern()) {\n // Replace `function (a, x = a.b ?? c) {}` to `function (a, x = (() => a.b ?? c)() ){}`\n // so the temporary variable can be injected in correct scope\n path.replaceWith(template.statement.ast`(() => ${path.node})()`);\n // The injected nullish expression will be queued and eventually transformed when visited\n return;\n } else {\n ref = scope.generateUidIdentifierBasedOnNode(node.left);\n scope.push({ id: t.cloneNode(ref) });\n assignment = t.assignmentExpression(\"=\", ref, node.left);\n }\n\n path.replaceWith(\n t.conditionalExpression(\n // We cannot use `!= null` in spec mode because\n // `document.all == null` and `document.all` is not \"nullish\".\n noDocumentAll\n ? t.binaryExpression(\"!=\", assignment, t.nullLiteral())\n : t.logicalExpression(\n \"&&\",\n t.binaryExpression(\"!==\", assignment, t.nullLiteral()),\n t.binaryExpression(\n \"!==\",\n t.cloneNode(ref),\n scope.buildUndefinedNode(),\n ),\n ),\n t.cloneNode(ref),\n node.right,\n ),\n );\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAmD,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMpC,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAE;EAAEC,KAAK,GAAG;AAAe,CAAC,KAAK;EAAA,IAAAC,eAAA,EAAAC,gBAAA;EAC1DH,GAAG,CAACI,aAAa,mDAAyC,CAAC;EAC3D,MAAMC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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-nullish-coalescing-operator",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "Remove nullish coalescing operator",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-nullish-coalescing-operator"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-nullish-coalescing-operator",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"keywords": [
|
| 17 |
+
"babel-plugin"
|
| 18 |
+
],
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 21 |
+
},
|
| 22 |
+
"peerDependencies": {
|
| 23 |
+
"@babel/core": "^7.0.0-0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"@babel/core": "^7.29.7",
|
| 27 |
+
"@babel/helper-plugin-test-runner": "^7.29.7"
|
| 28 |
+
},
|
| 29 |
+
"engines": {
|
| 30 |
+
"node": ">=6.9.0"
|
| 31 |
+
},
|
| 32 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 33 |
+
"type": "commonjs"
|
| 34 |
+
}
|
node_modules/@babel/plugin-transform-numeric-separator/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-numeric-separator/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-numeric-separator
|
| 2 |
+
|
| 3 |
+
> Remove numeric separators from Decimal, Binary, Hex and Octal literals
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-numeric-separator](https://babeljs.io/docs/babel-plugin-transform-numeric-separator) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-numeric-separator
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-numeric-separator --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-numeric-separator/lib/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.default = void 0;
|
| 7 |
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
| 8 |
+
function remover({
|
| 9 |
+
node
|
| 10 |
+
}) {
|
| 11 |
+
var _extra$raw;
|
| 12 |
+
const {
|
| 13 |
+
extra
|
| 14 |
+
} = node;
|
| 15 |
+
if (extra != null && (_extra$raw = extra.raw) != null && _extra$raw.includes("_")) {
|
| 16 |
+
extra.raw = extra.raw.replace(/_/g, "");
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
|
| 20 |
+
api.assertVersion("^7.0.0-0 || ^8.0.0-0 || >8.0.0-alpha <8.0.0-beta");
|
| 21 |
+
return {
|
| 22 |
+
name: "transform-numeric-separator",
|
| 23 |
+
manipulateOptions: (_, parser) => parser.plugins.push("numericSeparator"),
|
| 24 |
+
visitor: {
|
| 25 |
+
NumericLiteral: remover,
|
| 26 |
+
BigIntLiteral: remover
|
| 27 |
+
}
|
| 28 |
+
};
|
| 29 |
+
});
|
| 30 |
+
|
| 31 |
+
//# sourceMappingURL=index.js.map
|
node_modules/@babel/plugin-transform-numeric-separator/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"names":["_helperPluginUtils","require","remover","node","_extra$raw","extra","raw","includes","replace","_default","exports","default","declare","api","assertVersion","name","manipulateOptions","_","parser","plugins","push","visitor","NumericLiteral","BigIntLiteral"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport type { NodePath, types as t } from \"@babel/core\";\n\n/**\n * Given a bigIntLiteral or NumericLiteral, remove numeric\n * separator `_` from its raw representation\n *\n * @param {NodePath<BigIntLiteral | NumericLiteral>} { node }: A Babel AST node path\n */\nfunction remover({ node }: NodePath<t.BigIntLiteral | t.NumericLiteral>) {\n const { extra } = node;\n // @ts-expect-error todo(flow->ts)\n if (extra?.raw?.includes(\"_\")) {\n // @ts-expect-error todo(flow->ts)\n extra.raw = extra.raw.replace(/_/g, \"\");\n }\n}\n\nexport default declare(api => {\n api.assertVersion(REQUIRED_VERSION(\"^7.0.0-0 || ^8.0.0-0\"));\n\n return {\n name: \"transform-numeric-separator\",\n manipulateOptions: process.env.BABEL_8_BREAKING\n ? undefined\n : (_, parser) => parser.plugins.push(\"numericSeparator\"),\n\n visitor: {\n NumericLiteral: remover,\n BigIntLiteral: remover,\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AASA,SAASC,OAAOA,CAAC;EAAEC;AAAmD,CAAC,EAAE;EAAA,IAAAC,UAAA;EACvE,MAAM;IAAEC;EAAM,CAAC,GAAGF,IAAI;EAEtB,IAAIE,KAAK,aAAAD,UAAA,GAALC,KAAK,CAAEC,GAAG,aAAVF,UAAA,CAAYG,QAAQ,CAAC,GAAG,CAAC,EAAE;IAE7BF,KAAK,CAACC,GAAG,GAAGD,KAAK,CAACC,GAAG,CAACE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;EACzC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,mDAAyC,CAAC;EAE3D,OAAO;IACLC,IAAI,EAAE,6BAA6B;IACnCC,iBAAiB,EAEbA,CAACC,CAAC,EAAEC,MAAM,KAAKA,MAAM,CAACC,OAAO,CAACC,IAAI,CAAC,kBAAkB,CAAC;IAE1DC,OAAO,EAAE;MACPC,cAAc,EAAEpB,OAAO;MACvBqB,aAAa,EAAErB;IACjB;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
node_modules/@babel/plugin-transform-numeric-separator/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@babel/plugin-transform-numeric-separator",
|
| 3 |
+
"version": "7.29.7",
|
| 4 |
+
"description": "Remove numeric separators from Decimal, Binary, Hex and Octal literals",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "https://github.com/babel/babel.git",
|
| 8 |
+
"directory": "packages/babel-plugin-transform-numeric-separator"
|
| 9 |
+
},
|
| 10 |
+
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-numeric-separator",
|
| 11 |
+
"license": "MIT",
|
| 12 |
+
"publishConfig": {
|
| 13 |
+
"access": "public"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/index.js",
|
| 16 |
+
"keywords": [
|
| 17 |
+
"babel-plugin"
|
| 18 |
+
],
|
| 19 |
+
"dependencies": {
|
| 20 |
+
"@babel/helper-plugin-utils": "^7.29.7"
|
| 21 |
+
},
|
| 22 |
+
"peerDependencies": {
|
| 23 |
+
"@babel/core": "^7.0.0-0"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"@babel/core": "^7.29.7",
|
| 27 |
+
"@babel/helper-plugin-test-runner": "^7.29.7",
|
| 28 |
+
"@babel/traverse": "^7.29.7",
|
| 29 |
+
"@babel/types": "^7.29.7"
|
| 30 |
+
},
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=6.9.0"
|
| 33 |
+
},
|
| 34 |
+
"author": "The Babel Team (https://babel.dev/team)",
|
| 35 |
+
"type": "commonjs"
|
| 36 |
+
}
|
node_modules/@babel/plugin-transform-object-rest-spread/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/@babel/plugin-transform-object-rest-spread/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/plugin-transform-object-rest-spread
|
| 2 |
+
|
| 3 |
+
> Compile object rest and spread to ES5
|
| 4 |
+
|
| 5 |
+
See our website [@babel/plugin-transform-object-rest-spread](https://babeljs.io/docs/babel-plugin-transform-object-rest-spread) for more information.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/plugin-transform-object-rest-spread
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/plugin-transform-object-rest-spread --dev
|
| 19 |
+
```
|
node_modules/@babel/plugin-transform-object-rest-spread/lib/index.js
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, '__esModule', { value: true });
|
| 4 |
+
|
| 5 |
+
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
| 6 |
+
var core = require('@babel/core');
|
| 7 |
+
var pluginTransformParameters = require('@babel/plugin-transform-parameters');
|
| 8 |
+
var helperCompilationTargets = require('@babel/helper-compilation-targets');
|
| 9 |
+
var pluginTransformDestructuring = require('@babel/plugin-transform-destructuring');
|
| 10 |
+
|
| 11 |
+
function shouldStoreRHSInTemporaryVariable(node) {
|
| 12 |
+
if (!node) return false;
|
| 13 |
+
if (node.type === "ArrayPattern") {
|
| 14 |
+
const nonNullElements = node.elements.filter(element => element !== null && element.type !== "VoidPattern");
|
| 15 |
+
if (nonNullElements.length > 1) return true;else return shouldStoreRHSInTemporaryVariable(nonNullElements[0]);
|
| 16 |
+
} else if (node.type === "ObjectPattern") {
|
| 17 |
+
const {
|
| 18 |
+
properties
|
| 19 |
+
} = node;
|
| 20 |
+
if (properties.length > 1) return true;else if (properties.length === 0) return false;else {
|
| 21 |
+
const firstProperty = properties[0];
|
| 22 |
+
if (firstProperty.type === "ObjectProperty") {
|
| 23 |
+
return shouldStoreRHSInTemporaryVariable(firstProperty.value);
|
| 24 |
+
} else {
|
| 25 |
+
return shouldStoreRHSInTemporaryVariable(firstProperty);
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
} else if (node.type === "AssignmentPattern") {
|
| 29 |
+
return shouldStoreRHSInTemporaryVariable(node.left);
|
| 30 |
+
} else if (node.type === "RestElement") {
|
| 31 |
+
if (node.argument.type === "Identifier") return true;
|
| 32 |
+
return shouldStoreRHSInTemporaryVariable(node.argument);
|
| 33 |
+
} else {
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
var compatData = {
|
| 39 |
+
"Object.assign": {
|
| 40 |
+
chrome: "49",
|
| 41 |
+
opera: "36",
|
| 42 |
+
edge: "13",
|
| 43 |
+
firefox: "36",
|
| 44 |
+
safari: "10",
|
| 45 |
+
node: "6",
|
| 46 |
+
deno: "1",
|
| 47 |
+
ios: "10",
|
| 48 |
+
samsung: "5",
|
| 49 |
+
opera_mobile: "36",
|
| 50 |
+
electron: "0.37"
|
| 51 |
+
}
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
const node = core.types.identifier("a");
|
| 55 |
+
const property = core.types.objectProperty(core.types.identifier("key"), node);
|
| 56 |
+
const pattern = core.types.objectPattern([property]);
|
| 57 |
+
var ZERO_REFS = core.types.isReferenced(node, property, pattern) ? 1 : 0;
|
| 58 |
+
var index = helperPluginUtils.declare((api, opts) => {
|
| 59 |
+
var _api$assumption, _api$assumption2, _api$assumption3, _api$assumption4;
|
| 60 |
+
api.assertVersion("^7.0.0-0 || ^8.0.0-0 || >8.0.0-alpha <8.0.0-beta");
|
| 61 |
+
const targets = api.targets();
|
| 62 |
+
const supportsObjectAssign = !helperCompilationTargets.isRequired("Object.assign", targets, {
|
| 63 |
+
compatData
|
| 64 |
+
});
|
| 65 |
+
const {
|
| 66 |
+
useBuiltIns = supportsObjectAssign,
|
| 67 |
+
loose = false
|
| 68 |
+
} = opts;
|
| 69 |
+
if (typeof loose !== "boolean") {
|
| 70 |
+
throw new Error(".loose must be a boolean, or undefined");
|
| 71 |
+
}
|
| 72 |
+
const ignoreFunctionLength = (_api$assumption = api.assumption("ignoreFunctionLength")) != null ? _api$assumption : loose;
|
| 73 |
+
const objectRestNoSymbols = (_api$assumption2 = api.assumption("objectRestNoSymbols")) != null ? _api$assumption2 : loose;
|
| 74 |
+
const pureGetters = (_api$assumption3 = api.assumption("pureGetters")) != null ? _api$assumption3 : loose;
|
| 75 |
+
const setSpreadProperties = (_api$assumption4 = api.assumption("setSpreadProperties")) != null ? _api$assumption4 : loose;
|
| 76 |
+
function getExtendsHelper(file) {
|
| 77 |
+
return useBuiltIns ? core.types.memberExpression(core.types.identifier("Object"), core.types.identifier("assign")) : file.addHelper("extends");
|
| 78 |
+
}
|
| 79 |
+
function* iterateObjectRestElement(path) {
|
| 80 |
+
switch (path.type) {
|
| 81 |
+
case "ArrayPattern":
|
| 82 |
+
for (const elementPath of path.get("elements")) {
|
| 83 |
+
if (elementPath.isRestElement()) {
|
| 84 |
+
yield* iterateObjectRestElement(elementPath.get("argument"));
|
| 85 |
+
} else {
|
| 86 |
+
yield* iterateObjectRestElement(elementPath);
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
break;
|
| 90 |
+
case "ObjectPattern":
|
| 91 |
+
for (const propertyPath of path.get("properties")) {
|
| 92 |
+
if (propertyPath.isRestElement()) {
|
| 93 |
+
yield propertyPath;
|
| 94 |
+
} else {
|
| 95 |
+
yield* iterateObjectRestElement(propertyPath.get("value"));
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
break;
|
| 99 |
+
case "AssignmentPattern":
|
| 100 |
+
yield* iterateObjectRestElement(path.get("left"));
|
| 101 |
+
break;
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
function hasObjectRestElement(path) {
|
| 105 |
+
const objectRestPatternIterator = iterateObjectRestElement(path);
|
| 106 |
+
return !objectRestPatternIterator.next().done;
|
| 107 |
+
}
|
| 108 |
+
function visitObjectRestElements(path, visitor) {
|
| 109 |
+
for (const restElementPath of iterateObjectRestElement(path)) {
|
| 110 |
+
visitor(restElementPath);
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
function hasSpread(node) {
|
| 114 |
+
for (const prop of node.properties) {
|
| 115 |
+
if (core.types.isSpreadElement(prop)) {
|
| 116 |
+
return true;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
return false;
|
| 120 |
+
}
|
| 121 |
+
function extractNormalizedKeys(pattern) {
|
| 122 |
+
const propsList = pattern.get("properties").map(p => p.node);
|
| 123 |
+
const keys = [];
|
| 124 |
+
let allPrimitives = true;
|
| 125 |
+
let hasTemplateLiteral = false;
|
| 126 |
+
for (const prop of propsList) {
|
| 127 |
+
const key = prop.key;
|
| 128 |
+
if (core.types.isIdentifier(key) && !prop.computed) {
|
| 129 |
+
keys.push(core.types.stringLiteral(key.name));
|
| 130 |
+
} else if (core.types.isTemplateLiteral(key)) {
|
| 131 |
+
keys.push(core.types.cloneNode(key));
|
| 132 |
+
hasTemplateLiteral = true;
|
| 133 |
+
} else if (core.types.isLiteral(key)) {
|
| 134 |
+
keys.push(core.types.stringLiteral(String(key.value)));
|
| 135 |
+
} else {
|
| 136 |
+
if (core.types.isAssignmentExpression(key) && core.types.isIdentifier(key.left)) {
|
| 137 |
+
keys.push(core.types.cloneNode(key.left));
|
| 138 |
+
} else {
|
| 139 |
+
keys.push(core.types.cloneNode(key));
|
| 140 |
+
}
|
| 141 |
+
const keyToCheck = core.types.isAssignmentExpression(key) ? key.right : key;
|
| 142 |
+
if (core.types.isMemberExpression(keyToCheck, {
|
| 143 |
+
computed: false
|
| 144 |
+
}) && core.types.isIdentifier(keyToCheck.object, {
|
| 145 |
+
name: "Symbol"
|
| 146 |
+
}) || core.types.isCallExpression(keyToCheck) && core.types.matchesPattern(keyToCheck.callee, "Symbol.for")) ; else {
|
| 147 |
+
allPrimitives = false;
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
return {
|
| 152 |
+
keys,
|
| 153 |
+
allPrimitives,
|
| 154 |
+
hasTemplateLiteral
|
| 155 |
+
};
|
| 156 |
+
}
|
| 157 |
+
function replaceImpureComputedKeys(properties, scope) {
|
| 158 |
+
const tempVariableDeclarations = [];
|
| 159 |
+
for (const property of properties) {
|
| 160 |
+
const keyExpression = property.get("key");
|
| 161 |
+
if (keyExpression.isAssignmentExpression() && keyExpression.get("left").isIdentifier()) {
|
| 162 |
+
const identName = keyExpression.node.left.name;
|
| 163 |
+
if (scope.hasUid(identName)) {
|
| 164 |
+
continue;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
if (property.node.computed && !keyExpression.isPure()) {
|
| 168 |
+
const tempVariableName = scope.generateUidBasedOnNode(keyExpression.node);
|
| 169 |
+
const tempVariableDeclaration = core.types.variableDeclarator(core.types.identifier(tempVariableName), keyExpression.node);
|
| 170 |
+
tempVariableDeclarations.push(tempVariableDeclaration);
|
| 171 |
+
keyExpression.replaceWith(core.types.identifier(tempVariableName));
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
return tempVariableDeclarations;
|
| 175 |
+
}
|
| 176 |
+
function removeUnusedExcludedKeys(path) {
|
| 177 |
+
const bindings = path.getOuterBindingIdentifierPaths();
|
| 178 |
+
Object.keys(bindings).forEach(bindingName => {
|
| 179 |
+
const bindingParentPath = bindings[bindingName].parentPath;
|
| 180 |
+
if (path.scope.getBinding(bindingName).references > ZERO_REFS || !bindingParentPath.isObjectProperty()) {
|
| 181 |
+
return;
|
| 182 |
+
}
|
| 183 |
+
bindingParentPath.remove();
|
| 184 |
+
});
|
| 185 |
+
}
|
| 186 |
+
function collectComputedKeysInSourceOrder(destructuringPattern) {
|
| 187 |
+
const computedProperties = [];
|
| 188 |
+
function visitPattern(pattern) {
|
| 189 |
+
if (pattern.isObjectPattern()) {
|
| 190 |
+
const properties = pattern.get("properties");
|
| 191 |
+
for (const property of properties) {
|
| 192 |
+
if (property.isRestElement()) continue;
|
| 193 |
+
if (property.node.computed) {
|
| 194 |
+
computedProperties.push(property);
|
| 195 |
+
}
|
| 196 |
+
const nestedPattern = property.get("value");
|
| 197 |
+
visitPattern(nestedPattern);
|
| 198 |
+
}
|
| 199 |
+
} else if (pattern.isArrayPattern()) {
|
| 200 |
+
for (const element of pattern.get("elements")) {
|
| 201 |
+
if (!element) continue;
|
| 202 |
+
if (element.isRestElement()) {
|
| 203 |
+
const restArgument = element.get("argument");
|
| 204 |
+
visitPattern(restArgument);
|
| 205 |
+
} else {
|
| 206 |
+
visitPattern(element);
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
} else if (pattern.isAssignmentPattern()) {
|
| 210 |
+
visitPattern(pattern.get("left"));
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
visitPattern(destructuringPattern);
|
| 214 |
+
return computedProperties;
|
| 215 |
+
}
|
| 216 |
+
function createObjectRest(path, file, objRef) {
|
| 217 |
+
const props = path.get("properties");
|
| 218 |
+
const last = props[props.length - 1];
|
| 219 |
+
core.types.assertRestElement(last.node);
|
| 220 |
+
const restElement = core.types.cloneNode(last.node);
|
| 221 |
+
last.remove();
|
| 222 |
+
const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path.get("properties"), path.scope);
|
| 223 |
+
const {
|
| 224 |
+
keys,
|
| 225 |
+
allPrimitives,
|
| 226 |
+
hasTemplateLiteral
|
| 227 |
+
} = extractNormalizedKeys(path);
|
| 228 |
+
if (keys.length === 0) {
|
| 229 |
+
return [impureComputedPropertyDeclarators, restElement.argument, core.types.callExpression(getExtendsHelper(file), [core.types.objectExpression([]), core.types.sequenceExpression([core.types.callExpression(file.addHelper("objectDestructuringEmpty"), [core.types.cloneNode(objRef)]), core.types.cloneNode(objRef)])])];
|
| 230 |
+
}
|
| 231 |
+
let keyExpression;
|
| 232 |
+
if (!allPrimitives) {
|
| 233 |
+
keyExpression = core.types.callExpression(core.types.memberExpression(core.types.arrayExpression(keys), core.types.identifier("map")), [file.addHelper("toPropertyKey")]);
|
| 234 |
+
} else {
|
| 235 |
+
keyExpression = core.types.arrayExpression(keys);
|
| 236 |
+
if (!hasTemplateLiteral && !core.types.isProgram(path.scope.block)) {
|
| 237 |
+
const program = path.findParent(path => path.isProgram());
|
| 238 |
+
const id = path.scope.generateUidIdentifier("excluded");
|
| 239 |
+
program.scope.push({
|
| 240 |
+
id,
|
| 241 |
+
init: keyExpression,
|
| 242 |
+
kind: "const"
|
| 243 |
+
});
|
| 244 |
+
keyExpression = core.types.cloneNode(id);
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
return [impureComputedPropertyDeclarators, restElement.argument, core.types.callExpression(file.addHelper(`objectWithoutProperties${objectRestNoSymbols ? "Loose" : ""}`), [core.types.cloneNode(objRef), keyExpression])];
|
| 248 |
+
}
|
| 249 |
+
function replaceRestElement(parentPath, paramPath, container) {
|
| 250 |
+
if (paramPath.isAssignmentPattern()) {
|
| 251 |
+
replaceRestElement(parentPath, paramPath.get("left"), container);
|
| 252 |
+
return;
|
| 253 |
+
}
|
| 254 |
+
if (paramPath.isArrayPattern() && hasObjectRestElement(paramPath)) {
|
| 255 |
+
const elements = paramPath.get("elements");
|
| 256 |
+
for (let i = 0; i < elements.length; i++) {
|
| 257 |
+
replaceRestElement(parentPath, elements[i], container);
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
if (paramPath.isObjectPattern() && hasObjectRestElement(paramPath)) {
|
| 261 |
+
const uid = parentPath.scope.generateUidIdentifier("ref");
|
| 262 |
+
const declar = core.types.variableDeclaration("let", [core.types.variableDeclarator(paramPath.node, uid)]);
|
| 263 |
+
if (container) {
|
| 264 |
+
container.push(declar);
|
| 265 |
+
} else {
|
| 266 |
+
parentPath.ensureBlock();
|
| 267 |
+
parentPath.get("body").unshiftContainer("body", declar);
|
| 268 |
+
}
|
| 269 |
+
paramPath.replaceWith(core.types.cloneNode(uid));
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
return {
|
| 273 |
+
name: "transform-object-rest-spread",
|
| 274 |
+
manipulateOptions: (_, parser) => parser.plugins.push("objectRestSpread"),
|
| 275 |
+
visitor: {
|
| 276 |
+
Function(path) {
|
| 277 |
+
const params = path.get("params");
|
| 278 |
+
const paramsWithRestElement = new Set();
|
| 279 |
+
const idsInRestParams = new Set();
|
| 280 |
+
for (let i = 0; i < params.length; ++i) {
|
| 281 |
+
const param = params[i];
|
| 282 |
+
if (hasObjectRestElement(param)) {
|
| 283 |
+
paramsWithRestElement.add(i);
|
| 284 |
+
for (const name of Object.keys(param.getBindingIdentifiers())) {
|
| 285 |
+
idsInRestParams.add(name);
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
let idInRest = false;
|
| 290 |
+
const IdentifierHandler = function (path, functionScope) {
|
| 291 |
+
const name = path.node.name;
|
| 292 |
+
if (path.scope.getBinding(name) === functionScope.getBinding(name) && idsInRestParams.has(name)) {
|
| 293 |
+
idInRest = true;
|
| 294 |
+
path.stop();
|
| 295 |
+
}
|
| 296 |
+
};
|
| 297 |
+
let i;
|
| 298 |
+
for (i = 0; i < params.length && !idInRest; ++i) {
|
| 299 |
+
const param = params[i];
|
| 300 |
+
if (!paramsWithRestElement.has(i)) {
|
| 301 |
+
if (param.isReferencedIdentifier() || param.isBindingIdentifier()) {
|
| 302 |
+
IdentifierHandler(param, path.scope);
|
| 303 |
+
} else {
|
| 304 |
+
param.traverse({
|
| 305 |
+
"Scope|TypeAnnotation|TSTypeAnnotation": path => path.skip(),
|
| 306 |
+
"ReferencedIdentifier|BindingIdentifier": IdentifierHandler
|
| 307 |
+
}, path.scope);
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
if (!idInRest) {
|
| 312 |
+
for (let i = 0; i < params.length; ++i) {
|
| 313 |
+
const param = params[i];
|
| 314 |
+
if (paramsWithRestElement.has(i)) {
|
| 315 |
+
replaceRestElement(path, param);
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
} else {
|
| 319 |
+
const shouldTransformParam = idx => idx >= i - 1 || paramsWithRestElement.has(idx);
|
| 320 |
+
pluginTransformParameters.convertFunctionParams(path, ignoreFunctionLength, shouldTransformParam, replaceRestElement);
|
| 321 |
+
}
|
| 322 |
+
},
|
| 323 |
+
VariableDeclarator(path, file) {
|
| 324 |
+
if (!path.get("id").isObjectPattern()) {
|
| 325 |
+
return;
|
| 326 |
+
}
|
| 327 |
+
let insertionPath = path;
|
| 328 |
+
const originalPath = path;
|
| 329 |
+
if (hasObjectRestElement(path.get("id"))) {
|
| 330 |
+
const destructuringPattern = originalPath.get("id");
|
| 331 |
+
const propertiesWithComputedKeys = collectComputedKeysInSourceOrder(destructuringPattern);
|
| 332 |
+
for (const property of propertiesWithComputedKeys) {
|
| 333 |
+
const computedKeyExpression = property.get("key");
|
| 334 |
+
if (computedKeyExpression.isAssignmentExpression() && computedKeyExpression.get("left").isIdentifier() && originalPath.scope.hasUid(computedKeyExpression.node.left.name)) {
|
| 335 |
+
continue;
|
| 336 |
+
}
|
| 337 |
+
if (!computedKeyExpression.isPure()) {
|
| 338 |
+
const tempVariableName = originalPath.scope.generateUidBasedOnNode(computedKeyExpression.node);
|
| 339 |
+
const tempIdentifier = core.types.identifier(tempVariableName);
|
| 340 |
+
originalPath.scope.push({
|
| 341 |
+
id: tempIdentifier,
|
| 342 |
+
kind: "var"
|
| 343 |
+
});
|
| 344 |
+
computedKeyExpression.replaceWith(core.types.assignmentExpression("=", core.types.cloneNode(tempIdentifier), computedKeyExpression.node));
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
visitObjectRestElements(path.get("id"), path => {
|
| 349 |
+
if (shouldStoreRHSInTemporaryVariable(originalPath.node.id) && !core.types.isIdentifier(originalPath.node.init)) {
|
| 350 |
+
const initRef = path.scope.generateUidIdentifierBasedOnNode(originalPath.node.init, "ref");
|
| 351 |
+
originalPath.insertBefore(core.types.variableDeclarator(initRef, originalPath.node.init));
|
| 352 |
+
originalPath.replaceWith(core.types.variableDeclarator(originalPath.node.id, core.types.cloneNode(initRef)));
|
| 353 |
+
return;
|
| 354 |
+
}
|
| 355 |
+
let ref = originalPath.node.init;
|
| 356 |
+
const refPropertyPath = [];
|
| 357 |
+
let kind;
|
| 358 |
+
path.findParent(path => {
|
| 359 |
+
if (path.isObjectProperty()) {
|
| 360 |
+
refPropertyPath.unshift(path);
|
| 361 |
+
} else if (path.isVariableDeclarator()) {
|
| 362 |
+
kind = path.parentPath.node.kind;
|
| 363 |
+
return true;
|
| 364 |
+
}
|
| 365 |
+
});
|
| 366 |
+
const impureObjRefComputedDeclarators = replaceImpureComputedKeys(refPropertyPath, path.scope);
|
| 367 |
+
refPropertyPath.forEach(prop => {
|
| 368 |
+
const keyPath = prop.get("key");
|
| 369 |
+
let keyForMemberExpression = keyPath.node;
|
| 370 |
+
if (core.types.isAssignmentExpression(keyPath.node)) {
|
| 371 |
+
keyForMemberExpression = keyPath.node.left;
|
| 372 |
+
}
|
| 373 |
+
ref = core.types.memberExpression(ref, core.types.cloneNode(keyForMemberExpression), prop.node.computed || core.types.isLiteral(keyPath.node));
|
| 374 |
+
});
|
| 375 |
+
const objectPatternPath = path.parentPath;
|
| 376 |
+
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectRest(objectPatternPath, file, ref);
|
| 377 |
+
if (pureGetters) {
|
| 378 |
+
removeUnusedExcludedKeys(objectPatternPath);
|
| 379 |
+
}
|
| 380 |
+
core.types.assertIdentifier(argument);
|
| 381 |
+
insertionPath.insertBefore(impureComputedPropertyDeclarators);
|
| 382 |
+
insertionPath.insertBefore(impureObjRefComputedDeclarators);
|
| 383 |
+
insertionPath = insertionPath.insertAfter(core.types.variableDeclarator(argument, callExpression))[0];
|
| 384 |
+
path.scope.registerBinding(kind, insertionPath);
|
| 385 |
+
if (objectPatternPath.node.properties.length === 0) {
|
| 386 |
+
objectPatternPath.findParent(path => path.isObjectProperty() || path.isVariableDeclarator()).remove();
|
| 387 |
+
}
|
| 388 |
+
});
|
| 389 |
+
},
|
| 390 |
+
ExportNamedDeclaration(path) {
|
| 391 |
+
var _path$splitExportDecl;
|
| 392 |
+
const declaration = path.get("declaration");
|
| 393 |
+
if (!declaration.isVariableDeclaration()) return;
|
| 394 |
+
const hasRest = declaration.get("declarations").some(path => hasObjectRestElement(path.get("id")));
|
| 395 |
+
if (!hasRest) return;
|
| 396 |
+
(_path$splitExportDecl = path.splitExportDeclaration) != null ? _path$splitExportDecl : path.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
|
| 397 |
+
path.splitExportDeclaration();
|
| 398 |
+
},
|
| 399 |
+
CatchClause(path) {
|
| 400 |
+
const paramPath = path.get("param");
|
| 401 |
+
replaceRestElement(path, paramPath);
|
| 402 |
+
},
|
| 403 |
+
AssignmentExpression(path, file) {
|
| 404 |
+
const leftPath = path.get("left");
|
| 405 |
+
if (leftPath.isObjectPattern() && hasObjectRestElement(leftPath)) {
|
| 406 |
+
const nodes = [];
|
| 407 |
+
const refName = path.scope.generateUidBasedOnNode(path.node.right, "ref");
|
| 408 |
+
nodes.push(core.types.variableDeclaration("var", [core.types.variableDeclarator(core.types.identifier(refName), path.node.right)]));
|
| 409 |
+
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectRest(leftPath, file, core.types.identifier(refName));
|
| 410 |
+
if (impureComputedPropertyDeclarators.length > 0) {
|
| 411 |
+
nodes.push(core.types.variableDeclaration("var", impureComputedPropertyDeclarators));
|
| 412 |
+
}
|
| 413 |
+
const nodeWithoutSpread = core.types.cloneNode(path.node);
|
| 414 |
+
nodeWithoutSpread.right = core.types.identifier(refName);
|
| 415 |
+
nodes.push(core.types.expressionStatement(nodeWithoutSpread));
|
| 416 |
+
nodes.push(core.types.expressionStatement(core.types.assignmentExpression("=", argument, callExpression)));
|
| 417 |
+
nodes.push(core.types.expressionStatement(core.types.identifier(refName)));
|
| 418 |
+
path.replaceWithMultiple(nodes);
|
| 419 |
+
}
|
| 420 |
+
},
|
| 421 |
+
ForXStatement(path) {
|
| 422 |
+
const {
|
| 423 |
+
node,
|
| 424 |
+
scope
|
| 425 |
+
} = path;
|
| 426 |
+
const leftPath = path.get("left");
|
| 427 |
+
if (!leftPath.isVariableDeclaration()) {
|
| 428 |
+
if (!hasObjectRestElement(leftPath)) {
|
| 429 |
+
return;
|
| 430 |
+
}
|
| 431 |
+
const temp = scope.generateUidIdentifier("ref");
|
| 432 |
+
node.left = core.types.variableDeclaration("var", [core.types.variableDeclarator(temp)]);
|
| 433 |
+
path.ensureBlock();
|
| 434 |
+
const statementBody = path.node.body.body;
|
| 435 |
+
const nodes = [];
|
| 436 |
+
if (statementBody.length === 0 && path.isCompletionRecord()) {
|
| 437 |
+
nodes.unshift(core.types.expressionStatement(scope.buildUndefinedNode()));
|
| 438 |
+
}
|
| 439 |
+
nodes.unshift(core.types.expressionStatement(core.types.assignmentExpression("=", leftPath.node, core.types.cloneNode(temp))));
|
| 440 |
+
pluginTransformDestructuring.unshiftForXStatementBody(path, nodes);
|
| 441 |
+
scope.crawl();
|
| 442 |
+
return;
|
| 443 |
+
} else {
|
| 444 |
+
const patternPath = leftPath.get("declarations")[0].get("id");
|
| 445 |
+
if (!hasObjectRestElement(patternPath)) {
|
| 446 |
+
return;
|
| 447 |
+
}
|
| 448 |
+
const left = leftPath.node;
|
| 449 |
+
const pattern = patternPath.node;
|
| 450 |
+
const key = scope.generateUidIdentifier("ref");
|
| 451 |
+
node.left = core.types.variableDeclaration(left.kind, [core.types.variableDeclarator(key, null)]);
|
| 452 |
+
path.ensureBlock();
|
| 453 |
+
pluginTransformDestructuring.unshiftForXStatementBody(path, [core.types.variableDeclaration(node.left.kind, [core.types.variableDeclarator(pattern, core.types.cloneNode(key))])]);
|
| 454 |
+
scope.crawl();
|
| 455 |
+
return;
|
| 456 |
+
}
|
| 457 |
+
},
|
| 458 |
+
ArrayPattern(path) {
|
| 459 |
+
const objectPatterns = [];
|
| 460 |
+
const {
|
| 461 |
+
scope
|
| 462 |
+
} = path;
|
| 463 |
+
const uidIdentifiers = [];
|
| 464 |
+
visitObjectRestElements(path, path => {
|
| 465 |
+
const objectPattern = path.parentPath;
|
| 466 |
+
const uid = scope.generateUidIdentifier("ref");
|
| 467 |
+
objectPatterns.push({
|
| 468 |
+
left: objectPattern.node,
|
| 469 |
+
right: uid
|
| 470 |
+
});
|
| 471 |
+
uidIdentifiers.push(uid);
|
| 472 |
+
objectPattern.replaceWith(core.types.cloneNode(uid));
|
| 473 |
+
path.skip();
|
| 474 |
+
});
|
| 475 |
+
if (objectPatterns.length > 0) {
|
| 476 |
+
const patternParentPath = path.findParent(path => !(path.isPattern() || path.isObjectProperty()));
|
| 477 |
+
const patternParent = patternParentPath.node;
|
| 478 |
+
switch (patternParent.type) {
|
| 479 |
+
case "VariableDeclarator":
|
| 480 |
+
patternParentPath.insertAfter(objectPatterns.map(({
|
| 481 |
+
left,
|
| 482 |
+
right
|
| 483 |
+
}) => core.types.variableDeclarator(left, right)));
|
| 484 |
+
break;
|
| 485 |
+
case "AssignmentExpression":
|
| 486 |
+
{
|
| 487 |
+
for (const uidIdentifier of uidIdentifiers) {
|
| 488 |
+
scope.push({
|
| 489 |
+
id: core.types.cloneNode(uidIdentifier)
|
| 490 |
+
});
|
| 491 |
+
}
|
| 492 |
+
patternParentPath.insertAfter(objectPatterns.map(({
|
| 493 |
+
left,
|
| 494 |
+
right
|
| 495 |
+
}) => core.types.assignmentExpression("=", left, right)));
|
| 496 |
+
}
|
| 497 |
+
break;
|
| 498 |
+
default:
|
| 499 |
+
throw new Error(`Unexpected pattern parent type: ${patternParent.type}`);
|
| 500 |
+
}
|
| 501 |
+
}
|
| 502 |
+
},
|
| 503 |
+
ObjectExpression(path, file) {
|
| 504 |
+
if (!hasSpread(path.node)) return;
|
| 505 |
+
let helper;
|
| 506 |
+
if (setSpreadProperties) {
|
| 507 |
+
helper = getExtendsHelper(file);
|
| 508 |
+
} else {
|
| 509 |
+
try {
|
| 510 |
+
helper = file.addHelper("objectSpread2");
|
| 511 |
+
} catch (_unused) {
|
| 512 |
+
this.file.declarations.objectSpread2 = null;
|
| 513 |
+
helper = file.addHelper("objectSpread");
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
let exp = null;
|
| 517 |
+
let props = [];
|
| 518 |
+
function make() {
|
| 519 |
+
const hadProps = props.length > 0;
|
| 520 |
+
const obj = core.types.objectExpression(props);
|
| 521 |
+
props = [];
|
| 522 |
+
if (!exp) {
|
| 523 |
+
exp = core.types.callExpression(helper, [obj]);
|
| 524 |
+
return;
|
| 525 |
+
}
|
| 526 |
+
if (pureGetters) {
|
| 527 |
+
if (hadProps) {
|
| 528 |
+
exp.arguments.push(obj);
|
| 529 |
+
}
|
| 530 |
+
return;
|
| 531 |
+
}
|
| 532 |
+
exp = core.types.callExpression(core.types.cloneNode(helper), [exp, ...(hadProps ? [core.types.objectExpression([]), obj] : [])]);
|
| 533 |
+
}
|
| 534 |
+
for (const prop of path.node.properties) {
|
| 535 |
+
if (core.types.isSpreadElement(prop)) {
|
| 536 |
+
make();
|
| 537 |
+
exp.arguments.push(prop.argument);
|
| 538 |
+
} else {
|
| 539 |
+
props.push(prop);
|
| 540 |
+
}
|
| 541 |
+
}
|
| 542 |
+
if (props.length) make();
|
| 543 |
+
path.replaceWith(exp);
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
};
|
| 547 |
+
});
|
| 548 |
+
|
| 549 |
+
exports.default = index;
|
| 550 |
+
//# sourceMappingURL=index.js.map
|