Skip to content

Commit f656b70

Browse files
Move decorators to Stage 3 in @babel/standalone (#15430)
1 parent 34136c5 commit f656b70

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

packages/babel-standalone/src/preset-stage-2.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@ import * as babelPlugins from "./generated/plugins";
33

44
export default (_: any, opts: any = {}) => {
55
const {
6-
loose = false,
7-
useBuiltIns = false,
8-
decoratorsLegacy = false,
9-
decoratorsVersion = "2018-09",
10-
decoratorsBeforeExport,
116
pipelineProposal = "minimal",
127
pipelineTopicToken = "%",
138
recordAndTupleSyntax = "hash",
149
} = opts;
1510

1611
return {
17-
presets: [[presetStage3, { loose, useBuiltIns }]],
12+
presets: [[presetStage3, opts]],
1813
plugins: [
19-
[
20-
babelPlugins.proposalDecorators,
21-
{
22-
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
23-
decoratorsBeforeExport,
24-
},
25-
],
2614
babelPlugins.proposalDestructuringPrivate,
2715
[
2816
babelPlugins.proposalPipelineOperator,

packages/babel-standalone/src/preset-stage-3.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
import * as babelPlugins from "./generated/plugins";
22

3-
export default (_: any, { loose = false } = {}) => {
3+
export default (_: any, opts: any = {}) => {
4+
const {
5+
loose = false,
6+
decoratorsLegacy = false,
7+
decoratorsVersion = "2018-09",
8+
decoratorsBeforeExport,
9+
} = opts;
10+
411
// todo(flow->ts) improve types
512
const plugins: any[] = [
613
babelPlugins.syntaxImportAssertions,
714
babelPlugins.proposalUnicodeSetsRegex,
815
babelPlugins.proposalDuplicateNamedCapturingGroupsRegex,
16+
[
17+
babelPlugins.proposalDecorators,
18+
{
19+
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
20+
decoratorsBeforeExport,
21+
},
22+
],
923
];
1024

1125
if (!process.env.BABEL_8_BREAKING) {

0 commit comments

Comments
 (0)