@angular/core 20.1.0-next.2 → 20.1.0-rc.0

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 (76) hide show
  1. package/{api.d-Dwpmmn5j.d.ts → api.d.d.ts} +2 -2
  2. package/{chrome_dev_tools_performance.d-Dk_7kdX9.d.ts → chrome_dev_tools_performance.d.d.ts} +4 -4
  3. package/{discovery.d-AiW64LSq.d.ts → discovery.d.d.ts} +10 -5
  4. package/{event_dispatcher.d-BReQpZfC.d.ts → event_dispatcher.d.d.ts} +1 -1
  5. package/fesm2022/{attribute-BWp59EjE.mjs → attribute.mjs} +2 -2
  6. package/fesm2022/attribute.mjs.map +1 -0
  7. package/fesm2022/core.mjs +23 -15
  8. package/fesm2022/core.mjs.map +1 -1
  9. package/fesm2022/{debug_node-BFi6TVHr.mjs → debug_node.mjs} +240 -17
  10. package/fesm2022/debug_node.mjs.map +1 -0
  11. package/fesm2022/not_found.mjs +56 -0
  12. package/fesm2022/not_found.mjs.map +1 -0
  13. package/fesm2022/primitives/di.mjs +13 -36
  14. package/fesm2022/primitives/di.mjs.map +1 -1
  15. package/fesm2022/primitives/event-dispatch.mjs +2 -2
  16. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  17. package/fesm2022/primitives/signals.mjs +5 -5
  18. package/fesm2022/primitives/signals.mjs.map +1 -1
  19. package/fesm2022/{resource-BwChsGJq.mjs → resource.mjs} +12 -8
  20. package/fesm2022/resource.mjs.map +1 -0
  21. package/fesm2022/{root_effect_scheduler-BkoRKl64.mjs → root_effect_scheduler.mjs} +14 -7
  22. package/fesm2022/root_effect_scheduler.mjs.map +1 -0
  23. package/fesm2022/rxjs-interop.mjs +6 -6
  24. package/fesm2022/rxjs-interop.mjs.map +1 -1
  25. package/fesm2022/{signal-nCiHhWf6.mjs → signal.mjs} +2 -2
  26. package/fesm2022/signal.mjs.map +1 -0
  27. package/fesm2022/testing.mjs +143 -54
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/fesm2022/{untracked-DmD_2MlC.mjs → untracked.mjs} +3 -3
  30. package/fesm2022/untracked.mjs.map +1 -0
  31. package/fesm2022/{weak_ref-BaIq-pgY.mjs → weak_ref.mjs} +2 -2
  32. package/fesm2022/weak_ref.mjs.map +1 -0
  33. package/{graph.d-BcIOep_B.d.ts → graph.d.d.ts} +1 -1
  34. package/index.d.ts +106 -18
  35. package/package.json +2 -2
  36. package/primitives/di/index.d.ts +12 -2
  37. package/primitives/event-dispatch/index.d.ts +3 -3
  38. package/primitives/signals/index.d.ts +6 -6
  39. package/rxjs-interop/index.d.ts +5 -5
  40. package/schematics/bundles/{apply_import_manager-BsIRDO9W.cjs → apply_import_manager-DEMoyu96.cjs} +3 -3
  41. package/schematics/bundles/{checker-CY7a8ko8.cjs → checker-CwuJOWZI.cjs} +694 -459
  42. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  43. package/schematics/bundles/{compiler_host-DNYQkH4l.cjs → compiler_host-B1N_OYoF.cjs} +2 -2
  44. package/schematics/bundles/control-flow-migration.cjs +3 -3
  45. package/schematics/bundles/document-core.cjs +5 -5
  46. package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
  47. package/schematics/bundles/{index-BUgQDm-J.cjs → index-CmuNlSML.cjs} +49 -34
  48. package/schematics/bundles/{index-BJ3PYYwQ.cjs → index-DPxKO2pR.cjs} +4 -4
  49. package/schematics/bundles/inject-flags.cjs +5 -5
  50. package/schematics/bundles/inject-migration.cjs +3 -3
  51. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  52. package/schematics/bundles/{migrate_ts_type_references-MBd4NBjn.cjs → migrate_ts_type_references-Da3yLjVM.cjs} +27 -5
  53. package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
  54. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  55. package/schematics/bundles/output-migration.cjs +6 -6
  56. package/schematics/bundles/{project_paths-C5Df24y1.cjs → project_paths-86Qe1BQQ.cjs} +3 -3
  57. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
  58. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  59. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  60. package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
  61. package/schematics/bundles/signal-input-migration.cjs +7 -7
  62. package/schematics/bundles/signal-queries-migration.cjs +7 -7
  63. package/schematics/bundles/signals.cjs +7 -7
  64. package/schematics/bundles/standalone-migration.cjs +4 -4
  65. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  66. package/schematics/bundles/test-bed-get.cjs +4 -4
  67. package/{signal.d-BcmOdASA.d.ts → signal.d.d.ts} +2 -2
  68. package/testing/index.d.ts +73 -6
  69. package/{weak_ref.d-eGOEP9S1.d.ts → weak_ref.d.d.ts} +1 -1
  70. package/fesm2022/attribute-BWp59EjE.mjs.map +0 -1
  71. package/fesm2022/debug_node-BFi6TVHr.mjs.map +0 -1
  72. package/fesm2022/resource-BwChsGJq.mjs.map +0 -1
  73. package/fesm2022/root_effect_scheduler-BkoRKl64.mjs.map +0 -1
  74. package/fesm2022/signal-nCiHhWf6.mjs.map +0 -1
  75. package/fesm2022/untracked-DmD_2MlC.mjs.map +0 -1
  76. package/fesm2022/weak_ref-BaIq-pgY.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.1.0-next.2
3
+ * @license Angular v20.1.0-rc.0
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -955,6 +955,15 @@ var BinaryOperator;
955
955
  BinaryOperator[BinaryOperator["NullishCoalesce"] = 18] = "NullishCoalesce";
956
956
  BinaryOperator[BinaryOperator["Exponentiation"] = 19] = "Exponentiation";
957
957
  BinaryOperator[BinaryOperator["In"] = 20] = "In";
958
+ BinaryOperator[BinaryOperator["AdditionAssignment"] = 21] = "AdditionAssignment";
959
+ BinaryOperator[BinaryOperator["SubtractionAssignment"] = 22] = "SubtractionAssignment";
960
+ BinaryOperator[BinaryOperator["MultiplicationAssignment"] = 23] = "MultiplicationAssignment";
961
+ BinaryOperator[BinaryOperator["DivisionAssignment"] = 24] = "DivisionAssignment";
962
+ BinaryOperator[BinaryOperator["RemainderAssignment"] = 25] = "RemainderAssignment";
963
+ BinaryOperator[BinaryOperator["ExponentiationAssignment"] = 26] = "ExponentiationAssignment";
964
+ BinaryOperator[BinaryOperator["AndAssignment"] = 27] = "AndAssignment";
965
+ BinaryOperator[BinaryOperator["OrAssignment"] = 28] = "OrAssignment";
966
+ BinaryOperator[BinaryOperator["NullishCoalesceAssignment"] = 29] = "NullishCoalesceAssignment";
958
967
  })(BinaryOperator || (BinaryOperator = {}));
959
968
  function nullSafeIsEquivalent(base, other) {
960
969
  if (base == null || other == null) {
@@ -1674,6 +1683,19 @@ class BinaryOperatorExpr extends Expression {
1674
1683
  clone() {
1675
1684
  return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
1676
1685
  }
1686
+ isAssignment() {
1687
+ const op = this.operator;
1688
+ return (op === BinaryOperator.Assign ||
1689
+ op === BinaryOperator.AdditionAssignment ||
1690
+ op === BinaryOperator.SubtractionAssignment ||
1691
+ op === BinaryOperator.MultiplicationAssignment ||
1692
+ op === BinaryOperator.DivisionAssignment ||
1693
+ op === BinaryOperator.RemainderAssignment ||
1694
+ op === BinaryOperator.ExponentiationAssignment ||
1695
+ op === BinaryOperator.AndAssignment ||
1696
+ op === BinaryOperator.OrAssignment ||
1697
+ op === BinaryOperator.NullishCoalesceAssignment);
1698
+ }
1677
1699
  }
1678
1700
  class ReadPropExpr extends Expression {
1679
1701
  receiver;
@@ -2476,6 +2498,23 @@ class Identifiers {
2476
2498
  static element = { name: 'ɵɵelement', moduleName: CORE };
2477
2499
  static elementStart = { name: 'ɵɵelementStart', moduleName: CORE };
2478
2500
  static elementEnd = { name: 'ɵɵelementEnd', moduleName: CORE };
2501
+ static domElement = { name: 'ɵɵdomElement', moduleName: CORE };
2502
+ static domElementStart = { name: 'ɵɵdomElementStart', moduleName: CORE };
2503
+ static domElementEnd = { name: 'ɵɵdomElementEnd', moduleName: CORE };
2504
+ static domElementContainer = {
2505
+ name: 'ɵɵdomElementContainer',
2506
+ moduleName: CORE,
2507
+ };
2508
+ static domElementContainerStart = {
2509
+ name: 'ɵɵdomElementContainerStart',
2510
+ moduleName: CORE,
2511
+ };
2512
+ static domElementContainerEnd = {
2513
+ name: 'ɵɵdomElementContainerEnd',
2514
+ moduleName: CORE,
2515
+ };
2516
+ static domTemplate = { name: 'ɵɵdomTemplate', moduleName: CORE };
2517
+ static domListener = { name: 'ɵɵdomListener', moduleName: CORE };
2479
2518
  static advance = { name: 'ɵɵadvance', moduleName: CORE };
2480
2519
  static syntheticHostProperty = {
2481
2520
  name: 'ɵɵsyntheticHostProperty',
@@ -3083,6 +3122,38 @@ class _EmittedLine {
3083
3122
  this.indent = indent;
3084
3123
  }
3085
3124
  }
3125
+ const BINARY_OPERATORS$4 = new Map([
3126
+ [BinaryOperator.And, '&&'],
3127
+ [BinaryOperator.Bigger, '>'],
3128
+ [BinaryOperator.BiggerEquals, '>='],
3129
+ [BinaryOperator.BitwiseOr, '|'],
3130
+ [BinaryOperator.BitwiseAnd, '&'],
3131
+ [BinaryOperator.Divide, '/'],
3132
+ [BinaryOperator.Assign, '='],
3133
+ [BinaryOperator.Equals, '=='],
3134
+ [BinaryOperator.Identical, '==='],
3135
+ [BinaryOperator.Lower, '<'],
3136
+ [BinaryOperator.LowerEquals, '<='],
3137
+ [BinaryOperator.Minus, '-'],
3138
+ [BinaryOperator.Modulo, '%'],
3139
+ [BinaryOperator.Exponentiation, '**'],
3140
+ [BinaryOperator.Multiply, '*'],
3141
+ [BinaryOperator.NotEquals, '!='],
3142
+ [BinaryOperator.NotIdentical, '!=='],
3143
+ [BinaryOperator.NullishCoalesce, '??'],
3144
+ [BinaryOperator.Or, '||'],
3145
+ [BinaryOperator.Plus, '+'],
3146
+ [BinaryOperator.In, 'in'],
3147
+ [BinaryOperator.AdditionAssignment, '+='],
3148
+ [BinaryOperator.SubtractionAssignment, '-='],
3149
+ [BinaryOperator.MultiplicationAssignment, '*='],
3150
+ [BinaryOperator.DivisionAssignment, '/='],
3151
+ [BinaryOperator.RemainderAssignment, '%='],
3152
+ [BinaryOperator.ExponentiationAssignment, '**='],
3153
+ [BinaryOperator.AndAssignment, '&&='],
3154
+ [BinaryOperator.OrAssignment, '||='],
3155
+ [BinaryOperator.NullishCoalesceAssignment, '??='],
3156
+ ]);
3086
3157
  class EmitterVisitorContext {
3087
3158
  _indent;
3088
3159
  static createRoot() {
@@ -3405,79 +3476,15 @@ class AbstractEmitterVisitor {
3405
3476
  return null;
3406
3477
  }
3407
3478
  visitBinaryOperatorExpr(ast, ctx) {
3408
- let opStr;
3409
- switch (ast.operator) {
3410
- case BinaryOperator.Assign:
3411
- opStr = '=';
3412
- break;
3413
- case BinaryOperator.Equals:
3414
- opStr = '==';
3415
- break;
3416
- case BinaryOperator.Identical:
3417
- opStr = '===';
3418
- break;
3419
- case BinaryOperator.NotEquals:
3420
- opStr = '!=';
3421
- break;
3422
- case BinaryOperator.NotIdentical:
3423
- opStr = '!==';
3424
- break;
3425
- case BinaryOperator.And:
3426
- opStr = '&&';
3427
- break;
3428
- case BinaryOperator.BitwiseOr:
3429
- opStr = '|';
3430
- break;
3431
- case BinaryOperator.BitwiseAnd:
3432
- opStr = '&';
3433
- break;
3434
- case BinaryOperator.Or:
3435
- opStr = '||';
3436
- break;
3437
- case BinaryOperator.Plus:
3438
- opStr = '+';
3439
- break;
3440
- case BinaryOperator.Minus:
3441
- opStr = '-';
3442
- break;
3443
- case BinaryOperator.Divide:
3444
- opStr = '/';
3445
- break;
3446
- case BinaryOperator.Multiply:
3447
- opStr = '*';
3448
- break;
3449
- case BinaryOperator.Modulo:
3450
- opStr = '%';
3451
- break;
3452
- case BinaryOperator.Exponentiation:
3453
- opStr = '**';
3454
- break;
3455
- case BinaryOperator.Lower:
3456
- opStr = '<';
3457
- break;
3458
- case BinaryOperator.LowerEquals:
3459
- opStr = '<=';
3460
- break;
3461
- case BinaryOperator.Bigger:
3462
- opStr = '>';
3463
- break;
3464
- case BinaryOperator.BiggerEquals:
3465
- opStr = '>=';
3466
- break;
3467
- case BinaryOperator.NullishCoalesce:
3468
- opStr = '??';
3469
- break;
3470
- case BinaryOperator.In:
3471
- opStr = 'in';
3472
- break;
3473
- default:
3474
- throw new Error(`Unknown operator ${ast.operator}`);
3479
+ const operator = BINARY_OPERATORS$4.get(ast.operator);
3480
+ if (!operator) {
3481
+ throw new Error(`Unknown operator ${ast.operator}`);
3475
3482
  }
3476
3483
  const parens = ast !== this.lastIfCondition;
3477
3484
  if (parens)
3478
3485
  ctx.print(ast, `(`);
3479
3486
  ast.lhs.visitExpression(this, ctx);
3480
- ctx.print(ast, ` ${opStr} `);
3487
+ ctx.print(ast, ` ${operator} `);
3481
3488
  ast.rhs.visitExpression(this, ctx);
3482
3489
  if (parens)
3483
3490
  ctx.print(ast, `)`);
@@ -3842,18 +3849,6 @@ function getInjectFn(target) {
3842
3849
  }
3843
3850
  }
3844
3851
 
3845
- class ParserError {
3846
- input;
3847
- errLocation;
3848
- ctxLocation;
3849
- message;
3850
- constructor(message, input, errLocation, ctxLocation) {
3851
- this.input = input;
3852
- this.errLocation = errLocation;
3853
- this.ctxLocation = ctxLocation;
3854
- this.message = `Parser Error: ${message} ${errLocation} [${input}] in ${ctxLocation}`;
3855
- }
3856
- }
3857
3852
  class ParseSpan {
3858
3853
  start;
3859
3854
  end;
@@ -4072,6 +4067,18 @@ class Binary extends AST {
4072
4067
  visit(visitor, context = null) {
4073
4068
  return visitor.visitBinary(this, context);
4074
4069
  }
4070
+ static isAssignmentOperation(op) {
4071
+ return (op === '=' ||
4072
+ op === '+=' ||
4073
+ op === '-=' ||
4074
+ op === '*=' ||
4075
+ op === '/=' ||
4076
+ op === '%=' ||
4077
+ op === '**=' ||
4078
+ op === '&&=' ||
4079
+ op === '||=' ||
4080
+ op === '??=');
4081
+ }
4075
4082
  }
4076
4083
  /**
4077
4084
  * For backwards compatibility reasons, `Unary` inherits from `Binary` and mimics the binary AST
@@ -4402,7 +4409,7 @@ class ParsedProperty {
4402
4409
  keySpan;
4403
4410
  valueSpan;
4404
4411
  isLiteral;
4405
- isAnimation;
4412
+ isLegacyAnimation;
4406
4413
  constructor(name, expression, type, sourceSpan, keySpan, valueSpan) {
4407
4414
  this.name = name;
4408
4415
  this.expression = expression;
@@ -4411,22 +4418,22 @@ class ParsedProperty {
4411
4418
  this.keySpan = keySpan;
4412
4419
  this.valueSpan = valueSpan;
4413
4420
  this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR;
4414
- this.isAnimation = this.type === ParsedPropertyType.ANIMATION;
4421
+ this.isLegacyAnimation = this.type === ParsedPropertyType.LEGACY_ANIMATION;
4415
4422
  }
4416
4423
  }
4417
4424
  var ParsedPropertyType;
4418
4425
  (function (ParsedPropertyType) {
4419
4426
  ParsedPropertyType[ParsedPropertyType["DEFAULT"] = 0] = "DEFAULT";
4420
4427
  ParsedPropertyType[ParsedPropertyType["LITERAL_ATTR"] = 1] = "LITERAL_ATTR";
4421
- ParsedPropertyType[ParsedPropertyType["ANIMATION"] = 2] = "ANIMATION";
4428
+ ParsedPropertyType[ParsedPropertyType["LEGACY_ANIMATION"] = 2] = "LEGACY_ANIMATION";
4422
4429
  ParsedPropertyType[ParsedPropertyType["TWO_WAY"] = 3] = "TWO_WAY";
4423
4430
  })(ParsedPropertyType || (ParsedPropertyType = {}));
4424
4431
  exports.ParsedEventType = void 0;
4425
4432
  (function (ParsedEventType) {
4426
4433
  // DOM or Directive event
4427
4434
  ParsedEventType[ParsedEventType["Regular"] = 0] = "Regular";
4428
- // Animation specific event
4429
- ParsedEventType[ParsedEventType["Animation"] = 1] = "Animation";
4435
+ // Legacy animation specific event
4436
+ ParsedEventType[ParsedEventType["LegacyAnimation"] = 1] = "LegacyAnimation";
4430
4437
  // Event side of a two-way binding (e.g. `[(property)]="expression"`).
4431
4438
  ParsedEventType[ParsedEventType["TwoWay"] = 2] = "TwoWay";
4432
4439
  })(exports.ParsedEventType || (exports.ParsedEventType = {}));
@@ -4475,8 +4482,8 @@ exports.BindingType = void 0;
4475
4482
  BindingType[BindingType["Class"] = 2] = "Class";
4476
4483
  // A binding to a style rule (e.g. `[style.rule]="expression"`).
4477
4484
  BindingType[BindingType["Style"] = 3] = "Style";
4478
- // A binding to an animation reference (e.g. `[animate.key]="expression"`).
4479
- BindingType[BindingType["Animation"] = 4] = "Animation";
4485
+ // A binding to a legacy animation reference (e.g. `[animate.key]="expression"`).
4486
+ BindingType[BindingType["LegacyAnimation"] = 4] = "LegacyAnimation";
4480
4487
  // Property side of a two-way binding (e.g. `[(property)]="expression"`).
4481
4488
  BindingType[BindingType["TwoWay"] = 5] = "TwoWay";
4482
4489
  })(exports.BindingType || (exports.BindingType = {}));
@@ -4659,7 +4666,7 @@ class BoundEvent {
4659
4666
  }
4660
4667
  static fromParsedEvent(event) {
4661
4668
  const target = event.type === exports.ParsedEventType.Regular ? event.targetOrPhase : null;
4662
- const phase = event.type === exports.ParsedEventType.Animation ? event.targetOrPhase : null;
4669
+ const phase = event.type === exports.ParsedEventType.LegacyAnimation ? event.targetOrPhase : null;
4663
4670
  if (event.keySpan === undefined) {
4664
4671
  throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);
4665
4672
  }
@@ -8785,9 +8792,9 @@ var BindingKind;
8785
8792
  */
8786
8793
  BindingKind[BindingKind["I18n"] = 5] = "I18n";
8787
8794
  /**
8788
- * Animation property bindings.
8795
+ * Legacy animation property bindings.
8789
8796
  */
8790
- BindingKind[BindingKind["Animation"] = 6] = "Animation";
8797
+ BindingKind[BindingKind["LegacyAnimation"] = 6] = "LegacyAnimation";
8791
8798
  /**
8792
8799
  * Property side of a two-way binding.
8793
8800
  */
@@ -9032,13 +9039,13 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
9032
9039
  /**
9033
9040
  * Create a `PropertyOp`.
9034
9041
  */
9035
- function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
9042
+ function createPropertyOp(target, name, expression, isLegacyAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
9036
9043
  return {
9037
9044
  kind: OpKind.Property,
9038
9045
  target,
9039
9046
  name,
9040
9047
  expression,
9041
- isAnimationTrigger,
9048
+ isLegacyAnimationTrigger,
9042
9049
  securityContext,
9043
9050
  sanitizer: null,
9044
9051
  isStructuralTemplateAttribute,
@@ -10725,7 +10732,7 @@ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
10725
10732
  /**
10726
10733
  * Create a `ListenerOp`. Host bindings reuse all the listener logic.
10727
10734
  */
10728
- function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
10735
+ function createListenerOp(target, targetSlot, name, tag, handlerOps, legacyAnimationPhase, eventTarget, hostListener, sourceSpan) {
10729
10736
  const handlerList = new OpList();
10730
10737
  handlerList.push(handlerOps);
10731
10738
  return {
@@ -10738,8 +10745,8 @@ function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPh
10738
10745
  handlerOps: handlerList,
10739
10746
  handlerFnName: null,
10740
10747
  consumesDollarEvent: false,
10741
- isAnimationListener: animationPhase !== null,
10742
- animationPhase,
10748
+ isLegacyAnimationListener: legacyAnimationPhase !== null,
10749
+ legacyAnimationPhase: legacyAnimationPhase,
10743
10750
  eventTarget,
10744
10751
  sourceSpan,
10745
10752
  ...NEW_OP,
@@ -10994,12 +11001,12 @@ function createSourceLocationOp(templatePath, locations) {
10994
11001
  };
10995
11002
  }
10996
11003
 
10997
- function createDomPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
11004
+ function createDomPropertyOp(name, expression, isLegacyAnimationTrigger, i18nContext, securityContext, sourceSpan) {
10998
11005
  return {
10999
11006
  kind: OpKind.DomProperty,
11000
11007
  name,
11001
11008
  expression,
11002
- isAnimationTrigger,
11009
+ isLegacyAnimationTrigger,
11003
11010
  i18nContext,
11004
11011
  securityContext,
11005
11012
  sanitizer: null,
@@ -11021,6 +11028,14 @@ var CompilationJobKind;
11021
11028
  CompilationJobKind[CompilationJobKind["Host"] = 1] = "Host";
11022
11029
  CompilationJobKind[CompilationJobKind["Both"] = 2] = "Both";
11023
11030
  })(CompilationJobKind || (CompilationJobKind = {}));
11031
+ /** Possible modes in which a component's template can be compiled. */
11032
+ var TemplateCompilationMode;
11033
+ (function (TemplateCompilationMode) {
11034
+ /** Supports the full instruction set, including directives. */
11035
+ TemplateCompilationMode[TemplateCompilationMode["Full"] = 0] = "Full";
11036
+ /** Uses a narrower instruction set that doesn't support directives and allows optimizations. */
11037
+ TemplateCompilationMode[TemplateCompilationMode["DomOnly"] = 1] = "DomOnly";
11038
+ })(TemplateCompilationMode || (TemplateCompilationMode = {}));
11024
11039
  /**
11025
11040
  * An entire ongoing compilation, which will result in one or more template functions when complete.
11026
11041
  * Contains one or more corresponding compilation units.
@@ -11029,10 +11044,12 @@ class CompilationJob {
11029
11044
  componentName;
11030
11045
  pool;
11031
11046
  compatibility;
11032
- constructor(componentName, pool, compatibility) {
11047
+ mode;
11048
+ constructor(componentName, pool, compatibility, mode) {
11033
11049
  this.componentName = componentName;
11034
11050
  this.pool = pool;
11035
11051
  this.compatibility = compatibility;
11052
+ this.mode = mode;
11036
11053
  }
11037
11054
  kind = CompilationJobKind.Both;
11038
11055
  /**
@@ -11057,8 +11074,8 @@ class ComponentCompilationJob extends CompilationJob {
11057
11074
  allDeferrableDepsFn;
11058
11075
  relativeTemplatePath;
11059
11076
  enableDebugLocations;
11060
- constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
11061
- super(componentName, pool, compatibility);
11077
+ constructor(componentName, pool, compatibility, mode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
11078
+ super(componentName, pool, compatibility, mode);
11062
11079
  this.relativeContextFilePath = relativeContextFilePath;
11063
11080
  this.i18nUseExternalIds = i18nUseExternalIds;
11064
11081
  this.deferMeta = deferMeta;
@@ -11203,8 +11220,8 @@ class ViewCompilationUnit extends CompilationUnit {
11203
11220
  * Compilation-in-progress of a host binding, which contains a single unit for that host binding.
11204
11221
  */
11205
11222
  class HostBindingCompilationJob extends CompilationJob {
11206
- constructor(componentName, pool, compatibility) {
11207
- super(componentName, pool, compatibility);
11223
+ constructor(componentName, pool, compatibility, mode) {
11224
+ super(componentName, pool, compatibility, mode);
11208
11225
  this.root = new HostBindingCompilationUnit(this);
11209
11226
  }
11210
11227
  kind = CompilationJobKind.Host;
@@ -11436,7 +11453,7 @@ function extractAttributes(job) {
11436
11453
  extractAttributeOp(unit, op, elements);
11437
11454
  break;
11438
11455
  case OpKind.Property:
11439
- if (!op.isAnimationTrigger) {
11456
+ if (!op.isLegacyAnimationTrigger) {
11440
11457
  let bindingKind;
11441
11458
  if (op.i18nMessage !== null && op.templateKind === null) {
11442
11459
  // If the binding has an i18n context, it is an i18n attribute, and should have that
@@ -11478,7 +11495,7 @@ function extractAttributes(job) {
11478
11495
  }
11479
11496
  break;
11480
11497
  case OpKind.Listener:
11481
- if (!op.isAnimationListener) {
11498
+ if (!op.isLegacyAnimationListener) {
11482
11499
  const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name,
11483
11500
  /* expression */ null,
11484
11501
  /* i18nContext */ null,
@@ -11588,12 +11605,12 @@ function specializeBindings(job) {
11588
11605
  }
11589
11606
  break;
11590
11607
  case BindingKind.Property:
11591
- case BindingKind.Animation:
11608
+ case BindingKind.LegacyAnimation:
11592
11609
  if (job.kind === CompilationJobKind.Host) {
11593
- OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
11610
+ OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.LegacyAnimation, op.i18nContext, op.securityContext, op.sourceSpan));
11594
11611
  }
11595
11612
  else {
11596
- OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
11613
+ OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.LegacyAnimation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
11597
11614
  }
11598
11615
  break;
11599
11616
  case BindingKind.TwoWayProperty:
@@ -11637,6 +11654,14 @@ const CHAIN_COMPATIBILITY = new Map([
11637
11654
  [Identifiers.declareLet, Identifiers.declareLet],
11638
11655
  [Identifiers.conditionalCreate, Identifiers.conditionalBranchCreate],
11639
11656
  [Identifiers.conditionalBranchCreate, Identifiers.conditionalBranchCreate],
11657
+ [Identifiers.domElement, Identifiers.domElement],
11658
+ [Identifiers.domElementStart, Identifiers.domElementStart],
11659
+ [Identifiers.domElementEnd, Identifiers.domElementEnd],
11660
+ [Identifiers.domElementContainer, Identifiers.domElementContainer],
11661
+ [Identifiers.domElementContainerStart, Identifiers.domElementContainerStart],
11662
+ [Identifiers.domElementContainerEnd, Identifiers.domElementContainerEnd],
11663
+ [Identifiers.domListener, Identifiers.domListener],
11664
+ [Identifiers.domTemplate, Identifiers.domTemplate],
11640
11665
  ]);
11641
11666
  /**
11642
11667
  * Chaining results in repeated call expressions, causing a deep AST of receiver expressions. To prevent running out of
@@ -11809,6 +11834,15 @@ const BINARY_OPERATORS$3 = new Map([
11809
11834
  ['||', BinaryOperator.Or],
11810
11835
  ['+', BinaryOperator.Plus],
11811
11836
  ['in', BinaryOperator.In],
11837
+ ['+=', BinaryOperator.AdditionAssignment],
11838
+ ['-=', BinaryOperator.SubtractionAssignment],
11839
+ ['*=', BinaryOperator.MultiplicationAssignment],
11840
+ ['/=', BinaryOperator.DivisionAssignment],
11841
+ ['%=', BinaryOperator.RemainderAssignment],
11842
+ ['**=', BinaryOperator.ExponentiationAssignment],
11843
+ ['&&=', BinaryOperator.AndAssignment],
11844
+ ['||=', BinaryOperator.OrAssignment],
11845
+ ['??=', BinaryOperator.NullishCoalesceAssignment],
11812
11846
  ]);
11813
11847
  function namespaceForKey(namespacePrefixKey) {
11814
11848
  const NAMESPACES = new Map([
@@ -15596,13 +15630,6 @@ const NAMED_ENTITIES = {
15596
15630
  const NGSP_UNICODE = '\uE500';
15597
15631
  NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
15598
15632
 
15599
- class TokenError extends ParseError {
15600
- tokenType;
15601
- constructor(errorMsg, tokenType, span) {
15602
- super(span, errorMsg);
15603
- this.tokenType = tokenType;
15604
- }
15605
- }
15606
15633
  class TokenizeResult {
15607
15634
  tokens;
15608
15635
  errors;
@@ -15634,12 +15661,6 @@ var CharacterReferenceType;
15634
15661
  CharacterReferenceType["HEX"] = "hexadecimal";
15635
15662
  CharacterReferenceType["DEC"] = "decimal";
15636
15663
  })(CharacterReferenceType || (CharacterReferenceType = {}));
15637
- class _ControlFlowError {
15638
- error;
15639
- constructor(error) {
15640
- this.error = error;
15641
- }
15642
- }
15643
15664
  // See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
15644
15665
  class _Tokenizer {
15645
15666
  _getTagDefinition;
@@ -15949,10 +15970,10 @@ class _Tokenizer {
15949
15970
  }
15950
15971
  _endToken(parts, end) {
15951
15972
  if (this._currentTokenStart === null) {
15952
- throw new TokenError('Programming error - attempted to end a token when there was no start to the token', this._currentTokenType, this._cursor.getSpan(end));
15973
+ throw new ParseError(this._cursor.getSpan(end), 'Programming error - attempted to end a token when there was no start to the token');
15953
15974
  }
15954
15975
  if (this._currentTokenType === null) {
15955
- throw new TokenError('Programming error - attempted to end a token which has no token type', null, this._cursor.getSpan(this._currentTokenStart));
15976
+ throw new ParseError(this._cursor.getSpan(this._currentTokenStart), 'Programming error - attempted to end a token which has no token type');
15956
15977
  }
15957
15978
  const token = {
15958
15979
  type: this._currentTokenType,
@@ -15968,17 +15989,17 @@ class _Tokenizer {
15968
15989
  if (this._isInExpansionForm()) {
15969
15990
  msg += ` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`;
15970
15991
  }
15971
- const error = new TokenError(msg, this._currentTokenType, span);
15992
+ const error = new ParseError(span, msg);
15972
15993
  this._currentTokenStart = null;
15973
15994
  this._currentTokenType = null;
15974
- return new _ControlFlowError(error);
15995
+ return error;
15975
15996
  }
15976
15997
  handleError(e) {
15977
15998
  if (e instanceof CursorError) {
15978
15999
  e = this._createError(e.msg, this._cursor.getSpan(e.cursor));
15979
16000
  }
15980
- if (e instanceof _ControlFlowError) {
15981
- this.errors.push(e.error);
16001
+ if (e instanceof ParseError) {
16002
+ this.errors.push(e);
15982
16003
  }
15983
16004
  else {
15984
16005
  throw e;
@@ -16218,7 +16239,7 @@ class _Tokenizer {
16218
16239
  }
16219
16240
  }
16220
16241
  catch (e) {
16221
- if (e instanceof _ControlFlowError) {
16242
+ if (e instanceof ParseError) {
16222
16243
  if (openToken) {
16223
16244
  // We errored before we could close the opening tag, so it is incomplete.
16224
16245
  openToken.type =
@@ -16999,7 +17020,7 @@ let Parser$1 = class Parser {
16999
17020
  const tokenizeResult = tokenize(source, url, this.getTagDefinition, options);
17000
17021
  const parser = new _TreeBuilder(tokenizeResult.tokens, this.getTagDefinition);
17001
17022
  parser.build();
17002
- return new ParseTreeResult(parser.rootNodes, tokenizeResult.errors.concat(parser.errors));
17023
+ return new ParseTreeResult(parser.rootNodes, [...tokenizeResult.errors, ...parser.errors]);
17003
17024
  }
17004
17025
  };
17005
17026
  class _TreeBuilder {
@@ -18090,13 +18111,17 @@ class _Scanner {
18090
18111
  case $HASH:
18091
18112
  return this.scanPrivateIdentifier();
18092
18113
  case $PLUS:
18114
+ return this.scanComplexOperator(start, '+', $EQ, '=');
18093
18115
  case $MINUS:
18116
+ return this.scanComplexOperator(start, '-', $EQ, '=');
18094
18117
  case $SLASH:
18118
+ return this.scanComplexOperator(start, '/', $EQ, '=');
18095
18119
  case $PERCENT:
18120
+ return this.scanComplexOperator(start, '%', $EQ, '=');
18096
18121
  case $CARET:
18097
- return this.scanOperator(start, String.fromCharCode(peek));
18122
+ return this.scanOperator(start, '^');
18098
18123
  case $STAR:
18099
- return this.scanComplexOperator(start, '*', $STAR, '*');
18124
+ return this.scanStar(start);
18100
18125
  case $QUESTION:
18101
18126
  return this.scanQuestion(start);
18102
18127
  case $LT:
@@ -18106,9 +18131,9 @@ class _Scanner {
18106
18131
  case $EQ:
18107
18132
  return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');
18108
18133
  case $AMPERSAND:
18109
- return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
18134
+ return this.scanComplexOperator(start, '&', $AMPERSAND, '&', $EQ, '=');
18110
18135
  case $BAR:
18111
- return this.scanComplexOperator(start, '|', $BAR, '|');
18136
+ return this.scanComplexOperator(start, '|', $BAR, '|', $EQ, '=');
18112
18137
  case $NBSP:
18113
18138
  while (isWhitespace(this.peek))
18114
18139
  this.advance();
@@ -18254,13 +18279,23 @@ class _Scanner {
18254
18279
  }
18255
18280
  scanQuestion(start) {
18256
18281
  this.advance();
18257
- let str = '?';
18258
- // Either `a ?? b` or 'a?.b'.
18259
- if (this.peek === $QUESTION || this.peek === $PERIOD) {
18260
- str += this.peek === $PERIOD ? '.' : '?';
18282
+ let operator = '?';
18283
+ // `a ?? b` or `a ??= b`.
18284
+ if (this.peek === $QUESTION) {
18285
+ operator += '?';
18286
+ this.advance();
18287
+ // @ts-expect-error
18288
+ if (this.peek === $EQ) {
18289
+ operator += '=';
18290
+ this.advance();
18291
+ }
18292
+ }
18293
+ else if (this.peek === $PERIOD) {
18294
+ // `a?.b`
18295
+ operator += '.';
18261
18296
  this.advance();
18262
18297
  }
18263
- return newOperatorToken(start, this.index, str);
18298
+ return newOperatorToken(start, this.index, operator);
18264
18299
  }
18265
18300
  scanTemplateLiteralPart(start) {
18266
18301
  let buffer = '';
@@ -18324,6 +18359,25 @@ class _Scanner {
18324
18359
  buffer += String.fromCharCode(unescapedCode);
18325
18360
  return buffer;
18326
18361
  }
18362
+ scanStar(start) {
18363
+ this.advance();
18364
+ // `*`, `**`, `**=` or `*=`
18365
+ let operator = '*';
18366
+ if (this.peek === $STAR) {
18367
+ operator += '*';
18368
+ this.advance();
18369
+ // @ts-expect-error
18370
+ if (this.peek === $EQ) {
18371
+ operator += '=';
18372
+ this.advance();
18373
+ }
18374
+ }
18375
+ else if (this.peek === $EQ) {
18376
+ operator += '=';
18377
+ this.advance();
18378
+ }
18379
+ return newOperatorToken(start, this.index, operator);
18380
+ }
18327
18381
  }
18328
18382
  function isIdentifierStart(code) {
18329
18383
  return (($a <= code && code <= $z) ||
@@ -18384,6 +18438,9 @@ class TemplateBindingParseResult {
18384
18438
  this.errors = errors;
18385
18439
  }
18386
18440
  }
18441
+ function getLocation(span) {
18442
+ return span.start.toString() || '(unknown)';
18443
+ }
18387
18444
  class Parser {
18388
18445
  _lexer;
18389
18446
  _supportsDirectPipeReferences;
@@ -18391,18 +18448,18 @@ class Parser {
18391
18448
  this._lexer = _lexer;
18392
18449
  this._supportsDirectPipeReferences = _supportsDirectPipeReferences;
18393
18450
  }
18394
- parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18451
+ parseAction(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18395
18452
  const errors = [];
18396
- this._checkNoInterpolation(errors, input, location, interpolationConfig);
18453
+ this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
18397
18454
  const sourceToLex = this._stripComments(input);
18398
18455
  const tokens = this._lexer.tokenize(sourceToLex);
18399
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18400
- return new ASTWithSource(ast, input, location, absoluteOffset, errors);
18456
+ const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18457
+ return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
18401
18458
  }
18402
- parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18459
+ parseBinding(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18403
18460
  const errors = [];
18404
- const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors);
18405
- return new ASTWithSource(ast, input, location, absoluteOffset, errors);
18461
+ const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors);
18462
+ return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
18406
18463
  }
18407
18464
  checkSimpleExpression(ast) {
18408
18465
  const checker = new SimpleExpressionChecker();
@@ -18410,20 +18467,20 @@ class Parser {
18410
18467
  return checker.errors;
18411
18468
  }
18412
18469
  // Host bindings parsed here
18413
- parseSimpleBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18470
+ parseSimpleBinding(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18414
18471
  const errors = [];
18415
- const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors);
18472
+ const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors);
18416
18473
  const simplExpressionErrors = this.checkSimpleExpression(ast);
18417
18474
  if (simplExpressionErrors.length > 0) {
18418
- errors.push(new ParserError(`Host binding expression cannot contain ${simplExpressionErrors.join(' ')}`, input, location));
18475
+ errors.push(getParseError(`Host binding expression cannot contain ${simplExpressionErrors.join(' ')}`, input, '', parseSourceSpan));
18419
18476
  }
18420
- return new ASTWithSource(ast, input, location, absoluteOffset, errors);
18477
+ return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
18421
18478
  }
18422
- _parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors) {
18423
- this._checkNoInterpolation(errors, input, location, interpolationConfig);
18479
+ _parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors) {
18480
+ this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
18424
18481
  const sourceToLex = this._stripComments(input);
18425
18482
  const tokens = this._lexer.tokenize(sourceToLex);
18426
- return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18483
+ return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18427
18484
  }
18428
18485
  /**
18429
18486
  * Parse microsyntax template expression and return a list of bindings or
@@ -18451,42 +18508,46 @@ class Parser {
18451
18508
  * @param absoluteKeyOffset start of the `templateKey`
18452
18509
  * @param absoluteValueOffset start of the `templateValue`
18453
18510
  */
18454
- parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
18511
+ parseTemplateBindings(templateKey, templateValue, parseSourceSpan, absoluteKeyOffset, absoluteValueOffset) {
18455
18512
  const tokens = this._lexer.tokenize(templateValue);
18456
18513
  const errors = [];
18457
- const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, errors, 0 /* relative offset */, this._supportsDirectPipeReferences);
18514
+ const parser = new _ParseAST(templateValue, parseSourceSpan, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, errors, 0 /* relative offset */, this._supportsDirectPipeReferences);
18458
18515
  return parser.parseTemplateBindings({
18459
18516
  source: templateKey,
18460
18517
  span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
18461
18518
  });
18462
18519
  }
18463
- parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18520
+ parseInterpolation(input, parseSourceSpan, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18464
18521
  const errors = [];
18465
- const { strings, expressions, offsets } = this.splitInterpolation(input, location, errors, interpolatedTokens, interpolationConfig);
18522
+ const { strings, expressions, offsets } = this.splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens, interpolationConfig);
18466
18523
  if (expressions.length === 0)
18467
18524
  return null;
18468
18525
  const expressionNodes = [];
18469
18526
  for (let i = 0; i < expressions.length; ++i) {
18527
+ // If we have a token for the specific expression, it's preferrable to use it because it
18528
+ // allows us to produce more accurate error messages. The expressions are always at the odd
18529
+ // indexes inside the tokens.
18530
+ const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
18470
18531
  const expressionText = expressions[i].text;
18471
18532
  const sourceToLex = this._stripComments(expressionText);
18472
18533
  const tokens = this._lexer.tokenize(sourceToLex);
18473
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
18534
+ const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
18474
18535
  expressionNodes.push(ast);
18475
18536
  }
18476
- return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, location, absoluteOffset, errors);
18537
+ return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, getLocation(parseSourceSpan), absoluteOffset, errors);
18477
18538
  }
18478
18539
  /**
18479
18540
  * Similar to `parseInterpolation`, but treats the provided string as a single expression
18480
18541
  * element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).
18481
18542
  * This is used for parsing the switch expression in ICUs.
18482
18543
  */
18483
- parseInterpolationExpression(expression, location, absoluteOffset) {
18544
+ parseInterpolationExpression(expression, parseSourceSpan, absoluteOffset) {
18484
18545
  const sourceToLex = this._stripComments(expression);
18485
18546
  const tokens = this._lexer.tokenize(sourceToLex);
18486
18547
  const errors = [];
18487
- const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18548
+ const ast = new _ParseAST(expression, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18488
18549
  const strings = ['', '']; // The prefix and suffix strings are both empty
18489
- return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset, errors);
18550
+ return this.createInterpolationAst(strings, [ast], expression, getLocation(parseSourceSpan), absoluteOffset, errors);
18490
18551
  }
18491
18552
  createInterpolationAst(strings, expressions, input, location, absoluteOffset, errors) {
18492
18553
  const span = new ParseSpan(0, input.length);
@@ -18500,7 +18561,7 @@ class Parser {
18500
18561
  * `SplitInterpolation` with splits that look like
18501
18562
  * <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
18502
18563
  */
18503
- splitInterpolation(input, location, errors, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18564
+ splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18504
18565
  const strings = [];
18505
18566
  const expressions = [];
18506
18567
  const offsets = [];
@@ -18538,7 +18599,7 @@ class Parser {
18538
18599
  const fullEnd = exprEnd + interpEnd.length;
18539
18600
  const text = input.substring(exprStart, exprEnd);
18540
18601
  if (text.trim().length === 0) {
18541
- errors.push(new ParserError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location));
18602
+ errors.push(getParseError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, parseSourceSpan));
18542
18603
  }
18543
18604
  expressions.push({ text, start: fullStart, end: fullEnd });
18544
18605
  const startInOriginalTemplate = inputToTemplateIndexMap?.get(fullStart) ?? fullStart;
@@ -18561,9 +18622,11 @@ class Parser {
18561
18622
  }
18562
18623
  return new SplitInterpolation(strings, expressions, offsets);
18563
18624
  }
18564
- wrapLiteralPrimitive(input, location, absoluteOffset) {
18625
+ wrapLiteralPrimitive(input, sourceSpanOrLocation, absoluteOffset) {
18565
18626
  const span = new ParseSpan(0, input == null ? 0 : input.length);
18566
- return new ASTWithSource(new LiteralPrimitive(span, span.toAbsolute(absoluteOffset), input), input, location, absoluteOffset, []);
18627
+ return new ASTWithSource(new LiteralPrimitive(span, span.toAbsolute(absoluteOffset), input), input, typeof sourceSpanOrLocation === 'string'
18628
+ ? sourceSpanOrLocation
18629
+ : getLocation(sourceSpanOrLocation), absoluteOffset, []);
18567
18630
  }
18568
18631
  _stripComments(input) {
18569
18632
  const i = this._commentStart(input);
@@ -18585,7 +18648,7 @@ class Parser {
18585
18648
  }
18586
18649
  return null;
18587
18650
  }
18588
- _checkNoInterpolation(errors, input, location, { start, end }) {
18651
+ _checkNoInterpolation(errors, input, parseSourceSpan, { start, end }) {
18589
18652
  let startIndex = -1;
18590
18653
  let endIndex = -1;
18591
18654
  for (const charIndex of this._forEachUnquotedChar(input, 0)) {
@@ -18602,7 +18665,7 @@ class Parser {
18602
18665
  }
18603
18666
  }
18604
18667
  if (startIndex > -1 && endIndex > -1) {
18605
- errors.push(new ParserError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, location));
18668
+ errors.push(getParseError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, parseSourceSpan));
18606
18669
  }
18607
18670
  }
18608
18671
  /**
@@ -18661,7 +18724,7 @@ var ParseContextFlags;
18661
18724
  })(ParseContextFlags || (ParseContextFlags = {}));
18662
18725
  class _ParseAST {
18663
18726
  input;
18664
- location;
18727
+ parseSourceSpan;
18665
18728
  absoluteOffset;
18666
18729
  tokens;
18667
18730
  parseFlags;
@@ -18678,9 +18741,9 @@ class _ParseAST {
18678
18741
  // and may change for subsequent expressions visited by the parser.
18679
18742
  sourceSpanCache = new Map();
18680
18743
  index = 0;
18681
- constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset, supportsDirectPipeReferences) {
18744
+ constructor(input, parseSourceSpan, absoluteOffset, tokens, parseFlags, errors, offset, supportsDirectPipeReferences) {
18682
18745
  this.input = input;
18683
- this.location = location;
18746
+ this.parseSourceSpan = parseSourceSpan;
18684
18747
  this.absoluteOffset = absoluteOffset;
18685
18748
  this.tokens = tokens;
18686
18749
  this.parseFlags = parseFlags;
@@ -18808,6 +18871,9 @@ class _ParseAST {
18808
18871
  return false;
18809
18872
  }
18810
18873
  }
18874
+ isAssignmentOperator(token) {
18875
+ return token.type === TokenType.Operator && Binary.isAssignmentOperation(token.strValue);
18876
+ }
18811
18877
  expectOperator(operator) {
18812
18878
  if (this.consumeOptionalOperator(operator))
18813
18879
  return;
@@ -19291,7 +19357,8 @@ class _ParseAST {
19291
19357
  });
19292
19358
  const nameSpan = this.sourceSpan(nameStart);
19293
19359
  if (isSafe) {
19294
- if (this.consumeOptionalOperator('=')) {
19360
+ if (this.isAssignmentOperator(this.next)) {
19361
+ this.advance();
19295
19362
  this.error("The '?.' operator cannot be used in the assignment");
19296
19363
  return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
19297
19364
  }
@@ -19300,14 +19367,16 @@ class _ParseAST {
19300
19367
  }
19301
19368
  }
19302
19369
  else {
19303
- if (this.consumeOptionalOperator('=')) {
19370
+ if (this.isAssignmentOperator(this.next)) {
19371
+ const operation = this.next.strValue;
19372
+ this.advance();
19304
19373
  if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
19305
19374
  this.error('Bindings cannot contain assignments');
19306
19375
  return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
19307
19376
  }
19308
19377
  const receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
19309
19378
  const value = this.parseConditional();
19310
- return new Binary(this.span(start), this.sourceSpan(start), '=', receiver, value);
19379
+ return new Binary(this.span(start), this.sourceSpan(start), operation, receiver, value);
19311
19380
  }
19312
19381
  else {
19313
19382
  return new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
@@ -19422,14 +19491,16 @@ class _ParseAST {
19422
19491
  }
19423
19492
  this.rbracketsExpected--;
19424
19493
  this.expectCharacter($RBRACKET);
19425
- if (this.consumeOptionalOperator('=')) {
19494
+ if (this.isAssignmentOperator(this.next)) {
19495
+ const operation = this.next.strValue;
19496
+ this.advance();
19426
19497
  if (isSafe) {
19427
19498
  this.error("The '?.' operator cannot be used in the assignment");
19428
19499
  }
19429
19500
  else {
19430
19501
  const binaryReceiver = new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
19431
19502
  const value = this.parseConditional();
19432
- return new Binary(this.span(start), this.sourceSpan(start), '=', binaryReceiver, value);
19503
+ return new Binary(this.span(start), this.sourceSpan(start), operation, binaryReceiver, value);
19433
19504
  }
19434
19505
  }
19435
19506
  else {
@@ -19493,7 +19564,7 @@ class _ParseAST {
19493
19564
  const ast = this.parsePipe(); // example: "condition | async"
19494
19565
  const { start, end } = ast.span;
19495
19566
  const value = this.input.substring(start, end);
19496
- return new ASTWithSource(ast, value, this.location, this.absoluteOffset + start, this.errors);
19567
+ return new ASTWithSource(ast, value, getLocation(this.parseSourceSpan), this.absoluteOffset + start, this.errors);
19497
19568
  }
19498
19569
  /**
19499
19570
  * Return the binding for a variable declared using `as`. Note that the order
@@ -19597,13 +19668,11 @@ class _ParseAST {
19597
19668
  * Records an error and skips over the token stream until reaching a recoverable point. See
19598
19669
  * `this.skip` for more details on token skipping.
19599
19670
  */
19600
- error(message, index = null) {
19601
- this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
19671
+ error(message, index = this.index) {
19672
+ this.errors.push(getParseError(message, this.input, this.getErrorLocationText(index), this.parseSourceSpan));
19602
19673
  this.skip();
19603
19674
  }
19604
- locationText(index = null) {
19605
- if (index == null)
19606
- index = this.index;
19675
+ getErrorLocationText(index) {
19607
19676
  return index < this.tokens.length
19608
19677
  ? `at column ${this.tokens[index].index + 1} in`
19609
19678
  : `at the end of the expression`;
@@ -19637,7 +19706,7 @@ class _ParseAST {
19637
19706
  * none of the calling productions are not expecting the closing token else we will never
19638
19707
  * make progress in the case of an extraneous group closing symbol (such as a stray ')').
19639
19708
  * That is, we skip a closing symbol if we are not in a grouping production.
19640
- * - '=' in a `Writable` context
19709
+ * - Assignment in a `Writable` context
19641
19710
  * - In this context, we are able to recover after seeing the `=` operator, which
19642
19711
  * signals the presence of an independent rvalue expression following the `=` operator.
19643
19712
  *
@@ -19652,15 +19721,23 @@ class _ParseAST {
19652
19721
  (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
19653
19722
  (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
19654
19723
  (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET)) &&
19655
- (!(this.context & ParseContextFlags.Writable) || !n.isOperator('='))) {
19724
+ (!(this.context & ParseContextFlags.Writable) || !this.isAssignmentOperator(n))) {
19656
19725
  if (this.next.isError()) {
19657
- this.errors.push(new ParserError(this.next.toString(), this.input, this.locationText(), this.location));
19726
+ this.errors.push(getParseError(this.next.toString(), this.input, this.getErrorLocationText(this.next.index), this.parseSourceSpan));
19658
19727
  }
19659
19728
  this.advance();
19660
19729
  n = this.next;
19661
19730
  }
19662
19731
  }
19663
19732
  }
19733
+ function getParseError(message, input, locationText, parseSourceSpan) {
19734
+ if (locationText.length > 0) {
19735
+ locationText = ` ${locationText} `;
19736
+ }
19737
+ const location = getLocation(parseSourceSpan);
19738
+ const error = `Parser Error: ${message}${locationText}[${input}] in ${location}`;
19739
+ return new ParseError(parseSourceSpan, error);
19740
+ }
19664
19741
  class SimpleExpressionChecker extends RecursiveAstVisitor {
19665
19742
  errors = [];
19666
19743
  visitPipe() {
@@ -20915,7 +20992,7 @@ class _I18nVisitor {
20915
20992
  normalizeExpression(token) {
20916
20993
  const expression = token.parts[1];
20917
20994
  const expr = this._expressionParser.parseBinding(expression,
20918
- /* location */ token.sourceSpan.start.toString(),
20995
+ /* location */ token.sourceSpan,
20919
20996
  /* absoluteOffset */ token.sourceSpan.start.offset, this._interpolationConfig);
20920
20997
  return serialize(expr);
20921
20998
  }
@@ -20981,15 +21058,6 @@ function extractPlaceholderName(input) {
20981
21058
  return input.split(_CUSTOM_PH_EXP)[2];
20982
21059
  }
20983
21060
 
20984
- /**
20985
- * An i18n error.
20986
- */
20987
- class I18nError extends ParseError {
20988
- constructor(span, msg) {
20989
- super(span, msg);
20990
- }
20991
- }
20992
-
20993
21061
  /**
20994
21062
  * Set of tagName|propertyName corresponding to Trusted Types sinks. Properties applying to all
20995
21063
  * tags use '*'.
@@ -21271,7 +21339,7 @@ class I18nMetaVisitor {
21271
21339
  }
21272
21340
  }
21273
21341
  _reportError(node, msg) {
21274
- this._errors.push(new I18nError(node.sourceSpan, msg));
21342
+ this._errors.push(new ParseError(node.sourceSpan, msg));
21275
21343
  }
21276
21344
  }
21277
21345
  /** I18n separators for metadata **/
@@ -22139,7 +22207,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
22139
22207
  switch (op.kind) {
22140
22208
  case OpKind.Property:
22141
22209
  case OpKind.DomProperty:
22142
- if (op.isAnimationTrigger) {
22210
+ if (op.isLegacyAnimationTrigger) {
22143
22211
  op.name = '@' + op.name;
22144
22212
  }
22145
22213
  break;
@@ -22151,8 +22219,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
22151
22219
  throw new Error(`Expected a slot to be assigned`);
22152
22220
  }
22153
22221
  let animation = '';
22154
- if (op.isAnimationListener) {
22155
- op.name = `@${op.name}.${op.animationPhase}`;
22222
+ if (op.isLegacyAnimationListener) {
22223
+ op.name = `@${op.name}.${op.legacyAnimationPhase}`;
22156
22224
  animation = 'animation';
22157
22225
  }
22158
22226
  if (op.hostListener) {
@@ -22420,7 +22488,7 @@ function kindWithInterpolationTest(kind, interpolation) {
22420
22488
  };
22421
22489
  }
22422
22490
  function basicListenerKindTest(op) {
22423
- return ((op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener)) ||
22491
+ return ((op.kind === OpKind.Listener && !(op.hostListener && op.isLegacyAnimationListener)) ||
22424
22492
  op.kind === OpKind.TwoWayListener);
22425
22493
  }
22426
22494
  function nonInterpolationPropertyKindTest(op) {
@@ -22433,7 +22501,7 @@ function nonInterpolationPropertyKindTest(op) {
22433
22501
  * the groups in the order defined here.
22434
22502
  */
22435
22503
  const CREATE_ORDERING = [
22436
- { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isAnimationListener },
22504
+ { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isLegacyAnimationListener },
22437
22505
  { test: basicListenerKindTest },
22438
22506
  ];
22439
22507
  /**
@@ -22855,21 +22923,7 @@ function elementOrContainerBase(instruction, slot, tag, constIndex, localRefInde
22855
22923
  }
22856
22924
  return call(instruction, args, sourceSpan);
22857
22925
  }
22858
- function elementEnd(sourceSpan) {
22859
- return call(Identifiers.elementEnd, [], sourceSpan);
22860
- }
22861
- function elementContainerStart(slot, constIndex, localRefIndex, sourceSpan) {
22862
- return elementOrContainerBase(Identifiers.elementContainerStart, slot,
22863
- /* tag */ null, constIndex, localRefIndex, sourceSpan);
22864
- }
22865
- function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
22866
- return elementOrContainerBase(Identifiers.elementContainer, slot,
22867
- /* tag */ null, constIndex, localRefIndex, sourceSpan);
22868
- }
22869
- function elementContainerEnd() {
22870
- return call(Identifiers.elementContainerEnd, [], null);
22871
- }
22872
- function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
22926
+ function templateBase(instruction, slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
22873
22927
  const args = [
22874
22928
  literal$1(slot),
22875
22929
  templateFnRef,
@@ -22885,7 +22939,37 @@ function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs,
22885
22939
  while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
22886
22940
  args.pop();
22887
22941
  }
22888
- return call(Identifiers.templateCreate, args, sourceSpan);
22942
+ return call(instruction, args, sourceSpan);
22943
+ }
22944
+ function propertyBase(instruction, name, expression, sanitizer, sourceSpan) {
22945
+ const args = [literal$1(name)];
22946
+ if (expression instanceof Interpolation) {
22947
+ args.push(interpolationToExpression(expression, sourceSpan));
22948
+ }
22949
+ else {
22950
+ args.push(expression);
22951
+ }
22952
+ if (sanitizer !== null) {
22953
+ args.push(sanitizer);
22954
+ }
22955
+ return call(instruction, args, sourceSpan);
22956
+ }
22957
+ function elementEnd(sourceSpan) {
22958
+ return call(Identifiers.elementEnd, [], sourceSpan);
22959
+ }
22960
+ function elementContainerStart(slot, constIndex, localRefIndex, sourceSpan) {
22961
+ return elementOrContainerBase(Identifiers.elementContainerStart, slot,
22962
+ /* tag */ null, constIndex, localRefIndex, sourceSpan);
22963
+ }
22964
+ function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
22965
+ return elementOrContainerBase(Identifiers.elementContainer, slot,
22966
+ /* tag */ null, constIndex, localRefIndex, sourceSpan);
22967
+ }
22968
+ function elementContainerEnd() {
22969
+ return call(Identifiers.elementContainerEnd, [], null);
22970
+ }
22971
+ function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
22972
+ return templateBase(Identifiers.templateCreate, slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan);
22889
22973
  }
22890
22974
  function disableBindings() {
22891
22975
  return call(Identifiers.disableBindings, [], null);
@@ -23151,17 +23235,7 @@ function i18nAttributes(slot, i18nAttributesConfig) {
23151
23235
  return call(Identifiers.i18nAttributes, args, null);
23152
23236
  }
23153
23237
  function property(name, expression, sanitizer, sourceSpan) {
23154
- const args = [literal$1(name)];
23155
- if (expression instanceof Interpolation) {
23156
- args.push(interpolationToExpression(expression, sourceSpan));
23157
- }
23158
- else {
23159
- args.push(expression);
23160
- }
23161
- if (sanitizer !== null) {
23162
- args.push(sanitizer);
23163
- }
23164
- return call(Identifiers.property, args, sourceSpan);
23238
+ return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
23165
23239
  }
23166
23240
  function twoWayProperty(name, expression, sanitizer, sourceSpan) {
23167
23241
  const args = [literal$1(name), expression];
@@ -23214,6 +23288,36 @@ function classMap(expression, sourceSpan) {
23214
23288
  : expression;
23215
23289
  return call(Identifiers.classMap, [value], sourceSpan);
23216
23290
  }
23291
+ function domElement(slot, tag, constIndex, localRefIndex, sourceSpan) {
23292
+ return elementOrContainerBase(Identifiers.domElement, slot, tag, constIndex, localRefIndex, sourceSpan);
23293
+ }
23294
+ function domElementStart(slot, tag, constIndex, localRefIndex, sourceSpan) {
23295
+ return elementOrContainerBase(Identifiers.domElementStart, slot, tag, constIndex, localRefIndex, sourceSpan);
23296
+ }
23297
+ function domElementEnd(sourceSpan) {
23298
+ return call(Identifiers.domElementEnd, [], sourceSpan);
23299
+ }
23300
+ function domElementContainerStart(slot, constIndex, localRefIndex, sourceSpan) {
23301
+ return elementOrContainerBase(Identifiers.domElementContainerStart, slot,
23302
+ /* tag */ null, constIndex, localRefIndex, sourceSpan);
23303
+ }
23304
+ function domElementContainer(slot, constIndex, localRefIndex, sourceSpan) {
23305
+ return elementOrContainerBase(Identifiers.domElementContainer, slot,
23306
+ /* tag */ null, constIndex, localRefIndex, sourceSpan);
23307
+ }
23308
+ function domElementContainerEnd() {
23309
+ return call(Identifiers.domElementContainerEnd, [], null);
23310
+ }
23311
+ function domListener(name, handlerFn, eventTargetResolver, sourceSpan) {
23312
+ const args = [literal$1(name), handlerFn];
23313
+ if (eventTargetResolver !== null) {
23314
+ args.push(importExpr(eventTargetResolver));
23315
+ }
23316
+ return call(Identifiers.domListener, args, sourceSpan);
23317
+ }
23318
+ function domTemplate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
23319
+ return templateBase(Identifiers.domTemplate, slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan);
23320
+ }
23217
23321
  const PIPE_BINDINGS = [
23218
23322
  Identifiers.pipeBind1,
23219
23323
  Identifiers.pipeBind2,
@@ -23241,11 +23345,7 @@ function i18nApply(slot, sourceSpan) {
23241
23345
  return call(Identifiers.i18nApply, [literal$1(slot)], sourceSpan);
23242
23346
  }
23243
23347
  function domProperty(name, expression, sanitizer, sourceSpan) {
23244
- const args = [literal$1(name), expression];
23245
- if (sanitizer !== null) {
23246
- args.push(sanitizer);
23247
- }
23248
- return call(Identifiers.domProperty, args, sourceSpan);
23348
+ return propertyBase(Identifiers.domProperty, name, expression, sanitizer, sourceSpan);
23249
23349
  }
23250
23350
  function syntheticHostProperty(name, expression, sourceSpan) {
23251
23351
  return call(Identifiers.syntheticHostProperty, [literal$1(name), expression], sourceSpan);
@@ -23410,22 +23510,34 @@ function reifyCreateOperations(unit, ops) {
23410
23510
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
23411
23511
  break;
23412
23512
  case OpKind.ElementStart:
23413
- OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
23513
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23514
+ ? domElementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan)
23515
+ : elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
23414
23516
  break;
23415
23517
  case OpKind.Element:
23416
- OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
23518
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23519
+ ? domElement(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan)
23520
+ : element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
23417
23521
  break;
23418
23522
  case OpKind.ElementEnd:
23419
- OpList.replace(op, elementEnd(op.sourceSpan));
23523
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23524
+ ? domElementEnd(op.sourceSpan)
23525
+ : elementEnd(op.sourceSpan));
23420
23526
  break;
23421
23527
  case OpKind.ContainerStart:
23422
- OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
23528
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23529
+ ? domElementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan)
23530
+ : elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
23423
23531
  break;
23424
23532
  case OpKind.Container:
23425
- OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
23533
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23534
+ ? domElementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan)
23535
+ : elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
23426
23536
  break;
23427
23537
  case OpKind.ContainerEnd:
23428
- OpList.replace(op, elementContainerEnd());
23538
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly
23539
+ ? domElementContainerEnd()
23540
+ : elementContainerEnd());
23429
23541
  break;
23430
23542
  case OpKind.I18nStart:
23431
23543
  OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
@@ -23450,7 +23562,12 @@ function reifyCreateOperations(unit, ops) {
23450
23562
  throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
23451
23563
  }
23452
23564
  const childView = unit.job.views.get(op.xref);
23453
- OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
23565
+ OpList.replace(op,
23566
+ // Block templates can't have directives so we can always generate them as DOM-only.
23567
+ op.templateKind === TemplateKind.Block ||
23568
+ unit.job.mode === TemplateCompilationMode.DomOnly
23569
+ ? domTemplate(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan)
23570
+ : template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
23454
23571
  break;
23455
23572
  case OpKind.DisableBindings:
23456
23573
  OpList.replace(op, disableBindings());
@@ -23472,7 +23589,11 @@ function reifyCreateOperations(unit, ops) {
23472
23589
  if (eventTargetResolver === undefined) {
23473
23590
  throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
23474
23591
  }
23475
- OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
23592
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly &&
23593
+ !op.hostListener &&
23594
+ !op.isLegacyAnimationListener
23595
+ ? domListener(op.name, listenerFn, eventTargetResolver, op.sourceSpan)
23596
+ : listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isLegacyAnimationListener, op.sourceSpan));
23476
23597
  break;
23477
23598
  case OpKind.TwoWayListener:
23478
23599
  OpList.replace(op, twoWayListener(op.name, reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, true), op.sourceSpan));
@@ -23630,7 +23751,7 @@ function reifyCreateOperations(unit, ops) {
23630
23751
  }
23631
23752
  }
23632
23753
  }
23633
- function reifyUpdateOperations(_unit, ops) {
23754
+ function reifyUpdateOperations(unit, ops) {
23634
23755
  for (const op of ops) {
23635
23756
  transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
23636
23757
  switch (op.kind) {
@@ -23638,7 +23759,9 @@ function reifyUpdateOperations(_unit, ops) {
23638
23759
  OpList.replace(op, advance(op.delta, op.sourceSpan));
23639
23760
  break;
23640
23761
  case OpKind.Property:
23641
- OpList.replace(op, property(op.name, op.expression, op.sanitizer, op.sourceSpan));
23762
+ OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
23763
+ ? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
23764
+ : property(op.name, op.expression, op.sanitizer, op.sourceSpan));
23642
23765
  break;
23643
23766
  case OpKind.TwoWayProperty:
23644
23767
  OpList.replace(op, twoWayProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
@@ -23672,7 +23795,7 @@ function reifyUpdateOperations(_unit, ops) {
23672
23795
  throw new Error('not yet handled');
23673
23796
  }
23674
23797
  else {
23675
- if (op.isAnimationTrigger) {
23798
+ if (op.isLegacyAnimationTrigger) {
23676
23799
  OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
23677
23800
  }
23678
23801
  else {
@@ -25876,8 +25999,8 @@ function isSingleI18nIcu(meta) {
25876
25999
  * representation.
25877
26000
  * TODO: Refactor more of the ingestion code into phases.
25878
26001
  */
25879
- function ingestComponent(componentName, template, constantPool, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
25880
- const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations);
26002
+ function ingestComponent(componentName, template, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
26003
+ const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations);
25881
26004
  ingestNodes(job.root, template);
25882
26005
  return job;
25883
26006
  }
@@ -25886,7 +26009,7 @@ function ingestComponent(componentName, template, constantPool, relativeContextF
25886
26009
  * representation.
25887
26010
  */
25888
26011
  function ingestHostBinding(input, bindingParser, constantPool) {
25889
- const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
26012
+ const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode, TemplateCompilationMode.DomOnly);
25890
26013
  for (const property of input.properties ?? []) {
25891
26014
  let bindingKind = BindingKind.Property;
25892
26015
  // TODO: this should really be handled in the parser.
@@ -25894,8 +26017,8 @@ function ingestHostBinding(input, bindingParser, constantPool) {
25894
26017
  property.name = property.name.substring('attr.'.length);
25895
26018
  bindingKind = BindingKind.Attribute;
25896
26019
  }
25897
- if (property.isAnimation) {
25898
- bindingKind = BindingKind.Animation;
26020
+ if (property.isLegacyAnimation) {
26021
+ bindingKind = BindingKind.LegacyAnimation;
25899
26022
  }
25900
26023
  const securityContexts = bindingParser
25901
26024
  .calcPossibleSecurityContexts(input.componentSelector, property.name, bindingKind === BindingKind.Attribute)
@@ -25937,7 +26060,7 @@ function ingestHostAttribute(job, name, value, securityContexts) {
25937
26060
  job.root.update.push(attrBinding);
25938
26061
  }
25939
26062
  function ingestHostEvent(job, event) {
25940
- const [phase, target] = event.type !== exports.ParsedEventType.Animation
26063
+ const [phase, target] = event.type !== exports.ParsedEventType.LegacyAnimation
25941
26064
  ? [null, event.targetOrPhase]
25942
26065
  : [event.targetOrPhase, null];
25943
26066
  const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
@@ -26562,7 +26685,7 @@ const BINDING_KINDS = new Map([
26562
26685
  [exports.BindingType.Attribute, BindingKind.Attribute],
26563
26686
  [exports.BindingType.Class, BindingKind.ClassName],
26564
26687
  [exports.BindingType.Style, BindingKind.StyleProperty],
26565
- [exports.BindingType.Animation, BindingKind.Animation],
26688
+ [exports.BindingType.LegacyAnimation, BindingKind.LegacyAnimation],
26566
26689
  ]);
26567
26690
  /**
26568
26691
  * Checks whether the given template is a plain ng-template (as opposed to another kind of template
@@ -26621,7 +26744,7 @@ function ingestElementBindings(unit, op, element) {
26621
26744
  unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
26622
26745
  unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
26623
26746
  for (const output of element.outputs) {
26624
- if (output.type === exports.ParsedEventType.Animation && output.phase === null) {
26747
+ if (output.type === exports.ParsedEventType.LegacyAnimation && output.phase === null) {
26625
26748
  throw Error('Animation listener should have a phase');
26626
26749
  }
26627
26750
  if (output.type === exports.ParsedEventType.TwoWay) {
@@ -26664,7 +26787,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
26664
26787
  unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
26665
26788
  unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
26666
26789
  for (const output of template.outputs) {
26667
- if (output.type === exports.ParsedEventType.Animation && output.phase === null) {
26790
+ if (output.type === exports.ParsedEventType.LegacyAnimation && output.phase === null) {
26668
26791
  throw Error('Animation listener should have a phase');
26669
26792
  }
26670
26793
  if (templateKind === TemplateKind.NgTemplate) {
@@ -26676,7 +26799,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
26676
26799
  }
26677
26800
  }
26678
26801
  if (templateKind === TemplateKind.Structural &&
26679
- output.type !== exports.ParsedEventType.Animation) {
26802
+ output.type !== exports.ParsedEventType.LegacyAnimation) {
26680
26803
  // Animation bindings are excluded from the structural template's const array.
26681
26804
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
26682
26805
  unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
@@ -26734,7 +26857,8 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
26734
26857
  return createExtractedAttributeOp(xref, BindingKind.TwoWayProperty, null, name, null, null, i18nMessage, securityContext);
26735
26858
  }
26736
26859
  }
26737
- if (!isTextBinding && (type === exports.BindingType.Attribute || type === exports.BindingType.Animation)) {
26860
+ if (!isTextBinding &&
26861
+ (type === exports.BindingType.Attribute || type === exports.BindingType.LegacyAnimation)) {
26738
26862
  // Again, this binding doesn't really target the ng-template; it actually targets the element
26739
26863
  // inside the structural template. In the case of non-text attribute or animation bindings,
26740
26864
  // the binding doesn't even show up on the ng-template const array, so we just skip it
@@ -26899,7 +27023,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
26899
27023
  // Note that TDB used to collect the outputs as well, but it wasn't passing them into
26900
27024
  // the template instruction. Here we just don't collect them.
26901
27025
  for (const attr of root.inputs) {
26902
- if (attr.type !== exports.BindingType.Animation && attr.type !== exports.BindingType.Attribute) {
27026
+ if (attr.type !== exports.BindingType.LegacyAnimation && attr.type !== exports.BindingType.Attribute) {
26903
27027
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
26904
27028
  unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
26905
27029
  }
@@ -27114,7 +27238,7 @@ const ATTRIBUTE_PREFIX = 'attr';
27114
27238
  const CLASS_PREFIX = 'class';
27115
27239
  const STYLE_PREFIX = 'style';
27116
27240
  const TEMPLATE_ATTR_PREFIX$1 = '*';
27117
- const ANIMATE_PROP_PREFIX = 'animate-';
27241
+ const LEGACY_ANIMATE_PROP_PREFIX = 'animate-';
27118
27242
  /**
27119
27243
  * Parses bindings in templates and in the directive host area.
27120
27244
  */
@@ -27173,17 +27297,17 @@ class BindingParser {
27173
27297
  return targetEvents;
27174
27298
  }
27175
27299
  parseInterpolation(value, sourceSpan, interpolatedTokens) {
27176
- const sourceInfo = sourceSpan.start.toString();
27177
27300
  const absoluteOffset = sourceSpan.fullStart.offset;
27178
27301
  try {
27179
- const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, interpolatedTokens, this._interpolationConfig);
27180
- if (ast)
27181
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
27302
+ const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens, this._interpolationConfig);
27303
+ if (ast) {
27304
+ this.errors.push(...ast.errors);
27305
+ }
27182
27306
  return ast;
27183
27307
  }
27184
27308
  catch (e) {
27185
27309
  this._reportError(`${e}`, sourceSpan);
27186
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
27310
+ return this._exprParser.wrapLiteralPrimitive('ERROR', sourceSpan, absoluteOffset);
27187
27311
  }
27188
27312
  }
27189
27313
  /**
@@ -27192,17 +27316,17 @@ class BindingParser {
27192
27316
  * This is used for parsing the switch expression in ICUs.
27193
27317
  */
27194
27318
  parseInterpolationExpression(expression, sourceSpan) {
27195
- const sourceInfo = sourceSpan.start.toString();
27196
27319
  const absoluteOffset = sourceSpan.start.offset;
27197
27320
  try {
27198
- const ast = this._exprParser.parseInterpolationExpression(expression, sourceInfo, absoluteOffset);
27199
- if (ast)
27200
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
27321
+ const ast = this._exprParser.parseInterpolationExpression(expression, sourceSpan, absoluteOffset);
27322
+ if (ast) {
27323
+ this.errors.push(...ast.errors);
27324
+ }
27201
27325
  return ast;
27202
27326
  }
27203
27327
  catch (e) {
27204
27328
  this._reportError(`${e}`, sourceSpan);
27205
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
27329
+ return this._exprParser.wrapLiteralPrimitive('ERROR', sourceSpan, absoluteOffset);
27206
27330
  }
27207
27331
  }
27208
27332
  /**
@@ -27259,10 +27383,9 @@ class BindingParser {
27259
27383
  * @param absoluteValueOffset start of the `tplValue`
27260
27384
  */
27261
27385
  _parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset) {
27262
- const sourceInfo = sourceSpan.start.toString();
27263
27386
  try {
27264
- const bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo, absoluteKeyOffset, absoluteValueOffset);
27265
- this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
27387
+ const bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
27388
+ bindingsResult.errors.forEach((e) => this.errors.push(e));
27266
27389
  bindingsResult.warnings.forEach((warning) => {
27267
27390
  this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING);
27268
27391
  });
@@ -27274,7 +27397,7 @@ class BindingParser {
27274
27397
  }
27275
27398
  }
27276
27399
  parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
27277
- if (isAnimationLabel(name)) {
27400
+ if (isLegacyAnimationLabel(name)) {
27278
27401
  name = name.substring(1);
27279
27402
  if (keySpan !== undefined) {
27280
27403
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
@@ -27283,7 +27406,7 @@ class BindingParser {
27283
27406
  this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid.` +
27284
27407
  ` Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR);
27285
27408
  }
27286
- this._parseAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27409
+ this._parseLegacyAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27287
27410
  }
27288
27411
  else {
27289
27412
  targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, '', absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
@@ -27293,23 +27416,23 @@ class BindingParser {
27293
27416
  if (name.length === 0) {
27294
27417
  this._reportError(`Property name is missing in binding`, sourceSpan);
27295
27418
  }
27296
- let isAnimationProp = false;
27297
- if (name.startsWith(ANIMATE_PROP_PREFIX)) {
27298
- isAnimationProp = true;
27299
- name = name.substring(ANIMATE_PROP_PREFIX.length);
27419
+ let isLegacyAnimationProp = false;
27420
+ if (name.startsWith(LEGACY_ANIMATE_PROP_PREFIX)) {
27421
+ isLegacyAnimationProp = true;
27422
+ name = name.substring(LEGACY_ANIMATE_PROP_PREFIX.length);
27300
27423
  if (keySpan !== undefined) {
27301
- keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
27424
+ keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + LEGACY_ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
27302
27425
  }
27303
27426
  }
27304
- else if (isAnimationLabel(name)) {
27305
- isAnimationProp = true;
27427
+ else if (isLegacyAnimationLabel(name)) {
27428
+ isLegacyAnimationProp = true;
27306
27429
  name = name.substring(1);
27307
27430
  if (keySpan !== undefined) {
27308
27431
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
27309
27432
  }
27310
27433
  }
27311
- if (isAnimationProp) {
27312
- this._parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27434
+ if (isLegacyAnimationProp) {
27435
+ this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27313
27436
  }
27314
27437
  else {
27315
27438
  this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
@@ -27327,7 +27450,7 @@ class BindingParser {
27327
27450
  targetMatchableAttrs.push([name, ast.source]);
27328
27451
  targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
27329
27452
  }
27330
- _parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
27453
+ _parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
27331
27454
  if (name.length === 0) {
27332
27455
  this._reportError('Animation trigger is missing', sourceSpan);
27333
27456
  }
@@ -27336,26 +27459,26 @@ class BindingParser {
27336
27459
  // states will be applied by angular when the element is attached/detached
27337
27460
  const ast = this.parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
27338
27461
  targetMatchableAttrs.push([name, ast.source]);
27339
- targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
27462
+ targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.LEGACY_ANIMATION, sourceSpan, keySpan, valueSpan));
27340
27463
  }
27341
27464
  parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
27342
- const sourceInfo = ((sourceSpan && sourceSpan.start) || '(unknown)').toString();
27343
27465
  try {
27344
27466
  const ast = isHostBinding
27345
- ? this._exprParser.parseSimpleBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig)
27346
- : this._exprParser.parseBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig);
27347
- if (ast)
27348
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
27467
+ ? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset, this._interpolationConfig)
27468
+ : this._exprParser.parseBinding(value, sourceSpan, absoluteOffset, this._interpolationConfig);
27469
+ if (ast) {
27470
+ this.errors.push(...ast.errors);
27471
+ }
27349
27472
  return ast;
27350
27473
  }
27351
27474
  catch (e) {
27352
27475
  this._reportError(`${e}`, sourceSpan);
27353
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
27476
+ return this._exprParser.wrapLiteralPrimitive('ERROR', sourceSpan, absoluteOffset);
27354
27477
  }
27355
27478
  }
27356
27479
  createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
27357
- if (boundProp.isAnimation) {
27358
- return new BoundElementProperty(boundProp.name, exports.BindingType.Animation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
27480
+ if (boundProp.isLegacyAnimation) {
27481
+ return new BoundElementProperty(boundProp.name, exports.BindingType.LegacyAnimation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
27359
27482
  }
27360
27483
  let unit = null;
27361
27484
  let bindingType = undefined;
@@ -27408,12 +27531,12 @@ class BindingParser {
27408
27531
  if (name.length === 0) {
27409
27532
  this._reportError(`Event name is missing in binding`, sourceSpan);
27410
27533
  }
27411
- if (isAnimationLabel(name)) {
27534
+ if (isLegacyAnimationLabel(name)) {
27412
27535
  name = name.slice(1);
27413
27536
  if (keySpan !== undefined) {
27414
27537
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
27415
27538
  }
27416
- this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
27539
+ this._parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
27417
27540
  }
27418
27541
  else {
27419
27542
  this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
@@ -27427,14 +27550,14 @@ class BindingParser {
27427
27550
  const [target, eventName] = splitAtColon(rawName, [null, rawName]);
27428
27551
  return { eventName: eventName, target };
27429
27552
  }
27430
- parseAnimationEventName(rawName) {
27553
+ parseLegacyAnimationEventName(rawName) {
27431
27554
  const matches = splitAtPeriod(rawName, [rawName, null]);
27432
27555
  return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
27433
27556
  }
27434
- _parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
27435
- const { eventName, phase } = this.parseAnimationEventName(name);
27557
+ _parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
27558
+ const { eventName, phase } = this.parseLegacyAnimationEventName(name);
27436
27559
  const ast = this._parseAction(expression, handlerSpan);
27437
- targetEvents.push(new ParsedEvent(eventName, phase, exports.ParsedEventType.Animation, ast, sourceSpan, handlerSpan, keySpan));
27560
+ targetEvents.push(new ParsedEvent(eventName, phase, exports.ParsedEventType.LegacyAnimation, ast, sourceSpan, handlerSpan, keySpan));
27438
27561
  if (eventName.length === 0) {
27439
27562
  this._reportError(`Animation event name is missing in binding`, sourceSpan);
27440
27563
  }
@@ -27464,31 +27587,25 @@ class BindingParser {
27464
27587
  // so don't add the event name to the matchableAttrs
27465
27588
  }
27466
27589
  _parseAction(value, sourceSpan) {
27467
- const sourceInfo = ((sourceSpan && sourceSpan.start) || '(unknown').toString();
27468
27590
  const absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0;
27469
27591
  try {
27470
- const ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
27592
+ const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset, this._interpolationConfig);
27471
27593
  if (ast) {
27472
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
27594
+ this.errors.push(...ast.errors);
27473
27595
  }
27474
27596
  if (!ast || ast.ast instanceof EmptyExpr$1) {
27475
27597
  this._reportError(`Empty expressions are not allowed`, sourceSpan);
27476
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
27598
+ return this._exprParser.wrapLiteralPrimitive('ERROR', sourceSpan, absoluteOffset);
27477
27599
  }
27478
27600
  return ast;
27479
27601
  }
27480
27602
  catch (e) {
27481
27603
  this._reportError(`${e}`, sourceSpan);
27482
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
27604
+ return this._exprParser.wrapLiteralPrimitive('ERROR', sourceSpan, absoluteOffset);
27483
27605
  }
27484
27606
  }
27485
- _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR, relatedError) {
27486
- this.errors.push(new ParseError(sourceSpan, message, level, relatedError));
27487
- }
27488
- _reportExpressionParserErrors(errors, sourceSpan) {
27489
- for (const error of errors) {
27490
- this._reportError(error.message, sourceSpan, undefined, error);
27491
- }
27607
+ _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
27608
+ this.errors.push(new ParseError(sourceSpan, message, level));
27492
27609
  }
27493
27610
  /**
27494
27611
  * @param propName the name of the property / attribute
@@ -27528,7 +27645,7 @@ class BindingParser {
27528
27645
  return false;
27529
27646
  }
27530
27647
  }
27531
- function isAnimationLabel(name) {
27648
+ function isLegacyAnimationLabel(name) {
27532
27649
  return name[0] == '@';
27533
27650
  }
27534
27651
  function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
@@ -29526,8 +29643,11 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29526
29643
  constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, undefined, exports.StmtModifier.Final));
29527
29644
  allDeferrableDepsFn = variable(fnName);
29528
29645
  }
29646
+ const compilationMode = meta.isStandalone && !meta.hasDirectiveDependencies
29647
+ ? TemplateCompilationMode.DomOnly
29648
+ : TemplateCompilationMode.Full;
29529
29649
  // First the template is ingested into IR:
29530
- const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled());
29650
+ const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, compilationMode, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled());
29531
29651
  // Then the IR is transformed to prepare it for cod egeneration.
29532
29652
  transform(tpl, CompilationJobKind.Tmpl);
29533
29653
  // Finally we emit the template function:
@@ -31307,6 +31427,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
31307
31427
  declarations.push(...decl.directives.map((dir) => convertDirectiveDeclarationToMetadata(dir)));
31308
31428
  decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
31309
31429
  }
31430
+ const hasDirectiveDependencies = declarations.every(({ kind }) => kind === exports.R3TemplateDependencyKind.Directive || kind === exports.R3TemplateDependencyKind.NgModule);
31310
31431
  return {
31311
31432
  ...convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan),
31312
31433
  template,
@@ -31322,6 +31443,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
31322
31443
  relativeContextFilePath: '',
31323
31444
  i18nUseExternalIds: true,
31324
31445
  relativeTemplatePath: null,
31446
+ hasDirectiveDependencies,
31325
31447
  };
31326
31448
  }
31327
31449
  function convertDeclarationFacadeToMetadata(declaration) {
@@ -32047,7 +32169,7 @@ class _Visitor {
32047
32169
  this._msgCountAtSectionStart = undefined;
32048
32170
  }
32049
32171
  _reportError(node, msg) {
32050
- this._errors.push(new I18nError(node.sourceSpan, msg));
32172
+ this._errors.push(new ParseError(node.sourceSpan, msg));
32051
32173
  }
32052
32174
  }
32053
32175
  function _isOpeningComment(n) {
@@ -32082,7 +32204,7 @@ function isAttrNode(ast) {
32082
32204
  * @description
32083
32205
  * Entry point for all public APIs of the compiler package.
32084
32206
  */
32085
- new Version('20.1.0-next.2');
32207
+ new Version('20.1.0-rc.0');
32086
32208
 
32087
32209
  //////////////////////////////////////
32088
32210
  // THIS FILE HAS GLOBAL SIDE EFFECT //
@@ -33102,7 +33224,7 @@ class NodeJSPathManipulation {
33102
33224
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
33103
33225
  // CommonJS/ESM interop for determining the current file name and containing dir.
33104
33226
  const isCommonJS = typeof __filename !== 'undefined';
33105
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-CY7a8ko8.cjs', document.baseURI).href));
33227
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-CwuJOWZI.cjs', document.baseURI).href));
33106
33228
  const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
33107
33229
  /**
33108
33230
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
@@ -37345,26 +37467,30 @@ exports.PerfPhase = void 0;
37345
37467
  * Time spent by the Angular Language Service calculating outlining spans.
37346
37468
  */
37347
37469
  PerfPhase[PerfPhase["OutliningSpans"] = 24] = "OutliningSpans";
37348
- /**
37349
- * Tracks the number of `PerfPhase`s, and must appear at the end of the list.
37350
- */
37351
- PerfPhase[PerfPhase["LAST"] = 25] = "LAST";
37352
37470
  /**
37353
37471
  * Time spent by the Angular Language Service calculating code fixes.
37354
37472
  */
37355
- PerfPhase[PerfPhase["LsCodeFixes"] = 26] = "LsCodeFixes";
37473
+ PerfPhase[PerfPhase["LsCodeFixes"] = 25] = "LsCodeFixes";
37356
37474
  /**
37357
37475
  * Time spent by the Angular Language Service to fix all detected same type errors.
37358
37476
  */
37359
- PerfPhase[PerfPhase["LsCodeFixesAll"] = 27] = "LsCodeFixesAll";
37477
+ PerfPhase[PerfPhase["LsCodeFixesAll"] = 26] = "LsCodeFixesAll";
37360
37478
  /**
37361
37479
  * Time spent computing possible Angular refactorings.
37362
37480
  */
37363
- PerfPhase[PerfPhase["LSComputeApplicableRefactorings"] = 28] = "LSComputeApplicableRefactorings";
37481
+ PerfPhase[PerfPhase["LSComputeApplicableRefactorings"] = 27] = "LSComputeApplicableRefactorings";
37364
37482
  /**
37365
37483
  * Time spent computing changes for applying a given refactoring.
37366
37484
  */
37367
- PerfPhase[PerfPhase["LSApplyRefactoring"] = 29] = "LSApplyRefactoring";
37485
+ PerfPhase[PerfPhase["LSApplyRefactoring"] = 28] = "LSApplyRefactoring";
37486
+ /**
37487
+ * Time spent by the Angular Language Service calculating semantic classifications.
37488
+ */
37489
+ PerfPhase[PerfPhase["LSSemanticClassification"] = 29] = "LSSemanticClassification";
37490
+ /**
37491
+ * Tracks the number of `PerfPhase`s, and must appear at the end of the list.
37492
+ */
37493
+ PerfPhase[PerfPhase["LAST"] = 30] = "LAST";
37368
37494
  })(exports.PerfPhase || (exports.PerfPhase = {}));
37369
37495
  /**
37370
37496
  * Represents some occurrence during compilation, and is tracked with a counter.
@@ -38196,6 +38322,16 @@ const BINARY_OPERATORS$1 = /* @__PURE__ */ new Map([
38196
38322
  [BinaryOperator.NullishCoalesce, '??'],
38197
38323
  [BinaryOperator.Exponentiation, '**'],
38198
38324
  [BinaryOperator.In, 'in'],
38325
+ [BinaryOperator.Assign, '='],
38326
+ [BinaryOperator.AdditionAssignment, '+='],
38327
+ [BinaryOperator.SubtractionAssignment, '-='],
38328
+ [BinaryOperator.MultiplicationAssignment, '*='],
38329
+ [BinaryOperator.DivisionAssignment, '/='],
38330
+ [BinaryOperator.RemainderAssignment, '%='],
38331
+ [BinaryOperator.ExponentiationAssignment, '**='],
38332
+ [BinaryOperator.AndAssignment, '&&='],
38333
+ [BinaryOperator.OrAssignment, '||='],
38334
+ [BinaryOperator.NullishCoalesceAssignment, '??='],
38199
38335
  ]);
38200
38336
  class ExpressionTranslatorVisitor {
38201
38337
  factory;
@@ -38359,13 +38495,14 @@ class ExpressionTranslatorVisitor {
38359
38495
  : ast.body.visitExpression(this, context));
38360
38496
  }
38361
38497
  visitBinaryOperatorExpr(ast, context) {
38362
- if (ast.operator === BinaryOperator.Assign) {
38363
- return this.factory.createAssignment(ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context));
38364
- }
38365
38498
  if (!BINARY_OPERATORS$1.has(ast.operator)) {
38366
38499
  throw new Error(`Unknown binary operator: ${BinaryOperator[ast.operator]}`);
38367
38500
  }
38368
- return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), BINARY_OPERATORS$1.get(ast.operator), ast.rhs.visitExpression(this, context));
38501
+ const operator = BINARY_OPERATORS$1.get(ast.operator);
38502
+ if (ast.isAssignment()) {
38503
+ return this.factory.createAssignment(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
38504
+ }
38505
+ return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
38369
38506
  }
38370
38507
  visitReadPropExpr(ast, context) {
38371
38508
  return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
@@ -38897,6 +39034,16 @@ const BINARY_OPERATORS = /* @__PURE__ */ (() => ({
38897
39034
  '+': ts.SyntaxKind.PlusToken,
38898
39035
  '??': ts.SyntaxKind.QuestionQuestionToken,
38899
39036
  'in': ts.SyntaxKind.InKeyword,
39037
+ '=': ts.SyntaxKind.EqualsToken,
39038
+ '+=': ts.SyntaxKind.PlusEqualsToken,
39039
+ '-=': ts.SyntaxKind.MinusEqualsToken,
39040
+ '*=': ts.SyntaxKind.AsteriskEqualsToken,
39041
+ '/=': ts.SyntaxKind.SlashEqualsToken,
39042
+ '%=': ts.SyntaxKind.PercentEqualsToken,
39043
+ '**=': ts.SyntaxKind.AsteriskAsteriskEqualsToken,
39044
+ '&&=': ts.SyntaxKind.AmpersandAmpersandEqualsToken,
39045
+ '||=': ts.SyntaxKind.BarBarEqualsToken,
39046
+ '??=': ts.SyntaxKind.QuestionQuestionEqualsToken,
38900
39047
  }))();
38901
39048
  const VAR_TYPES = /* @__PURE__ */ (() => ({
38902
39049
  'const': ts.NodeFlags.Const,
@@ -38914,8 +39061,8 @@ class TypeScriptAstFactory {
38914
39061
  }
38915
39062
  attachComments = attachComments;
38916
39063
  createArrayLiteral = ts.factory.createArrayLiteralExpression;
38917
- createAssignment(target, value) {
38918
- return ts.factory.createBinaryExpression(target, ts.SyntaxKind.EqualsToken, value);
39064
+ createAssignment(target, operator, value) {
39065
+ return ts.factory.createBinaryExpression(target, BINARY_OPERATORS[operator], value);
38919
39066
  }
38920
39067
  createBinaryExpression(leftOperand, operator, rightOperand) {
38921
39068
  return ts.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS[operator], rightOperand);
@@ -39414,6 +39561,9 @@ function validateAccessOfInitializerApiMember({ api, call }, member) {
39414
39561
  * @returns The parsed initializer API, or null if none was found.
39415
39562
  */
39416
39563
  function tryParseInitializerApi(functions, expression, reflector, importTracker) {
39564
+ if (ts.isAsExpression(expression) || ts.isParenthesizedExpression(expression)) {
39565
+ return tryParseInitializerApi(functions, expression.expression, reflector, importTracker);
39566
+ }
39417
39567
  if (!ts.isCallExpression(expression)) {
39418
39568
  return null;
39419
39569
  }
@@ -40727,11 +40877,11 @@ function getHostBindingErrorNode(error, hostExpr) {
40727
40877
  // confidently match the error to its expression by looking at the string value that the parser
40728
40878
  // failed to parse and the initializers for each of the properties. If we fail to match, we fall
40729
40879
  // back to the old behavior where the error is reported on the entire `host` object.
40730
- if (ts.isObjectLiteralExpression(hostExpr) && error.relatedError instanceof ParserError) {
40880
+ if (ts.isObjectLiteralExpression(hostExpr)) {
40731
40881
  for (const prop of hostExpr.properties) {
40732
40882
  if (ts.isPropertyAssignment(prop) &&
40733
40883
  ts.isStringLiteralLike(prop.initializer) &&
40734
- prop.initializer.text === error.relatedError.input) {
40884
+ error.msg.includes(`[${prop.initializer.text}]`)) {
40735
40885
  return prop.initializer;
40736
40886
  }
40737
40887
  }
@@ -41560,97 +41710,88 @@ class CompletionEngine {
41560
41710
  }
41561
41711
  }
41562
41712
 
41563
- const comma = ','.charCodeAt(0);
41564
- const semicolon = ';'.charCodeAt(0);
41565
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
41566
- const intToChar = new Uint8Array(64); // 64 possible chars.
41567
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
41713
+ // src/vlq.ts
41714
+ var comma = ",".charCodeAt(0);
41715
+ var semicolon = ";".charCodeAt(0);
41716
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
41717
+ var intToChar = new Uint8Array(64);
41718
+ var charToInt = new Uint8Array(128);
41568
41719
  for (let i = 0; i < chars.length; i++) {
41569
- const c = chars.charCodeAt(i);
41570
- intToChar[i] = c;
41571
- charToInt[c] = i;
41720
+ const c = chars.charCodeAt(i);
41721
+ intToChar[i] = c;
41722
+ charToInt[c] = i;
41572
41723
  }
41573
41724
  function encodeInteger(builder, num, relative) {
41574
- let delta = num - relative;
41575
- delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
41576
- do {
41577
- let clamped = delta & 0b011111;
41578
- delta >>>= 5;
41579
- if (delta > 0)
41580
- clamped |= 0b100000;
41581
- builder.write(intToChar[clamped]);
41582
- } while (delta > 0);
41583
- return num;
41584
- }
41585
-
41586
- const bufLength = 1024 * 16;
41587
- // Provide a fallback for older environments.
41588
- const td = typeof TextDecoder !== 'undefined'
41589
- ? /* #__PURE__ */ new TextDecoder()
41590
- : typeof Buffer !== 'undefined'
41591
- ? {
41592
- decode(buf) {
41593
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
41594
- return out.toString();
41595
- },
41596
- }
41597
- : {
41598
- decode(buf) {
41599
- let out = '';
41600
- for (let i = 0; i < buf.length; i++) {
41601
- out += String.fromCharCode(buf[i]);
41602
- }
41603
- return out;
41604
- },
41605
- };
41606
- class StringWriter {
41607
- constructor() {
41608
- this.pos = 0;
41609
- this.out = '';
41610
- this.buffer = new Uint8Array(bufLength);
41611
- }
41612
- write(v) {
41613
- const { buffer } = this;
41614
- buffer[this.pos++] = v;
41615
- if (this.pos === bufLength) {
41616
- this.out += td.decode(buffer);
41617
- this.pos = 0;
41618
- }
41619
- }
41620
- flush() {
41621
- const { buffer, out, pos } = this;
41622
- return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
41725
+ let delta = num - relative;
41726
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
41727
+ do {
41728
+ let clamped = delta & 31;
41729
+ delta >>>= 5;
41730
+ if (delta > 0) clamped |= 32;
41731
+ builder.write(intToChar[clamped]);
41732
+ } while (delta > 0);
41733
+ return num;
41734
+ }
41735
+
41736
+ // src/strings.ts
41737
+ var bufLength = 1024 * 16;
41738
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
41739
+ decode(buf) {
41740
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
41741
+ return out.toString();
41742
+ }
41743
+ } : {
41744
+ decode(buf) {
41745
+ let out = "";
41746
+ for (let i = 0; i < buf.length; i++) {
41747
+ out += String.fromCharCode(buf[i]);
41623
41748
  }
41624
- }
41749
+ return out;
41750
+ }
41751
+ };
41752
+ var StringWriter = class {
41753
+ constructor() {
41754
+ this.pos = 0;
41755
+ this.out = "";
41756
+ this.buffer = new Uint8Array(bufLength);
41757
+ }
41758
+ write(v) {
41759
+ const { buffer } = this;
41760
+ buffer[this.pos++] = v;
41761
+ if (this.pos === bufLength) {
41762
+ this.out += td.decode(buffer);
41763
+ this.pos = 0;
41764
+ }
41765
+ }
41766
+ flush() {
41767
+ const { buffer, out, pos } = this;
41768
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
41769
+ }
41770
+ };
41625
41771
  function encode(decoded) {
41626
- const writer = new StringWriter();
41627
- let sourcesIndex = 0;
41628
- let sourceLine = 0;
41629
- let sourceColumn = 0;
41630
- let namesIndex = 0;
41631
- for (let i = 0; i < decoded.length; i++) {
41632
- const line = decoded[i];
41633
- if (i > 0)
41634
- writer.write(semicolon);
41635
- if (line.length === 0)
41636
- continue;
41637
- let genColumn = 0;
41638
- for (let j = 0; j < line.length; j++) {
41639
- const segment = line[j];
41640
- if (j > 0)
41641
- writer.write(comma);
41642
- genColumn = encodeInteger(writer, segment[0], genColumn);
41643
- if (segment.length === 1)
41644
- continue;
41645
- sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
41646
- sourceLine = encodeInteger(writer, segment[2], sourceLine);
41647
- sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
41648
- if (segment.length === 4)
41649
- continue;
41650
- namesIndex = encodeInteger(writer, segment[4], namesIndex);
41651
- }
41652
- }
41653
- return writer.flush();
41772
+ const writer = new StringWriter();
41773
+ let sourcesIndex = 0;
41774
+ let sourceLine = 0;
41775
+ let sourceColumn = 0;
41776
+ let namesIndex = 0;
41777
+ for (let i = 0; i < decoded.length; i++) {
41778
+ const line = decoded[i];
41779
+ if (i > 0) writer.write(semicolon);
41780
+ if (line.length === 0) continue;
41781
+ let genColumn = 0;
41782
+ for (let j = 0; j < line.length; j++) {
41783
+ const segment = line[j];
41784
+ if (j > 0) writer.write(comma);
41785
+ genColumn = encodeInteger(writer, segment[0], genColumn);
41786
+ if (segment.length === 1) continue;
41787
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
41788
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
41789
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
41790
+ if (segment.length === 4) continue;
41791
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
41792
+ }
41793
+ }
41794
+ return writer.flush();
41654
41795
  }
41655
41796
 
41656
41797
  class BitSet {
@@ -43538,8 +43679,8 @@ function createNodeFromListenerDecorator(decorator, parser, listeners) {
43538
43679
  let phase;
43539
43680
  let target;
43540
43681
  if (eventNameNode.text.startsWith('@')) {
43541
- const parsedName = parser.parseAnimationEventName(eventNameNode.text);
43542
- type = exports.ParsedEventType.Animation;
43682
+ const parsedName = parser.parseLegacyAnimationEventName(eventNameNode.text);
43683
+ type = exports.ParsedEventType.LegacyAnimation;
43543
43684
  eventName = parsedName.eventName;
43544
43685
  phase = parsedName.phase;
43545
43686
  target = null;
@@ -43579,7 +43720,7 @@ function inferBoundAttribute(name) {
43579
43720
  }
43580
43721
  else if (name.startsWith(animationPrefix)) {
43581
43722
  attrName = name.slice(animationPrefix.length);
43582
- type = exports.BindingType.Animation;
43723
+ type = exports.BindingType.LegacyAnimation;
43583
43724
  }
43584
43725
  else {
43585
43726
  attrName = name;
@@ -44201,6 +44342,22 @@ class OutOfBandDiagnosticRecorderImpl {
44201
44342
  * is ever produced per node.
44202
44343
  */
44203
44344
  recordedPipes = new Set();
44345
+ /** Common pipes that can be suggested to users. */
44346
+ pipeSuggestions = new Map([
44347
+ ['async', 'AsyncPipe'],
44348
+ ['uppercase', 'UpperCasePipe'],
44349
+ ['lowercase', 'LowerCasePipe'],
44350
+ ['json', 'JsonPipe'],
44351
+ ['slice', 'SlicePipe'],
44352
+ ['number', 'DecimalPipe'],
44353
+ ['percent', 'PercentPipe'],
44354
+ ['titlecase', 'TitleCasePipe'],
44355
+ ['currency', 'CurrencyPipe'],
44356
+ ['date', 'DatePipe'],
44357
+ ['i18nPlural', 'I18nPluralPipe'],
44358
+ ['i18nSelect', 'I18nSelectPipe'],
44359
+ ['keyvalue', 'KeyValuePipe'],
44360
+ ]);
44204
44361
  constructor(resolver) {
44205
44362
  this.resolver = resolver;
44206
44363
  }
@@ -44213,16 +44370,30 @@ class OutOfBandDiagnosticRecorderImpl {
44213
44370
  const errorMsg = `No directive found with exportAs '${value}'.`;
44214
44371
  this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
44215
44372
  }
44216
- missingPipe(id, ast) {
44373
+ missingPipe(id, ast, isStandalone) {
44217
44374
  if (this.recordedPipes.has(ast)) {
44218
44375
  return;
44219
44376
  }
44220
- const mapping = this.resolver.getTemplateSourceMapping(id);
44221
- const errorMsg = `No pipe found with name '${ast.name}'.`;
44222
44377
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, ast.nameSpan);
44223
44378
  if (sourceSpan === null) {
44224
44379
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
44225
44380
  }
44381
+ const mapping = this.resolver.getTemplateSourceMapping(id);
44382
+ let errorMsg = `No pipe found with name '${ast.name}'.`;
44383
+ if (this.pipeSuggestions.has(ast.name)) {
44384
+ const suggestedClassName = this.pipeSuggestions.get(ast.name);
44385
+ const suggestedImport = '@angular/common';
44386
+ if (isStandalone) {
44387
+ errorMsg +=
44388
+ `\nTo fix this, import the "${suggestedClassName}" class from "${suggestedImport}"` +
44389
+ ` and add it to the "imports" array of the component.`;
44390
+ }
44391
+ else {
44392
+ errorMsg +=
44393
+ `\nTo fix this, import the "${suggestedClassName}" class from "${suggestedImport}"` +
44394
+ ` and add it to the "imports" array of the module declaring the component.`;
44395
+ }
44396
+ }
44226
44397
  this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.MISSING_PIPE), errorMsg));
44227
44398
  this.recordedPipes.add(ast);
44228
44399
  }
@@ -44595,6 +44766,16 @@ const BINARY_OPS = new Map([
44595
44766
  ['|', ts.SyntaxKind.BarToken],
44596
44767
  ['??', ts.SyntaxKind.QuestionQuestionToken],
44597
44768
  ['in', ts.SyntaxKind.InKeyword],
44769
+ ['=', ts.SyntaxKind.EqualsToken],
44770
+ ['+=', ts.SyntaxKind.PlusEqualsToken],
44771
+ ['-=', ts.SyntaxKind.MinusEqualsToken],
44772
+ ['*=', ts.SyntaxKind.AsteriskEqualsToken],
44773
+ ['/=', ts.SyntaxKind.SlashEqualsToken],
44774
+ ['%=', ts.SyntaxKind.PercentEqualsToken],
44775
+ ['**=', ts.SyntaxKind.AsteriskAsteriskEqualsToken],
44776
+ ['&&=', ts.SyntaxKind.AmpersandAmpersandEqualsToken],
44777
+ ['||=', ts.SyntaxKind.BarBarEqualsToken],
44778
+ ['??=', ts.SyntaxKind.QuestionQuestionEqualsToken],
44598
44779
  ]);
44599
44780
  /**
44600
44781
  * Convert an `AST` to TypeScript code directly, without going through an intermediate `Expression`
@@ -46167,7 +46348,7 @@ class TcbDirectiveOutputsOp extends TcbOp {
46167
46348
  let dirId = null;
46168
46349
  const outputs = this.dir.outputs;
46169
46350
  for (const output of this.node.outputs) {
46170
- if (output.type === exports.ParsedEventType.Animation ||
46351
+ if (output.type === exports.ParsedEventType.LegacyAnimation ||
46171
46352
  !outputs.hasBindingPropertyName(output.name)) {
46172
46353
  continue;
46173
46354
  }
@@ -46252,7 +46433,7 @@ class TcbUnclaimedOutputsOp extends TcbOp {
46252
46433
  continue;
46253
46434
  }
46254
46435
  }
46255
- if (output.type === exports.ParsedEventType.Animation) {
46436
+ if (output.type === exports.ParsedEventType.LegacyAnimation) {
46256
46437
  // Animation output bindings always have an `$event` parameter of type `AnimationEvent`.
46257
46438
  const eventType = this.tcb.env.config.checkTypeOfAnimationEvents
46258
46439
  ? this.tcb.env.referenceExternalType('@angular/animations', 'AnimationEvent')
@@ -47470,7 +47651,7 @@ class TcbExpressionTranslator {
47470
47651
  return targetExpression;
47471
47652
  }
47472
47653
  else if (ast instanceof Binary &&
47473
- ast.operation === '=' &&
47654
+ Binary.isAssignmentOperation(ast.operation) &&
47474
47655
  ast.left instanceof PropertyRead &&
47475
47656
  ast.left.receiver instanceof ImplicitReceiver) {
47476
47657
  const read = ast.left;
@@ -47512,7 +47693,7 @@ class TcbExpressionTranslator {
47512
47693
  let pipe;
47513
47694
  if (pipeMeta === null) {
47514
47695
  // No pipe by that name exists in scope. Record this as an error.
47515
- this.tcb.oobRecorder.missingPipe(this.tcb.id, ast);
47696
+ this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
47516
47697
  // Use an 'any' value to at least allow the rest of the expression to be checked.
47517
47698
  pipe = ANY_EXPRESSION;
47518
47699
  }
@@ -48603,7 +48784,7 @@ class SymbolBuilder {
48603
48784
  isStructural: meta.isStructural,
48604
48785
  isInScope: true,
48605
48786
  isHostDirective: false,
48606
- tsCompletionEntryInfo: null,
48787
+ tsCompletionEntryInfos: null,
48607
48788
  };
48608
48789
  symbols.push(directiveSymbol);
48609
48790
  seenDirectives.add(declaration);
@@ -48639,7 +48820,7 @@ class SymbolBuilder {
48639
48820
  kind: exports.SymbolKind.Directive,
48640
48821
  isStructural: meta.isStructural,
48641
48822
  isInScope: true,
48642
- tsCompletionEntryInfo: null,
48823
+ tsCompletionEntryInfos: null,
48643
48824
  };
48644
48825
  symbols.push(directiveSymbol);
48645
48826
  seenDirectives.add(node);
@@ -48898,7 +49079,7 @@ class SymbolBuilder {
48898
49079
  ngModule,
48899
49080
  isHostDirective: false,
48900
49081
  isInScope: true, // TODO: this should always be in scope in this context, right?
48901
- tsCompletionEntryInfo: null,
49082
+ tsCompletionEntryInfos: null,
48902
49083
  };
48903
49084
  }
48904
49085
  getSymbolOfVariable(variable) {
@@ -49059,7 +49240,7 @@ class SymbolBuilder {
49059
49240
  // AST so there is no way to retrieve a `Symbol` for just the `name` via a specific node.
49060
49241
  // Also skipping SafePropertyReads as it breaks nullish coalescing not nullable extended diagnostic
49061
49242
  if (expression instanceof Binary &&
49062
- expression.operation === '=' &&
49243
+ Binary.isAssignmentOperation(expression.operation) &&
49063
49244
  expression.left instanceof PropertyRead) {
49064
49245
  withSpan = expression.left.nameSpan;
49065
49246
  }
@@ -49797,7 +49978,11 @@ class TemplateTypeCheckerImpl {
49797
49978
  return {
49798
49979
  ...withScope,
49799
49980
  isInScope,
49800
- tsCompletionEntryInfo,
49981
+ /**
49982
+ * The Angular LS only supports displaying one directive at a time when
49983
+ * providing the completion item, even if it's exported by multiple modules.
49984
+ */
49985
+ tsCompletionEntryInfos: tsCompletionEntryInfo !== null ? [tsCompletionEntryInfo] : null,
49801
49986
  };
49802
49987
  }
49803
49988
  getElementsInFileScope(component) {
@@ -49839,7 +50024,8 @@ class TemplateTypeCheckerImpl {
49839
50024
  const currentComponentFileName = component.getSourceFile().fileName;
49840
50025
  for (const { symbol, data } of entries ?? []) {
49841
50026
  const symbolFileName = symbol?.declarations?.[0]?.getSourceFile().fileName;
49842
- if (symbolFileName === undefined) {
50027
+ const symbolName = symbol?.name;
50028
+ if (symbolFileName === undefined || symbolName === undefined) {
49843
50029
  continue;
49844
50030
  }
49845
50031
  if (symbolFileName === currentComponentFileName) {
@@ -49859,23 +50045,22 @@ class TemplateTypeCheckerImpl {
49859
50045
  });
49860
50046
  }
49861
50047
  else {
49862
- const ngModuleMeta = this.metaReader.getNgModuleMetadata(ref);
49863
- if (ngModuleMeta === null) {
49864
- continue;
49865
- }
49866
- for (const moduleExports of ngModuleMeta.exports) {
49867
- const directiveMeta = this.metaReader.getDirectiveMetadata(moduleExports);
49868
- if (directiveMeta === null) {
49869
- continue;
49870
- }
49871
- directiveDecls.push({
49872
- meta: directiveMeta,
49873
- ref: moduleExports,
49874
- });
49875
- }
50048
+ const directiveDeclsForNgModule = this.getDirectiveDeclsForNgModule(ref);
50049
+ directiveDecls.push(...directiveDeclsForNgModule);
49876
50050
  }
49877
50051
  for (const directiveDecl of directiveDecls) {
50052
+ const cachedCompletionEntryInfos = resultingDirectives.get(directiveDecl.ref.node)?.tsCompletionEntryInfos ?? [];
50053
+ cachedCompletionEntryInfos.push({
50054
+ tsCompletionEntryData: data,
50055
+ tsCompletionEntrySymbolFileName: symbolFileName,
50056
+ tsCompletionEntrySymbolName: symbolName,
50057
+ });
49878
50058
  if (resultingDirectives.has(directiveDecl.ref.node)) {
50059
+ const directiveInfo = resultingDirectives.get(directiveDecl.ref.node);
50060
+ resultingDirectives.set(directiveDecl.ref.node, {
50061
+ ...directiveInfo,
50062
+ tsCompletionEntryInfos: cachedCompletionEntryInfos,
50063
+ });
49879
50064
  continue;
49880
50065
  }
49881
50066
  const withScope = this.scopeDataOfDirectiveMeta(typeChecker, directiveDecl.meta);
@@ -49885,15 +50070,41 @@ class TemplateTypeCheckerImpl {
49885
50070
  resultingDirectives.set(directiveDecl.ref.node, {
49886
50071
  ...withScope,
49887
50072
  isInScope: false,
49888
- tsCompletionEntryInfo: {
49889
- tsCompletionEntryData: data,
49890
- tsCompletionEntrySymbolFileName: symbolFileName,
49891
- },
50073
+ tsCompletionEntryInfos: cachedCompletionEntryInfos,
49892
50074
  });
49893
50075
  }
49894
50076
  }
49895
50077
  return Array.from(resultingDirectives.values());
49896
50078
  }
50079
+ /**
50080
+ * If the NgModule exports a new module, we need to recursively get its directives.
50081
+ */
50082
+ getDirectiveDeclsForNgModule(ref) {
50083
+ const ngModuleMeta = this.metaReader.getNgModuleMetadata(ref);
50084
+ if (ngModuleMeta === null) {
50085
+ return [];
50086
+ }
50087
+ const directiveDecls = [];
50088
+ for (const moduleExports of ngModuleMeta.exports) {
50089
+ const directiveMeta = this.metaReader.getDirectiveMetadata(moduleExports);
50090
+ if (directiveMeta !== null) {
50091
+ directiveDecls.push({
50092
+ meta: directiveMeta,
50093
+ ref: moduleExports,
50094
+ });
50095
+ }
50096
+ else {
50097
+ const ngModuleMeta = this.metaReader.getNgModuleMetadata(moduleExports);
50098
+ if (ngModuleMeta === null) {
50099
+ continue;
50100
+ }
50101
+ // If the export is an NgModule, we need to recursively get its directives.
50102
+ const nestedDirectiveDecls = this.getDirectiveDeclsForNgModule(moduleExports);
50103
+ directiveDecls.push(...nestedDirectiveDecls);
50104
+ }
50105
+ }
50106
+ return directiveDecls;
50107
+ }
49897
50108
  getPotentialElementTags(component, tsLs, options) {
49898
50109
  if (this.elementTagCache.has(component)) {
49899
50110
  return this.elementTagCache.get(component);
@@ -50002,27 +50213,51 @@ class TemplateTypeCheckerImpl {
50002
50213
  }
50003
50214
  return null;
50004
50215
  }
50005
- getPotentialImportsFor(toImport, inContext, importMode) {
50216
+ getPotentialImportsFor(toImport, inContext, importMode, potentialDirectiveModuleSpecifierResolver) {
50006
50217
  const imports = [];
50007
50218
  const meta = this.metaReader.getDirectiveMetadata(toImport) ?? this.metaReader.getPipeMetadata(toImport);
50008
50219
  if (meta === null) {
50009
50220
  return imports;
50010
50221
  }
50222
+ /**
50223
+ * When providing completion items, the Angular Language Service only supports displaying
50224
+ * one directive at a time. If a directive is exported by two different modules,
50225
+ * the Language Service will select the first module. To ensure the most appropriate directive
50226
+ * is shown, move the likely one to the top of the import list.
50227
+ *
50228
+ * When providing the code action for the directive. All the imports will show for the developer to choose.
50229
+ */
50230
+ let highestImportPriority = -1;
50231
+ const collectImports = (emit, moduleSpecifier) => {
50232
+ if (emit === null) {
50233
+ return;
50234
+ }
50235
+ imports.push({
50236
+ ...emit,
50237
+ moduleSpecifier: moduleSpecifier ?? emit.moduleSpecifier,
50238
+ });
50239
+ if (moduleSpecifier !== undefined && highestImportPriority === -1) {
50240
+ highestImportPriority = imports.length - 1;
50241
+ }
50242
+ };
50011
50243
  if (meta.isStandalone || importMode === exports.PotentialImportMode.ForceDirect) {
50012
50244
  const emitted = this.emit(exports.PotentialImportKind.Standalone, toImport, inContext);
50013
- if (emitted !== null) {
50014
- imports.push(emitted);
50015
- }
50245
+ const moduleSpecifier = potentialDirectiveModuleSpecifierResolver?.resolve(toImport, inContext);
50246
+ collectImports(emitted, moduleSpecifier);
50016
50247
  }
50017
50248
  const exportingNgModules = this.ngModuleIndex.getNgModulesExporting(meta.ref.node);
50018
50249
  if (exportingNgModules !== null) {
50019
50250
  for (const exporter of exportingNgModules) {
50020
50251
  const emittedRef = this.emit(exports.PotentialImportKind.NgModule, exporter, inContext);
50021
- if (emittedRef !== null) {
50022
- imports.push(emittedRef);
50023
- }
50252
+ const moduleSpecifier = potentialDirectiveModuleSpecifierResolver?.resolve(exporter, inContext);
50253
+ collectImports(emittedRef, moduleSpecifier);
50024
50254
  }
50025
50255
  }
50256
+ // move the import with module specifier from the tsLs to top in the imports array
50257
+ if (highestImportPriority > 0) {
50258
+ const highImport = imports.splice(highestImportPriority, 1)[0];
50259
+ imports.unshift(highImport);
50260
+ }
50026
50261
  return imports;
50027
50262
  }
50028
50263
  getComponentScope(component) {
@@ -50084,7 +50319,7 @@ class TemplateTypeCheckerImpl {
50084
50319
  selector: dep.selector,
50085
50320
  tsSymbol,
50086
50321
  ngModule,
50087
- tsCompletionEntryInfo: null,
50322
+ tsCompletionEntryInfos: null,
50088
50323
  };
50089
50324
  }
50090
50325
  scopeDataOfPipeMeta(typeChecker, dep) {
@@ -50096,7 +50331,7 @@ class TemplateTypeCheckerImpl {
50096
50331
  ref: dep.ref,
50097
50332
  name: dep.name,
50098
50333
  tsSymbol,
50099
- tsCompletionEntryInfo: null,
50334
+ tsCompletionEntryInfos: null,
50100
50335
  };
50101
50336
  }
50102
50337
  }
@@ -50277,7 +50512,6 @@ exports.FnParam = FnParam;
50277
50512
  exports.ForLoopBlock = ForLoopBlock;
50278
50513
  exports.FunctionExpr = FunctionExpr;
50279
50514
  exports.HtmlParser = HtmlParser;
50280
- exports.I18nError = I18nError;
50281
50515
  exports.INPUT_INITIALIZER_FN = INPUT_INITIALIZER_FN;
50282
50516
  exports.Icu = Icu;
50283
50517
  exports.IcuPlaceholder = IcuPlaceholder;
@@ -50300,6 +50534,7 @@ exports.NULL_EXPR = NULL_EXPR;
50300
50534
  exports.NgOriginalFile = NgOriginalFile;
50301
50535
  exports.NodeJSFileSystem = NodeJSFileSystem;
50302
50536
  exports.OUTPUT_INITIALIZER_FNS = OUTPUT_INITIALIZER_FNS;
50537
+ exports.ParseError = ParseError;
50303
50538
  exports.ParseLocation = ParseLocation;
50304
50539
  exports.ParseSourceFile = ParseSourceFile;
50305
50540
  exports.ParseSourceSpan = ParseSourceSpan;