feat(@angular/build): migrate advanced optimization Babel plugins to oxc-parser + magic-string#33568
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a fast, single-pass AST-based transformation (oxc-transform.ts) using oxc-parser and magic-string to replace Babel for advanced optimizations, including TypeScript enum wrapping, static class member elision/wrapping, Angular metadata elision, and top-level pure function annotations. It integrates this new transformer into the JavaScript transformer worker and adds comprehensive test suites. The review feedback highlights opportunities to improve robustness and performance, such as using strict regex checks for numeric suffixes, adding defensive checks for array expression elements, supporting empty static blocks, removing unused variables and imports, and extracting metadata function names into a static Set to avoid repeated array allocations.
8cca34c to
fa2a348
Compare
fa2a348 to
815bf0d
Compare
815bf0d to
ba3036e
Compare
1ede652 to
61f32fe
Compare
…oxc-parser + magic-string This change ports the remaining Babel plugins used for Angular build optimizations to a single unified, ultra-fast `oxc-transform` pass using `oxc-parser` and `magic-string`. Optimization passes migrated: - TypeScript Enum wrapping - Class static members elision and wrapping - Angular metadata elision (setClassMetadata, etc.) - Top-level pure function call and constructor annotation For regular optimized builds, this bypasses Babel entirely. For builds with code coverage or linking, it runs Babel first and then processes the output through the new fast path.
61f32fe to
8fafc16
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
This change ports the remaining Babel plugins used for Angular build optimizations to a single unified, ultra-fast
oxc-transformpass usingoxc-parserandmagic-string.Optimization passes migrated:
For regular optimized builds, this bypasses Babel entirely. For builds with code coverage or linking, it runs Babel first and then processes the output through the new fast path.