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 #138

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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.21.0"
"@babel/preset-env/core-js-compat": "^3.25.1"
},
"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.3.2",
"core-js-compat": "^3.21.0"
"core-js-compat": "^3.25.1"
},
"devDependencies": {
"@babel/core": "^7.17.8",
Expand All @@ -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.21.0",
"core-js-pure": "^3.21.0"
"core-js": "^3.25.1",
"core-js-pure": "^3.25.1"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
Expand Down
24 changes: 20 additions & 4 deletions packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const TypedArrayDependencies = [
"es.typed-array.filter",
"es.typed-array.find",
"es.typed-array.find-index",
"es.typed-array.find-last",
"es.typed-array.find-last-index",
"es.typed-array.for-each",
"es.typed-array.includes",
"es.typed-array.index-of",
Expand All @@ -76,8 +78,6 @@ const TypedArrayDependencies = [
"es.array.iterator",
"es.array-buffer.slice",
"esnext.typed-array.filter-reject",
"esnext.typed-array.find-last",
"esnext.typed-array.find-last-index",
"esnext.typed-array.group-by",
"esnext.typed-array.to-reversed",
"esnext.typed-array.to-sorted",
Expand Down Expand Up @@ -563,6 +563,7 @@ export const StaticProperties: ObjectMap2<CoreJSPolyfillDescriptor> = {
"es.string.match-all",
]),
metadata: define("symbol/metadata", ["esnext.symbol.metadata"]),
metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
observable: define("symbol/observable", ["esnext.symbol.observable"]),
patternMatch: define("symbol/pattern-match", [
"esnext.symbol.pattern-match",
Expand Down Expand Up @@ -686,9 +687,9 @@ export const InstanceProperties = {
...IteratorDependencies,
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["esnext.array.find-last"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", [
"esnext.array.find-last-index",
"es.array.find-last-index",
]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
Expand All @@ -701,12 +702,18 @@ export const InstanceProperties = {
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define("instance/group-by-to-map", [
"esnext.array.group-by-to-map",
"es.map",
"es.object.to-string",
]),
groupToMap: define("instance/group-to-map", [
"esnext.array.group-to-map",
"es.map",
"es.object.to-string",
]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", [
Expand All @@ -720,6 +727,12 @@ export const InstanceProperties = {
"es.array.includes",
"es.string.includes",
]),
indexed: define("instance/indexed", [
"esnext.async-iterator.indexed",
...AsyncIteratorDependencies,
"esnext.iterator.indexed",
...IteratorDependencies,
]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
italic: define(null, ["es.string.italics"]),
join: define(null, ["es.array.join"]),
Expand All @@ -741,6 +754,7 @@ export const InstanceProperties = {
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", [
"es.array.reduce",
"esnext.async-iterator.reduce",
Expand Down Expand Up @@ -818,13 +832,15 @@ export const InstanceProperties = {
trimRight: define("instance/trim-right", ["es.string.trim-end"]),
trimStart: define("instance/trim-start", ["es.string.trim-start"]),
uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
unshift: define("instance/unshift", ["es.array.unshift"]),
unThis: define("instance/un-this", ["esnext.function.un-this"]),
values: define("instance/values", ArrayNatureIteratorsWithTag),
with: define("instance/with", ["esnext.array.with"]),
__defineGetter__: define(null, ["es.object.define-getter"]),
__defineSetter__: define(null, ["es.object.define-setter"]),
__lookupGetter__: define(null, ["es.object.lookup-getter"]),
__lookupSetter__: define(null, ["es.object.lookup-setter"]),
["__proto__"]: define(null, ["es.object.proto"]),
};

export const CommonInstanceDependencies = new Set<string>([
Expand Down
13 changes: 9 additions & 4 deletions packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs

export default new Set<string>([
"esnext.array.find-last",
"esnext.array.find-last-index",
"esnext.typed-array.find-last",
"esnext.typed-array.find-last-index",
"esnext.array.group",
"esnext.array.group-to-map",
"esnext.array.to-reversed",
Copy link
Member

Choose a reason for hiding this comment

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

Is it already available in some browsers by default?

Copy link
Member Author

@zloirock zloirock Aug 7, 2022

Choose a reason for hiding this comment

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

It's generated automatically, so yes, it's available in some environments by default. It's not a browser, it's bun.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But preset-env's shippedProposals does not include bun. Until preset-env recognizes bun as shippedProposals, can we exclude bun here?

if (Object.keys(compatData[feature]).length === 0) continue;

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that it should be solved on the preset-env side, babel/babel#14831.

Copy link
Member Author

@zloirock zloirock Sep 12, 2022

Choose a reason for hiding this comment

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

So, this proposal is supported in Safari 16 that's released today. If you wanna change something in the shippedProposals logic - feel free to do it out of the scope of this PR - I think that the current logic of considering something as "shipped" is incorrect anyway.

"esnext.array.to-sorted",
"esnext.array.to-spliced",
"esnext.array.with",
"esnext.typed-array.to-reversed",
"esnext.typed-array.to-sorted",
"esnext.typed-array.with",
]);
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import "core-js/modules/es.string.replace.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.typed-array.fill.js";
import "core-js/modules/es.typed-array.set.js";
import "core-js/modules/es.typed-array.sort.js";
import "core-js/modules/web.dom-collections.for-each.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "core-js/modules/es.promise.js";
import "core-js/modules/es.promise.finally.js";
import "core-js/modules/es.regexp.constructor.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.regexp.flags.js";
import "core-js/modules/es.string.replace.js";
import "core-js/modules/es.string.trim-end.js";
import "core-js/modules/es.string.trim-start.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import "core-js/modules/es.string.replace.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.typed-array.fill.js";
import "core-js/modules/es.typed-array.set.js";
import "core-js/modules/es.typed-array.sort.js";
import "core-js/modules/web.dom-collections.for-each.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,16 @@ import "core-js/modules/esnext.array.find-last.js";
import "core-js/modules/esnext.array.find-last-index.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.symbol.replace-all.js";
import "core-js/modules/esnext.array.to-reversed.js";
import "core-js/modules/esnext.array.to-sorted.js";
import "core-js/modules/esnext.array.to-spliced.js";
import "core-js/modules/esnext.array.with.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.group-by.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";
import "core-js/modules/esnext.typed-array.with.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";
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,11 @@
{
"plugins": [
[
"@@/polyfill-corejs3",
{
"version": "3.25",
"method": "entry-global"
}
]
]
}