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

Enable class static blocks by default #13713

Merged
merged 6 commits into from Oct 28, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/babel-compat-data/scripts/data/plugin-features.js
Expand Up @@ -163,12 +163,11 @@ const es2022 = {
],
},
"proposal-private-methods": "private class methods",
};

const shippedProposal = {
"proposal-class-static-block": "Class static initialization blocks",
};

const shippedProposal = {};

// Run plugins for modern features first
module.exports = Object.assign(
{},
Expand Down
@@ -1,4 +1,3 @@
{
"minified": true,
"plugins": ["classStaticBlock"]
"minified": true
}

This file was deleted.

1 change: 0 additions & 1 deletion packages/babel-parser/src/parser/statement.js
Expand Up @@ -1619,7 +1619,6 @@ export default class StatementParser extends ExpressionParser {
classBody: N.ClassBody,
member: N.StaticBlock & { decorators?: Array<N.Decorator> },
) {
this.expectPlugin("classStaticBlock", member.start);
// Start a new lexical scope
this.scope.enter(SCOPE_CLASS | SCOPE_STATIC_BLOCK | SCOPE_SUPER);
// Start a new scope with regard to loop labels
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,6 +1,3 @@
{
"plugins": [
"classStaticBlock",
["decorators", { "decoratorsBeforeExport": true }]
]
"plugins": [["decorators", { "decoratorsBeforeExport": true }]]
}
@@ -1,3 +1,3 @@
{
"plugins": ["classStaticBlock", "decorators-legacy"]
"plugins": ["decorators-legacy"]
}

This file was deleted.

This file was deleted.

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:17)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:19)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:16)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:17)"
}
}
@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}
@@ -1,4 +1,4 @@
{
"plugins": ["classStaticBlock", "typescript"],
"plugins": ["typescript"],
"sourceType": "module"
}
2 changes: 1 addition & 1 deletion packages/babel-parser/typings/babel-parser.d.ts
Expand Up @@ -125,7 +125,7 @@ export type ParserPlugin =
| "classPrivateMethods"
| "classPrivateProperties"
| "classProperties"
| "classStaticBlock"
| "classStaticBlock" // Enabled by default
| "decimal"
| "decorators"
| "decorators-legacy"
Expand Down
4 changes: 1 addition & 3 deletions packages/babel-preset-env/data/shipped-proposals.js
Expand Up @@ -2,9 +2,7 @@
// These mappings represent the syntax proposals that have been
// shipped by browsers, and are enabled by the `shippedProposals` option.

const proposalPlugins = new Set([
"proposal-class-static-block",
]);
const proposalPlugins = new Set();

// use intermediary object to enforce alphabetical key order
const pluginSyntaxObject = {
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { android, chrome < 94, edge, firefox < 93, ios, node, opera, safari, samsung }
proposal-private-property-in-object { android, chrome < 91, edge, firefox < 90, ios < 15, node, opera, safari < 15, samsung }
proposal-class-properties { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
proposal-private-methods { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { android, chrome < 94, edge, firefox < 93, ios, node, opera, safari, samsung }
proposal-private-property-in-object { android, chrome < 91, edge, firefox < 90, ios < 15, node, opera, safari < 15, samsung }
proposal-class-properties { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
proposal-private-methods { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { chrome < 94 }
proposal-private-property-in-object { chrome < 91 }
proposal-class-properties { chrome < 84 }
proposal-private-methods { chrome < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { chrome < 94 }
proposal-private-property-in-object { chrome < 91 }
proposal-class-properties { chrome < 84 }
proposal-private-methods { chrome < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { edge }
proposal-private-property-in-object { edge }
proposal-class-properties { edge < 84 }
proposal-private-methods { edge < 84 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
proposal-private-property-in-object { safari < 15 }
proposal-class-properties { safari < 15 }
proposal-private-methods { safari < 15 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
proposal-private-property-in-object { safari < 15 }
proposal-class-properties { safari < 15 }
proposal-private-methods { safari < 15 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
proposal-private-property-in-object { safari < 15 }
proposal-class-properties { safari < 15 }
proposal-private-methods { safari < 15 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
proposal-private-property-in-object { safari < 15 }
proposal-class-properties { safari < 15 }
proposal-private-methods { safari < 15 }
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
syntax-private-property-in-object
syntax-class-properties
syntax-numeric-separator
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { safari }
syntax-private-property-in-object
syntax-class-properties
syntax-numeric-separator
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { chrome < 94 }
proposal-private-property-in-object { chrome < 91 }
syntax-class-properties
syntax-numeric-separator
Expand Down
Expand Up @@ -8,6 +8,7 @@ Using targets:
Using modules transform: auto

Using plugins:
proposal-class-static-block { chrome < 94 }
proposal-private-property-in-object { chrome < 91 }
syntax-class-properties
syntax-numeric-separator
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
proposal-class-static-block { android, chrome < 94, edge, firefox < 93, ios, node, opera, safari, samsung }
proposal-private-property-in-object { android, chrome < 91, edge, firefox < 90, ios < 15, node, opera, safari < 15, samsung }
proposal-class-properties { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
proposal-private-methods { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
Expand Down
Expand Up @@ -16,6 +16,7 @@ Using targets:
Using modules transform: false

Using plugins:
proposal-class-static-block { android, chrome < 94, edge, firefox < 93, ios, node, opera, safari, samsung }
proposal-private-property-in-object { android, chrome < 91, edge, firefox < 90, ios < 15, node, opera, safari < 15, samsung }
proposal-class-properties { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
proposal-private-methods { android, chrome < 84, edge < 84, firefox < 90, ios < 15, node < 14.6, opera < 70, safari < 15, samsung < 14 }
Expand Down