feat(napi/transform): rename all mention of React to Jsx; remove mention of Binding (#6198)

This does not alter field names nor file names.

part of #6156
This commit is contained in:
Boshen 2024-10-01 03:44:53 +00:00 committed by Boshen
parent f6a3450710
commit 51a78d5946
No known key found for this signature in database
GPG key ID: 67715A371E534061
10 changed files with 67 additions and 76 deletions

View file

@ -52,7 +52,7 @@ pub use crate::{
env::{EnvOptions, Targets}, env::{EnvOptions, Targets},
es2015::{ArrowFunctionsOptions, ES2015Options}, es2015::{ArrowFunctionsOptions, ES2015Options},
options::{BabelOptions, TransformOptions}, options::{BabelOptions, TransformOptions},
react::{ReactJsxRuntime, ReactOptions, ReactRefreshOptions}, react::{JsxOptions, JsxRuntime, ReactRefreshOptions},
typescript::{RewriteExtensionsMode, TypeScriptOptions}, typescript::{RewriteExtensionsMode, TypeScriptOptions},
}; };
use crate::{context::TransformCtx, es2015::ES2015, react::React, typescript::TypeScript}; use crate::{context::TransformCtx, es2015::ES2015, react::React, typescript::TypeScript};

View file

@ -13,7 +13,7 @@ use crate::{
es2020::ES2020Options, es2020::ES2020Options,
es2021::ES2021Options, es2021::ES2021Options,
options::babel::BabelOptions, options::babel::BabelOptions,
react::ReactOptions, react::JsxOptions,
regexp::RegExpOptions, regexp::RegExpOptions,
typescript::TypeScriptOptions, typescript::TypeScriptOptions,
ReactRefreshOptions, ReactRefreshOptions,
@ -38,7 +38,7 @@ pub struct TransformOptions {
pub typescript: TypeScriptOptions, pub typescript: TypeScriptOptions,
/// [preset-react](https://babeljs.io/docs/babel-preset-react) /// [preset-react](https://babeljs.io/docs/babel-preset-react)
pub react: ReactOptions, pub react: JsxOptions,
pub regexp: RegExpOptions, pub regexp: RegExpOptions,
@ -62,10 +62,10 @@ impl TransformOptions {
cwd: PathBuf::new(), cwd: PathBuf::new(),
assumptions: CompilerAssumptions::default(), assumptions: CompilerAssumptions::default(),
typescript: TypeScriptOptions::default(), typescript: TypeScriptOptions::default(),
react: ReactOptions { react: JsxOptions {
development: true, development: true,
refresh: Some(ReactRefreshOptions::default()), refresh: Some(ReactRefreshOptions::default()),
..ReactOptions::default() ..JsxOptions::default()
}, },
regexp: RegExpOptions { regexp: RegExpOptions {
sticky_flag: true, sticky_flag: true,
@ -155,11 +155,11 @@ impl TransformOptions {
let preset_name = "react"; let preset_name = "react";
transformer_options.react = if let Some(value) = get_preset_options(preset_name, options) { transformer_options.react = if let Some(value) = get_preset_options(preset_name, options) {
match from_value::<ReactOptions>(value) { match from_value::<JsxOptions>(value) {
Ok(res) => res, Ok(res) => res,
Err(err) => { Err(err) => {
report_error(preset_name, &err, true, &mut errors); report_error(preset_name, &err, true, &mut errors);
ReactOptions::default() JsxOptions::default()
} }
} }
} else { } else {
@ -168,17 +168,17 @@ impl TransformOptions {
let mut react_options = let mut react_options =
if has_jsx_plugin { if has_jsx_plugin {
let plugin_name = "transform-react-jsx"; let plugin_name = "transform-react-jsx";
from_value::<ReactOptions>(get_plugin_options(plugin_name, options)) from_value::<JsxOptions>(get_plugin_options(plugin_name, options))
.unwrap_or_else(|err| { .unwrap_or_else(|err| {
report_error(plugin_name, &err, false, &mut errors); report_error(plugin_name, &err, false, &mut errors);
ReactOptions::default() JsxOptions::default()
}) })
} else { } else {
let plugin_name = "transform-react-jsx-development"; let plugin_name = "transform-react-jsx-development";
from_value::<ReactOptions>(get_plugin_options(plugin_name, options)) from_value::<JsxOptions>(get_plugin_options(plugin_name, options))
.unwrap_or_else(|err| { .unwrap_or_else(|err| {
report_error(plugin_name, &err, false, &mut errors); report_error(plugin_name, &err, false, &mut errors);
ReactOptions::default() JsxOptions::default()
}) })
}; };
react_options.development = has_jsx_development_plugin; react_options.development = has_jsx_development_plugin;

View file

@ -1,7 +1,7 @@
use oxc_ast::{Comment, CommentKind}; use oxc_ast::{Comment, CommentKind};
use oxc_syntax::identifier::is_irregular_whitespace; use oxc_syntax::identifier::is_irregular_whitespace;
use crate::{ReactJsxRuntime, ReactOptions, TransformCtx}; use crate::{JsxOptions, JsxRuntime, TransformCtx};
/// Scan through all comments and find the following pragmas: /// Scan through all comments and find the following pragmas:
/// ///
@ -14,13 +14,13 @@ use crate::{ReactJsxRuntime, ReactOptions, TransformCtx};
/// otherwise `JSDoc` could be used instead. /// otherwise `JSDoc` could be used instead.
/// ///
/// This behavior is aligned with Babel. /// This behavior is aligned with Babel.
pub(crate) fn update_options_with_comments(options: &mut ReactOptions, ctx: &TransformCtx) { pub(crate) fn update_options_with_comments(options: &mut JsxOptions, ctx: &TransformCtx) {
for comment in ctx.trivias.comments() { for comment in ctx.trivias.comments() {
update_options_with_comment(options, comment, ctx.source_text); update_options_with_comment(options, comment, ctx.source_text);
} }
} }
fn update_options_with_comment(options: &mut ReactOptions, comment: &Comment, source_text: &str) { fn update_options_with_comment(options: &mut JsxOptions, comment: &Comment, source_text: &str) {
let Some((keyword, remainder)) = find_jsx_pragma(comment, source_text) else { return }; let Some((keyword, remainder)) = find_jsx_pragma(comment, source_text) else { return };
match keyword { match keyword {
@ -31,8 +31,8 @@ fn update_options_with_comment(options: &mut ReactOptions, comment: &Comment, so
// @jsxRuntime // @jsxRuntime
"Runtime" => { "Runtime" => {
options.runtime = match remainder { options.runtime = match remainder {
"classic" => ReactJsxRuntime::Classic, "classic" => JsxRuntime::Classic,
"automatic" => ReactJsxRuntime::Automatic, "automatic" => JsxRuntime::Automatic,
_ => return, _ => return,
}; };
} }

View file

@ -103,7 +103,7 @@ use super::diagnostics;
pub use super::{ pub use super::{
jsx_self::ReactJsxSelf, jsx_self::ReactJsxSelf,
jsx_source::ReactJsxSource, jsx_source::ReactJsxSource,
options::{ReactJsxRuntime, ReactOptions}, options::{JsxOptions, JsxRuntime},
}; };
use crate::{ use crate::{
helpers::{bindings::BoundIdentifier, module_imports::NamedImport}, helpers::{bindings::BoundIdentifier, module_imports::NamedImport},
@ -111,7 +111,7 @@ use crate::{
}; };
pub struct ReactJsx<'a, 'ctx> { pub struct ReactJsx<'a, 'ctx> {
options: ReactOptions, options: JsxOptions,
ctx: &'ctx TransformCtx<'a>, ctx: &'ctx TransformCtx<'a>,
@ -370,9 +370,9 @@ impl<'a> Pragma<'a> {
} }
impl<'a, 'ctx> ReactJsx<'a, 'ctx> { impl<'a, 'ctx> ReactJsx<'a, 'ctx> {
pub fn new(options: ReactOptions, ctx: &'ctx TransformCtx<'a>) -> Self { pub fn new(options: JsxOptions, ctx: &'ctx TransformCtx<'a>) -> Self {
let bindings = match options.runtime { let bindings = match options.runtime {
ReactJsxRuntime::Classic => { JsxRuntime::Classic => {
if options.import_source.is_some() { if options.import_source.is_some() {
ctx.error(diagnostics::import_source_cannot_be_set()); ctx.error(diagnostics::import_source_cannot_be_set());
} }
@ -380,7 +380,7 @@ impl<'a, 'ctx> ReactJsx<'a, 'ctx> {
let pragma_frag = Pragma::parse(options.pragma_frag.as_ref(), "Fragment", ctx); let pragma_frag = Pragma::parse(options.pragma_frag.as_ref(), "Fragment", ctx);
Bindings::Classic(ClassicBindings { pragma, pragma_frag }) Bindings::Classic(ClassicBindings { pragma, pragma_frag })
} }
ReactJsxRuntime::Automatic => { JsxRuntime::Automatic => {
if options.pragma.is_some() || options.pragma_frag.is_some() { if options.pragma.is_some() || options.pragma_frag.is_some() {
ctx.error(diagnostics::pragma_and_pragma_frag_cannot_be_set()); ctx.error(diagnostics::pragma_and_pragma_frag_cannot_be_set());
} }

View file

@ -16,7 +16,7 @@ use refresh::ReactRefresh;
pub use self::{ pub use self::{
display_name::ReactDisplayName, display_name::ReactDisplayName,
jsx::ReactJsx, jsx::ReactJsx,
options::{ReactJsxRuntime, ReactOptions, ReactRefreshOptions}, options::{JsxOptions, JsxRuntime, ReactRefreshOptions},
}; };
use crate::TransformCtx; use crate::TransformCtx;
@ -43,17 +43,13 @@ pub struct React<'a, 'ctx> {
// Constructors // Constructors
impl<'a, 'ctx> React<'a, 'ctx> { impl<'a, 'ctx> React<'a, 'ctx> {
pub fn new(mut options: ReactOptions, ctx: &'ctx TransformCtx<'a>) -> Self { pub fn new(mut options: JsxOptions, ctx: &'ctx TransformCtx<'a>) -> Self {
if options.jsx_plugin || options.development { if options.jsx_plugin || options.development {
update_options_with_comments(&mut options, ctx); update_options_with_comments(&mut options, ctx);
options.conform(); options.conform();
} }
let ReactOptions { let JsxOptions {
jsx_plugin, jsx_plugin, display_name_plugin, jsx_self_plugin, jsx_source_plugin, ..
display_name_plugin,
jsx_self_plugin,
jsx_source_plugin,
..
} = options; } = options;
let refresh = options.refresh.clone(); let refresh = options.refresh.clone();
Self { Self {

View file

@ -11,14 +11,14 @@ fn default_as_true() -> bool {
/// classic does not automatic import anything. /// classic does not automatic import anything.
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Deserialize)] #[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum ReactJsxRuntime { pub enum JsxRuntime {
Classic, Classic,
/// The default runtime is switched to automatic in Babel 8. /// The default runtime is switched to automatic in Babel 8.
#[default] #[default]
Automatic, Automatic,
} }
impl ReactJsxRuntime { impl JsxRuntime {
pub fn is_classic(self) -> bool { pub fn is_classic(self) -> bool {
self == Self::Classic self == Self::Classic
} }
@ -30,7 +30,7 @@ impl ReactJsxRuntime {
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
#[serde(default, rename_all = "camelCase", deny_unknown_fields)] #[serde(default, rename_all = "camelCase", deny_unknown_fields)]
pub struct ReactOptions { pub struct JsxOptions {
#[serde(skip)] #[serde(skip)]
pub jsx_plugin: bool, pub jsx_plugin: bool,
@ -46,7 +46,7 @@ pub struct ReactOptions {
// Both Runtimes // Both Runtimes
// //
/// Decides which runtime to use. /// Decides which runtime to use.
pub runtime: ReactJsxRuntime, pub runtime: JsxRuntime,
/// This toggles behavior specific to development, such as adding __source and __self. /// This toggles behavior specific to development, such as adding __source and __self.
/// ///
@ -107,14 +107,14 @@ pub struct ReactOptions {
pub refresh: Option<ReactRefreshOptions>, pub refresh: Option<ReactRefreshOptions>,
} }
impl Default for ReactOptions { impl Default for JsxOptions {
fn default() -> Self { fn default() -> Self {
Self { Self {
jsx_plugin: true, jsx_plugin: true,
display_name_plugin: true, display_name_plugin: true,
jsx_self_plugin: false, jsx_self_plugin: false,
jsx_source_plugin: false, jsx_source_plugin: false,
runtime: ReactJsxRuntime::default(), runtime: JsxRuntime::default(),
development: false, development: false,
throw_if_namespace: default_as_true(), throw_if_namespace: default_as_true(),
pure: default_as_true(), pure: default_as_true(),
@ -128,7 +128,7 @@ impl Default for ReactOptions {
} }
} }
impl ReactOptions { impl JsxOptions {
pub fn conform(&mut self) { pub fn conform(&mut self) {
if self.development { if self.development {
self.jsx_plugin = true; self.jsx_plugin = true;

View file

@ -44,7 +44,7 @@ export interface IsolatedDeclarationsResult {
* *
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options} * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
*/ */
export interface ReactBindingOptions { export interface JsxOptions {
/** /**
* Decides which runtime to use. * Decides which runtime to use.
* *
@ -131,10 +131,10 @@ export interface ReactBindingOptions {
* *
* @default false * @default false
*/ */
refresh?: boolean | ReactRefreshBindingOptions refresh?: boolean | ReactRefreshOptions
} }
export interface ReactRefreshBindingOptions { export interface ReactRefreshOptions {
/** /**
* Specify the identifier of the refresh registration variable. * Specify the identifier of the refresh registration variable.
* *
@ -188,9 +188,9 @@ export interface TransformOptions {
*/ */
cwd?: string cwd?: string
/** Configure how TypeScript is transformed. */ /** Configure how TypeScript is transformed. */
typescript?: TypeScriptBindingOptions typescript?: TypeScriptOptions
/** Configure how TSX and JSX are transformed. */ /** Configure how TSX and JSX are transformed. */
react?: ReactBindingOptions react?: JsxOptions
/** Enable ES2015 transformations. */ /** Enable ES2015 transformations. */
es2015?: ES2015BindingOptions es2015?: ES2015BindingOptions
/** /**
@ -245,7 +245,7 @@ export interface TransformResult {
errors: Array<string> errors: Array<string>
} }
export interface TypeScriptBindingOptions { export interface TypeScriptOptions {
jsxPragma?: string jsxPragma?: string
jsxPragmaFrag?: string jsxPragmaFrag?: string
onlyRemoveTypeImports?: boolean onlyRemoveTypeImports?: boolean

View file

@ -4,10 +4,7 @@ use std::path::PathBuf;
use napi::Either; use napi::Either;
use napi_derive::napi; use napi_derive::napi;
use oxc_transformer::{ use oxc_transformer::{ArrowFunctionsOptions, ES2015Options, JsxRuntime, RewriteExtensionsMode};
ArrowFunctionsOptions, ES2015Options, ReactJsxRuntime, ReactOptions, ReactRefreshOptions,
RewriteExtensionsMode, TypeScriptOptions,
};
use crate::IsolatedDeclarationsOptions; use crate::IsolatedDeclarationsOptions;
@ -25,10 +22,10 @@ pub struct TransformOptions {
pub cwd: Option<String>, pub cwd: Option<String>,
/// Configure how TypeScript is transformed. /// Configure how TypeScript is transformed.
pub typescript: Option<TypeScriptBindingOptions>, pub typescript: Option<TypeScriptOptions>,
/// Configure how TSX and JSX are transformed. /// Configure how TSX and JSX are transformed.
pub react: Option<ReactBindingOptions>, pub react: Option<JsxOptions>,
/// Enable ES2015 transformations. /// Enable ES2015 transformations.
pub es2015: Option<ES2015BindingOptions>, pub es2015: Option<ES2015BindingOptions>,
@ -57,7 +54,7 @@ impl From<TransformOptions> for oxc_transformer::TransformOptions {
#[napi(object)] #[napi(object)]
#[derive(Default)] #[derive(Default)]
pub struct TypeScriptBindingOptions { pub struct TypeScriptOptions {
pub jsx_pragma: Option<String>, pub jsx_pragma: Option<String>,
pub jsx_pragma_frag: Option<String>, pub jsx_pragma_frag: Option<String>,
pub only_remove_type_imports: Option<bool>, pub only_remove_type_imports: Option<bool>,
@ -83,10 +80,10 @@ pub struct TypeScriptBindingOptions {
pub rewrite_import_extensions: Option<Either<bool, String>>, pub rewrite_import_extensions: Option<Either<bool, String>>,
} }
impl From<TypeScriptBindingOptions> for TypeScriptOptions { impl From<TypeScriptOptions> for oxc_transformer::TypeScriptOptions {
fn from(options: TypeScriptBindingOptions) -> Self { fn from(options: TypeScriptOptions) -> Self {
let ops = TypeScriptOptions::default(); let ops = oxc_transformer::TypeScriptOptions::default();
TypeScriptOptions { oxc_transformer::TypeScriptOptions {
jsx_pragma: options.jsx_pragma.map(Into::into).unwrap_or(ops.jsx_pragma), jsx_pragma: options.jsx_pragma.map(Into::into).unwrap_or(ops.jsx_pragma),
jsx_pragma_frag: options.jsx_pragma_frag.map(Into::into).unwrap_or(ops.jsx_pragma_frag), jsx_pragma_frag: options.jsx_pragma_frag.map(Into::into).unwrap_or(ops.jsx_pragma_frag),
only_remove_type_imports: options only_remove_type_imports: options
@ -119,7 +116,7 @@ impl From<TypeScriptBindingOptions> for TypeScriptOptions {
/// ///
/// @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options} /// @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
#[napi(object)] #[napi(object)]
pub struct ReactBindingOptions { pub struct JsxOptions {
/// Decides which runtime to use. /// Decides which runtime to use.
/// ///
/// - 'automatic' - auto-import the correct JSX factories /// - 'automatic' - auto-import the correct JSX factories
@ -196,16 +193,16 @@ pub struct ReactBindingOptions {
/// Conforms to the implementation in {@link https://github.com/facebook/react/tree/main/packages/react-refresh} /// Conforms to the implementation in {@link https://github.com/facebook/react/tree/main/packages/react-refresh}
/// ///
/// @default false /// @default false
pub refresh: Option<Either<bool, ReactRefreshBindingOptions>>, pub refresh: Option<Either<bool, ReactRefreshOptions>>,
} }
impl From<ReactBindingOptions> for ReactOptions { impl From<JsxOptions> for oxc_transformer::JsxOptions {
fn from(options: ReactBindingOptions) -> Self { fn from(options: JsxOptions) -> Self {
let ops = ReactOptions::default(); let ops = oxc_transformer::JsxOptions::default();
ReactOptions { oxc_transformer::JsxOptions {
runtime: match options.runtime.as_deref() { runtime: match options.runtime.as_deref() {
Some("classic") => ReactJsxRuntime::Classic, Some("classic") => JsxRuntime::Classic,
/* "automatic" */ _ => ReactJsxRuntime::Automatic, /* "automatic" */ _ => JsxRuntime::Automatic,
}, },
development: options.development.unwrap_or(ops.development), development: options.development.unwrap_or(ops.development),
throw_if_namespace: options.throw_if_namespace.unwrap_or(ops.throw_if_namespace), throw_if_namespace: options.throw_if_namespace.unwrap_or(ops.throw_if_namespace),
@ -216,8 +213,8 @@ impl From<ReactBindingOptions> for ReactOptions {
use_built_ins: options.use_built_ins, use_built_ins: options.use_built_ins,
use_spread: options.use_spread, use_spread: options.use_spread,
refresh: options.refresh.and_then(|value| match value { refresh: options.refresh.and_then(|value| match value {
Either::A(b) => b.then(ReactRefreshOptions::default), Either::A(b) => b.then(oxc_transformer::ReactRefreshOptions::default),
Either::B(options) => Some(ReactRefreshOptions::from(options)), Either::B(options) => Some(oxc_transformer::ReactRefreshOptions::from(options)),
}), }),
..Default::default() ..Default::default()
} }
@ -225,7 +222,7 @@ impl From<ReactBindingOptions> for ReactOptions {
} }
#[napi(object)] #[napi(object)]
pub struct ReactRefreshBindingOptions { pub struct ReactRefreshOptions {
/// Specify the identifier of the refresh registration variable. /// Specify the identifier of the refresh registration variable.
/// ///
/// @default `$RefreshReg$`. /// @default `$RefreshReg$`.
@ -239,10 +236,10 @@ pub struct ReactRefreshBindingOptions {
pub emit_full_signatures: Option<bool>, pub emit_full_signatures: Option<bool>,
} }
impl From<ReactRefreshBindingOptions> for ReactRefreshOptions { impl From<ReactRefreshOptions> for oxc_transformer::ReactRefreshOptions {
fn from(options: ReactRefreshBindingOptions) -> Self { fn from(options: ReactRefreshOptions) -> Self {
let ops = ReactRefreshOptions::default(); let ops = oxc_transformer::ReactRefreshOptions::default();
ReactRefreshOptions { oxc_transformer::ReactRefreshOptions {
refresh_reg: options.refresh_reg.unwrap_or(ops.refresh_reg), refresh_reg: options.refresh_reg.unwrap_or(ops.refresh_reg),
refresh_sig: options.refresh_sig.unwrap_or(ops.refresh_sig), refresh_sig: options.refresh_sig.unwrap_or(ops.refresh_sig),
emit_full_signatures: options.emit_full_signatures.unwrap_or(ops.emit_full_signatures), emit_full_signatures: options.emit_full_signatures.unwrap_or(ops.emit_full_signatures),

View file

@ -2,9 +2,7 @@ use std::path::{Path, PathBuf};
use oxc::{ use oxc::{
span::SourceType, span::SourceType,
transformer::{ transformer::{ES2015Options, JsxOptions, JsxRuntime, TransformOptions, TypeScriptOptions},
ES2015Options, ReactJsxRuntime, ReactOptions, TransformOptions, TypeScriptOptions,
},
}; };
use crate::{ use crate::{
@ -20,7 +18,7 @@ fn get_default_transformer_options() -> TransformOptions {
TransformOptions { TransformOptions {
typescript: TypeScriptOptions::default(), typescript: TypeScriptOptions::default(),
es2015: ES2015Options { arrow_function: None }, es2015: ES2015Options { arrow_function: None },
react: ReactOptions { react: JsxOptions {
jsx_plugin: true, jsx_plugin: true,
jsx_self_plugin: true, jsx_self_plugin: true,
jsx_source_plugin: true, jsx_source_plugin: true,
@ -152,7 +150,7 @@ impl Case for SemanticTypeScriptCase {
// handle @jsx: react, `react` of behavior is match babel following options // handle @jsx: react, `react` of behavior is match babel following options
if self.base.settings.jsx.last().is_some_and(|jsx| jsx == "react") { if self.base.settings.jsx.last().is_some_and(|jsx| jsx == "react") {
source_type = source_type.with_module(true); source_type = source_type.with_module(true);
options.react.runtime = ReactJsxRuntime::Classic; options.react.runtime = JsxRuntime::Classic;
} }
get_result(self.base.code(), source_type, self.path(), Some(options)) get_result(self.base.code(), source_type, self.path(), Some(options))
} }

View file

@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use oxc::{ use oxc::{
span::SourceType, span::SourceType,
transformer::{ transformer::{
ArrowFunctionsOptions, ES2015Options, ReactJsxRuntime, ReactOptions, TransformOptions, ArrowFunctionsOptions, ES2015Options, JsxOptions, JsxRuntime, TransformOptions,
TypeScriptOptions, TypeScriptOptions,
}, },
}; };
@ -50,7 +50,7 @@ fn get_default_transformer_options() -> TransformOptions {
TransformOptions { TransformOptions {
typescript: TypeScriptOptions::default(), typescript: TypeScriptOptions::default(),
es2015: ES2015Options { arrow_function: Some(ArrowFunctionsOptions::default()) }, es2015: ES2015Options { arrow_function: Some(ArrowFunctionsOptions::default()) },
react: ReactOptions { react: JsxOptions {
jsx_plugin: true, jsx_plugin: true,
jsx_self_plugin: true, jsx_self_plugin: true,
jsx_source_plugin: true, jsx_source_plugin: true,
@ -158,7 +158,7 @@ impl Case for TransformerTypeScriptCase {
// handle @jsx: react, `react` of behavior is match babel following options // handle @jsx: react, `react` of behavior is match babel following options
if self.base.settings.jsx.last().is_some_and(|jsx| jsx == "react") { if self.base.settings.jsx.last().is_some_and(|jsx| jsx == "react") {
source_type = source_type.with_module(true); source_type = source_type.with_module(true);
options.react.runtime = ReactJsxRuntime::Classic; options.react.runtime = JsxRuntime::Classic;
} }
get_result(self.base.code(), source_type, self.path(), Some(options)) get_result(self.base.code(), source_type, self.path(), Some(options))
} }