feat(@angular/build): migrate Angular Linker to oxc-parser and magic-string - #33625
Conversation
89f575b to
a1a721b
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces a high-performance Angular partial declaration linker using oxc-parser and magic-string to replace the Babel-based linker. The review feedback highlights critical compatibility issues with the OXC AST structure. Specifically, oxc-parser does not export a Visitor class, requiring a custom recursive AST walker instead. Additionally, OXC AST node types differ from standard ESTree nodes: generic Literal nodes are represented as specific StringLiteral, NumericLiteral, BooleanLiteral, and NullLiteral nodes; identifiers are split into IdentifierReference and IdentifierName; and object properties are represented as ObjectProperty instead of Property.
JoostK
left a comment
There was a problem hiding this comment.
I've been wanting to experiment with this, so I'm excited to see this 🥳
9118d3c to
b7fb852
Compare
7517eb6 to
822b849
Compare
JoostK
left a comment
There was a problem hiding this comment.
I don't see anything obviously broken anymore, but the AST builder/parenthesis wrapping is subtle. Keeping the Babel plugin behind an envvar could perhaps be a risk mitigation measure (G3 doesn't have partially compiled code, this is 3P only and thus not as widely covered in a test corpus)
f571f28 to
c9ab630
Compare
…string This refactors the Angular linker processing in the ESBuild pipeline to use `oxc-parser` and `magic-string` instead of `@babel/core`. By using the lightweight AST and precise token spans provided by OXC, the linker is able to process partial declarations via targeted `magic-string` overwrites in-place. This removes the dependency on `@babel/core` and the linker Babel plugin, yielding faster build startup times and improved compilation performance.
c9ab630 to
49dd007
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
This refactors the Angular linker processing in the ESBuild pipeline to use
oxc-parserandmagic-stringinstead of@babel/core.By using the lightweight AST and precise token spans provided by OXC, the linker is able to process partial declarations via targeted
magic-stringoverwrites in-place. This removes the dependency on@babel/coreand the linker Babel plugin, yielding faster build startup times and improved compilation performance.