mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(transformer/react-jsx): support @jsxImportSource annotation (#1179)
This commit is contained in:
parent
f0e452a599
commit
bf23d87848
2 changed files with 8 additions and 4 deletions
|
|
@ -56,12 +56,18 @@ impl ReactJsxOptions {
|
|||
let comment = comment.strip_prefix('*').unwrap_or(comment).trim_start();
|
||||
// strip leading `@`
|
||||
let Some(comment) = comment.strip_prefix('@') else { continue };
|
||||
|
||||
// read jsxRuntime
|
||||
match comment.strip_prefix("jsxRuntime").map(str::trim) {
|
||||
Some("classic") => self.runtime = ReactJsxRuntime::Classic,
|
||||
Some("automatic") => self.runtime = ReactJsxRuntime::Automatic,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// read jsxImportSource
|
||||
if let Some(import_source) = comment.strip_prefix("jsxImportSource").map(str::trim) {
|
||||
self.import_source = Cow::from(import_source.to_string());
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Passed: 256/1113
|
||||
Passed: 258/1113
|
||||
|
||||
# All Passed:
|
||||
* babel-plugin-transform-numeric-separator
|
||||
|
|
@ -825,14 +825,13 @@ Passed: 256/1113
|
|||
* regression/11061/input.mjs
|
||||
* variable-declaration/non-null-in-optional-chain/input.ts
|
||||
|
||||
# babel-plugin-transform-react-jsx (94/170)
|
||||
# babel-plugin-transform-react-jsx (96/170)
|
||||
* autoImport/after-polyfills-compiled-to-cjs/input.mjs
|
||||
* autoImport/after-polyfills-script-not-supported/input.js
|
||||
* autoImport/auto-import-react-source-type-module/input.js
|
||||
* autoImport/auto-import-react-source-type-script/input.js
|
||||
* autoImport/complicated-scope-module/input.js
|
||||
* autoImport/complicated-scope-script/input.js
|
||||
* autoImport/import-source-pragma/input.js
|
||||
* pure/false-default-pragma-automatic-runtime/input.js
|
||||
* pure/false-pragma-comment-automatic-runtime/input.js
|
||||
* pure/false-pragma-comment-classic-runtime/input.js
|
||||
|
|
@ -877,7 +876,6 @@ Passed: 256/1113
|
|||
* react-automatic/does-not-add-source-self-automatic/input.mjs
|
||||
* react-automatic/handle-nonstatic-children/input.js
|
||||
* react-automatic/optimisation.react.constant-elements/input.js
|
||||
* react-automatic/pragma-works-with-no-space-at-the-end/input.js
|
||||
* react-automatic/should-add-quotes-es3/input.js
|
||||
* react-automatic/should-allow-nested-fragments/input.js
|
||||
* react-automatic/should-avoid-wrapping-in-extra-parens-if-not-needed/input.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue