add decoratorsVersion support to babel-standalone
This commit is contained in:
parent
9ecadfd8d2
commit
62acebe844
@ -5,7 +5,8 @@ export default (_: any, opts: any = {}) => {
|
|||||||
const {
|
const {
|
||||||
loose = false,
|
loose = false,
|
||||||
useBuiltIns = false,
|
useBuiltIns = false,
|
||||||
decoratorsLegacy = false,
|
decoratorsLegacy,
|
||||||
|
decoratorsVersion,
|
||||||
decoratorsBeforeExport,
|
decoratorsBeforeExport,
|
||||||
pipelineProposal,
|
pipelineProposal,
|
||||||
pipelineTopicToken,
|
pipelineTopicToken,
|
||||||
@ -20,6 +21,7 @@ export default (_: any, opts: any = {}) => {
|
|||||||
loose,
|
loose,
|
||||||
useBuiltIns,
|
useBuiltIns,
|
||||||
decoratorsLegacy,
|
decoratorsLegacy,
|
||||||
|
decoratorsVersion,
|
||||||
decoratorsBeforeExport,
|
decoratorsBeforeExport,
|
||||||
pipelineProposal,
|
pipelineProposal,
|
||||||
pipelineTopicToken,
|
pipelineTopicToken,
|
||||||
|
|||||||
@ -5,7 +5,8 @@ export default (_: any, opts: any = {}) => {
|
|||||||
const {
|
const {
|
||||||
loose = false,
|
loose = false,
|
||||||
useBuiltIns = false,
|
useBuiltIns = false,
|
||||||
decoratorsLegacy = false,
|
decoratorsLegacy,
|
||||||
|
decoratorsVersion,
|
||||||
decoratorsBeforeExport,
|
decoratorsBeforeExport,
|
||||||
pipelineProposal,
|
pipelineProposal,
|
||||||
pipelineTopicToken,
|
pipelineTopicToken,
|
||||||
@ -20,6 +21,7 @@ export default (_: any, opts: any = {}) => {
|
|||||||
loose,
|
loose,
|
||||||
useBuiltIns,
|
useBuiltIns,
|
||||||
decoratorsLegacy,
|
decoratorsLegacy,
|
||||||
|
decoratorsVersion,
|
||||||
decoratorsBeforeExport,
|
decoratorsBeforeExport,
|
||||||
pipelineProposal,
|
pipelineProposal,
|
||||||
pipelineTopicToken,
|
pipelineTopicToken,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export default (_: any, opts: any = {}) => {
|
|||||||
loose = false,
|
loose = false,
|
||||||
useBuiltIns = false,
|
useBuiltIns = false,
|
||||||
decoratorsLegacy = false,
|
decoratorsLegacy = false,
|
||||||
|
decoratorsVersion = "2018-09",
|
||||||
decoratorsBeforeExport,
|
decoratorsBeforeExport,
|
||||||
pipelineProposal = "minimal",
|
pipelineProposal = "minimal",
|
||||||
pipelineTopicToken = "%",
|
pipelineTopicToken = "%",
|
||||||
@ -17,7 +18,10 @@ export default (_: any, opts: any = {}) => {
|
|||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
babelPlugins.proposalDecorators,
|
babelPlugins.proposalDecorators,
|
||||||
{ legacy: decoratorsLegacy, decoratorsBeforeExport },
|
{
|
||||||
|
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
|
||||||
|
decoratorsBeforeExport,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
babelPlugins.proposalPipelineOperator,
|
babelPlugins.proposalPipelineOperator,
|
||||||
|
|||||||
@ -55,5 +55,20 @@ _ref = x, _ref;"
|
|||||||
_ref = x, _ref;"
|
_ref = x, _ref;"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
it("should support decorators versioned 2021-12", () => {
|
||||||
|
const output = Babel.transform("@dec class C {}", {
|
||||||
|
plugins: [["external-helpers", { helperVersion: "7.100.0" }]],
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
"stage-1",
|
||||||
|
{
|
||||||
|
decoratorsVersion: "2021-12",
|
||||||
|
decoratorsBeforeExport: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
}).code;
|
||||||
|
expect(output).toMatch("babelHelpers.applyDecs");
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user