@angular/compiler 20.2.0 → 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
2
+ * @license Angular v20.2.1
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));
@@ -34300,7 +34317,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34300
34317
  function compileDeclareClassMetadata(metadata) {
34301
34318
  const definitionMap = new DefinitionMap();
34302
34319
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34303
- definitionMap.set('version', literal('20.2.0'));
34320
+ definitionMap.set('version', literal('20.2.1'));
34304
34321
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34305
34322
  definitionMap.set('type', metadata.type);
34306
34323
  definitionMap.set('decorators', metadata.decorators);
@@ -34318,7 +34335,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34318
34335
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34319
34336
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34320
34337
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34321
- definitionMap.set('version', literal('20.2.0'));
34338
+ definitionMap.set('version', literal('20.2.1'));
34322
34339
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34323
34340
  definitionMap.set('type', metadata.type);
34324
34341
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34413,7 +34430,7 @@ function createDirectiveDefinitionMap(meta) {
34413
34430
  const definitionMap = new DefinitionMap();
34414
34431
  const minVersion = getMinimumVersionForPartialOutput(meta);
34415
34432
  definitionMap.set('minVersion', literal(minVersion));
34416
- definitionMap.set('version', literal('20.2.0'));
34433
+ definitionMap.set('version', literal('20.2.1'));
34417
34434
  // e.g. `type: MyDirective`
34418
34435
  definitionMap.set('type', meta.type.value);
34419
34436
  if (meta.isStandalone !== undefined) {
@@ -34829,7 +34846,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34829
34846
  function compileDeclareFactoryFunction(meta) {
34830
34847
  const definitionMap = new DefinitionMap();
34831
34848
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34832
- definitionMap.set('version', literal('20.2.0'));
34849
+ definitionMap.set('version', literal('20.2.1'));
34833
34850
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34834
34851
  definitionMap.set('type', meta.type.value);
34835
34852
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34864,7 +34881,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34864
34881
  function createInjectableDefinitionMap(meta) {
34865
34882
  const definitionMap = new DefinitionMap();
34866
34883
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34867
- definitionMap.set('version', literal('20.2.0'));
34884
+ definitionMap.set('version', literal('20.2.1'));
34868
34885
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34869
34886
  definitionMap.set('type', meta.type.value);
34870
34887
  // Only generate providedIn property if it has a non-null value
@@ -34915,7 +34932,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34915
34932
  function createInjectorDefinitionMap(meta) {
34916
34933
  const definitionMap = new DefinitionMap();
34917
34934
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34918
- definitionMap.set('version', literal('20.2.0'));
34935
+ definitionMap.set('version', literal('20.2.1'));
34919
34936
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34920
34937
  definitionMap.set('type', meta.type.value);
34921
34938
  definitionMap.set('providers', meta.providers);
@@ -34948,7 +34965,7 @@ function createNgModuleDefinitionMap(meta) {
34948
34965
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34949
34966
  }
34950
34967
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34951
- definitionMap.set('version', literal('20.2.0'));
34968
+ definitionMap.set('version', literal('20.2.1'));
34952
34969
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34953
34970
  definitionMap.set('type', meta.type.value);
34954
34971
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34999,7 +35016,7 @@ function compileDeclarePipeFromMetadata(meta) {
34999
35016
  function createPipeDefinitionMap(meta) {
35000
35017
  const definitionMap = new DefinitionMap();
35001
35018
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
35002
- definitionMap.set('version', literal('20.2.0'));
35019
+ definitionMap.set('version', literal('20.2.1'));
35003
35020
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35004
35021
  // e.g. `type: MyPipe`
35005
35022
  definitionMap.set('type', meta.type.value);
@@ -35155,7 +35172,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35155
35172
  * @description
35156
35173
  * Entry point for all public APIs of the compiler package.
35157
35174
  */
35158
- const VERSION = new Version('20.2.0');
35175
+ const VERSION = new Version('20.2.1');
35159
35176
 
35160
35177
  //////////////////////////////////////
35161
35178
  // THIS FILE HAS GLOBAL SIDE EFFECT //