diff options
Diffstat (limited to 'node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs')
| -rw-r--r-- | node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs | 83 |
1 files changed, 49 insertions, 34 deletions
diff --git a/node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs b/node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs index a0da2af6..7437da4c 100644 --- a/node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs +++ b/node_modules/babel-plugin-polyfill-corejs3/esm/index.mjs @@ -6,7 +6,7 @@ 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.from-async", "esnext.array.group", "esnext.array.group-to-map", "esnext.array-buffer.detached", "esnext.array-buffer.transfer", "esnext.array-buffer.transfer-to-fixed-length", "esnext.iterator.constructor", "esnext.iterator.drop", "esnext.iterator.every", "esnext.iterator.filter", "esnext.iterator.find", "esnext.iterator.flat-map", "esnext.iterator.for-each", "esnext.iterator.from", "esnext.iterator.map", "esnext.iterator.reduce", "esnext.iterator.some", "esnext.iterator.take", "esnext.iterator.to-array", "esnext.json.is-raw-json", "esnext.json.parse", "esnext.json.raw-json", "esnext.map.group-by", "esnext.object.group-by", "esnext.promise.with-resolvers", "esnext.set.difference.v2", "esnext.set.intersection.v2", "esnext.set.is-disjoint-from.v2", "esnext.set.is-subset-of.v2", "esnext.set.is-superset-of.v2", "esnext.set.symmetric-difference.v2", "esnext.set.union.v2", "esnext.symbol.async-dispose", "esnext.symbol.dispose"]); +var corejs3ShippedProposalsList = new Set(["esnext.suppressed-error.constructor", "esnext.array.from-async", "esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.constructor", "esnext.iterator.drop", "esnext.iterator.every", "esnext.iterator.filter", "esnext.iterator.find", "esnext.iterator.flat-map", "esnext.iterator.for-each", "esnext.iterator.from", "esnext.iterator.map", "esnext.iterator.reduce", "esnext.iterator.some", "esnext.iterator.take", "esnext.iterator.to-array", "esnext.json.is-raw-json", "esnext.json.parse", "esnext.json.raw-json", "esnext.set.difference.v2", "esnext.set.intersection.v2", "esnext.set.is-disjoint-from.v2", "esnext.set.is-subset-of.v2", "esnext.set.is-superset-of.v2", "esnext.set.symmetric-difference.v2", "esnext.set.union.v2", "esnext.symbol.async-dispose", "esnext.symbol.dispose", "esnext.symbol.metadata"]); const polyfillsOrder = {}; Object.keys(corejs3Polyfills).forEach((name, index) => { @@ -20,14 +20,14 @@ const define = (pure, global, name = global[0], exclude) => { exclude }; }; -const typed = name => define(null, [name, ...TypedArrayDependencies]); +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 = ["esnext.suppressed-error.constructor", ...ErrorDependencies]; -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", "es.array-buffer.slice", "esnext.array-buffer.detached", "esnext.array-buffer.transfer", "esnext.array-buffer.transfer-to-fixed-length", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by"]; +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", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by"]; const PromiseDependencies = ["es.promise", "es.object.to-string"]; const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators]; const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"]; @@ -41,17 +41,17 @@ const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...Promi 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 = ["esnext.iterator.constructor", "es.object.to-string"]; const DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"]; -const TypedArrayStaticMethods = { - from: define(null, ["es.typed-array.from"]), - fromAsync: define(null, ["esnext.typed-array.from-async", ...PromiseDependenciesWithIterators]), - of: define(null, ["es.typed-array.of"]) -}; -const DataViewDependencies = ["es.data-view", "es.array-buffer.slice", "es.object.to-string"]; +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", "es.array-buffer.constructor", "es.array-buffer.slice", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"]; const BuiltIns = { AsyncDisposableStack: define("async-disposable-stack/index", ["esnext.async-disposable-stack.constructor", "es.object.to-string", "esnext.async-iterator.async-dispose", "esnext.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, ["es.array-buffer.constructor", "es.array-buffer.slice", "es.object.to-string"]), + ArrayBuffer: define(null, ["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"]), DataView: define(null, DataViewDependencies), Date: define(null, ["es.date.to-string"]), DOMException: define("dom-exception/index", DOMExceptionDependencies), @@ -64,7 +64,7 @@ const BuiltIns = { 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"), + Uint8Array: typed("es.typed-array.uint8-array", "esnext.uint8-array.to-base64", "esnext.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"), @@ -82,7 +82,7 @@ const BuiltIns = { SyntaxError: define(null, ErrorDependencies), TypeError: define(null, ErrorDependencies), URIError: define(null, ErrorDependencies), - URL: define("url/index", ["web.url", ...URLSearchParamsDependencies]), + 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), @@ -136,7 +136,7 @@ const StaticProperties = { isRawJSON: define("json/is-raw-json", ["esnext.json.is-raw-json"]), parse: define("json/parse", ["esnext.json.parse", "es.object.keys"]), rawJSON: define("json/raw-json", ["esnext.json.raw-json", "es.object.create", "es.object.freeze"]), - stringify: define("json/stringify", ["es.json.stringify"], "es.symbol") + stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"], "es.symbol") }, Math: { DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]), @@ -173,8 +173,8 @@ const StaticProperties = { }, Map: { from: define(null, ["esnext.map.from", ...MapDependencies]), - groupBy: define(null, ["esnext.map.group-by", ...MapDependencies]), - keyBy: define(null, ["esnext.map.key-by", ...MapDependencies]), + groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]), + keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]), of: define(null, ["esnext.map.of", ...MapDependencies]) }, Number: { @@ -203,7 +203,7 @@ const StaticProperties = { 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", ["esnext.object.group-by", "es.object.create"]), + 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"]), @@ -217,11 +217,11 @@ const StaticProperties = { }, Promise: { all: define(null, PromiseDependenciesWithIterators), - allSettled: define(null, ["es.promise.all-settled", ...PromiseDependenciesWithIterators]), - any: define(null, ["es.promise.any", "es.aggregate-error", ...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(null, ["esnext.promise.try", ...PromiseDependencies]), - withResolvers: define(null, ["esnext.promise.with-resolvers", ...PromiseDependencies]) + try: define("promise/try", ["esnext.promise.try", ...PromiseDependencies]), + withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies]) }, Reflect: { apply: define("reflect/apply", ["es.reflect.apply"]), @@ -299,15 +299,19 @@ const StaticProperties = { from: define(null, ["esnext.weak-set.from", ...WeakSetDependencies]), of: define(null, ["esnext.weak-set.of", ...WeakSetDependencies]) }, - Int8Array: TypedArrayStaticMethods, - Uint8Array: TypedArrayStaticMethods, - Uint8ClampedArray: TypedArrayStaticMethods, - Int16Array: TypedArrayStaticMethods, - Uint16Array: TypedArrayStaticMethods, - Int32Array: TypedArrayStaticMethods, - Uint32Array: TypedArrayStaticMethods, - Float32Array: TypedArrayStaticMethods, - Float64Array: TypedArrayStaticMethods, + Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"), + Uint8Array: { + fromBase64: define(null, ["esnext.uint8-array.from-base64", ...TypedArrayDependencies]), + fromHex: define(null, ["esnext.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), @@ -418,7 +422,7 @@ const InstanceProperties = { 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", "web.url.to-json"]), + 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"]), @@ -442,6 +446,13 @@ const InstanceProperties = { ["__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; @@ -517,7 +528,7 @@ var index = defineProvider(function ({ babel }, { version = 3, - proposals, + proposals: proposals$1, shippedProposals, [presetEnvCompat]: { noRuntimeName = false @@ -540,7 +551,7 @@ var index = defineProvider(function ({ function maybeInjectGlobalImpl(name, utils) { if (shouldInjectPolyfill(name)) { debug(name); - utils.injectGlobalImport(coreJSModule(name)); + utils.injectGlobalImport(coreJSModule(name), name); return true; } return false; @@ -560,11 +571,14 @@ var index = defineProvider(function ({ name } = desc; let useProposalBase = false; - if (proposals || shippedProposals && name.startsWith("esnext.")) { + 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); } @@ -584,7 +598,7 @@ var index = defineProvider(function ({ polyfills: corejs3Polyfills, filterPolyfills(name) { if (!available.has(name)) return false; - if (proposals || method === "entry-global") return true; + if (proposals$1 || method === "entry-global") return true; if (shippedProposals && corejs3ShippedProposalsList.has(name)) { return true; } @@ -622,6 +636,7 @@ var index = defineProvider(function ({ 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") { |
