@angular/compiler 20.2.0-rc.1 → 20.2.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.2.0-rc.1
2
+ * @license Angular v20.2.1
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -23224,6 +23224,11 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
23224
23224
  subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
23225
23225
  }
23226
23226
  break;
23227
+ case OpKind.Projection:
23228
+ if (op.fallbackView !== null) {
23229
+ subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.fallbackView), i18nBlock, op.fallbackViewI18nPlaceholder, subTemplateIndex);
23230
+ }
23231
+ break;
23227
23232
  }
23228
23233
  }
23229
23234
  return subTemplateIndex;
@@ -24807,6 +24812,21 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
24807
24812
  // Clear out the pending structural directive now that its been accounted for.
24808
24813
  pendingStructuralDirective = undefined;
24809
24814
  }
24815
+ if (op.fallbackView !== null) {
24816
+ const view = job.views.get(op.fallbackView);
24817
+ if (op.fallbackViewI18nPlaceholder === undefined) {
24818
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
24819
+ }
24820
+ else {
24821
+ if (currentOps === null) {
24822
+ throw Error('i18n tag placeholder should only occur inside an i18n block');
24823
+ }
24824
+ recordTemplateStart(job, view, op.handle.slot, op.fallbackViewI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
24825
+ resolvePlaceholdersForView(job, view, i18nContexts, elements);
24826
+ recordTemplateClose(job, view, op.handle.slot, op.fallbackViewI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
24827
+ pendingStructuralDirective = undefined;
24828
+ }
24829
+ }
24810
24830
  break;
24811
24831
  case OpKind.ConditionalCreate:
24812
24832
  case OpKind.ConditionalBranchCreate:
@@ -25463,8 +25483,13 @@ function hasPipe(root) {
25463
25483
  *
25464
25484
  * 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
25465
25485
  * valid JavaScript, but `(-2) ** 3` is.
25486
+ *
25466
25487
  * 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need
25467
25488
  * parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
25489
+ * Note: Because of the outcome of https://github.com/microsoft/TypeScript/issues/62307
25490
+ * We need (for now) to keep parentheses around the `??` operator when it is used with and/or operators.
25491
+ * For example, `a ?? b && c` is not valid JavaScript, but `(a ?? b) && c` is.
25492
+ *
25468
25493
  * 3. Ternary expression used as an operand for nullish coalescing. Typescript generates incorrect
25469
25494
  * code if the parentheses are missing. For example when `(a ? b : c) ?? d` is translated to
25470
25495
  * typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
@@ -25487,6 +25512,11 @@ function stripNonrequiredParentheses(job) {
25487
25512
  case BinaryOperator.NullishCoalesce:
25488
25513
  checkNullishCoalescingParens(expr, requiredParens);
25489
25514
  break;
25515
+ // these 2 cases can be dropped if the regression introduced in 5.9.2 is fixed
25516
+ // see https://github.com/microsoft/TypeScript/issues/62307
25517
+ case BinaryOperator.And:
25518
+ case BinaryOperator.Or:
25519
+ checkAndOrParens(expr, requiredParens);
25490
25520
  }
25491
25521
  }
25492
25522
  });
@@ -25519,6 +25549,13 @@ function checkNullishCoalescingParens(expr, requiredParens) {
25519
25549
  requiredParens.add(expr.rhs);
25520
25550
  }
25521
25551
  }
25552
+ function checkAndOrParens(expr, requiredParens) {
25553
+ if (expr.lhs instanceof ParenthesizedExpr &&
25554
+ expr.lhs.expr instanceof BinaryOperatorExpr &&
25555
+ expr.lhs.expr.operator === BinaryOperator.NullishCoalesce) {
25556
+ requiredParens.add(expr.lhs);
25557
+ }
25558
+ }
25522
25559
  function isLogicalAndOr(expr) {
25523
25560
  return (expr instanceof BinaryOperatorExpr &&
25524
25561
  (expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
@@ -26656,10 +26693,16 @@ function ingestHostAttribute(job, name, value, securityContexts) {
26656
26693
  job.root.update.push(attrBinding);
26657
26694
  }
26658
26695
  function ingestHostEvent(job, event) {
26659
- const [phase, target] = event.type !== ParsedEventType.LegacyAnimation
26660
- ? [null, event.targetOrPhase]
26661
- : [event.targetOrPhase, null];
26662
- const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
26696
+ let eventBinding;
26697
+ if (event.type === ParsedEventType.Animation) {
26698
+ eventBinding = createAnimationListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), event.name.endsWith('enter') ? "enter" /* ir.AnimationKind.ENTER */ : "leave" /* ir.AnimationKind.LEAVE */, event.targetOrPhase, true, event.sourceSpan);
26699
+ }
26700
+ else {
26701
+ const [phase, target] = event.type !== ParsedEventType.LegacyAnimation
26702
+ ? [null, event.targetOrPhase]
26703
+ : [event.targetOrPhase, null];
26704
+ eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
26705
+ }
26663
26706
  job.root.create.push(eventBinding);
26664
26707
  }
26665
26708
  /**
@@ -29720,11 +29763,11 @@ class HtmlAstToIvyAst {
29720
29763
  const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
29721
29764
  const parsedVariables = [];
29722
29765
  const absoluteValueOffset = attribute.valueSpan
29723
- ? attribute.valueSpan.start.offset
29766
+ ? attribute.valueSpan.fullStart.offset
29724
29767
  : // If there is no value span the attribute does not have a value, like `attr` in
29725
29768
  //`<div attr></div>`. In this case, point to one character beyond the last character of
29726
29769
  // the attribute name.
29727
- attribute.sourceSpan.start.offset + attribute.name.length;
29770
+ attribute.sourceSpan.fullStart.offset + attribute.name.length;
29728
29771
  this.bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attribute.sourceSpan, absoluteValueOffset, [], templateParsedProperties, parsedVariables, true /* isIvyAst */);
29729
29772
  templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
29730
29773
  }
@@ -34274,7 +34317,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34274
34317
  function compileDeclareClassMetadata(metadata) {
34275
34318
  const definitionMap = new DefinitionMap();
34276
34319
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34277
- definitionMap.set('version', literal('20.2.0-rc.1'));
34320
+ definitionMap.set('version', literal('20.2.1'));
34278
34321
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34279
34322
  definitionMap.set('type', metadata.type);
34280
34323
  definitionMap.set('decorators', metadata.decorators);
@@ -34292,7 +34335,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34292
34335
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34293
34336
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34294
34337
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34295
- definitionMap.set('version', literal('20.2.0-rc.1'));
34338
+ definitionMap.set('version', literal('20.2.1'));
34296
34339
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34297
34340
  definitionMap.set('type', metadata.type);
34298
34341
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34387,7 +34430,7 @@ function createDirectiveDefinitionMap(meta) {
34387
34430
  const definitionMap = new DefinitionMap();
34388
34431
  const minVersion = getMinimumVersionForPartialOutput(meta);
34389
34432
  definitionMap.set('minVersion', literal(minVersion));
34390
- definitionMap.set('version', literal('20.2.0-rc.1'));
34433
+ definitionMap.set('version', literal('20.2.1'));
34391
34434
  // e.g. `type: MyDirective`
34392
34435
  definitionMap.set('type', meta.type.value);
34393
34436
  if (meta.isStandalone !== undefined) {
@@ -34803,7 +34846,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34803
34846
  function compileDeclareFactoryFunction(meta) {
34804
34847
  const definitionMap = new DefinitionMap();
34805
34848
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34806
- definitionMap.set('version', literal('20.2.0-rc.1'));
34849
+ definitionMap.set('version', literal('20.2.1'));
34807
34850
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34808
34851
  definitionMap.set('type', meta.type.value);
34809
34852
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34838,7 +34881,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34838
34881
  function createInjectableDefinitionMap(meta) {
34839
34882
  const definitionMap = new DefinitionMap();
34840
34883
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34841
- definitionMap.set('version', literal('20.2.0-rc.1'));
34884
+ definitionMap.set('version', literal('20.2.1'));
34842
34885
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34843
34886
  definitionMap.set('type', meta.type.value);
34844
34887
  // Only generate providedIn property if it has a non-null value
@@ -34889,7 +34932,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34889
34932
  function createInjectorDefinitionMap(meta) {
34890
34933
  const definitionMap = new DefinitionMap();
34891
34934
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34892
- definitionMap.set('version', literal('20.2.0-rc.1'));
34935
+ definitionMap.set('version', literal('20.2.1'));
34893
34936
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34894
34937
  definitionMap.set('type', meta.type.value);
34895
34938
  definitionMap.set('providers', meta.providers);
@@ -34922,7 +34965,7 @@ function createNgModuleDefinitionMap(meta) {
34922
34965
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34923
34966
  }
34924
34967
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34925
- definitionMap.set('version', literal('20.2.0-rc.1'));
34968
+ definitionMap.set('version', literal('20.2.1'));
34926
34969
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34927
34970
  definitionMap.set('type', meta.type.value);
34928
34971
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34973,7 +35016,7 @@ function compileDeclarePipeFromMetadata(meta) {
34973
35016
  function createPipeDefinitionMap(meta) {
34974
35017
  const definitionMap = new DefinitionMap();
34975
35018
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34976
- definitionMap.set('version', literal('20.2.0-rc.1'));
35019
+ definitionMap.set('version', literal('20.2.1'));
34977
35020
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34978
35021
  // e.g. `type: MyPipe`
34979
35022
  definitionMap.set('type', meta.type.value);
@@ -35129,7 +35172,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35129
35172
  * @description
35130
35173
  * Entry point for all public APIs of the compiler package.
35131
35174
  */
35132
- const VERSION = new Version('20.2.0-rc.1');
35175
+ const VERSION = new Version('20.2.1');
35133
35176
 
35134
35177
  //////////////////////////////////////
35135
35178
  // THIS FILE HAS GLOBAL SIDE EFFECT //