diff --git a/packages/babel-node/test/config.json b/packages/babel-node/test/config.json index 06c1c58530..e82f5fcfa6 100644 --- a/packages/babel-node/test/config.json +++ b/packages/babel-node/test/config.json @@ -1,7 +1,7 @@ { "presets": [ "../../babel-preset-env", - ["../../babel-preset-react"] + ["../../babel-preset-react", { "runtime": "classic" }] ], "plugins": [ "../../babel-plugin-transform-strict-mode", diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json index e1385e0394..6dc5e9a6a3 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/regression/7178/options.json @@ -2,7 +2,7 @@ "plugins": [ "external-helpers", "transform-async-to-generator", - "transform-react-jsx", + ["transform-react-jsx", { "runtime": "classic" }], "transform-react-constant-elements" ] } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/options.json index d480b6d0ab..41e2cadf63 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/options.json +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/options.json @@ -2,7 +2,7 @@ "plugins": [ "transform-block-scoping", "syntax-jsx", - "transform-react-jsx", + ["transform-react-jsx", { "runtime": "classic" }], "transform-block-scoped-functions", "transform-arrow-functions" ] diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/options.json b/packages/babel-plugin-transform-classes/test/fixtures/regression/options.json index c27170293f..5aee2cfe4a 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/options.json +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/options.json @@ -1,4 +1,7 @@ { "plugins": ["external-helpers", "proposal-class-properties"], - "presets": [["env", { "targets": { "browsers": "ie 6" } }], "react"] + "presets": [ + ["env", { "targets": { "browsers": "ie 6" } }], + ["react", { "runtime": "classic" }] + ] } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/options.json b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/options.json index 16d4b70c31..3712ce18d5 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/options.json +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-3/options.json @@ -1,3 +1,6 @@ { - "presets": [["env", { "targets": { "browsers": "ie 6" } }], "react"] + "presets": [ + ["env", { "targets": { "browsers": "ie 6" } }], + ["react", { "runtime": "classic" }] + ] } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/options.json index 72ce72ca0b..646be547c2 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-react-jsx", "transform-react-constant-elements"] + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }], + "transform-react-constant-elements" + ] } diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/options.json index 72ce72ca0b..646be547c2 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-react-jsx", "transform-react-constant-elements"] + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }], + "transform-react-constant-elements" + ] } diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/options.json b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/options.json index 0979da7aff..cf2845dc2a 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/options.json +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/lowercase-member-expression/options.json @@ -3,7 +3,7 @@ "external-helpers", "syntax-jsx", "transform-react-inline-elements", - "transform-react-jsx", + ["transform-react-jsx", { "runtime": "classic" }], "transform-modules-commonjs" ] } diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/options.json b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/options.json index 0979da7aff..cf2845dc2a 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/options.json +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/inline-elements/member-expression/options.json @@ -3,7 +3,7 @@ "external-helpers", "syntax-jsx", "transform-react-inline-elements", - "transform-react-jsx", + ["transform-react-jsx", { "runtime": "classic" }], "transform-modules-commonjs" ] } diff --git a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/options.json b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/options.json index ba074de5fb..59c68d65b1 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/fixtures/options.json +++ b/packages/babel-plugin-transform-react-inline-elements/test/fixtures/options.json @@ -3,6 +3,6 @@ "external-helpers", "syntax-jsx", "transform-react-inline-elements", - "transform-react-jsx" + ["transform-react-jsx", { "runtime": "classic" }] ] } diff --git a/packages/babel-plugin-transform-react-jsx/src/create-plugin.js b/packages/babel-plugin-transform-react-jsx/src/create-plugin.js index 7485cc86b0..c0ed656736 100644 --- a/packages/babel-plugin-transform-react-jsx/src/create-plugin.js +++ b/packages/babel-plugin-transform-react-jsx/src/create-plugin.js @@ -30,7 +30,11 @@ export default function createPlugin({ name, development }) { // TODO (Babel 8): It should throw if this option is used with the automatic runtime filter, - runtime: RUNTIME_DEFAULT = development ? "automatic" : "classic", + runtime: RUNTIME_DEFAULT = process.env.BABEL_8_BREAKING + ? "automatic" + : development + ? "automatic" + : "classic", importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource, pragma: PRAGMA_DEFAULT = DEFAULT.pragma, diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/options.json new file mode 100644 index 0000000000..fa05b86b93 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false, "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/output.js new file mode 100644 index 0000000000..fd783106b6 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-automatic-runtime/output.js @@ -0,0 +1,3 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +_reactJsxRuntime.jsx("div", {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/options.json new file mode 100644 index 0000000000..3f03904314 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json deleted file mode 100644 index 8608ef3739..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pure": false }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-automatic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-automatic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-automatic-runtime/options.json new file mode 100644 index 0000000000..8515728c5e --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false, "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/options.json new file mode 100644 index 0000000000..3f03904314 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": false, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json deleted file mode 100644 index 8608ef3739..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pure": false }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-automatic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-automatic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-automatic-runtime/options.json new file mode 100644 index 0000000000..7d6646b2d3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": false, "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/options.json new file mode 100644 index 0000000000..9a94a0e2ae --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": false, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json deleted file mode 100644 index 65d9e8ae0d..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pragma": "h", "pure": false }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/options.json new file mode 100644 index 0000000000..5206bc8ed3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true, "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/output.js new file mode 100644 index 0000000000..5518c29044 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-automatic-runtime/output.js @@ -0,0 +1,4 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +/*#__PURE__*/ +_reactJsxRuntime.jsx("div", {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/options.json new file mode 100644 index 0000000000..1eb39754fc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json deleted file mode 100644 index c9f1fc61d3..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pure": true }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-automatic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-automatic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-automatic-runtime/options.json new file mode 100644 index 0000000000..9af0d6fb0a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true, "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/input.js new file mode 100644 index 0000000000..6b8761b4a9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/options.json new file mode 100644 index 0000000000..1eb39754fc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pure": true, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json deleted file mode 100644 index c9f1fc61d3..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pure": true }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/options.json new file mode 100644 index 0000000000..2da99eb016 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": true, "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/options.json new file mode 100644 index 0000000000..4c12140e43 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "pure": true, "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json deleted file mode 100644 index 8d4223a48b..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pragma": "h", "pure": true }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/options.json new file mode 100644 index 0000000000..aa1ff2bb27 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "automatic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/output.js new file mode 100644 index 0000000000..5518c29044 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-automatic-runtime/output.js @@ -0,0 +1,4 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +/*#__PURE__*/ +_reactJsxRuntime.jsx("div", {}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/options.json new file mode 100644 index 0000000000..d21f1136de --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json deleted file mode 100644 index c6c8501685..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-default-pragma/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", {}] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/input.js new file mode 100644 index 0000000000..6b8761b4a9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/options.json new file mode 100644 index 0000000000..e4d88c580a --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/input.js new file mode 100644 index 0000000000..6b8761b4a9 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/input.js @@ -0,0 +1,3 @@ +/* @jsx h */ + +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/options.json new file mode 100644 index 0000000000..d21f1136de --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json deleted file mode 100644 index c6c8501685..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-comment/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", {}] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/options.json new file mode 100644 index 0000000000..2465b20fdc --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-automatic-runtime/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "runtime": "automatic" }] + ], + "throws": "pragma and pragmaFrag cannot be set when runtime is automatic." +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/input.js new file mode 100644 index 0000000000..cbe1d12c58 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/input.js @@ -0,0 +1 @@ +; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/options.json new file mode 100644 index 0000000000..bb89905482 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "pragma": "h", "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json deleted file mode 100644 index 46f657580a..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/pure/unset-pragma-option/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - ["transform-react-jsx", { "pragma": "h" }] - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json index 17c61ec6cf..778a933de4 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json @@ -1,3 +1,3 @@ { - "plugins": [["transform-react-jsx", { "pragma": "foo.bar" }]] + "plugins": [["transform-react-jsx", { "pragma": "foo.bar", "runtime": "classic" }]] } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/options.json index 2aae85c034..5db83b99f4 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/options.json @@ -1,3 +1,3 @@ { - "plugins": [["transform-react-jsx", { "pragma": "dom" }]] + "plugins": [["transform-react-jsx", { "pragma": "dom", "runtime": "classic" }]] } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/options.json index 10a4a89a35..319425c118 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/options.json @@ -2,7 +2,7 @@ "plugins": [ "external-helpers", "syntax-jsx", - "transform-react-jsx", + ["transform-react-jsx", { "runtime": "classic" }], "transform-arrow-functions" ] } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/options.json index 81639b17e0..0cb674fb09 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/options.json @@ -1,3 +1,6 @@ { - "plugins": ["transform-react-jsx", "transform-property-literals"] + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }], + "transform-property-literals" + ] } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-support-xml-namespaces-if-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-support-xml-namespaces-if-flag/options.json index 644fc6f6da..390bd81516 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-support-xml-namespaces-if-flag/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-support-xml-namespaces-if-flag/options.json @@ -4,6 +4,7 @@ "transform-react-jsx", { "pragma": "h", + "runtime": "classic", "throwIfNamespace": false } ] diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json index 426249807e..8264ca4f74 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-throw-error-namespaces-if-not-flag/options.json @@ -4,6 +4,7 @@ "transform-react-jsx", { "pragma": "h", + "runtime": "classic", "throwIfNamespace": true } ] diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/options.json new file mode 100644 index 0000000000..d21f1136de --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-react-jsx", { "runtime": "classic" }] + ] +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/output.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/output.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default-classic-runtime/output.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json deleted file mode 100644 index 5e1d82404d..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/regression/pragma-frag-set-default/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - "transform-react-jsx" - ] -} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/input.js similarity index 100% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/input.js rename to packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/input.js diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/options.json similarity index 59% rename from packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json rename to packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/options.json index 4f654b8206..9895a36a86 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classic/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/options.json @@ -1,3 +1,4 @@ { + "BABEL_8_BREAKING": true, "plugins": ["transform-react-jsx"] } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/output.js new file mode 100644 index 0000000000..607dafdc73 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-automatic/output.js @@ -0,0 +1,5 @@ +var _reactJsxRuntime = require("react/jsx-runtime"); + +var x = /*#__PURE__*/_reactJsxRuntime.jsx("div", { + children: /*#__PURE__*/_reactJsxRuntime.jsx("span", {}) +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classis-babel-7/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classis-babel-7/input.js new file mode 100644 index 0000000000..6a6f1f219c --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/runtime/defaults-to-classis-babel-7/input.js @@ -0,0 +1 @@ +var x = (