refactor(es/typescript): Precompute namespace import-equals usage in semantic pass#11534
refactor(es/typescript): Precompute namespace import-equals usage in semantic pass#11534
Conversation
|
Binary Sizes
Commit: 846b437 |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Pull request overview
Refactors the TypeScript namespace import = alias usage resolution so it is precomputed during semantic analysis and then consumed by the transform pass to strip unused aliases inside namespace/module blocks.
Changes:
- Compute per-namespace-block
import =usage (including import-chain propagation) during semantic analysis. - Remove the transform-time namespace usage collector and switch stripping logic to consult
SemanticInfo. - Add unit tests covering namespace-block import-chain propagation/merge behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/swc_ecma_transforms_typescript/src/transform.rs | Removes the AST-visitor-based namespace import-equals usage collector and uses semantic lookup to retain/strip TsImportEqualsDecl in namespace/module blocks. |
| crates/swc_ecma_transforms_typescript/src/semantic.rs | Adds tracking for namespace-block import = usage keyed by declaration Span, implements per-block import-chain propagation with parent/child merging, and introduces unit tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Review: refactor(es/typescript): Precompute namespace import-equals usage in semantic passGood refactoring overall — moving the namespace import-equals usage resolution from a per-block transform-time visitor into the single semantic analysis pass is a clean structural improvement. It eliminates the separate Below are observations and a few items worth considering: 1. Behavioral difference:
|
Summary
Testing