1 | import corejs3Polyfills from '../core-js-compat/data.js';
|
---|
2 | import getModulesListForTargetVersion from '../core-js-compat/get-modules-list-for-target-version.js';
|
---|
3 | import * as _babel from '@babel/core';
|
---|
4 | import corejsEntries from '../core-js-compat/entries.js';
|
---|
5 | import defineProvider from '@babel/helper-define-polyfill-provider';
|
---|
6 |
|
---|
7 | // This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
|
---|
8 |
|
---|
9 | var corejs3ShippedProposalsList = new Set(["esnext.suppressed-error.constructor", "esnext.array.from-async", "esnext.array.group", "esnext.array.group-to-map", "esnext.data-view.get-float16", "esnext.data-view.set-float16", "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.math.f16round", "esnext.promise.try", "esnext.symbol.async-dispose", "esnext.symbol.dispose", "esnext.symbol.metadata"]);
|
---|
10 |
|
---|
11 | const polyfillsOrder = {};
|
---|
12 | Object.keys(corejs3Polyfills).forEach((name, index) => {
|
---|
13 | polyfillsOrder[name] = index;
|
---|
14 | });
|
---|
15 | const define = (pure, global, name = global[0], exclude) => {
|
---|
16 | return {
|
---|
17 | name,
|
---|
18 | pure,
|
---|
19 | global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
|
---|
20 | exclude
|
---|
21 | };
|
---|
22 | };
|
---|
23 | const typed = (...modules) => define(null, [...modules, ...TypedArrayDependencies]);
|
---|
24 | const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
|
---|
25 | const CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
|
---|
26 | const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
|
---|
27 | const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
|
---|
28 | const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
|
---|
29 | const SuppressedErrorDependencies = ["esnext.suppressed-error.constructor", ...ErrorDependencies];
|
---|
30 | 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"];
|
---|
31 | 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];
|
---|
32 | const PromiseDependencies = ["es.promise", "es.object.to-string"];
|
---|
33 | const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
|
---|
34 | const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
|
---|
35 | const MapDependencies = ["es.map", "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];
|
---|
36 | 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];
|
---|
37 | const WeakMapDependencies = ["es.weak-map", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
|
---|
38 | const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
|
---|
39 | const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
|
---|
40 | const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
|
---|
41 | const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
|
---|
42 | 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"];
|
---|
43 | const IteratorDependencies = ["esnext.iterator.constructor", "es.object.to-string"];
|
---|
44 | const DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
|
---|
45 | const TypedArrayStaticMethods = base => ({
|
---|
46 | from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
|
---|
47 | fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
|
---|
48 | of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
|
---|
49 | });
|
---|
50 | const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
|
---|
51 | const BuiltIns = {
|
---|
52 | 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]),
|
---|
53 | AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
|
---|
54 | AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
|
---|
55 | ArrayBuffer: define(null, ArrayBufferDependencies),
|
---|
56 | DataView: define(null, DataViewDependencies),
|
---|
57 | Date: define(null, ["es.date.to-string"]),
|
---|
58 | DOMException: define("dom-exception/index", DOMExceptionDependencies),
|
---|
59 | DisposableStack: define("disposable-stack/index", ["esnext.disposable-stack.constructor", "es.object.to-string", "esnext.iterator.dispose", ...SuppressedErrorDependencies]),
|
---|
60 | Error: define(null, ErrorDependencies),
|
---|
61 | EvalError: define(null, ErrorDependencies),
|
---|
62 | Float32Array: typed("es.typed-array.float32-array"),
|
---|
63 | Float64Array: typed("es.typed-array.float64-array"),
|
---|
64 | Int8Array: typed("es.typed-array.int8-array"),
|
---|
65 | Int16Array: typed("es.typed-array.int16-array"),
|
---|
66 | Int32Array: typed("es.typed-array.int32-array"),
|
---|
67 | Iterator: define("iterator/index", IteratorDependencies),
|
---|
68 | Uint8Array: typed("es.typed-array.uint8-array", "esnext.uint8-array.set-from-base64", "esnext.uint8-array.set-from-hex", "esnext.uint8-array.to-base64", "esnext.uint8-array.to-hex"),
|
---|
69 | Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
|
---|
70 | Uint16Array: typed("es.typed-array.uint16-array"),
|
---|
71 | Uint32Array: typed("es.typed-array.uint32-array"),
|
---|
72 | Map: define("map/index", MapDependencies),
|
---|
73 | Number: define(null, ["es.number.constructor"]),
|
---|
74 | Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
|
---|
75 | Promise: define("promise/index", PromiseDependencies),
|
---|
76 | RangeError: define(null, ErrorDependencies),
|
---|
77 | ReferenceError: define(null, ErrorDependencies),
|
---|
78 | Reflect: define(null, ["es.reflect.to-string-tag", "es.object.to-string"]),
|
---|
79 | RegExp: define(null, ["es.regexp.constructor", "es.regexp.dot-all", "es.regexp.exec", "es.regexp.sticky", "es.regexp.to-string"]),
|
---|
80 | Set: define("set/index", SetDependencies),
|
---|
81 | SuppressedError: define("suppressed-error", SuppressedErrorDependencies),
|
---|
82 | Symbol: define("symbol/index", SymbolDependencies),
|
---|
83 | SyntaxError: define(null, ErrorDependencies),
|
---|
84 | TypeError: define(null, ErrorDependencies),
|
---|
85 | URIError: define(null, ErrorDependencies),
|
---|
86 | URL: define("url/index", ["web.url", "web.url.to-json", ...URLSearchParamsDependencies]),
|
---|
87 | URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
|
---|
88 | WeakMap: define("weak-map/index", WeakMapDependencies),
|
---|
89 | WeakSet: define("weak-set/index", WeakSetDependencies),
|
---|
90 | atob: define("atob", ["web.atob", ...DOMExceptionDependencies]),
|
---|
91 | btoa: define("btoa", ["web.btoa", ...DOMExceptionDependencies]),
|
---|
92 | clearImmediate: define("clear-immediate", ["web.immediate"]),
|
---|
93 | compositeKey: define("composite-key", ["esnext.composite-key"]),
|
---|
94 | compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
|
---|
95 | escape: define("escape", ["es.escape"]),
|
---|
96 | fetch: define(null, PromiseDependencies),
|
---|
97 | globalThis: define("global-this", ["es.global-this"]),
|
---|
98 | parseFloat: define("parse-float", ["es.parse-float"]),
|
---|
99 | parseInt: define("parse-int", ["es.parse-int"]),
|
---|
100 | queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
|
---|
101 | self: define("self", ["web.self"]),
|
---|
102 | setImmediate: define("set-immediate", ["web.immediate"]),
|
---|
103 | setInterval: define("set-interval", ["web.timers"]),
|
---|
104 | setTimeout: define("set-timeout", ["web.timers"]),
|
---|
105 | structuredClone: define("structured-clone", ["web.structured-clone", ...DOMExceptionDependencies, "es.array.iterator", "es.object.keys", "es.object.to-string", "es.map", "es.set"]),
|
---|
106 | unescape: define("unescape", ["es.unescape"])
|
---|
107 | };
|
---|
108 | const StaticProperties = {
|
---|
109 | AsyncIterator: {
|
---|
110 | from: define("async-iterator/from", ["esnext.async-iterator.from", ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods, ...CommonIterators])
|
---|
111 | },
|
---|
112 | Array: {
|
---|
113 | from: define("array/from", ["es.array.from", "es.string.iterator"]),
|
---|
114 | fromAsync: define("array/from-async", ["esnext.array.from-async", ...PromiseDependenciesWithIterators]),
|
---|
115 | isArray: define("array/is-array", ["es.array.is-array"]),
|
---|
116 | isTemplateObject: define("array/is-template-object", ["esnext.array.is-template-object"]),
|
---|
117 | of: define("array/of", ["es.array.of"])
|
---|
118 | },
|
---|
119 | ArrayBuffer: {
|
---|
120 | isView: define(null, ["es.array-buffer.is-view"])
|
---|
121 | },
|
---|
122 | BigInt: {
|
---|
123 | range: define("bigint/range", ["esnext.bigint.range", "es.object.to-string"])
|
---|
124 | },
|
---|
125 | Date: {
|
---|
126 | now: define("date/now", ["es.date.now"])
|
---|
127 | },
|
---|
128 | Function: {
|
---|
129 | isCallable: define("function/is-callable", ["esnext.function.is-callable"]),
|
---|
130 | isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
|
---|
131 | },
|
---|
132 | Iterator: {
|
---|
133 | from: define("iterator/from", ["esnext.iterator.from", ...IteratorDependencies, ...CommonIterators]),
|
---|
134 | range: define("iterator/range", ["esnext.iterator.range", "es.object.to-string"])
|
---|
135 | },
|
---|
136 | JSON: {
|
---|
137 | isRawJSON: define("json/is-raw-json", ["esnext.json.is-raw-json"]),
|
---|
138 | parse: define("json/parse", ["esnext.json.parse", "es.object.keys"]),
|
---|
139 | rawJSON: define("json/raw-json", ["esnext.json.raw-json", "es.object.create", "es.object.freeze"]),
|
---|
140 | stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"], "es.symbol")
|
---|
141 | },
|
---|
142 | Math: {
|
---|
143 | DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
|
---|
144 | RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
|
---|
145 | acosh: define("math/acosh", ["es.math.acosh"]),
|
---|
146 | asinh: define("math/asinh", ["es.math.asinh"]),
|
---|
147 | atanh: define("math/atanh", ["es.math.atanh"]),
|
---|
148 | cbrt: define("math/cbrt", ["es.math.cbrt"]),
|
---|
149 | clamp: define("math/clamp", ["esnext.math.clamp"]),
|
---|
150 | clz32: define("math/clz32", ["es.math.clz32"]),
|
---|
151 | cosh: define("math/cosh", ["es.math.cosh"]),
|
---|
152 | degrees: define("math/degrees", ["esnext.math.degrees"]),
|
---|
153 | expm1: define("math/expm1", ["es.math.expm1"]),
|
---|
154 | fround: define("math/fround", ["es.math.fround"]),
|
---|
155 | f16round: define("math/f16round", ["esnext.math.f16round"]),
|
---|
156 | fscale: define("math/fscale", ["esnext.math.fscale"]),
|
---|
157 | hypot: define("math/hypot", ["es.math.hypot"]),
|
---|
158 | iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
|
---|
159 | imul: define("math/imul", ["es.math.imul"]),
|
---|
160 | imulh: define("math/imulh", ["esnext.math.imulh"]),
|
---|
161 | isubh: define("math/isubh", ["esnext.math.isubh"]),
|
---|
162 | log10: define("math/log10", ["es.math.log10"]),
|
---|
163 | log1p: define("math/log1p", ["es.math.log1p"]),
|
---|
164 | log2: define("math/log2", ["es.math.log2"]),
|
---|
165 | radians: define("math/radians", ["esnext.math.radians"]),
|
---|
166 | scale: define("math/scale", ["esnext.math.scale"]),
|
---|
167 | seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
|
---|
168 | sign: define("math/sign", ["es.math.sign"]),
|
---|
169 | signbit: define("math/signbit", ["esnext.math.signbit"]),
|
---|
170 | sinh: define("math/sinh", ["es.math.sinh"]),
|
---|
171 | sumPrecise: define("math/sum-precise", ["esnext.math.sum-precise", "es.array.iterator"]),
|
---|
172 | tanh: define("math/tanh", ["es.math.tanh"]),
|
---|
173 | trunc: define("math/trunc", ["es.math.trunc"]),
|
---|
174 | umulh: define("math/umulh", ["esnext.math.umulh"])
|
---|
175 | },
|
---|
176 | Map: {
|
---|
177 | from: define("map/from", ["esnext.map.from", ...MapDependencies]),
|
---|
178 | groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
|
---|
179 | keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
|
---|
180 | of: define("map/of", ["esnext.map.of", ...MapDependencies])
|
---|
181 | },
|
---|
182 | Number: {
|
---|
183 | EPSILON: define("number/epsilon", ["es.number.epsilon"]),
|
---|
184 | MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
|
---|
185 | MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
|
---|
186 | fromString: define("number/from-string", ["esnext.number.from-string"]),
|
---|
187 | isFinite: define("number/is-finite", ["es.number.is-finite"]),
|
---|
188 | isInteger: define("number/is-integer", ["es.number.is-integer"]),
|
---|
189 | isNaN: define("number/is-nan", ["es.number.is-nan"]),
|
---|
190 | isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
|
---|
191 | parseFloat: define("number/parse-float", ["es.number.parse-float"]),
|
---|
192 | parseInt: define("number/parse-int", ["es.number.parse-int"]),
|
---|
193 | range: define("number/range", ["esnext.number.range", "es.object.to-string"])
|
---|
194 | },
|
---|
195 | Object: {
|
---|
196 | assign: define("object/assign", ["es.object.assign"]),
|
---|
197 | create: define("object/create", ["es.object.create"]),
|
---|
198 | defineProperties: define("object/define-properties", ["es.object.define-properties"]),
|
---|
199 | defineProperty: define("object/define-property", ["es.object.define-property"]),
|
---|
200 | entries: define("object/entries", ["es.object.entries"]),
|
---|
201 | freeze: define("object/freeze", ["es.object.freeze"]),
|
---|
202 | fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
|
---|
203 | getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
|
---|
204 | getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
|
---|
205 | getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
|
---|
206 | getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
|
---|
207 | getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
|
---|
208 | groupBy: define("object/group-by", ["es.object.group-by", "es.object.create"]),
|
---|
209 | hasOwn: define("object/has-own", ["es.object.has-own"]),
|
---|
210 | is: define("object/is", ["es.object.is"]),
|
---|
211 | isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
|
---|
212 | isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
|
---|
213 | isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
|
---|
214 | keys: define("object/keys", ["es.object.keys"]),
|
---|
215 | preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
|
---|
216 | seal: define("object/seal", ["es.object.seal"]),
|
---|
217 | setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
|
---|
218 | values: define("object/values", ["es.object.values"])
|
---|
219 | },
|
---|
220 | Promise: {
|
---|
221 | all: define(null, PromiseDependenciesWithIterators),
|
---|
222 | allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
|
---|
223 | any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
|
---|
224 | race: define(null, PromiseDependenciesWithIterators),
|
---|
225 | try: define("promise/try", ["esnext.promise.try", ...PromiseDependencies]),
|
---|
226 | withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
|
---|
227 | },
|
---|
228 | Reflect: {
|
---|
229 | apply: define("reflect/apply", ["es.reflect.apply"]),
|
---|
230 | construct: define("reflect/construct", ["es.reflect.construct"]),
|
---|
231 | defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
|
---|
232 | defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
|
---|
233 | deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
|
---|
234 | deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
|
---|
235 | get: define("reflect/get", ["es.reflect.get"]),
|
---|
236 | getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
|
---|
237 | getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
|
---|
238 | getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
|
---|
239 | getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
|
---|
240 | getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
|
---|
241 | getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
|
---|
242 | has: define("reflect/has", ["es.reflect.has"]),
|
---|
243 | hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
|
---|
244 | hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
|
---|
245 | isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
|
---|
246 | metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
|
---|
247 | ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
|
---|
248 | preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
|
---|
249 | set: define("reflect/set", ["es.reflect.set"]),
|
---|
250 | setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
|
---|
251 | },
|
---|
252 | RegExp: {
|
---|
253 | escape: define("regexp/escape", ["esnext.regexp.escape"])
|
---|
254 | },
|
---|
255 | Set: {
|
---|
256 | from: define("set/from", ["esnext.set.from", ...SetDependencies]),
|
---|
257 | of: define("set/of", ["esnext.set.of", ...SetDependencies])
|
---|
258 | },
|
---|
259 | String: {
|
---|
260 | cooked: define("string/cooked", ["esnext.string.cooked"]),
|
---|
261 | dedent: define("string/dedent", ["esnext.string.dedent", "es.string.from-code-point", "es.weak-map"]),
|
---|
262 | fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
|
---|
263 | raw: define("string/raw", ["es.string.raw"])
|
---|
264 | },
|
---|
265 | Symbol: {
|
---|
266 | asyncDispose: define("symbol/async-dispose", ["esnext.symbol.async-dispose", "esnext.async-iterator.async-dispose"]),
|
---|
267 | asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
|
---|
268 | customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
|
---|
269 | dispose: define("symbol/dispose", ["esnext.symbol.dispose", "esnext.iterator.dispose"]),
|
---|
270 | for: define("symbol/for", [], "es.symbol"),
|
---|
271 | hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
|
---|
272 | isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
|
---|
273 | isRegistered: define("symbol/is-registered", ["esnext.symbol.is-registered", "es.symbol"]),
|
---|
274 | isRegisteredSymbol: define("symbol/is-registered-symbol", ["esnext.symbol.is-registered-symbol", "es.symbol"]),
|
---|
275 | isWellKnown: define("symbol/is-well-known", ["esnext.symbol.is-well-known", "es.symbol"]),
|
---|
276 | isWellKnownSymbol: define("symbol/is-well-known-symbol", ["esnext.symbol.is-well-known-symbol", "es.symbol"]),
|
---|
277 | iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
|
---|
278 | keyFor: define("symbol/key-for", [], "es.symbol"),
|
---|
279 | match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
|
---|
280 | matcher: define("symbol/matcher", ["esnext.symbol.matcher"]),
|
---|
281 | matchAll: define("symbol/match-all", ["es.symbol.match-all", "es.string.match-all"]),
|
---|
282 | metadata: define("symbol/metadata", DecoratorMetadataDependencies),
|
---|
283 | metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
|
---|
284 | observable: define("symbol/observable", ["esnext.symbol.observable"]),
|
---|
285 | patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
|
---|
286 | replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
|
---|
287 | search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
|
---|
288 | species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
|
---|
289 | split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
|
---|
290 | toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
|
---|
291 | 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"]),
|
---|
292 | unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
|
---|
293 | },
|
---|
294 | URL: {
|
---|
295 | canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
|
---|
296 | parse: define("url/parse", ["web.url.parse", "web.url"])
|
---|
297 | },
|
---|
298 | WeakMap: {
|
---|
299 | from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
|
---|
300 | of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
|
---|
301 | },
|
---|
302 | WeakSet: {
|
---|
303 | from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
|
---|
304 | of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
|
---|
305 | },
|
---|
306 | Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
|
---|
307 | Uint8Array: {
|
---|
308 | fromBase64: define(null, ["esnext.uint8-array.from-base64", ...TypedArrayDependencies]),
|
---|
309 | fromHex: define(null, ["esnext.uint8-array.from-hex", ...TypedArrayDependencies]),
|
---|
310 | ...TypedArrayStaticMethods("es.typed-array.uint8-array")
|
---|
311 | },
|
---|
312 | Uint8ClampedArray: TypedArrayStaticMethods("es.typed-array.uint8-clamped-array"),
|
---|
313 | Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
|
---|
314 | Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
|
---|
315 | Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
|
---|
316 | Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
|
---|
317 | Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
|
---|
318 | Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),
|
---|
319 | WebAssembly: {
|
---|
320 | CompileError: define(null, ErrorDependencies),
|
---|
321 | LinkError: define(null, ErrorDependencies),
|
---|
322 | RuntimeError: define(null, ErrorDependencies)
|
---|
323 | }
|
---|
324 | };
|
---|
325 | const InstanceProperties = {
|
---|
326 | asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
|
---|
327 | at: define("instance/at", [
|
---|
328 | // TODO: We should introduce overloaded instance methods definition
|
---|
329 | // Before that is implemented, the `esnext.string.at` must be the first
|
---|
330 | // In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
|
---|
331 | // and treats the compat-data of `esnext.string.at` as the compat-data of
|
---|
332 | // pure import `instance/at`. The first polyfill here should have the lowest corejs
|
---|
333 | // supported versions.
|
---|
334 | "esnext.string.at", "es.string.at-alternative", "es.array.at"]),
|
---|
335 | anchor: define(null, ["es.string.anchor"]),
|
---|
336 | big: define(null, ["es.string.big"]),
|
---|
337 | bind: define("instance/bind", ["es.function.bind"]),
|
---|
338 | blink: define(null, ["es.string.blink"]),
|
---|
339 | bold: define(null, ["es.string.bold"]),
|
---|
340 | codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
|
---|
341 | codePoints: define("instance/code-points", ["esnext.string.code-points"]),
|
---|
342 | concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
|
---|
343 | copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
|
---|
344 | demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
|
---|
345 | description: define(null, ["es.symbol", "es.symbol.description"]),
|
---|
346 | dotAll: define(null, ["es.regexp.dot-all"]),
|
---|
347 | drop: define(null, ["esnext.async-iterator.drop", ...AsyncIteratorDependencies, "esnext.iterator.drop", ...IteratorDependencies]),
|
---|
348 | emplace: define("instance/emplace", ["esnext.map.emplace", "esnext.weak-map.emplace"]),
|
---|
349 | endsWith: define("instance/ends-with", ["es.string.ends-with"]),
|
---|
350 | entries: define("instance/entries", ArrayNatureIteratorsWithTag),
|
---|
351 | every: define("instance/every", ["es.array.every", "esnext.async-iterator.every",
|
---|
352 | // TODO: add async iterator dependencies when we support sub-dependencies
|
---|
353 | // esnext.async-iterator.every depends on es.promise
|
---|
354 | // but we don't want to pull es.promise when esnext.async-iterator is disabled
|
---|
355 | //
|
---|
356 | // ...AsyncIteratorDependencies
|
---|
357 | "esnext.iterator.every", ...IteratorDependencies]),
|
---|
358 | exec: define(null, ["es.regexp.exec"]),
|
---|
359 | fill: define("instance/fill", ["es.array.fill"]),
|
---|
360 | filter: define("instance/filter", ["es.array.filter", "esnext.async-iterator.filter", "esnext.iterator.filter", ...IteratorDependencies]),
|
---|
361 | filterReject: define("instance/filterReject", ["esnext.array.filter-reject"]),
|
---|
362 | finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
|
---|
363 | find: define("instance/find", ["es.array.find", "esnext.async-iterator.find", "esnext.iterator.find", ...IteratorDependencies]),
|
---|
364 | findIndex: define("instance/find-index", ["es.array.find-index"]),
|
---|
365 | findLast: define("instance/find-last", ["es.array.find-last"]),
|
---|
366 | findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
|
---|
367 | fixed: define(null, ["es.string.fixed"]),
|
---|
368 | flags: define("instance/flags", ["es.regexp.flags"]),
|
---|
369 | flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "esnext.async-iterator.flat-map", "esnext.iterator.flat-map", ...IteratorDependencies]),
|
---|
370 | flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
|
---|
371 | getFloat16: define(null, ["esnext.data-view.get-float16", ...DataViewDependencies]),
|
---|
372 | getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
|
---|
373 | getYear: define(null, ["es.date.get-year"]),
|
---|
374 | group: define("instance/group", ["esnext.array.group"]),
|
---|
375 | groupBy: define("instance/group-by", ["esnext.array.group-by"]),
|
---|
376 | groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
|
---|
377 | groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
|
---|
378 | fontcolor: define(null, ["es.string.fontcolor"]),
|
---|
379 | fontsize: define(null, ["es.string.fontsize"]),
|
---|
380 | forEach: define("instance/for-each", ["es.array.for-each", "esnext.async-iterator.for-each", "esnext.iterator.for-each", ...IteratorDependencies, "web.dom-collections.for-each"]),
|
---|
381 | includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
|
---|
382 | indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
|
---|
383 | indexOf: define("instance/index-of", ["es.array.index-of"]),
|
---|
384 | isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
|
---|
385 | italic: define(null, ["es.string.italics"]),
|
---|
386 | join: define(null, ["es.array.join"]),
|
---|
387 | keys: define("instance/keys", ArrayNatureIteratorsWithTag),
|
---|
388 | lastIndex: define(null, ["esnext.array.last-index"]),
|
---|
389 | lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
|
---|
390 | lastItem: define(null, ["esnext.array.last-item"]),
|
---|
391 | link: define(null, ["es.string.link"]),
|
---|
392 | map: define("instance/map", ["es.array.map", "esnext.async-iterator.map", "esnext.iterator.map"]),
|
---|
393 | match: define(null, ["es.string.match", "es.regexp.exec"]),
|
---|
394 | matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
|
---|
395 | name: define(null, ["es.function.name"]),
|
---|
396 | padEnd: define("instance/pad-end", ["es.string.pad-end"]),
|
---|
397 | padStart: define("instance/pad-start", ["es.string.pad-start"]),
|
---|
398 | push: define("instance/push", ["es.array.push"]),
|
---|
399 | reduce: define("instance/reduce", ["es.array.reduce", "esnext.async-iterator.reduce", "esnext.iterator.reduce", ...IteratorDependencies]),
|
---|
400 | reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
|
---|
401 | repeat: define("instance/repeat", ["es.string.repeat"]),
|
---|
402 | replace: define(null, ["es.string.replace", "es.regexp.exec"]),
|
---|
403 | replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
|
---|
404 | reverse: define("instance/reverse", ["es.array.reverse"]),
|
---|
405 | search: define(null, ["es.string.search", "es.regexp.exec"]),
|
---|
406 | setFloat16: define(null, ["esnext.data-view.set-float16", ...DataViewDependencies]),
|
---|
407 | setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
|
---|
408 | setYear: define(null, ["es.date.set-year"]),
|
---|
409 | slice: define("instance/slice", ["es.array.slice"]),
|
---|
410 | small: define(null, ["es.string.small"]),
|
---|
411 | some: define("instance/some", ["es.array.some", "esnext.async-iterator.some", "esnext.iterator.some", ...IteratorDependencies]),
|
---|
412 | sort: define("instance/sort", ["es.array.sort"]),
|
---|
413 | splice: define("instance/splice", ["es.array.splice"]),
|
---|
414 | split: define(null, ["es.string.split", "es.regexp.exec"]),
|
---|
415 | startsWith: define("instance/starts-with", ["es.string.starts-with"]),
|
---|
416 | sticky: define(null, ["es.regexp.sticky"]),
|
---|
417 | strike: define(null, ["es.string.strike"]),
|
---|
418 | sub: define(null, ["es.string.sub"]),
|
---|
419 | substr: define(null, ["es.string.substr"]),
|
---|
420 | sup: define(null, ["es.string.sup"]),
|
---|
421 | take: define(null, ["esnext.async-iterator.take", ...AsyncIteratorDependencies, "esnext.iterator.take", ...IteratorDependencies]),
|
---|
422 | test: define(null, ["es.regexp.test", "es.regexp.exec"]),
|
---|
423 | toArray: define(null, ["esnext.async-iterator.to-array", ...AsyncIteratorDependencies, "esnext.iterator.to-array", ...IteratorDependencies]),
|
---|
424 | toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
|
---|
425 | toExponential: define(null, ["es.number.to-exponential"]),
|
---|
426 | toFixed: define(null, ["es.number.to-fixed"]),
|
---|
427 | toGMTString: define(null, ["es.date.to-gmt-string"]),
|
---|
428 | toISOString: define(null, ["es.date.to-iso-string"]),
|
---|
429 | toJSON: define(null, ["es.date.to-json"]),
|
---|
430 | toPrecision: define(null, ["es.number.to-precision"]),
|
---|
431 | toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
|
---|
432 | toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
|
---|
433 | toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
|
---|
434 | toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
|
---|
435 | toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
|
---|
436 | trim: define("instance/trim", ["es.string.trim"]),
|
---|
437 | trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
|
---|
438 | trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
|
---|
439 | trimRight: define("instance/trim-right", ["es.string.trim-end"]),
|
---|
440 | trimStart: define("instance/trim-start", ["es.string.trim-start"]),
|
---|
441 | uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
|
---|
442 | unshift: define("instance/unshift", ["es.array.unshift"]),
|
---|
443 | unThis: define("instance/un-this", ["esnext.function.un-this"]),
|
---|
444 | values: define("instance/values", ArrayNatureIteratorsWithTag),
|
---|
445 | with: define("instance/with", ["es.array.with"]),
|
---|
446 | __defineGetter__: define(null, ["es.object.define-getter"]),
|
---|
447 | __defineSetter__: define(null, ["es.object.define-setter"]),
|
---|
448 | __lookupGetter__: define(null, ["es.object.lookup-getter"]),
|
---|
449 | __lookupSetter__: define(null, ["es.object.lookup-setter"]),
|
---|
450 | ["__proto__"]: define(null, ["es.object.proto"])
|
---|
451 | };
|
---|
452 |
|
---|
453 | // This file contains the list of paths supported by @babel/runtime-corejs3.
|
---|
454 | // It must _not_ be edited, as all new features should go through direct
|
---|
455 | // injection of core-js-pure imports.
|
---|
456 |
|
---|
457 | 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"]);
|
---|
458 | 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"]);
|
---|
459 |
|
---|
460 | const {
|
---|
461 | types: t$2
|
---|
462 | } = _babel.default || _babel;
|
---|
463 | function canSkipPolyfill(desc, path) {
|
---|
464 | const {
|
---|
465 | node,
|
---|
466 | parent
|
---|
467 | } = path;
|
---|
468 | switch (desc.name) {
|
---|
469 | case "es.string.split":
|
---|
470 | {
|
---|
471 | if (!t$2.isCallExpression(parent, {
|
---|
472 | callee: node
|
---|
473 | })) return false;
|
---|
474 | if (parent.arguments.length < 1) return true;
|
---|
475 | const splitter = parent.arguments[0];
|
---|
476 | return t$2.isStringLiteral(splitter) || t$2.isTemplateLiteral(splitter);
|
---|
477 | }
|
---|
478 | }
|
---|
479 | }
|
---|
480 |
|
---|
481 | const {
|
---|
482 | types: t$1
|
---|
483 | } = _babel.default || _babel;
|
---|
484 | const BABEL_RUNTIME = "@babel/runtime-corejs3";
|
---|
485 | function callMethod(path, id) {
|
---|
486 | const {
|
---|
487 | object
|
---|
488 | } = path.node;
|
---|
489 | let context1, context2;
|
---|
490 | if (t$1.isIdentifier(object)) {
|
---|
491 | context1 = object;
|
---|
492 | context2 = t$1.cloneNode(object);
|
---|
493 | } else {
|
---|
494 | context1 = path.scope.generateDeclaredUidIdentifier("context");
|
---|
495 | context2 = t$1.assignmentExpression("=", t$1.cloneNode(context1), object);
|
---|
496 | }
|
---|
497 | path.replaceWith(t$1.memberExpression(t$1.callExpression(id, [context2]), t$1.identifier("call")));
|
---|
498 | path.parentPath.unshiftContainer("arguments", context1);
|
---|
499 | }
|
---|
500 | function isCoreJSSource(source) {
|
---|
501 | if (typeof source === "string") {
|
---|
502 | source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
|
---|
503 | }
|
---|
504 | return Object.prototype.hasOwnProperty.call(corejsEntries, source) && corejsEntries[source];
|
---|
505 | }
|
---|
506 | function coreJSModule(name) {
|
---|
507 | return `core-js/modules/${name}.js`;
|
---|
508 | }
|
---|
509 | function coreJSPureHelper(name, useBabelRuntime, ext) {
|
---|
510 | return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
|
---|
511 | }
|
---|
512 |
|
---|
513 | const {
|
---|
514 | types: t
|
---|
515 | } = _babel.default || _babel;
|
---|
516 | const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
|
---|
517 | const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
|
---|
518 | const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
|
---|
519 | const esnextFallback = (name, cb) => {
|
---|
520 | if (cb(name)) return true;
|
---|
521 | if (!name.startsWith("es.")) return false;
|
---|
522 | const fallback = `esnext.${name.slice(3)}`;
|
---|
523 | if (!corejs3Polyfills[fallback]) return false;
|
---|
524 | return cb(fallback);
|
---|
525 | };
|
---|
526 | var index = defineProvider(function ({
|
---|
527 | getUtils,
|
---|
528 | method,
|
---|
529 | shouldInjectPolyfill,
|
---|
530 | createMetaResolver,
|
---|
531 | debug,
|
---|
532 | babel
|
---|
533 | }, {
|
---|
534 | version = 3,
|
---|
535 | proposals: proposals$1,
|
---|
536 | shippedProposals,
|
---|
537 | [presetEnvCompat]: {
|
---|
538 | noRuntimeName = false
|
---|
539 | } = {},
|
---|
540 | [runtimeCompat]: {
|
---|
541 | useBabelRuntime = false,
|
---|
542 | ext = ".js"
|
---|
543 | } = {}
|
---|
544 | }) {
|
---|
545 | const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
|
---|
546 | const resolve = createMetaResolver({
|
---|
547 | global: BuiltIns,
|
---|
548 | static: StaticProperties,
|
---|
549 | instance: InstanceProperties
|
---|
550 | });
|
---|
551 | const available = new Set(getModulesListForTargetVersion(version));
|
---|
552 | function getCoreJSPureBase(useProposalBase) {
|
---|
553 | return useBabelRuntime ? useProposalBase ? `${BABEL_RUNTIME}/core-js` : `${BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
|
---|
554 | }
|
---|
555 | function maybeInjectGlobalImpl(name, utils) {
|
---|
556 | if (shouldInjectPolyfill(name)) {
|
---|
557 | debug(name);
|
---|
558 | utils.injectGlobalImport(coreJSModule(name), name);
|
---|
559 | return true;
|
---|
560 | }
|
---|
561 | return false;
|
---|
562 | }
|
---|
563 | function maybeInjectGlobal(names, utils, fallback = true) {
|
---|
564 | for (const name of names) {
|
---|
565 | if (fallback) {
|
---|
566 | esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
|
---|
567 | } else {
|
---|
568 | maybeInjectGlobalImpl(name, utils);
|
---|
569 | }
|
---|
570 | }
|
---|
571 | }
|
---|
572 | function maybeInjectPure(desc, hint, utils, object) {
|
---|
573 | if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
|
---|
574 | const {
|
---|
575 | name
|
---|
576 | } = desc;
|
---|
577 | let useProposalBase = false;
|
---|
578 | if (proposals$1 || shippedProposals && name.startsWith("esnext.")) {
|
---|
579 | useProposalBase = true;
|
---|
580 | } else if (name.startsWith("es.") && !available.has(name)) {
|
---|
581 | useProposalBase = true;
|
---|
582 | }
|
---|
583 | if (useBabelRuntime && !(useProposalBase ? proposals : stable).has(desc.pure)) {
|
---|
584 | return;
|
---|
585 | }
|
---|
586 | const coreJSPureBase = getCoreJSPureBase(useProposalBase);
|
---|
587 | return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
|
---|
588 | }
|
---|
589 | }
|
---|
590 | function isFeatureStable(name) {
|
---|
591 | if (name.startsWith("esnext.")) {
|
---|
592 | const esName = `es.${name.slice(7)}`;
|
---|
593 | // If its imaginative esName is not in latest compat data, it means
|
---|
594 | // the proposal is not stage 4
|
---|
595 | return esName in corejs3Polyfills;
|
---|
596 | }
|
---|
597 | return true;
|
---|
598 | }
|
---|
599 | return {
|
---|
600 | name: "corejs3",
|
---|
601 | runtimeName: noRuntimeName ? null : BABEL_RUNTIME,
|
---|
602 | polyfills: corejs3Polyfills,
|
---|
603 | filterPolyfills(name) {
|
---|
604 | if (!available.has(name)) return false;
|
---|
605 | if (proposals$1 || method === "entry-global") return true;
|
---|
606 | if (shippedProposals && corejs3ShippedProposalsList.has(name)) {
|
---|
607 | return true;
|
---|
608 | }
|
---|
609 | return isFeatureStable(name);
|
---|
610 | },
|
---|
611 | entryGlobal(meta, utils, path) {
|
---|
612 | if (meta.kind !== "import") return;
|
---|
613 | const modules = isCoreJSSource(meta.source);
|
---|
614 | if (!modules) return;
|
---|
615 | if (modules.length === 1 && meta.source === coreJSModule(modules[0]) && shouldInjectPolyfill(modules[0])) {
|
---|
616 | // Avoid infinite loop: do not replace imports with a new copy of
|
---|
617 | // themselves.
|
---|
618 | debug(null);
|
---|
619 | return;
|
---|
620 | }
|
---|
621 | const modulesSet = new Set(modules);
|
---|
622 | const filteredModules = modules.filter(module => {
|
---|
623 | if (!module.startsWith("esnext.")) return true;
|
---|
624 | const stable = module.replace("esnext.", "es.");
|
---|
625 | if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
|
---|
626 | return false;
|
---|
627 | }
|
---|
628 | return true;
|
---|
629 | });
|
---|
630 | maybeInjectGlobal(filteredModules, utils, false);
|
---|
631 | path.remove();
|
---|
632 | },
|
---|
633 | usageGlobal(meta, utils, path) {
|
---|
634 | const resolved = resolve(meta);
|
---|
635 | if (!resolved) return;
|
---|
636 | if (canSkipPolyfill(resolved.desc, path)) return;
|
---|
637 | let deps = resolved.desc.global;
|
---|
638 | if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
|
---|
639 | const low = meta.object.toLowerCase();
|
---|
640 | deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
|
---|
641 | }
|
---|
642 | maybeInjectGlobal(deps, utils);
|
---|
643 | return true;
|
---|
644 | },
|
---|
645 | usagePure(meta, utils, path) {
|
---|
646 | if (meta.kind === "in") {
|
---|
647 | if (meta.key === "Symbol.iterator") {
|
---|
648 | path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
|
---|
649 | ));
|
---|
650 | }
|
---|
651 |
|
---|
652 | return;
|
---|
653 | }
|
---|
654 | if (path.parentPath.isUnaryExpression({
|
---|
655 | operator: "delete"
|
---|
656 | })) return;
|
---|
657 | if (meta.kind === "property") {
|
---|
658 | // We can't compile destructuring and updateExpression.
|
---|
659 | if (!path.isMemberExpression()) return;
|
---|
660 | if (!path.isReferenced()) return;
|
---|
661 | if (path.parentPath.isUpdateExpression()) return;
|
---|
662 | if (t.isSuper(path.node.object)) {
|
---|
663 | return;
|
---|
664 | }
|
---|
665 | if (meta.key === "Symbol.iterator") {
|
---|
666 | if (!shouldInjectPolyfill("es.symbol.iterator")) return;
|
---|
667 | const {
|
---|
668 | parent,
|
---|
669 | node
|
---|
670 | } = path;
|
---|
671 | if (t.isCallExpression(parent, {
|
---|
672 | callee: node
|
---|
673 | })) {
|
---|
674 | if (parent.arguments.length === 0) {
|
---|
675 | path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
|
---|
676 | path.skip();
|
---|
677 | } else {
|
---|
678 | callMethod(path, utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
|
---|
679 | }
|
---|
680 | } else {
|
---|
681 | path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
|
---|
682 | }
|
---|
683 | return;
|
---|
684 | }
|
---|
685 | }
|
---|
686 | let resolved = resolve(meta);
|
---|
687 | if (!resolved) return;
|
---|
688 | if (canSkipPolyfill(resolved.desc, path)) return;
|
---|
689 | if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
|
---|
690 | // Remove /index, since it doesn't exist in @babel/runtime-corejs3s
|
---|
691 | resolved = {
|
---|
692 | ...resolved,
|
---|
693 | desc: {
|
---|
694 | ...resolved.desc,
|
---|
695 | pure: resolved.desc.pure.slice(0, -6)
|
---|
696 | }
|
---|
697 | };
|
---|
698 | }
|
---|
699 | if (resolved.kind === "global") {
|
---|
700 | const id = maybeInjectPure(resolved.desc, resolved.name, utils);
|
---|
701 | if (id) path.replaceWith(id);
|
---|
702 | } else if (resolved.kind === "static") {
|
---|
703 | const id = maybeInjectPure(resolved.desc, resolved.name, utils,
|
---|
704 | // @ts-expect-error
|
---|
705 | meta.object);
|
---|
706 | if (id) path.replaceWith(id);
|
---|
707 | } else if (resolved.kind === "instance") {
|
---|
708 | const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
|
---|
709 | // @ts-expect-error
|
---|
710 | meta.object);
|
---|
711 | if (!id) return;
|
---|
712 | const {
|
---|
713 | node
|
---|
714 | } = path;
|
---|
715 | if (t.isCallExpression(path.parent, {
|
---|
716 | callee: node
|
---|
717 | })) {
|
---|
718 | callMethod(path, id);
|
---|
719 | } else {
|
---|
720 | path.replaceWith(t.callExpression(id, [node.object]));
|
---|
721 | }
|
---|
722 | }
|
---|
723 | },
|
---|
724 | visitor: method === "usage-global" && {
|
---|
725 | // import("foo")
|
---|
726 | CallExpression(path) {
|
---|
727 | if (path.get("callee").isImport()) {
|
---|
728 | const utils = getUtils(path);
|
---|
729 | if (isWebpack) {
|
---|
730 | // Webpack uses Promise.all to handle dynamic import.
|
---|
731 | maybeInjectGlobal(PromiseDependenciesWithIterators, utils);
|
---|
732 | } else {
|
---|
733 | maybeInjectGlobal(PromiseDependencies, utils);
|
---|
734 | }
|
---|
735 | }
|
---|
736 | },
|
---|
737 | // (async function () { }).finally(...)
|
---|
738 | Function(path) {
|
---|
739 | if (path.node.async) {
|
---|
740 | maybeInjectGlobal(PromiseDependencies, getUtils(path));
|
---|
741 | }
|
---|
742 | },
|
---|
743 | // for-of, [a, b] = c
|
---|
744 | "ForOfStatement|ArrayPattern"(path) {
|
---|
745 | maybeInjectGlobal(CommonIterators, getUtils(path));
|
---|
746 | },
|
---|
747 | // [...spread]
|
---|
748 | SpreadElement(path) {
|
---|
749 | if (!path.parentPath.isObjectExpression()) {
|
---|
750 | maybeInjectGlobal(CommonIterators, getUtils(path));
|
---|
751 | }
|
---|
752 | },
|
---|
753 | // yield*
|
---|
754 | YieldExpression(path) {
|
---|
755 | if (path.node.delegate) {
|
---|
756 | maybeInjectGlobal(CommonIterators, getUtils(path));
|
---|
757 | }
|
---|
758 | },
|
---|
759 | // Decorators metadata
|
---|
760 | Class(path) {
|
---|
761 | var _path$node$decorators;
|
---|
762 | const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
|
---|
763 | var _decorators;
|
---|
764 | return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
|
---|
765 | });
|
---|
766 | if (hasDecorators) {
|
---|
767 | maybeInjectGlobal(DecoratorMetadataDependencies, getUtils(path));
|
---|
768 | }
|
---|
769 | }
|
---|
770 | }
|
---|
771 | };
|
---|
772 | });
|
---|
773 |
|
---|
774 | export default index;
|
---|
775 | //# sourceMappingURL=index.mjs.map
|
---|