From 8817fcf03e4616dfbe70578903bf47910402f0d7 Mon Sep 17 00:00:00 2001 From: James DiGioia Date: Mon, 16 Jul 2018 13:02:54 -0400 Subject: [PATCH] Fix stage-0/1 import of pipeline/decorators proposals (#8317) Just default to pipeline "minimal" and true for decorators for ease of use. We are going to remove the stage presets next so it's fine since it will error when using the plugin individually later. --- packages/babel-preset-stage-0/src/index.js | 22 ++----------------- packages/babel-preset-stage-1/src/index.js | 25 +++------------------- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/packages/babel-preset-stage-0/src/index.js b/packages/babel-preset-stage-0/src/index.js index 28d9dd33cc..84e1a9d3b8 100644 --- a/packages/babel-preset-stage-0/src/index.js +++ b/packages/babel-preset-stage-0/src/index.js @@ -2,7 +2,6 @@ import { declare } from "@babel/helper-plugin-utils"; import presetStage1 from "@babel/preset-stage-1"; import transformFunctionBind from "@babel/plugin-proposal-function-bind"; -import { proposals } from "@babel/plugin-proposal-pipeline-operator"; export default declare((api, opts = {}) => { api.assertVersion(7); @@ -10,8 +9,8 @@ export default declare((api, opts = {}) => { const { loose = false, useBuiltIns = false, - decoratorsLegacy = false, - pipelineProposal, + decoratorsLegacy = true, + pipelineProposal = "minimal", } = opts; if (typeof loose !== "boolean") { @@ -28,23 +27,6 @@ export default declare((api, opts = {}) => { ); } - if (decoratorsLegacy !== true) { - throw new Error( - "The new decorators proposal is not supported yet." + - ' You must pass the `"decoratorsLegacy": true` option to' + - " @babel/preset-stage-0", - ); - } - - if (typeof pipelineProposal !== "string") { - throw new Error( - "The pipeline operator requires a proposal set." + - " You must pass 'pipelineProposal' option to" + - " @babel/preset-stage-0 whose value must be one of: " + - proposals.join(", "), - ); - } - return { presets: [ [ diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index 2c50a12fca..6324c7ac2d 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -4,9 +4,7 @@ import presetStage2 from "@babel/preset-stage-2"; import transformExportDefaultFrom from "@babel/plugin-proposal-export-default-from"; import transformLogicalAssignmentOperators from "@babel/plugin-proposal-logical-assignment-operators"; import transformOptionalChaining from "@babel/plugin-proposal-optional-chaining"; -import transformPipelineOperator, { - proposals, -} from "@babel/plugin-proposal-pipeline-operator"; +import transformPipelineOperator from "@babel/plugin-proposal-pipeline-operator"; import transformNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator"; import transformDoExpressions from "@babel/plugin-proposal-do-expressions"; @@ -16,8 +14,8 @@ export default declare((api, opts = {}) => { const { loose = false, useBuiltIns = false, - decoratorsLegacy = false, - pipelineProposal, + decoratorsLegacy = true, + pipelineProposal = "minimal", } = opts; if (typeof loose !== "boolean") { @@ -34,23 +32,6 @@ export default declare((api, opts = {}) => { ); } - if (decoratorsLegacy !== true) { - throw new Error( - "The new decorators proposal is not supported yet." + - ' You must pass the `"decoratorsLegacy": true` option to' + - " @babel/preset-stage-1", - ); - } - - if (typeof pipelineProposal !== "string") { - throw new Error( - "The pipeline operator requires a proposal set." + - " You must pass 'pipelineProposal' option to" + - " @babel/preset-stage-1 whose value must be one of: " + - proposals.join(", "), - ); - } - return { presets: [[presetStage2, { loose, useBuiltIns, decoratorsLegacy }]], plugins: [