index.mjs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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.map.group-by", "esnext.object.group-by", "esnext.promise.with-resolvers", "esnext.set.difference.v2", "esnext.set.intersection.v2", "esnext.set.is-disjoint-from.v2", "esnext.set.is-subset-of.v2", "esnext.set.is-superset-of.v2", "esnext.set.symmetric-difference.v2", "esnext.set.union.v2", "esnext.symbol.async-dispose", "esnext.symbol.dispose"]);
  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 = name => define(null, [name, ...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"]),
  43. fromAsync: define(null, ["esnext.typed-array.from-async", ...PromiseDependenciesWithIterators]),
  44. of: define(null, ["es.typed-array.of"])
  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"),
  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, ["esnext.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", ["esnext.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, ["esnext.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: TypedArrayStaticMethods,
  301. Uint8ClampedArray: TypedArrayStaticMethods,
  302. Int16Array: TypedArrayStaticMethods,
  303. Uint16Array: TypedArrayStaticMethods,
  304. Int32Array: TypedArrayStaticMethods,
  305. Uint32Array: TypedArrayStaticMethods,
  306. Float32Array: TypedArrayStaticMethods,
  307. Float64Array: TypedArrayStaticMethods,
  308. WebAssembly: {
  309. CompileError: define(null, ErrorDependencies),
  310. LinkError: define(null, ErrorDependencies),
  311. RuntimeError: define(null, ErrorDependencies)
  312. }
  313. };
  314. const InstanceProperties = {
  315. asIndexedPairs: define("instance/asIndexedPairs", ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
  316. at: define("instance/at", [
  317. // TODO: We should introduce overloaded instance methods definition
  318. // Before that is implemented, the `esnext.string.at` must be the first
  319. // In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
  320. // and treats the compat-data of `esnext.string.at` as the compat-data of
  321. // pure import `instance/at`. The first polyfill here should have the lowest corejs
  322. // supported versions.
  323. "esnext.string.at", "es.string.at-alternative", "es.array.at"]),
  324. anchor: define(null, ["es.string.anchor"]),
  325. big: define(null, ["es.string.big"]),
  326. bind: define("instance/bind", ["es.function.bind"]),
  327. blink: define(null, ["es.string.blink"]),
  328. bold: define(null, ["es.string.bold"]),
  329. codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
  330. codePoints: define("instance/code-points", ["esnext.string.code-points"]),
  331. concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
  332. copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
  333. demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
  334. description: define(null, ["es.symbol", "es.symbol.description"]),
  335. dotAll: define(null, ["es.regexp.dot-all"]),
  336. drop: define(null, ["esnext.async-iterator.drop", ...AsyncIteratorDependencies, "esnext.iterator.drop", ...IteratorDependencies]),
  337. emplace: define("instance/emplace", ["esnext.map.emplace", "esnext.weak-map.emplace"]),
  338. endsWith: define("instance/ends-with", ["es.string.ends-with"]),
  339. entries: define("instance/entries", ArrayNatureIteratorsWithTag),
  340. every: define("instance/every", ["es.array.every", "esnext.async-iterator.every",
  341. // TODO: add async iterator dependencies when we support sub-dependencies
  342. // esnext.async-iterator.every depends on es.promise
  343. // but we don't want to pull es.promise when esnext.async-iterator is disabled
  344. //
  345. // ...AsyncIteratorDependencies
  346. "esnext.iterator.every", ...IteratorDependencies]),
  347. exec: define(null, ["es.regexp.exec"]),
  348. fill: define("instance/fill", ["es.array.fill"]),
  349. filter: define("instance/filter", ["es.array.filter", "esnext.async-iterator.filter", "esnext.iterator.filter", ...IteratorDependencies]),
  350. filterReject: define("instance/filterReject", ["esnext.array.filter-reject"]),
  351. finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
  352. find: define("instance/find", ["es.array.find", "esnext.async-iterator.find", "esnext.iterator.find", ...IteratorDependencies]),
  353. findIndex: define("instance/find-index", ["es.array.find-index"]),
  354. findLast: define("instance/find-last", ["es.array.find-last"]),
  355. findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
  356. fixed: define(null, ["es.string.fixed"]),
  357. flags: define("instance/flags", ["es.regexp.flags"]),
  358. flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "esnext.async-iterator.flat-map", "esnext.iterator.flat-map", ...IteratorDependencies]),
  359. flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
  360. getFloat16: define(null, ["esnext.data-view.get-float16", ...DataViewDependencies]),
  361. getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
  362. getYear: define(null, ["es.date.get-year"]),
  363. group: define("instance/group", ["esnext.array.group"]),
  364. groupBy: define("instance/group-by", ["esnext.array.group-by"]),
  365. groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
  366. groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
  367. fontcolor: define(null, ["es.string.fontcolor"]),
  368. fontsize: define(null, ["es.string.fontsize"]),
  369. forEach: define("instance/for-each", ["es.array.for-each", "esnext.async-iterator.for-each", "esnext.iterator.for-each", ...IteratorDependencies, "web.dom-collections.for-each"]),
  370. includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
  371. indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
  372. indexOf: define("instance/index-of", ["es.array.index-of"]),
  373. isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
  374. italic: define(null, ["es.string.italics"]),
  375. join: define(null, ["es.array.join"]),
  376. keys: define("instance/keys", ArrayNatureIteratorsWithTag),
  377. lastIndex: define(null, ["esnext.array.last-index"]),
  378. lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
  379. lastItem: define(null, ["esnext.array.last-item"]),
  380. link: define(null, ["es.string.link"]),
  381. map: define("instance/map", ["es.array.map", "esnext.async-iterator.map", "esnext.iterator.map"]),
  382. match: define(null, ["es.string.match", "es.regexp.exec"]),
  383. matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
  384. name: define(null, ["es.function.name"]),
  385. padEnd: define("instance/pad-end", ["es.string.pad-end"]),
  386. padStart: define("instance/pad-start", ["es.string.pad-start"]),
  387. push: define("instance/push", ["es.array.push"]),
  388. reduce: define("instance/reduce", ["es.array.reduce", "esnext.async-iterator.reduce", "esnext.iterator.reduce", ...IteratorDependencies]),
  389. reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
  390. repeat: define("instance/repeat", ["es.string.repeat"]),
  391. replace: define(null, ["es.string.replace", "es.regexp.exec"]),
  392. replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
  393. reverse: define("instance/reverse", ["es.array.reverse"]),
  394. search: define(null, ["es.string.search", "es.regexp.exec"]),
  395. setFloat16: define(null, ["esnext.data-view.set-float16", ...DataViewDependencies]),
  396. setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
  397. setYear: define(null, ["es.date.set-year"]),
  398. slice: define("instance/slice", ["es.array.slice"]),
  399. small: define(null, ["es.string.small"]),
  400. some: define("instance/some", ["es.array.some", "esnext.async-iterator.some", "esnext.iterator.some", ...IteratorDependencies]),
  401. sort: define("instance/sort", ["es.array.sort"]),
  402. splice: define("instance/splice", ["es.array.splice"]),
  403. split: define(null, ["es.string.split", "es.regexp.exec"]),
  404. startsWith: define("instance/starts-with", ["es.string.starts-with"]),
  405. sticky: define(null, ["es.regexp.sticky"]),
  406. strike: define(null, ["es.string.strike"]),
  407. sub: define(null, ["es.string.sub"]),
  408. substr: define(null, ["es.string.substr"]),
  409. sup: define(null, ["es.string.sup"]),
  410. take: define(null, ["esnext.async-iterator.take", ...AsyncIteratorDependencies, "esnext.iterator.take", ...IteratorDependencies]),
  411. test: define(null, ["es.regexp.test", "es.regexp.exec"]),
  412. toArray: define(null, ["esnext.async-iterator.to-array", ...AsyncIteratorDependencies, "esnext.iterator.to-array", ...IteratorDependencies]),
  413. toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
  414. toExponential: define(null, ["es.number.to-exponential"]),
  415. toFixed: define(null, ["es.number.to-fixed"]),
  416. toGMTString: define(null, ["es.date.to-gmt-string"]),
  417. toISOString: define(null, ["es.date.to-iso-string"]),
  418. toJSON: define(null, ["es.date.to-json", "web.url.to-json"]),
  419. toPrecision: define(null, ["es.number.to-precision"]),
  420. toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
  421. toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
  422. toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
  423. toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
  424. toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
  425. trim: define("instance/trim", ["es.string.trim"]),
  426. trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
  427. trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
  428. trimRight: define("instance/trim-right", ["es.string.trim-end"]),
  429. trimStart: define("instance/trim-start", ["es.string.trim-start"]),
  430. uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
  431. unshift: define("instance/unshift", ["es.array.unshift"]),
  432. unThis: define("instance/un-this", ["esnext.function.un-this"]),
  433. values: define("instance/values", ArrayNatureIteratorsWithTag),
  434. with: define("instance/with", ["es.array.with"]),
  435. __defineGetter__: define(null, ["es.object.define-getter"]),
  436. __defineSetter__: define(null, ["es.object.define-setter"]),
  437. __lookupGetter__: define(null, ["es.object.lookup-getter"]),
  438. __lookupSetter__: define(null, ["es.object.lookup-setter"]),
  439. ["__proto__"]: define(null, ["es.object.proto"])
  440. };
  441. const {
  442. types: t$2
  443. } = _babel.default || _babel;
  444. function canSkipPolyfill(desc, path) {
  445. const {
  446. node,
  447. parent
  448. } = path;
  449. switch (desc.name) {
  450. case "es.string.split":
  451. {
  452. if (!t$2.isCallExpression(parent, {
  453. callee: node
  454. })) return false;
  455. if (parent.arguments.length < 1) return true;
  456. const splitter = parent.arguments[0];
  457. return t$2.isStringLiteral(splitter) || t$2.isTemplateLiteral(splitter);
  458. }
  459. }
  460. }
  461. const {
  462. types: t$1
  463. } = _babel.default || _babel;
  464. const BABEL_RUNTIME = "@babel/runtime-corejs3";
  465. function callMethod(path, id) {
  466. const {
  467. object
  468. } = path.node;
  469. let context1, context2;
  470. if (t$1.isIdentifier(object)) {
  471. context1 = object;
  472. context2 = t$1.cloneNode(object);
  473. } else {
  474. context1 = path.scope.generateDeclaredUidIdentifier("context");
  475. context2 = t$1.assignmentExpression("=", t$1.cloneNode(context1), object);
  476. }
  477. path.replaceWith(t$1.memberExpression(t$1.callExpression(id, [context2]), t$1.identifier("call")));
  478. path.parentPath.unshiftContainer("arguments", context1);
  479. }
  480. function isCoreJSSource(source) {
  481. if (typeof source === "string") {
  482. source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
  483. }
  484. return Object.prototype.hasOwnProperty.call(corejsEntries, source) && corejsEntries[source];
  485. }
  486. function coreJSModule(name) {
  487. return `core-js/modules/${name}.js`;
  488. }
  489. function coreJSPureHelper(name, useBabelRuntime, ext) {
  490. return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
  491. }
  492. const {
  493. types: t
  494. } = _babel.default || _babel;
  495. const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
  496. const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
  497. const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
  498. const esnextFallback = (name, cb) => {
  499. if (cb(name)) return true;
  500. if (!name.startsWith("es.")) return false;
  501. const fallback = `esnext.${name.slice(3)}`;
  502. if (!corejs3Polyfills[fallback]) return false;
  503. return cb(fallback);
  504. };
  505. var index = defineProvider(function ({
  506. getUtils,
  507. method,
  508. shouldInjectPolyfill,
  509. createMetaResolver,
  510. debug,
  511. babel
  512. }, {
  513. version = 3,
  514. proposals,
  515. shippedProposals,
  516. [presetEnvCompat]: {
  517. noRuntimeName = false
  518. } = {},
  519. [runtimeCompat]: {
  520. useBabelRuntime = false,
  521. ext = ".js"
  522. } = {}
  523. }) {
  524. const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
  525. const resolve = createMetaResolver({
  526. global: BuiltIns,
  527. static: StaticProperties,
  528. instance: InstanceProperties
  529. });
  530. const available = new Set(getModulesListForTargetVersion(version));
  531. function getCoreJSPureBase(useProposalBase) {
  532. return useBabelRuntime ? useProposalBase ? `${BABEL_RUNTIME}/core-js` : `${BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
  533. }
  534. function maybeInjectGlobalImpl(name, utils) {
  535. if (shouldInjectPolyfill(name)) {
  536. debug(name);
  537. utils.injectGlobalImport(coreJSModule(name));
  538. return true;
  539. }
  540. return false;
  541. }
  542. function maybeInjectGlobal(names, utils, fallback = true) {
  543. for (const name of names) {
  544. if (fallback) {
  545. esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
  546. } else {
  547. maybeInjectGlobalImpl(name, utils);
  548. }
  549. }
  550. }
  551. function maybeInjectPure(desc, hint, utils, object) {
  552. if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
  553. const {
  554. name
  555. } = desc;
  556. let useProposalBase = false;
  557. if (proposals || shippedProposals && name.startsWith("esnext.")) {
  558. useProposalBase = true;
  559. } else if (name.startsWith("es.") && !available.has(name)) {
  560. useProposalBase = true;
  561. }
  562. const coreJSPureBase = getCoreJSPureBase(useProposalBase);
  563. return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
  564. }
  565. }
  566. function isFeatureStable(name) {
  567. if (name.startsWith("esnext.")) {
  568. const esName = `es.${name.slice(7)}`;
  569. // If its imaginative esName is not in latest compat data, it means
  570. // the proposal is not stage 4
  571. return esName in corejs3Polyfills;
  572. }
  573. return true;
  574. }
  575. return {
  576. name: "corejs3",
  577. runtimeName: noRuntimeName ? null : BABEL_RUNTIME,
  578. polyfills: corejs3Polyfills,
  579. filterPolyfills(name) {
  580. if (!available.has(name)) return false;
  581. if (proposals || method === "entry-global") return true;
  582. if (shippedProposals && corejs3ShippedProposalsList.has(name)) {
  583. return true;
  584. }
  585. return isFeatureStable(name);
  586. },
  587. entryGlobal(meta, utils, path) {
  588. if (meta.kind !== "import") return;
  589. const modules = isCoreJSSource(meta.source);
  590. if (!modules) return;
  591. if (modules.length === 1 && meta.source === coreJSModule(modules[0]) && shouldInjectPolyfill(modules[0])) {
  592. // Avoid infinite loop: do not replace imports with a new copy of
  593. // themselves.
  594. debug(null);
  595. return;
  596. }
  597. const modulesSet = new Set(modules);
  598. const filteredModules = modules.filter(module => {
  599. if (!module.startsWith("esnext.")) return true;
  600. const stable = module.replace("esnext.", "es.");
  601. if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
  602. return false;
  603. }
  604. return true;
  605. });
  606. maybeInjectGlobal(filteredModules, utils, false);
  607. path.remove();
  608. },
  609. usageGlobal(meta, utils, path) {
  610. const resolved = resolve(meta);
  611. if (!resolved) return;
  612. if (canSkipPolyfill(resolved.desc, path)) return;
  613. let deps = resolved.desc.global;
  614. if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
  615. const low = meta.object.toLowerCase();
  616. deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
  617. }
  618. maybeInjectGlobal(deps, utils);
  619. },
  620. usagePure(meta, utils, path) {
  621. if (meta.kind === "in") {
  622. if (meta.key === "Symbol.iterator") {
  623. path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
  624. ));
  625. }
  626. return;
  627. }
  628. if (path.parentPath.isUnaryExpression({
  629. operator: "delete"
  630. })) return;
  631. if (meta.kind === "property") {
  632. // We can't compile destructuring and updateExpression.
  633. if (!path.isMemberExpression()) return;
  634. if (!path.isReferenced()) return;
  635. if (path.parentPath.isUpdateExpression()) return;
  636. if (t.isSuper(path.node.object)) {
  637. return;
  638. }
  639. if (meta.key === "Symbol.iterator") {
  640. if (!shouldInjectPolyfill("es.symbol.iterator")) return;
  641. const {
  642. parent,
  643. node
  644. } = path;
  645. if (t.isCallExpression(parent, {
  646. callee: node
  647. })) {
  648. if (parent.arguments.length === 0) {
  649. path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
  650. path.skip();
  651. } else {
  652. callMethod(path, utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
  653. }
  654. } else {
  655. path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
  656. }
  657. return;
  658. }
  659. }
  660. let resolved = resolve(meta);
  661. if (!resolved) return;
  662. if (canSkipPolyfill(resolved.desc, path)) return;
  663. if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
  664. // Remove /index, since it doesn't exist in @babel/runtime-corejs3s
  665. resolved = {
  666. ...resolved,
  667. desc: {
  668. ...resolved.desc,
  669. pure: resolved.desc.pure.slice(0, -6)
  670. }
  671. };
  672. }
  673. if (resolved.kind === "global") {
  674. const id = maybeInjectPure(resolved.desc, resolved.name, utils);
  675. if (id) path.replaceWith(id);
  676. } else if (resolved.kind === "static") {
  677. const id = maybeInjectPure(resolved.desc, resolved.name, utils,
  678. // @ts-expect-error
  679. meta.object);
  680. if (id) path.replaceWith(id);
  681. } else if (resolved.kind === "instance") {
  682. const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
  683. // @ts-expect-error
  684. meta.object);
  685. if (!id) return;
  686. const {
  687. node
  688. } = path;
  689. if (t.isCallExpression(path.parent, {
  690. callee: node
  691. })) {
  692. callMethod(path, id);
  693. } else {
  694. path.replaceWith(t.callExpression(id, [node.object]));
  695. }
  696. }
  697. },
  698. visitor: method === "usage-global" && {
  699. // import("foo")
  700. CallExpression(path) {
  701. if (path.get("callee").isImport()) {
  702. const utils = getUtils(path);
  703. if (isWebpack) {
  704. // Webpack uses Promise.all to handle dynamic import.
  705. maybeInjectGlobal(PromiseDependenciesWithIterators, utils);
  706. } else {
  707. maybeInjectGlobal(PromiseDependencies, utils);
  708. }
  709. }
  710. },
  711. // (async function () { }).finally(...)
  712. Function(path) {
  713. if (path.node.async) {
  714. maybeInjectGlobal(PromiseDependencies, getUtils(path));
  715. }
  716. },
  717. // for-of, [a, b] = c
  718. "ForOfStatement|ArrayPattern"(path) {
  719. maybeInjectGlobal(CommonIterators, getUtils(path));
  720. },
  721. // [...spread]
  722. SpreadElement(path) {
  723. if (!path.parentPath.isObjectExpression()) {
  724. maybeInjectGlobal(CommonIterators, getUtils(path));
  725. }
  726. },
  727. // yield*
  728. YieldExpression(path) {
  729. if (path.node.delegate) {
  730. maybeInjectGlobal(CommonIterators, getUtils(path));
  731. }
  732. },
  733. // Decorators metadata
  734. Class(path) {
  735. var _path$node$decorators;
  736. const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
  737. var _decorators;
  738. return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
  739. });
  740. if (hasDecorators) {
  741. maybeInjectGlobal(DecoratorMetadataDependencies, getUtils(path));
  742. }
  743. }
  744. }
  745. };
  746. });
  747. export default index;
  748. //# sourceMappingURL=index.mjs.map