diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js index dbad846412e6..216a0eed4d80 100644 --- a/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js @@ -2,5 +2,5 @@ module.exports = { presets: [["@babel/preset-env", { forceAllTransforms: true }]], - plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]], + plugins: [["@babel/plugin-proposal-decorators", { version: "legacy" }]], }; diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.js index 2e64c5214c20..426de60b219f 100644 --- a/eslint/babel-eslint-shared-fixtures/config/babel.config.js +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.js @@ -9,7 +9,7 @@ module.exports = { plugins: [ "@babel/plugin-syntax-export-default-from", "@babel/plugin-proposal-class-properties", - ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }], + ["@babel/plugin-proposal-decorators", { version: "2021-12" }], ["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], "@babel/plugin-proposal-private-methods", "@babel/plugin-proposal-do-expressions", diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_function.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_function.js index d0755324db58..9ca3312d367c 100644 --- a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_function.js +++ b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_function.js @@ -16,7 +16,7 @@ exports.default = function () { [ __dirname + "/../../../../../babel-plugin-syntax-decorators/lib/index.js", - { legacy: true }, + { version: "legacy" }, ], ], }; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js index cb27145ce49b..b77f9245097b 100644 --- a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js +++ b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js @@ -11,7 +11,7 @@ module.exports = function () { [ __dirname + "/../../../../../babel-plugin-syntax-decorators/lib/index.js", - { legacy: true }, + { version: "legacy" }, ], ], }; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js b/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js index dda0ce55675c..5c545c5ec696 100644 --- a/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js +++ b/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js @@ -4,7 +4,7 @@ module.exports = function () { [ __dirname + "/../../../../../babel-plugin-syntax-decorators/lib/index.js", - { legacy: true }, + { version: "legacy" }, ], ], }; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es5_object.js b/packages/babel-core/test/fixtures/option-manager/presets/es5_object.js index dda0ce55675c..5c545c5ec696 100644 --- a/packages/babel-core/test/fixtures/option-manager/presets/es5_object.js +++ b/packages/babel-core/test/fixtures/option-manager/presets/es5_object.js @@ -4,7 +4,7 @@ module.exports = function () { [ __dirname + "/../../../../../babel-plugin-syntax-decorators/lib/index.js", - { legacy: true }, + { version: "legacy" }, ], ], }; diff --git a/packages/babel-generator/src/generators/classes.ts b/packages/babel-generator/src/generators/classes.ts index 0212bd9d4737..01416fa82828 100644 --- a/packages/babel-generator/src/generators/classes.ts +++ b/packages/babel-generator/src/generators/classes.ts @@ -11,11 +11,15 @@ export function ClassDeclaration( node: t.ClassDeclaration, parent: t.Node, ) { - if ( - !this.format.decoratorsBeforeExport || - (!isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) - ) { + if (process.env.BABEL_8_BREAKING) { this.printJoin(node.decorators, node); + } else { + if ( + !this.format.decoratorsBeforeExport || + (!isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) + ) { + this.printJoin(node.decorators, node); + } } if (node.declare) { diff --git a/packages/babel-generator/src/generators/modules.ts b/packages/babel-generator/src/generators/modules.ts index e902729430cc..f40ba76b2604 100644 --- a/packages/babel-generator/src/generators/modules.ts +++ b/packages/babel-generator/src/generators/modules.ts @@ -90,11 +90,13 @@ export function ExportNamedDeclaration( this: Printer, node: t.ExportNamedDeclaration, ) { - if ( - this.format.decoratorsBeforeExport && - isClassDeclaration(node.declaration) - ) { - this.printJoin(node.declaration.decorators, node); + if (!process.env.BABEL_8_BREAKING) { + if ( + this.format.decoratorsBeforeExport && + isClassDeclaration(node.declaration) + ) { + this.printJoin(node.declaration.decorators, node); + } } this.word("export"); @@ -156,11 +158,13 @@ export function ExportDefaultDeclaration( this: Printer, node: t.ExportDefaultDeclaration, ) { - if ( - this.format.decoratorsBeforeExport && - isClassDeclaration(node.declaration) - ) { - this.printJoin(node.declaration.decorators, node); + if (!process.env.BABEL_8_BREAKING) { + if ( + this.format.decoratorsBeforeExport && + isClassDeclaration(node.declaration) + ) { + this.printJoin(node.declaration.decorators, node); + } } this.word("export"); diff --git a/packages/babel-generator/src/index.ts b/packages/babel-generator/src/index.ts index c6f609c7e831..b64536d182ab 100644 --- a/packages/babel-generator/src/index.ts +++ b/packages/babel-generator/src/index.ts @@ -66,7 +66,6 @@ function normalizeOptions( style: " ", base: 0, }, - decoratorsBeforeExport: !!opts.decoratorsBeforeExport, jsescOption: { quotes: "double", wrap: true, @@ -78,6 +77,7 @@ function normalizeOptions( }; if (!process.env.BABEL_8_BREAKING) { + format.decoratorsBeforeExport = !!opts.decoratorsBeforeExport; format.jsonCompatibleStrings = opts.jsonCompatibleStrings; } @@ -193,6 +193,7 @@ export interface GeneratorOptions { /** * Set to true to enable support for experimental decorators syntax before module exports. * Defaults to `false`. + * @deprecated Removed in Babel 8 */ decoratorsBeforeExport?: boolean; diff --git a/packages/babel-generator/src/printer.ts b/packages/babel-generator/src/printer.ts index 227fabe71aa6..857ca0c97034 100644 --- a/packages/babel-generator/src/printer.ts +++ b/packages/babel-generator/src/printer.ts @@ -35,7 +35,6 @@ export type Format = { style: string; base: number; }; - decoratorsBeforeExport: boolean; recordAndTupleSyntaxType: RecordAndTuplePluginOptions["syntaxType"]; jsescOption: jsescOptions; jsonCompatibleStrings?: boolean; @@ -44,6 +43,10 @@ export type Format = { * Changes what token is used for pipe bodies’ topic references. */ topicToken?: PipelineOperatorPluginOptions["topicToken"]; + /** + * @deprecated Removed in Babel 8 + */ + decoratorsBeforeExport?: boolean; }; interface AddNewlinesOptions { diff --git a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-false/options.json b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-false/options.json index 7ebfdd91777b..f19a69b6a2b8 100644 --- a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-false/options.json +++ b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-false/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [["decorators", { "decoratorsBeforeExport": false }]], "decoratorsBeforeExport": false } diff --git a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-true/options.json b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-true/options.json index 234fb2bac889..5cd524b7c638 100644 --- a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-true/options.json +++ b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/false-to-true/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [["decorators", { "decoratorsBeforeExport": false }]], "decoratorsBeforeExport": true } diff --git a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-false/options.json b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-false/options.json index 2540d61c86c0..99dc70805820 100644 --- a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-false/options.json +++ b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-false/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [["decorators", { "decoratorsBeforeExport": true }]], "decoratorsBeforeExport": false } diff --git a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-true/options.json b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-true/options.json index 788cc225058a..f82968d9ccb5 100644 --- a/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-true/options.json +++ b/packages/babel-generator/test/fixtures/decoratorsBeforeExport/true-to-true/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [["decorators", { "decoratorsBeforeExport": true }]], "decoratorsBeforeExport": true } diff --git a/packages/babel-helper-create-class-features-plugin/src/decorators.ts b/packages/babel-helper-create-class-features-plugin/src/decorators.ts index ef34aa56f399..a3d721a5412d 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -1,3 +1,5 @@ +// TODO(Babel 8): Remove this file + import { types as t, template } from "@babel/core"; import type { File } from "@babel/core"; import type { NodePath } from "@babel/traverse"; diff --git a/packages/babel-helper-create-class-features-plugin/src/features.ts b/packages/babel-helper-create-class-features-plugin/src/features.ts index a749d8b1b1c0..7a7ded5cf5fb 100644 --- a/packages/babel-helper-create-class-features-plugin/src/features.ts +++ b/packages/babel-helper-create-class-features-plugin/src/features.ts @@ -6,6 +6,7 @@ export const FEATURES = Object.freeze({ //classes: 1 << 0, fields: 1 << 1, privateMethods: 1 << 2, + // TODO(Babel 8): Remove this decorators: 1 << 3, privateIn: 1 << 4, staticBlocks: 1 << 5, @@ -170,10 +171,10 @@ export function shouldTransform(path: NodePath, file: File): boolean { throw path.buildCodeFrameError( "Decorators are not enabled." + "\nIf you are using " + - '["@babel/plugin-proposal-decorators", { "legacy": true }], ' + + '["@babel/plugin-proposal-decorators", { "version": "legacy" }], ' + 'make sure it comes *before* "@babel/plugin-proposal-class-properties" ' + "and enable loose mode, like so:\n" + - '\t["@babel/plugin-proposal-decorators", { "legacy": true }]\n' + + '\t["@babel/plugin-proposal-decorators", { "version": "legacy" }]\n' + '\t["@babel/plugin-proposal-class-properties", { "loose": true }]', ); } diff --git a/packages/babel-helper-create-class-features-plugin/src/index.ts b/packages/babel-helper-create-class-features-plugin/src/index.ts index 4d234b121916..c6002b084d27 100644 --- a/packages/babel-helper-create-class-features-plugin/src/index.ts +++ b/packages/babel-helper-create-class-features-plugin/src/index.ts @@ -168,7 +168,11 @@ export function createClassFeaturePlugin({ } } - if (!props.length && !isDecorated) return; + if (process.env.BABEL_8_BREAKING) { + if (!props.length) return; + } else { + if (!props.length && !isDecorated) return; + } const innerBinding = path.node.id; let ref: t.Identifier; @@ -207,14 +211,30 @@ export function createClassFeaturePlugin({ pureStaticNodes: t.FunctionDeclaration[], wrapClass: (path: NodePath) => NodePath; - if (isDecorated) { - staticNodes = pureStaticNodes = keysNodes = []; - ({ instanceNodes, wrapClass } = buildDecoratedClass( - ref, - path, - elements, - file, - )); + if (!process.env.BABEL_8_BREAKING) { + if (isDecorated) { + staticNodes = pureStaticNodes = keysNodes = []; + ({ instanceNodes, wrapClass } = buildDecoratedClass( + ref, + path, + elements, + file, + )); + } else { + keysNodes = extractComputedKeys(path, computedPaths, file); + ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = + buildFieldsInitNodes( + ref, + path.node.superClass, + props, + privateNamesMap, + file, + (setPublicClassFields ?? loose) as boolean, + (privateFieldsAsProperties ?? loose) as boolean, + (constantSuper ?? loose) as boolean, + innerBinding, + )); + } } else { keysNodes = extractComputedKeys(path, computedPaths, file); ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = @@ -237,7 +257,9 @@ export function createClassFeaturePlugin({ constructor, instanceNodes, (referenceVisitor, state) => { - if (isDecorated) return; + if (!process.env.BABEL_8_BREAKING) { + if (isDecorated) return; + } for (const prop of props) { // @ts-expect-error: TS doesn't infer that prop.node is not a StaticBlock if (t.isStaticBlock?.(prop.node) || prop.node.static) continue; @@ -261,21 +283,23 @@ export function createClassFeaturePlugin({ }, ExportDefaultDeclaration(path, { file }) { - if (file.get(versionKey) !== version) return; + if (!process.env.BABEL_8_BREAKING) { + if (file.get(versionKey) !== version) return; - const decl = path.get("declaration"); + const decl = path.get("declaration"); - if (decl.isClassDeclaration() && hasDecorators(decl.node)) { - if (decl.node.id) { - // export default class Foo {} - // --> - // class Foo {} export { Foo as default } - splitExportDeclaration(path); - } else { - // Annyms class declarations can be - // transformed as if they were expressions - // @ts-expect-error - decl.node.type = "ClassExpression"; + if (decl.isClassDeclaration() && hasDecorators(decl.node)) { + if (decl.node.id) { + // export default class Foo {} + // --> + // class Foo {} export { Foo as default } + splitExportDeclaration(path); + } else { + // Annyms class declarations can be + // transformed as if they were expressions + // @ts-expect-error + decl.node.type = "ClassExpression"; + } } } }, diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/exec.ts similarity index 100% rename from packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts rename to packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/exec.ts diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/input.ts similarity index 100% rename from packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts rename to packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/input.ts diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/options.json similarity index 84% rename from packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json rename to packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/options.json index 1783c7d93113..8f2ceedbdf82 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "presets": [["typescript"]], "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": true }], diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/output.js similarity index 100% rename from packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js rename to packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/2018-12-ignore-abstract-methods/output.js diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json index 6f03cd7aad03..4df31c10a0f2 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], ["proposal-class-properties"], "transform-classes" ] diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json index 8c831989533b..126d13906aea 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], ["proposal-class-properties", { "loose": true }], "transform-classes" ] diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json index 6f03cd7aad03..4df31c10a0f2 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], ["proposal-class-properties"], "transform-classes" ] diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/wrong-order/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/wrong-order/options.json index 64fd0cbcea65..ecd6aeb93cdb 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/wrong-order/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/wrong-order/options.json @@ -1,7 +1,7 @@ { "plugins": [ ["proposal-class-properties", { "loose": true }], - ["proposal-decorators", { "legacy": true }] + ["proposal-decorators", { "version": "legacy" }] ], "throws": "Decorators are not enabled." } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/options.json index 8c831989533b..126d13906aea 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/options.json +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], ["proposal-class-properties", { "loose": true }], "transform-classes" ] diff --git a/packages/babel-plugin-proposal-decorators/src/index.ts b/packages/babel-plugin-proposal-decorators/src/index.ts index 929fd5e824a2..2cc119636033 100644 --- a/packages/babel-plugin-proposal-decorators/src/index.ts +++ b/packages/babel-plugin-proposal-decorators/src/index.ts @@ -21,9 +21,17 @@ export default declare((api, options: Options) => { api.assertVersion(7); // Options are validated in @babel/plugin-syntax-decorators - const { legacy, version } = options; + if (!process.env.BABEL_8_BREAKING) { + // eslint-disable-next-line no-var + var { legacy } = options; + } + const { version } = options; - if (legacy || version === "legacy") { + if ( + process.env.BABEL_8_BREAKING + ? version === "legacy" + : legacy || version === "legacy" + ) { return { name: "proposal-decorators", inherits: syntaxDecorators, @@ -31,7 +39,7 @@ export default declare((api, options: Options) => { }; } else if (version === "2021-12") { return transformer2021_12(api, options); - } else { + } else if (!process.env.BABEL_8_BREAKING) { return createClassFeaturePlugin({ name: "proposal-decorators", @@ -40,5 +48,9 @@ export default declare((api, options: Options) => { inherits: syntaxDecorators, // loose: options.loose, Not supported }); + } else { + throw new Error( + "The '.version' option must be one of 'legacy' or '2021-12'", + ); } }); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/coalesce-get-set/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/coalesce-get-set/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/coalesce-get-set/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/coalesce-get-set/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-ast/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-ast/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/computed-keys-same-value/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/computed-keys-same-value/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-from-class-decorator/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-from-class-decorator/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-from-class-decorator/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-from-class-decorator/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-from-method-decorator/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-from-method-decorator/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-from-method-decorator/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-from-method-decorator/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-with-extras/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-with-extras/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/create-existing-element-with-extras/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/create-existing-element-with-extras/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/extras-duplicated/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/extras-duplicated/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/extras-duplicated/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/extras-duplicated/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/extras-same-as-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/extras-same-as-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/extras-same-as-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/extras-same-as-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/get-set-both-decorated/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/get-set-both-decorated/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/get-set-both-decorated/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/get-set-both-decorated/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/moved-and-created/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/moved-and-created/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/moved-and-created/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/moved-and-created/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/options.json similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/options.json index 57fadf095498..3a0c89abe469 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-both-decorated/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-both-decorated/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-both-decorated/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-both-decorated/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-first-decorated/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-first-decorated/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-first-decorated/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-first-decorated/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-no-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-no-decorators/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-no-decorators/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-no-decorators/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-second-decorated/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-second-decorated/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-overwritten-second-decorated/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-overwritten-second-decorated/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-prototype-and-static/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-prototype-and-static/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/original-method-prototype-and-static/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-duplicated-keys/original-method-prototype-and-static/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-own-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-own-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-own-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-own-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-own-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-own-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-own-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-own-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-prototype-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-prototype-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-prototype-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-prototype-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-prototype-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-prototype-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-prototype-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-prototype-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-static-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-static-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-static-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-static-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-static-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-static-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/created-static-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/created-static-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/default/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/default/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/default/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/default/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-class/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-class/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-class/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/not-reused-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/not-reused-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/options.json similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/options.json index 57fadf095498..3a0c89abe469 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-class/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-class/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-class/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-own-field-without-initiailzer/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-own-field-without-initiailzer/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-own-field-without-initiailzer/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-own-field-without-initiailzer/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-own-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-own-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-own-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-own-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-prototype-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-prototype-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-prototype-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-prototype-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-static-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-static-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-static-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-static-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-static-method/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-static-method/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/element-descriptors/original-static-method/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-element-descriptors/original-static-method/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/finishers/class-as-parameter/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/class-as-parameter/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/finishers/class-as-parameter/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/class-as-parameter/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/finishers/no-in-extras/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/no-in-extras/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/finishers/no-in-extras/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/no-in-extras/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/finishers/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/options.json similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/finishers/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/options.json index 57fadf095498..3a0c89abe469 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/finishers/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/finishers/return-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/return-class/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/finishers/return-class/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-finishers/return-class/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/class-accessor-property/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/class-accessor-property/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/class-accessor-property/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/class-accessor-property/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/class-accessor-property/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/class-accessor-property/options.json similarity index 91% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/class-accessor-property/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/class-accessor-property/options.json index d453a9ad73fd..93cf6af3c2cd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/class-accessor-property/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/class-accessor-property/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ [ "proposal-decorators", diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/static-block/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/static-block/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/static-block/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/static-block/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/static-block/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/static-block/options.json similarity index 91% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/static-block/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/static-block/options.json index 6316387da387..9f772a44fbfb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations/static-block/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-integrations-babel-7/static-block/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ [ "proposal-decorators", diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name-not-shadow/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name-not-shadow/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/method-name/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/method-name/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/options.json similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/options.json index 57fadf095498..3a0c89abe469 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/duplicated-keys/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/options.json @@ -1,4 +1,5 @@ { + "BABEL_8_BREAKING": false, "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/misc/to-primitive/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/to-primitive/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/misc/to-primitive/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-misc/to-primitive/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/decorators/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/ordering/decorators/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/decorators/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/ordering/field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/finishers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/finishers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/ordering/finishers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/finishers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/options.json new file mode 100644 index 000000000000..3a0c89abe469 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/options.json @@ -0,0 +1,7 @@ +{ + "BABEL_8_BREAKING": false, + "plugins": [ + ["proposal-decorators", { "decoratorsBeforeExport": false }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/static-field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/ordering/static-field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-ordering/static-field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/arguments/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/arguments/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/arguments/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/arguments/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/arguments/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/arguments/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/arguments/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/arguments/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/options.json new file mode 100644 index 000000000000..f9c4ee8bb7f5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-decorators", { "decoratorsBeforeExport": true }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/async-generator-method/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/options.json new file mode 100644 index 000000000000..f9c4ee8bb7f5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-decorators", { "decoratorsBeforeExport": true }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/class-decorators-yield-await/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/declaration/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/declaration/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/declaration/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/declaration/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/declaration/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/declaration/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/declaration/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/declaration/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-anonymous/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-anonymous/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-anonymous/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-anonymous/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-anonymous/output.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-anonymous/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-anonymous/output.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-named/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-named/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-named/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-named/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-named/output.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/export-default-named/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/export-default-named/output.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/expression/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/expression/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-await/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-await/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-await/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-await/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-await/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-yield/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-yield/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-yield/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends-yield/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends-yield/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/extends/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/extends/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initiailzer-after-super-bug-8808/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initiailzer-after-super-bug-8808/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initiailzer-after-super-bug-8808/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initiailzer-after-super-bug-8808/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initiailzer-after-super-bug-8808/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initiailzer-after-super-bug-8808/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initiailzer-after-super-bug-8808/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initiailzer-after-super-bug-8808/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-bug-8931/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-bug-8931/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-bug-8931/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-bug-8931/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-bug-8931/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-bug-8931/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-bug-8931/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-bug-8931/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-expression/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-expression/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-multiple/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-multiple/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-multiple/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-multiple/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-multiple/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-multiple/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-multiple/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-multiple/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-statement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-statement/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-statement/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-statement/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-statement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-statement/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/initialize-after-super-statement/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/initialize-after-super-statement/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/only-decorated/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/only-decorated/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/only-decorated/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/only-decorated/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/only-decorated/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/only-decorated/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/only-decorated/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/only-decorated/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/options.json new file mode 100644 index 000000000000..3a0c89abe469 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/options.json @@ -0,0 +1,7 @@ +{ + "BABEL_8_BREAKING": false, + "plugins": [ + ["proposal-decorators", { "decoratorsBeforeExport": false }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/strict-directive/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/strict-directive/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/strict-directive/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/strict-directive/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/strict-directive/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/strict-directive/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/transformation/strict-directive/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2018-09-transformation/strict-directive/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-constructors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-constructors/options.json index a8b36fc49a7d..b5ed719faf7a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-constructors/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-constructors/options.json @@ -3,5 +3,5 @@ "setPublicClassFields": true }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-export-default/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-export-default/options.json index a8b36fc49a7d..b5ed719faf7a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-export-default/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-export-default/options.json @@ -3,5 +3,5 @@ "setPublicClassFields": true }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-ordering/options.json index a8b36fc49a7d..b5ed719faf7a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-ordering/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-ordering/options.json @@ -3,5 +3,5 @@ "setPublicClassFields": true }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-methods/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-methods/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-methods/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-methods/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-methods/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-methods/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-properties/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-properties/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-properties/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-static-properties/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-decl-to-expression/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-decl-to-expression/options.json index 3269632a3f11..ac1df5986e20 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-decl-to-expression/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-decl-to-expression/options.json @@ -1,4 +1,4 @@ { "presets": [], - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-methods/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-methods/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-methods/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-ordering/options.json index a8b36fc49a7d..b5ed719faf7a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-ordering/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-ordering/options.json @@ -3,5 +3,5 @@ "setPublicClassFields": true }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-properties/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-properties/options.json index 349e2f1419f2..6649f9f05f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-properties/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-object-properties/options.json @@ -4,9 +4,15 @@ }, "presets": [["env", { "targets": { "browsers": "ie 6" } }]], "plugins": [ - ["proposal-decorators", { "legacy": true }], - ["babel-plugin-polyfill-es-shims", { "method": "usage-global", "targets": { - "node": "current" - }}] + ["proposal-decorators", { "version": "legacy" }], + [ + "babel-plugin-polyfill-es-shims", + { + "method": "usage-global", + "targets": { + "node": "current" + } + } + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json index ee996d3cfc6f..f490103f5830 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json @@ -1,6 +1,6 @@ { "plugins": [ "transform-typescript", - ["proposal-decorators", { "legacy": true }] + ["proposal-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8041/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8041/options.json index 563691359c83..554a3f217e13 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8041/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8041/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], "proposal-class-properties" ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8512/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8512/options.json index 92ce979119b0..77635e9121db 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8512/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8512/options.json @@ -1,3 +1,3 @@ { - "plugins": [["proposal-decorators", { "legacy": true }]] + "plugins": [["proposal-decorators", { "version": "legacy" }]] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/options.json deleted file mode 100644 index 57fadf095498..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/ordering/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "decoratorsBeforeExport": false }], - "proposal-class-properties" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json deleted file mode 100644 index 57fadf095498..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "decoratorsBeforeExport": false }], - "proposal-class-properties" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json deleted file mode 100644 index 57fadf095498..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "decoratorsBeforeExport": false }], - "proposal-class-properties" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/options.json deleted file mode 100644 index 57fadf095498..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "decoratorsBeforeExport": false }], - "proposal-class-properties" - ] -} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json index d9bc8f93e7d4..dbe394c78668 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json @@ -1,6 +1,8 @@ { "plugins": [ ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }], - ["proposal-decorators", { "decoratorsBeforeExport": false }] + ["proposal-decorators", { "version": "2021-12" }], + "proposal-class-static-block", + "proposal-class-properties" ] } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js index 3d2b64ddf390..490ebb4246a4 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js @@ -1,25 +1,16 @@ +var _initClass, _decorated_class, _class; + const expectedValue = 42; function decorator(target) { target.decoratorValue = expectedValue; } -const result = babelHelpers.decorate([decorator], function (_initialize) { - "use strict"; - - class _class { - constructor() { - _initialize(this); - - this.value = expectedValue; - } - +const result = ((_class = class { + constructor() { + this.value = expectedValue; } - return { - F: _class, - d: [] - }; -}); +}, [_decorated_class, _initClass] = babelHelpers.applyDecs(_class, [], [decorator]), _initClass()), _decorated_class); expect(result.decoratorValue).toBe(expectedValue); expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json index 15526f1d0636..da98f89f4ef9 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json @@ -1,6 +1,8 @@ { "plugins": [ ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }], - ["proposal-decorators", { "decoratorsBeforeExport": false }] + ["proposal-decorators", { "version": "2021-12" }], + "proposal-class-static-block", + "proposal-class-properties" ] } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js index 3d2b64ddf390..490ebb4246a4 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js @@ -1,25 +1,16 @@ +var _initClass, _decorated_class, _class; + const expectedValue = 42; function decorator(target) { target.decoratorValue = expectedValue; } -const result = babelHelpers.decorate([decorator], function (_initialize) { - "use strict"; - - class _class { - constructor() { - _initialize(this); - - this.value = expectedValue; - } - +const result = ((_class = class { + constructor() { + this.value = expectedValue; } - return { - F: _class, - d: [] - }; -}); +}, [_decorated_class, _initClass] = babelHelpers.applyDecs(_class, [], [decorator]), _initClass()), _decorated_class); expect(result.decoratorValue).toBe(expectedValue); expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-syntax-decorators/src/index.ts b/packages/babel-plugin-syntax-decorators/src/index.ts index 83dd7f8f0b7c..d4f914ce38ed 100644 --- a/packages/babel-plugin-syntax-decorators/src/index.ts +++ b/packages/babel-plugin-syntax-decorators/src/index.ts @@ -1,49 +1,83 @@ import { declare } from "@babel/helper-plugin-utils"; export interface Options { + // TODO(Babel 8): Remove legacy?: boolean; + // TODO(Babel 8): Remove "2018-09" version?: "legacy" | "2018-09" | "2021-12"; + // TODO(Babel 8): Remove decoratorsBeforeExport?: boolean; } export default declare((api, options: Options) => { api.assertVersion(7); - const { - legacy, // TODO: Remove in Babel 8 + let { version } = options; - version = legacy ? "legacy" : "2018-09", - decoratorsBeforeExport = version === "2021-12" ? false : undefined, - } = options; - if (version !== "2021-12" && version !== "2018-09" && version !== "legacy") { - throw new Error("Unsupported decorators version: " + version); - } - if (legacy !== undefined) { - if (typeof legacy !== "boolean") { - throw new Error(".legacy must be a boolean."); - } - if (options.version !== undefined) { + if (process.env.BABEL_8_BREAKING) { + if (version === undefined) { throw new Error( - "You can either use the .legacy or the .version option, not both.", + "The decorators plugin requires a 'version' option, whose value must be one of: " + + "'2021-12', '2018-09', or 'legacy'.", ); } - } - - if (decoratorsBeforeExport === undefined) { - if (version === "2018-09") { + if (version !== "2021-12" && version !== "legacy") { + throw new Error("Unsupported decorators version: " + version); + } + if (options.legacy !== undefined) { throw new Error( - "The decorators plugin, when .version is '2018-09' or not specified," + - " requires a 'decoratorsBeforeExport' option, whose value must be a boolean.", + `The .legacy option has been removed in Babel 8. Use .version: "legacy" instead.`, ); } - } else { - if (version === "legacy") { + if (options.decoratorsBeforeExport !== undefined) { throw new Error( - "'decoratorsBeforeExport' can't be used with legacy decorators.", + `The .decoratorsBeforeExport option has been removed in Babel 8.`, ); } - if (typeof decoratorsBeforeExport !== "boolean") { - throw new Error("'decoratorsBeforeExport' must be a boolean."); + } else { + const { legacy } = options; + + if (legacy !== undefined) { + if (typeof legacy !== "boolean") { + throw new Error(".legacy must be a boolean."); + } + if (version !== undefined) { + throw new Error( + "You can either use the .legacy or the .version option, not both.", + ); + } + } + + if (version === undefined) { + version = legacy ? "legacy" : "2018-09"; + } else if ( + version !== "2021-12" && + version !== "2018-09" && + version !== "legacy" + ) { + throw new Error("Unsupported decorators version: " + version); + } + + // eslint-disable-next-line no-var + var { decoratorsBeforeExport } = options; + if (decoratorsBeforeExport === undefined) { + if (version === "2021-12") { + decoratorsBeforeExport = false; + } else if (version === "2018-09") { + throw new Error( + "The decorators plugin, when .version is '2018-09' or not specified," + + " requires a 'decoratorsBeforeExport' option, whose value must be a boolean.", + ); + } + } else { + if (version === "legacy") { + throw new Error( + "'decoratorsBeforeExport' can't be used with legacy decorators.", + ); + } + if (typeof decoratorsBeforeExport !== "boolean") { + throw new Error("'decoratorsBeforeExport' must be a boolean."); + } } } @@ -53,16 +87,22 @@ export default declare((api, options: Options) => { manipulateOptions({ generatorOpts }, parserOpts) { if (version === "legacy") { parserOpts.plugins.push("decorators-legacy"); - } else if (version === "2018-09") { - parserOpts.plugins.push(["decorators", { decoratorsBeforeExport }]); - generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport; - } else { - // version === "2021-12" + } else if (process.env.BABEL_8_BREAKING) { parserOpts.plugins.push( - ["decorators", { decoratorsBeforeExport }], + ["decorators", { decoratorsBeforeExport: false }], "decoratorAutoAccessors", ); - generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport; + } else { + if (version === "2021-12") { + parserOpts.plugins.push( + ["decorators", { decoratorsBeforeExport }], + "decoratorAutoAccessors", + ); + generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport; + } else if (version === "2018-09") { + parserOpts.plugins.push(["decorators", { decoratorsBeforeExport }]); + generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport; + } } }, }; diff --git a/packages/babel-plugin-syntax-decorators/test/index.js b/packages/babel-plugin-syntax-decorators/test/index.js index 286cb4dbefb6..0d7927af9dd3 100644 --- a/packages/babel-plugin-syntax-decorators/test/index.js +++ b/packages/babel-plugin-syntax-decorators/test/index.js @@ -10,7 +10,10 @@ function makeParser(code, options) { }); } -describe("'legacy' option", function () { +const babel8 = process.env.BABEL_8_BREAKING ? test : test.skip; +const babel7describe = process.env.BABEL_8_BREAKING ? describe.skip : describe; + +babel7describe("'legacy' option", function () { test("must be boolean", function () { expect(makeParser("", { legacy: "legacy" })).toThrow(); }); @@ -28,9 +31,11 @@ describe("'legacy' option", function () { }); }); -describe("'decoratorsBeforeExport' option", function () { +babel7describe("'decoratorsBeforeExport' option", function () { test("must be boolean", function () { - expect(makeParser("", { decoratorsBeforeExport: "before" })).toThrow(); + expect( + makeParser("", { version: "2021-12", decoratorsBeforeExport: "before" }), + ).toThrow(); }); test("is required with 2018-09 decorators", function () { @@ -42,10 +47,13 @@ describe("'decoratorsBeforeExport' option", function () { test("is incompatible with legacy", function () { expect( - makeParser("", { decoratorsBeforeExport: false, legacy: true }), + makeParser("", { decoratorsBeforeExport: false, version: "legacy" }), ).toThrow(); + }); + + test("is incompatible with legacy when using the 'legacy' option", () => { expect( - makeParser("", { decoratorsBeforeExport: false, version: "legacy" }), + makeParser("", { decoratorsBeforeExport: false, legacy: true }), ).toThrow(); }); @@ -72,12 +80,20 @@ describe("'decoratorsBeforeExport' option", function () { const codeTitle = code === BEFORE ? "before" : "after"; if (throws) { test(`${before} - decorators ${codeTitle} export should throw`, function () { - expect(makeParser(code, { decoratorsBeforeExport: before })).toThrow(); + expect( + makeParser(code, { + version: "2021-12", + decoratorsBeforeExport: before, + }), + ).toThrow(); }); } else { test(`${before} - decorators ${codeTitle} export should not throw`, function () { expect( - makeParser(code, { decoratorsBeforeExport: before }), + makeParser(code, { + version: "2021-12", + decoratorsBeforeExport: before, + }), ).not.toThrow(); }); } @@ -95,4 +111,8 @@ describe("'version' option", function () { makeParser("", { version: "2015-02", decoratorsBeforeExport: true }), ).toThrow(); }); + + babel8("is required", function () { + expect(makeParser("", {})).toThrow(); + }); }); diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/options.json b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/options.json index 1a4635f61abb..7e164c9f6107 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/options.json +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-2/options.json @@ -2,7 +2,7 @@ "plugins": [ "transform-function-name", "transform-classes", - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], "transform-modules-commonjs" ] } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/options.json b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/options.json index 4e45a6a625ea..5b29df95b8ad 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/options.json +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules-3/options.json @@ -3,6 +3,6 @@ "transform-function-name", "transform-modules-commonjs", "transform-classes", - ["proposal-decorators", { "legacy": true }] + ["proposal-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/options.json b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/options.json index 4e45a6a625ea..5b29df95b8ad 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/options.json +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/modules/options.json @@ -3,6 +3,6 @@ "transform-function-name", "transform-modules-commonjs", "transform-classes", - ["proposal-decorators", { "legacy": true }] + ["proposal-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json index e7d1719c563e..292ee8bc659a 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/options.json @@ -2,6 +2,6 @@ "plugins": [ "transform-function-name", "transform-classes", - ["proposal-decorators", { "legacy": true }] + ["proposal-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-method/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-method/options.json index 8549cff84993..14ba4f1468b7 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-method/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-method/options.json @@ -4,7 +4,7 @@ [ "proposal-decorators", { - "legacy": true + "version": "legacy" } ] ], diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/options.json index 8549cff84993..14ba4f1468b7 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/options.json @@ -4,7 +4,7 @@ [ "proposal-decorators", { - "legacy": true + "version": "legacy" } ] ], diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated/options.json index 8549cff84993..14ba4f1468b7 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated/options.json @@ -4,7 +4,7 @@ [ "proposal-decorators", { - "legacy": true + "version": "legacy" } ] ], diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-babel-7/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-babel-7/options.json index a9701db68995..5887f4355c85 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-babel-7/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-babel-7/options.json @@ -2,6 +2,6 @@ "BABEL_8_BREAKING": false, "plugins": [ ["transform-typescript", { "allowDeclareFields": true }], - ["syntax-decorators", { "legacy": true }] + ["syntax-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json index 1873c2b33708..ffef005f64fd 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json @@ -2,6 +2,6 @@ "BABEL_8_BREAKING": true, "plugins": [ "transform-typescript", - ["syntax-decorators", { "legacy": true }] + ["syntax-decorators", { "version": "legacy" }] ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/options.json index 8f17a067939d..5a311eda52e0 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/options.json @@ -1,7 +1,7 @@ { "plugins": [ ["transform-typescript", { "allowDeclareFields": true }], - ["proposal-decorators", { "legacy": true }], + ["proposal-decorators", { "version": "legacy" }], ["proposal-class-properties"] ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties-babel-7/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties-babel-7/options.json index ede2f47e3459..e2eb87083997 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties-babel-7/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties-babel-7/options.json @@ -1,4 +1,7 @@ { "BABEL_8_BREAKING": false, - "plugins": ["transform-typescript", ["syntax-decorators", { "legacy": true }]] + "plugins": [ + "transform-typescript", + ["syntax-decorators", { "version": "legacy" }] + ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json index 5f63671b9969..ffef005f64fd 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/options.json @@ -1,4 +1,7 @@ { "BABEL_8_BREAKING": true, - "plugins": ["transform-typescript", ["syntax-decorators", { "legacy": true }]] + "plugins": [ + "transform-typescript", + ["syntax-decorators", { "version": "legacy" }] + ] } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/imports/parameter-decorators/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/imports/parameter-decorators/options.json index dcdc6eed36c0..3a7ec4c060b0 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/imports/parameter-decorators/options.json +++ b/packages/babel-plugin-transform-typescript/test/fixtures/imports/parameter-decorators/options.json @@ -4,7 +4,7 @@ [ "proposal-decorators", { - "legacy": true + "version": "legacy" } ], "./plugin" diff --git a/packages/babel-standalone/test/babel.js b/packages/babel-standalone/test/babel.js index bc4d463dd365..7ad602215dfb 100644 --- a/packages/babel-standalone/test/babel.js +++ b/packages/babel-standalone/test/babel.js @@ -238,7 +238,7 @@ const require = createRequire(import.meta.url); it("#11628 - supports stage-0 passing importAssertionsVersion to stage-1", () => { expect(() => Babel.transform("const getMessage = () => 'Hello World'", { - presets: [["stage-0", { decoratorsBeforeExport: false }]], + presets: [["stage-0", { decoratorsLegacy: true }]], }), ).not.toThrow(); }); diff --git a/packages/babel-standalone/test/preset-stage-1.test.js b/packages/babel-standalone/test/preset-stage-1.test.js index 6e763f9e949c..c9a64c3326b1 100644 --- a/packages/babel-standalone/test/preset-stage-1.test.js +++ b/packages/babel-standalone/test/preset-stage-1.test.js @@ -11,7 +11,7 @@ const require = createRequire(import.meta.url); it("should parser decimal literal", () => { const output = Babel.transform("0.3m", { - presets: [["stage-1", { decoratorsBeforeExport: true }]], + presets: [["stage-1", { decoratorsLegacy: true }]], }).code; expect(output).toBe("0.3m;"); }); @@ -23,7 +23,7 @@ const require = createRequire(import.meta.url); "stage-1", { pipelineProposal: "hack", - decoratorsBeforeExport: true, + decoratorsLegacy: true, }, ], ], @@ -40,7 +40,7 @@ const require = createRequire(import.meta.url); pipelineProposal: "hack", pipelineTopicToken: "#", recordAndTupleSyntax: "bar", - decoratorsBeforeExport: true, + decoratorsLegacy: true, }, ], ], @@ -50,15 +50,7 @@ const require = createRequire(import.meta.url); 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, - }, - ], - ], + presets: [["stage-1", { decoratorsVersion: "2021-12" }]], }).code; expect(output).toMatch("babelHelpers.applyDecs"); }); diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh index 853482506e33..febdbae59c22 100755 --- a/scripts/integration-tests/e2e-vue-cli.sh +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -39,6 +39,11 @@ fi # but we import it from @babel/runtime. sed -i 's%toMatch(`regenerator-runtime/runtime`)%toMatch(`@babel/runtime/helpers/regeneratorRuntime`)%' packages/@vue/babel-preset-app/__tests__/babel-preset.spec.js +if [ "$BABEL_8_BREAKING" = true ] ; then + # This option is renamed in Babel 8 + sed -i 's/legacy: decoratorsLegacy !== false/version: decoratorsLegacy === false ? "legacy": "2021-12"/g' packages/@vue/babel-preset-app/index.js +fi + # Test CI=true yarn test -p babel,babel-preset-app