Skip to content

Commit b8a76a2

Browse files
eve0415claude
andauthored
feat: sourcemap generation support (#18)
## Summary - Propagate original source spans through HIR to codegen AST nodes, enabling accurate source position tracking through the compilation pipeline - Generate sourcemaps via OXC codegen with post-processing line adjustment to handle wrapper code (imports, function signatures) that shifts compiled output - Add `source_map` option to `PluginOptions`, NAPI bindings, and Vite plugin - Position-aware sourcemap adjustment with virtual source routing for compiler-generated code (e.g. `useMemoCache` import, cache declarations) - Support `debugId` (UUID v4) and `x_google_ignoreList` in sourcemap output - Remove 6 Category C cosmetic post-processing transforms that interfered with sourcemap accuracy - Strip comments inside compiled function bodies from codegen output ## Test plan - [x] Unit tests for `adjust_sourcemap_positional` and `collect_line_edits` - [x] End-to-end sourcemap verification with full token dump - [x] Identity mapping, HOC, monotonicity, and manual token verification tests - [x] 15 comprehensive sourcemap verification tests - [x] Round-trip sourcemap tests for custom and shadcn fixtures - [x] Sourcemap invariant tests for threshold, identity mapping, columns, monotonicity - [x] `cargo test --package oxc_react_compiler` passes - [x] `cargo clippy` clean - [x] `cargo fmt` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 25eeca3 commit b8a76a2

14 files changed

Lines changed: 2504 additions & 403 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
steps:
3333
- name: Checkout
3434
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
submodules: recursive
3537

3638
- name: Setup Rust toolchain
3739
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
@@ -49,6 +51,8 @@ jobs:
4951
steps:
5052
- name: Checkout
5153
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
54+
with:
55+
submodules: recursive
5256

5357
- name: Setup Rust toolchain
5458
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
@@ -148,6 +152,8 @@ jobs:
148152
steps:
149153
- name: Checkout
150154
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
155+
with:
156+
submodules: recursive
151157

152158
- name: Setup Rust toolchain
153159
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4

0 commit comments

Comments
 (0)