@angular/core 19.2.1 → 20.0.0-next.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.
Files changed (42) hide show
  1. package/fesm2022/core.mjs +6420 -6161
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/di.mjs +1 -1
  4. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  5. package/fesm2022/primitives/signals.mjs +1 -1
  6. package/fesm2022/rxjs-interop.mjs +1 -1
  7. package/fesm2022/testing.mjs +15 -4
  8. package/fesm2022/testing.mjs.map +1 -1
  9. package/index.d.ts +114 -25
  10. package/package.json +7 -1
  11. package/primitives/di/index.d.ts +1 -1
  12. package/primitives/event-dispatch/index.d.ts +1 -1
  13. package/primitives/signals/index.d.ts +1 -1
  14. package/rxjs-interop/index.d.ts +1 -1
  15. package/schematics/bundles/{apply_import_manager-b8d6885d.js → apply_import_manager-e2a7fe5b.js} +3 -3
  16. package/schematics/bundles/{checker-89987c98.js → checker-af521da6.js} +452 -231
  17. package/schematics/bundles/cleanup-unused-imports.js +6 -6
  18. package/schematics/bundles/{compiler_host-2398e4ca.js → compiler_host-5a29293c.js} +2 -2
  19. package/schematics/bundles/control-flow-migration.js +3 -3
  20. package/schematics/bundles/explicit-standalone-flag.js +3 -3
  21. package/schematics/bundles/imports-047fbbc8.js +1 -1
  22. package/schematics/bundles/{index-e0b2e4a7.js → index-1bef3025.js} +4 -4
  23. package/schematics/bundles/{index-10911843.js → index-ef1bffbb.js} +4 -4
  24. package/schematics/bundles/inject-migration.js +3 -3
  25. package/schematics/bundles/leading_space-f8944434.js +1 -1
  26. package/schematics/bundles/{migrate_ts_type_references-52508cd4.js → migrate_ts_type_references-2a3e9e6b.js} +15 -13
  27. package/schematics/bundles/ng_decorators-b0d8b324.js +1 -1
  28. package/schematics/bundles/nodes-7758dbf6.js +1 -1
  29. package/schematics/bundles/output-migration.js +6 -6
  30. package/schematics/bundles/pending-tasks.js +3 -3
  31. package/schematics/bundles/{program-0e1d4f10.js → program-a449f9bf.js} +149 -149
  32. package/schematics/bundles/{project_paths-c48796dd.js → project_paths-17dc204d.js} +3 -3
  33. package/schematics/bundles/project_tsconfig_paths-b558633b.js +1 -1
  34. package/schematics/bundles/property_name-ac18447e.js +1 -1
  35. package/schematics/bundles/provide-initializer.js +3 -3
  36. package/schematics/bundles/route-lazy-loading.js +3 -3
  37. package/schematics/bundles/self-closing-tags-migration.js +4 -4
  38. package/schematics/bundles/signal-input-migration.js +7 -7
  39. package/schematics/bundles/signal-queries-migration.js +7 -7
  40. package/schematics/bundles/signals.js +7 -7
  41. package/schematics/bundles/standalone-migration.js +5 -5
  42. package/testing/index.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.2.1
3
+ * @license Angular v20.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -921,6 +921,7 @@ var BinaryOperator;
921
921
  BinaryOperator[BinaryOperator["Bigger"] = 15] = "Bigger";
922
922
  BinaryOperator[BinaryOperator["BiggerEquals"] = 16] = "BiggerEquals";
923
923
  BinaryOperator[BinaryOperator["NullishCoalesce"] = 17] = "NullishCoalesce";
924
+ BinaryOperator[BinaryOperator["Exponentiation"] = 18] = "Exponentiation";
924
925
  })(BinaryOperator || (BinaryOperator = {}));
925
926
  function nullSafeIsEquivalent(base, other) {
926
927
  if (base == null || other == null) {
@@ -992,14 +993,17 @@ class Expression {
992
993
  modulo(rhs, sourceSpan) {
993
994
  return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
994
995
  }
996
+ power(rhs, sourceSpan) {
997
+ return new BinaryOperatorExpr(BinaryOperator.Exponentiation, this, rhs, null, sourceSpan);
998
+ }
995
999
  and(rhs, sourceSpan) {
996
1000
  return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
997
1001
  }
998
- bitwiseOr(rhs, sourceSpan, parens = true) {
999
- return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);
1002
+ bitwiseOr(rhs, sourceSpan) {
1003
+ return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan);
1000
1004
  }
1001
- bitwiseAnd(rhs, sourceSpan, parens = true) {
1002
- return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);
1005
+ bitwiseAnd(rhs, sourceSpan) {
1006
+ return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan);
1003
1007
  }
1004
1008
  or(rhs, sourceSpan) {
1005
1009
  return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
@@ -1069,6 +1073,25 @@ class TypeofExpr extends Expression {
1069
1073
  return new TypeofExpr(this.expr.clone());
1070
1074
  }
1071
1075
  }
1076
+ class VoidExpr extends Expression {
1077
+ expr;
1078
+ constructor(expr, type, sourceSpan) {
1079
+ super(type, sourceSpan);
1080
+ this.expr = expr;
1081
+ }
1082
+ visitExpression(visitor, context) {
1083
+ return visitor.visitVoidExpr(this, context);
1084
+ }
1085
+ isEquivalent(e) {
1086
+ return e instanceof VoidExpr && e.expr.isEquivalent(this.expr);
1087
+ }
1088
+ isConstant() {
1089
+ return this.expr.isConstant();
1090
+ }
1091
+ clone() {
1092
+ return new VoidExpr(this.expr.clone());
1093
+ }
1094
+ }
1072
1095
  class WrappedNodeExpr extends Expression {
1073
1096
  node;
1074
1097
  constructor(node, type, sourceSpan) {
@@ -1653,16 +1676,34 @@ class UnaryOperatorExpr extends Expression {
1653
1676
  return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
1654
1677
  }
1655
1678
  }
1679
+ class ParenthesizedExpr extends Expression {
1680
+ expr;
1681
+ constructor(expr, type, sourceSpan) {
1682
+ super(type, sourceSpan);
1683
+ this.expr = expr;
1684
+ }
1685
+ visitExpression(visitor, context) {
1686
+ return visitor.visitParenthesizedExpr(this, context);
1687
+ }
1688
+ isEquivalent(e) {
1689
+ // TODO: should this ignore paren depth? i.e. is `(1)` equivalent to `1`?
1690
+ return e instanceof ParenthesizedExpr && e.expr.isEquivalent(this.expr);
1691
+ }
1692
+ isConstant() {
1693
+ return this.expr.isConstant();
1694
+ }
1695
+ clone() {
1696
+ return new ParenthesizedExpr(this.expr.clone());
1697
+ }
1698
+ }
1656
1699
  class BinaryOperatorExpr extends Expression {
1657
1700
  operator;
1658
1701
  rhs;
1659
- parens;
1660
1702
  lhs;
1661
- constructor(operator, lhs, rhs, type, sourceSpan, parens = true) {
1703
+ constructor(operator, lhs, rhs, type, sourceSpan) {
1662
1704
  super(type || lhs.type, sourceSpan);
1663
1705
  this.operator = operator;
1664
1706
  this.rhs = rhs;
1665
- this.parens = parens;
1666
1707
  this.lhs = lhs;
1667
1708
  }
1668
1709
  isEquivalent(e) {
@@ -1678,7 +1719,7 @@ class BinaryOperatorExpr extends Expression {
1678
1719
  return visitor.visitBinaryOperatorExpr(this, context);
1679
1720
  }
1680
1721
  clone() {
1681
- return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan, this.parens);
1722
+ return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
1682
1723
  }
1683
1724
  }
1684
1725
  class ReadPropExpr extends Expression {
@@ -1963,9 +2004,6 @@ class RecursiveAstVisitor$1 {
1963
2004
  visitWrappedNodeExpr(ast, context) {
1964
2005
  return ast;
1965
2006
  }
1966
- visitTypeofExpr(ast, context) {
1967
- return this.visitExpression(ast, context);
1968
- }
1969
2007
  visitReadVarExpr(ast, context) {
1970
2008
  return this.visitExpression(ast, context);
1971
2009
  }
@@ -2043,6 +2081,14 @@ class RecursiveAstVisitor$1 {
2043
2081
  ast.expr.visitExpression(this, context);
2044
2082
  return this.visitExpression(ast, context);
2045
2083
  }
2084
+ visitTypeofExpr(ast, context) {
2085
+ ast.expr.visitExpression(this, context);
2086
+ return this.visitExpression(ast, context);
2087
+ }
2088
+ visitVoidExpr(ast, context) {
2089
+ ast.expr.visitExpression(this, context);
2090
+ return this.visitExpression(ast, context);
2091
+ }
2046
2092
  visitBinaryOperatorExpr(ast, context) {
2047
2093
  ast.lhs.visitExpression(this, context);
2048
2094
  ast.rhs.visitExpression(this, context);
@@ -2077,6 +2123,10 @@ class RecursiveAstVisitor$1 {
2077
2123
  visitTemplateLiteralElementExpr(ast, context) {
2078
2124
  return this.visitExpression(ast, context);
2079
2125
  }
2126
+ visitParenthesizedExpr(ast, context) {
2127
+ ast.expr.visitExpression(this, context);
2128
+ return this.visitExpression(ast, context);
2129
+ }
2080
2130
  visitAllExpressions(exprs, context) {
2081
2131
  exprs.forEach((expr) => expr.visitExpression(this, context));
2082
2132
  }
@@ -3371,6 +3421,7 @@ class EmitterVisitorContext {
3371
3421
  }
3372
3422
  class AbstractEmitterVisitor {
3373
3423
  _escapeDollarInStrings;
3424
+ lastIfCondition = null;
3374
3425
  constructor(_escapeDollarInStrings) {
3375
3426
  this._escapeDollarInStrings = _escapeDollarInStrings;
3376
3427
  }
@@ -3410,7 +3461,9 @@ class AbstractEmitterVisitor {
3410
3461
  visitIfStmt(stmt, ctx) {
3411
3462
  this.printLeadingComments(stmt, ctx);
3412
3463
  ctx.print(stmt, `if (`);
3464
+ this.lastIfCondition = stmt.condition; // We can skip redundant parentheses for the condition.
3413
3465
  stmt.condition.visitExpression(this, ctx);
3466
+ this.lastIfCondition = null;
3414
3467
  ctx.print(stmt, `) {`);
3415
3468
  const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
3416
3469
  if (stmt.trueCase.length <= 1 && !hasElseCase) {
@@ -3516,6 +3569,10 @@ class AbstractEmitterVisitor {
3516
3569
  ctx.print(expr, 'typeof ');
3517
3570
  expr.expr.visitExpression(this, ctx);
3518
3571
  }
3572
+ visitVoidExpr(expr, ctx) {
3573
+ ctx.print(expr, 'void ');
3574
+ expr.expr.visitExpression(this, ctx);
3575
+ }
3519
3576
  visitReadVarExpr(ast, ctx) {
3520
3577
  ctx.print(ast, ast.name);
3521
3578
  return null;
@@ -3579,11 +3636,12 @@ class AbstractEmitterVisitor {
3579
3636
  default:
3580
3637
  throw new Error(`Unknown operator ${ast.operator}`);
3581
3638
  }
3582
- if (ast.parens)
3639
+ const parens = ast !== this.lastIfCondition;
3640
+ if (parens)
3583
3641
  ctx.print(ast, `(`);
3584
3642
  ctx.print(ast, opStr);
3585
3643
  ast.expr.visitExpression(this, ctx);
3586
- if (ast.parens)
3644
+ if (parens)
3587
3645
  ctx.print(ast, `)`);
3588
3646
  return null;
3589
3647
  }
@@ -3629,6 +3687,9 @@ class AbstractEmitterVisitor {
3629
3687
  case BinaryOperator.Modulo:
3630
3688
  opStr = '%';
3631
3689
  break;
3690
+ case BinaryOperator.Exponentiation:
3691
+ opStr = '**';
3692
+ break;
3632
3693
  case BinaryOperator.Lower:
3633
3694
  opStr = '<';
3634
3695
  break;
@@ -3647,12 +3708,13 @@ class AbstractEmitterVisitor {
3647
3708
  default:
3648
3709
  throw new Error(`Unknown operator ${ast.operator}`);
3649
3710
  }
3650
- if (ast.parens)
3711
+ const parens = ast !== this.lastIfCondition;
3712
+ if (parens)
3651
3713
  ctx.print(ast, `(`);
3652
3714
  ast.lhs.visitExpression(this, ctx);
3653
3715
  ctx.print(ast, ` ${opStr} `);
3654
3716
  ast.rhs.visitExpression(this, ctx);
3655
- if (ast.parens)
3717
+ if (parens)
3656
3718
  ctx.print(ast, `)`);
3657
3719
  return null;
3658
3720
  }
@@ -3690,6 +3752,12 @@ class AbstractEmitterVisitor {
3690
3752
  ctx.print(ast, ')');
3691
3753
  return null;
3692
3754
  }
3755
+ visitParenthesizedExpr(ast, ctx) {
3756
+ // We parenthesize everything regardless of an explicit ParenthesizedExpr, so we can just visit
3757
+ // the inner expression.
3758
+ // TODO: Do we *need* to parenthesize everything?
3759
+ ast.expr.visitExpression(this, ctx);
3760
+ }
3693
3761
  visitAllExpressions(expressions, ctx, separator) {
3694
3762
  this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator);
3695
3763
  }
@@ -3776,7 +3844,7 @@ function guardedExpression(guard, expr) {
3776
3844
  const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal$1('undefined'));
3777
3845
  const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr,
3778
3846
  /* type */ undefined,
3779
- /* sourceSpan */ undefined, true);
3847
+ /* sourceSpan */ undefined);
3780
3848
  return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);
3781
3849
  }
3782
3850
  function wrapReference(value) {
@@ -4321,6 +4389,16 @@ class TypeofExpression extends AST {
4321
4389
  return visitor.visitTypeofExpression(this, context);
4322
4390
  }
4323
4391
  }
4392
+ class VoidExpression extends AST {
4393
+ expression;
4394
+ constructor(span, sourceSpan, expression) {
4395
+ super(span, sourceSpan);
4396
+ this.expression = expression;
4397
+ }
4398
+ visit(visitor, context = null) {
4399
+ return visitor.visitVoidExpression(this, context);
4400
+ }
4401
+ }
4324
4402
  class NonNullAssert extends AST {
4325
4403
  expression;
4326
4404
  constructor(span, sourceSpan, expression) {
@@ -4359,6 +4437,18 @@ class SafeCall extends AST {
4359
4437
  return visitor.visitSafeCall(this, context);
4360
4438
  }
4361
4439
  }
4440
+ class TaggedTemplateLiteral extends AST {
4441
+ tag;
4442
+ template;
4443
+ constructor(span, sourceSpan, tag, template) {
4444
+ super(span, sourceSpan);
4445
+ this.tag = tag;
4446
+ this.template = template;
4447
+ }
4448
+ visit(visitor, context) {
4449
+ return visitor.visitTaggedTemplateLiteral(this, context);
4450
+ }
4451
+ }
4362
4452
  class TemplateLiteral extends AST {
4363
4453
  elements;
4364
4454
  expressions;
@@ -4503,6 +4593,9 @@ class RecursiveAstVisitor {
4503
4593
  visitTypeofExpression(ast, context) {
4504
4594
  this.visit(ast.expression, context);
4505
4595
  }
4596
+ visitVoidExpression(ast, context) {
4597
+ this.visit(ast.expression, context);
4598
+ }
4506
4599
  visitNonNullAssert(ast, context) {
4507
4600
  this.visit(ast.expression, context);
4508
4601
  }
@@ -4540,6 +4633,10 @@ class RecursiveAstVisitor {
4540
4633
  }
4541
4634
  }
4542
4635
  visitTemplateLiteralElement(ast, context) { }
4636
+ visitTaggedTemplateLiteral(ast, context) {
4637
+ this.visit(ast.tag, context);
4638
+ this.visit(ast.template, context);
4639
+ }
4543
4640
  // This is not part of the AstVisitor interface, just a helper method
4544
4641
  visitAll(asts, context) {
4545
4642
  for (const ast of asts) {
@@ -10246,6 +10343,9 @@ function transformExpressionsInExpression(expr, transform, flags) {
10246
10343
  else if (expr instanceof TypeofExpr) {
10247
10344
  expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
10248
10345
  }
10346
+ else if (expr instanceof VoidExpr) {
10347
+ expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
10348
+ }
10249
10349
  else if (expr instanceof WriteVarExpr) {
10250
10350
  expr.value = transformExpressionsInExpression(expr.value, transform, flags);
10251
10351
  }
@@ -10277,6 +10377,9 @@ function transformExpressionsInExpression(expr, transform, flags) {
10277
10377
  expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
10278
10378
  }
10279
10379
  }
10380
+ else if (expr instanceof ParenthesizedExpr) {
10381
+ expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
10382
+ }
10280
10383
  else if (expr instanceof ReadVarExpr ||
10281
10384
  expr instanceof ExternalExpr ||
10282
10385
  expr instanceof LiteralExpr) ;
@@ -11349,6 +11452,33 @@ function assignI18nSlotDependencies(job) {
11349
11452
  }
11350
11453
  }
11351
11454
 
11455
+ /**
11456
+ * Locates all of the elements defined in a creation block and outputs an op
11457
+ * that will expose their definition location in the DOM.
11458
+ */
11459
+ function attachSourceLocations(job) {
11460
+ if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
11461
+ return;
11462
+ }
11463
+ for (const unit of job.units) {
11464
+ const locations = [];
11465
+ for (const op of unit.create) {
11466
+ if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
11467
+ const start = op.startSourceSpan.start;
11468
+ locations.push({
11469
+ targetSlot: op.handle,
11470
+ offset: start.offset,
11471
+ line: start.line,
11472
+ column: start.col,
11473
+ });
11474
+ }
11475
+ }
11476
+ if (locations.length > 0) {
11477
+ unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
11478
+ }
11479
+ }
11480
+ }
11481
+
11352
11482
  /**
11353
11483
  * Gets a map of all elements in the given view by their xref id.
11354
11484
  */
@@ -11749,6 +11879,7 @@ const BINARY_OPERATORS$3 = new Map([
11749
11879
  ['<=', BinaryOperator.LowerEquals],
11750
11880
  ['-', BinaryOperator.Minus],
11751
11881
  ['%', BinaryOperator.Modulo],
11882
+ ['**', BinaryOperator.Exponentiation],
11752
11883
  ['*', BinaryOperator.Multiply],
11753
11884
  ['!=', BinaryOperator.NotEquals],
11754
11885
  ['!==', BinaryOperator.NotIdentical],
@@ -12038,29 +12169,6 @@ function convertI18nBindings(job) {
12038
12169
  }
12039
12170
  }
12040
12171
 
12041
- /**
12042
- * Resolve the dependency function of a deferred block.
12043
- */
12044
- function resolveDeferDepsFns(job) {
12045
- for (const unit of job.units) {
12046
- for (const op of unit.create) {
12047
- if (op.kind === OpKind.Defer) {
12048
- if (op.resolverFn !== null) {
12049
- continue;
12050
- }
12051
- if (op.ownResolverFn !== null) {
12052
- if (op.handle.slot === null) {
12053
- throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
12054
- }
12055
- const fullPathName = unit.fnName?.replace('_Template', '');
12056
- op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
12057
- /* Don't use unique names for TDB compatibility */ false);
12058
- }
12059
- }
12060
- }
12061
- }
12062
- }
12063
-
12064
12172
  /**
12065
12173
  * Create one helper context op per i18n block (including generate descending blocks).
12066
12174
  *
@@ -12803,6 +12911,27 @@ function generateAdvance(job) {
12803
12911
  }
12804
12912
  }
12805
12913
 
12914
+ /**
12915
+ * Replaces the `storeLet` ops with variables that can be
12916
+ * used to reference the value within the same view.
12917
+ */
12918
+ function generateLocalLetReferences(job) {
12919
+ for (const unit of job.units) {
12920
+ for (const op of unit.update) {
12921
+ if (op.kind !== OpKind.StoreLet) {
12922
+ continue;
12923
+ }
12924
+ const variable = {
12925
+ kind: SemanticVariableKind.Identifier,
12926
+ name: null,
12927
+ identifier: op.declaredName,
12928
+ local: true,
12929
+ };
12930
+ OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
12931
+ }
12932
+ }
12933
+ }
12934
+
12806
12935
  /**
12807
12936
  * Locate projection slots, populate the each component's `ngContentSelectors` literal field,
12808
12937
  * populate `project` arguments, and generate the required `projectionDef` instruction for the job's
@@ -17447,6 +17576,7 @@ const KEYWORDS = [
17447
17576
  'else',
17448
17577
  'this',
17449
17578
  'typeof',
17579
+ 'void',
17450
17580
  ];
17451
17581
  class Lexer {
17452
17582
  tokenize(text) {
@@ -17511,6 +17641,9 @@ class Token {
17511
17641
  isKeywordTypeof() {
17512
17642
  return this.type === TokenType.Keyword && this.strValue === 'typeof';
17513
17643
  }
17644
+ isKeywordVoid() {
17645
+ return this.type === TokenType.Keyword && this.strValue === 'void';
17646
+ }
17514
17647
  isError() {
17515
17648
  return this.type === TokenType.Error;
17516
17649
  }
@@ -17655,11 +17788,12 @@ class _Scanner {
17655
17788
  return this.scanPrivateIdentifier();
17656
17789
  case $PLUS:
17657
17790
  case $MINUS:
17658
- case $STAR:
17659
17791
  case $SLASH:
17660
17792
  case $PERCENT:
17661
17793
  case $CARET:
17662
17794
  return this.scanOperator(start, String.fromCharCode(peek));
17795
+ case $STAR:
17796
+ return this.scanComplexOperator(start, '*', $STAR, '*');
17663
17797
  case $QUESTION:
17664
17798
  return this.scanQuestion(start);
17665
17799
  case $LT:
@@ -18227,6 +18361,7 @@ class _ParseAST {
18227
18361
  parseFlags;
18228
18362
  errors;
18229
18363
  offset;
18364
+ lastUnary = null;
18230
18365
  rparensExpected = 0;
18231
18366
  rbracketsExpected = 0;
18232
18367
  rbracesExpected = 0;
@@ -18593,7 +18728,7 @@ class _ParseAST {
18593
18728
  parseMultiplicative() {
18594
18729
  // '*', '%', '/'
18595
18730
  const start = this.inputIndex;
18596
- let result = this.parsePrefix();
18731
+ let result = this.parseExponentiation();
18597
18732
  while (this.next.type == TokenType.Operator) {
18598
18733
  const operator = this.next.strValue;
18599
18734
  switch (operator) {
@@ -18601,7 +18736,7 @@ class _ParseAST {
18601
18736
  case '%':
18602
18737
  case '/':
18603
18738
  this.advance();
18604
- let right = this.parsePrefix();
18739
+ const right = this.parseExponentiation();
18605
18740
  result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
18606
18741
  continue;
18607
18742
  }
@@ -18609,6 +18744,23 @@ class _ParseAST {
18609
18744
  }
18610
18745
  return result;
18611
18746
  }
18747
+ parseExponentiation() {
18748
+ // '**'
18749
+ const start = this.inputIndex;
18750
+ let result = this.parsePrefix();
18751
+ while (this.next.type == TokenType.Operator && this.next.strValue === '**') {
18752
+ // This aligns with Javascript semantics which require any unary operator preceeding the
18753
+ // exponentiation operation to be explicitly grouped as either applying to the base or result
18754
+ // of the exponentiation operation.
18755
+ if (result === this.lastUnary) {
18756
+ this.error('Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence');
18757
+ }
18758
+ this.advance();
18759
+ const right = this.parseExponentiation();
18760
+ result = new Binary(this.span(start), this.sourceSpan(start), '**', result, right);
18761
+ }
18762
+ return result;
18763
+ }
18612
18764
  parsePrefix() {
18613
18765
  if (this.next.type == TokenType.Operator) {
18614
18766
  const start = this.inputIndex;
@@ -18618,22 +18770,28 @@ class _ParseAST {
18618
18770
  case '+':
18619
18771
  this.advance();
18620
18772
  result = this.parsePrefix();
18621
- return Unary.createPlus(this.span(start), this.sourceSpan(start), result);
18773
+ return (this.lastUnary = Unary.createPlus(this.span(start), this.sourceSpan(start), result));
18622
18774
  case '-':
18623
18775
  this.advance();
18624
18776
  result = this.parsePrefix();
18625
- return Unary.createMinus(this.span(start), this.sourceSpan(start), result);
18777
+ return (this.lastUnary = Unary.createMinus(this.span(start), this.sourceSpan(start), result));
18626
18778
  case '!':
18627
18779
  this.advance();
18628
18780
  result = this.parsePrefix();
18629
- return new PrefixNot(this.span(start), this.sourceSpan(start), result);
18781
+ return (this.lastUnary = new PrefixNot(this.span(start), this.sourceSpan(start), result));
18630
18782
  }
18631
18783
  }
18632
18784
  else if (this.next.isKeywordTypeof()) {
18633
18785
  this.advance();
18634
18786
  const start = this.inputIndex;
18635
18787
  let result = this.parsePrefix();
18636
- return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
18788
+ return (this.lastUnary = new TypeofExpression(this.span(start), this.sourceSpan(start), result));
18789
+ }
18790
+ else if (this.next.isKeywordVoid()) {
18791
+ this.advance();
18792
+ const start = this.inputIndex;
18793
+ let result = this.parsePrefix();
18794
+ return (this.lastUnary = new VoidExpression(this.span(start), this.sourceSpan(start), result));
18637
18795
  }
18638
18796
  return this.parseCallChain();
18639
18797
  }
@@ -18663,6 +18821,12 @@ class _ParseAST {
18663
18821
  else if (this.consumeOptionalOperator('!')) {
18664
18822
  result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
18665
18823
  }
18824
+ else if (this.next.isTemplateLiteralEnd()) {
18825
+ result = this.parseNoInterpolationTaggedTemplateLiteral(result, start);
18826
+ }
18827
+ else if (this.next.isTemplateLiteralPart()) {
18828
+ result = this.parseTaggedTemplateLiteral(result, start);
18829
+ }
18666
18830
  else {
18667
18831
  return result;
18668
18832
  }
@@ -18674,6 +18838,7 @@ class _ParseAST {
18674
18838
  this.rparensExpected++;
18675
18839
  const result = this.parsePipe();
18676
18840
  this.rparensExpected--;
18841
+ this.lastUnary = null;
18677
18842
  this.expectCharacter($RPAREN);
18678
18843
  return result;
18679
18844
  }
@@ -18716,7 +18881,7 @@ class _ParseAST {
18716
18881
  return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);
18717
18882
  }
18718
18883
  else if (this.next.isTemplateLiteralEnd()) {
18719
- return this.parseNoInterpolationTemplateLiteral(start);
18884
+ return this.parseNoInterpolationTemplateLiteral();
18720
18885
  }
18721
18886
  else if (this.next.isTemplateLiteralPart()) {
18722
18887
  return this.parseTemplateLiteral();
@@ -19046,17 +19211,25 @@ class _ParseAST {
19046
19211
  const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
19047
19212
  return new VariableBinding(sourceSpan, key, value);
19048
19213
  }
19049
- parseNoInterpolationTemplateLiteral(start) {
19214
+ parseNoInterpolationTaggedTemplateLiteral(tag, start) {
19215
+ const template = this.parseNoInterpolationTemplateLiteral();
19216
+ return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
19217
+ }
19218
+ parseNoInterpolationTemplateLiteral() {
19050
19219
  const text = this.next.strValue;
19051
19220
  this.advance();
19052
- const span = this.span(start);
19053
- const sourceSpan = this.sourceSpan(start);
19221
+ const span = this.span(this.inputIndex);
19222
+ const sourceSpan = this.sourceSpan(this.inputIndex);
19054
19223
  return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text)], []);
19055
19224
  }
19225
+ parseTaggedTemplateLiteral(tag, start) {
19226
+ const template = this.parseTemplateLiteral();
19227
+ return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
19228
+ }
19056
19229
  parseTemplateLiteral() {
19057
- const start = this.inputIndex;
19058
19230
  const elements = [];
19059
19231
  const expressions = [];
19232
+ const start = this.inputIndex;
19060
19233
  while (this.next !== EOF) {
19061
19234
  const token = this.next;
19062
19235
  if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
@@ -19297,6 +19470,9 @@ class SerializeExpressionVisitor {
19297
19470
  visitTypeofExpression(ast, context) {
19298
19471
  return `typeof ${ast.expression.visit(this, context)}`;
19299
19472
  }
19473
+ visitVoidExpression(ast, context) {
19474
+ return `void ${ast.expression.visit(this, context)}`;
19475
+ }
19300
19476
  visitASTWithSource(ast, context) {
19301
19477
  return ast.ast.visit(this, context);
19302
19478
  }
@@ -19314,6 +19490,9 @@ class SerializeExpressionVisitor {
19314
19490
  visitTemplateLiteralElement(ast, context) {
19315
19491
  return ast.text;
19316
19492
  }
19493
+ visitTaggedTemplateLiteral(ast, context) {
19494
+ return ast.tag.visit(this, context) + ast.template.visit(this, context);
19495
+ }
19317
19496
  }
19318
19497
  /** Zips the two input arrays into a single array of pairs of elements at the same index. */
19319
19498
  function zip(left, right) {
@@ -21863,30 +22042,6 @@ function disableBindings$1(job) {
21863
22042
  }
21864
22043
  }
21865
22044
 
21866
- /**
21867
- * Nullish coalescing expressions such as `a ?? b` have different semantics in Angular templates as
21868
- * compared to JavaScript. In particular, they default to `null` instead of `undefined`. Therefore,
21869
- * we replace them with ternary expressions, assigning temporaries as needed to avoid re-evaluating
21870
- * the same sub-expression multiple times.
21871
- */
21872
- function generateNullishCoalesceExpressions(job) {
21873
- for (const unit of job.units) {
21874
- for (const op of unit.ops()) {
21875
- transformExpressionsInOp(op, (expr) => {
21876
- if (!(expr instanceof BinaryOperatorExpr) ||
21877
- expr.operator !== BinaryOperator.NullishCoalesce) {
21878
- return expr;
21879
- }
21880
- const assignment = new AssignTemporaryExpr(expr.lhs.clone(), job.allocateXrefId());
21881
- const read = new ReadTemporaryExpr(assignment.xref);
21882
- // TODO: When not in compatibility mode for TemplateDefinitionBuilder, we can just emit
21883
- // `t != null` instead of including an undefined check as well.
21884
- return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, assignment, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, read, new LiteralExpr(undefined))), read.clone(), expr.rhs);
21885
- }, VisitorContextFlag.None);
21886
- }
21887
- }
21888
- }
21889
-
21890
22045
  function kindTest(kind) {
21891
22046
  return (op) => op.kind === kind;
21892
22047
  }
@@ -23405,6 +23560,33 @@ function removeI18nContexts(job) {
23405
23560
  }
23406
23561
  }
23407
23562
 
23563
+ /**
23564
+ * It's not allowed to access a `@let` declaration before it has been defined. This is enforced
23565
+ * already via template type checking, however it can trip some of the assertions in the pipeline.
23566
+ * E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
23567
+ * exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
23568
+ * confusing errors to users in the case where template type checking isn't running (e.g. in JIT
23569
+ * mode) this phase detects illegal forward references and replaces them with `undefined`.
23570
+ * Eventually users will see the proper error from the template type checker.
23571
+ */
23572
+ function removeIllegalLetReferences(job) {
23573
+ for (const unit of job.units) {
23574
+ for (const op of unit.update) {
23575
+ if (op.kind !== OpKind.Variable ||
23576
+ op.variable.kind !== SemanticVariableKind.Identifier ||
23577
+ !(op.initializer instanceof StoreLetExpr)) {
23578
+ continue;
23579
+ }
23580
+ const name = op.variable.identifier;
23581
+ let current = op;
23582
+ while (current && current.kind !== OpKind.ListEnd) {
23583
+ transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal$1(undefined) : expr, VisitorContextFlag.None);
23584
+ current = current.prev;
23585
+ }
23586
+ }
23587
+ }
23588
+ }
23589
+
23408
23590
  /**
23409
23591
  * i18nAttributes ops will be generated for each i18n attribute. However, not all i18n attribues
23410
23592
  * will contain dynamic content, and so some of these i18nAttributes ops may be unnecessary.
@@ -23430,6 +23612,57 @@ function removeUnusedI18nAttributesOps(job) {
23430
23612
  }
23431
23613
  }
23432
23614
 
23615
+ // TODO: create AST for parentheses when parsing, then we can remove the unnecessary ones instead of
23616
+ // adding them out of thin air. This should simplify the parsing and give us valid spans for the
23617
+ // parentheses.
23618
+ /**
23619
+ * In some cases we need to add parentheses to expressions for them to be considered valid
23620
+ * JavaScript. This phase adds parentheses to cover such cases. Currently these cases are:
23621
+ *
23622
+ * 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
23623
+ * valid JavaScript, but `(-2) ** 3` is.
23624
+ * 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need to
23625
+ * add parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
23626
+ * 3. Safe property access that has been down-leveled into a ternary expression needs parentheses
23627
+ * when used with nullish coalescing.
23628
+ */
23629
+ function requiredParentheses(job) {
23630
+ for (const unit of job.units) {
23631
+ for (const op of unit.ops()) {
23632
+ transformExpressionsInOp(op, (expr) => {
23633
+ if (expr instanceof BinaryOperatorExpr) {
23634
+ switch (expr.operator) {
23635
+ case BinaryOperator.Exponentiation:
23636
+ parenthesizeExponentiation(expr);
23637
+ break;
23638
+ case BinaryOperator.NullishCoalesce:
23639
+ parenthesizeNullishCoalescing(expr);
23640
+ break;
23641
+ }
23642
+ }
23643
+ return expr;
23644
+ }, VisitorContextFlag.None);
23645
+ }
23646
+ }
23647
+ }
23648
+ function parenthesizeExponentiation(expr) {
23649
+ if (expr.lhs instanceof UnaryOperatorExpr) {
23650
+ expr.lhs = new ParenthesizedExpr(expr.lhs);
23651
+ }
23652
+ }
23653
+ function parenthesizeNullishCoalescing(expr) {
23654
+ if (isLogicalAndOr(expr.lhs) || expr.lhs instanceof ConditionalExpr) {
23655
+ expr.lhs = new ParenthesizedExpr(expr.lhs);
23656
+ }
23657
+ if (isLogicalAndOr(expr.rhs) || expr.rhs instanceof ConditionalExpr) {
23658
+ expr.rhs = new ParenthesizedExpr(expr.rhs);
23659
+ }
23660
+ }
23661
+ function isLogicalAndOr(expr) {
23662
+ return (expr instanceof BinaryOperatorExpr &&
23663
+ (expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
23664
+ }
23665
+
23433
23666
  /**
23434
23667
  * Resolves `ir.ContextExpr` expressions (which represent embedded view or component contexts) to
23435
23668
  * either the `ctx` parameter to component functions (for the current view context) or to variables
@@ -23486,6 +23719,29 @@ function processLexicalScope$1(view, ops) {
23486
23719
  }
23487
23720
  }
23488
23721
 
23722
+ /**
23723
+ * Resolve the dependency function of a deferred block.
23724
+ */
23725
+ function resolveDeferDepsFns(job) {
23726
+ for (const unit of job.units) {
23727
+ for (const op of unit.create) {
23728
+ if (op.kind === OpKind.Defer) {
23729
+ if (op.resolverFn !== null) {
23730
+ continue;
23731
+ }
23732
+ if (op.ownResolverFn !== null) {
23733
+ if (op.handle.slot === null) {
23734
+ throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
23735
+ }
23736
+ const fullPathName = unit.fnName?.replace('_Template', '');
23737
+ op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
23738
+ /* Don't use unique names for TDB compatibility */ false);
23739
+ }
23740
+ }
23741
+ }
23742
+ }
23743
+ }
23744
+
23489
23745
  /**
23490
23746
  * Any variable inside a listener with the name `$event` will be transformed into a output lexical
23491
23747
  * read immediately, and does not participate in any of the normal logic for handling variables.
@@ -24062,39 +24318,6 @@ function getOnlySecurityContext(securityContext) {
24062
24318
  return securityContext;
24063
24319
  }
24064
24320
 
24065
- /**
24066
- * Transforms a `TwoWayBindingSet` expression into an expression that either
24067
- * sets a value through the `twoWayBindingSet` instruction or falls back to setting
24068
- * the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
24069
- * `ng.twoWayBindingSet(target, value) || (target = value)`.
24070
- */
24071
- function transformTwoWayBindingSet(job) {
24072
- for (const unit of job.units) {
24073
- for (const op of unit.create) {
24074
- if (op.kind === OpKind.TwoWayListener) {
24075
- transformExpressionsInOp(op, (expr) => {
24076
- if (!(expr instanceof TwoWayBindingSetExpr)) {
24077
- return expr;
24078
- }
24079
- const { target, value } = expr;
24080
- if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
24081
- return twoWayBindingSet(target, value).or(target.set(value));
24082
- }
24083
- // ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
24084
- // to a local template variable. This appears to be the case at the time of writing.
24085
- // If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
24086
- // since the fallback would be attempting to write into a constant. Invalid usages will be
24087
- // flagged during template type checking.
24088
- if (target instanceof ReadVariableExpr) {
24089
- return twoWayBindingSet(target, value);
24090
- }
24091
- throw new Error(`Unsupported expression in two-way action binding.`);
24092
- }, VisitorContextFlag.InChildOperation);
24093
- }
24094
- }
24095
- }
24096
- }
24097
-
24098
24321
  /**
24099
24322
  * When inside of a listener, we may need access to one or more enclosing views. Therefore, each
24100
24323
  * view should save the current view, and each listener must have the ability to restore the
@@ -24204,6 +24427,40 @@ function allocateSlots(job) {
24204
24427
  }
24205
24428
  }
24206
24429
 
24430
+ /*!
24431
+ * @license
24432
+ * Copyright Google LLC All Rights Reserved.
24433
+ *
24434
+ * Use of this source code is governed by an MIT-style license that can be
24435
+ * found in the LICENSE file at https://angular.dev/license
24436
+ */
24437
+ /**
24438
+ * Removes any `storeLet` calls that aren't referenced outside of the current view.
24439
+ */
24440
+ function optimizeStoreLet(job) {
24441
+ const letUsedExternally = new Set();
24442
+ // Since `@let` declarations can be referenced in child views, both in
24443
+ // the creation block (via listeners) and in the update block, we have
24444
+ // to look through all the ops to find the references.
24445
+ for (const unit of job.units) {
24446
+ for (const op of unit.ops()) {
24447
+ visitExpressionsInOp(op, (expr) => {
24448
+ if (expr instanceof ContextLetReferenceExpr) {
24449
+ letUsedExternally.add(expr.target);
24450
+ }
24451
+ });
24452
+ }
24453
+ }
24454
+ // TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
24455
+ for (const unit of job.units) {
24456
+ for (const op of unit.update) {
24457
+ transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
24458
+ ? expression.value
24459
+ : expression, VisitorContextFlag.None);
24460
+ }
24461
+ }
24462
+ }
24463
+
24207
24464
  /**
24208
24465
  * Transforms special-case bindings with 'style' or 'class' in their names. Must run before the
24209
24466
  * main binding specialization pass.
@@ -24431,6 +24688,39 @@ function generateTrackVariables(job) {
24431
24688
  }
24432
24689
  }
24433
24690
 
24691
+ /**
24692
+ * Transforms a `TwoWayBindingSet` expression into an expression that either
24693
+ * sets a value through the `twoWayBindingSet` instruction or falls back to setting
24694
+ * the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
24695
+ * `ng.twoWayBindingSet(target, value) || (target = value)`.
24696
+ */
24697
+ function transformTwoWayBindingSet(job) {
24698
+ for (const unit of job.units) {
24699
+ for (const op of unit.create) {
24700
+ if (op.kind === OpKind.TwoWayListener) {
24701
+ transformExpressionsInOp(op, (expr) => {
24702
+ if (!(expr instanceof TwoWayBindingSetExpr)) {
24703
+ return expr;
24704
+ }
24705
+ const { target, value } = expr;
24706
+ if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
24707
+ return twoWayBindingSet(target, value).or(target.set(value));
24708
+ }
24709
+ // ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
24710
+ // to a local template variable. This appears to be the case at the time of writing.
24711
+ // If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
24712
+ // since the fallback would be attempting to write into a constant. Invalid usages will be
24713
+ // flagged during template type checking.
24714
+ if (target instanceof ReadVariableExpr) {
24715
+ return twoWayBindingSet(target, value);
24716
+ }
24717
+ throw new Error(`Unsupported expression in two-way action binding.`);
24718
+ }, VisitorContextFlag.InChildOperation);
24719
+ }
24720
+ }
24721
+ }
24722
+ }
24723
+
24434
24724
  /**
24435
24725
  * Counts the number of variable slots used within each view, and stores that on the view itself, as
24436
24726
  * well as propagates it to the `ir.TemplateOp` for embedded views.
@@ -25030,115 +25320,6 @@ function wrapI18nIcus(job) {
25030
25320
  }
25031
25321
  }
25032
25322
 
25033
- /*!
25034
- * @license
25035
- * Copyright Google LLC All Rights Reserved.
25036
- *
25037
- * Use of this source code is governed by an MIT-style license that can be
25038
- * found in the LICENSE file at https://angular.dev/license
25039
- */
25040
- /**
25041
- * Removes any `storeLet` calls that aren't referenced outside of the current view.
25042
- */
25043
- function optimizeStoreLet(job) {
25044
- const letUsedExternally = new Set();
25045
- // Since `@let` declarations can be referenced in child views, both in
25046
- // the creation block (via listeners) and in the update block, we have
25047
- // to look through all the ops to find the references.
25048
- for (const unit of job.units) {
25049
- for (const op of unit.ops()) {
25050
- visitExpressionsInOp(op, (expr) => {
25051
- if (expr instanceof ContextLetReferenceExpr) {
25052
- letUsedExternally.add(expr.target);
25053
- }
25054
- });
25055
- }
25056
- }
25057
- // TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
25058
- for (const unit of job.units) {
25059
- for (const op of unit.update) {
25060
- transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
25061
- ? expression.value
25062
- : expression, VisitorContextFlag.None);
25063
- }
25064
- }
25065
- }
25066
-
25067
- /**
25068
- * It's not allowed to access a `@let` declaration before it has been defined. This is enforced
25069
- * already via template type checking, however it can trip some of the assertions in the pipeline.
25070
- * E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
25071
- * exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
25072
- * confusing errors to users in the case where template type checking isn't running (e.g. in JIT
25073
- * mode) this phase detects illegal forward references and replaces them with `undefined`.
25074
- * Eventually users will see the proper error from the template type checker.
25075
- */
25076
- function removeIllegalLetReferences(job) {
25077
- for (const unit of job.units) {
25078
- for (const op of unit.update) {
25079
- if (op.kind !== OpKind.Variable ||
25080
- op.variable.kind !== SemanticVariableKind.Identifier ||
25081
- !(op.initializer instanceof StoreLetExpr)) {
25082
- continue;
25083
- }
25084
- const name = op.variable.identifier;
25085
- let current = op;
25086
- while (current && current.kind !== OpKind.ListEnd) {
25087
- transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal$1(undefined) : expr, VisitorContextFlag.None);
25088
- current = current.prev;
25089
- }
25090
- }
25091
- }
25092
- }
25093
-
25094
- /**
25095
- * Replaces the `storeLet` ops with variables that can be
25096
- * used to reference the value within the same view.
25097
- */
25098
- function generateLocalLetReferences(job) {
25099
- for (const unit of job.units) {
25100
- for (const op of unit.update) {
25101
- if (op.kind !== OpKind.StoreLet) {
25102
- continue;
25103
- }
25104
- const variable = {
25105
- kind: SemanticVariableKind.Identifier,
25106
- name: null,
25107
- identifier: op.declaredName,
25108
- local: true,
25109
- };
25110
- OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
25111
- }
25112
- }
25113
- }
25114
-
25115
- /**
25116
- * Locates all of the elements defined in a creation block and outputs an op
25117
- * that will expose their definition location in the DOM.
25118
- */
25119
- function attachSourceLocations(job) {
25120
- if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
25121
- return;
25122
- }
25123
- for (const unit of job.units) {
25124
- const locations = [];
25125
- for (const op of unit.create) {
25126
- if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
25127
- const start = op.startSourceSpan.start;
25128
- locations.push({
25129
- targetSlot: op.handle,
25130
- offset: start.offset,
25131
- line: start.line,
25132
- column: start.col,
25133
- });
25134
- }
25135
- }
25136
- if (locations.length > 0) {
25137
- unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
25138
- }
25139
- }
25140
- }
25141
-
25142
25323
  /**
25143
25324
  *
25144
25325
  * @license
@@ -25187,8 +25368,8 @@ const phases = [
25187
25368
  { kind: CompilationJobKind.Both, fn: resolveContexts },
25188
25369
  { kind: CompilationJobKind.Both, fn: resolveSanitizers },
25189
25370
  { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
25190
- { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
25191
25371
  { kind: CompilationJobKind.Both, fn: expandSafeReads },
25372
+ { kind: CompilationJobKind.Both, fn: requiredParentheses },
25192
25373
  { kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
25193
25374
  { kind: CompilationJobKind.Both, fn: optimizeVariables },
25194
25375
  { kind: CompilationJobKind.Both, fn: optimizeStoreLet },
@@ -25978,15 +26159,24 @@ function convertAst(ast, job, baseSourceSpan) {
25978
26159
  else if (ast instanceof TypeofExpression) {
25979
26160
  return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
25980
26161
  }
26162
+ else if (ast instanceof VoidExpression) {
26163
+ return new VoidExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
26164
+ }
25981
26165
  else if (ast instanceof TemplateLiteral) {
25982
- return new TemplateLiteralExpr(ast.elements.map((el) => {
25983
- return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
25984
- }), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
26166
+ return convertTemplateLiteral(ast, job, baseSourceSpan);
26167
+ }
26168
+ else if (ast instanceof TaggedTemplateLiteral) {
26169
+ return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
25985
26170
  }
25986
26171
  else {
25987
26172
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
25988
26173
  }
25989
26174
  }
26175
+ function convertTemplateLiteral(ast, job, baseSourceSpan) {
26176
+ return new TemplateLiteralExpr(ast.elements.map((el) => {
26177
+ return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
26178
+ }), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
26179
+ }
25990
26180
  function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
25991
26181
  let expression;
25992
26182
  if (value instanceof Interpolation$1) {
@@ -26378,7 +26568,7 @@ function getTemplateSourceLocationsEnabled() {
26378
26568
 
26379
26569
  // if (rf & flags) { .. }
26380
26570
  function renderFlagCheckIfStmt(flags, statements) {
26381
- return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal$1(flags), null, false), statements);
26571
+ return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal$1(flags), null), statements);
26382
26572
  }
26383
26573
  /**
26384
26574
  * Translates query flags into `TQueryFlags` type in
@@ -30717,13 +30907,6 @@ function publishFacade(global) {
30717
30907
  ng.ɵcompilerFacade = new CompilerFacadeImpl();
30718
30908
  }
30719
30909
 
30720
- /**
30721
- * @module
30722
- * @description
30723
- * Entry point for all public APIs of the compiler package.
30724
- */
30725
- new Version('19.2.1');
30726
-
30727
30910
  const _I18N_ATTR = 'i18n';
30728
30911
  const _I18N_ATTR_PREFIX = 'i18n-';
30729
30912
  const _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
@@ -31200,6 +31383,13 @@ var FactoryTarget;
31200
31383
  FactoryTarget[FactoryTarget["NgModule"] = 4] = "NgModule";
31201
31384
  })(FactoryTarget || (FactoryTarget = {}));
31202
31385
 
31386
+ /**
31387
+ * @module
31388
+ * @description
31389
+ * Entry point for all public APIs of the compiler package.
31390
+ */
31391
+ new Version('20.0.0-next.1');
31392
+
31203
31393
  //////////////////////////////////////
31204
31394
  // This file only reexports content of the `src` folder. Keep it that way.
31205
31395
  // This function call has a global side effects and publishes the compiler into global namespace for
@@ -32130,7 +32320,7 @@ class NodeJSPathManipulation {
32130
32320
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
32131
32321
  // CommonJS/ESM interop for determining the current file name and containing dir.
32132
32322
  const isCommonJS = typeof __filename !== 'undefined';
32133
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-89987c98.js', document.baseURI).href));
32323
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-af521da6.js', document.baseURI).href));
32134
32324
  const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
32135
32325
  /**
32136
32326
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
@@ -36632,6 +36822,7 @@ const BINARY_OPERATORS$1 = new Map([
36632
36822
  [BinaryOperator.Or, '||'],
36633
36823
  [BinaryOperator.Plus, '+'],
36634
36824
  [BinaryOperator.NullishCoalesce, '??'],
36825
+ [BinaryOperator.Exponentiation, '**'],
36635
36826
  ]);
36636
36827
  class ExpressionTranslatorVisitor {
36637
36828
  factory;
@@ -36876,12 +37067,18 @@ class ExpressionTranslatorVisitor {
36876
37067
  visitTypeofExpr(ast, context) {
36877
37068
  return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
36878
37069
  }
37070
+ visitVoidExpr(ast, context) {
37071
+ return this.factory.createVoidExpression(ast.expr.visitExpression(this, context));
37072
+ }
36879
37073
  visitUnaryOperatorExpr(ast, context) {
36880
37074
  if (!UNARY_OPERATORS$1.has(ast.operator)) {
36881
37075
  throw new Error(`Unknown unary operator: ${UnaryOperator[ast.operator]}`);
36882
37076
  }
36883
37077
  return this.factory.createUnaryExpression(UNARY_OPERATORS$1.get(ast.operator), ast.expr.visitExpression(this, context));
36884
37078
  }
37079
+ visitParenthesizedExpr(ast, context) {
37080
+ return this.factory.createParenthesizedExpression(ast.expr.visitExpression(this, context));
37081
+ }
36885
37082
  visitStatements(statements, context) {
36886
37083
  return statements
36887
37084
  .map((stmt) => stmt.visitStatement(this, context))
@@ -37292,6 +37489,12 @@ class TypeTranslatorVisitor {
37292
37489
  }
37293
37490
  return ts__default["default"].factory.createTypeQueryNode(typeNode.typeName);
37294
37491
  }
37492
+ visitVoidExpr(ast, context) {
37493
+ throw new Error('Method not implemented.');
37494
+ }
37495
+ visitParenthesizedExpr(ast, context) {
37496
+ throw new Error('Method not implemented.');
37497
+ }
37295
37498
  translateType(type, context) {
37296
37499
  const typeNode = type.visitType(this, context);
37297
37500
  if (!ts__default["default"].isTypeNode(typeNode)) {
@@ -37363,6 +37566,7 @@ const BINARY_OPERATORS = {
37363
37566
  '-': ts__default["default"].SyntaxKind.MinusToken,
37364
37567
  '%': ts__default["default"].SyntaxKind.PercentToken,
37365
37568
  '*': ts__default["default"].SyntaxKind.AsteriskToken,
37569
+ '**': ts__default["default"].SyntaxKind.AsteriskAsteriskToken,
37366
37570
  '!=': ts__default["default"].SyntaxKind.ExclamationEqualsToken,
37367
37571
  '!==': ts__default["default"].SyntaxKind.ExclamationEqualsEqualsToken,
37368
37572
  '||': ts__default["default"].SyntaxKind.BarBarToken,
@@ -37502,6 +37706,7 @@ class TypeScriptAstFactory {
37502
37706
  }
37503
37707
  createThrowStatement = ts__default["default"].factory.createThrowStatement;
37504
37708
  createTypeOfExpression = ts__default["default"].factory.createTypeOfExpression;
37709
+ createVoidExpression = ts__default["default"].factory.createVoidExpression;
37505
37710
  createUnaryExpression(operator, operand) {
37506
37711
  return ts__default["default"].factory.createPrefixUnaryExpression(UNARY_OPERATORS[operator], operand);
37507
37712
  }
@@ -41233,6 +41438,7 @@ const BINARY_OPS = new Map([
41233
41438
  ['==', ts__default["default"].SyntaxKind.EqualsEqualsToken],
41234
41439
  ['===', ts__default["default"].SyntaxKind.EqualsEqualsEqualsToken],
41235
41440
  ['*', ts__default["default"].SyntaxKind.AsteriskToken],
41441
+ ['**', ts__default["default"].SyntaxKind.AsteriskAsteriskToken],
41236
41442
  ['/', ts__default["default"].SyntaxKind.SlashToken],
41237
41443
  ['%', ts__default["default"].SyntaxKind.PercentToken],
41238
41444
  ['!=', ts__default["default"].SyntaxKind.ExclamationEqualsToken],
@@ -41411,6 +41617,12 @@ class AstTranslator {
41411
41617
  addParseSpanInfo(node, ast.sourceSpan);
41412
41618
  return node;
41413
41619
  }
41620
+ visitVoidExpression(ast) {
41621
+ const expression = wrapForDiagnostics(this.translate(ast.expression));
41622
+ const node = ts__default["default"].factory.createVoidExpression(expression);
41623
+ addParseSpanInfo(node, ast.sourceSpan);
41624
+ return node;
41625
+ }
41414
41626
  visitPropertyRead(ast) {
41415
41627
  // This is a normal property read - convert the receiver to an expression and emit the correct
41416
41628
  // TypeScript expression to read the property.
@@ -41562,6 +41774,9 @@ class AstTranslator {
41562
41774
  visitTemplateLiteralElement(ast, context) {
41563
41775
  throw new Error('Method not implemented');
41564
41776
  }
41777
+ visitTaggedTemplateLiteral(ast) {
41778
+ return ts__default["default"].factory.createTaggedTemplateExpression(this.translate(ast.tag), undefined, this.visitTemplateLiteral(ast.template));
41779
+ }
41565
41780
  convertToSafeCall(ast, expr, args) {
41566
41781
  if (this.config.strictSafeNavigationTypes) {
41567
41782
  // "a?.method(...)" becomes (0 as any ? a!.method(...) : undefined)
@@ -41646,6 +41861,9 @@ class VeSafeLhsInferenceBugDetector {
41646
41861
  visitTypeofExpression(ast) {
41647
41862
  return ast.expression.visit(this);
41648
41863
  }
41864
+ visitVoidExpression(ast) {
41865
+ return ast.expression.visit(this);
41866
+ }
41649
41867
  visitNonNullAssert(ast) {
41650
41868
  return ast.expression.visit(this);
41651
41869
  }
@@ -41667,6 +41885,9 @@ class VeSafeLhsInferenceBugDetector {
41667
41885
  visitTemplateLiteralElement(ast, context) {
41668
41886
  return false;
41669
41887
  }
41888
+ visitTaggedTemplateLiteral(ast, context) {
41889
+ return false;
41890
+ }
41670
41891
  }
41671
41892
 
41672
41893
  /**