| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…lasses in minified files In 22.1.0, the Babel-based advancedOptimizations pass was replaced with oxc-parser + magic-string. When wrapping a class declaration in a pure IIFE, appendLeft was used for the opener and appendRight for the closer. In minified bundles where sibling top-level class declarations are adjacent without whitespace (classA.end === classB.start), magic-string emits appendLeft content before appendRight content at a shared index. This caused class B's IIFE opener to be emitted ahead of class A's IIFE closer, interleaving the wrappers and resulting in duplicate symbol declarations in subsequent build phases. This change swaps the insertion methods to use appendRight for the opening fragment and appendLeft for the closing fragment (and when splitting default exports), ensuring correct ordering at shared boundaries. closes angular#33699
There was a problem hiding this comment.
This pull request modifies the oxc-transform Babel plugin to prevent interleaving issues when wrapping adjacent class declarations. It swaps the usage of s.appendLeft and s.appendRight on the MagicString instance when wrapping classes in IIFEs or splitting default exports, ensuring correct output ordering. Additionally, comprehensive unit tests have been added to verify that adjacent class declarations, exported classes, and default exports are wrapped correctly without interleaving. I have no feedback to provide on these changes.
Sorry, something went wrong.
|
This PR was merged into the repository. The changes were merged into the following branches: |
Sorry, something went wrong.
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
In 22.1.0, the Babel-based advancedOptimizations pass was replaced with oxc-parser + magic-string. When wrapping a class declaration in a pure IIFE, appendLeft was used for the opener and appendRight for the closer.
In minified bundles where sibling top-level class declarations are adjacent without whitespace (classA.end === classB.start), magic-string emits appendLeft content before appendRight content at a shared index. This caused class B's IIFE opener to be emitted ahead of class A's IIFE closer, interleaving the wrappers and resulting in duplicate symbol declarations in subsequent build phases.
This change swaps the insertion methods to use appendRight for the opening fragment and appendLeft for the closing fragment (and when splitting default exports), ensuring correct ordering at shared boundaries.
closes #33699