diff --git a/package.json b/package.json index 7daa94c2..c5b2d258 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@lerna/package": "patch:@lerna/package@npm:3.16.0#.yarn-patches/@lerna/package.patch", "@lerna/package-graph": "patch:@lerna/package-graph@npm:3.18.5#.yarn-patches/@lerna/package-graph.patch", "@lerna/pack-directory": "patch:@lerna/pack-directory@npm:3.16.4#.yarn-patches/@lerna/pack-directory.patch", - "@babel/preset-env/core-js-compat": "^3.30.1" + "@babel/preset-env/core-js-compat": "^3.31.0" }, "engines": { "node": ">= 6.9.0", diff --git a/packages/babel-plugin-polyfill-corejs3/package.json b/packages/babel-plugin-polyfill-corejs3/package.json index 41dea677..91f05d31 100644 --- a/packages/babel-plugin-polyfill-corejs3/package.json +++ b/packages/babel-plugin-polyfill-corejs3/package.json @@ -27,7 +27,7 @@ ], "dependencies": { "@babel/helper-define-polyfill-provider": "workspace:^0.4.0", - "core-js-compat": "^3.30.1" + "core-js-compat": "^3.31.0" }, "devDependencies": { "@babel/core": "^7.17.8", @@ -37,8 +37,8 @@ "@babel/plugin-transform-for-of": "^7.16.7", "@babel/plugin-transform-modules-commonjs": "^7.17.7", "@babel/plugin-transform-spread": "^7.16.7", - "core-js": "^3.30.1", - "core-js-pure": "^3.30.1" + "core-js": "^3.31.0", + "core-js-pure": "^3.31.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" diff --git a/packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts b/packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts index b7ebca7a..9684a8f7 100644 --- a/packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts +++ b/packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts @@ -177,6 +177,8 @@ const DOMExceptionDependencies = [ const URLSearchParamsDependencies = [ "web.url-search-params", + "web.url-search-params.delete", + "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag, ]; @@ -477,6 +479,10 @@ export const StaticProperties: ObjectMap2 = { getPrototypeOf: define("object/get-prototype-of", [ "es.object.get-prototype-of", ]), + groupBy: define("object/group-by", [ + "esnext.object.group-by", + "es.object.create", + ]), hasOwn: define("object/has-own", ["es.object.has-own"]), is: define("object/is", ["es.object.is"]), isExtensible: define("object/is-extensible", ["es.object.is-extensible"]), @@ -505,9 +511,10 @@ export const StaticProperties: ObjectMap2 = { ...PromiseDependenciesWithIterators, ]), race: define(null, PromiseDependenciesWithIterators), - try: define(null, [ - "esnext.promise.try", - ...PromiseDependenciesWithIterators, + try: define(null, ["esnext.promise.try", ...PromiseDependencies]), + withResolvers: define(null, [ + "esnext.promise.with-resolvers", + ...PromiseDependencies, ]), }, @@ -607,10 +614,18 @@ export const StaticProperties: ObjectMap2 = { "esnext.symbol.is-registered", "es.symbol", ]), + isRegisteredSymbol: define("symbol/is-registered-symbol", [ + "esnext.symbol.is-registered-symbol", + "es.symbol", + ]), isWellKnown: define("symbol/is-well-known", [ "esnext.symbol.is-well-known", "es.symbol", ]), + isWellKnownSymbol: define("symbol/is-well-known-symbol", [ + "esnext.symbol.is-well-known-symbol", + "es.symbol", + ]), iterator: define("symbol/iterator", [ "es.symbol.iterator", ...CommonIteratorsWithTag, @@ -622,7 +637,10 @@ export const StaticProperties: ObjectMap2 = { "es.symbol.match-all", "es.string.match-all", ]), - metadata: define("symbol/metadata", ["esnext.symbol.metadata"]), + metadata: define("symbol/metadata", [ + "esnext.symbol.metadata", + "esnext.function.metadata", + ]), metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]), observable: define("symbol/observable", ["esnext.symbol.observable"]), patternMatch: define("symbol/pattern-match", [ @@ -799,9 +817,7 @@ export const InstanceProperties = { ...IteratorDependencies, ]), indexOf: define("instance/index-of", ["es.array.index-of"]), - isWellFormed: define("instance/is-well-formed", [ - "esnext.string.is-well-formed", - ]), + isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]), italic: define(null, ["es.string.italics"]), join: define(null, ["es.array.join"]), keys: define("instance/keys", ArrayNatureIteratorsWithTag), @@ -894,9 +910,7 @@ export const InstanceProperties = { "es.date.to-string", "es.regexp.to-string", ]), - toWellFormed: define("instance/to-well-formed", [ - "esnext.string.to-well-formed", - ]), + toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]), trim: define("instance/trim", ["es.string.trim"]), trimEnd: define("instance/trim-end", ["es.string.trim-end"]), trimLeft: define("instance/trim-left", ["es.string.trim-start"]), diff --git a/packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts b/packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts index 9f14ca4c..9f240c08 100644 --- a/packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts +++ b/packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts @@ -17,6 +17,4 @@ export default new Set([ "esnext.set.is-superset-of.v2", "esnext.set.symmetric-difference.v2", "esnext.set.union.v2", - "esnext.string.is-well-formed", - "esnext.string.to-well-formed", ]); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.27/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.27/output.mjs index 4814c2f1..e93ffcf1 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.27/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.27/output.mjs @@ -49,6 +49,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-reversed.js"; import "core-js/modules/esnext.typed-array.to-sorted.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.28/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.28/output.mjs index af4d013b..91830261 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.28/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.28/output.mjs @@ -58,6 +58,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.dom-exception.stack.js"; import "core-js/modules/web.immediate.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.29/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.29/output.mjs index 3101501a..3f072d70 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.29/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.29/output.mjs @@ -58,6 +58,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.dom-exception.stack.js"; import "core-js/modules/web.immediate.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.30/output.mjs index dc0842c1..59971a3a 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.30/output.mjs @@ -58,6 +58,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.dom-exception.stack.js"; import "core-js/modules/web.immediate.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/input.mjs new file mode 100644 index 00000000..a3a9078c --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/input.mjs @@ -0,0 +1 @@ +import 'core-js/actual'; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/options.json new file mode 100644 index 00000000..eee16d94 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/options.json @@ -0,0 +1,14 @@ +{ + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "version": "3.31", + "method": "entry-global", + "targets": { + "chrome": 107 + } + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/output.mjs new file mode 100644 index 00000000..30124c64 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-chrome-107-corejs-3.31/output.mjs @@ -0,0 +1,70 @@ +import "core-js/modules/es.array.push.js"; +import "core-js/modules/es.array.to-reversed.js"; +import "core-js/modules/es.array.to-sorted.js"; +import "core-js/modules/es.array.to-spliced.js"; +import "core-js/modules/es.array.with.js"; +import "core-js/modules/es.regexp.flags.js"; +import "core-js/modules/es.string.is-well-formed.js"; +import "core-js/modules/es.string.to-well-formed.js"; +import "core-js/modules/es.typed-array.to-reversed.js"; +import "core-js/modules/es.typed-array.to-sorted.js"; +import "core-js/modules/es.typed-array.with.js"; +import "core-js/modules/esnext.suppressed-error.constructor.js"; +import "core-js/modules/esnext.array.from-async.js"; +import "core-js/modules/esnext.array.group.js"; +import "core-js/modules/esnext.array.group-by.js"; +import "core-js/modules/esnext.array.group-by-to-map.js"; +import "core-js/modules/esnext.array.group-to-map.js"; +import "core-js/modules/esnext.array-buffer.detached.js"; +import "core-js/modules/esnext.array-buffer.transfer.js"; +import "core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js"; +import "core-js/modules/esnext.async-iterator.constructor.js"; +import "core-js/modules/esnext.async-iterator.drop.js"; +import "core-js/modules/esnext.async-iterator.every.js"; +import "core-js/modules/esnext.async-iterator.filter.js"; +import "core-js/modules/esnext.async-iterator.find.js"; +import "core-js/modules/esnext.async-iterator.flat-map.js"; +import "core-js/modules/esnext.async-iterator.for-each.js"; +import "core-js/modules/esnext.async-iterator.from.js"; +import "core-js/modules/esnext.async-iterator.map.js"; +import "core-js/modules/esnext.async-iterator.reduce.js"; +import "core-js/modules/esnext.async-iterator.some.js"; +import "core-js/modules/esnext.async-iterator.take.js"; +import "core-js/modules/esnext.async-iterator.to-array.js"; +import "core-js/modules/esnext.disposable-stack.constructor.js"; +import "core-js/modules/esnext.function.metadata.js"; +import "core-js/modules/esnext.iterator.constructor.js"; +import "core-js/modules/esnext.iterator.dispose.js"; +import "core-js/modules/esnext.iterator.drop.js"; +import "core-js/modules/esnext.iterator.every.js"; +import "core-js/modules/esnext.iterator.filter.js"; +import "core-js/modules/esnext.iterator.find.js"; +import "core-js/modules/esnext.iterator.flat-map.js"; +import "core-js/modules/esnext.iterator.for-each.js"; +import "core-js/modules/esnext.iterator.from.js"; +import "core-js/modules/esnext.iterator.map.js"; +import "core-js/modules/esnext.iterator.reduce.js"; +import "core-js/modules/esnext.iterator.some.js"; +import "core-js/modules/esnext.iterator.take.js"; +import "core-js/modules/esnext.iterator.to-array.js"; +import "core-js/modules/esnext.iterator.to-async.js"; +import "core-js/modules/esnext.json.is-raw-json.js"; +import "core-js/modules/esnext.json.parse.js"; +import "core-js/modules/esnext.json.raw-json.js"; +import "core-js/modules/esnext.set.difference.v2.js"; +import "core-js/modules/esnext.set.intersection.v2.js"; +import "core-js/modules/esnext.set.is-disjoint-from.v2.js"; +import "core-js/modules/esnext.set.is-subset-of.v2.js"; +import "core-js/modules/esnext.set.is-superset-of.v2.js"; +import "core-js/modules/esnext.set.symmetric-difference.v2.js"; +import "core-js/modules/esnext.set.union.v2.js"; +import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; +import "core-js/modules/esnext.typed-array.to-spliced.js"; +import "core-js/modules/web.dom-exception.stack.js"; +import "core-js/modules/web.immediate.js"; +import "core-js/modules/web.structured-clone.js"; +import "core-js/modules/web.url.can-parse.js"; +import "core-js/modules/web.url-search-params.delete.js"; +import "core-js/modules/web.url-search-params.has.js"; +import "core-js/modules/web.url-search-params.size.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.21/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.21/output.mjs index 568b0f7b..f8adb8d7 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.21/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.21/output.mjs @@ -261,6 +261,7 @@ import "core-js/modules/esnext.iterator.take.js"; import "core-js/modules/esnext.iterator.to-array.js"; import "core-js/modules/esnext.iterator.to-async.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.find-last.js"; import "core-js/modules/esnext.typed-array.find-last-index.js"; import "core-js/modules/esnext.typed-array.to-reversed.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.25/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.25/output.mjs index 93b65c06..67e54cbe 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.25/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.25/output.mjs @@ -268,6 +268,7 @@ import "core-js/modules/esnext.iterator.take.js"; import "core-js/modules/esnext.iterator.to-array.js"; import "core-js/modules/esnext.iterator.to-async.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-reversed.js"; import "core-js/modules/esnext.typed-array.to-sorted.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.27/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.27/output.mjs index 81ae76e2..3443046c 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.27/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.27/output.mjs @@ -280,6 +280,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-reversed.js"; import "core-js/modules/esnext.typed-array.to-sorted.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.28/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.28/output.mjs index 12bea930..3f541de2 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.28/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.28/output.mjs @@ -289,6 +289,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.atob.js"; import "core-js/modules/web.btoa.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.29/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.29/output.mjs index c0e95c4b..cecbd539 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.29/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.29/output.mjs @@ -289,6 +289,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.atob.js"; import "core-js/modules/web.btoa.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.30/output.mjs index 31bfc988..0bfe2ed0 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.30/output.mjs @@ -289,6 +289,7 @@ import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.string.is-well-formed.js"; import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; import "core-js/modules/esnext.typed-array.to-spliced.js"; import "core-js/modules/web.atob.js"; import "core-js/modules/web.btoa.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/input.mjs new file mode 100644 index 00000000..a3a9078c --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/input.mjs @@ -0,0 +1 @@ +import 'core-js/actual'; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/options.json new file mode 100644 index 00000000..3fa14753 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "version": "3.31", + "method": "entry-global" + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/output.mjs new file mode 100644 index 00000000..2c19f816 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/entry-global/actual-corejs-3.31/output.mjs @@ -0,0 +1,313 @@ +import "core-js/modules/es.symbol.js"; +import "core-js/modules/es.symbol.description.js"; +import "core-js/modules/es.symbol.async-iterator.js"; +import "core-js/modules/es.symbol.has-instance.js"; +import "core-js/modules/es.symbol.is-concat-spreadable.js"; +import "core-js/modules/es.symbol.iterator.js"; +import "core-js/modules/es.symbol.match.js"; +import "core-js/modules/es.symbol.match-all.js"; +import "core-js/modules/es.symbol.replace.js"; +import "core-js/modules/es.symbol.search.js"; +import "core-js/modules/es.symbol.species.js"; +import "core-js/modules/es.symbol.split.js"; +import "core-js/modules/es.symbol.to-primitive.js"; +import "core-js/modules/es.symbol.to-string-tag.js"; +import "core-js/modules/es.symbol.unscopables.js"; +import "core-js/modules/es.error.cause.js"; +import "core-js/modules/es.error.to-string.js"; +import "core-js/modules/es.aggregate-error.js"; +import "core-js/modules/es.aggregate-error.cause.js"; +import "core-js/modules/es.array.at.js"; +import "core-js/modules/es.array.concat.js"; +import "core-js/modules/es.array.copy-within.js"; +import "core-js/modules/es.array.every.js"; +import "core-js/modules/es.array.fill.js"; +import "core-js/modules/es.array.filter.js"; +import "core-js/modules/es.array.find.js"; +import "core-js/modules/es.array.find-index.js"; +import "core-js/modules/es.array.find-last.js"; +import "core-js/modules/es.array.find-last-index.js"; +import "core-js/modules/es.array.flat.js"; +import "core-js/modules/es.array.flat-map.js"; +import "core-js/modules/es.array.for-each.js"; +import "core-js/modules/es.array.from.js"; +import "core-js/modules/es.array.includes.js"; +import "core-js/modules/es.array.index-of.js"; +import "core-js/modules/es.array.is-array.js"; +import "core-js/modules/es.array.iterator.js"; +import "core-js/modules/es.array.join.js"; +import "core-js/modules/es.array.last-index-of.js"; +import "core-js/modules/es.array.map.js"; +import "core-js/modules/es.array.of.js"; +import "core-js/modules/es.array.push.js"; +import "core-js/modules/es.array.reduce.js"; +import "core-js/modules/es.array.reduce-right.js"; +import "core-js/modules/es.array.reverse.js"; +import "core-js/modules/es.array.slice.js"; +import "core-js/modules/es.array.some.js"; +import "core-js/modules/es.array.sort.js"; +import "core-js/modules/es.array.species.js"; +import "core-js/modules/es.array.splice.js"; +import "core-js/modules/es.array.to-reversed.js"; +import "core-js/modules/es.array.to-sorted.js"; +import "core-js/modules/es.array.to-spliced.js"; +import "core-js/modules/es.array.unscopables.flat.js"; +import "core-js/modules/es.array.unscopables.flat-map.js"; +import "core-js/modules/es.array.unshift.js"; +import "core-js/modules/es.array.with.js"; +import "core-js/modules/es.array-buffer.constructor.js"; +import "core-js/modules/es.array-buffer.is-view.js"; +import "core-js/modules/es.array-buffer.slice.js"; +import "core-js/modules/es.data-view.js"; +import "core-js/modules/es.date.get-year.js"; +import "core-js/modules/es.date.now.js"; +import "core-js/modules/es.date.set-year.js"; +import "core-js/modules/es.date.to-gmt-string.js"; +import "core-js/modules/es.date.to-iso-string.js"; +import "core-js/modules/es.date.to-json.js"; +import "core-js/modules/es.date.to-primitive.js"; +import "core-js/modules/es.date.to-string.js"; +import "core-js/modules/es.escape.js"; +import "core-js/modules/es.function.bind.js"; +import "core-js/modules/es.function.has-instance.js"; +import "core-js/modules/es.function.name.js"; +import "core-js/modules/es.global-this.js"; +import "core-js/modules/es.json.stringify.js"; +import "core-js/modules/es.json.to-string-tag.js"; +import "core-js/modules/es.map.js"; +import "core-js/modules/es.math.acosh.js"; +import "core-js/modules/es.math.asinh.js"; +import "core-js/modules/es.math.atanh.js"; +import "core-js/modules/es.math.cbrt.js"; +import "core-js/modules/es.math.clz32.js"; +import "core-js/modules/es.math.cosh.js"; +import "core-js/modules/es.math.expm1.js"; +import "core-js/modules/es.math.fround.js"; +import "core-js/modules/es.math.hypot.js"; +import "core-js/modules/es.math.imul.js"; +import "core-js/modules/es.math.log10.js"; +import "core-js/modules/es.math.log1p.js"; +import "core-js/modules/es.math.log2.js"; +import "core-js/modules/es.math.sign.js"; +import "core-js/modules/es.math.sinh.js"; +import "core-js/modules/es.math.tanh.js"; +import "core-js/modules/es.math.to-string-tag.js"; +import "core-js/modules/es.math.trunc.js"; +import "core-js/modules/es.number.constructor.js"; +import "core-js/modules/es.number.epsilon.js"; +import "core-js/modules/es.number.is-finite.js"; +import "core-js/modules/es.number.is-integer.js"; +import "core-js/modules/es.number.is-nan.js"; +import "core-js/modules/es.number.is-safe-integer.js"; +import "core-js/modules/es.number.max-safe-integer.js"; +import "core-js/modules/es.number.min-safe-integer.js"; +import "core-js/modules/es.number.parse-float.js"; +import "core-js/modules/es.number.parse-int.js"; +import "core-js/modules/es.number.to-exponential.js"; +import "core-js/modules/es.number.to-fixed.js"; +import "core-js/modules/es.number.to-precision.js"; +import "core-js/modules/es.object.assign.js"; +import "core-js/modules/es.object.create.js"; +import "core-js/modules/es.object.define-getter.js"; +import "core-js/modules/es.object.define-properties.js"; +import "core-js/modules/es.object.define-property.js"; +import "core-js/modules/es.object.define-setter.js"; +import "core-js/modules/es.object.entries.js"; +import "core-js/modules/es.object.freeze.js"; +import "core-js/modules/es.object.from-entries.js"; +import "core-js/modules/es.object.get-own-property-descriptor.js"; +import "core-js/modules/es.object.get-own-property-descriptors.js"; +import "core-js/modules/es.object.get-own-property-names.js"; +import "core-js/modules/es.object.get-prototype-of.js"; +import "core-js/modules/es.object.has-own.js"; +import "core-js/modules/es.object.is.js"; +import "core-js/modules/es.object.is-extensible.js"; +import "core-js/modules/es.object.is-frozen.js"; +import "core-js/modules/es.object.is-sealed.js"; +import "core-js/modules/es.object.keys.js"; +import "core-js/modules/es.object.lookup-getter.js"; +import "core-js/modules/es.object.lookup-setter.js"; +import "core-js/modules/es.object.prevent-extensions.js"; +import "core-js/modules/es.object.proto.js"; +import "core-js/modules/es.object.seal.js"; +import "core-js/modules/es.object.set-prototype-of.js"; +import "core-js/modules/es.object.to-string.js"; +import "core-js/modules/es.object.values.js"; +import "core-js/modules/es.parse-float.js"; +import "core-js/modules/es.parse-int.js"; +import "core-js/modules/es.promise.js"; +import "core-js/modules/es.promise.all-settled.js"; +import "core-js/modules/es.promise.any.js"; +import "core-js/modules/es.promise.finally.js"; +import "core-js/modules/es.reflect.apply.js"; +import "core-js/modules/es.reflect.construct.js"; +import "core-js/modules/es.reflect.define-property.js"; +import "core-js/modules/es.reflect.delete-property.js"; +import "core-js/modules/es.reflect.get.js"; +import "core-js/modules/es.reflect.get-own-property-descriptor.js"; +import "core-js/modules/es.reflect.get-prototype-of.js"; +import "core-js/modules/es.reflect.has.js"; +import "core-js/modules/es.reflect.is-extensible.js"; +import "core-js/modules/es.reflect.own-keys.js"; +import "core-js/modules/es.reflect.prevent-extensions.js"; +import "core-js/modules/es.reflect.set.js"; +import "core-js/modules/es.reflect.set-prototype-of.js"; +import "core-js/modules/es.reflect.to-string-tag.js"; +import "core-js/modules/es.regexp.constructor.js"; +import "core-js/modules/es.regexp.dot-all.js"; +import "core-js/modules/es.regexp.exec.js"; +import "core-js/modules/es.regexp.flags.js"; +import "core-js/modules/es.regexp.sticky.js"; +import "core-js/modules/es.regexp.test.js"; +import "core-js/modules/es.regexp.to-string.js"; +import "core-js/modules/es.set.js"; +import "core-js/modules/es.string.at-alternative.js"; +import "core-js/modules/es.string.code-point-at.js"; +import "core-js/modules/es.string.ends-with.js"; +import "core-js/modules/es.string.from-code-point.js"; +import "core-js/modules/es.string.includes.js"; +import "core-js/modules/es.string.is-well-formed.js"; +import "core-js/modules/es.string.iterator.js"; +import "core-js/modules/es.string.match.js"; +import "core-js/modules/es.string.match-all.js"; +import "core-js/modules/es.string.pad-end.js"; +import "core-js/modules/es.string.pad-start.js"; +import "core-js/modules/es.string.raw.js"; +import "core-js/modules/es.string.repeat.js"; +import "core-js/modules/es.string.replace.js"; +import "core-js/modules/es.string.replace-all.js"; +import "core-js/modules/es.string.search.js"; +import "core-js/modules/es.string.split.js"; +import "core-js/modules/es.string.starts-with.js"; +import "core-js/modules/es.string.substr.js"; +import "core-js/modules/es.string.to-well-formed.js"; +import "core-js/modules/es.string.trim.js"; +import "core-js/modules/es.string.trim-end.js"; +import "core-js/modules/es.string.trim-start.js"; +import "core-js/modules/es.string.anchor.js"; +import "core-js/modules/es.string.big.js"; +import "core-js/modules/es.string.blink.js"; +import "core-js/modules/es.string.bold.js"; +import "core-js/modules/es.string.fixed.js"; +import "core-js/modules/es.string.fontcolor.js"; +import "core-js/modules/es.string.fontsize.js"; +import "core-js/modules/es.string.italics.js"; +import "core-js/modules/es.string.link.js"; +import "core-js/modules/es.string.small.js"; +import "core-js/modules/es.string.strike.js"; +import "core-js/modules/es.string.sub.js"; +import "core-js/modules/es.string.sup.js"; +import "core-js/modules/es.typed-array.float32-array.js"; +import "core-js/modules/es.typed-array.float64-array.js"; +import "core-js/modules/es.typed-array.int8-array.js"; +import "core-js/modules/es.typed-array.int16-array.js"; +import "core-js/modules/es.typed-array.int32-array.js"; +import "core-js/modules/es.typed-array.uint8-array.js"; +import "core-js/modules/es.typed-array.uint8-clamped-array.js"; +import "core-js/modules/es.typed-array.uint16-array.js"; +import "core-js/modules/es.typed-array.uint32-array.js"; +import "core-js/modules/es.typed-array.at.js"; +import "core-js/modules/es.typed-array.copy-within.js"; +import "core-js/modules/es.typed-array.every.js"; +import "core-js/modules/es.typed-array.fill.js"; +import "core-js/modules/es.typed-array.filter.js"; +import "core-js/modules/es.typed-array.find.js"; +import "core-js/modules/es.typed-array.find-index.js"; +import "core-js/modules/es.typed-array.find-last.js"; +import "core-js/modules/es.typed-array.find-last-index.js"; +import "core-js/modules/es.typed-array.for-each.js"; +import "core-js/modules/es.typed-array.from.js"; +import "core-js/modules/es.typed-array.includes.js"; +import "core-js/modules/es.typed-array.index-of.js"; +import "core-js/modules/es.typed-array.iterator.js"; +import "core-js/modules/es.typed-array.join.js"; +import "core-js/modules/es.typed-array.last-index-of.js"; +import "core-js/modules/es.typed-array.map.js"; +import "core-js/modules/es.typed-array.of.js"; +import "core-js/modules/es.typed-array.reduce.js"; +import "core-js/modules/es.typed-array.reduce-right.js"; +import "core-js/modules/es.typed-array.reverse.js"; +import "core-js/modules/es.typed-array.set.js"; +import "core-js/modules/es.typed-array.slice.js"; +import "core-js/modules/es.typed-array.some.js"; +import "core-js/modules/es.typed-array.sort.js"; +import "core-js/modules/es.typed-array.subarray.js"; +import "core-js/modules/es.typed-array.to-locale-string.js"; +import "core-js/modules/es.typed-array.to-reversed.js"; +import "core-js/modules/es.typed-array.to-sorted.js"; +import "core-js/modules/es.typed-array.to-string.js"; +import "core-js/modules/es.typed-array.with.js"; +import "core-js/modules/es.unescape.js"; +import "core-js/modules/es.weak-map.js"; +import "core-js/modules/es.weak-set.js"; +import "core-js/modules/esnext.suppressed-error.constructor.js"; +import "core-js/modules/esnext.array.from-async.js"; +import "core-js/modules/esnext.array.group.js"; +import "core-js/modules/esnext.array.group-by.js"; +import "core-js/modules/esnext.array.group-by-to-map.js"; +import "core-js/modules/esnext.array.group-to-map.js"; +import "core-js/modules/esnext.array-buffer.detached.js"; +import "core-js/modules/esnext.array-buffer.transfer.js"; +import "core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js"; +import "core-js/modules/esnext.async-iterator.constructor.js"; +import "core-js/modules/esnext.async-iterator.drop.js"; +import "core-js/modules/esnext.async-iterator.every.js"; +import "core-js/modules/esnext.async-iterator.filter.js"; +import "core-js/modules/esnext.async-iterator.find.js"; +import "core-js/modules/esnext.async-iterator.flat-map.js"; +import "core-js/modules/esnext.async-iterator.for-each.js"; +import "core-js/modules/esnext.async-iterator.from.js"; +import "core-js/modules/esnext.async-iterator.map.js"; +import "core-js/modules/esnext.async-iterator.reduce.js"; +import "core-js/modules/esnext.async-iterator.some.js"; +import "core-js/modules/esnext.async-iterator.take.js"; +import "core-js/modules/esnext.async-iterator.to-array.js"; +import "core-js/modules/esnext.disposable-stack.constructor.js"; +import "core-js/modules/esnext.function.metadata.js"; +import "core-js/modules/esnext.iterator.constructor.js"; +import "core-js/modules/esnext.iterator.dispose.js"; +import "core-js/modules/esnext.iterator.drop.js"; +import "core-js/modules/esnext.iterator.every.js"; +import "core-js/modules/esnext.iterator.filter.js"; +import "core-js/modules/esnext.iterator.find.js"; +import "core-js/modules/esnext.iterator.flat-map.js"; +import "core-js/modules/esnext.iterator.for-each.js"; +import "core-js/modules/esnext.iterator.from.js"; +import "core-js/modules/esnext.iterator.map.js"; +import "core-js/modules/esnext.iterator.reduce.js"; +import "core-js/modules/esnext.iterator.some.js"; +import "core-js/modules/esnext.iterator.take.js"; +import "core-js/modules/esnext.iterator.to-array.js"; +import "core-js/modules/esnext.iterator.to-async.js"; +import "core-js/modules/esnext.json.is-raw-json.js"; +import "core-js/modules/esnext.json.parse.js"; +import "core-js/modules/esnext.json.raw-json.js"; +import "core-js/modules/esnext.set.difference.v2.js"; +import "core-js/modules/esnext.set.intersection.v2.js"; +import "core-js/modules/esnext.set.is-disjoint-from.v2.js"; +import "core-js/modules/esnext.set.is-subset-of.v2.js"; +import "core-js/modules/esnext.set.is-superset-of.v2.js"; +import "core-js/modules/esnext.set.symmetric-difference.v2.js"; +import "core-js/modules/esnext.set.union.v2.js"; +import "core-js/modules/esnext.symbol.dispose.js"; +import "core-js/modules/esnext.symbol.metadata.js"; +import "core-js/modules/esnext.typed-array.to-spliced.js"; +import "core-js/modules/web.atob.js"; +import "core-js/modules/web.btoa.js"; +import "core-js/modules/web.dom-collections.for-each.js"; +import "core-js/modules/web.dom-collections.iterator.js"; +import "core-js/modules/web.dom-exception.constructor.js"; +import "core-js/modules/web.dom-exception.stack.js"; +import "core-js/modules/web.dom-exception.to-string-tag.js"; +import "core-js/modules/web.immediate.js"; +import "core-js/modules/web.queue-microtask.js"; +import "core-js/modules/web.self.js"; +import "core-js/modules/web.structured-clone.js"; +import "core-js/modules/web.timers.js"; +import "core-js/modules/web.url.js"; +import "core-js/modules/web.url.can-parse.js"; +import "core-js/modules/web.url.to-json.js"; +import "core-js/modules/web.url-search-params.js"; +import "core-js/modules/web.url-search-params.delete.js"; +import "core-js/modules/web.url-search-params.has.js"; +import "core-js/modules/web.url-search-params.size.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.27/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.27/output.mjs index 9a5e81b4..0f03d672 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.27/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.27/output.mjs @@ -33,6 +33,8 @@ import "core-js/modules/web.structured-clone.js"; import "core-js/modules/web.btoa.js"; import "core-js/modules/esnext.array.with.js"; import "core-js/modules/es.object.proto.js"; +import "core-js/modules/esnext.string.is-well-formed.js"; +import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/es.string.from-code-point.js"; import "core-js/modules/es.weak-map.js"; import "core-js/modules/web.self.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.28/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.28/output.mjs index 959c0d14..e7303cf6 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.28/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.28/output.mjs @@ -33,6 +33,8 @@ import "core-js/modules/web.structured-clone.js"; import "core-js/modules/web.btoa.js"; import "core-js/modules/es.array.with.js"; import "core-js/modules/es.object.proto.js"; +import "core-js/modules/esnext.string.is-well-formed.js"; +import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/es.string.from-code-point.js"; import "core-js/modules/es.weak-map.js"; import "core-js/modules/web.self.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.29/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.29/output.mjs index 0708c4bc..c7bbbd7e 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.29/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.29/output.mjs @@ -34,6 +34,8 @@ import "core-js/modules/web.structured-clone.js"; import "core-js/modules/web.btoa.js"; import "core-js/modules/es.array.with.js"; import "core-js/modules/es.object.proto.js"; +import "core-js/modules/esnext.string.is-well-formed.js"; +import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/es.string.from-code-point.js"; import "core-js/modules/es.weak-map.js"; import "core-js/modules/web.self.js"; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/input.mjs index a038340a..b1df2e6c 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/input.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/input.mjs @@ -75,3 +75,11 @@ new URLSearchParams(string).size; new Set(array).intersection(otherSet); URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/output.mjs index 54487f74..adf6dd2b 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.30/output.mjs @@ -34,6 +34,8 @@ import "core-js/modules/web.structured-clone.js"; import "core-js/modules/web.btoa.js"; import "core-js/modules/es.array.with.js"; import "core-js/modules/es.object.proto.js"; +import "core-js/modules/esnext.string.is-well-formed.js"; +import "core-js/modules/esnext.string.to-well-formed.js"; import "core-js/modules/es.string.from-code-point.js"; import "core-js/modules/es.weak-map.js"; import "core-js/modules/web.self.js"; @@ -94,3 +96,10 @@ Function.demethodize(); new URLSearchParams(string).size; new Set(array).intersection(otherSet); URL.canParse(foo); +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/input.mjs new file mode 100644 index 00000000..b1df2e6c --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/input.mjs @@ -0,0 +1,85 @@ +[].findLast(fn); +[].findLastIndex(fn); + +[].asIndexedPairs(); + +Iterator.from({ + next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) + }).forEach(console.log).toArray(); + +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) + .drop(1) + .take(5) + .filter(it => it % 2) + .groupBy(it => id % 4) + .map(it => it ** 2) + .toArray() + .then(console.log); + +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); + +Number.range(1, 2); +BigInt.range(1n, 2n); + +Array.isTemplateObject((x => x)`a${ x }z`) + +new Map([['x', 1]]).emplace('x', { update: x => x + 1, insert: () => 0}); + +/x/.dotAll; +/x/.sticky + +Symbol.asyncDispose +Symbol.matcher +Symbol.matchAll +Symbol.metadata +Symbol.replaceAll + +new URL(url); + +const foo = [1, 2, 3].groupByToMap(bar); + +const push = [].push.unThis(); + +Function.isConstructor; + +throw new DOMException(); + +structuredClone(72); + +btoa('hi'); + +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; + +string.isWellFormed; +string.toWellFormed; + +String.dedent`42`; + +self; +SuppressedError +DisposableStack; +AsyncDisposableStack; + +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); + +new URLSearchParams(string).size; +new Set(array).intersection(otherSet); + +URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/options.json new file mode 100644 index 00000000..2c342d40 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "version": "3.31", + "method": "usage-global" + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/output.mjs new file mode 100644 index 00000000..6340ee23 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-corejs-3.31/output.mjs @@ -0,0 +1,107 @@ +import "core-js/modules/es.array.find-last.js"; +import "core-js/modules/es.array.find-last-index.js"; +import "core-js/modules/es.object.to-string.js"; +import "core-js/modules/es.promise.js"; +import "core-js/modules/es.array.for-each.js"; +import "core-js/modules/web.dom-collections.for-each.js"; +import "core-js/modules/es.array.iterator.js"; +import "core-js/modules/es.string.iterator.js"; +import "core-js/modules/web.dom-collections.iterator.js"; +import "core-js/modules/es.array.map.js"; +import "core-js/modules/es.array.filter.js"; +import "core-js/modules/es.map.js"; +import "core-js/modules/es.number.constructor.js"; +import "core-js/modules/es.regexp.dot-all.js"; +import "core-js/modules/es.regexp.sticky.js"; +import "core-js/modules/es.symbol.js"; +import "core-js/modules/es.symbol.description.js"; +import "core-js/modules/es.symbol.match-all.js"; +import "core-js/modules/es.string.match-all.js"; +import "core-js/modules/es.regexp.exec.js"; +import "core-js/modules/es.string.replace.js"; +import "core-js/modules/es.string.replace-all.js"; +import "core-js/modules/web.url.js"; +import "core-js/modules/web.url-search-params.js"; +import "core-js/modules/web.url-search-params.delete.js"; +import "core-js/modules/web.url-search-params.has.js"; +import "core-js/modules/web.url-search-params.size.js"; +import "core-js/modules/es.array.push.js"; +import "core-js/modules/es.error.to-string.js"; +import "core-js/modules/web.dom-exception.constructor.js"; +import "core-js/modules/web.dom-exception.stack.js"; +import "core-js/modules/web.dom-exception.to-string-tag.js"; +import "core-js/modules/es.object.keys.js"; +import "core-js/modules/es.set.js"; +import "core-js/modules/web.structured-clone.js"; +import "core-js/modules/web.btoa.js"; +import "core-js/modules/es.array.with.js"; +import "core-js/modules/es.object.proto.js"; +import "core-js/modules/es.string.is-well-formed.js"; +import "core-js/modules/es.string.to-well-formed.js"; +import "core-js/modules/es.string.from-code-point.js"; +import "core-js/modules/es.weak-map.js"; +import "core-js/modules/web.self.js"; +import "core-js/modules/es.error.cause.js"; +import "core-js/modules/es.object.create.js"; +import "core-js/modules/es.object.freeze.js"; +import "core-js/modules/web.url.can-parse.js"; +[].findLast(fn); +[].findLastIndex(fn); +[].asIndexedPairs(); +Iterator.from({ + next: () => ({ + done: Math.random() > .9, + value: Math.random() * 10 | 0 + }) +}).forEach(console.log).toArray(); +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]).drop(1).take(5).filter(it => it % 2).groupBy(it => id % 4).map(it => it ** 2).toArray().then(console.log); +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); +Number.range(1, 2); +BigInt.range(1n, 2n); +Array.isTemplateObject((x => x)`a${x}z`); +new Map([['x', 1]]).emplace('x', { + update: x => x + 1, + insert: () => 0 +}); +/x/.dotAll; +/x/.sticky; +Symbol.asyncDispose; +Symbol.matcher; +Symbol.matchAll; +Symbol.metadata; +Symbol.replaceAll; +new URL(url); +const foo = [1, 2, 3].groupByToMap(bar); +const push = [].push.unThis(); +Function.isConstructor; +throw new DOMException(); +structuredClone(72); +btoa('hi'); +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; +string.isWellFormed; +string.toWellFormed; +String.dedent`42`; +self; +SuppressedError; +DisposableStack; +AsyncDisposableStack; +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); +new URLSearchParams(string).size; +new Set(array).intersection(otherSet); +URL.canParse(foo); +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/input.mjs index a038340a..b1df2e6c 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/input.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/input.mjs @@ -75,3 +75,11 @@ new URLSearchParams(string).size; new Set(array).intersection(otherSet); URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/output.mjs index 2e9e240c..d27e3251 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.30/output.mjs @@ -91,6 +91,7 @@ import "core-js/modules/esnext.set.symmetric-difference.js"; import "core-js/modules/esnext.set.union.v2.js"; import "core-js/modules/esnext.set.union.js"; import "core-js/modules/web.url.can-parse.js"; +import "core-js/modules/esnext.map.group-by.js"; [].findLast(fn); [].findLastIndex(fn); [].asIndexedPairs(); @@ -144,3 +145,10 @@ Function.demethodize(); new URLSearchParams(string).size; new Set(array).intersection(otherSet); URL.canParse(foo); +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/input.mjs new file mode 100644 index 00000000..b1df2e6c --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/input.mjs @@ -0,0 +1,85 @@ +[].findLast(fn); +[].findLastIndex(fn); + +[].asIndexedPairs(); + +Iterator.from({ + next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) + }).forEach(console.log).toArray(); + +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) + .drop(1) + .take(5) + .filter(it => it % 2) + .groupBy(it => id % 4) + .map(it => it ** 2) + .toArray() + .then(console.log); + +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); + +Number.range(1, 2); +BigInt.range(1n, 2n); + +Array.isTemplateObject((x => x)`a${ x }z`) + +new Map([['x', 1]]).emplace('x', { update: x => x + 1, insert: () => 0}); + +/x/.dotAll; +/x/.sticky + +Symbol.asyncDispose +Symbol.matcher +Symbol.matchAll +Symbol.metadata +Symbol.replaceAll + +new URL(url); + +const foo = [1, 2, 3].groupByToMap(bar); + +const push = [].push.unThis(); + +Function.isConstructor; + +throw new DOMException(); + +structuredClone(72); + +btoa('hi'); + +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; + +string.isWellFormed; +string.toWellFormed; + +String.dedent`42`; + +self; +SuppressedError +DisposableStack; +AsyncDisposableStack; + +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); + +new URLSearchParams(string).size; +new Set(array).intersection(otherSet); + +URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/options.json new file mode 100644 index 00000000..ccd1e505 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/options.json @@ -0,0 +1,15 @@ +{ + "targets": { + "chrome": 107 + }, + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "method": "usage-global", + "version": "3.31", + "proposals": true + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/output.mjs new file mode 100644 index 00000000..fe02109a --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-global/all-proposals-chrome-107-corejs-3.31/output.mjs @@ -0,0 +1,161 @@ +import "core-js/modules/esnext.async-iterator.constructor.js"; +import "core-js/modules/esnext.async-iterator.to-array.js"; +import "core-js/modules/esnext.iterator.constructor.js"; +import "core-js/modules/esnext.iterator.to-array.js"; +import "core-js/modules/esnext.async-iterator.for-each.js"; +import "core-js/modules/esnext.iterator.for-each.js"; +import "core-js/modules/esnext.iterator.from.js"; +import "core-js/modules/esnext.async-iterator.map.js"; +import "core-js/modules/esnext.iterator.map.js"; +import "core-js/modules/esnext.array.group-by.js"; +import "core-js/modules/esnext.async-iterator.filter.js"; +import "core-js/modules/esnext.iterator.filter.js"; +import "core-js/modules/esnext.async-iterator.take.js"; +import "core-js/modules/esnext.iterator.take.js"; +import "core-js/modules/esnext.async-iterator.drop.js"; +import "core-js/modules/esnext.iterator.drop.js"; +import "core-js/modules/esnext.async-iterator.every.js"; +import "core-js/modules/esnext.async-iterator.find.js"; +import "core-js/modules/esnext.async-iterator.flat-map.js"; +import "core-js/modules/esnext.async-iterator.from.js"; +import "core-js/modules/esnext.async-iterator.reduce.js"; +import "core-js/modules/esnext.async-iterator.some.js"; +import "core-js/modules/esnext.array.unique-by.js"; +import "core-js/modules/esnext.number.range.js"; +import "core-js/modules/esnext.bigint.range.js"; +import "core-js/modules/esnext.array.is-template-object.js"; +import "core-js/modules/esnext.map.emplace.js"; +import "core-js/modules/esnext.weak-map.emplace.js"; +import "core-js/modules/esnext.map.delete-all.js"; +import "core-js/modules/esnext.map.every.js"; +import "core-js/modules/esnext.map.filter.js"; +import "core-js/modules/esnext.map.find.js"; +import "core-js/modules/esnext.map.find-key.js"; +import "core-js/modules/esnext.map.includes.js"; +import "core-js/modules/esnext.map.key-of.js"; +import "core-js/modules/esnext.map.map-keys.js"; +import "core-js/modules/esnext.map.map-values.js"; +import "core-js/modules/esnext.map.merge.js"; +import "core-js/modules/esnext.map.reduce.js"; +import "core-js/modules/esnext.map.some.js"; +import "core-js/modules/esnext.map.update.js"; +import "core-js/modules/esnext.async-iterator.async-dispose.js"; +import "core-js/modules/esnext.symbol.async-dispose.js"; +import "core-js/modules/esnext.symbol.matcher.js"; +import "core-js/modules/esnext.function.metadata.js"; +import "core-js/modules/esnext.symbol.metadata.js"; +import "core-js/modules/web.url-search-params.delete.js"; +import "core-js/modules/web.url-search-params.has.js"; +import "core-js/modules/web.url-search-params.size.js"; +import "core-js/modules/esnext.array.group-by-to-map.js"; +import "core-js/modules/esnext.function.un-this.js"; +import "core-js/modules/es.array.push.js"; +import "core-js/modules/esnext.function.is-constructor.js"; +import "core-js/modules/web.dom-exception.stack.js"; +import "core-js/modules/web.structured-clone.js"; +import "core-js/modules/esnext.async-iterator.indexed.js"; +import "core-js/modules/esnext.iterator.indexed.js"; +import "core-js/modules/es.array.with.js"; +import "core-js/modules/es.string.is-well-formed.js"; +import "core-js/modules/es.string.to-well-formed.js"; +import "core-js/modules/esnext.string.dedent.js"; +import "core-js/modules/esnext.suppressed-error.constructor.js"; +import "core-js/modules/esnext.disposable-stack.constructor.js"; +import "core-js/modules/esnext.iterator.dispose.js"; +import "core-js/modules/esnext.async-disposable-stack.constructor.js"; +import "core-js/modules/esnext.iterator.range.js"; +import "core-js/modules/esnext.json.parse.js"; +import "core-js/modules/esnext.json.is-raw-json.js"; +import "core-js/modules/esnext.json.raw-json.js"; +import "core-js/modules/esnext.symbol.is-well-known.js"; +import "core-js/modules/esnext.symbol.is-registered.js"; +import "core-js/modules/esnext.function.demethodize.js"; +import "core-js/modules/esnext.set.add-all.js"; +import "core-js/modules/esnext.set.delete-all.js"; +import "core-js/modules/esnext.set.difference.v2.js"; +import "core-js/modules/esnext.set.difference.js"; +import "core-js/modules/esnext.set.every.js"; +import "core-js/modules/esnext.set.filter.js"; +import "core-js/modules/esnext.set.find.js"; +import "core-js/modules/esnext.set.intersection.v2.js"; +import "core-js/modules/esnext.set.intersection.js"; +import "core-js/modules/esnext.set.is-disjoint-from.v2.js"; +import "core-js/modules/esnext.set.is-disjoint-from.js"; +import "core-js/modules/esnext.set.is-subset-of.v2.js"; +import "core-js/modules/esnext.set.is-subset-of.js"; +import "core-js/modules/esnext.set.is-superset-of.v2.js"; +import "core-js/modules/esnext.set.is-superset-of.js"; +import "core-js/modules/esnext.set.join.js"; +import "core-js/modules/esnext.set.map.js"; +import "core-js/modules/esnext.set.reduce.js"; +import "core-js/modules/esnext.set.some.js"; +import "core-js/modules/esnext.set.symmetric-difference.v2.js"; +import "core-js/modules/esnext.set.symmetric-difference.js"; +import "core-js/modules/esnext.set.union.v2.js"; +import "core-js/modules/esnext.set.union.js"; +import "core-js/modules/web.url.can-parse.js"; +import "core-js/modules/esnext.symbol.is-well-known-symbol.js"; +import "core-js/modules/esnext.symbol.is-registered-symbol.js"; +import "core-js/modules/esnext.object.group-by.js"; +import "core-js/modules/esnext.map.group-by.js"; +import "core-js/modules/esnext.promise.with-resolvers.js"; +[].findLast(fn); +[].findLastIndex(fn); +[].asIndexedPairs(); +Iterator.from({ + next: () => ({ + done: Math.random() > .9, + value: Math.random() * 10 | 0 + }) +}).forEach(console.log).toArray(); +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]).drop(1).take(5).filter(it => it % 2).groupBy(it => id % 4).map(it => it ** 2).toArray().then(console.log); +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); +Number.range(1, 2); +BigInt.range(1n, 2n); +Array.isTemplateObject((x => x)`a${x}z`); +new Map([['x', 1]]).emplace('x', { + update: x => x + 1, + insert: () => 0 +}); +/x/.dotAll; +/x/.sticky; +Symbol.asyncDispose; +Symbol.matcher; +Symbol.matchAll; +Symbol.metadata; +Symbol.replaceAll; +new URL(url); +const foo = [1, 2, 3].groupByToMap(bar); +const push = [].push.unThis(); +Function.isConstructor; +throw new DOMException(); +structuredClone(72); +btoa('hi'); +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; +string.isWellFormed; +string.toWellFormed; +String.dedent`42`; +self; +SuppressedError; +DisposableStack; +AsyncDisposableStack; +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); +new URLSearchParams(string).size; +new Set(array).intersection(otherSet); +URL.canParse(foo); +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.27/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.27/output.mjs index b6675040..d82f3213 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.27/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.27/output.mjs @@ -15,6 +15,8 @@ import _DOMException from "core-js-pure/stable/dom-exception.js"; import _structuredClone from "core-js-pure/stable/structured-clone.js"; import _btoa from "core-js-pure/stable/btoa.js"; import _withInstanceProperty from "core-js-pure/features/instance/with.js"; +import _isWellFormedInstanceProperty from "core-js-pure/features/instance/is-well-formed.js"; +import _toWellFormedInstanceProperty from "core-js-pure/features/instance/to-well-formed.js"; import _self from "core-js-pure/stable/self.js"; _findLastInstanceProperty(_context = []).call(_context, fn); @@ -68,8 +70,11 @@ _withInstanceProperty(bar); _pushInstanceProperty(buz); fuz.__proto__; -string.isWellFormed; -string.toWellFormed; + +_isWellFormedInstanceProperty(string); + +_toWellFormedInstanceProperty(string); + String.dedent`42`; _self; SuppressedError; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.28/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.28/output.mjs index 6baf1bee..4092bd48 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.28/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.28/output.mjs @@ -15,6 +15,8 @@ import _DOMException from "core-js-pure/stable/dom-exception.js"; import _structuredClone from "core-js-pure/stable/structured-clone.js"; import _btoa from "core-js-pure/stable/btoa.js"; import _withInstanceProperty from "core-js-pure/stable/instance/with.js"; +import _isWellFormedInstanceProperty from "core-js-pure/features/instance/is-well-formed.js"; +import _toWellFormedInstanceProperty from "core-js-pure/features/instance/to-well-formed.js"; import _self from "core-js-pure/stable/self.js"; _findLastInstanceProperty(_context = []).call(_context, fn); @@ -68,8 +70,11 @@ _withInstanceProperty(bar); _pushInstanceProperty(buz); fuz.__proto__; -string.isWellFormed; -string.toWellFormed; + +_isWellFormedInstanceProperty(string); + +_toWellFormedInstanceProperty(string); + String.dedent`42`; _self; SuppressedError; diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/input.mjs index cbc0b3b7..c737f1b2 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/input.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/input.mjs @@ -72,3 +72,11 @@ Symbol.isRegistered(foo); Function.demethodize(); URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/output.mjs index fa493241..d668e6f8 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.30/output.mjs @@ -15,8 +15,12 @@ import _DOMException from "core-js-pure/stable/dom-exception.js"; import _structuredClone from "core-js-pure/stable/structured-clone.js"; import _btoa from "core-js-pure/stable/btoa.js"; import _withInstanceProperty from "core-js-pure/stable/instance/with.js"; +import _isWellFormedInstanceProperty from "core-js-pure/features/instance/is-well-formed.js"; +import _toWellFormedInstanceProperty from "core-js-pure/features/instance/to-well-formed.js"; import _self from "core-js-pure/stable/self.js"; import _URL$canParse from "core-js-pure/stable/url/can-parse.js"; +import _Promise from "core-js-pure/stable/promise/index.js"; +import _URLSearchParams from "core-js-pure/stable/url-search-params/index.js"; _findLastInstanceProperty(_context = []).call(_context, fn); @@ -69,8 +73,11 @@ _withInstanceProperty(bar); _pushInstanceProperty(buz); fuz.__proto__; -string.isWellFormed; -string.toWellFormed; + +_isWellFormedInstanceProperty(string); + +_toWellFormedInstanceProperty(string); + String.dedent`42`; _self; SuppressedError; @@ -88,3 +95,16 @@ _Symbol.isRegistered(foo); Function.demethodize(); _URL$canParse(foo); + +_Symbol.isWellKnownSymbol(foo); + +_Symbol.isRegisteredSymbol(foo); + +_Symbol.metadata; +Object.groupBy(a, b); + +_Map.groupBy(a, b); + +_Promise.withResolvers(); + +new _URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/input.mjs new file mode 100644 index 00000000..c737f1b2 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/input.mjs @@ -0,0 +1,82 @@ +[].findLast(fn); +[].findLastIndex(fn); + +[].asIndexedPairs(); + +Iterator.from({ + next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) + }).forEach(console.log).toArray(); + +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) + .drop(1) + .take(5) + .filter(it => it % 2) + .groupBy(it => id % 4) + .map(it => it ** 2) + .toArray() + .then(console.log); + +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); + +Number.range(1, 2); +BigInt.range(1n, 2n); + +Array.isTemplateObject((x => x)`a${ x }z`) + +new Map([['x', 1]]).emplace('x', { update: x => x + 1, insert: () => 0}); + +/x/.dotAll; +/x/.sticky + +Symbol.asyncDispose +Symbol.matcher +Symbol.matchAll +Symbol.metadata +Symbol.replaceAll + +new URL(url); + +const foo = [1, 2, 3].groupByToMap(bar); + +const push = [].push.unThis(); + +Function.isConstructor; + +throw new DOMException(); + +structuredClone(72); + +btoa('hi'); + +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; + +string.isWellFormed; +string.toWellFormed; + +String.dedent`42`; + +self; +SuppressedError +DisposableStack; +AsyncDisposableStack; + +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); + +URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/options.json new file mode 100644 index 00000000..1c42d782 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "method": "usage-pure", + "version": "3.31" + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/output.mjs new file mode 100644 index 00000000..ede21020 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-corejs-3.31/output.mjs @@ -0,0 +1,110 @@ +var _context, _context2, _context3, _context4, _context5; + +import _findLastInstanceProperty from "core-js-pure/stable/instance/find-last.js"; +import _findLastIndexInstanceProperty from "core-js-pure/stable/instance/find-last-index.js"; +import _forEachInstanceProperty from "core-js-pure/stable/instance/for-each.js"; +import _mapInstanceProperty from "core-js-pure/stable/instance/map.js"; +import _filterInstanceProperty from "core-js-pure/stable/instance/filter.js"; +import _Map from "core-js-pure/stable/map/index.js"; +import _Symbol from "core-js-pure/stable/symbol/index.js"; +import _Symbol$matchAll from "core-js-pure/stable/symbol/match-all.js"; +import _replaceAllInstanceProperty from "core-js-pure/stable/instance/replace-all.js"; +import _URL from "core-js-pure/stable/url/index.js"; +import _pushInstanceProperty from "core-js-pure/stable/instance/push.js"; +import _DOMException from "core-js-pure/stable/dom-exception.js"; +import _structuredClone from "core-js-pure/stable/structured-clone.js"; +import _btoa from "core-js-pure/stable/btoa.js"; +import _withInstanceProperty from "core-js-pure/stable/instance/with.js"; +import _isWellFormedInstanceProperty from "core-js-pure/stable/instance/is-well-formed.js"; +import _toWellFormedInstanceProperty from "core-js-pure/stable/instance/to-well-formed.js"; +import _self from "core-js-pure/stable/self.js"; +import _URL$canParse from "core-js-pure/stable/url/can-parse.js"; +import _Promise from "core-js-pure/stable/promise/index.js"; +import _URLSearchParams from "core-js-pure/stable/url-search-params/index.js"; + +_findLastInstanceProperty(_context = []).call(_context, fn); + +_findLastIndexInstanceProperty(_context2 = []).call(_context2, fn); + +[].asIndexedPairs(); + +_forEachInstanceProperty(_context3 = Iterator.from({ + next: () => ({ + done: Math.random() > .9, + value: Math.random() * 10 | 0 + }) +})).call(_context3, console.log).toArray(); + +_mapInstanceProperty(_context4 = _filterInstanceProperty(_context5 = AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]).drop(1).take(5)).call(_context5, it => it % 2).groupBy(it => id % 4)).call(_context4, it => it ** 2).toArray().then(console.log); + +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); +Number.range(1, 2); +BigInt.range(1n, 2n); +Array.isTemplateObject((x => x)`a${x}z`); +new _Map([['x', 1]]).emplace('x', { + update: x => x + 1, + insert: () => 0 +}); +/x/.dotAll; +/x/.sticky; +_Symbol.asyncDispose; +_Symbol.matcher; +_Symbol$matchAll; +_Symbol.metadata; + +_replaceAllInstanceProperty(_Symbol); + +new _URL(url); +const foo = [1, 2, 3].groupByToMap(bar); + +const push = _pushInstanceProperty([]).unThis(); + +Function.isConstructor; +throw new _DOMException(); + +_structuredClone(72); + +_btoa('hi'); + +foo.indexed; + +_withInstanceProperty(bar); + +_pushInstanceProperty(buz); + +fuz.__proto__; + +_isWellFormedInstanceProperty(string); + +_toWellFormedInstanceProperty(string); + +String.dedent`42`; +_self; +SuppressedError; +DisposableStack; +AsyncDisposableStack; +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); + +_Symbol.isWellKnown(foo); + +_Symbol.isRegistered(foo); + +Function.demethodize(); + +_URL$canParse(foo); + +_Symbol.isWellKnownSymbol(foo); + +_Symbol.isRegisteredSymbol(foo); + +_Symbol.metadata; +Object.groupBy(a, b); + +_Map.groupBy(a, b); + +_Promise.withResolvers(); + +new _URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/input.mjs index cbc0b3b7..c737f1b2 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/input.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/input.mjs @@ -72,3 +72,11 @@ Symbol.isRegistered(foo); Function.demethodize(); URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/output.mjs index d8cb4f57..9922a098 100644 --- a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/output.mjs +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.30/output.mjs @@ -120,3 +120,11 @@ _Symbol$isRegistered(foo); _demethodizeInstanceProperty(Function).call(Function); _URL$canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +_Symbol$metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/input.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/input.mjs new file mode 100644 index 00000000..c737f1b2 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/input.mjs @@ -0,0 +1,82 @@ +[].findLast(fn); +[].findLastIndex(fn); + +[].asIndexedPairs(); + +Iterator.from({ + next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) + }).forEach(console.log).toArray(); + +AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) + .drop(1) + .take(5) + .filter(it => it % 2) + .groupBy(it => id % 4) + .map(it => it ** 2) + .toArray() + .then(console.log); + +[1, 2, 3, 4, 5, 6, 7, 7].uniqueBy(x => x).groupBy(x => x % 2); + +Number.range(1, 2); +BigInt.range(1n, 2n); + +Array.isTemplateObject((x => x)`a${ x }z`) + +new Map([['x', 1]]).emplace('x', { update: x => x + 1, insert: () => 0}); + +/x/.dotAll; +/x/.sticky + +Symbol.asyncDispose +Symbol.matcher +Symbol.matchAll +Symbol.metadata +Symbol.replaceAll + +new URL(url); + +const foo = [1, 2, 3].groupByToMap(bar); + +const push = [].push.unThis(); + +Function.isConstructor; + +throw new DOMException(); + +structuredClone(72); + +btoa('hi'); + +foo.indexed; +bar.with; +buz.push; +fuz.__proto__; + +string.isWellFormed; +string.toWellFormed; + +String.dedent`42`; + +self; +SuppressedError +DisposableStack; +AsyncDisposableStack; + +Iterator.range(foo, bar); +JSON.parse(foo); +JSON.isRawJSON(foo); +JSON.rawJSON(foo); +Symbol.isWellKnown(foo); +Symbol.isRegistered(foo); +Function.demethodize(); + +URL.canParse(foo); + +Symbol.isWellKnownSymbol(foo); +Symbol.isRegisteredSymbol(foo); +Symbol.metadata; +Object.groupBy(a, b); +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/options.json b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/options.json new file mode 100644 index 00000000..6b696c37 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/options.json @@ -0,0 +1,15 @@ +{ + "targets": { + "chrome": 90 + }, + "plugins": [ + [ + "@@/polyfill-corejs3", + { + "method": "usage-pure", + "version": "3.31", + "proposals": true + } + ] + ] +} diff --git a/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/output.mjs b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/output.mjs new file mode 100644 index 00000000..ae3722f9 --- /dev/null +++ b/packages/babel-plugin-polyfill-corejs3/test/fixtures/usage-pure/all-proposals-chrome-90-corejs-3.31/output.mjs @@ -0,0 +1,137 @@ +var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13; + +import _findLastInstanceProperty from "core-js-pure/features/instance/find-last.js"; +import _findLastIndexInstanceProperty from "core-js-pure/features/instance/find-last-index.js"; +import _asIndexedPairsInstanceProperty from "core-js-pure/features/instance/asIndexedPairs.js"; +import _toArrayInstanceProperty from "core-js-pure/features/instance/to-array.js"; +import _Iterator$from from "core-js-pure/features/iterator/from.js"; +import _groupByInstanceProperty from "core-js-pure/features/instance/group-by.js"; +import _takeInstanceProperty from "core-js-pure/features/instance/take.js"; +import _dropInstanceProperty from "core-js-pure/features/instance/drop.js"; +import _AsyncIterator$from from "core-js-pure/features/async-iterator/from.js"; +import _uniqueByInstanceProperty from "core-js-pure/features/instance/unique-by.js"; +import _Number$range from "core-js-pure/features/number/range.js"; +import _BigInt$range from "core-js-pure/features/bigint/range.js"; +import _Array$isTemplateObject from "core-js-pure/features/array/is-template-object.js"; +import _emplaceInstanceProperty from "core-js-pure/features/instance/emplace.js"; +import _Symbol$asyncDispose from "core-js-pure/features/symbol/async-dispose.js"; +import _Symbol$matcher from "core-js-pure/features/symbol/matcher.js"; +import _Symbol$metadata from "core-js-pure/features/symbol/metadata.js"; +import _groupByToMapInstanceProperty from "core-js-pure/features/instance/group-by-to-map.js"; +import _unThisInstanceProperty from "core-js-pure/features/instance/un-this.js"; +import _pushInstanceProperty from "core-js-pure/features/instance/push.js"; +import _Function$isConstructor from "core-js-pure/features/function/is-constructor.js"; +import _structuredClone from "core-js-pure/features/structured-clone.js"; +import _indexedInstanceProperty from "core-js-pure/features/instance/indexed.js"; +import _withInstanceProperty from "core-js-pure/features/instance/with.js"; +import _isWellFormedInstanceProperty from "core-js-pure/features/instance/is-well-formed.js"; +import _toWellFormedInstanceProperty from "core-js-pure/features/instance/to-well-formed.js"; +import _String$dedent from "core-js-pure/features/string/dedent.js"; +import _SuppressedError from "core-js-pure/features/suppressed-error.js"; +import _DisposableStack from "core-js-pure/features/disposable-stack.js"; +import _AsyncDisposableStack from "core-js-pure/features/async-disposable-stack.js"; +import _Iterator$range from "core-js-pure/features/iterator/range.js"; +import _JSON$parse from "core-js-pure/features/json/parse.js"; +import _JSON$isRawJSON from "core-js-pure/features/json/is-raw-json.js"; +import _JSON$rawJSON from "core-js-pure/features/json/raw-json.js"; +import _Symbol$isWellKnown from "core-js-pure/features/symbol/is-well-known.js"; +import _Symbol$isRegistered from "core-js-pure/features/symbol/is-registered.js"; +import _demethodizeInstanceProperty from "core-js-pure/features/instance/demethodize.js"; +import _URL$canParse from "core-js-pure/features/url/can-parse.js"; +import _Symbol$isWellKnownSymbol from "core-js-pure/features/symbol/is-well-known-symbol.js"; +import _Symbol$isRegisteredSymbol from "core-js-pure/features/symbol/is-registered-symbol.js"; +import _Object$groupBy from "core-js-pure/features/object/group-by.js"; + +_findLastInstanceProperty(_context = []).call(_context, fn); + +_findLastIndexInstanceProperty(_context2 = []).call(_context2, fn); + +_asIndexedPairsInstanceProperty(_context3 = []).call(_context3); + +_toArrayInstanceProperty(_context4 = _Iterator$from({ + next: () => ({ + done: Math.random() > .9, + value: Math.random() * 10 | 0 + }) +}).forEach(console.log)).call(_context4); + +_toArrayInstanceProperty(_context5 = _groupByInstanceProperty(_context6 = _takeInstanceProperty(_context7 = _dropInstanceProperty(_context8 = _AsyncIterator$from([1, 2, 3, 4, 5, 6, 7])).call(_context8, 1)).call(_context7, 5).filter(it => it % 2)).call(_context6, it => id % 4).map(it => it ** 2)).call(_context5).then(console.log); + +_groupByInstanceProperty(_context9 = _uniqueByInstanceProperty(_context10 = [1, 2, 3, 4, 5, 6, 7, 7]).call(_context10, x => x)).call(_context9, x => x % 2); + +_Number$range(1, 2); + +_BigInt$range(1n, 2n); + +_Array$isTemplateObject((x => x)`a${x}z`); + +_emplaceInstanceProperty(_context11 = new Map([['x', 1]])).call(_context11, 'x', { + update: x => x + 1, + insert: () => 0 +}); + +/x/.dotAll; +/x/.sticky; +_Symbol$asyncDispose; +_Symbol$matcher; +Symbol.matchAll; +_Symbol$metadata; +Symbol.replaceAll; +new URL(url); + +const foo = _groupByToMapInstanceProperty(_context12 = [1, 2, 3]).call(_context12, bar); + +const push = _unThisInstanceProperty(_context13 = _pushInstanceProperty([])).call(_context13); + +_Function$isConstructor; +throw new DOMException(); + +_structuredClone(72); + +btoa('hi'); + +_indexedInstanceProperty(foo); + +_withInstanceProperty(bar); + +_pushInstanceProperty(buz); + +fuz.__proto__; + +_isWellFormedInstanceProperty(string); + +_toWellFormedInstanceProperty(string); + +_String$dedent`42`; +self; +_SuppressedError; +_DisposableStack; +_AsyncDisposableStack; + +_Iterator$range(foo, bar); + +_JSON$parse(foo); + +_JSON$isRawJSON(foo); + +_JSON$rawJSON(foo); + +_Symbol$isWellKnown(foo); + +_Symbol$isRegistered(foo); + +_demethodizeInstanceProperty(Function).call(Function); + +_URL$canParse(foo); + +_Symbol$isWellKnownSymbol(foo); + +_Symbol$isRegisteredSymbol(foo); + +_Symbol$metadata; + +_Object$groupBy(a, b); + +Map.groupBy(a, b); +Promise.withResolvers(); +new URLSearchParams().has(a, b); diff --git a/scripts/corejs3-shipped-proposals-special-cases.mjs b/scripts/corejs3-shipped-proposals-special-cases.mjs index 39e6092e..6529ae07 100644 --- a/scripts/corejs3-shipped-proposals-special-cases.mjs +++ b/scripts/corejs3-shipped-proposals-special-cases.mjs @@ -1,3 +1,5 @@ export default [ - "esnext.set.difference.v2", + // legacy for compatibility with previous versions + "esnext.array.group", + "esnext.array.group-to-map", ]; diff --git a/yarn.lock b/yarn.lock index 6efdb173..4f93f3c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4342,9 +4342,9 @@ __metadata: "@babel/plugin-transform-for-of": ^7.16.7 "@babel/plugin-transform-modules-commonjs": ^7.17.7 "@babel/plugin-transform-spread": ^7.16.7 - core-js: ^3.30.1 - core-js-compat: ^3.30.1 - core-js-pure: ^3.30.1 + core-js: ^3.31.0 + core-js-compat: ^3.31.0 + core-js-pure: ^3.31.0 peerDependencies: "@babel/core": ^7.0.0-0 languageName: unknown @@ -5591,26 +5591,26 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.21.0, core-js-compat@npm:^3.30.1": - version: 3.30.1 - resolution: "core-js-compat@npm:3.30.1" +"core-js-compat@npm:^3.21.0, core-js-compat@npm:^3.31.0": + version: 3.31.0 + resolution: "core-js-compat@npm:3.31.0" dependencies: browserslist: ^4.21.5 - checksum: e450a9771fc927ce982333929e1c4b32f180f641e4cfff9de6ed44b5930de19be7707cf74f45d1746ca69b8e8ac0698a555cb7244fbfbed6c38ca93844207bf7 + checksum: 5c76ac5e4ab39480391f93a5aef14a2cfa188cda7bd6a7b8532de1f8bc5d89099a5025b2640d2ef70a2928614792363dcbcf8bd254aa7b2e11b85aeed7ac460f languageName: node linkType: hard -"core-js-pure@npm:^3.30.1": - version: 3.30.1 - resolution: "core-js-pure@npm:3.30.1" - checksum: ea64c72cd68ddde43eddb250033af784cc00251195faaee665163e7d6a69df964c9eba9e931f3adf4cc1e1be0fabc1b59aa54de1c847811583c09bf1737911f9 +"core-js-pure@npm:^3.31.0": + version: 3.31.0 + resolution: "core-js-pure@npm:3.31.0" + checksum: 2bc5d2f6c3c9732fd5c066529b8d41fae9c746206ddf7614712dc4120a9efd47bf894df4fc600fde8c04324171c1999869798b48b23fca128eff5f09f58cd2f6 languageName: node linkType: hard -"core-js@npm:^3.30.1": - version: 3.30.1 - resolution: "core-js@npm:3.30.1" - checksum: 6d4a00b488694d4c715c424e15dfef31433ac7aa395c39c518a0cfacec918ada1c716fed74682033197e0164e23bbf38bfd598ee9a239c4aaa590ab1ba862ac8 +"core-js@npm:^3.31.0": + version: 3.31.0 + resolution: "core-js@npm:3.31.0" + checksum: f7cf9b3010f7ca99c026d95b61743baca1a85512742ed2b67e8f65a72ac4f4fe0b90b00057783e886bdd39d3a295f42f845d33e7cba3973ed263df978343ab79 languageName: node linkType: hard