Merge remote-tracking branch 'upstream/main'

This commit is contained in:
2026-08-26 09:31:34 +08:00
parent 9b8c4bfab6
commit 394eb0285d
34137 changed files with 3589424 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
# Contributing
## Adding a new plugin or polyfill to support (when approved in the next ECMAScript version)
### Update [`plugin-features.mjs`](../babel-compat-data/scripts/data/plugin-features.mjs)
*Example:*
If you were going to add `**` which is in ES2016:
Find the relevant entries on [compat-table](https://compat-table.github.io/compat-table/es2016plus/#test-exponentiation_(**)_operator):
`exponentiation (**) operator`
Find the corresponding babel plugin:
`@babel/plugin-transform-exponentiation-operator`
And add them in this structure:
```js
// es2016
"@babel/plugin-transform-exponentiation-operator": {
features: [
"exponentiation (**) operator",
],
},
```
### Update data for `core-js@2` polyfilling
*Example:*
In case you want to add `Object.values` which is in ES2017:
Find the relevant feature and subfeature on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values)
and split it with `/`:
`Object static methods / Object.values`
Find the corresponding module on [`core-js@2`](https://github.com/zloirock/core-js/tree/v2/modules):
`es7.object.values.js`
Find required ES version in [`corejs2-built-in-features.js`](https://github.com/babel/babel/blob/main/packages/babel-preset-env/data/corejs2-built-in-features.js) and add the new feature:
```js
const es = {
//...
"es7.object.values": "Object static methods / Object.values"
}
```
If you want to transform a new built-in by `useBuiltIns: 'usage'`, add mapping to related `core-js` modules to [this file](https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs2/built-in-definitions.js).
### Update data for `core-js@3` polyfilling
Just update the version of [`core-js-compat`](https://github.com/zloirock/core-js/tree/main/packages/core-js-compat) in dependencies.
If you want to transform a new built-in by `useBuiltIns: 'usage'`, add mapping to related [`core-js`](https://github.com/zloirock/core-js/tree/main/packages/core-js/modules) modules to [this file](https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/built-in-definitions.js).
If you want to mark a new proposal as shipped, add it to [this list](https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/shipped-proposals.js).
### Update [`plugins.json`](../babel-compat-data/data/plugins.json)
Until `compat-table` is a standalone npm module for data we are using the git commit in `packages/babel-compat-data/scripts/download-compat-table.sh`
`COMPAT_TABLE_COMMIT=[latest-commit-hash]`,
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
## Tests
### Running tests
See general [CONTRIBUTING.md](../../CONTRIBUTING.md#running-lintingtests).
### Writing tests
#### General
All the tests for `@babel/preset-env` exist in the `test/fixtures` folder. The
test setup and conventions are exactly the same as testing a Babel plugin, so
please read our [documentation on writing tests](../../CONTRIBUTING.md#babel-plugin-x).
#### Testing the `debug` option
Testing debug output to `stdout` is similar. Under the `test/debug-fixtures`,
create a folder with a descriptive name of your test, and add the following:
* Add a `options.json` file (just as the other tests, this is essentially a
`.babelrc`) with the desired test configuration (required)
* Add a `stdout.txt` file with the expected debug output. For added
convenience, if there is no `stdout.txt` present, the test runner will
generate one for you.
+22
View File
@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+19
View File
@@ -0,0 +1,19 @@
# @babel/preset-env
> A Babel preset for each environment.
See our website [@babel/preset-env](https://babeljs.io/docs/babel-preset-env) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20preset-env%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/preset-env
```
or using yarn:
```sh
yarn add @babel/preset-env --dev
```
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/native-modules");
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/native-modules");
+4
View File
@@ -0,0 +1,4 @@
// TODO: Remove in Babel 8
// https://github.com/vuejs/vue-cli/issues/3671
module.exports = require("./corejs2-built-ins.json");
+4
View File
@@ -0,0 +1,4 @@
// TODO: Remove in Babel 8
// https://github.com/vuejs/vue-cli/issues/3671
module.exports = require("./corejs2-built-ins.json");
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("core-js-compat/data.json");
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/corejs2-built-ins");
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/corejs2-built-ins");
+1
View File
@@ -0,0 +1 @@
{ "type": "commonjs" }
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/plugins");
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/compat-data/plugins");
+4
View File
@@ -0,0 +1,4 @@
// TODO: Remove in Babel 8
const { pluginSyntaxMap, proposalPlugins, proposalSyntaxPlugins } = require("../lib/shipped-proposals");
module.exports = { pluginSyntaxMap, proposalPlugins, proposalSyntaxPlugins };
+3
View File
@@ -0,0 +1,3 @@
// TODO: Remove in Babel 8
module.exports = require("@babel/helper-compilation-targets").unreleasedLabels;
+176
View File
@@ -0,0 +1,176 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.minVersions = exports.legacyBabel7SyntaxPlugins = exports.default = void 0;
var _pluginSyntaxImportAssertions = require("@babel/plugin-syntax-import-assertions");
var _pluginSyntaxImportAttributes = require("@babel/plugin-syntax-import-attributes");
var _pluginTransformAsyncGeneratorFunctions = require("@babel/plugin-transform-async-generator-functions");
var _pluginTransformAsyncToGenerator = require("@babel/plugin-transform-async-to-generator");
var _pluginTransformArrowFunctions = require("@babel/plugin-transform-arrow-functions");
var _pluginTransformBlockScopedFunctions = require("@babel/plugin-transform-block-scoped-functions");
var _pluginTransformBlockScoping = require("@babel/plugin-transform-block-scoping");
var _pluginTransformClasses = require("@babel/plugin-transform-classes");
var _pluginTransformClassProperties = require("@babel/plugin-transform-class-properties");
var _pluginTransformClassStaticBlock = require("@babel/plugin-transform-class-static-block");
var _pluginTransformComputedProperties = require("@babel/plugin-transform-computed-properties");
var _pluginTransformDestructuring = require("@babel/plugin-transform-destructuring");
var _pluginTransformDotallRegex = require("@babel/plugin-transform-dotall-regex");
var _pluginTransformDuplicateKeys = require("@babel/plugin-transform-duplicate-keys");
var _pluginTransformDuplicateNamedCapturingGroupsRegex = require("@babel/plugin-transform-duplicate-named-capturing-groups-regex");
var _pluginTransformDynamicImport = require("@babel/plugin-transform-dynamic-import");
var _pluginTransformExplicitResourceManagement = require("@babel/plugin-transform-explicit-resource-management");
var _pluginTransformExponentiationOperator = require("@babel/plugin-transform-exponentiation-operator");
var _pluginTransformExportNamespaceFrom = require("@babel/plugin-transform-export-namespace-from");
var _pluginTransformForOf = require("@babel/plugin-transform-for-of");
var _pluginTransformFunctionName = require("@babel/plugin-transform-function-name");
var _pluginTransformJsonStrings = require("@babel/plugin-transform-json-strings");
var _pluginTransformLiterals = require("@babel/plugin-transform-literals");
var _pluginTransformLogicalAssignmentOperators = require("@babel/plugin-transform-logical-assignment-operators");
var _pluginTransformMemberExpressionLiterals = require("@babel/plugin-transform-member-expression-literals");
var _pluginTransformModulesAmd = require("@babel/plugin-transform-modules-amd");
var _pluginTransformModulesCommonjs = require("@babel/plugin-transform-modules-commonjs");
var _pluginTransformModulesSystemjs = require("@babel/plugin-transform-modules-systemjs");
var _pluginTransformModulesUmd = require("@babel/plugin-transform-modules-umd");
var _pluginTransformNamedCapturingGroupsRegex = require("@babel/plugin-transform-named-capturing-groups-regex");
var _pluginTransformNewTarget = require("@babel/plugin-transform-new-target");
var _pluginTransformNullishCoalescingOperator = require("@babel/plugin-transform-nullish-coalescing-operator");
var _pluginTransformNumericSeparator = require("@babel/plugin-transform-numeric-separator");
var _pluginTransformObjectRestSpread = require("@babel/plugin-transform-object-rest-spread");
var _pluginTransformObjectSuper = require("@babel/plugin-transform-object-super");
var _pluginTransformOptionalCatchBinding = require("@babel/plugin-transform-optional-catch-binding");
var _pluginTransformOptionalChaining = require("@babel/plugin-transform-optional-chaining");
var _pluginTransformParameters = require("@babel/plugin-transform-parameters");
var _pluginTransformPrivateMethods = require("@babel/plugin-transform-private-methods");
var _pluginTransformPrivatePropertyInObject = require("@babel/plugin-transform-private-property-in-object");
var _pluginTransformPropertyLiterals = require("@babel/plugin-transform-property-literals");
var _pluginTransformRegenerator = require("@babel/plugin-transform-regenerator");
var _pluginTransformRegexpModifiers = require("@babel/plugin-transform-regexp-modifiers");
var _pluginTransformReservedWords = require("@babel/plugin-transform-reserved-words");
var _pluginTransformShorthandProperties = require("@babel/plugin-transform-shorthand-properties");
var _pluginTransformSpread = require("@babel/plugin-transform-spread");
var _pluginTransformStickyRegex = require("@babel/plugin-transform-sticky-regex");
var _pluginTransformTemplateLiterals = require("@babel/plugin-transform-template-literals");
var _pluginTransformTypeofSymbol = require("@babel/plugin-transform-typeof-symbol");
var _pluginTransformUnicodeEscapes = require("@babel/plugin-transform-unicode-escapes");
var _pluginTransformUnicodePropertyRegex = require("@babel/plugin-transform-unicode-property-regex");
var _pluginTransformUnicodeRegex = require("@babel/plugin-transform-unicode-regex");
var _pluginTransformUnicodeSetsRegex = require("@babel/plugin-transform-unicode-sets-regex");
var _index = require("@babel/preset-modules/lib/plugins/transform-async-arrows-in-class/index.js");
var _index2 = require("@babel/preset-modules/lib/plugins/transform-edge-default-parameters/index.js");
var _index3 = require("@babel/preset-modules/lib/plugins/transform-edge-function-name/index.js");
var _pluginBugfixFirefoxClassInComputedClassKey = require("@babel/plugin-bugfix-firefox-class-in-computed-class-key");
var _index4 = require("@babel/preset-modules/lib/plugins/transform-tagged-template-caching/index.js");
var _index5 = require("@babel/preset-modules/lib/plugins/transform-safari-block-shadowing/index.js");
var _index6 = require("@babel/preset-modules/lib/plugins/transform-safari-for-shadowing/index.js");
var _pluginBugfixSafariIdDestructuringCollisionInFunctionExpression = require("@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression");
var _pluginBugfixSafariRestDestructuringRhsArray = require("@babel/plugin-bugfix-safari-rest-destructuring-rhs-array");
var _pluginBugfixSafariClassFieldInitializerScope = require("@babel/plugin-bugfix-safari-class-field-initializer-scope");
var _pluginBugfixV8SpreadParametersInOptionalChaining = require("@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining");
var _pluginBugfixV8StaticClassFieldsRedefineReadonly = require("@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly");
const availablePlugins = exports.default = {
"bugfix/transform-async-arrows-in-class": () => _index,
"bugfix/transform-edge-default-parameters": () => _index2,
"bugfix/transform-edge-function-name": () => _index3,
"bugfix/transform-firefox-class-in-computed-class-key": () => _pluginBugfixFirefoxClassInComputedClassKey.default,
"bugfix/transform-safari-block-shadowing": () => _index5,
"bugfix/transform-safari-class-field-initializer-scope": () => _pluginBugfixSafariClassFieldInitializerScope.default,
"bugfix/transform-safari-for-shadowing": () => _index6,
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": () => _pluginBugfixSafariIdDestructuringCollisionInFunctionExpression.default,
"bugfix/transform-safari-rest-destructuring-rhs-array": () => _pluginBugfixSafariRestDestructuringRhsArray.default,
"bugfix/transform-tagged-template-caching": () => _index4,
"bugfix/transform-v8-spread-parameters-in-optional-chaining": () => _pluginBugfixV8SpreadParametersInOptionalChaining.default,
"bugfix/transform-v8-static-class-fields-redefine-readonly": () => _pluginBugfixV8StaticClassFieldsRedefineReadonly.default,
"transform-arrow-functions": () => _pluginTransformArrowFunctions.default,
"transform-async-generator-functions": () => _pluginTransformAsyncGeneratorFunctions.default,
"transform-async-to-generator": () => _pluginTransformAsyncToGenerator.default,
"transform-block-scoped-functions": () => _pluginTransformBlockScopedFunctions.default,
"transform-block-scoping": () => _pluginTransformBlockScoping.default,
"transform-class-properties": () => _pluginTransformClassProperties.default,
"transform-class-static-block": () => _pluginTransformClassStaticBlock.default,
"transform-classes": () => _pluginTransformClasses.default,
"transform-computed-properties": () => _pluginTransformComputedProperties.default,
"transform-destructuring": () => _pluginTransformDestructuring.default,
"transform-dotall-regex": () => _pluginTransformDotallRegex.default,
"transform-duplicate-keys": () => _pluginTransformDuplicateKeys.default,
"transform-duplicate-named-capturing-groups-regex": () => _pluginTransformDuplicateNamedCapturingGroupsRegex.default,
"transform-dynamic-import": () => _pluginTransformDynamicImport.default,
"transform-explicit-resource-management": () => _pluginTransformExplicitResourceManagement.default,
"transform-exponentiation-operator": () => _pluginTransformExponentiationOperator.default,
"transform-export-namespace-from": () => _pluginTransformExportNamespaceFrom.default,
"transform-for-of": () => _pluginTransformForOf.default,
"transform-function-name": () => _pluginTransformFunctionName.default,
"transform-json-strings": () => _pluginTransformJsonStrings.default,
"transform-literals": () => _pluginTransformLiterals.default,
"transform-logical-assignment-operators": () => _pluginTransformLogicalAssignmentOperators.default,
"transform-member-expression-literals": () => _pluginTransformMemberExpressionLiterals.default,
"transform-modules-amd": () => _pluginTransformModulesAmd.default,
"transform-modules-commonjs": () => _pluginTransformModulesCommonjs.default,
"transform-modules-systemjs": () => _pluginTransformModulesSystemjs.default,
"transform-modules-umd": () => _pluginTransformModulesUmd.default,
"transform-named-capturing-groups-regex": () => _pluginTransformNamedCapturingGroupsRegex.default,
"transform-new-target": () => _pluginTransformNewTarget.default,
"transform-nullish-coalescing-operator": () => _pluginTransformNullishCoalescingOperator.default,
"transform-numeric-separator": () => _pluginTransformNumericSeparator.default,
"transform-object-rest-spread": () => _pluginTransformObjectRestSpread.default,
"transform-object-super": () => _pluginTransformObjectSuper.default,
"transform-optional-catch-binding": () => _pluginTransformOptionalCatchBinding.default,
"transform-optional-chaining": () => _pluginTransformOptionalChaining.default,
"transform-parameters": () => _pluginTransformParameters.default,
"transform-private-methods": () => _pluginTransformPrivateMethods.default,
"transform-private-property-in-object": () => _pluginTransformPrivatePropertyInObject.default,
"transform-property-literals": () => _pluginTransformPropertyLiterals.default,
"transform-regenerator": () => _pluginTransformRegenerator.default,
"transform-regexp-modifiers": () => _pluginTransformRegexpModifiers.default,
"transform-reserved-words": () => _pluginTransformReservedWords.default,
"transform-shorthand-properties": () => _pluginTransformShorthandProperties.default,
"transform-spread": () => _pluginTransformSpread.default,
"transform-sticky-regex": () => _pluginTransformStickyRegex.default,
"transform-template-literals": () => _pluginTransformTemplateLiterals.default,
"transform-typeof-symbol": () => _pluginTransformTypeofSymbol.default,
"transform-unicode-escapes": () => _pluginTransformUnicodeEscapes.default,
"transform-unicode-property-regex": () => _pluginTransformUnicodePropertyRegex.default,
"transform-unicode-regex": () => _pluginTransformUnicodeRegex.default,
"transform-unicode-sets-regex": () => _pluginTransformUnicodeSetsRegex.default
};
const minVersions = exports.minVersions = {};
let legacyBabel7SyntaxPlugins = exports.legacyBabel7SyntaxPlugins = void 0;
Object.assign(minVersions, {
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": "7.16.0",
"bugfix/transform-v8-static-class-fields-redefine-readonly": "7.12.0",
"syntax-import-attributes": "7.22.0",
"transform-class-static-block": "7.12.0",
"transform-duplicate-named-capturing-groups-regex": "7.19.0",
"transform-explicit-resource-management": "7.23.9",
"transform-private-property-in-object": "7.10.0",
"transform-regexp-modifiers": "7.19.0"
});
const syntax = name => () => () => ({
manipulateOptions: (_, p) => p.plugins.push(name)
});
const legacyBabel7SyntaxPluginsLoaders = {
"syntax-async-generators": syntax("asyncGenerators"),
"syntax-class-properties": syntax("classProperties"),
"syntax-class-static-block": syntax("classStaticBlock"),
"syntax-dynamic-import": syntax("dynamicImport"),
"syntax-explicit-resource-management": syntax("explicitResourceManagement"),
"syntax-export-namespace-from": syntax("exportNamespaceFrom"),
"syntax-import-meta": syntax("importMeta"),
"syntax-json-strings": syntax("jsonStrings"),
"syntax-logical-assignment-operators": syntax("logicalAssignment"),
"syntax-nullish-coalescing-operator": syntax("nullishCoalescingOperator"),
"syntax-numeric-separator": syntax("numericSeparator"),
"syntax-object-rest-spread": syntax("objectRestSpread"),
"syntax-optional-catch-binding": syntax("optionalCatchBinding"),
"syntax-optional-chaining": syntax("optionalChaining"),
"syntax-private-property-in-object": syntax("privateIn"),
"syntax-top-level-await": syntax("topLevelAwait"),
"syntax-import-assertions": () => _pluginSyntaxImportAssertions.default,
"syntax-import-attributes": () => _pluginSyntaxImportAttributes.default,
"syntax-unicode-sets-regex": () => require("@babel/plugin-syntax-unicode-sets-regex")
};
Object.assign(availablePlugins, legacyBabel7SyntaxPluginsLoaders);
exports.legacyBabel7SyntaxPlugins = legacyBabel7SyntaxPlugins = new Set(Object.keys(legacyBabel7SyntaxPluginsLoaders));
//# sourceMappingURL=available-plugins.js.map
File diff suppressed because one or more lines are too long
+35
View File
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.logPlugin = void 0;
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
const compatData = require("@babel/compat-data/plugins");
const logPlugin = (item, targetVersions, list) => {
const filteredList = (0, _helperCompilationTargets.getInclusionReasons)(item, targetVersions, list);
const support = list[item];
if (item.startsWith("transform-")) {
const proposalName = `proposal-${item.slice(10)}`;
if (proposalName === "proposal-dynamic-import" || hasOwnProperty.call(compatData, proposalName)) {
item = proposalName;
}
}
if (!support) {
console.log(` ${item}`);
return;
}
let formattedTargets = `{`;
let first = true;
for (const target of Object.keys(filteredList)) {
if (!first) formattedTargets += `,`;
first = false;
formattedTargets += ` ${target}`;
if (support[target]) formattedTargets += ` < ${support[target]}`;
}
formattedTargets += ` }`;
console.log(` ${item} ${formattedTargets}`);
};
exports.logPlugin = logPlugin;
//# sourceMappingURL=debug.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["_helperCompilationTargets","require","compatData","logPlugin","item","targetVersions","list","filteredList","getInclusionReasons","support","startsWith","proposalName","slice","hasOwnProperty","call","console","log","formattedTargets","first","target","Object","keys","exports"],"sources":["../src/debug.ts"],"sourcesContent":["import {\n getInclusionReasons,\n type Targets,\n type Target,\n} from \"@babel/helper-compilation-targets\";\nimport compatData from \"@babel/compat-data/plugins\" with { type: \"json\" };\n\n// Outputs a message that shows which target(s) caused an item to be included:\n// transform-foo { \"edge\":\"13\", \"firefox\":\"49\", \"ie\":\"10\" }\nexport const logPlugin = (\n item: string,\n targetVersions: Targets,\n list: Record<string, Targets>,\n) => {\n const filteredList = getInclusionReasons(item, targetVersions, list);\n\n const support = list[item];\n\n if (!process.env.BABEL_8_BREAKING) {\n // It's needed to keep outputting proposal- in the debug log.\n if (item.startsWith(\"transform-\")) {\n const proposalName = `proposal-${item.slice(10)}`;\n if (\n proposalName === \"proposal-dynamic-import\" ||\n Object.hasOwn(compatData, proposalName)\n ) {\n item = proposalName;\n }\n }\n }\n\n if (!support) {\n console.log(` ${item}`);\n return;\n }\n\n let formattedTargets = `{`;\n let first = true;\n for (const target of Object.keys(filteredList) as Target[]) {\n if (!first) formattedTargets += `,`;\n first = false;\n formattedTargets += ` ${target}`;\n if (support[target]) formattedTargets += ` < ${support[target]}`;\n }\n formattedTargets += ` }`;\n\n console.log(` ${item} ${formattedTargets}`);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AAI2C,MACpCC,UAAU,GAAAD,OAAA,CAAM,4BAA4B;AAI5C,MAAME,SAAS,GAAGA,CACvBC,IAAY,EACZC,cAAuB,EACvBC,IAA6B,KAC1B;EACH,MAAMC,YAAY,GAAG,IAAAC,6CAAmB,EAACJ,IAAI,EAAEC,cAAc,EAAEC,IAAI,CAAC;EAEpE,MAAMG,OAAO,GAAGH,IAAI,CAACF,IAAI,CAAC;EAIxB,IAAIA,IAAI,CAACM,UAAU,CAAC,YAAY,CAAC,EAAE;IACjC,MAAMC,YAAY,GAAG,YAAYP,IAAI,CAACQ,KAAK,CAAC,EAAE,CAAC,EAAE;IACjD,IACED,YAAY,KAAK,yBAAyB,IAC1CE,cAAA,CAAAC,IAAA,CAAcZ,UAAU,EAAES,YAAY,CAAC,EACvC;MACAP,IAAI,GAAGO,YAAY;IACrB;EACF;EAGF,IAAI,CAACF,OAAO,EAAE;IACZM,OAAO,CAACC,GAAG,CAAC,KAAKZ,IAAI,EAAE,CAAC;IACxB;EACF;EAEA,IAAIa,gBAAgB,GAAG,GAAG;EAC1B,IAAIC,KAAK,GAAG,IAAI;EAChB,KAAK,MAAMC,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACd,YAAY,CAAC,EAAc;IAC1D,IAAI,CAACW,KAAK,EAAED,gBAAgB,IAAI,GAAG;IACnCC,KAAK,GAAG,KAAK;IACbD,gBAAgB,IAAI,IAAIE,MAAM,EAAE;IAChC,IAAIV,OAAO,CAACU,MAAM,CAAC,EAAEF,gBAAgB,IAAI,MAAMR,OAAO,CAACU,MAAM,CAAC,EAAE;EAClE;EACAF,gBAAgB,IAAI,IAAI;EAExBF,OAAO,CAACC,GAAG,CAAC,KAAKZ,IAAI,IAAIa,gBAAgB,EAAE,CAAC;AAC9C,CAAC;AAACK,OAAA,CAAAnB,SAAA,GAAAA,SAAA","ignoreList":[]}
+32
View File
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addProposalSyntaxPlugins = addProposalSyntaxPlugins;
exports.removeUnnecessaryItems = removeUnnecessaryItems;
exports.removeUnsupportedItems = removeUnsupportedItems;
var _semver = require("semver");
var _availablePlugins = require("./available-plugins.js");
function addProposalSyntaxPlugins(items, proposalSyntaxPlugins) {
proposalSyntaxPlugins.forEach(plugin => {
items.add(plugin);
});
}
function removeUnnecessaryItems(items, overlapping) {
items.forEach(item => {
var _overlapping$item;
(_overlapping$item = overlapping[item]) == null || _overlapping$item.forEach(name => items.delete(name));
});
}
function removeUnsupportedItems(items, babelVersion) {
items.forEach(item => {
if (hasOwnProperty.call(_availablePlugins.minVersions, item) && _semver.lt(babelVersion, _availablePlugins.minVersions[item])) {
items.delete(item);
} else if (babelVersion.startsWith("8") && _availablePlugins.legacyBabel7SyntaxPlugins.has(item)) {
items.delete(item);
}
});
}
//# sourceMappingURL=filter-items.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["_semver","require","_availablePlugins","addProposalSyntaxPlugins","items","proposalSyntaxPlugins","forEach","plugin","add","removeUnnecessaryItems","overlapping","item","_overlapping$item","name","delete","removeUnsupportedItems","babelVersion","hasOwnProperty","call","minVersions","semver","lt","startsWith","legacyBabel7SyntaxPlugins","has"],"sources":["../src/filter-items.ts"],"sourcesContent":["import semver from \"semver\";\nimport { minVersions, legacyBabel7SyntaxPlugins } from \"./available-plugins.ts\";\n\nexport function addProposalSyntaxPlugins(\n items: Set<string>,\n proposalSyntaxPlugins: readonly string[],\n) {\n proposalSyntaxPlugins.forEach(plugin => {\n items.add(plugin);\n });\n}\nexport function removeUnnecessaryItems(\n items: Set<string>,\n overlapping: Record<string, string[]>,\n) {\n items.forEach(item => {\n overlapping[item]?.forEach(name => items.delete(name));\n });\n}\nexport function removeUnsupportedItems(\n items: Set<string>,\n babelVersion: string,\n) {\n items.forEach(item => {\n if (\n Object.hasOwn(minVersions, item) &&\n semver.lt(\n babelVersion,\n // @ts-expect-error we have checked minVersions[item] in has call\n minVersions[item],\n )\n ) {\n items.delete(item);\n } else if (\n !process.env.BABEL_8_BREAKING &&\n babelVersion.startsWith(\"8\") &&\n legacyBabel7SyntaxPlugins.has(item)\n ) {\n items.delete(item);\n }\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEO,SAASE,wBAAwBA,CACtCC,KAAkB,EAClBC,qBAAwC,EACxC;EACAA,qBAAqB,CAACC,OAAO,CAACC,MAAM,IAAI;IACtCH,KAAK,CAACI,GAAG,CAACD,MAAM,CAAC;EACnB,CAAC,CAAC;AACJ;AACO,SAASE,sBAAsBA,CACpCL,KAAkB,EAClBM,WAAqC,EACrC;EACAN,KAAK,CAACE,OAAO,CAACK,IAAI,IAAI;IAAA,IAAAC,iBAAA;IACpB,CAAAA,iBAAA,GAAAF,WAAW,CAACC,IAAI,CAAC,aAAjBC,iBAAA,CAAmBN,OAAO,CAACO,IAAI,IAAIT,KAAK,CAACU,MAAM,CAACD,IAAI,CAAC,CAAC;EACxD,CAAC,CAAC;AACJ;AACO,SAASE,sBAAsBA,CACpCX,KAAkB,EAClBY,YAAoB,EACpB;EACAZ,KAAK,CAACE,OAAO,CAACK,IAAI,IAAI;IACpB,IACEM,cAAA,CAAAC,IAAA,CAAcC,6BAAW,EAAER,IAAI,CAAC,IAChCS,OAAM,CAACC,EAAE,CACPL,YAAY,EAEZG,6BAAW,CAACR,IAAI,CAClB,CAAC,EACD;MACAP,KAAK,CAACU,MAAM,CAACH,IAAI,CAAC;IACpB,CAAC,MAAM,IAELK,YAAY,CAACM,UAAU,CAAC,GAAG,CAAC,IAC5BC,2CAAyB,CAACC,GAAG,CAACb,IAAI,CAAC,EACnC;MACAP,KAAK,CAACU,MAAM,CAACH,IAAI,CAAC;IACpB;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
+321
View File
@@ -0,0 +1,321 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.isPluginRequired = isPluginRequired;
exports.transformIncludesAndExcludes = void 0;
var _semver = require("semver");
var _debug = require("./debug.js");
var _filterItems = require("./filter-items.js");
var _moduleTransformations = require("./module-transformations.js");
var _normalizeOptions = require("./normalize-options.js");
var _shippedProposals = require("./shipped-proposals.js");
var _pluginsCompatData = require("./plugins-compat-data.js");
var _babelPluginPolyfillCorejs = require("babel-plugin-polyfill-corejs3");
var _babel7Plugins = require("./polyfills/babel-7-plugins.cjs");
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
var _availablePlugins = require("./available-plugins.js");
var _helperPluginUtils = require("@babel/helper-plugin-utils");
const pluginCoreJS3 = _babelPluginPolyfillCorejs.default || _babelPluginPolyfillCorejs;
function isPluginRequired(targets, support) {
return (0, _helperCompilationTargets.isRequired)("fake-name", targets, {
compatData: {
"fake-name": support
}
});
}
function filterStageFromList(list, stageList) {
return Object.keys(list).reduce((result, item) => {
if (!stageList.has(item)) {
result[item] = list[item];
}
return result;
}, {});
}
const pluginsListWithProposals = Object.assign({}, _pluginsCompatData.plugins, _pluginsCompatData.pluginsBugfixes);
const pluginsListWithoutProposals = filterStageFromList(pluginsListWithProposals, _shippedProposals.proposalPlugins);
var pluginsListNoBugfixesWithProposals = _pluginsCompatData.plugins;
var pluginsListNoBugfixesWithoutProposals = filterStageFromList(_pluginsCompatData.plugins, _shippedProposals.proposalPlugins);
const getPlugin = pluginName => {
const plugin = _availablePlugins.default[pluginName]();
if (!plugin) {
throw new Error(`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`);
}
return plugin;
};
const transformIncludesAndExcludes = opts => {
return opts.reduce((result, opt) => {
const target = /^(?:es|es6|es7|esnext|web)\./.test(opt) ? "builtIns" : "plugins";
result[target].add(opt);
return result;
}, {
all: opts,
plugins: new Set(),
builtIns: new Set()
});
};
exports.transformIncludesAndExcludes = transformIncludesAndExcludes;
function getSpecialModulesPluginNames(modules, shouldTransformDynamicImport, babelVersion) {
const modulesPluginNames = [];
if (modules) {
modulesPluginNames.push(_moduleTransformations.default[modules]);
}
if (shouldTransformDynamicImport) {
if (modules && modules !== "umd") {
modulesPluginNames.push("transform-dynamic-import");
} else {
console.warn("Dynamic import can only be transformed when transforming ES" + " modules to AMD, CommonJS or SystemJS.");
}
}
if (!babelVersion.startsWith("8")) {
if (!shouldTransformDynamicImport) {
modulesPluginNames.push("syntax-dynamic-import");
}
modulesPluginNames.push("syntax-top-level-await");
modulesPluginNames.push("syntax-import-meta");
}
return modulesPluginNames;
}
const getCoreJSOptions = ({
useBuiltIns,
corejs,
polyfillTargets,
include,
exclude,
proposals,
shippedProposals,
debug
}) => ({
method: `${useBuiltIns}-global`,
version: corejs ? corejs.toString() : undefined,
targets: polyfillTargets,
include,
exclude,
proposals,
shippedProposals,
debug,
"#__secret_key__@babel/preset-env__compatibility": {
noRuntimeName: true
}
});
var getPolyfillPlugins = ({
useBuiltIns,
corejs,
polyfillTargets,
include,
exclude,
proposals,
shippedProposals,
regenerator,
debug
}) => {
const polyfillPlugins = [];
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
const pluginOptions = getCoreJSOptions({
useBuiltIns,
corejs,
polyfillTargets,
include,
exclude,
proposals,
shippedProposals,
debug
});
if (corejs) {
if (useBuiltIns === "usage") {
if (corejs.major === 2) {
polyfillPlugins.push([_babel7Plugins.pluginCoreJS2, pluginOptions], [_babel7Plugins.legacyBabelPolyfillPlugin, {
usage: true
}]);
} else {
polyfillPlugins.push([pluginCoreJS3, pluginOptions], [_babel7Plugins.legacyBabelPolyfillPlugin, {
usage: true,
deprecated: true
}]);
}
if (regenerator) {
polyfillPlugins.push([_babel7Plugins.pluginRegenerator, {
method: "usage-global",
debug
}]);
}
} else {
if (corejs.major === 2) {
polyfillPlugins.push([_babel7Plugins.legacyBabelPolyfillPlugin, {
regenerator
}], [_babel7Plugins.pluginCoreJS2, pluginOptions]);
} else {
polyfillPlugins.push([pluginCoreJS3, pluginOptions], [_babel7Plugins.legacyBabelPolyfillPlugin, {
deprecated: true
}]);
if (!regenerator) {
polyfillPlugins.push([_babel7Plugins.removeRegeneratorEntryPlugin, pluginOptions]);
}
}
}
}
}
return polyfillPlugins;
};
exports.getPolyfillPlugins = getPolyfillPlugins;
function getLocalTargets(optionsTargets, ignoreBrowserslistConfig, configPath, browserslistEnv, api) {
if (optionsTargets != null && optionsTargets.esmodules && optionsTargets.browsers) {
console.warn(`
@babel/preset-env: esmodules and browsers targets have been specified together.
\`browsers\` target, \`${optionsTargets.browsers.toString()}\` will be ignored.
`);
}
return (0, _helperCompilationTargets.default)(optionsTargets, {
ignoreBrowserslistConfig,
configPath,
browserslistEnv,
onBrowserslistConfigFound(config) {
api.addExternalDependency(config);
}
});
}
function supportsStaticESM(caller) {
return !!(caller != null && caller.supportsStaticESM);
}
function supportsDynamicImport(caller) {
return !!(caller != null && caller.supportsDynamicImport);
}
function supportsExportNamespaceFrom(caller) {
return !!(caller != null && caller.supportsExportNamespaceFrom);
}
var _default = exports.default = (0, _helperPluginUtils.declarePreset)((api, opts) => {
api.assertVersion(7);
const babelTargets = api.targets();
const {
configPath,
debug,
exclude: optionsExclude,
forceAllTransforms,
ignoreBrowserslistConfig,
include: optionsInclude,
modules: optionsModules,
shippedProposals,
targets: optionsTargets,
useBuiltIns,
corejs: {
version: corejs,
proposals
},
browserslistEnv
} = (0, _normalizeOptions.default)(opts);
var {
loose,
spec = false,
bugfixes = false
} = opts;
let targets = babelTargets;
if (_semver.lt(api.version, "7.13.0") || opts.targets || opts.configPath || opts.browserslistEnv || opts.ignoreBrowserslistConfig) {
var hasUglifyTarget = false;
if (optionsTargets != null && optionsTargets.uglify) {
hasUglifyTarget = true;
delete optionsTargets.uglify;
console.warn(`
The uglify target has been deprecated. Set the top level
option \`forceAllTransforms: true\` instead.
`);
}
targets = getLocalTargets(optionsTargets, ignoreBrowserslistConfig, configPath, browserslistEnv, api);
}
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
const include = transformIncludesAndExcludes(optionsInclude);
const exclude = transformIncludesAndExcludes(optionsExclude);
const compatData = bugfixes ? shippedProposals ? pluginsListWithProposals : pluginsListWithoutProposals : shippedProposals ? pluginsListNoBugfixesWithProposals : pluginsListNoBugfixesWithoutProposals;
const modules = optionsModules === "auto" ? api.caller(supportsStaticESM) ? false : "commonjs" : optionsModules;
const shouldTransformDynamicImport = optionsModules === "auto" ? !api.caller(supportsDynamicImport) : !!modules;
if (!exclude.plugins.has("transform-export-namespace-from") && (optionsModules === "auto" ? !api.caller(supportsExportNamespaceFrom) : !!modules)) {
include.plugins.add("transform-export-namespace-from");
}
const pluginNames = (0, _helperCompilationTargets.filterItems)(compatData, include.plugins, exclude.plugins, transformTargets, getSpecialModulesPluginNames(modules, shouldTransformDynamicImport, api.version), !loose ? undefined : ["transform-typeof-symbol"], _shippedProposals.pluginSyntaxMap);
if (shippedProposals) {
(0, _filterItems.addProposalSyntaxPlugins)(pluginNames, _shippedProposals.proposalSyntaxPlugins);
}
(0, _filterItems.removeUnsupportedItems)(pluginNames, api.version);
(0, _filterItems.removeUnnecessaryItems)(pluginNames, _pluginsCompatData.overlappingPlugins);
const polyfillPlugins = getPolyfillPlugins({
useBuiltIns,
corejs,
polyfillTargets: targets,
include: include.builtIns,
exclude: exclude.builtIns,
proposals,
shippedProposals,
regenerator: pluginNames.has("transform-regenerator"),
debug
});
const pluginUseBuiltIns = useBuiltIns !== false;
const plugins = Array.from(pluginNames).map(pluginName => {
if (pluginName === "transform-class-properties" || pluginName === "transform-private-methods" || pluginName === "transform-private-property-in-object") {
return [getPlugin(pluginName), {
loose: loose ? "#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error" : "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"
}];
}
if (pluginName === "syntax-import-attributes") {
return [getPlugin(pluginName), {
deprecatedAssertSyntax: true
}];
}
return [getPlugin(pluginName), {
spec,
loose,
useBuiltIns: pluginUseBuiltIns
}];
}).concat(polyfillPlugins);
if (debug) {
console.log("@babel/preset-env: `DEBUG` option");
console.log("\nUsing targets:");
console.log(JSON.stringify((0, _helperCompilationTargets.prettifyTargets)(targets), null, 2));
console.log(`\nUsing modules transform: ${optionsModules.toString()}`);
console.log("\nUsing plugins:");
pluginNames.forEach(pluginName => {
(0, _debug.logPlugin)(pluginName, targets, compatData);
});
if (!useBuiltIns) {
console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.");
}
}
return {
plugins
};
});
exports.getModulesPluginNames = ({
modules,
transformations,
shouldTransformESM,
shouldTransformDynamicImport,
shouldTransformExportNamespaceFrom
}) => {
const modulesPluginNames = [];
if (modules !== false && transformations[modules]) {
if (shouldTransformESM) {
modulesPluginNames.push(transformations[modules]);
}
if (shouldTransformDynamicImport) {
if (shouldTransformESM && modules !== "umd") {
modulesPluginNames.push("transform-dynamic-import");
} else {
console.warn("Dynamic import can only be transformed when transforming ES" + " modules to AMD, CommonJS or SystemJS.");
}
}
}
if (shouldTransformExportNamespaceFrom) {
modulesPluginNames.push("transform-export-namespace-from");
}
if (!shouldTransformDynamicImport) {
modulesPluginNames.push("syntax-dynamic-import");
}
if (!shouldTransformExportNamespaceFrom) {
modulesPluginNames.push("syntax-export-namespace-from");
}
modulesPluginNames.push("syntax-top-level-await");
modulesPluginNames.push("syntax-import-meta");
return modulesPluginNames;
};
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = exports.default = {
amd: "transform-modules-amd",
commonjs: "transform-modules-commonjs",
cjs: "transform-modules-commonjs",
systemjs: "transform-modules-systemjs",
umd: "transform-modules-umd"
};
//# sourceMappingURL=module-transformations.js.map
@@ -0,0 +1 @@
{"version":3,"names":["amd","commonjs","cjs","systemjs","umd"],"sources":["../src/module-transformations.ts"],"sourcesContent":["type AvailablePlugins = typeof import(\"./available-plugins\").default;\n\nexport default {\n amd: \"transform-modules-amd\",\n commonjs: \"transform-modules-commonjs\",\n cjs: \"transform-modules-commonjs\",\n systemjs: \"transform-modules-systemjs\",\n umd: \"transform-modules-umd\",\n} as Record<string, keyof AvailablePlugins>;\n"],"mappings":";;;;;;iCAEe;EACbA,GAAG,EAAE,uBAAuB;EAC5BC,QAAQ,EAAE,4BAA4B;EACtCC,GAAG,EAAE,4BAA4B;EACjCC,QAAQ,EAAE,4BAA4B;EACtCC,GAAG,EAAE;AACP,CAAC","ignoreList":[]}
+144
View File
@@ -0,0 +1,144 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkDuplicateIncludeExcludes = void 0;
exports.default = normalizeOptions;
exports.normalizeCoreJSOption = normalizeCoreJSOption;
exports.validateUseBuiltInsOption = exports.validateModulesOption = exports.normalizePluginName = void 0;
var _semver = require("semver");
var _pluginsCompatData = require("./plugins-compat-data.js");
var _moduleTransformations = require("./module-transformations.js");
var _options = require("./options.js");
var _helperValidatorOption = require("@babel/helper-validator-option");
var _babel7Plugins = require("./polyfills/babel-7-plugins.cjs");
const corejs3Polyfills = require("core-js-compat/data.json");
const v = new _helperValidatorOption.OptionValidator("@babel/preset-env");
const allPluginsList = [...Object.keys(_pluginsCompatData.plugins), ...Object.keys(_pluginsCompatData.pluginsBugfixes)];
const modulePlugins = ["transform-dynamic-import", ...Object.keys(_moduleTransformations.default).map(m => _moduleTransformations.default[m])];
const getValidIncludesAndExcludes = (type, corejs) => {
const set = new Set(allPluginsList);
if (type === "exclude") modulePlugins.map(set.add, set);
if (corejs) {
if (corejs === 2) {
Object.keys(_babel7Plugins.corejs2Polyfills).map(set.add, set);
set.add("web.timers").add("web.immediate").add("web.dom.iterable");
} else {
Object.keys(corejs3Polyfills).map(set.add, set);
}
}
return Array.from(set);
};
function flatMap(array, fn) {
return Array.prototype.concat.apply([], array.map(fn));
}
const normalizePluginName = plugin => plugin.replace(/^(?:@babel\/|babel-)(?:plugin-)?/, "");
exports.normalizePluginName = normalizePluginName;
const expandIncludesAndExcludes = (filterList = [], type, corejs) => {
if (filterList.length === 0) return [];
const filterableItems = getValidIncludesAndExcludes(type, corejs);
const invalidFilters = [];
const selectedPlugins = flatMap(filterList, filter => {
let re;
if (typeof filter === "string") {
try {
re = new RegExp(`^${normalizePluginName(filter)}$`);
} catch (_) {
invalidFilters.push(filter);
return [];
}
} else {
re = filter;
}
const items = filterableItems.filter(item => {
return re.test(item) || re.test(item.replace(/^transform-/, "proposal-"));
});
if (items.length === 0) invalidFilters.push(filter);
return items;
});
v.invariant(invalidFilters.length === 0, `The plugins/built-ins '${invalidFilters.join(", ")}' passed to the '${type}' option are not
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);
return selectedPlugins;
};
const checkDuplicateIncludeExcludes = (include = [], exclude = []) => {
const duplicates = include.filter(opt => exclude.includes(opt));
v.invariant(duplicates.length === 0, `The plugins/built-ins '${duplicates.join(", ")}' were found in both the "include" and
"exclude" options.`);
};
exports.checkDuplicateIncludeExcludes = checkDuplicateIncludeExcludes;
const normalizeTargets = targets => {
if (typeof targets === "string" || Array.isArray(targets)) {
return {
browsers: targets
};
}
return Object.assign({}, targets);
};
const validateModulesOption = (modulesOpt = _options.ModulesOption.auto) => {
v.invariant(_options.ModulesOption[modulesOpt.toString()] || modulesOpt === _options.ModulesOption.false, `The 'modules' option must be one of \n` + ` - 'false' to indicate no module processing\n` + ` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'` + ` - 'auto' (default) which will automatically select 'false' if the current\n` + ` process is known to support ES module syntax, or "commonjs" otherwise\n`);
return modulesOpt;
};
exports.validateModulesOption = validateModulesOption;
const validateUseBuiltInsOption = (builtInsOpt = false) => {
v.invariant(_options.UseBuiltInsOption[builtInsOpt.toString()] || builtInsOpt === _options.UseBuiltInsOption.false, `The 'useBuiltIns' option must be either
'false' (default) to indicate no polyfill,
'"entry"' to indicate replacing the entry polyfill, or
'"usage"' to import only used polyfills per file`);
return builtInsOpt;
};
exports.validateUseBuiltInsOption = validateUseBuiltInsOption;
function normalizeCoreJSOption(corejs, useBuiltIns) {
let proposals = false;
let rawVersion;
if (useBuiltIns && corejs === undefined) {
rawVersion = 2;
console.warn("\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a " + `core-js version. Currently, we assume version 2.x when no version ` + "is passed. Since this default version will likely change in future " + "versions of Babel, we recommend explicitly setting the core-js version " + "you are using via the `corejs` option.\n" + "\nYou should also be sure that the version you pass to the `corejs` " + "option matches the version specified in your `package.json`'s " + "`dependencies` section. If it doesn't, you need to run one of the " + "following commands:\n\n" + " npm install --save core-js@2 npm install --save core-js@3\n" + " yarn add core-js@2 yarn add core-js@3\n\n" + "More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n" + "More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs");
} else if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
const version = rawVersion ? _semver.coerce(String(rawVersion)) : false;
if (version) {
if (useBuiltIns) {
if (version.major < 2 || version.major > 3) {
throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, " + "only core-js@2 and core-js@3 are supported.");
}
} else {
console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n");
}
}
return {
version,
proposals
};
}
function normalizeOptions(opts) {
v.validateTopLevelOptions(opts, _options.TopLevelOptions);
const useBuiltIns = validateUseBuiltInsOption(opts.useBuiltIns);
const corejs = normalizeCoreJSOption(opts.corejs, useBuiltIns);
const include = expandIncludesAndExcludes(opts.include, _options.TopLevelOptions.include, !!corejs.version && corejs.version.major);
const exclude = expandIncludesAndExcludes(opts.exclude, _options.TopLevelOptions.exclude, !!corejs.version && corejs.version.major);
checkDuplicateIncludeExcludes(include, exclude);
v.validateBooleanOption("loose", opts.loose);
v.validateBooleanOption("spec", opts.spec);
v.validateBooleanOption("bugfixes", opts.bugfixes);
return {
configPath: v.validateStringOption(_options.TopLevelOptions.configPath, opts.configPath, process.cwd()),
corejs,
debug: v.validateBooleanOption(_options.TopLevelOptions.debug, opts.debug, false),
include,
exclude,
forceAllTransforms: v.validateBooleanOption(_options.TopLevelOptions.forceAllTransforms, opts.forceAllTransforms, false),
ignoreBrowserslistConfig: v.validateBooleanOption(_options.TopLevelOptions.ignoreBrowserslistConfig, opts.ignoreBrowserslistConfig, false),
modules: validateModulesOption(opts.modules),
shippedProposals: v.validateBooleanOption(_options.TopLevelOptions.shippedProposals, opts.shippedProposals, false),
targets: normalizeTargets(opts.targets),
useBuiltIns: useBuiltIns,
browserslistEnv: v.validateStringOption(_options.TopLevelOptions.browserslistEnv, opts.browserslistEnv)
};
}
//# sourceMappingURL=normalize-options.js.map
File diff suppressed because one or more lines are too long
+41
View File
@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.UseBuiltInsOption = exports.TopLevelOptions = exports.ModulesOption = void 0;
const TopLevelOptions = exports.TopLevelOptions = {
configPath: "configPath",
corejs: "corejs",
debug: "debug",
exclude: "exclude",
forceAllTransforms: "forceAllTransforms",
ignoreBrowserslistConfig: "ignoreBrowserslistConfig",
include: "include",
modules: "modules",
shippedProposals: "shippedProposals",
targets: "targets",
useBuiltIns: "useBuiltIns",
browserslistEnv: "browserslistEnv"
};
Object.assign(TopLevelOptions, {
bugfixes: "bugfixes",
loose: "loose",
spec: "spec"
});
const ModulesOption = exports.ModulesOption = {
false: false,
auto: "auto",
amd: "amd",
commonjs: "commonjs",
cjs: "cjs",
systemjs: "systemjs",
umd: "umd"
};
const UseBuiltInsOption = exports.UseBuiltInsOption = {
false: false,
entry: "entry",
usage: "usage"
};
//# sourceMappingURL=options.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["TopLevelOptions","exports","configPath","corejs","debug","exclude","forceAllTransforms","ignoreBrowserslistConfig","include","modules","shippedProposals","targets","useBuiltIns","browserslistEnv","Object","assign","bugfixes","loose","spec","ModulesOption","false","auto","amd","commonjs","cjs","systemjs","umd","UseBuiltInsOption","entry","usage"],"sources":["../src/options.ts"],"sourcesContent":["export const TopLevelOptions = {\n configPath: \"configPath\",\n corejs: \"corejs\",\n debug: \"debug\",\n exclude: \"exclude\",\n forceAllTransforms: \"forceAllTransforms\",\n ignoreBrowserslistConfig: \"ignoreBrowserslistConfig\",\n include: \"include\",\n modules: \"modules\",\n shippedProposals: \"shippedProposals\",\n targets: \"targets\",\n useBuiltIns: \"useBuiltIns\",\n browserslistEnv: \"browserslistEnv\",\n} as const;\n\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(TopLevelOptions, {\n bugfixes: \"bugfixes\",\n loose: \"loose\",\n spec: \"spec\",\n });\n}\n\nexport const ModulesOption = {\n false: false,\n auto: \"auto\",\n amd: \"amd\",\n commonjs: \"commonjs\",\n cjs: \"cjs\",\n systemjs: \"systemjs\",\n umd: \"umd\",\n} as const;\n\nexport const UseBuiltInsOption = {\n false: false,\n entry: \"entry\",\n usage: \"usage\",\n} as const;\n"],"mappings":";;;;;;AAAO,MAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,UAAU,EAAE,YAAY;EACxBC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE,SAAS;EAClBC,kBAAkB,EAAE,oBAAoB;EACxCC,wBAAwB,EAAE,0BAA0B;EACpDC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,gBAAgB,EAAE,kBAAkB;EACpCC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,aAAa;EAC1BC,eAAe,EAAE;AACnB,CAAU;AAGRC,MAAM,CAACC,MAAM,CAACf,eAAe,EAAE;EAC7BgB,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;AACR,CAAC,CAAC;AAGG,MAAMC,aAAa,GAAAlB,OAAA,CAAAkB,aAAA,GAAG;EAC3BC,KAAK,EAAE,KAAK;EACZC,IAAI,EAAE,MAAM;EACZC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,UAAU;EACpBC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,UAAU;EACpBC,GAAG,EAAE;AACP,CAAU;AAEH,MAAMC,iBAAiB,GAAA1B,OAAA,CAAA0B,iBAAA,GAAG;EAC/BP,KAAK,EAAE,KAAK;EACZQ,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE;AACT,CAAU","ignoreList":[]}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pluginsBugfixes = exports.plugins = exports.overlappingPlugins = void 0;
var _availablePlugins = require("./available-plugins.js");
const originalPlugins = require("@babel/compat-data/plugins"),
originalPluginsBugfixes = require("@babel/compat-data/plugin-bugfixes"),
originalOverlappingPlugins = require("@babel/compat-data/overlapping-plugins");
const keys = Object.keys;
const plugins = exports.plugins = filterAvailable(originalPlugins);
const pluginsBugfixes = exports.pluginsBugfixes = filterAvailable(originalPluginsBugfixes);
const overlappingPlugins = exports.overlappingPlugins = filterAvailable(originalOverlappingPlugins);
overlappingPlugins["syntax-import-attributes"] = ["syntax-import-assertions"];
function filterAvailable(data) {
const result = {};
for (const plugin of keys(data)) {
if (hasOwnProperty.call(_availablePlugins.default, plugin)) {
result[plugin] = data[plugin];
}
}
return result;
}
//# sourceMappingURL=plugins-compat-data.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_availablePlugins","require","originalPlugins","originalPluginsBugfixes","originalOverlappingPlugins","keys","Object","plugins","exports","filterAvailable","pluginsBugfixes","overlappingPlugins","data","result","plugin","hasOwnProperty","call","availablePlugins"],"sources":["../src/plugins-compat-data.ts"],"sourcesContent":["import originalPlugins from \"@babel/compat-data/plugins\" with { type: \"json\" };\nimport originalPluginsBugfixes from \"@babel/compat-data/plugin-bugfixes\" with { type: \"json\" };\nimport originalOverlappingPlugins from \"@babel/compat-data/overlapping-plugins\" with { type: \"json\" };\nimport availablePlugins from \"./available-plugins.ts\";\n\nconst keys: <O extends object>(o: O) => (keyof O)[] = Object.keys;\n\nexport const plugins = filterAvailable(originalPlugins);\nexport const pluginsBugfixes = filterAvailable(originalPluginsBugfixes);\nexport const overlappingPlugins = filterAvailable(originalOverlappingPlugins);\n\nif (!process.env.BABEL_8_BREAKING) {\n // @ts-expect-error: we extend this here, since it's a syntax plugin and thus\n // doesn't make sense to store it in a compat-data package.\n overlappingPlugins[\"syntax-import-attributes\"] = [\"syntax-import-assertions\"];\n}\n\nfunction filterAvailable<Data extends Record<string, unknown>>(\n data: Data,\n): { [Name in keyof Data & keyof typeof availablePlugins]: Data[Name] } {\n const result = {} as any;\n for (const plugin of keys(data)) {\n if (Object.hasOwn(availablePlugins, plugin)) {\n result[plugin] = data[plugin];\n }\n }\n return result;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,iBAAA,GAAAC,OAAA;AAAsD,MAH/CC,eAAe,GAAAD,OAAA,CAAM,4BAA4B;EACjDE,uBAAuB,GAAAF,OAAA,CAAM,oCAAoC;EACjEG,0BAA0B,GAAAH,OAAA,CAAM,wCAAwC;AAG/E,MAAMI,IAA6C,GAAGC,MAAM,CAACD,IAAI;AAE1D,MAAME,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAGE,eAAe,CAACP,eAAe,CAAC;AAChD,MAAMQ,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAGD,eAAe,CAACN,uBAAuB,CAAC;AAChE,MAAMQ,kBAAkB,GAAAH,OAAA,CAAAG,kBAAA,GAAGF,eAAe,CAACL,0BAA0B,CAAC;AAK3EO,kBAAkB,CAAC,0BAA0B,CAAC,GAAG,CAAC,0BAA0B,CAAC;AAG/E,SAASF,eAAeA,CACtBG,IAAU,EAC4D;EACtE,MAAMC,MAAM,GAAG,CAAC,CAAQ;EACxB,KAAK,MAAMC,MAAM,IAAIT,IAAI,CAACO,IAAI,CAAC,EAAE;IAC/B,IAAIG,cAAA,CAAAC,IAAA,CAAcC,yBAAgB,EAAEH,MAAM,CAAC,EAAE;MAC3CD,MAAM,CAACC,MAAM,CAAC,GAAGF,IAAI,CAACE,MAAM,CAAC;IAC/B;EACF;EACA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,19 @@
Object.defineProperties(exports, {
pluginCoreJS2: {
get: () => require("babel-plugin-polyfill-corejs2").default
},
pluginRegenerator: {
get: () => require("babel-plugin-polyfill-regenerator").default
},
legacyBabelPolyfillPlugin: {
get: () => require("./babel-polyfill.cjs")
},
removeRegeneratorEntryPlugin: {
get: () => require("./regenerator.cjs")
},
corejs2Polyfills: {
get: () => require("@babel/compat-data/corejs2-built-ins")
}
});
//# sourceMappingURL=babel-7-plugins.cjs.map
@@ -0,0 +1 @@
{"version":3,"names":["Object","defineProperties","exports","pluginCoreJS2","get","require","default","pluginRegenerator","legacyBabelPolyfillPlugin","removeRegeneratorEntryPlugin","corejs2Polyfills"],"sources":["../../src/polyfills/babel-7-plugins.cjs"],"sourcesContent":["// TODO(Babel 8): Remove this file\n\nif (!process.env.BABEL_8_BREAKING) {\n Object.defineProperties(exports, {\n pluginCoreJS2: {\n get: () => require(\"babel-plugin-polyfill-corejs2\").default,\n },\n pluginRegenerator: {\n get: () => require(\"babel-plugin-polyfill-regenerator\").default,\n },\n legacyBabelPolyfillPlugin: { get: () => require(\"./babel-polyfill.cjs\") },\n removeRegeneratorEntryPlugin: { get: () => require(\"./regenerator.cjs\") },\n corejs2Polyfills: {\n get: () => require(\"@babel/compat-data/corejs2-built-ins\"),\n },\n });\n}\n"],"mappings":"AAGEA,MAAM,CAACC,gBAAgB,CAACC,OAAO,EAAE;EAC/BC,aAAa,EAAE;IACbC,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,+BAA+B,CAAC,CAACC;EACtD,CAAC;EACDC,iBAAiB,EAAE;IACjBH,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,mCAAmC,CAAC,CAACC;EAC1D,CAAC;EACDE,yBAAyB,EAAE;IAAEJ,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,sBAAsB;EAAE,CAAC;EACzEI,4BAA4B,EAAE;IAAEL,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,mBAAmB;EAAE,CAAC;EACzEK,gBAAgB,EAAE;IAChBN,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,sCAAsC;EAC3D;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,68 @@
const {
getImportSource,
getRequireSource,
isPolyfillSource
} = require("./utils.cjs");
const BABEL_POLYFILL_DEPRECATION = `
\`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`
and \`regenerator-runtime/runtime\` separately`;
const NO_DIRECT_POLYFILL_IMPORT = `
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;
module.exports = function ({
template
}, {
regenerator,
deprecated,
usage
}) {
return {
name: "preset-env/replace-babel-polyfill",
visitor: {
ImportDeclaration(path) {
const src = getImportSource(path);
if (usage && isPolyfillSource(src)) {
console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));
if (!deprecated) path.remove();
} else if (src === "@babel/polyfill") {
if (deprecated) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else if (regenerator) {
path.replaceWithMultiple(template.ast`
import "core-js";
import "regenerator-runtime/runtime.js";
`);
} else {
path.replaceWith(template.ast`
import "core-js";
`);
}
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
const src = getRequireSource(bodyPath);
if (usage && isPolyfillSource(src)) {
console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));
if (!deprecated) bodyPath.remove();
} else if (src === "@babel/polyfill") {
if (deprecated) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else if (regenerator) {
bodyPath.replaceWithMultiple(template.ast`
require("core-js");
require("regenerator-runtime/runtime.js");
`);
} else {
bodyPath.replaceWith(template.ast`
require("core-js");
`);
}
}
});
}
}
};
};
//# sourceMappingURL=babel-polyfill.cjs.map
@@ -0,0 +1 @@
{"version":3,"names":["getImportSource","getRequireSource","isPolyfillSource","require","BABEL_POLYFILL_DEPRECATION","NO_DIRECT_POLYFILL_IMPORT","module","exports","template","regenerator","deprecated","usage","name","visitor","ImportDeclaration","path","src","console","warn","replace","remove","replaceWithMultiple","ast","replaceWith","Program","get","forEach","bodyPath"],"sources":["../../src/polyfills/babel-polyfill.cjs"],"sourcesContent":["// TODO(Babel 8) Remove this file\nif (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n\nconst {\n getImportSource,\n getRequireSource,\n isPolyfillSource,\n} = require(\"./utils.cjs\");\n\nconst BABEL_POLYFILL_DEPRECATION = `\n \\`@babel/polyfill\\` is deprecated. Please, use required parts of \\`core-js\\`\n and \\`regenerator-runtime/runtime\\` separately`;\n\nconst NO_DIRECT_POLYFILL_IMPORT = `\n When setting \\`useBuiltIns: 'usage'\\`, polyfills are automatically imported when needed.\n Please remove the direct import of \\`SPECIFIER\\` or use \\`useBuiltIns: 'entry'\\` instead.`;\n\nmodule.exports = function ({ template }, { regenerator, deprecated, usage }) {\n return {\n name: \"preset-env/replace-babel-polyfill\",\n visitor: {\n ImportDeclaration(path) {\n const src = getImportSource(path);\n if (usage && isPolyfillSource(src)) {\n console.warn(NO_DIRECT_POLYFILL_IMPORT.replace(\"SPECIFIER\", src));\n if (!deprecated) path.remove();\n } else if (src === \"@babel/polyfill\") {\n if (deprecated) {\n console.warn(BABEL_POLYFILL_DEPRECATION);\n } else if (regenerator) {\n path.replaceWithMultiple(template.ast`\n import \"core-js\";\n import \"regenerator-runtime/runtime.js\";\n `);\n } else {\n path.replaceWith(template.ast`\n import \"core-js\";\n `);\n }\n }\n },\n Program(path) {\n path.get(\"body\").forEach(bodyPath => {\n const src = getRequireSource(bodyPath);\n if (usage && isPolyfillSource(src)) {\n console.warn(NO_DIRECT_POLYFILL_IMPORT.replace(\"SPECIFIER\", src));\n if (!deprecated) bodyPath.remove();\n } else if (src === \"@babel/polyfill\") {\n if (deprecated) {\n console.warn(BABEL_POLYFILL_DEPRECATION);\n } else if (regenerator) {\n bodyPath.replaceWithMultiple(template.ast`\n require(\"core-js\");\n require(\"regenerator-runtime/runtime.js\");\n `);\n } else {\n bodyPath.replaceWith(template.ast`\n require(\"core-js\");\n `);\n }\n }\n });\n },\n },\n };\n};\n"],"mappings":"AAOA,MAAM;EACJA,eAAe;EACfC,gBAAgB;EAChBC;AACF,CAAC,GAAGC,OAAO,CAAC,aAAa,CAAC;AAE1B,MAAMC,0BAA0B,GAAG;AACnC;AACA,iDAAiD;AAEjD,MAAMC,yBAAyB,GAAG;AAClC;AACA,4FAA4F;AAE5FC,MAAM,CAACC,OAAO,GAAG,UAAU;EAAEC;AAAS,CAAC,EAAE;EAAEC,WAAW;EAAEC,UAAU;EAAEC;AAAM,CAAC,EAAE;EAC3E,OAAO;IACLC,IAAI,EAAE,mCAAmC;IACzCC,OAAO,EAAE;MACPC,iBAAiBA,CAACC,IAAI,EAAE;QACtB,MAAMC,GAAG,GAAGhB,eAAe,CAACe,IAAI,CAAC;QACjC,IAAIJ,KAAK,IAAIT,gBAAgB,CAACc,GAAG,CAAC,EAAE;UAClCC,OAAO,CAACC,IAAI,CAACb,yBAAyB,CAACc,OAAO,CAAC,WAAW,EAAEH,GAAG,CAAC,CAAC;UACjE,IAAI,CAACN,UAAU,EAAEK,IAAI,CAACK,MAAM,CAAC,CAAC;QAChC,CAAC,MAAM,IAAIJ,GAAG,KAAK,iBAAiB,EAAE;UACpC,IAAIN,UAAU,EAAE;YACdO,OAAO,CAACC,IAAI,CAACd,0BAA0B,CAAC;UAC1C,CAAC,MAAM,IAAIK,WAAW,EAAE;YACtBM,IAAI,CAACM,mBAAmB,CAACb,QAAQ,CAACc,GAAG;AACjD;AACA;AACA,aAAa,CAAC;UACJ,CAAC,MAAM;YACLP,IAAI,CAACQ,WAAW,CAACf,QAAQ,CAACc,GAAG;AACzC;AACA,aAAa,CAAC;UACJ;QACF;MACF,CAAC;MACDE,OAAOA,CAACT,IAAI,EAAE;QACZA,IAAI,CAACU,GAAG,CAAC,MAAM,CAAC,CAACC,OAAO,CAACC,QAAQ,IAAI;UACnC,MAAMX,GAAG,GAAGf,gBAAgB,CAAC0B,QAAQ,CAAC;UACtC,IAAIhB,KAAK,IAAIT,gBAAgB,CAACc,GAAG,CAAC,EAAE;YAClCC,OAAO,CAACC,IAAI,CAACb,yBAAyB,CAACc,OAAO,CAAC,WAAW,EAAEH,GAAG,CAAC,CAAC;YACjE,IAAI,CAACN,UAAU,EAAEiB,QAAQ,CAACP,MAAM,CAAC,CAAC;UACpC,CAAC,MAAM,IAAIJ,GAAG,KAAK,iBAAiB,EAAE;YACpC,IAAIN,UAAU,EAAE;cACdO,OAAO,CAACC,IAAI,CAACd,0BAA0B,CAAC;YAC1C,CAAC,MAAM,IAAIK,WAAW,EAAE;cACtBkB,QAAQ,CAACN,mBAAmB,CAACb,QAAQ,CAACc,GAAG;AACvD;AACA;AACA,eAAe,CAAC;YACJ,CAAC,MAAM;cACLK,QAAQ,CAACJ,WAAW,CAACf,QAAQ,CAACc,GAAG;AAC/C;AACA,eAAe,CAAC;YACJ;UACF;QACF,CAAC,CAAC;MACJ;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
+43
View File
@@ -0,0 +1,43 @@
const {
getImportSource,
getRequireSource
} = require("./utils.cjs");
function isRegeneratorSource(source) {
return source === "regenerator-runtime/runtime" || source === "regenerator-runtime/runtime.js";
}
module.exports = function () {
const visitor = {
ImportDeclaration(path) {
if (isRegeneratorSource(getImportSource(path))) {
this.regeneratorImportExcluded = true;
path.remove();
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
if (isRegeneratorSource(getRequireSource(bodyPath))) {
this.regeneratorImportExcluded = true;
bodyPath.remove();
}
});
}
};
return {
name: "preset-env/remove-regenerator",
visitor,
pre() {
this.regeneratorImportExcluded = false;
},
post() {
if (this.opts.debug && this.regeneratorImportExcluded) {
let filename = this.file.opts.filename;
if (process.env.BABEL_ENV === "test") {
filename = filename.replace(/\\/g, "/");
}
console.log(`\n[${filename}] Based on your targets, regenerator-runtime import excluded.`);
}
}
};
};
//# sourceMappingURL=regenerator.cjs.map
@@ -0,0 +1 @@
{"version":3,"names":["getImportSource","getRequireSource","require","isRegeneratorSource","source","module","exports","visitor","ImportDeclaration","path","regeneratorImportExcluded","remove","Program","get","forEach","bodyPath","name","pre","post","opts","debug","filename","file","process","env","BABEL_ENV","replace","console","log"],"sources":["../../src/polyfills/regenerator.cjs"],"sourcesContent":["// TODO(Babel 8) Remove this file\nif (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n\nconst { getImportSource, getRequireSource } = require(\"./utils.cjs\");\n\nfunction isRegeneratorSource(source) {\n return (\n source === \"regenerator-runtime/runtime\" ||\n source === \"regenerator-runtime/runtime.js\"\n );\n}\n\nmodule.exports = function () {\n const visitor = {\n ImportDeclaration(path) {\n if (isRegeneratorSource(getImportSource(path))) {\n this.regeneratorImportExcluded = true;\n path.remove();\n }\n },\n Program(path) {\n path.get(\"body\").forEach(bodyPath => {\n if (isRegeneratorSource(getRequireSource(bodyPath))) {\n this.regeneratorImportExcluded = true;\n bodyPath.remove();\n }\n });\n },\n };\n\n return {\n name: \"preset-env/remove-regenerator\",\n visitor,\n pre() {\n this.regeneratorImportExcluded = false;\n },\n post() {\n if (this.opts.debug && this.regeneratorImportExcluded) {\n let filename = this.file.opts.filename;\n // normalize filename to generate consistent preset-env test fixtures\n if (process.env.BABEL_ENV === \"test\") {\n filename = filename.replace(/\\\\/g, \"/\");\n }\n console.log(\n `\\n[${filename}] Based on your targets, regenerator-runtime import excluded.`,\n );\n }\n },\n };\n};\n"],"mappings":"AAOA,MAAM;EAAEA,eAAe;EAAEC;AAAiB,CAAC,GAAGC,OAAO,CAAC,aAAa,CAAC;AAEpE,SAASC,mBAAmBA,CAACC,MAAM,EAAE;EACnC,OACEA,MAAM,KAAK,6BAA6B,IACxCA,MAAM,KAAK,gCAAgC;AAE/C;AAEAC,MAAM,CAACC,OAAO,GAAG,YAAY;EAC3B,MAAMC,OAAO,GAAG;IACdC,iBAAiBA,CAACC,IAAI,EAAE;MACtB,IAAIN,mBAAmB,CAACH,eAAe,CAACS,IAAI,CAAC,CAAC,EAAE;QAC9C,IAAI,CAACC,yBAAyB,GAAG,IAAI;QACrCD,IAAI,CAACE,MAAM,CAAC,CAAC;MACf;IACF,CAAC;IACDC,OAAOA,CAACH,IAAI,EAAE;MACZA,IAAI,CAACI,GAAG,CAAC,MAAM,CAAC,CAACC,OAAO,CAACC,QAAQ,IAAI;QACnC,IAAIZ,mBAAmB,CAACF,gBAAgB,CAACc,QAAQ,CAAC,CAAC,EAAE;UACnD,IAAI,CAACL,yBAAyB,GAAG,IAAI;UACrCK,QAAQ,CAACJ,MAAM,CAAC,CAAC;QACnB;MACF,CAAC,CAAC;IACJ;EACF,CAAC;EAED,OAAO;IACLK,IAAI,EAAE,+BAA+B;IACrCT,OAAO;IACPU,GAAGA,CAAA,EAAG;MACJ,IAAI,CAACP,yBAAyB,GAAG,KAAK;IACxC,CAAC;IACDQ,IAAIA,CAAA,EAAG;MACL,IAAI,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,IAAI,CAACV,yBAAyB,EAAE;QACrD,IAAIW,QAAQ,GAAG,IAAI,CAACC,IAAI,CAACH,IAAI,CAACE,QAAQ;QAEtC,IAAIE,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,MAAM,EAAE;UACpCJ,QAAQ,GAAGA,QAAQ,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACzC;QACAC,OAAO,CAACC,GAAG,CACT,MAAMP,QAAQ,+DAChB,CAAC;MACH;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
+21
View File
@@ -0,0 +1,21 @@
exports.getImportSource = function ({
node
}) {
if (node.specifiers.length === 0) return node.source.value;
};
exports.getRequireSource = function ({
node
}) {
if (node.type !== "ExpressionStatement") return;
const {
expression
} = node;
if (expression.type === "CallExpression" && expression.callee.type === "Identifier" && expression.callee.name === "require" && expression.arguments.length === 1 && expression.arguments[0].type === "StringLiteral") {
return expression.arguments[0].value;
}
};
exports.isPolyfillSource = function (source) {
return source === "@babel/polyfill" || source === "core-js";
};
//# sourceMappingURL=utils.cjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["exports","getImportSource","node","specifiers","length","source","value","getRequireSource","type","expression","callee","name","arguments","isPolyfillSource"],"sources":["../../src/polyfills/utils.cjs"],"sourcesContent":["// TODO(Babel 8) Remove this file\nif (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n\nexports.getImportSource = function ({ node }) {\n if (node.specifiers.length === 0) return node.source.value;\n};\n\nexports.getRequireSource = function ({ node }) {\n if (node.type !== \"ExpressionStatement\") return;\n const { expression } = node;\n if (\n expression.type === \"CallExpression\" &&\n expression.callee.type === \"Identifier\" &&\n expression.callee.name === \"require\" &&\n expression.arguments.length === 1 &&\n expression.arguments[0].type === \"StringLiteral\"\n ) {\n return expression.arguments[0].value;\n }\n};\n\nexports.isPolyfillSource = function (source) {\n return source === \"@babel/polyfill\" || source === \"core-js\";\n};\n"],"mappings":"AAOAA,OAAO,CAACC,eAAe,GAAG,UAAU;EAAEC;AAAK,CAAC,EAAE;EAC5C,IAAIA,IAAI,CAACC,UAAU,CAACC,MAAM,KAAK,CAAC,EAAE,OAAOF,IAAI,CAACG,MAAM,CAACC,KAAK;AAC5D,CAAC;AAEDN,OAAO,CAACO,gBAAgB,GAAG,UAAU;EAAEL;AAAK,CAAC,EAAE;EAC7C,IAAIA,IAAI,CAACM,IAAI,KAAK,qBAAqB,EAAE;EACzC,MAAM;IAAEC;EAAW,CAAC,GAAGP,IAAI;EAC3B,IACEO,UAAU,CAACD,IAAI,KAAK,gBAAgB,IACpCC,UAAU,CAACC,MAAM,CAACF,IAAI,KAAK,YAAY,IACvCC,UAAU,CAACC,MAAM,CAACC,IAAI,KAAK,SAAS,IACpCF,UAAU,CAACG,SAAS,CAACR,MAAM,KAAK,CAAC,IACjCK,UAAU,CAACG,SAAS,CAAC,CAAC,CAAC,CAACJ,IAAI,KAAK,eAAe,EAChD;IACA,OAAOC,UAAU,CAACG,SAAS,CAAC,CAAC,CAAC,CAACN,KAAK;EACtC;AACF,CAAC;AAEDN,OAAO,CAACa,gBAAgB,GAAG,UAAUR,MAAM,EAAE;EAC3C,OAAOA,MAAM,KAAK,iBAAiB,IAAIA,MAAM,KAAK,SAAS;AAC7D,CAAC","ignoreList":[]}
+29
View File
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.proposalSyntaxPlugins = exports.proposalPlugins = exports.pluginSyntaxMap = void 0;
const proposalPlugins = exports.proposalPlugins = new Set([]);
const proposalSyntaxPlugins = exports.proposalSyntaxPlugins = ["syntax-import-assertions", "syntax-import-attributes"];
const pluginSyntaxObject = {
"transform-async-generator-functions": "syntax-async-generators",
"transform-class-properties": "syntax-class-properties",
"transform-class-static-block": "syntax-class-static-block",
"transform-export-namespace-from": "syntax-export-namespace-from",
"transform-json-strings": "syntax-json-strings",
"transform-nullish-coalescing-operator": "syntax-nullish-coalescing-operator",
"transform-numeric-separator": "syntax-numeric-separator",
"transform-object-rest-spread": "syntax-object-rest-spread",
"transform-optional-catch-binding": "syntax-optional-catch-binding",
"transform-optional-chaining": "syntax-optional-chaining",
"transform-private-methods": "syntax-class-properties",
"transform-private-property-in-object": "syntax-private-property-in-object",
"transform-unicode-property-regex": null
};
const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map(function (key) {
return [key, pluginSyntaxObject[key]];
});
const pluginSyntaxMap = exports.pluginSyntaxMap = new Map(pluginSyntaxEntries);
//# sourceMappingURL=shipped-proposals.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["proposalPlugins","exports","Set","proposalSyntaxPlugins","pluginSyntaxObject","pluginSyntaxEntries","Object","keys","map","key","pluginSyntaxMap","Map"],"sources":["../src/shipped-proposals.ts"],"sourcesContent":["// TODO(Babel 8): Remove this file\n/* eslint sort-keys: \"error\" */\n// These mappings represent the transform plugins that have been\n// shipped by browsers, and are enabled by the `shippedProposals` option.\n\nconst proposalPlugins = new Set<string>([]);\n\n// proposal syntax plugins enabled by the `shippedProposals` option.\n// Unlike proposalPlugins above, they are independent of compiler targets.\nconst proposalSyntaxPlugins = process.env.BABEL_8_BREAKING\n ? ([] as const)\n : ([\"syntax-import-assertions\", \"syntax-import-attributes\"] as const);\n\n// use intermediary object to enforce alphabetical key order\nconst pluginSyntaxObject = process.env.BABEL_8_BREAKING\n ? {}\n : ({\n \"transform-async-generator-functions\": \"syntax-async-generators\",\n \"transform-class-properties\": \"syntax-class-properties\",\n \"transform-class-static-block\": \"syntax-class-static-block\",\n \"transform-export-namespace-from\": \"syntax-export-namespace-from\",\n \"transform-json-strings\": \"syntax-json-strings\",\n \"transform-nullish-coalescing-operator\":\n \"syntax-nullish-coalescing-operator\",\n \"transform-numeric-separator\": \"syntax-numeric-separator\",\n \"transform-object-rest-spread\": \"syntax-object-rest-spread\",\n \"transform-optional-catch-binding\": \"syntax-optional-catch-binding\",\n \"transform-optional-chaining\": \"syntax-optional-chaining\",\n // note: we don't have syntax-private-methods\n \"transform-private-methods\": \"syntax-class-properties\",\n \"transform-private-property-in-object\":\n \"syntax-private-property-in-object\",\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n \"transform-unicode-property-regex\": null as null,\n } as const);\n\ntype PluginSyntaxObjectKeys = keyof typeof pluginSyntaxObject;\n\nconst pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map<\n [PluginSyntaxObjectKeys, string | null]\n>(function (key: PluginSyntaxObjectKeys) {\n return [key, pluginSyntaxObject[key]];\n});\n\nconst pluginSyntaxMap = new Map(pluginSyntaxEntries);\n\nexport { proposalPlugins, proposalSyntaxPlugins, pluginSyntaxMap };\n"],"mappings":";;;;;;AAKA,MAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAIE,GAAG,CAAS,EAAE,CAAC;AAI3C,MAAMC,qBAAqB,GAAAF,OAAA,CAAAE,qBAAA,GAEtB,CAAC,0BAA0B,EAAE,0BAA0B,CAAW;AAGvE,MAAMC,kBAAkB,GAEnB;EACC,qCAAqC,EAAE,yBAAyB;EAChE,4BAA4B,EAAE,yBAAyB;EACvD,8BAA8B,EAAE,2BAA2B;EAC3D,iCAAiC,EAAE,8BAA8B;EACjE,wBAAwB,EAAE,qBAAqB;EAC/C,uCAAuC,EACrC,oCAAoC;EACtC,6BAA6B,EAAE,0BAA0B;EACzD,8BAA8B,EAAE,2BAA2B;EAC3D,kCAAkC,EAAE,+BAA+B;EACnE,6BAA6B,EAAE,0BAA0B;EAEzD,2BAA2B,EAAE,yBAAyB;EACtD,sCAAsC,EACpC,mCAAmC;EAErC,kCAAkC,EAAE;AACtC,CAAW;AAIf,MAAMC,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CAACH,kBAAkB,CAAC,CAACI,GAAG,CAE7D,UAAUC,GAA2B,EAAE;EACvC,OAAO,CAACA,GAAG,EAAEL,kBAAkB,CAACK,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAAT,OAAA,CAAAS,eAAA,GAAG,IAAIC,GAAG,CAACN,mBAAmB,CAAC","ignoreList":[]}
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _helperCompilationTargets.default;
}
});
Object.defineProperty(exports, "isBrowsersQueryValid", {
enumerable: true,
get: function () {
return _helperCompilationTargets.isBrowsersQueryValid;
}
});
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
//# sourceMappingURL=targets-parser.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"names":["_helperCompilationTargets","require"],"sources":["../src/targets-parser.ts"],"sourcesContent":["// TODO: Remove in Babel 8\n\nexport {\n default,\n isBrowsersQueryValid,\n} from \"@babel/helper-compilation-targets\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Nicolò Ribaudo and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,78 @@
# babel-plugin-polyfill-corejs3
## Install
Using npm:
```sh
npm install --save-dev babel-plugin-polyfill-corejs3
```
or using yarn:
```sh
yarn add babel-plugin-polyfill-corejs3 --dev
```
## Usage
Add this plugin to your Babel configuration:
```json
{
"plugins": [["polyfill-corejs3", { "method": "usage-global", "version": "3.48" }]]
}
```
This package supports the `usage-pure`, `usage-global`, and `entry-global` methods.
When `entry-global` is used, it replaces imports to `core-js`.
## Options
See [here](../../docs/usage.md#options) for a list of options supported by every polyfill provider.
### `version`
`string`, defaults to `"3.0"`.
This option only has an effect when used alongside `"method": "usage-global"` or `"method": "usage-pure"`. It is recommended to specify the minor version you are using as `core-js@3.0` may not include polyfills for the latest features. If you are bundling an app, you can provide the version directly from your node modules:
```js
{
plugins: [
["polyfill-corejs3", {
"method": "usage-pure",
// use `core-js/package.json` if you are using `usage-global`
"version": require("core-js-pure/package.json").version
}]
]
}
```
If you are a library author, specify a reasonably modern `core-js` version in your
`package.json` and provide the plugin the minimal supported version.
```json
{
"dependencies": {
"core-js": "^3.48.0"
}
}
```
```js
{
plugins: [
["polyfill-corejs3", {
"method": "usage-global",
// improvise if you have more complicated version spec, e.g. > 3.1.4
"version": require("./package.json").dependencies["core-js"]
}]
]
}
```
### `proposals`
`boolean`, defaults to `false`.
This option only has an effect when used alongside `"method": "usage-global"` or `"method": "usage-pure"`. When `proposals` are `true`, any ES proposal supported by core-js will be polyfilled as well.
@@ -0,0 +1,4 @@
`core-js-compat` exposes some files as JSON, and they cannot be
imported by Node.js ESM files.
This folder proxies `core-js-compat` to ensure that every entry
is CJS and can be safely imported.
@@ -0,0 +1 @@
module.exports = require("core-js-compat/data");
@@ -0,0 +1 @@
module.exports = require("core-js-compat/entries");
@@ -0,0 +1 @@
module.exports = require("core-js-compat/get-modules-list-for-target-version");
@@ -0,0 +1,855 @@
import corejs3Polyfills from '../core-js-compat/data.js';
import getModulesListForTargetVersion from '../core-js-compat/get-modules-list-for-target-version.js';
import * as _babel from '@babel/core';
import corejsEntries from '../core-js-compat/entries.js';
import defineProvider from '@babel/helper-define-polyfill-provider';
// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
var corejs3ShippedProposalsList = new Set(["esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.zip", "esnext.iterator.zip-keyed", "esnext.symbol.metadata"]);
const polyfillsOrder = {};
Object.keys(corejs3Polyfills).forEach((name, index) => {
polyfillsOrder[name] = index;
});
const define = (pure, global, name = global[0], exclude) => {
return {
name,
pure,
global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
exclude
};
};
const typed = (...modules) => define(null, [...modules, ...TypedArrayDependencies]);
const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
const CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
const SuppressedErrorDependencies = ["es.suppressed-error.constructor", ...ErrorDependencies];
const ArrayBufferDependencies = ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by", ...ArrayBufferDependencies];
const PromiseDependencies = ["es.promise", "es.object.to-string"];
const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
const MapDependencies = ["es.map", "es.map.get-or-insert", "es.map.get-or-insert-computed", "esnext.map.delete-all", "esnext.map.emplace", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
const SetDependencies = ["es.set", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
const WeakMapDependencies = ["es.weak-map", "es.weak-map.get-or-insert", "es.weak-map.get-or-insert-computed", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
const AsyncIteratorProblemMethods = ["esnext.async-iterator.every", "esnext.async-iterator.filter", "esnext.async-iterator.find", "esnext.async-iterator.flat-map", "esnext.async-iterator.for-each", "esnext.async-iterator.map", "esnext.async-iterator.reduce", "esnext.async-iterator.some"];
const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];
const DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
const TypedArrayStaticMethods = base => ({
from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
});
const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
const BuiltIns = {
AsyncDisposableStack: define("async-disposable-stack/index", ["es.async-disposable-stack.constructor", "es.object.to-string", "es.async-iterator.async-dispose", "es.iterator.dispose", ...PromiseDependencies, ...SuppressedErrorDependencies]),
AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
ArrayBuffer: define(null, ArrayBufferDependencies),
DataView: define(null, DataViewDependencies),
Date: define(null, ["es.date.to-string"]),
DOMException: define("dom-exception/index", DOMExceptionDependencies),
DisposableStack: define("disposable-stack/index", ["es.disposable-stack.constructor", "es.object.to-string", "es.iterator.dispose", ...SuppressedErrorDependencies]),
Error: define(null, ErrorDependencies),
EvalError: define(null, ErrorDependencies),
Float32Array: typed("es.typed-array.float32-array"),
Float64Array: typed("es.typed-array.float64-array"),
Int8Array: typed("es.typed-array.int8-array"),
Int16Array: typed("es.typed-array.int16-array"),
Int32Array: typed("es.typed-array.int32-array"),
Iterator: define("iterator/index", IteratorDependencies),
Uint8Array: typed("es.typed-array.uint8-array", "es.uint8-array.set-from-base64", "es.uint8-array.set-from-hex", "es.uint8-array.to-base64", "es.uint8-array.to-hex"),
Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
Uint16Array: typed("es.typed-array.uint16-array"),
Uint32Array: typed("es.typed-array.uint32-array"),
Map: define("map/index", MapDependencies),
Number: define(null, ["es.number.constructor"]),
Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
Promise: define("promise/index", PromiseDependencies),
RangeError: define(null, ErrorDependencies),
ReferenceError: define(null, ErrorDependencies),
Reflect: define(null, ["es.reflect.to-string-tag", "es.object.to-string"]),
RegExp: define(null, ["es.regexp.constructor", "es.regexp.dot-all", "es.regexp.exec", "es.regexp.sticky", "es.regexp.to-string"]),
Set: define("set/index", SetDependencies),
SuppressedError: define("suppressed-error", SuppressedErrorDependencies),
Symbol: define("symbol/index", SymbolDependencies),
SyntaxError: define(null, ErrorDependencies),
TypeError: define(null, ErrorDependencies),
URIError: define(null, ErrorDependencies),
URL: define("url/index", ["web.url", "web.url.to-json", ...URLSearchParamsDependencies]),
URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
WeakMap: define("weak-map/index", WeakMapDependencies),
WeakSet: define("weak-set/index", WeakSetDependencies),
atob: define("atob", ["web.atob", ...DOMExceptionDependencies]),
btoa: define("btoa", ["web.btoa", ...DOMExceptionDependencies]),
clearImmediate: define("clear-immediate", ["web.immediate"]),
compositeKey: define("composite-key", ["esnext.composite-key"]),
compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
escape: define("escape", ["es.escape"]),
fetch: define(null, PromiseDependencies),
globalThis: define("global-this", ["es.global-this"]),
parseFloat: define("parse-float", ["es.parse-float"]),
parseInt: define("parse-int", ["es.parse-int"]),
queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
self: define("self", ["web.self"]),
setImmediate: define("set-immediate", ["web.immediate"]),
setInterval: define("set-interval", ["web.timers"]),
setTimeout: define("set-timeout", ["web.timers"]),
structuredClone: define("structured-clone", ["web.structured-clone", ...DOMExceptionDependencies, "es.array.iterator", "es.object.keys", "es.object.to-string", "es.map", "es.set"]),
unescape: define("unescape", ["es.unescape"])
};
const StaticProperties = {
AsyncIterator: {
from: define("async-iterator/from", ["esnext.async-iterator.from", ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods, ...CommonIterators])
},
Array: {
from: define("array/from", ["es.array.from", "es.string.iterator"]),
fromAsync: define("array/from-async", ["es.array.from-async", ...PromiseDependenciesWithIterators]),
isArray: define("array/is-array", ["es.array.is-array"]),
isTemplateObject: define("array/is-template-object", ["esnext.array.is-template-object"]),
of: define("array/of", ["es.array.of"])
},
ArrayBuffer: {
isView: define(null, ["es.array-buffer.is-view"])
},
BigInt: {
range: define("bigint/range", ["esnext.bigint.range", "es.object.to-string"])
},
Date: {
now: define("date/now", ["es.date.now"])
},
Error: {
isError: define("error/is-error", ["es.error.is-error", "es.object.create"])
},
Function: {
isCallable: define("function/is-callable", ["esnext.function.is-callable"]),
isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
},
Iterator: {
concat: define("iterator/concat", ["es.iterator.concat", ...IteratorDependencies, ...CommonIterators]),
from: define("iterator/from", ["es.iterator.from", ...IteratorDependencies, ...CommonIterators]),
range: define("iterator/range", ["esnext.iterator.range", ...IteratorDependencies]),
zip: define("iterator/zip", ["esnext.iterator.zip", ...IteratorDependencies, ...CommonIterators]),
zipKeyed: define("iterator/zip-keyed", ["esnext.iterator.zip-keyed", "es.object.create", "es.reflect.own-keys", ...IteratorDependencies, ...CommonIterators])
},
JSON: {
isRawJSON: define("json/is-raw-json", ["es.json.is-raw-json"]),
parse: define("json/parse", ["es.json.parse", "es.object.keys"]),
rawJSON: define("json/raw-json", ["es.json.raw-json", "es.object.create", "es.object.freeze"]),
stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"])
},
Math: {
DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
acosh: define("math/acosh", ["es.math.acosh"]),
asinh: define("math/asinh", ["es.math.asinh"]),
atanh: define("math/atanh", ["es.math.atanh"]),
cbrt: define("math/cbrt", ["es.math.cbrt"]),
clamp: define("math/clamp", ["esnext.math.clamp"]),
clz32: define("math/clz32", ["es.math.clz32"]),
cosh: define("math/cosh", ["es.math.cosh"]),
degrees: define("math/degrees", ["esnext.math.degrees"]),
expm1: define("math/expm1", ["es.math.expm1"]),
fround: define("math/fround", ["es.math.fround"]),
f16round: define("math/f16round", ["es.math.f16round"]),
fscale: define("math/fscale", ["esnext.math.fscale"]),
hypot: define("math/hypot", ["es.math.hypot"]),
iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
imul: define("math/imul", ["es.math.imul"]),
imulh: define("math/imulh", ["esnext.math.imulh"]),
isubh: define("math/isubh", ["esnext.math.isubh"]),
log10: define("math/log10", ["es.math.log10"]),
log1p: define("math/log1p", ["es.math.log1p"]),
log2: define("math/log2", ["es.math.log2"]),
radians: define("math/radians", ["esnext.math.radians"]),
scale: define("math/scale", ["esnext.math.scale"]),
seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
sign: define("math/sign", ["es.math.sign"]),
signbit: define("math/signbit", ["esnext.math.signbit"]),
sinh: define("math/sinh", ["es.math.sinh"]),
sumPrecise: define("math/sum-precise", ["es.math.sum-precise", "es.array.iterator"]),
tanh: define("math/tanh", ["es.math.tanh"]),
trunc: define("math/trunc", ["es.math.trunc"]),
umulh: define("math/umulh", ["esnext.math.umulh"])
},
Map: {
from: define("map/from", ["esnext.map.from", ...MapDependencies]),
groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
of: define("map/of", ["esnext.map.of", ...MapDependencies])
},
Number: {
EPSILON: define("number/epsilon", ["es.number.epsilon"]),
MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
fromString: define("number/from-string", ["esnext.number.from-string"]),
isFinite: define("number/is-finite", ["es.number.is-finite"]),
isInteger: define("number/is-integer", ["es.number.is-integer"]),
isNaN: define("number/is-nan", ["es.number.is-nan"]),
isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
parseFloat: define("number/parse-float", ["es.number.parse-float"]),
parseInt: define("number/parse-int", ["es.number.parse-int"]),
range: define("number/range", ["esnext.number.range", "es.object.to-string"])
},
Object: {
assign: define("object/assign", ["es.object.assign"]),
create: define("object/create", ["es.object.create"]),
defineProperties: define("object/define-properties", ["es.object.define-properties"]),
defineProperty: define("object/define-property", ["es.object.define-property"]),
entries: define("object/entries", ["es.object.entries"]),
freeze: define("object/freeze", ["es.object.freeze"]),
fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
groupBy: define("object/group-by", ["es.object.group-by", "es.object.create"]),
hasOwn: define("object/has-own", ["es.object.has-own"]),
is: define("object/is", ["es.object.is"]),
isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
keys: define("object/keys", ["es.object.keys"]),
preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
seal: define("object/seal", ["es.object.seal"]),
setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
values: define("object/values", ["es.object.values"])
},
Promise: {
all: define(null, PromiseDependenciesWithIterators),
allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
race: define(null, PromiseDependenciesWithIterators),
try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
},
Reflect: {
apply: define("reflect/apply", ["es.reflect.apply"]),
construct: define("reflect/construct", ["es.reflect.construct"]),
defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
get: define("reflect/get", ["es.reflect.get"]),
getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
has: define("reflect/has", ["es.reflect.has"]),
hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
set: define("reflect/set", ["es.reflect.set"]),
setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
},
RegExp: {
escape: define("regexp/escape", ["es.regexp.escape"])
},
Set: {
from: define("set/from", ["esnext.set.from", ...SetDependencies]),
of: define("set/of", ["esnext.set.of", ...SetDependencies])
},
String: {
cooked: define("string/cooked", ["esnext.string.cooked"]),
dedent: define("string/dedent", ["esnext.string.dedent", "es.string.from-code-point", "es.weak-map"]),
fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
raw: define("string/raw", ["es.string.raw"])
},
Symbol: {
asyncDispose: define("symbol/async-dispose", ["es.symbol.async-dispose", "es.async-iterator.async-dispose"]),
asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
dispose: define("symbol/dispose", ["es.symbol.dispose", "es.iterator.dispose"]),
for: define("symbol/for", [], "es.symbol"),
hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
isRegistered: define("symbol/is-registered", ["esnext.symbol.is-registered", "es.symbol"]),
isRegisteredSymbol: define("symbol/is-registered-symbol", ["esnext.symbol.is-registered-symbol", "es.symbol"]),
isWellKnown: define("symbol/is-well-known", ["esnext.symbol.is-well-known", "es.symbol"]),
isWellKnownSymbol: define("symbol/is-well-known-symbol", ["esnext.symbol.is-well-known-symbol", "es.symbol"]),
iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
keyFor: define("symbol/key-for", [], "es.symbol"),
match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
matcher: define("symbol/matcher", ["esnext.symbol.matcher"]),
matchAll: define("symbol/match-all", ["es.symbol.match-all", "es.string.match-all"]),
metadata: define("symbol/metadata", DecoratorMetadataDependencies),
metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
observable: define("symbol/observable", ["esnext.symbol.observable"]),
patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
toStringTag: define("symbol/to-string-tag", ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"]),
unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
},
URL: {
canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
parse: define("url/parse", ["web.url.parse", "web.url"])
},
WeakMap: {
from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
},
WeakSet: {
from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
},
Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
Uint8Array: {
fromBase64: define(null, ["es.uint8-array.from-base64", ...TypedArrayDependencies]),
fromHex: define(null, ["es.uint8-array.from-hex", ...TypedArrayDependencies]),
...TypedArrayStaticMethods("es.typed-array.uint8-array")
},
Uint8ClampedArray: TypedArrayStaticMethods("es.typed-array.uint8-clamped-array"),
Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),
WebAssembly: {
CompileError: define(null, ErrorDependencies),
LinkError: define(null, ErrorDependencies),
RuntimeError: define(null, ErrorDependencies)
}
};
["AggregateError", "EvalError", "RangeError", "ReferenceError", "SuppressedError", "SyntaxError", "TypeError", "URIError"].forEach(ERROR_SUBCLASS => {
StaticProperties[ERROR_SUBCLASS] = StaticProperties.Error;
});
const InstanceProperties = {
asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
at: define("instance/at", [
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at", "es.string.at-alternative", "es.array.at"]),
anchor: define(null, ["es.string.anchor"]),
big: define(null, ["es.string.big"]),
bind: define("instance/bind", ["es.function.bind"]),
blink: define(null, ["es.string.blink"]),
bold: define(null, ["es.string.bold"]),
chunks: define(null, ["esnext.iterator.chunks", ...IteratorDependencies]),
clamp: define("instance/clamp", ["esnext.number.clamp"]),
codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
codePoints: define("instance/code-points", ["esnext.string.code-points"]),
concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(null, ["es.iterator.drop", ...IteratorDependencies, "esnext.async-iterator.drop", ...AsyncIteratorDependencies]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ArrayNatureIteratorsWithTag),
every: define("instance/every", ["es.array.every", "es.iterator.every", ...IteratorDependencies
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// "esnext.async-iterator.every",
// ...AsyncIteratorDependencies
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define("instance/filter", ["es.array.filter", "es.iterator.filter", ...IteratorDependencies
// "esnext.async-iterator.filter",
]),
filterReject: define("instance/filter-reject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
find: define("instance/find", ["es.array.find", "es.iterator.find", ...IteratorDependencies
// "esnext.async-iterator.find",
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "es.iterator.flat-map", ...IteratorDependencies
// "esnext.async-iterator.flat-map",
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, ["es.data-view.get-float16", ...DataViewDependencies]),
getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", ["es.array.for-each", "es.iterator.for-each", ...IteratorDependencies,
// "esnext.async-iterator.for-each",
"web.dom-collections.for-each"]),
includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
italics: define(null, ["es.string.italics"]),
join: define(null, ["es.array.join"]),
keys: define("instance/keys", ArrayNatureIteratorsWithTag),
lastIndex: define(null, ["esnext.array.last-index"]),
lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
lastItem: define(null, ["esnext.array.last-item"]),
link: define(null, ["es.string.link"]),
map: define("instance/map", ["es.array.map", "es.iterator.map", ...IteratorDependencies
// "esnext.async-iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", ["es.array.reduce", "es.iterator.reduce", ...IteratorDependencies
// "esnext.async-iterator.reduce",
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
replace: define(null, ["es.string.replace", "es.regexp.exec"]),
replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
reverse: define("instance/reverse", ["es.array.reverse"]),
search: define(null, ["es.string.search", "es.regexp.exec"]),
setFloat16: define(null, ["es.data-view.set-float16", ...DataViewDependencies]),
setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
setYear: define(null, ["es.date.set-year"]),
slice: define("instance/slice", ["es.array.slice"]),
sliding: define(null, ["esnext.iterator.sliding", ...IteratorDependencies]),
small: define(null, ["es.string.small"]),
some: define("instance/some", ["es.array.some", "es.iterator.some", ...IteratorDependencies
// "esnext.async-iterator.some",
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
split: define(null, ["es.string.split", "es.regexp.exec"]),
startsWith: define("instance/starts-with", ["es.string.starts-with"]),
sticky: define(null, ["es.regexp.sticky"]),
strike: define(null, ["es.string.strike"]),
sub: define(null, ["es.string.sub"]),
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(null, ["es.iterator.take", ...IteratorDependencies, "esnext.async-iterator.take", ...AsyncIteratorDependencies]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(null, ["es.iterator.to-array", ...IteratorDependencies, "esnext.async-iterator.to-array", ...AsyncIteratorDependencies]),
toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
toExponential: define(null, ["es.number.to-exponential"]),
toFixed: define(null, ["es.number.to-fixed"]),
toGMTString: define(null, ["es.date.to-gmt-string"]),
toISOString: define(null, ["es.date.to-iso-string"]),
toJSON: define(null, ["es.date.to-json"]),
toPrecision: define(null, ["es.number.to-precision"]),
toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
trim: define("instance/trim", ["es.string.trim"]),
trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
trimRight: define("instance/trim-right", ["es.string.trim-end"]),
trimStart: define("instance/trim-start", ["es.string.trim-start"]),
uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
unshift: define("instance/unshift", ["es.array.unshift"]),
unThis: define("instance/un-this", ["esnext.function.un-this"]),
values: define("instance/values", ArrayNatureIteratorsWithTag),
windows: define(null, ["esnext.iterator.windows", ...IteratorDependencies]),
with: define("instance/with", ["es.array.with"]),
__defineGetter__: define(null, ["es.object.define-getter"]),
__defineSetter__: define(null, ["es.object.define-setter"]),
__lookupGetter__: define(null, ["es.object.lookup-getter"]),
__lookupSetter__: define(null, ["es.object.lookup-setter"]),
["__proto__"]: define(null, ["es.object.proto"])
};
// This file contains the list of paths supported by @babel/runtime-corejs3.
// It must _not_ be edited, as all new features should go through direct
// injection of core-js-pure imports.
const stable = new Set(["array", "array/from", "array/is-array", "array/of", "clear-immediate", "date/now", "instance/bind", "instance/code-point-at", "instance/concat", "instance/copy-within", "instance/ends-with", "instance/entries", "instance/every", "instance/fill", "instance/filter", "instance/find", "instance/find-index", "instance/flags", "instance/flat", "instance/flat-map", "instance/for-each", "instance/includes", "instance/index-of", "instance/keys", "instance/last-index-of", "instance/map", "instance/pad-end", "instance/pad-start", "instance/reduce", "instance/reduce-right", "instance/repeat", "instance/reverse", "instance/slice", "instance/some", "instance/sort", "instance/splice", "instance/starts-with", "instance/trim", "instance/trim-end", "instance/trim-left", "instance/trim-right", "instance/trim-start", "instance/values", "json/stringify", "map", "math/acosh", "math/asinh", "math/atanh", "math/cbrt", "math/clz32", "math/cosh", "math/expm1", "math/fround", "math/hypot", "math/imul", "math/log10", "math/log1p", "math/log2", "math/sign", "math/sinh", "math/tanh", "math/trunc", "number/epsilon", "number/is-finite", "number/is-integer", "number/is-nan", "number/is-safe-integer", "number/max-safe-integer", "number/min-safe-integer", "number/parse-float", "number/parse-int", "object/assign", "object/create", "object/define-properties", "object/define-property", "object/entries", "object/freeze", "object/from-entries", "object/get-own-property-descriptor", "object/get-own-property-descriptors", "object/get-own-property-names", "object/get-own-property-symbols", "object/get-prototype-of", "object/is", "object/is-extensible", "object/is-frozen", "object/is-sealed", "object/keys", "object/prevent-extensions", "object/seal", "object/set-prototype-of", "object/values", "parse-float", "parse-int", "promise", "queue-microtask", "reflect/apply", "reflect/construct", "reflect/define-property", "reflect/delete-property", "reflect/get", "reflect/get-own-property-descriptor", "reflect/get-prototype-of", "reflect/has", "reflect/is-extensible", "reflect/own-keys", "reflect/prevent-extensions", "reflect/set", "reflect/set-prototype-of", "set", "set-immediate", "set-interval", "set-timeout", "string/from-code-point", "string/raw", "symbol", "symbol/async-iterator", "symbol/for", "symbol/has-instance", "symbol/is-concat-spreadable", "symbol/iterator", "symbol/key-for", "symbol/match", "symbol/replace", "symbol/search", "symbol/species", "symbol/split", "symbol/to-primitive", "symbol/to-string-tag", "symbol/unscopables", "url", "url-search-params", "weak-map", "weak-set"]);
const proposals = new Set([...stable, "aggregate-error", "composite-key", "composite-symbol", "global-this", "instance/at", "instance/code-points", "instance/match-all", "instance/replace-all", "math/clamp", "math/degrees", "math/deg-per-rad", "math/fscale", "math/iaddh", "math/imulh", "math/isubh", "math/rad-per-deg", "math/radians", "math/scale", "math/seeded-prng", "math/signbit", "math/umulh", "number/from-string", "observable", "reflect/define-metadata", "reflect/delete-metadata", "reflect/get-metadata", "reflect/get-metadata-keys", "reflect/get-own-metadata", "reflect/get-own-metadata-keys", "reflect/has-metadata", "reflect/has-own-metadata", "reflect/metadata", "symbol/dispose", "symbol/observable", "symbol/pattern-match"]);
const {
types: t$2
} = _babel.default || _babel;
function canSkipPolyfill(desc, path) {
const {
node,
parent
} = path;
switch (desc.name) {
case "es.string.split":
{
if (!t$2.isCallExpression(parent, {
callee: node
})) return false;
if (parent.arguments.length < 1) return true;
const splitter = parent.arguments[0];
return t$2.isStringLiteral(splitter) || t$2.isTemplateLiteral(splitter);
}
}
}
const {
types: t$1
} = _babel.default || _babel;
const BABEL_RUNTIME = "@babel/runtime-corejs3";
function callMethod(path, id, optionalCall, wrapCallee) {
const [context1, context2] = maybeMemoizeContext(path.node, path.scope);
let callee = t$1.callExpression(id, [context1]);
if (wrapCallee) callee = wrapCallee(callee);
const call = t$1.identifier("call");
path.replaceWith(optionalCall ? t$1.optionalMemberExpression(callee, call, false, true) : t$1.memberExpression(callee, call));
path.parentPath.unshiftContainer("arguments", context2);
}
function maybeMemoizeContext(node, scope) {
const {
object
} = node;
let context1, context2;
if (t$1.isIdentifier(object)) {
context2 = object;
context1 = t$1.cloneNode(object);
} else {
context2 = scope.generateDeclaredUidIdentifier("context");
context1 = t$1.assignmentExpression("=", t$1.cloneNode(context2), object);
}
return [context1, context2];
}
function extractOptionalCheck(scope, node) {
let optionalNode = node;
while (!optionalNode.optional && t$1.isOptionalMemberExpression(optionalNode.object)) {
optionalNode = optionalNode.object;
}
optionalNode.optional = false;
const ctx = scope.generateDeclaredUidIdentifier("context");
const assign = t$1.assignmentExpression("=", ctx, optionalNode.object);
optionalNode.object = t$1.cloneNode(ctx);
return ifNotNullish => t$1.conditionalExpression(t$1.binaryExpression("==", assign, t$1.nullLiteral()), t$1.unaryExpression("void", t$1.numericLiteral(0)), ifNotNullish);
}
function isCoreJSSource(source) {
if (typeof source === "string") {
source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
}
return Object.prototype.hasOwnProperty.call(corejsEntries, source) && corejsEntries[source];
}
function coreJSModule(name) {
return `core-js/modules/${name}.js`;
}
function coreJSPureHelper(name, useBabelRuntime, ext) {
return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
}
const {
types: t,
template: template
} = _babel.default || _babel;
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
const esnextFallback = (name, cb) => {
if (cb(name)) return true;
if (!name.startsWith("es.")) return false;
const fallback = `esnext.${name.slice(3)}`;
if (!corejs3Polyfills[fallback]) return false;
return cb(fallback);
};
var index = defineProvider(function ({
getUtils,
method,
shouldInjectPolyfill,
createMetaResolver,
debug,
babel
}, {
version = 3,
proposals: proposals$1,
shippedProposals,
[presetEnvCompat]: {
noRuntimeName = false
} = {},
[runtimeCompat]: {
useBabelRuntime = false,
ext = ".js"
} = {}
}) {
const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
const resolve = createMetaResolver({
global: BuiltIns,
static: StaticProperties,
instance: InstanceProperties
});
const available = new Set(getModulesListForTargetVersion(version));
function getCoreJSPureBase(useProposalBase) {
return useBabelRuntime ? useProposalBase ? `${BABEL_RUNTIME}/core-js` : `${BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
}
function maybeInjectGlobalImpl(name, utils) {
if (shouldInjectPolyfill(name)) {
debug(name);
utils.injectGlobalImport(coreJSModule(name), name);
return true;
}
return false;
}
function maybeInjectGlobal(names, utils, fallback = true) {
for (const name of names) {
if (fallback) {
esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
} else {
maybeInjectGlobalImpl(name, utils);
}
}
}
function maybeInjectPure(desc, hint, utils, object) {
if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
const {
name
} = desc;
let useProposalBase = false;
if (proposals$1 || shippedProposals && name.startsWith("esnext.")) {
useProposalBase = true;
} else if (name.startsWith("es.") && !available.has(name)) {
useProposalBase = true;
}
if (useBabelRuntime && !(useProposalBase ? proposals : stable).has(desc.pure)) {
return;
}
const coreJSPureBase = getCoreJSPureBase(useProposalBase);
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
}
}
function isFeatureStable(name) {
if (name.startsWith("esnext.")) {
const esName = `es.${name.slice(7)}`;
// If its imaginative esName is not in latest compat data, it means
// the proposal is not stage 4
return esName in corejs3Polyfills;
}
return true;
}
return {
name: "corejs3",
runtimeName: noRuntimeName ? null : BABEL_RUNTIME,
polyfills: corejs3Polyfills,
filterPolyfills(name) {
if (!available.has(name)) return false;
if (proposals$1 || method === "entry-global") return true;
if (shippedProposals && corejs3ShippedProposalsList.has(name)) {
return true;
}
return isFeatureStable(name);
},
entryGlobal(meta, utils, path) {
if (meta.kind !== "import") return;
const modules = isCoreJSSource(meta.source);
if (!modules) return;
if (modules.length === 1 && meta.source === coreJSModule(modules[0]) && shouldInjectPolyfill(modules[0])) {
// Avoid infinite loop: do not replace imports with a new copy of
// themselves.
debug(null);
return;
}
const modulesSet = new Set(modules);
const filteredModules = modules.filter(module => {
if (!module.startsWith("esnext.")) return true;
const stable = module.replace("esnext.", "es.");
if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
return false;
}
return true;
});
maybeInjectGlobal(filteredModules, utils, false);
path.remove();
},
usageGlobal(meta, utils, path) {
const resolved = resolve(meta);
if (!resolved) return;
if (canSkipPolyfill(resolved.desc, path)) return;
let deps = resolved.desc.global;
if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
const low = meta.object.toLowerCase();
deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
}
maybeInjectGlobal(deps, utils);
return true;
},
usagePure(meta, utils, path) {
if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
));
}
return;
}
if (path.parentPath.isUnaryExpression({
operator: "delete"
})) return;
if (meta.kind === "property") {
// We can't compile destructuring and updateExpression.
if (!path.isMemberExpression() && !path.isOptionalMemberExpression()) {
return;
}
if (!path.isReferenced()) return;
if (path.parentPath.isUpdateExpression()) return;
if (t.isSuper(path.node.object)) {
return;
}
if (meta.key === "Symbol.iterator") {
if (!shouldInjectPolyfill("es.symbol.iterator")) return;
const {
parent,
node
} = path;
if (t.isCallExpression(parent, {
callee: node
})) {
if (parent.arguments.length === 0) {
path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
path.skip();
} else {
callMethod(path, utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
}
} else {
path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
}
return;
}
}
let resolved = resolve(meta);
if (!resolved) return;
if (canSkipPolyfill(resolved.desc, path)) return;
if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
// Remove /index, since it doesn't exist in @babel/runtime-corejs3s
resolved = {
...resolved,
desc: {
...resolved.desc,
pure: resolved.desc.pure.slice(0, -6)
}
};
}
if (resolved.kind === "global") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils);
if (id) path.replaceWith(id);
} else if (resolved.kind === "static") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils,
// @ts-expect-error
meta.object);
if (id) {
path.replaceWith(id);
let {
parentPath
} = path;
if (parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) {
do {
const parentAsNotOptional = parentPath;
parentAsNotOptional.type = parentAsNotOptional.node.type = parentPath.type === "OptionalMemberExpression" ? "MemberExpression" : "CallExpression";
delete parentAsNotOptional.node.optional;
({
parentPath
} = parentPath);
} while ((parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) && !parentPath.node.optional);
}
}
} else if (resolved.kind === "instance") {
const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
// @ts-expect-error
meta.object);
if (!id) return;
const {
node,
parent
} = path;
if (t.isOptionalCallExpression(parent) && parent.callee === node) {
const wasOptional = parent.optional;
parent.optional = !wasOptional;
if (!wasOptional) {
const check = extractOptionalCheck(path.scope, node);
const [thisArg, thisArg2] = maybeMemoizeContext(node, path.scope);
path.replaceWith(check(template.expression.ast`
Function.call.bind(${id}(${thisArg}), ${thisArg2})
`));
} else if (t.isOptionalMemberExpression(node)) {
const check = extractOptionalCheck(path.scope, node);
callMethod(path, id, true, check);
} else {
callMethod(path, id, true);
}
} else if (t.isCallExpression(parent) && parent.callee === node) {
callMethod(path, id, false);
} else if (t.isOptionalMemberExpression(node)) {
const check = extractOptionalCheck(path.scope, node);
path.replaceWith(check(t.callExpression(id, [node.object])));
if (t.isOptionalMemberExpression(parent)) parent.optional = true;
} else {
path.replaceWith(t.callExpression(id, [node.object]));
}
}
},
visitor: method === "usage-global" && {
// import("foo")
CallExpression(path) {
if (path.get("callee").isImport()) {
const utils = getUtils(path);
if (isWebpack) {
// Webpack uses Promise.all to handle dynamic import.
maybeInjectGlobal(PromiseDependenciesWithIterators, utils);
} else {
maybeInjectGlobal(PromiseDependencies, utils);
}
}
},
// (async function () { }).finally(...)
Function(path) {
if (path.node.async) {
maybeInjectGlobal(PromiseDependencies, getUtils(path));
}
},
// for-of, [a, b] = c
"ForOfStatement|ArrayPattern"(path) {
maybeInjectGlobal(CommonIterators, getUtils(path));
},
// [...spread]
SpreadElement(path) {
if (!path.parentPath.isObjectExpression()) {
maybeInjectGlobal(CommonIterators, getUtils(path));
}
},
// yield*
YieldExpression(path) {
if (path.node.delegate) {
maybeInjectGlobal(CommonIterators, getUtils(path));
}
},
// Decorators metadata
Class(path) {
var _path$node$decorators;
const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
var _decorators;
return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
});
if (hasDecorators) {
maybeInjectGlobal(DecoratorMetadataDependencies, getUtils(path));
}
}
}
};
});
export { index as default };
//# sourceMappingURL=index.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
"use strict";
exports.__esModule = true;
exports.stable = exports.proposals = void 0;
// This file contains the list of paths supported by @babel/runtime-corejs3.
// It must _not_ be edited, as all new features should go through direct
// injection of core-js-pure imports.
const stable = exports.stable = new Set(["array", "array/from", "array/is-array", "array/of", "clear-immediate", "date/now", "instance/bind", "instance/code-point-at", "instance/concat", "instance/copy-within", "instance/ends-with", "instance/entries", "instance/every", "instance/fill", "instance/filter", "instance/find", "instance/find-index", "instance/flags", "instance/flat", "instance/flat-map", "instance/for-each", "instance/includes", "instance/index-of", "instance/keys", "instance/last-index-of", "instance/map", "instance/pad-end", "instance/pad-start", "instance/reduce", "instance/reduce-right", "instance/repeat", "instance/reverse", "instance/slice", "instance/some", "instance/sort", "instance/splice", "instance/starts-with", "instance/trim", "instance/trim-end", "instance/trim-left", "instance/trim-right", "instance/trim-start", "instance/values", "json/stringify", "map", "math/acosh", "math/asinh", "math/atanh", "math/cbrt", "math/clz32", "math/cosh", "math/expm1", "math/fround", "math/hypot", "math/imul", "math/log10", "math/log1p", "math/log2", "math/sign", "math/sinh", "math/tanh", "math/trunc", "number/epsilon", "number/is-finite", "number/is-integer", "number/is-nan", "number/is-safe-integer", "number/max-safe-integer", "number/min-safe-integer", "number/parse-float", "number/parse-int", "object/assign", "object/create", "object/define-properties", "object/define-property", "object/entries", "object/freeze", "object/from-entries", "object/get-own-property-descriptor", "object/get-own-property-descriptors", "object/get-own-property-names", "object/get-own-property-symbols", "object/get-prototype-of", "object/is", "object/is-extensible", "object/is-frozen", "object/is-sealed", "object/keys", "object/prevent-extensions", "object/seal", "object/set-prototype-of", "object/values", "parse-float", "parse-int", "promise", "queue-microtask", "reflect/apply", "reflect/construct", "reflect/define-property", "reflect/delete-property", "reflect/get", "reflect/get-own-property-descriptor", "reflect/get-prototype-of", "reflect/has", "reflect/is-extensible", "reflect/own-keys", "reflect/prevent-extensions", "reflect/set", "reflect/set-prototype-of", "set", "set-immediate", "set-interval", "set-timeout", "string/from-code-point", "string/raw", "symbol", "symbol/async-iterator", "symbol/for", "symbol/has-instance", "symbol/is-concat-spreadable", "symbol/iterator", "symbol/key-for", "symbol/match", "symbol/replace", "symbol/search", "symbol/species", "symbol/split", "symbol/to-primitive", "symbol/to-string-tag", "symbol/unscopables", "url", "url-search-params", "weak-map", "weak-set"]);
const proposals = exports.proposals = new Set([...stable, "aggregate-error", "composite-key", "composite-symbol", "global-this", "instance/at", "instance/code-points", "instance/match-all", "instance/replace-all", "math/clamp", "math/degrees", "math/deg-per-rad", "math/fscale", "math/iaddh", "math/imulh", "math/isubh", "math/rad-per-deg", "math/radians", "math/scale", "math/seeded-prng", "math/signbit", "math/umulh", "number/from-string", "observable", "reflect/define-metadata", "reflect/delete-metadata", "reflect/get-metadata", "reflect/get-metadata-keys", "reflect/get-own-metadata", "reflect/get-own-metadata-keys", "reflect/has-metadata", "reflect/has-own-metadata", "reflect/metadata", "symbol/dispose", "symbol/observable", "symbol/pattern-match"]);
@@ -0,0 +1,474 @@
"use strict";
exports.__esModule = true;
exports.StaticProperties = exports.PromiseDependenciesWithIterators = exports.PromiseDependencies = exports.InstanceProperties = exports.DecoratorMetadataDependencies = exports.CommonIterators = exports.BuiltIns = void 0;
var _data = _interopRequireDefault(require("../core-js-compat/data.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const polyfillsOrder = {};
Object.keys(_data.default).forEach((name, index) => {
polyfillsOrder[name] = index;
});
const define = (pure, global, name = global[0], exclude) => {
return {
name,
pure,
global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
exclude
};
};
const typed = (...modules) => define(null, [...modules, ...TypedArrayDependencies]);
const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
const CommonIterators = exports.CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
const SuppressedErrorDependencies = ["es.suppressed-error.constructor", ...ErrorDependencies];
const ArrayBufferDependencies = ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by", ...ArrayBufferDependencies];
const PromiseDependencies = exports.PromiseDependencies = ["es.promise", "es.object.to-string"];
const PromiseDependenciesWithIterators = exports.PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
const MapDependencies = ["es.map", "es.map.get-or-insert", "es.map.get-or-insert-computed", "esnext.map.delete-all", "esnext.map.emplace", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
const SetDependencies = ["es.set", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
const WeakMapDependencies = ["es.weak-map", "es.weak-map.get-or-insert", "es.weak-map.get-or-insert-computed", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
const AsyncIteratorProblemMethods = ["esnext.async-iterator.every", "esnext.async-iterator.filter", "esnext.async-iterator.find", "esnext.async-iterator.flat-map", "esnext.async-iterator.for-each", "esnext.async-iterator.map", "esnext.async-iterator.reduce", "esnext.async-iterator.some"];
const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];
const DecoratorMetadataDependencies = exports.DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
const TypedArrayStaticMethods = base => ({
from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
});
const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
const BuiltIns = exports.BuiltIns = {
AsyncDisposableStack: define("async-disposable-stack/index", ["es.async-disposable-stack.constructor", "es.object.to-string", "es.async-iterator.async-dispose", "es.iterator.dispose", ...PromiseDependencies, ...SuppressedErrorDependencies]),
AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
ArrayBuffer: define(null, ArrayBufferDependencies),
DataView: define(null, DataViewDependencies),
Date: define(null, ["es.date.to-string"]),
DOMException: define("dom-exception/index", DOMExceptionDependencies),
DisposableStack: define("disposable-stack/index", ["es.disposable-stack.constructor", "es.object.to-string", "es.iterator.dispose", ...SuppressedErrorDependencies]),
Error: define(null, ErrorDependencies),
EvalError: define(null, ErrorDependencies),
Float32Array: typed("es.typed-array.float32-array"),
Float64Array: typed("es.typed-array.float64-array"),
Int8Array: typed("es.typed-array.int8-array"),
Int16Array: typed("es.typed-array.int16-array"),
Int32Array: typed("es.typed-array.int32-array"),
Iterator: define("iterator/index", IteratorDependencies),
Uint8Array: typed("es.typed-array.uint8-array", "es.uint8-array.set-from-base64", "es.uint8-array.set-from-hex", "es.uint8-array.to-base64", "es.uint8-array.to-hex"),
Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
Uint16Array: typed("es.typed-array.uint16-array"),
Uint32Array: typed("es.typed-array.uint32-array"),
Map: define("map/index", MapDependencies),
Number: define(null, ["es.number.constructor"]),
Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
Promise: define("promise/index", PromiseDependencies),
RangeError: define(null, ErrorDependencies),
ReferenceError: define(null, ErrorDependencies),
Reflect: define(null, ["es.reflect.to-string-tag", "es.object.to-string"]),
RegExp: define(null, ["es.regexp.constructor", "es.regexp.dot-all", "es.regexp.exec", "es.regexp.sticky", "es.regexp.to-string"]),
Set: define("set/index", SetDependencies),
SuppressedError: define("suppressed-error", SuppressedErrorDependencies),
Symbol: define("symbol/index", SymbolDependencies),
SyntaxError: define(null, ErrorDependencies),
TypeError: define(null, ErrorDependencies),
URIError: define(null, ErrorDependencies),
URL: define("url/index", ["web.url", "web.url.to-json", ...URLSearchParamsDependencies]),
URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
WeakMap: define("weak-map/index", WeakMapDependencies),
WeakSet: define("weak-set/index", WeakSetDependencies),
atob: define("atob", ["web.atob", ...DOMExceptionDependencies]),
btoa: define("btoa", ["web.btoa", ...DOMExceptionDependencies]),
clearImmediate: define("clear-immediate", ["web.immediate"]),
compositeKey: define("composite-key", ["esnext.composite-key"]),
compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
escape: define("escape", ["es.escape"]),
fetch: define(null, PromiseDependencies),
globalThis: define("global-this", ["es.global-this"]),
parseFloat: define("parse-float", ["es.parse-float"]),
parseInt: define("parse-int", ["es.parse-int"]),
queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
self: define("self", ["web.self"]),
setImmediate: define("set-immediate", ["web.immediate"]),
setInterval: define("set-interval", ["web.timers"]),
setTimeout: define("set-timeout", ["web.timers"]),
structuredClone: define("structured-clone", ["web.structured-clone", ...DOMExceptionDependencies, "es.array.iterator", "es.object.keys", "es.object.to-string", "es.map", "es.set"]),
unescape: define("unescape", ["es.unescape"])
};
const StaticProperties = exports.StaticProperties = {
AsyncIterator: {
from: define("async-iterator/from", ["esnext.async-iterator.from", ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods, ...CommonIterators])
},
Array: {
from: define("array/from", ["es.array.from", "es.string.iterator"]),
fromAsync: define("array/from-async", ["es.array.from-async", ...PromiseDependenciesWithIterators]),
isArray: define("array/is-array", ["es.array.is-array"]),
isTemplateObject: define("array/is-template-object", ["esnext.array.is-template-object"]),
of: define("array/of", ["es.array.of"])
},
ArrayBuffer: {
isView: define(null, ["es.array-buffer.is-view"])
},
BigInt: {
range: define("bigint/range", ["esnext.bigint.range", "es.object.to-string"])
},
Date: {
now: define("date/now", ["es.date.now"])
},
Error: {
isError: define("error/is-error", ["es.error.is-error", "es.object.create"])
},
Function: {
isCallable: define("function/is-callable", ["esnext.function.is-callable"]),
isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
},
Iterator: {
concat: define("iterator/concat", ["es.iterator.concat", ...IteratorDependencies, ...CommonIterators]),
from: define("iterator/from", ["es.iterator.from", ...IteratorDependencies, ...CommonIterators]),
range: define("iterator/range", ["esnext.iterator.range", ...IteratorDependencies]),
zip: define("iterator/zip", ["esnext.iterator.zip", ...IteratorDependencies, ...CommonIterators]),
zipKeyed: define("iterator/zip-keyed", ["esnext.iterator.zip-keyed", "es.object.create", "es.reflect.own-keys", ...IteratorDependencies, ...CommonIterators])
},
JSON: {
isRawJSON: define("json/is-raw-json", ["es.json.is-raw-json"]),
parse: define("json/parse", ["es.json.parse", "es.object.keys"]),
rawJSON: define("json/raw-json", ["es.json.raw-json", "es.object.create", "es.object.freeze"]),
stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"])
},
Math: {
DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
acosh: define("math/acosh", ["es.math.acosh"]),
asinh: define("math/asinh", ["es.math.asinh"]),
atanh: define("math/atanh", ["es.math.atanh"]),
cbrt: define("math/cbrt", ["es.math.cbrt"]),
clamp: define("math/clamp", ["esnext.math.clamp"]),
clz32: define("math/clz32", ["es.math.clz32"]),
cosh: define("math/cosh", ["es.math.cosh"]),
degrees: define("math/degrees", ["esnext.math.degrees"]),
expm1: define("math/expm1", ["es.math.expm1"]),
fround: define("math/fround", ["es.math.fround"]),
f16round: define("math/f16round", ["es.math.f16round"]),
fscale: define("math/fscale", ["esnext.math.fscale"]),
hypot: define("math/hypot", ["es.math.hypot"]),
iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
imul: define("math/imul", ["es.math.imul"]),
imulh: define("math/imulh", ["esnext.math.imulh"]),
isubh: define("math/isubh", ["esnext.math.isubh"]),
log10: define("math/log10", ["es.math.log10"]),
log1p: define("math/log1p", ["es.math.log1p"]),
log2: define("math/log2", ["es.math.log2"]),
radians: define("math/radians", ["esnext.math.radians"]),
scale: define("math/scale", ["esnext.math.scale"]),
seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
sign: define("math/sign", ["es.math.sign"]),
signbit: define("math/signbit", ["esnext.math.signbit"]),
sinh: define("math/sinh", ["es.math.sinh"]),
sumPrecise: define("math/sum-precise", ["es.math.sum-precise", "es.array.iterator"]),
tanh: define("math/tanh", ["es.math.tanh"]),
trunc: define("math/trunc", ["es.math.trunc"]),
umulh: define("math/umulh", ["esnext.math.umulh"])
},
Map: {
from: define("map/from", ["esnext.map.from", ...MapDependencies]),
groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
of: define("map/of", ["esnext.map.of", ...MapDependencies])
},
Number: {
EPSILON: define("number/epsilon", ["es.number.epsilon"]),
MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
fromString: define("number/from-string", ["esnext.number.from-string"]),
isFinite: define("number/is-finite", ["es.number.is-finite"]),
isInteger: define("number/is-integer", ["es.number.is-integer"]),
isNaN: define("number/is-nan", ["es.number.is-nan"]),
isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
parseFloat: define("number/parse-float", ["es.number.parse-float"]),
parseInt: define("number/parse-int", ["es.number.parse-int"]),
range: define("number/range", ["esnext.number.range", "es.object.to-string"])
},
Object: {
assign: define("object/assign", ["es.object.assign"]),
create: define("object/create", ["es.object.create"]),
defineProperties: define("object/define-properties", ["es.object.define-properties"]),
defineProperty: define("object/define-property", ["es.object.define-property"]),
entries: define("object/entries", ["es.object.entries"]),
freeze: define("object/freeze", ["es.object.freeze"]),
fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
groupBy: define("object/group-by", ["es.object.group-by", "es.object.create"]),
hasOwn: define("object/has-own", ["es.object.has-own"]),
is: define("object/is", ["es.object.is"]),
isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
keys: define("object/keys", ["es.object.keys"]),
preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
seal: define("object/seal", ["es.object.seal"]),
setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
values: define("object/values", ["es.object.values"])
},
Promise: {
all: define(null, PromiseDependenciesWithIterators),
allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
race: define(null, PromiseDependenciesWithIterators),
try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
},
Reflect: {
apply: define("reflect/apply", ["es.reflect.apply"]),
construct: define("reflect/construct", ["es.reflect.construct"]),
defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
get: define("reflect/get", ["es.reflect.get"]),
getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
has: define("reflect/has", ["es.reflect.has"]),
hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
set: define("reflect/set", ["es.reflect.set"]),
setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
},
RegExp: {
escape: define("regexp/escape", ["es.regexp.escape"])
},
Set: {
from: define("set/from", ["esnext.set.from", ...SetDependencies]),
of: define("set/of", ["esnext.set.of", ...SetDependencies])
},
String: {
cooked: define("string/cooked", ["esnext.string.cooked"]),
dedent: define("string/dedent", ["esnext.string.dedent", "es.string.from-code-point", "es.weak-map"]),
fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
raw: define("string/raw", ["es.string.raw"])
},
Symbol: {
asyncDispose: define("symbol/async-dispose", ["es.symbol.async-dispose", "es.async-iterator.async-dispose"]),
asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
dispose: define("symbol/dispose", ["es.symbol.dispose", "es.iterator.dispose"]),
for: define("symbol/for", [], "es.symbol"),
hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
isRegistered: define("symbol/is-registered", ["esnext.symbol.is-registered", "es.symbol"]),
isRegisteredSymbol: define("symbol/is-registered-symbol", ["esnext.symbol.is-registered-symbol", "es.symbol"]),
isWellKnown: define("symbol/is-well-known", ["esnext.symbol.is-well-known", "es.symbol"]),
isWellKnownSymbol: define("symbol/is-well-known-symbol", ["esnext.symbol.is-well-known-symbol", "es.symbol"]),
iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
keyFor: define("symbol/key-for", [], "es.symbol"),
match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
matcher: define("symbol/matcher", ["esnext.symbol.matcher"]),
matchAll: define("symbol/match-all", ["es.symbol.match-all", "es.string.match-all"]),
metadata: define("symbol/metadata", DecoratorMetadataDependencies),
metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
observable: define("symbol/observable", ["esnext.symbol.observable"]),
patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
toStringTag: define("symbol/to-string-tag", ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"]),
unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
},
URL: {
canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
parse: define("url/parse", ["web.url.parse", "web.url"])
},
WeakMap: {
from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
},
WeakSet: {
from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
},
Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
Uint8Array: _extends({
fromBase64: define(null, ["es.uint8-array.from-base64", ...TypedArrayDependencies]),
fromHex: define(null, ["es.uint8-array.from-hex", ...TypedArrayDependencies])
}, TypedArrayStaticMethods("es.typed-array.uint8-array")),
Uint8ClampedArray: TypedArrayStaticMethods("es.typed-array.uint8-clamped-array"),
Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),
WebAssembly: {
CompileError: define(null, ErrorDependencies),
LinkError: define(null, ErrorDependencies),
RuntimeError: define(null, ErrorDependencies)
}
};
["AggregateError", "EvalError", "RangeError", "ReferenceError", "SuppressedError", "SyntaxError", "TypeError", "URIError"].forEach(ERROR_SUBCLASS => {
StaticProperties[ERROR_SUBCLASS] = StaticProperties.Error;
});
const InstanceProperties = exports.InstanceProperties = {
asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
at: define("instance/at", [
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at", "es.string.at-alternative", "es.array.at"]),
anchor: define(null, ["es.string.anchor"]),
big: define(null, ["es.string.big"]),
bind: define("instance/bind", ["es.function.bind"]),
blink: define(null, ["es.string.blink"]),
bold: define(null, ["es.string.bold"]),
chunks: define(null, ["esnext.iterator.chunks", ...IteratorDependencies]),
clamp: define("instance/clamp", ["esnext.number.clamp"]),
codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
codePoints: define("instance/code-points", ["esnext.string.code-points"]),
concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(null, ["es.iterator.drop", ...IteratorDependencies, "esnext.async-iterator.drop", ...AsyncIteratorDependencies]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ArrayNatureIteratorsWithTag),
every: define("instance/every", ["es.array.every", "es.iterator.every", ...IteratorDependencies
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// "esnext.async-iterator.every",
// ...AsyncIteratorDependencies
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define("instance/filter", ["es.array.filter", "es.iterator.filter", ...IteratorDependencies
// "esnext.async-iterator.filter",
]),
filterReject: define("instance/filter-reject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
find: define("instance/find", ["es.array.find", "es.iterator.find", ...IteratorDependencies
// "esnext.async-iterator.find",
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "es.iterator.flat-map", ...IteratorDependencies
// "esnext.async-iterator.flat-map",
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, ["es.data-view.get-float16", ...DataViewDependencies]),
getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", ["es.array.for-each", "es.iterator.for-each", ...IteratorDependencies,
// "esnext.async-iterator.for-each",
"web.dom-collections.for-each"]),
includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
italics: define(null, ["es.string.italics"]),
join: define(null, ["es.array.join"]),
keys: define("instance/keys", ArrayNatureIteratorsWithTag),
lastIndex: define(null, ["esnext.array.last-index"]),
lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
lastItem: define(null, ["esnext.array.last-item"]),
link: define(null, ["es.string.link"]),
map: define("instance/map", ["es.array.map", "es.iterator.map", ...IteratorDependencies
// "esnext.async-iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", ["es.array.reduce", "es.iterator.reduce", ...IteratorDependencies
// "esnext.async-iterator.reduce",
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
replace: define(null, ["es.string.replace", "es.regexp.exec"]),
replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
reverse: define("instance/reverse", ["es.array.reverse"]),
search: define(null, ["es.string.search", "es.regexp.exec"]),
setFloat16: define(null, ["es.data-view.set-float16", ...DataViewDependencies]),
setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
setYear: define(null, ["es.date.set-year"]),
slice: define("instance/slice", ["es.array.slice"]),
sliding: define(null, ["esnext.iterator.sliding", ...IteratorDependencies]),
small: define(null, ["es.string.small"]),
some: define("instance/some", ["es.array.some", "es.iterator.some", ...IteratorDependencies
// "esnext.async-iterator.some",
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
split: define(null, ["es.string.split", "es.regexp.exec"]),
startsWith: define("instance/starts-with", ["es.string.starts-with"]),
sticky: define(null, ["es.regexp.sticky"]),
strike: define(null, ["es.string.strike"]),
sub: define(null, ["es.string.sub"]),
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(null, ["es.iterator.take", ...IteratorDependencies, "esnext.async-iterator.take", ...AsyncIteratorDependencies]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(null, ["es.iterator.to-array", ...IteratorDependencies, "esnext.async-iterator.to-array", ...AsyncIteratorDependencies]),
toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
toExponential: define(null, ["es.number.to-exponential"]),
toFixed: define(null, ["es.number.to-fixed"]),
toGMTString: define(null, ["es.date.to-gmt-string"]),
toISOString: define(null, ["es.date.to-iso-string"]),
toJSON: define(null, ["es.date.to-json"]),
toPrecision: define(null, ["es.number.to-precision"]),
toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
trim: define("instance/trim", ["es.string.trim"]),
trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
trimRight: define("instance/trim-right", ["es.string.trim-end"]),
trimStart: define("instance/trim-start", ["es.string.trim-start"]),
uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
unshift: define("instance/unshift", ["es.array.unshift"]),
unThis: define("instance/un-this", ["esnext.function.un-this"]),
values: define("instance/values", ArrayNatureIteratorsWithTag),
windows: define(null, ["esnext.iterator.windows", ...IteratorDependencies]),
with: define("instance/with", ["es.array.with"]),
__defineGetter__: define(null, ["es.object.define-getter"]),
__defineSetter__: define(null, ["es.object.define-setter"]),
__lookupGetter__: define(null, ["es.object.lookup-getter"]),
__lookupSetter__: define(null, ["es.object.lookup-setter"]),
["__proto__"]: define(null, ["es.object.proto"])
};
@@ -0,0 +1,309 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _data = _interopRequireDefault(require("../core-js-compat/data.js"));
var _shippedProposals = _interopRequireDefault(require("./shipped-proposals"));
var _getModulesListForTargetVersion = _interopRequireDefault(require("../core-js-compat/get-modules-list-for-target-version.js"));
var _builtInDefinitions = require("./built-in-definitions");
var BabelRuntimePaths = _interopRequireWildcard(require("./babel-runtime-corejs3-paths"));
var _usageFilters = _interopRequireDefault(require("./usage-filters"));
var _babel = _interopRequireWildcard(require("@babel/core"));
var _utils = require("./utils");
var _helperDefinePolyfillProvider = _interopRequireDefault(require("@babel/helper-define-polyfill-provider"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const {
types: t,
template: template
} = _babel.default || _babel;
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
const esnextFallback = (name, cb) => {
if (cb(name)) return true;
if (!name.startsWith("es.")) return false;
const fallback = `esnext.${name.slice(3)}`;
if (!_data.default[fallback]) return false;
return cb(fallback);
};
var _default = exports.default = (0, _helperDefinePolyfillProvider.default)(function ({
getUtils,
method,
shouldInjectPolyfill,
createMetaResolver,
debug,
babel
}, {
version = 3,
proposals,
shippedProposals,
[presetEnvCompat]: {
noRuntimeName = false
} = {},
[runtimeCompat]: {
useBabelRuntime = false,
ext = ".js"
} = {}
}) {
const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
const resolve = createMetaResolver({
global: _builtInDefinitions.BuiltIns,
static: _builtInDefinitions.StaticProperties,
instance: _builtInDefinitions.InstanceProperties
});
const available = new Set((0, _getModulesListForTargetVersion.default)(version));
function getCoreJSPureBase(useProposalBase) {
return useBabelRuntime ? useProposalBase ? `${_utils.BABEL_RUNTIME}/core-js` : `${_utils.BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
}
function maybeInjectGlobalImpl(name, utils) {
if (shouldInjectPolyfill(name)) {
debug(name);
utils.injectGlobalImport((0, _utils.coreJSModule)(name), name);
return true;
}
return false;
}
function maybeInjectGlobal(names, utils, fallback = true) {
for (const name of names) {
if (fallback) {
esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
} else {
maybeInjectGlobalImpl(name, utils);
}
}
}
function maybeInjectPure(desc, hint, utils, object) {
if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
const {
name
} = desc;
let useProposalBase = false;
if (proposals || shippedProposals && name.startsWith("esnext.")) {
useProposalBase = true;
} else if (name.startsWith("es.") && !available.has(name)) {
useProposalBase = true;
}
if (useBabelRuntime && !(useProposalBase ? BabelRuntimePaths.proposals : BabelRuntimePaths.stable).has(desc.pure)) {
return;
}
const coreJSPureBase = getCoreJSPureBase(useProposalBase);
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
}
}
function isFeatureStable(name) {
if (name.startsWith("esnext.")) {
const esName = `es.${name.slice(7)}`;
// If its imaginative esName is not in latest compat data, it means
// the proposal is not stage 4
return esName in _data.default;
}
return true;
}
return {
name: "corejs3",
runtimeName: noRuntimeName ? null : _utils.BABEL_RUNTIME,
polyfills: _data.default,
filterPolyfills(name) {
if (!available.has(name)) return false;
if (proposals || method === "entry-global") return true;
if (shippedProposals && _shippedProposals.default.has(name)) {
return true;
}
return isFeatureStable(name);
},
entryGlobal(meta, utils, path) {
if (meta.kind !== "import") return;
const modules = (0, _utils.isCoreJSSource)(meta.source);
if (!modules) return;
if (modules.length === 1 && meta.source === (0, _utils.coreJSModule)(modules[0]) && shouldInjectPolyfill(modules[0])) {
// Avoid infinite loop: do not replace imports with a new copy of
// themselves.
debug(null);
return;
}
const modulesSet = new Set(modules);
const filteredModules = modules.filter(module => {
if (!module.startsWith("esnext.")) return true;
const stable = module.replace("esnext.", "es.");
if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
return false;
}
return true;
});
maybeInjectGlobal(filteredModules, utils, false);
path.remove();
},
usageGlobal(meta, utils, path) {
const resolved = resolve(meta);
if (!resolved) return;
if ((0, _usageFilters.default)(resolved.desc, path)) return;
let deps = resolved.desc.global;
if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
const low = meta.object.toLowerCase();
deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
}
maybeInjectGlobal(deps, utils);
return true;
},
usagePure(meta, utils, path) {
if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
));
}
return;
}
if (path.parentPath.isUnaryExpression({
operator: "delete"
})) return;
if (meta.kind === "property") {
// We can't compile destructuring and updateExpression.
if (!path.isMemberExpression() && !path.isOptionalMemberExpression()) {
return;
}
if (!path.isReferenced()) return;
if (path.parentPath.isUpdateExpression()) return;
if (t.isSuper(path.node.object)) {
return;
}
if (meta.key === "Symbol.iterator") {
if (!shouldInjectPolyfill("es.symbol.iterator")) return;
const {
parent,
node
} = path;
if (t.isCallExpression(parent, {
callee: node
})) {
if (parent.arguments.length === 0) {
path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
path.skip();
} else {
(0, _utils.callMethod)(path, utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
}
} else {
path.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
}
return;
}
}
let resolved = resolve(meta);
if (!resolved) return;
if ((0, _usageFilters.default)(resolved.desc, path)) return;
if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
// Remove /index, since it doesn't exist in @babel/runtime-corejs3s
resolved = _extends({}, resolved, {
desc: _extends({}, resolved.desc, {
pure: resolved.desc.pure.slice(0, -6)
})
});
}
if (resolved.kind === "global") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils);
if (id) path.replaceWith(id);
} else if (resolved.kind === "static") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils,
// @ts-expect-error
meta.object);
if (id) {
path.replaceWith(id);
let {
parentPath
} = path;
if (parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) {
do {
const parentAsNotOptional = parentPath;
parentAsNotOptional.type = parentAsNotOptional.node.type = parentPath.type === "OptionalMemberExpression" ? "MemberExpression" : "CallExpression";
delete parentAsNotOptional.node.optional;
({
parentPath
} = parentPath);
} while ((parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) && !parentPath.node.optional);
}
}
} else if (resolved.kind === "instance") {
const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
// @ts-expect-error
meta.object);
if (!id) return;
const {
node,
parent
} = path;
if (t.isOptionalCallExpression(parent) && parent.callee === node) {
const wasOptional = parent.optional;
parent.optional = !wasOptional;
if (!wasOptional) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
const [thisArg, thisArg2] = (0, _utils.maybeMemoizeContext)(node, path.scope);
path.replaceWith(check(template.expression.ast`
Function.call.bind(${id}(${thisArg}), ${thisArg2})
`));
} else if (t.isOptionalMemberExpression(node)) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
(0, _utils.callMethod)(path, id, true, check);
} else {
(0, _utils.callMethod)(path, id, true);
}
} else if (t.isCallExpression(parent) && parent.callee === node) {
(0, _utils.callMethod)(path, id, false);
} else if (t.isOptionalMemberExpression(node)) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
path.replaceWith(check(t.callExpression(id, [node.object])));
if (t.isOptionalMemberExpression(parent)) parent.optional = true;
} else {
path.replaceWith(t.callExpression(id, [node.object]));
}
}
},
visitor: method === "usage-global" && {
// import("foo")
CallExpression(path) {
if (path.get("callee").isImport()) {
const utils = getUtils(path);
if (isWebpack) {
// Webpack uses Promise.all to handle dynamic import.
maybeInjectGlobal(_builtInDefinitions.PromiseDependenciesWithIterators, utils);
} else {
maybeInjectGlobal(_builtInDefinitions.PromiseDependencies, utils);
}
}
},
// (async function () { }).finally(...)
Function(path) {
if (path.node.async) {
maybeInjectGlobal(_builtInDefinitions.PromiseDependencies, getUtils(path));
}
},
// for-of, [a, b] = c
"ForOfStatement|ArrayPattern"(path) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
},
// [...spread]
SpreadElement(path) {
if (!path.parentPath.isObjectExpression()) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
}
},
// yield*
YieldExpression(path) {
if (path.node.delegate) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
}
},
// Decorators metadata
Class(path) {
var _path$node$decorators;
const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
var _decorators;
return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
});
if (hasDecorators) {
maybeInjectGlobal(_builtInDefinitions.DecoratorMetadataDependencies, getUtils(path));
}
}
}
};
});
@@ -0,0 +1,6 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
var _default = exports.default = new Set(["esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.zip", "esnext.iterator.zip-keyed", "esnext.symbol.metadata"]);
@@ -0,0 +1,26 @@
"use strict";
exports.__esModule = true;
exports.default = canSkipPolyfill;
var _babel = _interopRequireWildcard(require("@babel/core"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const {
types: t
} = _babel.default || _babel;
function canSkipPolyfill(desc, path) {
const {
node,
parent
} = path;
switch (desc.name) {
case "es.string.split":
{
if (!t.isCallExpression(parent, {
callee: node
})) return false;
if (parent.arguments.length < 1) return true;
const splitter = parent.arguments[0];
return t.isStringLiteral(splitter) || t.isTemplateLiteral(splitter);
}
}
}
@@ -0,0 +1,63 @@
"use strict";
exports.__esModule = true;
exports.BABEL_RUNTIME = void 0;
exports.callMethod = callMethod;
exports.coreJSModule = coreJSModule;
exports.coreJSPureHelper = coreJSPureHelper;
exports.extractOptionalCheck = extractOptionalCheck;
exports.isCoreJSSource = isCoreJSSource;
exports.maybeMemoizeContext = maybeMemoizeContext;
var _babel = _interopRequireWildcard(require("@babel/core"));
var _entries = _interopRequireDefault(require("../core-js-compat/entries.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const {
types: t
} = _babel.default || _babel;
const BABEL_RUNTIME = exports.BABEL_RUNTIME = "@babel/runtime-corejs3";
function callMethod(path, id, optionalCall, wrapCallee) {
const [context1, context2] = maybeMemoizeContext(path.node, path.scope);
let callee = t.callExpression(id, [context1]);
if (wrapCallee) callee = wrapCallee(callee);
const call = t.identifier("call");
path.replaceWith(optionalCall ? t.optionalMemberExpression(callee, call, false, true) : t.memberExpression(callee, call));
path.parentPath.unshiftContainer("arguments", context2);
}
function maybeMemoizeContext(node, scope) {
const {
object
} = node;
let context1, context2;
if (t.isIdentifier(object)) {
context2 = object;
context1 = t.cloneNode(object);
} else {
context2 = scope.generateDeclaredUidIdentifier("context");
context1 = t.assignmentExpression("=", t.cloneNode(context2), object);
}
return [context1, context2];
}
function extractOptionalCheck(scope, node) {
let optionalNode = node;
while (!optionalNode.optional && t.isOptionalMemberExpression(optionalNode.object)) {
optionalNode = optionalNode.object;
}
optionalNode.optional = false;
const ctx = scope.generateDeclaredUidIdentifier("context");
const assign = t.assignmentExpression("=", ctx, optionalNode.object);
optionalNode.object = t.cloneNode(ctx);
return ifNotNullish => t.conditionalExpression(t.binaryExpression("==", assign, t.nullLiteral()), t.unaryExpression("void", t.numericLiteral(0)), ifNotNullish);
}
function isCoreJSSource(source) {
if (typeof source === "string") {
source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
}
return Object.prototype.hasOwnProperty.call(_entries.default, source) && _entries.default[source];
}
function coreJSModule(name) {
return `core-js/modules/${name}.js`;
}
function coreJSPureHelper(name, useBabelRuntime, ext) {
return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
}
@@ -0,0 +1,49 @@
{
"name": "babel-plugin-polyfill-corejs3",
"version": "0.14.2",
"description": "A Babel plugin to inject imports to core-js@3 polyfills",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel-polyfills.git",
"directory": "packages/babel-plugin-polyfill-corejs3"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"exports": {
".": [
{
"import": "./esm/index.mjs",
"default": "./lib/index.js"
},
"./lib/index.js"
],
"./package.json": "./package.json"
},
"keywords": [
"babel-plugin"
],
"dependencies": {
"@babel/helper-define-polyfill-provider": "^0.6.8",
"core-js-compat": "^3.48.0"
},
"devDependencies": {
"@babel/core": "^7.28.6",
"@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/plugin-proposal-decorators": "^7.28.6",
"@babel/plugin-transform-class-properties": "^7.28.6",
"@babel/plugin-transform-classes": "^7.28.6",
"@babel/plugin-transform-for-of": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/plugin-transform-runtime": "^7.28.5",
"@babel/plugin-transform-spread": "^7.28.6",
"core-js": "^3.48.0",
"core-js-pure": "^3.48.0"
},
"peerDependencies": {
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
},
"gitHead": "86eff78e98adc17cdf0eb9ba4d94140eb7cb0da0"
}
+104
View File
@@ -0,0 +1,104 @@
{
"name": "@babel/preset-env",
"version": "7.29.7",
"description": "A Babel preset for each environment.",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-preset-env",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20preset-env%22+is%3Aopen",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-preset-env"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/compat-data": "^7.29.7",
"@babel/helper-compilation-targets": "^7.29.7",
"@babel/helper-plugin-utils": "^7.29.7",
"@babel/helper-validator-option": "^7.29.7",
"@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.29.7",
"@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.29.7",
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.29.7",
"@babel/plugin-bugfix-safari-rest-destructuring-rhs-array": "^7.29.7",
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.29.7",
"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.29.7",
"@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2",
"@babel/plugin-syntax-import-assertions": "^7.29.7",
"@babel/plugin-syntax-import-attributes": "^7.29.7",
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
"@babel/plugin-transform-arrow-functions": "^7.29.7",
"@babel/plugin-transform-async-generator-functions": "^7.29.7",
"@babel/plugin-transform-async-to-generator": "^7.29.7",
"@babel/plugin-transform-block-scoped-functions": "^7.29.7",
"@babel/plugin-transform-block-scoping": "^7.29.7",
"@babel/plugin-transform-class-properties": "^7.29.7",
"@babel/plugin-transform-class-static-block": "^7.29.7",
"@babel/plugin-transform-classes": "^7.29.7",
"@babel/plugin-transform-computed-properties": "^7.29.7",
"@babel/plugin-transform-destructuring": "^7.29.7",
"@babel/plugin-transform-dotall-regex": "^7.29.7",
"@babel/plugin-transform-duplicate-keys": "^7.29.7",
"@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.29.7",
"@babel/plugin-transform-dynamic-import": "^7.29.7",
"@babel/plugin-transform-explicit-resource-management": "^7.29.7",
"@babel/plugin-transform-exponentiation-operator": "^7.29.7",
"@babel/plugin-transform-export-namespace-from": "^7.29.7",
"@babel/plugin-transform-for-of": "^7.29.7",
"@babel/plugin-transform-function-name": "^7.29.7",
"@babel/plugin-transform-json-strings": "^7.29.7",
"@babel/plugin-transform-literals": "^7.29.7",
"@babel/plugin-transform-logical-assignment-operators": "^7.29.7",
"@babel/plugin-transform-member-expression-literals": "^7.29.7",
"@babel/plugin-transform-modules-amd": "^7.29.7",
"@babel/plugin-transform-modules-commonjs": "^7.29.7",
"@babel/plugin-transform-modules-systemjs": "^7.29.7",
"@babel/plugin-transform-modules-umd": "^7.29.7",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.29.7",
"@babel/plugin-transform-new-target": "^7.29.7",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.29.7",
"@babel/plugin-transform-numeric-separator": "^7.29.7",
"@babel/plugin-transform-object-rest-spread": "^7.29.7",
"@babel/plugin-transform-object-super": "^7.29.7",
"@babel/plugin-transform-optional-catch-binding": "^7.29.7",
"@babel/plugin-transform-optional-chaining": "^7.29.7",
"@babel/plugin-transform-parameters": "^7.29.7",
"@babel/plugin-transform-private-methods": "^7.29.7",
"@babel/plugin-transform-private-property-in-object": "^7.29.7",
"@babel/plugin-transform-property-literals": "^7.29.7",
"@babel/plugin-transform-regenerator": "^7.29.7",
"@babel/plugin-transform-regexp-modifiers": "^7.29.7",
"@babel/plugin-transform-reserved-words": "^7.29.7",
"@babel/plugin-transform-shorthand-properties": "^7.29.7",
"@babel/plugin-transform-spread": "^7.29.7",
"@babel/plugin-transform-sticky-regex": "^7.29.7",
"@babel/plugin-transform-template-literals": "^7.29.7",
"@babel/plugin-transform-typeof-symbol": "^7.29.7",
"@babel/plugin-transform-unicode-escapes": "^7.29.7",
"@babel/plugin-transform-unicode-property-regex": "^7.29.7",
"@babel/plugin-transform-unicode-regex": "^7.29.7",
"@babel/plugin-transform-unicode-sets-regex": "^7.29.7",
"@babel/preset-modules": "0.1.6-no-external-plugins",
"babel-plugin-polyfill-corejs2": "^0.4.15",
"babel-plugin-polyfill-corejs3": "^0.14.0",
"babel-plugin-polyfill-regenerator": "^0.6.6",
"core-js-compat": "^3.48.0",
"semver": "^6.3.1"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/core-7.12": "npm:@babel/core@7.12.9",
"@babel/helper-plugin-test-runner": "^7.29.7",
"@babel/traverse": "^7.29.7"
},
"engines": {
"node": ">=6.9.0"
},
"type": "commonjs"
}