@angular/compiler 20.2.0 → 20.2.2

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
2
+ * @license Angular v20.2.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -25483,8 +25483,13 @@ function hasPipe(root) {
25483
25483
  *
25484
25484
  * 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
25485
25485
  * valid JavaScript, but `(-2) ** 3` is.
25486
+ *
25486
25487
  * 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need
25487
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
+ *
25488
25493
  * 3. Ternary expression used as an operand for nullish coalescing. Typescript generates incorrect
25489
25494
  * code if the parentheses are missing. For example when `(a ? b : c) ?? d` is translated to
25490
25495
  * typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
@@ -25507,6 +25512,11 @@ function stripNonrequiredParentheses(job) {
25507
25512
  case BinaryOperator.NullishCoalesce:
25508
25513
  checkNullishCoalescingParens(expr, requiredParens);
25509
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);
25510
25520
  }
25511
25521
  }
25512
25522
  });
@@ -25539,6 +25549,13 @@ function checkNullishCoalescingParens(expr, requiredParens) {
25539
25549
  requiredParens.add(expr.rhs);
25540
25550
  }
25541
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
+ }
25542
25559
  function isLogicalAndOr(expr) {
25543
25560
  return (expr instanceof BinaryOperatorExpr &&
25544
25561
  (expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
@@ -29913,6 +29930,12 @@ class HtmlAstToIvyAst {
29913
29930
  }
29914
29931
  return directives;
29915
29932
  }
29933
+ filterAnimationAttributes(attributes) {
29934
+ return attributes.filter((a) => !a.name.startsWith('animate.'));
29935
+ }
29936
+ filterAnimationInputs(attributes) {
29937
+ return attributes.filter((a) => a.type !== BindingType.Animation);
29938
+ }
29916
29939
  wrapInTemplate(node, templateProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement) {
29917
29940
  // We need to hoist the attributes of the node to the template for content projection purposes.
29918
29941
  const attrs = this.categorizePropertyAttributes('ng-template', templateProperties, i18nAttrsMeta);
@@ -29925,8 +29948,8 @@ class HtmlAstToIvyAst {
29925
29948
  outputs: [],
29926
29949
  };
29927
29950
  if (node instanceof Element$1 || node instanceof Component$1) {
29928
- hoistedAttrs.attributes.push(...node.attributes);
29929
- hoistedAttrs.inputs.push(...node.inputs);
29951
+ hoistedAttrs.attributes.push(...this.filterAnimationAttributes(node.attributes));
29952
+ hoistedAttrs.inputs.push(...this.filterAnimationInputs(node.inputs));
29930
29953
  hoistedAttrs.outputs.push(...node.outputs);
29931
29954
  }
29932
29955
  // For <ng-template>s with structural directives on them, avoid passing i18n information to
@@ -34300,7 +34323,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34300
34323
  function compileDeclareClassMetadata(metadata) {
34301
34324
  const definitionMap = new DefinitionMap();
34302
34325
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34303
- definitionMap.set('version', literal('20.2.0'));
34326
+ definitionMap.set('version', literal('20.2.2'));
34304
34327
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34305
34328
  definitionMap.set('type', metadata.type);
34306
34329
  definitionMap.set('decorators', metadata.decorators);
@@ -34318,7 +34341,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34318
34341
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34319
34342
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34320
34343
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34321
- definitionMap.set('version', literal('20.2.0'));
34344
+ definitionMap.set('version', literal('20.2.2'));
34322
34345
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34323
34346
  definitionMap.set('type', metadata.type);
34324
34347
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34413,7 +34436,7 @@ function createDirectiveDefinitionMap(meta) {
34413
34436
  const definitionMap = new DefinitionMap();
34414
34437
  const minVersion = getMinimumVersionForPartialOutput(meta);
34415
34438
  definitionMap.set('minVersion', literal(minVersion));
34416
- definitionMap.set('version', literal('20.2.0'));
34439
+ definitionMap.set('version', literal('20.2.2'));
34417
34440
  // e.g. `type: MyDirective`
34418
34441
  definitionMap.set('type', meta.type.value);
34419
34442
  if (meta.isStandalone !== undefined) {
@@ -34829,7 +34852,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34829
34852
  function compileDeclareFactoryFunction(meta) {
34830
34853
  const definitionMap = new DefinitionMap();
34831
34854
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34832
- definitionMap.set('version', literal('20.2.0'));
34855
+ definitionMap.set('version', literal('20.2.2'));
34833
34856
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34834
34857
  definitionMap.set('type', meta.type.value);
34835
34858
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34864,7 +34887,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34864
34887
  function createInjectableDefinitionMap(meta) {
34865
34888
  const definitionMap = new DefinitionMap();
34866
34889
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34867
- definitionMap.set('version', literal('20.2.0'));
34890
+ definitionMap.set('version', literal('20.2.2'));
34868
34891
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34869
34892
  definitionMap.set('type', meta.type.value);
34870
34893
  // Only generate providedIn property if it has a non-null value
@@ -34915,7 +34938,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34915
34938
  function createInjectorDefinitionMap(meta) {
34916
34939
  const definitionMap = new DefinitionMap();
34917
34940
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34918
- definitionMap.set('version', literal('20.2.0'));
34941
+ definitionMap.set('version', literal('20.2.2'));
34919
34942
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34920
34943
  definitionMap.set('type', meta.type.value);
34921
34944
  definitionMap.set('providers', meta.providers);
@@ -34948,7 +34971,7 @@ function createNgModuleDefinitionMap(meta) {
34948
34971
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34949
34972
  }
34950
34973
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34951
- definitionMap.set('version', literal('20.2.0'));
34974
+ definitionMap.set('version', literal('20.2.2'));
34952
34975
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34953
34976
  definitionMap.set('type', meta.type.value);
34954
34977
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34999,7 +35022,7 @@ function compileDeclarePipeFromMetadata(meta) {
34999
35022
  function createPipeDefinitionMap(meta) {
35000
35023
  const definitionMap = new DefinitionMap();
35001
35024
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
35002
- definitionMap.set('version', literal('20.2.0'));
35025
+ definitionMap.set('version', literal('20.2.2'));
35003
35026
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35004
35027
  // e.g. `type: MyPipe`
35005
35028
  definitionMap.set('type', meta.type.value);
@@ -35155,7 +35178,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35155
35178
  * @description
35156
35179
  * Entry point for all public APIs of the compiler package.
35157
35180
  */
35158
- const VERSION = new Version('20.2.0');
35181
+ const VERSION = new Version('20.2.2');
35159
35182
 
35160
35183
  //////////////////////////////////////
35161
35184
  // THIS FILE HAS GLOBAL SIDE EFFECT //