Skip to content

Commit

Permalink
Move decorators to Stage 3 in @babel/standalone (#15430)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 18, 2023
1 parent 34136c5 commit f656b70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
14 changes: 1 addition & 13 deletions packages/babel-standalone/src/preset-stage-2.ts
Expand Up @@ -3,26 +3,14 @@ import * as babelPlugins from "./generated/plugins";

export default (_: any, opts: any = {}) => {
const {
loose = false,
useBuiltIns = false,
decoratorsLegacy = false,
decoratorsVersion = "2018-09",
decoratorsBeforeExport,
pipelineProposal = "minimal",
pipelineTopicToken = "%",
recordAndTupleSyntax = "hash",
} = opts;

return {
presets: [[presetStage3, { loose, useBuiltIns }]],
presets: [[presetStage3, opts]],
plugins: [
[
babelPlugins.proposalDecorators,
{
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
decoratorsBeforeExport,
},
],
babelPlugins.proposalDestructuringPrivate,
[
babelPlugins.proposalPipelineOperator,
Expand Down
16 changes: 15 additions & 1 deletion packages/babel-standalone/src/preset-stage-3.ts
@@ -1,11 +1,25 @@
import * as babelPlugins from "./generated/plugins";

export default (_: any, { loose = false } = {}) => {
export default (_: any, opts: any = {}) => {
const {
loose = false,
decoratorsLegacy = false,
decoratorsVersion = "2018-09",
decoratorsBeforeExport,
} = opts;

// todo(flow->ts) improve types
const plugins: any[] = [
babelPlugins.syntaxImportAssertions,
babelPlugins.proposalUnicodeSetsRegex,
babelPlugins.proposalDuplicateNamedCapturingGroupsRegex,
[
babelPlugins.proposalDecorators,
{
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
decoratorsBeforeExport,
},
],
];

if (!process.env.BABEL_8_BREAKING) {
Expand Down

0 comments on commit f656b70

Please sign in to comment.