fix: jsx.preserve should also considering tsconfig json preserve#8324
Conversation
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
b64e6c6 to
fba0584
Compare
45ce42e to
50fe22f
Compare
fba0584 to
0a8e0d9
Compare
50fe22f to
efd34f0
Compare
0a8e0d9 to
75c3e8f
Compare
75c3e8f to
53e21e5
Compare
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
18e9fb3 to
4fa5faf
Compare
jsx.preserve should also considering tsconfig json preserve
4fa5faf to
ba580de
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes JSX preservation to respect per-module tsconfig.json settings rather than only using the global bundler configuration. Previously, modules with local tsconfig.json specifying "jsx": "preserve" would not have JSX preserved because the system only checked the static bundler config. Now, the JSX preserve flag is determined during module transformation by checking the resolved transform_options.jsx.jsx_plugin after tsconfig discovery.
Changes:
- Determine JSX preservation per-module based on resolved tsconfig during transformation
- Rename
SymbolRefDb.is_jsx_preservetohas_module_preserve_jsxto reflect it's a fast-path optimization flag - Remove initialization of
FlatOptions::JsxPreservefrom global options; now set per-module in module view factory - Add integration test parser support for JSX syntax in output validation
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/rolldown/src/utils/pre_process_ecma_ast.rs |
Check resolved transform_options.jsx.jsx_plugin to determine preserve_jsx per-module |
crates/rolldown/src/utils/parse_to_ecma_ast.rs |
Add preserve_jsx field to ParseToEcmaAstResult struct with documentation |
crates/rolldown/src/ecmascript/ecma_module_view_factory.rs |
Set FlatOptions::JsxPreserve per-module in context based on resolved config |
crates/rolldown_common/src/module_loader/task_result.rs |
Add preserve_jsx field to EcmaRelated struct |
crates/rolldown_common/src/types/symbol_ref_db.rs |
Rename field and add getter/setter for has_module_preserve_jsx optimization flag |
crates/rolldown_common/src/types/flat_options.rs |
Remove global initialization of JsxPreserve, add documentation explaining per-module determination |
crates/rolldown/src/utils/renamer.rs |
Update to use renamed has_module_preserve_jsx() method |
crates/rolldown/src/module_loader/module_loader.rs |
Remove parameter from SymbolRefDb::new(), track preserve_jsx from modules |
crates/rolldown/src/stages/link_stage/reference_needed_symbols.rs |
Preserve has_module_preserve_jsx flag across parallel processing |
crates/rolldown_testing/src/integration_test.rs |
Enable JSX parsing in output validation to handle preserved JSX |
crates/rolldown/tests/rolldown/issues/8377/* |
New test case for JSX preservation via local tsconfig.json |
crates/rolldown/tests/rolldown/issues/8216/* |
Updated test case now expects success instead of error |
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap |
Snapshot updates for new test cases |
Benchmarks Rust |
Merge activity
|
…8324) Previously, `FlatOptions::JsxPreserve` was determined once from the static bundler configuration (`transform_options.is_jsx_preserve()`). This didn't account for per-module tsconfig discovery — when a module's local `tsconfig.json` specifies `"jsx": "preserve"`, the static flag wouldn't reflect it. This PR determines `preserve_jsx` per-module during transformation by checking the resolved `transform_options.jsx.jsx_plugin` after tsconfig discovery, then updates `FlatOptions::JsxPreserve` on the module's context accordingly. closed #8377
ba580de to
62fe92f
Compare

Previously,
FlatOptions::JsxPreservewas determined once from the static bundler configuration (transform_options.is_jsx_preserve()). This didn't account for per-module tsconfig discovery — when a module's localtsconfig.jsonspecifies"jsx": "preserve", the static flag wouldn't reflect it.This PR determines
preserve_jsxper-module during transformation by checking the resolvedtransform_options.jsx.jsx_pluginafter tsconfig discovery, then updatesFlatOptions::JsxPreserveon the module's context accordingly.closed #8377