fix(transformer): react development default value should be false (#3002)

This commit is contained in:
Boshen 2024-04-16 17:28:31 +08:00 committed by GitHub
parent 5f4c1e1d3e
commit 67045467c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 17 deletions

View file

@ -67,8 +67,7 @@ pub struct ReactOptions {
/// This toggles behavior specific to development, such as adding __source and __self. /// This toggles behavior specific to development, such as adding __source and __self.
/// ///
/// Defaults to `true`. /// Defaults to `false`.
#[serde(default = "default_as_true")]
pub development: bool, pub development: bool,
/// Toggles whether or not to throw an error if a XML namespaced tag name is used. /// Toggles whether or not to throw an error if a XML namespaced tag name is used.
@ -127,10 +126,10 @@ impl Default for ReactOptions {
Self { Self {
jsx_plugin: true, jsx_plugin: true,
display_name_plugin: true, display_name_plugin: true,
jsx_self_plugin: true, jsx_self_plugin: false,
jsx_source_plugin: true, jsx_source_plugin: false,
runtime: ReactJsxRuntime::default(), runtime: ReactJsxRuntime::default(),
development: default_as_true(), development: false,
throw_if_namespace: default_as_true(), throw_if_namespace: default_as_true(),
pure: default_as_true(), pure: default_as_true(),
import_source: default_for_import_source(), import_source: default_for_import_source(),
@ -144,11 +143,11 @@ impl Default for ReactOptions {
impl ReactOptions { impl ReactOptions {
pub fn is_jsx_self_plugin_enabled(&self) -> bool { pub fn is_jsx_self_plugin_enabled(&self) -> bool {
self.jsx_self_plugin && self.development self.jsx_self_plugin || self.development
} }
pub fn is_jsx_source_plugin_enabled(&self) -> bool { pub fn is_jsx_source_plugin_enabled(&self) -> bool {
self.jsx_source_plugin && self.development self.jsx_source_plugin || self.development
} }
/// Scan through all comments and find the following pragmas /// Scan through all comments and find the following pragmas

View file

@ -1,13 +1,11 @@
Passed: 126/219 Passed: 133/219
# All Passed: # All Passed:
* babel-plugin-transform-react-jsx-source * babel-plugin-transform-react-jsx-source
# babel-preset-typescript (4/16) # babel-preset-typescript (6/16)
* jsx-compat/js-valid/input.js
* jsx-compat/ts-invalid/input.ts * jsx-compat/ts-invalid/input.ts
* jsx-compat/tsx-valid/input.tsx
* node-extensions/import-in-cts/input.cts * node-extensions/import-in-cts/input.cts
* node-extensions/type-assertion-in-cts/input.cts * node-extensions/type-assertion-in-cts/input.cts
* node-extensions/type-assertion-in-mts/input.mts * node-extensions/type-assertion-in-mts/input.mts
@ -87,16 +85,11 @@ Passed: 126/219
* regression/15768/input.ts * regression/15768/input.ts
* variable-declaration/non-null-in-optional-chain/input.ts * variable-declaration/non-null-in-optional-chain/input.ts
# babel-preset-react (2/11) # babel-preset-react (7/11)
* preset-options/development/input.js * preset-options/development/input.js
* preset-options/development-runtime-automatic/input.js * preset-options/development-runtime-automatic/input.js
* preset-options/development-runtime-automatic-windows/input.js * preset-options/development-runtime-automatic-windows/input.js
* preset-options/development-windows/input.js * preset-options/development-windows/input.js
* preset-options/empty-options/input.js
* preset-options/runtime-automatic/input.js
* preset-options/runtime-classic/input.js
* preset-options/runtime-classic-pragma-no-frag/input.js
* regression/11294/input.mjs
# babel-plugin-transform-react-jsx (35/36) # babel-plugin-transform-react-jsx (35/36)
* autoImport/complicated-scope-module/input.js * autoImport/complicated-scope-module/input.js