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 {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
decoratorsLegacy,
|
||||
decoratorsVersion,
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal,
|
||||
pipelineTopicToken,
|
||||
@ -20,6 +21,7 @@ export default (_: any, opts: any = {}) => {
|
||||
loose,
|
||||
useBuiltIns,
|
||||
decoratorsLegacy,
|
||||
decoratorsVersion,
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal,
|
||||
pipelineTopicToken,
|
||||
|
||||
@ -5,7 +5,8 @@ export default (_: any, opts: any = {}) => {
|
||||
const {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
decoratorsLegacy,
|
||||
decoratorsVersion,
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal,
|
||||
pipelineTopicToken,
|
||||
@ -20,6 +21,7 @@ export default (_: any, opts: any = {}) => {
|
||||
loose,
|
||||
useBuiltIns,
|
||||
decoratorsLegacy,
|
||||
decoratorsVersion,
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal,
|
||||
pipelineTopicToken,
|
||||
|
||||
@ -6,6 +6,7 @@ export default (_: any, opts: any = {}) => {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
decoratorsVersion = "2018-09",
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal = "minimal",
|
||||
pipelineTopicToken = "%",
|
||||
@ -17,7 +18,10 @@ export default (_: any, opts: any = {}) => {
|
||||
plugins: [
|
||||
[
|
||||
babelPlugins.proposalDecorators,
|
||||
{ legacy: decoratorsLegacy, decoratorsBeforeExport },
|
||||
{
|
||||
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
|
||||
decoratorsBeforeExport,
|
||||
},
|
||||
],
|
||||
[
|
||||
babelPlugins.proposalPipelineOperator,
|
||||
|
||||
@ -55,5 +55,20 @@ _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