fix(@angular/build): support parenthesized expressions in oxc linker - #34136
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for parenthesized expressions in the OXC AST host by implementing an unwrapParentheses helper function and applying it across various AST querying and parsing methods. This ensures that parenthesized nodes, such as parenthesized literals, objects, or functions, are correctly unwrapped and processed by the linker. Corresponding unit and integration tests have been added to verify this behavior. Feedback is provided regarding the isMinifiedBooleanLiteral helper function, where the type guard signature is no longer strictly accurate at runtime due to the potential presence of a ParenthesizedExpression wrapping the argument; simplifying this signature to node is UnaryExpression is recommended to maintain type safety.
820602f to
29bcef1
Compare
Unwrap parenthesized expressions in `OxcAstHost` to ensure parity with Babel
and prevent fatal linker errors when parsing functions returning parenthesized
expressions (such as `resolveMetadata: () => ({ ... })` in deferred component
metadata) and other parenthesized declaration properties.
Fixes angular#34129
29bcef1 to
4f44e9a
Compare
Unwrap parenthesized expressions in
OxcAstHostto ensure parity with Babel and prevent fatal linker errors when parsing functions returning parenthesized expressions (such asresolveMetadata: () => ({ ... })in deferred component metadata) and other parenthesized declaration properties.Fixes #34129