Repository navigation
Conversation
…data elision Add specs verifying that oxc-transform elides ɵsetClassMetadata, ɵsetClassMetadataAsync, and ngDevMode-guarded internal setClassMetadata calls inside ES2022 class static blocks while allowing pure static class wrapping.
… oxc-transform Recognize Angular class metadata statements inside ES2022 class static blocks (as emitted by ngp and ngtsc, including ngDevMode/ngJitMode-guarded internal setClassMetadata calls in @angular/core FESM bundles) so oxc-transform removes the metadata static block and continues wrapping pure static Angular classes.
mattrbeck
added a commit
to mattrbeck/angular
that referenced
this pull request
Nov 20, 2026
Temporarily patch @angular/build oxc-transform (matching upstream PR angular/angular-cli#34770) so Angular class metadata inside ES2022 static blocks (including ngDevMode-guarded internal setClassMetadata calls in @angular/core FESM bundles) is elided and pure static Angular classes continue to be wrapped for tree-shaking.
mattrbeck
added a commit
to mattrbeck/angular
that referenced
this pull request
Nov 20, 2026
Temporarily patch @angular/build oxc-transform (matching upstream PR angular/angular-cli#34770) so Angular class metadata inside ES2022 static blocks (including ngDevMode-guarded internal setClassMetadata calls in @angular/core FESM bundles) is elided and pure static Angular classes continue to be wrapped for tree-shaking.
mattrbeck
added a commit
to mattrbeck/angular
that referenced
this pull request
Nov 20, 2026
Temporarily patch @angular/build oxc-transform (matching upstream PR angular/angular-cli#34770) so Angular class metadata inside ES2022 static blocks (including ngDevMode-guarded internal setClassMetadata calls in @angular/core FESM bundles) is elided and pure static Angular classes continue to be wrapped for tree-shaking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
oxc-transformpreviously only elidedɵsetClassMetadata/ɵsetClassMetadataAsync/ɵsetClassDebugInfocalls insideFunctionExpression/ArrowFunctionExpressionIIFEs, andanalyzeClassStaticProperties()setshouldWrap = falsewhenever a class contained anyStaticBlockother thanthis.<prop> = <expr>.When full-mode Angular classes emit metadata inside an ES2022
static { ... }block (asngpalready does, and as proposed forngtscin angular/angular#72136 — including@angular/core/fesm2022/core.mjs, where Rollup bundles internalsetClassMetadatacalls without theɵprefix),oxc-transformpreviously left thestatic {}block intact and skipped wrapping the class in a/*#__PURE__*/IIFE, preventing unused classes such asPlatformRefandApplicationModulefrom being tree-shaken (+10.0 kB in standalone apps).This updates
oxc-transformandtraversalto:ɵsetClassMetadata*calls andngDevMode/ngJitMode-guarded(ɵ)setClassMetadata*statements insideStaticBlocks, removing metadata-onlyStaticBlocks (and individual metadata statements inside multi-statementStaticBlocks) whenadvancedOptimizationsis enabled.analyzeClassStaticProperties()to continue wrapping classes whoseStaticBlocks contain only elidable Angular metadata and/or purethis.<prop> = <expr>assignments, while still leaving user side-effectfulStaticBlocks unwrapped.Minimal failure example
Input (
@angular/core/ngp/ngtscES2022 output):Before (
main):Left unchanged (
shouldWrap = false), preventingPlatformReffrom being wrapped in/*#__PURE__*/ (() => { ... })()and retaining it in standalone application bundles.After: