index.mjs 42 KB

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