Skip to content

Commit 5a7a782

Browse files
Add private brand checks to shippedProposals (#13176)
1 parent 2fc2885 commit 5a7a782

82 files changed

Lines changed: 148 additions & 40 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/babel-compat-data/data/plugins.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"proposal-class-static-block": {
33
"chrome": "91"
44
},
5+
"proposal-private-property-in-object": {
6+
"chrome": "91"
7+
},
58
"proposal-class-properties": {
69
"chrome": "74",
710
"opera": "62",

packages/babel-compat-data/scripts/data/plugin-features.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ const es2021 = {
136136

137137
const shippedProposal = {
138138
"proposal-class-static-block": "Class static initialization blocks",
139+
"proposal-private-property-in-object":
140+
"Ergonomic brand checks for private fields",
139141
"proposal-class-properties": {
140142
features: [
141143
"static class fields",

packages/babel-compat-data/scripts/download-compat-table.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
COMPAT_TABLE_COMMIT=ca2d70e305bc3295ade6b06a1c33a929db1ccacf
4+
COMPAT_TABLE_COMMIT=bcf74805f08ef13371ebe3aa36030bed4cd9a902
55
GIT_HEAD=build/compat-table/.git/HEAD
66

77
if [ -d "build/compat-table" ]; then

packages/babel-preset-env/data/shipped-proposals.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const proposalPlugins = new Set([
66
"proposal-class-properties",
77
"proposal-private-methods",
88
"proposal-class-static-block",
9+
"proposal-private-property-in-object",
910
]);
1011

1112
// use intermediary object to enforce alphabetical key order
@@ -21,6 +22,7 @@ const pluginSyntaxObject = {
2122
"proposal-optional-chaining": "syntax-optional-chaining",
2223
// note: we don't have syntax-private-methods
2324
"proposal-private-methods": "syntax-class-properties",
25+
"proposal-private-property-in-object": "syntax-private-property-in-object",
2426
"proposal-unicode-property-regex": null,
2527
};
2628

packages/babel-preset-env/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@babel/plugin-proposal-optional-catch-binding": "workspace:^7.13.8",
3535
"@babel/plugin-proposal-optional-chaining": "workspace:^7.13.12",
3636
"@babel/plugin-proposal-private-methods": "workspace:^7.13.0",
37+
"@babel/plugin-proposal-private-property-in-object": "workspace:^7.13.0",
3738
"@babel/plugin-proposal-unicode-property-regex": "workspace:^7.12.13",
3839
"@babel/plugin-syntax-async-generators": "^7.8.4",
3940
"@babel/plugin-syntax-class-properties": "workspace:^7.12.13",
@@ -47,6 +48,7 @@
4748
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
4849
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
4950
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
51+
"@babel/plugin-syntax-private-property-in-object": "workspace:^7.13.0",
5052
"@babel/plugin-syntax-top-level-await": "workspace:^7.12.13",
5153
"@babel/plugin-transform-arrow-functions": "workspace:^7.13.0",
5254
"@babel/plugin-transform-async-to-generator": "workspace:^7.13.0",

packages/babel-preset-env/src/available-plugins.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator";
1313
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
1414
import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding";
1515
import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining";
16+
import syntaxPrivatePropertyInObject from "@babel/plugin-syntax-private-property-in-object";
1617
import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await";
1718
import proposalAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions";
1819
import proposalClassProperties from "@babel/plugin-proposal-class-properties";
@@ -27,6 +28,7 @@ import proposalObjectRestSpread from "@babel/plugin-proposal-object-rest-spread"
2728
import proposalOptionalCatchBinding from "@babel/plugin-proposal-optional-catch-binding";
2829
import proposalOptionalChaining from "@babel/plugin-proposal-optional-chaining";
2930
import proposalPrivateMethods from "@babel/plugin-proposal-private-methods";
31+
import proposalPrivatePropertyInObject from "@babel/plugin-proposal-private-property-in-object";
3032
import proposalUnicodePropertyRegex from "@babel/plugin-proposal-unicode-property-regex";
3133
import transformAsyncToGenerator from "@babel/plugin-transform-async-to-generator";
3234
import transformArrowFunctions from "@babel/plugin-transform-arrow-functions";
@@ -93,6 +95,7 @@ export default {
9395
"proposal-optional-catch-binding": () => proposalOptionalCatchBinding,
9496
"proposal-optional-chaining": () => proposalOptionalChaining,
9597
"proposal-private-methods": () => proposalPrivateMethods,
98+
"proposal-private-property-in-object": () => proposalPrivatePropertyInObject,
9699
"proposal-unicode-property-regex": () => proposalUnicodePropertyRegex,
97100
"syntax-async-generators": () => syntaxAsyncGenerators,
98101
"syntax-class-properties": () => syntaxClassProperties,
@@ -106,6 +109,7 @@ export default {
106109
"syntax-object-rest-spread": () => syntaxObjectRestSpread,
107110
"syntax-optional-catch-binding": () => syntaxOptionalCatchBinding,
108111
"syntax-optional-chaining": () => syntaxOptionalChaining,
112+
"syntax-private-property-in-object": () => syntaxPrivatePropertyInObject,
109113
"syntax-top-level-await": () => syntaxTopLevelAwait,
110114
"transform-arrow-functions": () => transformArrowFunctions,
111115
"transform-async-to-generator": () => transformAsyncToGenerator,
@@ -145,4 +149,5 @@ export default {
145149

146150
export const minVersions = {
147151
"proposal-class-static-block": "7.12.0",
152+
"proposal-private-property-in-object": "7.10.0",
148153
};

packages/babel-preset-env/src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,6 @@ option \`forceAllTransforms: true\` instead.
394394
if (
395395
pluginName === "proposal-class-properties" ||
396396
pluginName === "proposal-private-methods" ||
397-
// This is not included in preset-env yet, but let's keep it here so we
398-
// don't forget about it in the future.
399397
pluginName === "proposal-private-property-in-object"
400398
) {
401399
return [

packages/babel-preset-env/test/fixtures/debug-babel-7/entry-corejs2-shippedProposals-chrome-71/stdout.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Using modules transform: auto
99

1010
Using plugins:
1111
proposal-class-static-block { chrome < 91 }
12+
proposal-private-property-in-object { chrome < 91 }
1213
proposal-class-properties { chrome < 84 }
1314
proposal-private-methods { chrome < 84 }
1415
proposal-numeric-separator { chrome < 75 }

packages/babel-preset-env/test/fixtures/debug-babel-7/entry-corejs2-shippedProposals/stdout.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Using modules transform: auto
99

1010
Using plugins:
1111
proposal-class-static-block { ie }
12+
proposal-private-property-in-object { ie }
1213
proposal-class-properties { ie }
1314
proposal-private-methods { ie }
1415
proposal-numeric-separator { ie }

packages/babel-preset-env/test/fixtures/debug-babel-7/entry-corejs3-all-chrome-71/stdout.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Using modules transform: auto
99

1010
Using plugins:
1111
proposal-class-static-block { chrome < 91 }
12+
proposal-private-property-in-object { chrome < 91 }
1213
proposal-class-properties { chrome < 84 }
1314
proposal-private-methods { chrome < 84 }
1415
proposal-numeric-separator { chrome < 75 }

0 commit comments

Comments
 (0)