babel-plugin-polyfill-corejs3 0.10.4 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.mjs CHANGED
@@ -6,7 +6,7 @@ import defineProvider from '@babel/helper-define-polyfill-provider';
6
6
 
7
7
  // This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
8
8
 
9
- var corejs3ShippedProposalsList = new Set(["esnext.suppressed-error.constructor", "esnext.array.from-async", "esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.constructor", "esnext.iterator.drop", "esnext.iterator.every", "esnext.iterator.filter", "esnext.iterator.find", "esnext.iterator.flat-map", "esnext.iterator.for-each", "esnext.iterator.from", "esnext.iterator.map", "esnext.iterator.reduce", "esnext.iterator.some", "esnext.iterator.take", "esnext.iterator.to-array", "esnext.json.is-raw-json", "esnext.json.parse", "esnext.json.raw-json", "esnext.set.difference.v2", "esnext.set.intersection.v2", "esnext.set.is-disjoint-from.v2", "esnext.set.is-subset-of.v2", "esnext.set.is-superset-of.v2", "esnext.set.symmetric-difference.v2", "esnext.set.union.v2", "esnext.symbol.async-dispose", "esnext.symbol.dispose", "esnext.symbol.metadata"]);
9
+ var corejs3ShippedProposalsList = new Set(["esnext.suppressed-error.constructor", "esnext.array.from-async", "esnext.array.group", "esnext.array.group-to-map", "esnext.data-view.get-float16", "esnext.data-view.set-float16", "esnext.json.is-raw-json", "esnext.json.parse", "esnext.json.raw-json", "esnext.math.f16round", "esnext.regexp.escape", "esnext.symbol.async-dispose", "esnext.symbol.dispose", "esnext.symbol.metadata", "esnext.uint8-array.from-base64", "esnext.uint8-array.from-hex", "esnext.uint8-array.set-from-base64", "esnext.uint8-array.set-from-hex", "esnext.uint8-array.to-base64", "esnext.uint8-array.to-hex"]);
10
10
 
11
11
  const polyfillsOrder = {};
12
12
  Object.keys(corejs3Polyfills).forEach((name, index) => {
@@ -27,31 +27,32 @@ const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterat
27
27
  const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
28
28
  const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
29
29
  const SuppressedErrorDependencies = ["esnext.suppressed-error.constructor", ...ErrorDependencies];
30
- const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by"];
30
+ const ArrayBufferDependencies = ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
31
+ const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by", ...ArrayBufferDependencies];
31
32
  const PromiseDependencies = ["es.promise", "es.object.to-string"];
32
33
  const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
33
34
  const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
34
- 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];
35
- 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];
36
- const WeakMapDependencies = ["es.weak-map", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
35
+ const MapDependencies = ["es.map", "esnext.map.delete-all", "esnext.map.emplace", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.get-or-insert", "esnext.map.get-or-insert-computed", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
36
+ const SetDependencies = ["es.set", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
37
+ const WeakMapDependencies = ["es.weak-map", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", "esnext.weak-map.get-or-insert", "esnext.weak-map.get-or-insert-computed", ...CommonIteratorsWithTag];
37
38
  const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
38
39
  const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
39
40
  const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
40
41
  const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
41
42
  const AsyncIteratorProblemMethods = ["esnext.async-iterator.every", "esnext.async-iterator.filter", "esnext.async-iterator.find", "esnext.async-iterator.flat-map", "esnext.async-iterator.for-each", "esnext.async-iterator.map", "esnext.async-iterator.reduce", "esnext.async-iterator.some"];
42
- const IteratorDependencies = ["esnext.iterator.constructor", "es.object.to-string"];
43
+ const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];
43
44
  const DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
44
45
  const TypedArrayStaticMethods = base => ({
45
46
  from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
46
47
  fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
47
48
  of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
48
49
  });
49
- const DataViewDependencies = ["es.data-view", "es.array-buffer.constructor", "es.array-buffer.slice", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
50
+ const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
50
51
  const BuiltIns = {
51
52
  AsyncDisposableStack: define("async-disposable-stack/index", ["esnext.async-disposable-stack.constructor", "es.object.to-string", "esnext.async-iterator.async-dispose", "esnext.iterator.dispose", ...PromiseDependencies, ...SuppressedErrorDependencies]),
52
53
  AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
53
54
  AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
54
- ArrayBuffer: define(null, ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"]),
55
+ ArrayBuffer: define(null, ArrayBufferDependencies),
55
56
  DataView: define(null, DataViewDependencies),
56
57
  Date: define(null, ["es.date.to-string"]),
57
58
  DOMException: define("dom-exception/index", DOMExceptionDependencies),
@@ -64,7 +65,7 @@ const BuiltIns = {
64
65
  Int16Array: typed("es.typed-array.int16-array"),
65
66
  Int32Array: typed("es.typed-array.int32-array"),
66
67
  Iterator: define("iterator/index", IteratorDependencies),
67
- Uint8Array: typed("es.typed-array.uint8-array", "esnext.uint8-array.to-base64", "esnext.uint8-array.to-hex"),
68
+ Uint8Array: typed("es.typed-array.uint8-array", "esnext.uint8-array.set-from-base64", "esnext.uint8-array.set-from-hex", "esnext.uint8-array.to-base64", "esnext.uint8-array.to-hex"),
68
69
  Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
69
70
  Uint16Array: typed("es.typed-array.uint16-array"),
70
71
  Uint32Array: typed("es.typed-array.uint32-array"),
@@ -129,8 +130,9 @@ const StaticProperties = {
129
130
  isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
130
131
  },
131
132
  Iterator: {
132
- from: define("iterator/from", ["esnext.iterator.from", ...IteratorDependencies, ...CommonIterators]),
133
- range: define("iterator/range", ["esnext.iterator.range", "es.object.to-string"])
133
+ concat: define("iterator/concat", ["esnext.iterator.concat", ...IteratorDependencies, ...CommonIterators]),
134
+ from: define("iterator/from", ["es.iterator.from", ...IteratorDependencies, ...CommonIterators]),
135
+ range: define("iterator/range", ["esnext.iterator.range", ...IteratorDependencies, "es.object.to-string"])
134
136
  },
135
137
  JSON: {
136
138
  isRawJSON: define("json/is-raw-json", ["esnext.json.is-raw-json"]),
@@ -167,15 +169,16 @@ const StaticProperties = {
167
169
  sign: define("math/sign", ["es.math.sign"]),
168
170
  signbit: define("math/signbit", ["esnext.math.signbit"]),
169
171
  sinh: define("math/sinh", ["es.math.sinh"]),
172
+ sumPrecise: define("math/sum-precise", ["esnext.math.sum-precise", "es.array.iterator"]),
170
173
  tanh: define("math/tanh", ["es.math.tanh"]),
171
174
  trunc: define("math/trunc", ["es.math.trunc"]),
172
175
  umulh: define("math/umulh", ["esnext.math.umulh"])
173
176
  },
174
177
  Map: {
175
- from: define(null, ["esnext.map.from", ...MapDependencies]),
178
+ from: define("map/from", ["esnext.map.from", ...MapDependencies]),
176
179
  groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
177
180
  keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
178
- of: define(null, ["esnext.map.of", ...MapDependencies])
181
+ of: define("map/of", ["esnext.map.of", ...MapDependencies])
179
182
  },
180
183
  Number: {
181
184
  EPSILON: define("number/epsilon", ["es.number.epsilon"]),
@@ -220,7 +223,7 @@ const StaticProperties = {
220
223
  allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
221
224
  any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
222
225
  race: define(null, PromiseDependenciesWithIterators),
223
- try: define("promise/try", ["esnext.promise.try", ...PromiseDependencies]),
226
+ try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
224
227
  withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
225
228
  },
226
229
  Reflect: {
@@ -251,8 +254,8 @@ const StaticProperties = {
251
254
  escape: define("regexp/escape", ["esnext.regexp.escape"])
252
255
  },
253
256
  Set: {
254
- from: define(null, ["esnext.set.from", ...SetDependencies]),
255
- of: define(null, ["esnext.set.of", ...SetDependencies])
257
+ from: define("set/from", ["esnext.set.from", ...SetDependencies]),
258
+ of: define("set/of", ["esnext.set.of", ...SetDependencies])
256
259
  },
257
260
  String: {
258
261
  cooked: define("string/cooked", ["esnext.string.cooked"]),
@@ -263,6 +266,7 @@ const StaticProperties = {
263
266
  Symbol: {
264
267
  asyncDispose: define("symbol/async-dispose", ["esnext.symbol.async-dispose", "esnext.async-iterator.async-dispose"]),
265
268
  asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
269
+ customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
266
270
  dispose: define("symbol/dispose", ["esnext.symbol.dispose", "esnext.iterator.dispose"]),
267
271
  for: define("symbol/for", [], "es.symbol"),
268
272
  hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
@@ -289,15 +293,16 @@ const StaticProperties = {
289
293
  unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
290
294
  },
291
295
  URL: {
292
- canParse: define("url/can-parse", ["web.url.can-parse", "web.url"])
296
+ canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
297
+ parse: define("url/parse", ["web.url.parse", "web.url"])
293
298
  },
294
299
  WeakMap: {
295
- from: define(null, ["esnext.weak-map.from", ...WeakMapDependencies]),
296
- of: define(null, ["esnext.weak-map.of", ...WeakMapDependencies])
300
+ from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
301
+ of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
297
302
  },
298
303
  WeakSet: {
299
- from: define(null, ["esnext.weak-set.from", ...WeakSetDependencies]),
300
- of: define(null, ["esnext.weak-set.of", ...WeakSetDependencies])
304
+ from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
305
+ of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
301
306
  },
302
307
  Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
303
308
  Uint8Array: {
@@ -319,7 +324,7 @@ const StaticProperties = {
319
324
  }
320
325
  };
321
326
  const InstanceProperties = {
322
- asIndexedPairs: define("instance/asIndexedPairs", ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
327
+ asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
323
328
  at: define("instance/at", [
324
329
  // TODO: We should introduce overloaded instance methods definition
325
330
  // Before that is implemented, the `esnext.string.at` must be the first
@@ -340,29 +345,39 @@ const InstanceProperties = {
340
345
  demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
341
346
  description: define(null, ["es.symbol", "es.symbol.description"]),
342
347
  dotAll: define(null, ["es.regexp.dot-all"]),
343
- drop: define(null, ["esnext.async-iterator.drop", ...AsyncIteratorDependencies, "esnext.iterator.drop", ...IteratorDependencies]),
344
- emplace: define("instance/emplace", ["esnext.map.emplace", "esnext.weak-map.emplace"]),
348
+ drop: define(null, ["es.iterator.drop", ...IteratorDependencies, "esnext.async-iterator.drop", ...AsyncIteratorDependencies]),
345
349
  endsWith: define("instance/ends-with", ["es.string.ends-with"]),
346
350
  entries: define("instance/entries", ArrayNatureIteratorsWithTag),
347
- every: define("instance/every", ["es.array.every", "esnext.async-iterator.every",
351
+ every: define("instance/every", ["es.array.every", "es.iterator.every", ...IteratorDependencies
348
352
  // TODO: add async iterator dependencies when we support sub-dependencies
349
353
  // esnext.async-iterator.every depends on es.promise
350
354
  // but we don't want to pull es.promise when esnext.async-iterator is disabled
351
355
  //
356
+ // "esnext.async-iterator.every",
352
357
  // ...AsyncIteratorDependencies
353
- "esnext.iterator.every", ...IteratorDependencies]),
358
+ ]),
359
+
354
360
  exec: define(null, ["es.regexp.exec"]),
355
361
  fill: define("instance/fill", ["es.array.fill"]),
356
- filter: define("instance/filter", ["es.array.filter", "esnext.async-iterator.filter", "esnext.iterator.filter", ...IteratorDependencies]),
362
+ filter: define("instance/filter", ["es.array.filter", "es.iterator.filter", ...IteratorDependencies
363
+ // "esnext.async-iterator.filter",
364
+ ]),
365
+
357
366
  filterReject: define("instance/filterReject", ["esnext.array.filter-reject"]),
358
367
  finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
359
- find: define("instance/find", ["es.array.find", "esnext.async-iterator.find", "esnext.iterator.find", ...IteratorDependencies]),
368
+ find: define("instance/find", ["es.array.find", "es.iterator.find", ...IteratorDependencies
369
+ // "esnext.async-iterator.find",
370
+ ]),
371
+
360
372
  findIndex: define("instance/find-index", ["es.array.find-index"]),
361
373
  findLast: define("instance/find-last", ["es.array.find-last"]),
362
374
  findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
363
375
  fixed: define(null, ["es.string.fixed"]),
364
376
  flags: define("instance/flags", ["es.regexp.flags"]),
365
- flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "esnext.async-iterator.flat-map", "esnext.iterator.flat-map", ...IteratorDependencies]),
377
+ flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "es.iterator.flat-map", ...IteratorDependencies
378
+ // "esnext.async-iterator.flat-map",
379
+ ]),
380
+
366
381
  flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
367
382
  getFloat16: define(null, ["esnext.data-view.get-float16", ...DataViewDependencies]),
368
383
  getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
@@ -373,7 +388,9 @@ const InstanceProperties = {
373
388
  groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
374
389
  fontcolor: define(null, ["es.string.fontcolor"]),
375
390
  fontsize: define(null, ["es.string.fontsize"]),
376
- forEach: define("instance/for-each", ["es.array.for-each", "esnext.async-iterator.for-each", "esnext.iterator.for-each", ...IteratorDependencies, "web.dom-collections.for-each"]),
391
+ forEach: define("instance/for-each", ["es.array.for-each", "es.iterator.for-each", ...IteratorDependencies,
392
+ // "esnext.async-iterator.for-each",
393
+ "web.dom-collections.for-each"]),
377
394
  includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
378
395
  indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
379
396
  indexOf: define("instance/index-of", ["es.array.index-of"]),
@@ -385,14 +402,20 @@ const InstanceProperties = {
385
402
  lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
386
403
  lastItem: define(null, ["esnext.array.last-item"]),
387
404
  link: define(null, ["es.string.link"]),
388
- map: define("instance/map", ["es.array.map", "esnext.async-iterator.map", "esnext.iterator.map"]),
405
+ map: define("instance/map", ["es.array.map", "es.iterator.map", ...IteratorDependencies
406
+ // "esnext.async-iterator.map",
407
+ ]),
408
+
389
409
  match: define(null, ["es.string.match", "es.regexp.exec"]),
390
410
  matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
391
411
  name: define(null, ["es.function.name"]),
392
412
  padEnd: define("instance/pad-end", ["es.string.pad-end"]),
393
413
  padStart: define("instance/pad-start", ["es.string.pad-start"]),
394
414
  push: define("instance/push", ["es.array.push"]),
395
- reduce: define("instance/reduce", ["es.array.reduce", "esnext.async-iterator.reduce", "esnext.iterator.reduce", ...IteratorDependencies]),
415
+ reduce: define("instance/reduce", ["es.array.reduce", "es.iterator.reduce", ...IteratorDependencies
416
+ // "esnext.async-iterator.reduce",
417
+ ]),
418
+
396
419
  reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
397
420
  repeat: define("instance/repeat", ["es.string.repeat"]),
398
421
  replace: define(null, ["es.string.replace", "es.regexp.exec"]),
@@ -404,7 +427,10 @@ const InstanceProperties = {
404
427
  setYear: define(null, ["es.date.set-year"]),
405
428
  slice: define("instance/slice", ["es.array.slice"]),
406
429
  small: define(null, ["es.string.small"]),
407
- some: define("instance/some", ["es.array.some", "esnext.async-iterator.some", "esnext.iterator.some", ...IteratorDependencies]),
430
+ some: define("instance/some", ["es.array.some", "es.iterator.some", ...IteratorDependencies
431
+ // "esnext.async-iterator.some",
432
+ ]),
433
+
408
434
  sort: define("instance/sort", ["es.array.sort"]),
409
435
  splice: define("instance/splice", ["es.array.splice"]),
410
436
  split: define(null, ["es.string.split", "es.regexp.exec"]),
@@ -414,9 +440,9 @@ const InstanceProperties = {
414
440
  sub: define(null, ["es.string.sub"]),
415
441
  substr: define(null, ["es.string.substr"]),
416
442
  sup: define(null, ["es.string.sup"]),
417
- take: define(null, ["esnext.async-iterator.take", ...AsyncIteratorDependencies, "esnext.iterator.take", ...IteratorDependencies]),
443
+ take: define(null, ["es.iterator.take", ...IteratorDependencies, "esnext.async-iterator.take", ...AsyncIteratorDependencies]),
418
444
  test: define(null, ["es.regexp.test", "es.regexp.exec"]),
419
- toArray: define(null, ["esnext.async-iterator.to-array", ...AsyncIteratorDependencies, "esnext.iterator.to-array", ...IteratorDependencies]),
445
+ toArray: define(null, ["es.iterator.to-array", ...IteratorDependencies, "esnext.async-iterator.to-array", ...AsyncIteratorDependencies]),
420
446
  toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
421
447
  toExponential: define(null, ["es.number.to-exponential"]),
422
448
  toFixed: define(null, ["es.number.to-fixed"]),
@@ -478,20 +504,38 @@ const {
478
504
  types: t$1
479
505
  } = _babel.default || _babel;
480
506
  const BABEL_RUNTIME = "@babel/runtime-corejs3";
481
- function callMethod(path, id) {
507
+ function callMethod(path, id, optionalCall, wrapCallee) {
508
+ const [context1, context2] = maybeMemoizeContext(path.node, path.scope);
509
+ let callee = t$1.callExpression(id, [context1]);
510
+ if (wrapCallee) callee = wrapCallee(callee);
511
+ const call = t$1.identifier("call");
512
+ path.replaceWith(optionalCall ? t$1.optionalMemberExpression(callee, call, false, true) : t$1.memberExpression(callee, call));
513
+ path.parentPath.unshiftContainer("arguments", context2);
514
+ }
515
+ function maybeMemoizeContext(node, scope) {
482
516
  const {
483
517
  object
484
- } = path.node;
518
+ } = node;
485
519
  let context1, context2;
486
520
  if (t$1.isIdentifier(object)) {
487
- context1 = object;
488
- context2 = t$1.cloneNode(object);
521
+ context2 = object;
522
+ context1 = t$1.cloneNode(object);
489
523
  } else {
490
- context1 = path.scope.generateDeclaredUidIdentifier("context");
491
- context2 = t$1.assignmentExpression("=", t$1.cloneNode(context1), object);
524
+ context2 = scope.generateDeclaredUidIdentifier("context");
525
+ context1 = t$1.assignmentExpression("=", t$1.cloneNode(context2), object);
526
+ }
527
+ return [context1, context2];
528
+ }
529
+ function extractOptionalCheck(scope, node) {
530
+ let optionalNode = node;
531
+ while (!optionalNode.optional && t$1.isOptionalMemberExpression(optionalNode.object)) {
532
+ optionalNode = optionalNode.object;
492
533
  }
493
- path.replaceWith(t$1.memberExpression(t$1.callExpression(id, [context2]), t$1.identifier("call")));
494
- path.parentPath.unshiftContainer("arguments", context1);
534
+ optionalNode.optional = false;
535
+ const ctx = scope.generateDeclaredUidIdentifier("context");
536
+ const assign = t$1.assignmentExpression("=", ctx, optionalNode.object);
537
+ optionalNode.object = t$1.cloneNode(ctx);
538
+ return ifNotNullish => t$1.conditionalExpression(t$1.binaryExpression("==", assign, t$1.nullLiteral()), t$1.unaryExpression("void", t$1.numericLiteral(0)), ifNotNullish);
495
539
  }
496
540
  function isCoreJSSource(source) {
497
541
  if (typeof source === "string") {
@@ -507,7 +551,8 @@ function coreJSPureHelper(name, useBabelRuntime, ext) {
507
551
  }
508
552
 
509
553
  const {
510
- types: t
554
+ types: t,
555
+ template: template
511
556
  } = _babel.default || _babel;
512
557
  const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
513
558
  const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
@@ -652,7 +697,9 @@ var index = defineProvider(function ({
652
697
  })) return;
653
698
  if (meta.kind === "property") {
654
699
  // We can't compile destructuring and updateExpression.
655
- if (!path.isMemberExpression()) return;
700
+ if (!path.isMemberExpression() && !path.isOptionalMemberExpression()) {
701
+ return;
702
+ }
656
703
  if (!path.isReferenced()) return;
657
704
  if (path.parentPath.isUpdateExpression()) return;
658
705
  if (t.isSuper(path.node.object)) {
@@ -699,19 +746,52 @@ var index = defineProvider(function ({
699
746
  const id = maybeInjectPure(resolved.desc, resolved.name, utils,
700
747
  // @ts-expect-error
701
748
  meta.object);
702
- if (id) path.replaceWith(id);
749
+ if (id) {
750
+ path.replaceWith(id);
751
+ let {
752
+ parentPath
753
+ } = path;
754
+ if (parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) {
755
+ do {
756
+ const parentAsNotOptional = parentPath;
757
+ parentAsNotOptional.type = parentAsNotOptional.node.type = parentPath.type === "OptionalMemberExpression" ? "MemberExpression" : "CallExpression";
758
+ delete parentAsNotOptional.node.optional;
759
+ ({
760
+ parentPath
761
+ } = parentPath);
762
+ } while ((parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) && !parentPath.node.optional);
763
+ }
764
+ }
703
765
  } else if (resolved.kind === "instance") {
704
766
  const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
705
767
  // @ts-expect-error
706
768
  meta.object);
707
769
  if (!id) return;
708
770
  const {
709
- node
771
+ node,
772
+ parent
710
773
  } = path;
711
- if (t.isCallExpression(path.parent, {
712
- callee: node
713
- })) {
714
- callMethod(path, id);
774
+ if (t.isOptionalCallExpression(parent) && parent.callee === node) {
775
+ const wasOptional = parent.optional;
776
+ parent.optional = !wasOptional;
777
+ if (!wasOptional) {
778
+ const check = extractOptionalCheck(path.scope, node);
779
+ const [thisArg, thisArg2] = maybeMemoizeContext(node, path.scope);
780
+ path.replaceWith(check(template.expression.ast`
781
+ Function.call.bind(${id}(${thisArg}), ${thisArg2})
782
+ `));
783
+ } else if (t.isOptionalMemberExpression(node)) {
784
+ const check = extractOptionalCheck(path.scope, node);
785
+ callMethod(path, id, true, check);
786
+ } else {
787
+ callMethod(path, id, true);
788
+ }
789
+ } else if (t.isCallExpression(parent) && parent.callee === node) {
790
+ callMethod(path, id, false);
791
+ } else if (t.isOptionalMemberExpression(node)) {
792
+ const check = extractOptionalCheck(path.scope, node);
793
+ path.replaceWith(check(t.callExpression(id, [node.object])));
794
+ if (t.isOptionalMemberExpression(parent)) parent.optional = true;
715
795
  } else {
716
796
  path.replaceWith(t.callExpression(id, [node.object]));
717
797
  }