mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(transformer/react-jsx): support @jsxFrag annotation (#1189)
This commit is contained in:
parent
26fd0069d8
commit
28c0b85646
2 changed files with 17 additions and 7 deletions
|
|
@ -77,14 +77,27 @@ impl ReactJsxOptions {
|
|||
|
||||
// read jsxRuntime
|
||||
match comment.strip_prefix("jsxRuntime").map(str::trim) {
|
||||
Some("classic") => self.runtime = ReactJsxRuntime::Classic,
|
||||
Some("automatic") => self.runtime = ReactJsxRuntime::Automatic,
|
||||
Some("classic") => {
|
||||
self.runtime = ReactJsxRuntime::Classic;
|
||||
continue;
|
||||
}
|
||||
Some("automatic") => {
|
||||
self.runtime = ReactJsxRuntime::Automatic;
|
||||
continue;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// read jsxImportSource
|
||||
if let Some(import_source) = comment.strip_prefix("jsxImportSource").map(str::trim) {
|
||||
self.import_source = Cow::from(import_source.to_string());
|
||||
continue;
|
||||
}
|
||||
|
||||
// read jsxFrag
|
||||
if let Some(pragma_frag) = comment.strip_prefix("jsxFrag").map(str::trim) {
|
||||
self.pragma_frag = Cow::from(pragma_frag.to_string());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Put this condition at the end to avoid breaking @jsxXX
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Passed: 269/1113
|
||||
Passed: 272/1113
|
||||
|
||||
# All Passed:
|
||||
* babel-plugin-transform-numeric-separator
|
||||
|
|
@ -825,7 +825,7 @@ Passed: 269/1113
|
|||
* regression/11061/input.mjs
|
||||
* variable-declaration/non-null-in-optional-chain/input.ts
|
||||
|
||||
# babel-plugin-transform-react-jsx (107/170)
|
||||
# babel-plugin-transform-react-jsx (110/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
|
||||
|
|
@ -850,14 +850,12 @@ Passed: 269/1113
|
|||
* react/optimisation.react.constant-elements/input.js
|
||||
* react/should-add-quotes-es3/input.js
|
||||
* react/should-allow-jsx-docs-comment-with-pragma/input.js
|
||||
* react/should-allow-pragmafrag-and-frag/input.js
|
||||
* react/should-disallow-spread-children/input.js
|
||||
* react/should-disallow-valueless-key/input.js
|
||||
* react/should-disallow-xml-namespacing/input.js
|
||||
* react/should-throw-error-namespaces-if-not-flag/input.js
|
||||
* react/should-warn-when-importSource-is-set/input.js
|
||||
* react/should-warn-when-importSource-pragma-is-set/input.js
|
||||
* react/weird-symbols/input.js
|
||||
* react/wraps-props-in-react-spread-for-first-spread-attributes-babel-7/input.js
|
||||
* react/wraps-props-in-react-spread-for-last-spread-attributes-babel-7/input.js
|
||||
* react/wraps-props-in-react-spread-for-middle-spread-attributes-babel-7/input.js
|
||||
|
|
@ -885,7 +883,6 @@ Passed: 269/1113
|
|||
* runtime/defaults-to-automatic/input.js
|
||||
* runtime/defaults-to-classis-babel-7/input.js
|
||||
* runtime/invalid-runtime/input.js
|
||||
* runtime/pragma-runtime-classsic/input.js
|
||||
* runtime/runtime-automatic/input.js
|
||||
* spread-transform/transform-to-babel-extend/input.js
|
||||
* spread-transform/transform-to-object-assign/input.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue