Skip to content

feat(transformer/jsx): add jsxDEV source metadata for fragments#21932

Merged
Dunqing merged 2 commits intooxc-project:mainfrom
idoros:fix/jsx-fragment-source-location
Apr 30, 2026
Merged

feat(transformer/jsx): add jsxDEV source metadata for fragments#21932
Dunqing merged 2 commits intooxc-project:mainfrom
idoros:fix/jsx-fragment-source-location

Conversation

@idoros
Copy link
Copy Markdown
Contributor

@idoros idoros commented Apr 29, 2026

Before this change, fragment transforms omitted source location metadata:

_jsxDEV(_Fragment, { children: "test" }, void 0, false);

After this change, fragments receive the same trailing development metadata as other JSX jsxDEV calls:

_jsxDEV(_Fragment, { children: "test" }, void 0, false, {
  fileName: _jsxFileName,
  lineNumber: 2,
  columnNumber: 10
}, this);

Motivation

This came from #21042.

TypeScript's react: reactJSXDev transform also emits fragment source locations and this for same case:
https://www.typescriptlang.org/play/?jsx=5#code/DwPgUABBwCYJYDcTAPTyZa7lseV4QA

Changes

  • allow fragment jsxDEV calls to receive source metadata in the JSX transformer
  • update the local transform conformance fixture for fragment-static-children

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 29, 2026

Merging this PR will not alter performance

✅ 44 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing idoros:fix/jsx-fragment-source-location (9f10768) with main (fea301a)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing force-pushed the fix/jsx-fragment-source-location branch from 22e9655 to abfffc8 Compare April 30, 2026 05:32
@Dunqing Dunqing changed the title fix(transformer): add jsxDEV source metadata for fragments fix(transformer/jsx): add jsxDEV source metadata for fragments Apr 30, 2026
@Dunqing Dunqing changed the title fix(transformer/jsx): add jsxDEV source metadata for fragments feat(transformer/jsx): add jsxDEV source metadata for fragments Apr 30, 2026
Copy link
Copy Markdown
Member

@Dunqing Dunqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Dunqing Dunqing force-pushed the fix/jsx-fragment-source-location branch from abfffc8 to 9f10768 Compare April 30, 2026 06:32
@Dunqing Dunqing merged commit 9593ec8 into oxc-project:main Apr 30, 2026
34 checks passed
@idoros idoros deleted the fix/jsx-fragment-source-location branch April 30, 2026 07:05
camc314 added a commit that referenced this pull request May 5, 2026
### 💥 BREAKING CHANGES

- 0ffbe0d allocator: [**BREAKING**] Remove `Allocator::end_ptr` method
(#21871) (overlookmotel)

### 🚀 Features

- 9593ec8 transformer/jsx: Add jsxDEV source metadata for fragments
(#21932) (Ido Rosenthal)

### 🐛 Bug Fixes

- 429deac napi/parser: Export `visitorKeys` from `wasm` entrypoint
(#21996) (NullVoxPopuli)
- e852911 codegen: Preserve legal comments orphaned by upstream passes
(#21575) (Dunqing)
- e3399ec transformer/class-properties: Preserve RHS in
logical-assignment to static private field (#21950) (Dunqing)
- c59c199 transformer/typescript: Emit class fields for parameter
properties (#21831) (Dunqing)
- aaabde4 parser: Attach legal comments to following token (#21670)
(Dunqing)

### ⚡ Performance

- 0bf0cb9 allocator: Per-platform `Arena::new_fixed_size`
implementations (#22088) (overlookmotel)

### 📚 Documentation

- 62ec410 allocator: Correct doc comment for `Allocator::from_raw_parts`
(#22093) (overlookmotel)
- 3e152c6 allocator: Correct typos in comments (#22092) (overlookmotel)
- e220855 allocator: Correct doc comment for `Allocator::set_cursor_ptr`
(#21866) (overlookmotel)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants