Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proposal flag to pipeline plugin (#8196)
This is going to be required so we can add support for other proposals, as well as later set the accepted proposal as the default. Update stage-0 and stage-1 presets with `pipelineProposal` to thread down to the plugin.
- Loading branch information
1 parent
e166275
commit eac4c5b
Showing
8 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
...es/babel-plugin-proposal-class-properties/test/fixtures/private-loose/foobar/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"presets": [["stage-0", { "decoratorsLegacy": true }], "es2015"] | ||
"presets": [ | ||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }], | ||
"es2015" | ||
] | ||
} |
2 changes: 1 addition & 1 deletion
2
...ges/babel-plugin-proposal-class-properties/test/fixtures/public-loose/foobar/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"plugins": ["external-helpers", ["proposal-class-properties", {"loose": true}]], | ||
"presets": [ | ||
["stage-0", { "decoratorsLegacy": true }], | ||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }], | ||
"es2015" | ||
] | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-proposal-class-properties/test/fixtures/public/foobar/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"plugins": ["external-helpers", "proposal-class-properties"], | ||
"presets": [ | ||
["stage-0", { "decoratorsLegacy": true }], | ||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }], | ||
"es2015" | ||
] | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/7030/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
["stage-0", { "decoratorsLegacy": true }] | ||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }] | ||
] | ||
} |
4 changes: 3 additions & 1 deletion
4
...ages/babel-plugin-proposal-pipeline-operator/test/fixtures/pipeline-operator/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"plugins": ["proposal-pipeline-operator"] | ||
"plugins": [ | ||
["proposal-pipeline-operator", { "proposal": "minimal" }] | ||
] | ||
} |
10 changes: 8 additions & 2 deletions
10
packages/babel-plugin-syntax-pipeline-operator/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
|
||
export default declare(api => { | ||
const proposals = ["minimal"]; | ||
|
||
export default declare((api, { proposal }) => { | ||
api.assertVersion(7); | ||
|
||
if (typeof proposal !== "string" || !proposals.includes(proposal)) { | ||
throw new Error("'proposal' must be one of: " + proposals.join(", ")); | ||
} | ||
|
||
return { | ||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("pipelineOperator"); | ||
parserOpts.plugins.push(["pipelineOperator", { proposal }]); | ||
}, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters