refactor(estree/tokens): break up into multiple files#19865
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the oxc_estree_tokens crate by splitting the former monolithic serialize.rs into smaller, purpose-focused modules (JSON serialization, in-place raw transfer update, shared visitor/context utilities) while keeping the token-walking and emission logic equivalent.
Changes:
- Split token serialization / update logic into
json.rs,raw_transfer.rs,context.rs, andvisitor.rs. - Reworked
lib.rsto expose the same public entry points via re-exports. - Added/updated module-level documentation headers across the new/updated files.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_estree_tokens/src/visitor.rs | New AST visitor module extracted from former serialize.rs. |
| crates/oxc_estree_tokens/src/context.rs | New shared Context trait module used by both JSON and raw-transfer modes. |
| crates/oxc_estree_tokens/src/json.rs | New JSON serialization implementation extracted from former serialize.rs. |
| crates/oxc_estree_tokens/src/raw_transfer.rs | New in-place token kind update implementation extracted from former serialize.rs. |
| crates/oxc_estree_tokens/src/lib.rs | Updates module structure and re-exports public API entry points. |
| crates/oxc_estree_tokens/src/options.rs | Adjusts imports and adds module docs. |
| crates/oxc_estree_tokens/src/jsx_state.rs | Adds module docs. |
| crates/oxc_estree_tokens/src/token_type.rs | Adds module docs. |
| crates/oxc_estree_tokens/src/u32_string.rs | Adds module docs. |
| crates/oxc_estree_tokens/src/serialize.rs | Removed (functionality redistributed into new modules). |
Merging this PR will not alter performance
Comparing Footnotes
|

Pure refactor.
serialize.rshad got too big. Split it up into different files. Does not alter any of the code, just moves it into separate files.