Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update core-js #223

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.38.1"
"@babel/preset-env/core-js-compat": "^3.39.0"
},
"engines": {
"node": ">= 6.9.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-plugin-polyfill-corejs3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
"dependencies": {
"@babel/helper-define-polyfill-provider": "workspace:^0.6.2",
"core-js-compat": "^3.38.1"
"core-js-compat": "^3.39.0"
},
"devDependencies": {
"@babel/core": "^7.22.6",
Expand All @@ -39,8 +39,8 @@
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/plugin-transform-spread": "^7.22.5",
"core-js": "^3.38.1",
"core-js-pure": "^3.38.1"
"core-js": "^3.39.0",
"core-js-pure": "^3.39.0"
},
"peerDependencies": {
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
Expand Down
70 changes: 37 additions & 33 deletions packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const MapDependencies = [
"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",
Expand Down Expand Up @@ -166,6 +168,8 @@ 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,
];

Expand Down Expand Up @@ -207,10 +211,7 @@ const AsyncIteratorProblemMethods = [
"esnext.async-iterator.some",
];

const IteratorDependencies = [
"esnext.iterator.constructor",
"es.object.to-string",
];
const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];

export const DecoratorMetadataDependencies = [
"esnext.symbol.metadata",
Expand Down Expand Up @@ -383,13 +384,19 @@ export const StaticProperties: ObjectMap2<CoreJSPolyfillDescriptor> = {
},

Iterator: {
concat: define("iterator/concat", [
"esnext.iterator.concat",
...IteratorDependencies,
...CommonIterators,
]),
from: define("iterator/from", [
"esnext.iterator.from",
"es.iterator.from",
...IteratorDependencies,
...CommonIterators,
]),
range: define("iterator/range", [
"esnext.iterator.range",
...IteratorDependencies,
"es.object.to-string",
]),
},
Expand Down Expand Up @@ -539,7 +546,7 @@ export const StaticProperties: ObjectMap2<CoreJSPolyfillDescriptor> = {
...PromiseDependenciesWithIterators,
]),
race: define(null, PromiseDependenciesWithIterators),
try: define("promise/try", ["esnext.promise.try", ...PromiseDependencies]),
try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
withResolvers: define("promise/with-resolvers", [
"es.promise.with-resolvers",
...PromiseDependencies,
Expand Down Expand Up @@ -782,43 +789,39 @@ export const InstanceProperties = {
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(null, [
"es.iterator.drop",
...IteratorDependencies,
"esnext.async-iterator.drop",
...AsyncIteratorDependencies,
"esnext.iterator.drop",
...IteratorDependencies,
]),
emplace: define("instance/emplace", [
"esnext.map.emplace",
"esnext.weak-map.emplace",
Copy link
Member Author

@zloirock zloirock Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current approach, it should be injected on constructors call, and that's already happening. Here are missed dependencies and in this way anyway it could cause a error. However, in case of pure mode + targets, injection on constructor call could fail because of #166.

]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ArrayNatureIteratorsWithTag),
every: define("instance/every", [
"es.array.every",
"esnext.async-iterator.every",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because lack of dependencies, it could cause a error, so this and similar cases commented. They are covered by AsyncIteratorProblemMethods.

"es.iterator.every",
...IteratorDependencies,
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// "esnext.async-iterator.every",
// ...AsyncIteratorDependencies
"esnext.iterator.every",
...IteratorDependencies,
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define("instance/filter", [
"es.array.filter",
"esnext.async-iterator.filter",
"esnext.iterator.filter",
"es.iterator.filter",
...IteratorDependencies,
// "esnext.async-iterator.filter",
]),
filterReject: define("instance/filterReject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
find: define("instance/find", [
"es.array.find",
"esnext.async-iterator.find",
"esnext.iterator.find",
"es.iterator.find",
...IteratorDependencies,
// "esnext.async-iterator.find",
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
Expand All @@ -830,9 +833,9 @@ export const InstanceProperties = {
flatMap: define("instance/flat-map", [
"es.array.flat-map",
"es.array.unscopables.flat-map",
"esnext.async-iterator.flat-map",
"esnext.iterator.flat-map",
"es.iterator.flat-map",
...IteratorDependencies,
// "esnext.async-iterator.flat-map",
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, [
Expand Down Expand Up @@ -860,9 +863,9 @@ export const InstanceProperties = {
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", [
"es.array.for-each",
"esnext.async-iterator.for-each",
"esnext.iterator.for-each",
"es.iterator.for-each",
...IteratorDependencies,
// "esnext.async-iterator.for-each",
"web.dom-collections.for-each",
]),
includes: define("instance/includes", [
Expand All @@ -886,8 +889,9 @@ export const InstanceProperties = {
link: define(null, ["es.string.link"]),
map: define("instance/map", [
"es.array.map",
"esnext.async-iterator.map",
"esnext.iterator.map",
"es.iterator.map",
...IteratorDependencies,
// "esnext.async-iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define("instance/match-all", [
Expand All @@ -900,9 +904,9 @@ export const InstanceProperties = {
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", [
"es.array.reduce",
"esnext.async-iterator.reduce",
"esnext.iterator.reduce",
"es.iterator.reduce",
...IteratorDependencies,
// "esnext.async-iterator.reduce",
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
Expand All @@ -927,9 +931,9 @@ export const InstanceProperties = {
small: define(null, ["es.string.small"]),
some: define("instance/some", [
"es.array.some",
"esnext.async-iterator.some",
"esnext.iterator.some",
"es.iterator.some",
...IteratorDependencies,
// "esnext.async-iterator.some",
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
Expand All @@ -941,17 +945,17 @@ export const InstanceProperties = {
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(null, [
"es.iterator.take",
...IteratorDependencies,
"esnext.async-iterator.take",
...AsyncIteratorDependencies,
"esnext.iterator.take",
...IteratorDependencies,
]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(null, [
"es.iterator.to-array",
...IteratorDependencies,
"esnext.async-iterator.to-array",
...AsyncIteratorDependencies,
"esnext.iterator.to-array",
...IteratorDependencies,
]),
toAsync: define(null, [
"esnext.iterator.to-async",
Expand Down
14 changes: 0 additions & 14 deletions packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,10 @@ export default new Set<string>([
"esnext.array.group-to-map",
"esnext.data-view.get-float16",
"esnext.data-view.set-float16",
"esnext.iterator.constructor",
"esnext.iterator.drop",
"esnext.iterator.every",
"esnext.iterator.filter",
"esnext.iterator.find",
"esnext.iterator.flat-map",
"esnext.iterator.for-each",
"esnext.iterator.from",
"esnext.iterator.map",
"esnext.iterator.reduce",
"esnext.iterator.some",
"esnext.iterator.take",
"esnext.iterator.to-array",
"esnext.json.is-raw-json",
"esnext.json.parse",
"esnext.json.raw-json",
"esnext.math.f16round",
"esnext.promise.try",
"esnext.regexp.escape",
"esnext.symbol.async-dispose",
"esnext.symbol.dispose",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ 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.math.f16round.js";
import "core-js/modules/esnext.math.sum-precise.js";
import "core-js/modules/esnext.promise.try.js";
import "core-js/modules/esnext.regexp.escape.js";
import "core-js/modules/esnext.symbol.async-dispose.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ 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.math.f16round.js";
import "core-js/modules/esnext.math.sum-precise.js";
import "core-js/modules/esnext.promise.try.js";
import "core-js/modules/esnext.regexp.escape.js";
import "core-js/modules/esnext.symbol.async-dispose.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'core-js/actual';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"plugins": [
[
"@@/polyfill-corejs3",
{
"version": "3.39",
"method": "entry-global",
"targets": {
"chrome": 107
}
}
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
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.array-buffer.detached.js";
import "core-js/modules/es.array-buffer.transfer.js";
import "core-js/modules/es.array-buffer.transfer-to-fixed-length.js";
import "core-js/modules/es.iterator.constructor.js";
import "core-js/modules/es.iterator.drop.js";
import "core-js/modules/es.iterator.every.js";
import "core-js/modules/es.iterator.filter.js";
import "core-js/modules/es.iterator.find.js";
import "core-js/modules/es.iterator.flat-map.js";
import "core-js/modules/es.iterator.for-each.js";
import "core-js/modules/es.iterator.from.js";
import "core-js/modules/es.iterator.map.js";
import "core-js/modules/es.iterator.reduce.js";
import "core-js/modules/es.iterator.some.js";
import "core-js/modules/es.iterator.take.js";
import "core-js/modules/es.iterator.to-array.js";
import "core-js/modules/es.map.group-by.js";
import "core-js/modules/es.object.group-by.js";
import "core-js/modules/es.promise.try.js";
import "core-js/modules/es.promise.with-resolvers.js";
import "core-js/modules/es.regexp.flags.js";
import "core-js/modules/es.set.difference.v2.js";
import "core-js/modules/es.set.intersection.v2.js";
import "core-js/modules/es.set.is-disjoint-from.v2.js";
import "core-js/modules/es.set.is-subset-of.v2.js";
import "core-js/modules/es.set.is-superset-of.v2.js";
import "core-js/modules/es.set.symmetric-difference.v2.js";
import "core-js/modules/es.set.union.v2.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.async-disposable-stack.constructor.js";
import "core-js/modules/esnext.async-iterator.constructor.js";
import "core-js/modules/esnext.async-iterator.async-dispose.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.data-view.get-float16.js";
import "core-js/modules/esnext.data-view.set-float16.js";
import "core-js/modules/esnext.disposable-stack.constructor.js";
import "core-js/modules/esnext.function.metadata.js";
import "core-js/modules/esnext.iterator.dispose.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.math.f16round.js";
import "core-js/modules/esnext.math.sum-precise.js";
import "core-js/modules/esnext.regexp.escape.js";
import "core-js/modules/esnext.symbol.async-dispose.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/esnext.uint8-array.from-base64.js";
import "core-js/modules/esnext.uint8-array.from-hex.js";
import "core-js/modules/esnext.uint8-array.set-from-base64.js";
import "core-js/modules/esnext.uint8-array.set-from-hex.js";
import "core-js/modules/esnext.uint8-array.to-base64.js";
import "core-js/modules/esnext.uint8-array.to-hex.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.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";
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ 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.math.f16round.js";
import "core-js/modules/esnext.math.sum-precise.js";
import "core-js/modules/esnext.promise.try.js";
import "core-js/modules/esnext.regexp.escape.js";
import "core-js/modules/esnext.symbol.async-dispose.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ 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.math.f16round.js";
import "core-js/modules/esnext.math.sum-precise.js";
import "core-js/modules/esnext.promise.try.js";
import "core-js/modules/esnext.regexp.escape.js";
import "core-js/modules/esnext.symbol.async-dispose.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'core-js/actual';
Loading
Loading