From fa70f22c48f784bde69e3d7e10f7989d7a3c4156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 12 Feb 2021 00:31:36 +0100 Subject: [PATCH] Remove from standalone --- .../babel-standalone/examples/example.htm | 2 +- .../babel-standalone/src/preset-stage-0.js | 30 +++++++++++++------ .../babel-standalone/src/preset-stage-1.js | 10 +++++-- .../babel-standalone/src/preset-stage-2.js | 16 +++++----- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/packages/babel-standalone/examples/example.htm b/packages/babel-standalone/examples/example.htm index cdbda4cde166..6116a5805198 100644 --- a/packages/babel-standalone/examples/example.htm +++ b/packages/babel-standalone/examples/example.htm @@ -31,7 +31,7 @@ [ "stage-0", { - decoratorsBeforeExport: false, + pipelineProposal: "fsharp", }, ], ], diff --git a/packages/babel-standalone/src/preset-stage-0.js b/packages/babel-standalone/src/preset-stage-0.js index 54643f575cdf..0ab24b40d5c0 100644 --- a/packages/babel-standalone/src/preset-stage-0.js +++ b/packages/babel-standalone/src/preset-stage-0.js @@ -7,23 +7,35 @@ export default (_: any, opts: Object = {}) => { loose = false, useBuiltIns = false, decoratorsLegacy = false, - decoratorsBeforeExport, pipelineProposal = "minimal", importAssertionsVersion = "september-2020", } = opts; + if (!process.env.BABEL_8_BREAKING) { + // eslint-disable-next-line no-var + var { decoratorsBeforeExport } = opts; + } + return { presets: [ [ presetStage1, - { - loose, - useBuiltIns, - decoratorsLegacy, - decoratorsBeforeExport, - pipelineProposal, - importAssertionsVersion, - }, + process.env.BABEL_8_BREAKING + ? { + loose, + useBuiltIns, + decoratorsLegacy, + pipelineProposal, + importAssertionsVersion, + } + : { + loose, + useBuiltIns, + decoratorsLegacy, + decoratorsBeforeExport, + pipelineProposal, + importAssertionsVersion, + }, ], ], plugins: [proposalFunctionBind], diff --git a/packages/babel-standalone/src/preset-stage-1.js b/packages/babel-standalone/src/preset-stage-1.js index eaf640f6cc6d..27584f33898d 100644 --- a/packages/babel-standalone/src/preset-stage-1.js +++ b/packages/babel-standalone/src/preset-stage-1.js @@ -7,16 +7,22 @@ export default (_: any, opts: Object = {}) => { loose = false, useBuiltIns = false, decoratorsLegacy = false, - decoratorsBeforeExport, pipelineProposal = "minimal", recordAndTupleSyntax: recordAndTupleSyntax = "hash", } = opts; + if (!process.env.BABEL_8_BREAKING) { + // eslint-disable-next-line no-var + var { decoratorsBeforeExport } = opts; + } + return { presets: [ [ presetStage2, - { loose, useBuiltIns, decoratorsLegacy, decoratorsBeforeExport }, + process.env.BABEL_8_BREAKING + ? { loose, useBuiltIns, decoratorsLegacy } + : { loose, useBuiltIns, decoratorsLegacy, decoratorsBeforeExport }, ], ], plugins: [ diff --git a/packages/babel-standalone/src/preset-stage-2.js b/packages/babel-standalone/src/preset-stage-2.js index f0eff5756e0a..2de89d6416bf 100644 --- a/packages/babel-standalone/src/preset-stage-2.js +++ b/packages/babel-standalone/src/preset-stage-2.js @@ -3,12 +3,12 @@ import presetStage3 from "./preset-stage-3"; import * as babelPlugins from "./generated/plugins"; export default (_: any, opts: Object = {}) => { - const { - loose = false, - useBuiltIns = false, - decoratorsLegacy = false, - decoratorsBeforeExport, - } = opts; + const { loose = false, useBuiltIns = false, decoratorsLegacy = false } = opts; + + if (!process.env.BABEL_8_BREAKING) { + // eslint-disable-next-line no-var + var { decoratorsBeforeExport } = opts; + } return { presets: [[presetStage3, { loose, useBuiltIns }]], @@ -16,7 +16,9 @@ export default (_: any, opts: Object = {}) => { babelPlugins.proposalClassStaticBlock, [ babelPlugins.proposalDecorators, - { legacy: decoratorsLegacy, decoratorsBeforeExport }, + process.env.BABEL_8_BREAKING + ? { legacy: decoratorsLegacy } + : { legacy: decoratorsLegacy, decoratorsBeforeExport }, ], babelPlugins.proposalFunctionSent, babelPlugins.proposalPrivatePropertyInObject,