@angular/compiler 20.0.0-rc.0 → 20.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.0.0-rc.0
2
+ * @license Angular v20.0.0-rc.1
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -11754,7 +11754,23 @@ function assignI18nSlotDependencies(job) {
11754
11754
  i18nExpressionsInProgress.push(opToRemove);
11755
11755
  continue;
11756
11756
  }
11757
+ let hasDifferentTarget = false;
11757
11758
  if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
11759
+ hasDifferentTarget = true;
11760
+ }
11761
+ else if (
11762
+ // Some expressions may consume slots as well (e.g. `storeLet`).
11763
+ updateOp.kind === OpKind.Statement ||
11764
+ updateOp.kind === OpKind.Variable) {
11765
+ visitExpressionsInOp(updateOp, (expr) => {
11766
+ if (!hasDifferentTarget &&
11767
+ hasDependsOnSlotContextTrait(expr) &&
11768
+ expr.target !== createOp.xref) {
11769
+ hasDifferentTarget = true;
11770
+ }
11771
+ });
11772
+ }
11773
+ if (hasDifferentTarget) {
11758
11774
  break;
11759
11775
  }
11760
11776
  updateOp = updateOp.next;
@@ -25201,11 +25217,16 @@ function allocateSlots(job) {
25201
25217
  */
25202
25218
  function optimizeStoreLet(job) {
25203
25219
  const letUsedExternally = new Set();
25220
+ const declareLetOps = new Map();
25204
25221
  // Since `@let` declarations can be referenced in child views, both in
25205
25222
  // the creation block (via listeners) and in the update block, we have
25206
25223
  // to look through all the ops to find the references.
25207
25224
  for (const unit of job.units) {
25208
25225
  for (const op of unit.ops()) {
25226
+ // Take advantage that we're already looking through all the ops and track some more info.
25227
+ if (op.kind === OpKind.DeclareLet) {
25228
+ declareLetOps.set(op.xref, op);
25229
+ }
25209
25230
  visitExpressionsInOp(op, (expr) => {
25210
25231
  if (expr instanceof ContextLetReferenceExpr) {
25211
25232
  letUsedExternally.add(expr.target);
@@ -25213,15 +25234,35 @@ function optimizeStoreLet(job) {
25213
25234
  });
25214
25235
  }
25215
25236
  }
25216
- // TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
25217
25237
  for (const unit of job.units) {
25218
25238
  for (const op of unit.update) {
25219
- transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
25220
- ? expression.value
25221
- : expression, VisitorContextFlag.None);
25239
+ transformExpressionsInOp(op, (expr) => {
25240
+ // If a @let isn't used in other views, we don't have to store its value.
25241
+ if (expr instanceof StoreLetExpr && !letUsedExternally.has(expr.target)) {
25242
+ // Furthermore, if the @let isn't using pipes, we can also drop its declareLet op.
25243
+ // We need to keep the declareLet if there are pipes, because they can use DI which
25244
+ // requires the TNode created by declareLet.
25245
+ if (!hasPipe(expr)) {
25246
+ OpList.remove(declareLetOps.get(expr.target));
25247
+ }
25248
+ return expr.value;
25249
+ }
25250
+ return expr;
25251
+ }, VisitorContextFlag.None);
25222
25252
  }
25223
25253
  }
25224
25254
  }
25255
+ /** Determines if a `storeLet` expression contains a pipe. */
25256
+ function hasPipe(root) {
25257
+ let result = false;
25258
+ transformExpressionsInExpression(root, (expr) => {
25259
+ if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
25260
+ result = true;
25261
+ }
25262
+ return expr;
25263
+ }, VisitorContextFlag.None);
25264
+ return result;
25265
+ }
25225
25266
 
25226
25267
  /**
25227
25268
  * In most cases we can drop user added parentheses from expressions. However, in some cases
@@ -26180,11 +26221,6 @@ const phases = [
26180
26221
  { kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
26181
26222
  { kind: CompilationJobKind.Tmpl, fn: createPipes },
26182
26223
  { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
26183
- { kind: CompilationJobKind.Tmpl, fn: convertI18nText },
26184
- { kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
26185
- { kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
26186
- { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
26187
- { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
26188
26224
  { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
26189
26225
  { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
26190
26226
  { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
@@ -26207,6 +26243,11 @@ const phases = [
26207
26243
  { kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
26208
26244
  { kind: CompilationJobKind.Both, fn: optimizeVariables },
26209
26245
  { kind: CompilationJobKind.Both, fn: optimizeStoreLet },
26246
+ { kind: CompilationJobKind.Tmpl, fn: convertI18nText },
26247
+ { kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
26248
+ { kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
26249
+ { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
26250
+ { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
26210
26251
  { kind: CompilationJobKind.Tmpl, fn: allocateSlots },
26211
26252
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
26212
26253
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
@@ -33868,7 +33909,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
33868
33909
  function compileDeclareClassMetadata(metadata) {
33869
33910
  const definitionMap = new DefinitionMap();
33870
33911
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
33871
- definitionMap.set('version', literal('20.0.0-rc.0'));
33912
+ definitionMap.set('version', literal('20.0.0-rc.1'));
33872
33913
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33873
33914
  definitionMap.set('type', metadata.type);
33874
33915
  definitionMap.set('decorators', metadata.decorators);
@@ -33886,7 +33927,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
33886
33927
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
33887
33928
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
33888
33929
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
33889
- definitionMap.set('version', literal('20.0.0-rc.0'));
33930
+ definitionMap.set('version', literal('20.0.0-rc.1'));
33890
33931
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33891
33932
  definitionMap.set('type', metadata.type);
33892
33933
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -33981,7 +34022,7 @@ function createDirectiveDefinitionMap(meta) {
33981
34022
  const definitionMap = new DefinitionMap();
33982
34023
  const minVersion = getMinimumVersionForPartialOutput(meta);
33983
34024
  definitionMap.set('minVersion', literal(minVersion));
33984
- definitionMap.set('version', literal('20.0.0-rc.0'));
34025
+ definitionMap.set('version', literal('20.0.0-rc.1'));
33985
34026
  // e.g. `type: MyDirective`
33986
34027
  definitionMap.set('type', meta.type.value);
33987
34028
  if (meta.isStandalone !== undefined) {
@@ -34397,7 +34438,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34397
34438
  function compileDeclareFactoryFunction(meta) {
34398
34439
  const definitionMap = new DefinitionMap();
34399
34440
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34400
- definitionMap.set('version', literal('20.0.0-rc.0'));
34441
+ definitionMap.set('version', literal('20.0.0-rc.1'));
34401
34442
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34402
34443
  definitionMap.set('type', meta.type.value);
34403
34444
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34432,7 +34473,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34432
34473
  function createInjectableDefinitionMap(meta) {
34433
34474
  const definitionMap = new DefinitionMap();
34434
34475
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34435
- definitionMap.set('version', literal('20.0.0-rc.0'));
34476
+ definitionMap.set('version', literal('20.0.0-rc.1'));
34436
34477
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34437
34478
  definitionMap.set('type', meta.type.value);
34438
34479
  // Only generate providedIn property if it has a non-null value
@@ -34483,7 +34524,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34483
34524
  function createInjectorDefinitionMap(meta) {
34484
34525
  const definitionMap = new DefinitionMap();
34485
34526
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34486
- definitionMap.set('version', literal('20.0.0-rc.0'));
34527
+ definitionMap.set('version', literal('20.0.0-rc.1'));
34487
34528
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34488
34529
  definitionMap.set('type', meta.type.value);
34489
34530
  definitionMap.set('providers', meta.providers);
@@ -34516,7 +34557,7 @@ function createNgModuleDefinitionMap(meta) {
34516
34557
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34517
34558
  }
34518
34559
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34519
- definitionMap.set('version', literal('20.0.0-rc.0'));
34560
+ definitionMap.set('version', literal('20.0.0-rc.1'));
34520
34561
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34521
34562
  definitionMap.set('type', meta.type.value);
34522
34563
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34567,7 +34608,7 @@ function compileDeclarePipeFromMetadata(meta) {
34567
34608
  function createPipeDefinitionMap(meta) {
34568
34609
  const definitionMap = new DefinitionMap();
34569
34610
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34570
- definitionMap.set('version', literal('20.0.0-rc.0'));
34611
+ definitionMap.set('version', literal('20.0.0-rc.1'));
34571
34612
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34572
34613
  // e.g. `type: MyPipe`
34573
34614
  definitionMap.set('type', meta.type.value);
@@ -34725,7 +34766,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
34725
34766
  * @description
34726
34767
  * Entry point for all public APIs of the compiler package.
34727
34768
  */
34728
- const VERSION = new Version('20.0.0-rc.0');
34769
+ const VERSION = new Version('20.0.0-rc.1');
34729
34770
 
34730
34771
  //////////////////////////////////////
34731
34772
  // THIS FILE HAS GLOBAL SIDE EFFECT //