feat(transformer/react-jsx): support @jsx annotation (#1182)

This commit is contained in:
Dunqing 2023-11-07 20:30:26 +08:00 committed by GitHub
parent 008b0e650c
commit 633c469d2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -86,6 +86,12 @@ impl ReactJsxOptions {
if let Some(import_source) = comment.strip_prefix("jsxImportSource").map(str::trim) {
self.import_source = Cow::from(import_source.to_string());
}
// Put this condition at the end to avoid breaking @jsxXX
// read jsx
if let Some(pragma) = comment.strip_prefix("jsx").map(str::trim) {
self.pragma = Cow::from(pragma.to_string());
}
}
self
}

View file

@ -1,4 +1,4 @@
Passed: 263/1113
Passed: 269/1113
# All Passed:
* babel-plugin-transform-numeric-separator
@ -825,7 +825,7 @@ Passed: 263/1113
* regression/11061/input.mjs
* variable-declaration/non-null-in-optional-chain/input.ts
# babel-plugin-transform-react-jsx (101/170)
# babel-plugin-transform-react-jsx (107/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
@ -834,15 +834,12 @@ Passed: 263/1113
* autoImport/complicated-scope-script/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
* pure/false-pragma-option-automatic-runtime/input.js
* pure/true-default-pragma-automatic-runtime/input.js
* pure/true-pragma-comment-automatic-runtime/input.js
* pure/true-pragma-comment-classic-runtime/input.js
* pure/true-pragma-option-automatic-runtime/input.js
* pure/unset-default-pragma-automatic-runtime/input.js
* pure/unset-pragma-comment-automatic-runtime/input.js
* pure/unset-pragma-comment-classic-runtime/input.js
* pure/unset-pragma-option-automatic-runtime/input.js
* react/adds-appropriate-newlines-when-using-spread-attribute-babel-7/input.js
* react/arrow-functions/input.js
@ -850,13 +847,9 @@ Passed: 263/1113
* react/avoids-spread-babel-7/input.js
* react/does-not-add-source-self-babel-7/input.mjs
* react/handle-spread-with-proto-babel-7/input.js
* react/honor-custom-jsx-comment/input.js
* react/honor-custom-jsx-comment-if-jsx-pragma-option-set/input.js
* react/optimisation.react.constant-elements/input.js
* react/pragma-works-with-no-space-at-the-end/input.js
* react/should-add-quotes-es3/input.js
* react/should-allow-jsx-docs-comment-with-pragma/input.js
* react/should-allow-no-pragmafrag-if-frag-unused/input.js
* react/should-allow-pragmafrag-and-frag/input.js
* react/should-disallow-spread-children/input.js
* react/should-disallow-valueless-key/input.js
@ -864,6 +857,7 @@ Passed: 263/1113
* 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
@ -884,7 +878,6 @@ Passed: 263/1113
* react-automatic/should-warn-when-pragma-or-pragmaFrag-is-set/input.js
* regression/issue-12478-automatic/input.js
* regression/issue-12478-classic/input.js
* regression/pragma-frag-set-default-classic-runtime/input.js
* removed-options/invalid-use-builtins-false/input.js
* removed-options/invalid-use-builtins-true/input.js
* removed-options/invalid-use-spread-false/input.js
@ -892,6 +885,7 @@ Passed: 263/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