@angular/core 18.0.0-next.1 → 18.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/esm2022/src/authoring/input/input.mjs +37 -14
  2. package/esm2022/src/authoring/input/input_signal.mjs +1 -1
  3. package/esm2022/src/authoring/input/input_signal_node.mjs +1 -1
  4. package/esm2022/src/authoring/input/input_type_checking.mjs +1 -1
  5. package/esm2022/src/authoring/model/model.mjs +35 -15
  6. package/esm2022/src/authoring/output/output.mjs +32 -10
  7. package/esm2022/src/authoring/queries.mjs +11 -1
  8. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +21 -4
  9. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +5 -1
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +88 -20
  11. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  12. package/esm2022/src/core_private_export.mjs +2 -2
  13. package/esm2022/src/core_render3_private_export.mjs +2 -2
  14. package/esm2022/src/defer/instructions.mjs +23 -9
  15. package/esm2022/src/platform/platform_ref.mjs +3 -2
  16. package/esm2022/src/render3/component_ref.mjs +1 -1
  17. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +2 -2
  18. package/esm2022/src/render3/instructions/control_flow.mjs +24 -15
  19. package/esm2022/src/render3/instructions/projection.mjs +35 -9
  20. package/esm2022/src/render3/instructions/template.mjs +45 -24
  21. package/esm2022/src/render3/jit/partial.mjs +13 -2
  22. package/esm2022/src/render3/util/injector_discovery_utils.mjs +2 -2
  23. package/esm2022/src/util/callback_scheduler.mjs +6 -1
  24. package/esm2022/src/version.mjs +1 -1
  25. package/esm2022/testing/src/component_fixture.mjs +23 -58
  26. package/esm2022/testing/src/logger.mjs +3 -3
  27. package/esm2022/testing/src/test_bed.mjs +4 -4
  28. package/fesm2022/core.mjs +388 -148
  29. package/fesm2022/core.mjs.map +1 -1
  30. package/fesm2022/primitives/signals.mjs +1 -1
  31. package/fesm2022/rxjs-interop.mjs +1 -1
  32. package/fesm2022/testing.mjs +25 -60
  33. package/fesm2022/testing.mjs.map +1 -1
  34. package/index.d.ts +190 -117
  35. package/package.json +1 -1
  36. package/primitives/signals/index.d.ts +1 -1
  37. package/rxjs-interop/index.d.ts +1 -1
  38. package/schematics/migrations/block-template-entities/bundle.js +157 -99
  39. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  40. package/schematics/migrations/invalid-two-way-bindings/bundle.js +159 -100
  41. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  42. package/schematics/ng-generate/control-flow-migration/bundle.js +161 -100
  43. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  44. package/schematics/ng-generate/standalone-migration/bundle.js +1380 -882
  45. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  46. package/testing/index.d.ts +4 -3
@@ -1802,12 +1802,12 @@ var ConstantPool = class {
1802
1802
  if (isArrow && current instanceof DeclareVarStmt && ((_a2 = current.value) == null ? void 0 : _a2.isEquivalent(fn2))) {
1803
1803
  return variable(current.name);
1804
1804
  }
1805
- if (!isArrow && current instanceof DeclareFunctionStmt && fn2.isEquivalent(current)) {
1805
+ if (!isArrow && current instanceof DeclareFunctionStmt && fn2 instanceof FunctionExpr && fn2.isEquivalent(current)) {
1806
1806
  return variable(current.name);
1807
1807
  }
1808
1808
  }
1809
1809
  const name = useUniqueName ? this.uniqueName(prefix) : prefix;
1810
- this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
1810
+ this.statements.push(fn2 instanceof FunctionExpr ? fn2.toDeclStmt(name, StmtModifier.Final) : new DeclareVarStmt(name, fn2, INFERRED_TYPE, StmtModifier.Final, fn2.sourceSpan));
1811
1811
  return variable(name);
1812
1812
  }
1813
1813
  _getLiteralFactory(key, values, resultMap) {
@@ -2433,6 +2433,9 @@ var Identifiers = _Identifiers;
2433
2433
  (() => {
2434
2434
  _Identifiers.declareClassMetadata = { name: "\u0275\u0275ngDeclareClassMetadata", moduleName: CORE };
2435
2435
  })();
2436
+ (() => {
2437
+ _Identifiers.declareClassMetadataAsync = { name: "\u0275\u0275ngDeclareClassMetadataAsync", moduleName: CORE };
2438
+ })();
2436
2439
  (() => {
2437
2440
  _Identifiers.setClassMetadata = { name: "\u0275setClassMetadata", moduleName: CORE };
2438
2441
  })();
@@ -4232,9 +4235,10 @@ var Template = class {
4232
4235
  }
4233
4236
  };
4234
4237
  var Content = class {
4235
- constructor(selector, attributes, sourceSpan, i18n2) {
4238
+ constructor(selector, attributes, children, sourceSpan, i18n2) {
4236
4239
  this.selector = selector;
4237
4240
  this.attributes = attributes;
4241
+ this.children = children;
4238
4242
  this.sourceSpan = sourceSpan;
4239
4243
  this.i18n = i18n2;
4240
4244
  this.name = "ng-content";
@@ -7494,18 +7498,21 @@ function createProjectionDefOp(def) {
7494
7498
  def
7495
7499
  }, NEW_OP);
7496
7500
  }
7497
- function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
7498
- return __spreadValues(__spreadValues({
7501
+ function createProjectionOp(xref, selector, i18nPlaceholder, fallbackView, sourceSpan) {
7502
+ return __spreadProps(__spreadValues(__spreadValues({
7499
7503
  kind: OpKind.Projection,
7500
7504
  xref,
7501
7505
  handle: new SlotHandle(),
7502
7506
  selector,
7503
7507
  i18nPlaceholder,
7508
+ fallbackView,
7504
7509
  projectionSlotIndex: 0,
7505
7510
  attributes: null,
7506
7511
  localRefs: [],
7507
7512
  sourceSpan
7508
- }, NEW_OP), TRAIT_CONSUMES_SLOT);
7513
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), {
7514
+ numSlotsUsed: fallbackView === null ? 1 : 2
7515
+ });
7509
7516
  }
7510
7517
  function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
7511
7518
  return __spreadValues({
@@ -9051,6 +9058,11 @@ function recursivelyProcessView(view, parentScope) {
9051
9058
  case OpKind.Template:
9052
9059
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9053
9060
  break;
9061
+ case OpKind.Projection:
9062
+ if (op.fallbackView !== null) {
9063
+ recursivelyProcessView(view.job.views.get(op.fallbackView), scope);
9064
+ }
9065
+ break;
9054
9066
  case OpKind.RepeaterCreate:
9055
9067
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9056
9068
  if (op.emptyView) {
@@ -15672,6 +15684,18 @@ function addNamesToView(unit, baseName, state, compatibility) {
15672
15684
  }
15673
15685
  addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
15674
15686
  break;
15687
+ case OpKind.Projection:
15688
+ if (!(unit instanceof ViewCompilationUnit)) {
15689
+ throw new Error(`AssertionError: must be compiling a component`);
15690
+ }
15691
+ if (op.handle.slot === null) {
15692
+ throw new Error(`Expected slot to be assigned`);
15693
+ }
15694
+ if (op.fallbackView !== null) {
15695
+ const fallbackView = unit.job.views.get(op.fallbackView);
15696
+ addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
15697
+ }
15698
+ break;
15675
15699
  case OpKind.Template:
15676
15700
  if (!(unit instanceof ViewCompilationUnit)) {
15677
15701
  throw new Error(`AssertionError: must be compiling a component`);
@@ -16338,13 +16362,19 @@ function deferOn(trigger, args, prefetch, sourceSpan) {
16338
16362
  function projectionDef(def) {
16339
16363
  return call(Identifiers.projectionDef, def ? [def] : [], null);
16340
16364
  }
16341
- function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
16365
+ function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
16342
16366
  const args = [literal(slot)];
16343
- if (projectionSlotIndex !== 0 || attributes !== null) {
16367
+ if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
16344
16368
  args.push(literal(projectionSlotIndex));
16345
16369
  if (attributes !== null) {
16346
16370
  args.push(attributes);
16347
16371
  }
16372
+ if (fallbackFnName !== null) {
16373
+ if (attributes === null) {
16374
+ args.push(literal(null));
16375
+ }
16376
+ args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
16377
+ }
16348
16378
  }
16349
16379
  return call(Identifiers.projection, args, sourceSpan);
16350
16380
  }
@@ -16847,7 +16877,25 @@ function reifyCreateOperations(unit, ops) {
16847
16877
  if (op.handle.slot === null) {
16848
16878
  throw new Error("No slot was assigned for project instruction");
16849
16879
  }
16850
- OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, op.sourceSpan));
16880
+ let fallbackViewFnName = null;
16881
+ let fallbackDecls = null;
16882
+ let fallbackVars = null;
16883
+ if (op.fallbackView !== null) {
16884
+ if (!(unit instanceof ViewCompilationUnit)) {
16885
+ throw new Error(`AssertionError: must be compiling a component`);
16886
+ }
16887
+ const fallbackView = unit.job.views.get(op.fallbackView);
16888
+ if (fallbackView === void 0) {
16889
+ throw new Error("AssertionError: projection had fallback view xref, but fallback view was not found");
16890
+ }
16891
+ if (fallbackView.fnName === null || fallbackView.decls === null || fallbackView.vars === null) {
16892
+ throw new Error(`AssertionError: expected projection fallback view to have been named and counted`);
16893
+ }
16894
+ fallbackViewFnName = fallbackView.fnName;
16895
+ fallbackDecls = fallbackView.decls;
16896
+ fallbackVars = fallbackView.vars;
16897
+ }
16898
+ OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
16851
16899
  break;
16852
16900
  case OpKind.RepeaterCreate:
16853
16901
  if (op.handle.slot === null) {
@@ -17794,6 +17842,7 @@ function optimizeTrackFns(job) {
17794
17842
  } else if (op.track instanceof ReadVarExpr && op.track.name === "$item") {
17795
17843
  op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
17796
17844
  } else if (isTrackByFunctionCall(job.root.xref, op.track)) {
17845
+ op.usesComponentInstance = true;
17797
17846
  if (op.track.receiver.receiver.view === unit.xref) {
17798
17847
  op.trackByFn = op.track.receiver;
17799
17848
  } else {
@@ -17838,7 +17887,7 @@ function generateTrackVariables(job) {
17838
17887
  }
17839
17888
  op.track = transformExpressionsInExpression(op.track, (expr) => {
17840
17889
  if (expr instanceof LexicalReadExpr) {
17841
- if (expr.name === op.varNames.$index) {
17890
+ if (op.varNames.$index.has(expr.name)) {
17842
17891
  return variable("$index");
17843
17892
  } else if (expr.name === op.varNames.$implicit) {
17844
17893
  return variable("$item");
@@ -18555,10 +18604,17 @@ function ingestTemplate(unit, tmpl) {
18555
18604
  }
18556
18605
  }
18557
18606
  function ingestContent(unit, content) {
18607
+ var _a2;
18558
18608
  if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
18559
18609
  throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
18560
18610
  }
18561
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
18611
+ const id = unit.job.allocateXrefId();
18612
+ let fallbackView = null;
18613
+ if (content.children.some((child) => !(child instanceof Comment) && (!(child instanceof Text) || child.value.trim().length > 0))) {
18614
+ fallbackView = unit.job.allocateView(unit.xref);
18615
+ ingestNodes(fallbackView, content.children);
18616
+ }
18617
+ const op = createProjectionOp(id, content.selector, content.i18n, (_a2 = fallbackView == null ? void 0 : fallbackView.xref) != null ? _a2 : null, content.sourceSpan);
18562
18618
  for (const attr of content.attributes) {
18563
18619
  const securityContext = domSchema.securityContext(content.name, attr.name, true);
18564
18620
  unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
@@ -18597,10 +18653,7 @@ function ingestIfBlock(unit, ifBlock) {
18597
18653
  for (let i = 0; i < ifBlock.branches.length; i++) {
18598
18654
  const ifCase = ifBlock.branches[i];
18599
18655
  const cView = unit.job.allocateView(unit.xref);
18600
- let tagName = null;
18601
- if (i === 0) {
18602
- tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18603
- }
18656
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18604
18657
  if (ifCase.expressionAlias !== null) {
18605
18658
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
18606
18659
  }
@@ -18635,6 +18688,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18635
18688
  let conditions = [];
18636
18689
  for (const switchCase of switchBlock.cases) {
18637
18690
  const cView = unit.job.allocateView(unit.xref);
18691
+ const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
18638
18692
  let switchCaseI18nMeta = void 0;
18639
18693
  if (switchCase.i18n !== void 0) {
18640
18694
  if (!(switchCase.i18n instanceof BlockPlaceholder)) {
@@ -18642,7 +18696,7 @@ function ingestSwitchBlock(unit, switchBlock) {
18642
18696
  }
18643
18697
  switchCaseI18nMeta = switchCase.i18n;
18644
18698
  }
18645
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18699
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
18646
18700
  unit.create.push(templateOp);
18647
18701
  if (firstXref === null) {
18648
18702
  firstXref = cView.xref;
@@ -18776,37 +18830,27 @@ function ingestIcu(unit, icu) {
18776
18830
  function ingestForBlock(unit, forBlock) {
18777
18831
  var _a2, _b2, _c2;
18778
18832
  const repeaterView = unit.job.allocateView(unit.xref);
18833
+ const indexName = `\u0275$index_${repeaterView.xref}`;
18834
+ const countName = `\u0275$count_${repeaterView.xref}`;
18835
+ const indexVarNames = /* @__PURE__ */ new Set();
18779
18836
  repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
18780
- repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
18781
- repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
18782
- const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
18783
- const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
18784
- repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
18785
- repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
18786
- repeaterView.aliases.add({
18787
- kind: SemanticVariableKind.Alias,
18788
- name: null,
18789
- identifier: forBlock.contextVariables.$first.name,
18790
- expression: new LexicalReadExpr(indexName).identical(literal(0))
18791
- });
18792
- repeaterView.aliases.add({
18793
- kind: SemanticVariableKind.Alias,
18794
- name: null,
18795
- identifier: forBlock.contextVariables.$last.name,
18796
- expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
18797
- });
18798
- repeaterView.aliases.add({
18799
- kind: SemanticVariableKind.Alias,
18800
- name: null,
18801
- identifier: forBlock.contextVariables.$even.name,
18802
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
18803
- });
18804
- repeaterView.aliases.add({
18805
- kind: SemanticVariableKind.Alias,
18806
- name: null,
18807
- identifier: forBlock.contextVariables.$odd.name,
18808
- expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
18809
- });
18837
+ for (const variable2 of forBlock.contextVariables) {
18838
+ if (variable2.value === "$index") {
18839
+ indexVarNames.add(variable2.name);
18840
+ }
18841
+ if (variable2.name === "$index") {
18842
+ repeaterView.contextVariables.set("$index", variable2.value).set(indexName, variable2.value);
18843
+ } else if (variable2.name === "$count") {
18844
+ repeaterView.contextVariables.set("$count", variable2.value).set(countName, variable2.value);
18845
+ } else {
18846
+ repeaterView.aliases.add({
18847
+ kind: SemanticVariableKind.Alias,
18848
+ name: null,
18849
+ identifier: variable2.name,
18850
+ expression: getComputedForLoopVariableExpression(variable2, indexName, countName)
18851
+ });
18852
+ }
18853
+ }
18810
18854
  const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
18811
18855
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
18812
18856
  ingestNodes(repeaterView, forBlock.children);
@@ -18818,12 +18862,7 @@ function ingestForBlock(unit, forBlock) {
18818
18862
  emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
18819
18863
  }
18820
18864
  const varNames = {
18821
- $index: forBlock.contextVariables.$index.name,
18822
- $count: forBlock.contextVariables.$count.name,
18823
- $first: forBlock.contextVariables.$first.name,
18824
- $last: forBlock.contextVariables.$last.name,
18825
- $even: forBlock.contextVariables.$even.name,
18826
- $odd: forBlock.contextVariables.$odd.name,
18865
+ $index: indexVarNames,
18827
18866
  $implicit: forBlock.item.name
18828
18867
  };
18829
18868
  if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
@@ -18841,6 +18880,24 @@ function ingestForBlock(unit, forBlock) {
18841
18880
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
18842
18881
  unit.update.push(repeater2);
18843
18882
  }
18883
+ function getComputedForLoopVariableExpression(variable2, indexName, countName) {
18884
+ switch (variable2.value) {
18885
+ case "$index":
18886
+ return new LexicalReadExpr(indexName);
18887
+ case "$count":
18888
+ return new LexicalReadExpr(countName);
18889
+ case "$first":
18890
+ return new LexicalReadExpr(indexName).identical(literal(0));
18891
+ case "$last":
18892
+ return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
18893
+ case "$even":
18894
+ return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
18895
+ case "$odd":
18896
+ return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
18897
+ default:
18898
+ throw new Error(`AssertionError: unknown @for loop variable ${variable2.value}`);
18899
+ }
18900
+ }
18844
18901
  function convertAst(ast, job, baseSourceSpan) {
18845
18902
  if (ast instanceof ASTWithSource) {
18846
18903
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -19876,19 +19933,25 @@ function parseForLoopParameters(block, errors, bindingParser) {
19876
19933
  return null;
19877
19934
  }
19878
19935
  const [, itemName, rawExpression] = match;
19936
+ if (ALLOWED_FOR_LOOP_LET_VARIABLES.has(itemName)) {
19937
+ errors.push(new ParseError(expressionParam.sourceSpan, `@for loop item name cannot be one of ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}.`));
19938
+ }
19879
19939
  const variableName = expressionParam.expression.split(" ")[0];
19880
19940
  const variableSpan = new ParseSourceSpan(expressionParam.sourceSpan.start, expressionParam.sourceSpan.start.moveBy(variableName.length));
19881
19941
  const result = {
19882
19942
  itemName: new Variable(itemName, "$implicit", variableSpan, variableSpan),
19883
19943
  trackBy: null,
19884
19944
  expression: parseBlockParameterToBinding(expressionParam, bindingParser, rawExpression),
19885
- context: {}
19945
+ context: Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES, (variableName2) => {
19946
+ const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19947
+ return new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
19948
+ })
19886
19949
  };
19887
19950
  for (const param of secondaryParams) {
19888
19951
  const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
19889
19952
  if (letMatch !== null) {
19890
19953
  const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
19891
- parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, result.context, errors);
19954
+ parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
19892
19955
  continue;
19893
19956
  }
19894
19957
  const trackMatch = param.expression.match(FOR_LOOP_TRACK_PATTERN);
@@ -19907,15 +19970,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
19907
19970
  }
19908
19971
  errors.push(new ParseError(param.sourceSpan, `Unrecognized @for loop paramater "${param.expression}"`));
19909
19972
  }
19910
- for (const variableName2 of ALLOWED_FOR_LOOP_LET_VARIABLES) {
19911
- if (!result.context.hasOwnProperty(variableName2)) {
19912
- const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19913
- result.context[variableName2] = new Variable(variableName2, variableName2, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
19914
- }
19915
- }
19916
19973
  return result;
19917
19974
  }
19918
- function parseLetParameter(sourceSpan, expression, span, context, errors) {
19975
+ function parseLetParameter(sourceSpan, expression, span, loopItemName, context, errors) {
19919
19976
  var _a2, _b2, _c2;
19920
19977
  const parts = expression.split(",");
19921
19978
  let startSpan = span.start;
@@ -19927,7 +19984,9 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
19927
19984
  errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Parameter should match the pattern "<name> = <variable name>"`));
19928
19985
  } else if (!ALLOWED_FOR_LOOP_LET_VARIABLES.has(variableName)) {
19929
19986
  errors.push(new ParseError(sourceSpan, `Unknown "let" parameter variable "${variableName}". The allowed variables are: ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(", ")}`));
19930
- } else if (context.hasOwnProperty(variableName)) {
19987
+ } else if (name === loopItemName) {
19988
+ errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Variable cannot be called "${loopItemName}"`));
19989
+ } else if (context.some((v) => v.name === name)) {
19931
19990
  errors.push(new ParseError(sourceSpan, `Duplicate "let" parameter variable "${variableName}"`));
19932
19991
  } else {
19933
19992
  const [, keyLeadingWhitespace, keyName] = (_a2 = expressionParts[0].match(CHARACTERS_IN_SURROUNDING_WHITESPACE_PATTERN)) != null ? _a2 : [];
@@ -19941,7 +20000,7 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
19941
20000
  valueSpan = valueLeadingWhitespace !== void 0 ? new ParseSourceSpan(startSpan.moveBy(expressionParts[0].length + 1 + valueLeadingWhitespace.length), startSpan.moveBy(expressionParts[0].length + 1 + valueLeadingWhitespace.length + implicit.length)) : void 0;
19942
20001
  }
19943
20002
  const sourceSpan2 = new ParseSourceSpan(keySpan.start, (_c2 = valueSpan == null ? void 0 : valueSpan.end) != null ? _c2 : keySpan.end);
19944
- context[variableName] = new Variable(name, variableName, sourceSpan2, keySpan, valueSpan);
20003
+ context.push(new Variable(name, variableName, sourceSpan2, keySpan, valueSpan));
19945
20004
  }
19946
20005
  startSpan = startSpan.moveBy(part.length + 1);
19947
20006
  }
@@ -20579,12 +20638,9 @@ var HtmlAstToIvyAst = class {
20579
20638
  }
20580
20639
  let parsedElement;
20581
20640
  if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
20582
- if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
20583
- this.reportError(`<ng-content> element cannot have content.`, element2.sourceSpan);
20584
- }
20585
20641
  const selector = preparsedElement.selectAttr;
20586
20642
  const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
20587
- parsedElement = new Content(selector, attrs, element2.sourceSpan, element2.i18n);
20643
+ parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
20588
20644
  this.ngContentSelectors.push(selector);
20589
20645
  } else if (isTemplateElement) {
20590
20646
  const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
@@ -20888,12 +20944,6 @@ function normalizeAttributeName(attrName) {
20888
20944
  function addEvents(events, boundEvents) {
20889
20945
  boundEvents.push(...events.map((e) => BoundEvent.fromParsedEvent(e)));
20890
20946
  }
20891
- function isEmptyTextNode(node) {
20892
- return node instanceof Text4 && node.value.trim().length == 0;
20893
- }
20894
- function isCommentNode(node) {
20895
- return node instanceof Comment2;
20896
- }
20897
20947
  function textContents(node) {
20898
20948
  if (node.children.length !== 1 || !(node.children[0] instanceof Text4)) {
20899
20949
  return null;
@@ -21070,7 +21120,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21070
21120
  let allDeferrableDepsFn = null;
21071
21121
  if (meta.defer.mode === 1 && meta.defer.dependenciesFn !== null) {
21072
21122
  const fnName = `${templateTypeName}_DeferFn`;
21073
- constantPool.statements.push(meta.defer.dependenciesFn.toDeclStmt(fnName, StmtModifier.Final));
21123
+ constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, void 0, StmtModifier.Final));
21074
21124
  allDeferrableDepsFn = variable(fnName);
21075
21125
  }
21076
21126
  const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn);
@@ -21382,9 +21432,9 @@ var Scope2 = class {
21382
21432
  nodeOrNodes.children.forEach((node) => node.visit(this));
21383
21433
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21384
21434
  this.visitVariable(nodeOrNodes.item);
21385
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitVariable(v));
21435
+ nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
21386
21436
  nodeOrNodes.children.forEach((node) => node.visit(this));
21387
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21437
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21388
21438
  nodeOrNodes.children.forEach((node) => node.visit(this));
21389
21439
  } else {
21390
21440
  nodeOrNodes.forEach((node) => node.visit(this));
@@ -21442,6 +21492,7 @@ var Scope2 = class {
21442
21492
  this.ingestScopedNode(block);
21443
21493
  }
21444
21494
  visitContent(content) {
21495
+ this.ingestScopedNode(content);
21445
21496
  }
21446
21497
  visitBoundAttribute(attr) {
21447
21498
  }
@@ -21580,7 +21631,7 @@ var DirectiveBinder = class {
21580
21631
  visitForLoopBlock(block) {
21581
21632
  var _a2;
21582
21633
  block.item.visit(this);
21583
- Object.values(block.contextVariables).forEach((v) => v.visit(this));
21634
+ block.contextVariables.forEach((v) => v.visit(this));
21584
21635
  block.children.forEach((node) => node.visit(this));
21585
21636
  (_a2 = block.empty) == null ? void 0 : _a2.visit(this);
21586
21637
  }
@@ -21596,6 +21647,7 @@ var DirectiveBinder = class {
21596
21647
  block.children.forEach((node) => node.visit(this));
21597
21648
  }
21598
21649
  visitContent(content) {
21650
+ content.children.forEach((child) => child.visit(this));
21599
21651
  }
21600
21652
  visitVariable(variable2) {
21601
21653
  }
@@ -21648,7 +21700,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21648
21700
  const usedPipes = /* @__PURE__ */ new Set();
21649
21701
  const eagerPipes = /* @__PURE__ */ new Set();
21650
21702
  const template2 = nodes instanceof Template ? nodes : null;
21651
- const deferBlocks = /* @__PURE__ */ new Map();
21703
+ const deferBlocks = [];
21652
21704
  const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
21653
21705
  binder.ingest(nodes);
21654
21706
  return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
@@ -21666,7 +21718,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21666
21718
  this.nestingLevel.set(nodeOrNodes, this.level);
21667
21719
  } else if (nodeOrNodes instanceof ForLoopBlock) {
21668
21720
  this.visitNode(nodeOrNodes.item);
21669
- Object.values(nodeOrNodes.contextVariables).forEach((v) => this.visitNode(v));
21721
+ nodeOrNodes.contextVariables.forEach((v) => this.visitNode(v));
21670
21722
  nodeOrNodes.trackBy.visit(this);
21671
21723
  nodeOrNodes.children.forEach(this.visitNode);
21672
21724
  this.nestingLevel.set(nodeOrNodes, this.level);
@@ -21674,10 +21726,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21674
21726
  if (this.scope.rootNode !== nodeOrNodes) {
21675
21727
  throw new Error(`Assertion error: resolved incorrect scope for deferred block ${nodeOrNodes}`);
21676
21728
  }
21677
- this.deferBlocks.set(nodeOrNodes, this.scope);
21729
+ this.deferBlocks.push([nodeOrNodes, this.scope]);
21678
21730
  nodeOrNodes.children.forEach((node) => node.visit(this));
21679
21731
  this.nestingLevel.set(nodeOrNodes, this.level);
21680
- } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading) {
21732
+ } else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
21681
21733
  nodeOrNodes.children.forEach((node) => node.visit(this));
21682
21734
  this.nestingLevel.set(nodeOrNodes, this.level);
21683
21735
  } else {
@@ -21709,8 +21761,6 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21709
21761
  }
21710
21762
  visitText(text2) {
21711
21763
  }
21712
- visitContent(content) {
21713
- }
21714
21764
  visitTextAttribute(attribute2) {
21715
21765
  }
21716
21766
  visitUnknownBlock(block) {
@@ -21771,6 +21821,9 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21771
21821
  (_a2 = block.expression) == null ? void 0 : _a2.visit(this);
21772
21822
  this.ingestScopedNode(block);
21773
21823
  }
21824
+ visitContent(content) {
21825
+ this.ingestScopedNode(content);
21826
+ }
21774
21827
  visitBoundText(text2) {
21775
21828
  text2.value.visit(this);
21776
21829
  }
@@ -21809,7 +21862,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
21809
21862
  }
21810
21863
  };
21811
21864
  var R3BoundTarget = class {
21812
- constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks) {
21865
+ constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
21813
21866
  this.target = target;
21814
21867
  this.directives = directives;
21815
21868
  this.eagerDirectives = eagerDirectives;
@@ -21821,7 +21874,8 @@ var R3BoundTarget = class {
21821
21874
  this.scopedNodeEntities = scopedNodeEntities;
21822
21875
  this.usedPipes = usedPipes;
21823
21876
  this.eagerPipes = eagerPipes;
21824
- this.deferBlocks = deferBlocks;
21877
+ this.deferredBlocks = rawDeferred.map((current) => current[0]);
21878
+ this.deferredScopes = new Map(rawDeferred);
21825
21879
  }
21826
21880
  getEntitiesInScope(node) {
21827
21881
  var _a2;
@@ -21861,7 +21915,7 @@ var R3BoundTarget = class {
21861
21915
  return Array.from(this.eagerPipes);
21862
21916
  }
21863
21917
  getDeferBlocks() {
21864
- return Array.from(this.deferBlocks.keys());
21918
+ return this.deferredBlocks;
21865
21919
  }
21866
21920
  getDeferredTriggerTarget(block, trigger) {
21867
21921
  if (!(trigger instanceof InteractionDeferredTrigger) && !(trigger instanceof ViewportDeferredTrigger) && !(trigger instanceof HoverDeferredTrigger)) {
@@ -21902,8 +21956,11 @@ var R3BoundTarget = class {
21902
21956
  return null;
21903
21957
  }
21904
21958
  isDeferred(element2) {
21905
- for (const deferredScope of this.deferBlocks.values()) {
21906
- const stack = [deferredScope];
21959
+ for (const block of this.deferredBlocks) {
21960
+ if (!this.deferredScopes.has(block)) {
21961
+ continue;
21962
+ }
21963
+ const stack = [this.deferredScopes.get(block)];
21907
21964
  while (stack.length > 0) {
21908
21965
  const current = stack.pop();
21909
21966
  if (current.elementsInScope.has(element2)) {
@@ -21916,9 +21973,9 @@ var R3BoundTarget = class {
21916
21973
  }
21917
21974
  findEntityInScope(rootNode, name) {
21918
21975
  const entities = this.getEntitiesInScope(rootNode);
21919
- for (const entitity of entities) {
21920
- if (entitity.name === name) {
21921
- return entitity;
21976
+ for (const entity of entities) {
21977
+ if (entity.name === name) {
21978
+ return entity;
21922
21979
  }
21923
21980
  }
21924
21981
  return null;
@@ -22084,7 +22141,7 @@ var CompilerFacadeImpl = class {
22084
22141
  }
22085
22142
  compileComponent(angularCoreEnv, sourceMapUrl, facade) {
22086
22143
  var _a2;
22087
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
22144
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation, void 0);
22088
22145
  const meta = __spreadProps(__spreadValues(__spreadValues({}, facade), convertDirectiveFacadeToMetadata(facade)), {
22089
22146
  selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
22090
22147
  template: template2,
@@ -22273,7 +22330,7 @@ function convertOpaqueValuesToExpressions(obj) {
22273
22330
  }
22274
22331
  function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
22275
22332
  var _a2, _b2, _c2, _d2;
22276
- const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation);
22333
+ const { template: template2, interpolation, defer: defer2 } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a2 = decl.preserveWhitespaces) != null ? _a2 : false, decl.interpolation, decl.deferBlockDependencies);
22277
22334
  const declarations = [];
22278
22335
  if (decl.dependencies) {
22279
22336
  for (const innerDep of decl.dependencies) {
@@ -22343,7 +22400,7 @@ function convertPipeDeclarationToMetadata(pipe2) {
22343
22400
  type: new WrappedNodeExpr(pipe2.type)
22344
22401
  };
22345
22402
  }
22346
- function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
22403
+ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation, deferBlockDependencies) {
22347
22404
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
22348
22405
  const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
22349
22406
  if (parsed.errors !== null) {
@@ -22355,7 +22412,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
22355
22412
  return {
22356
22413
  template: parsed,
22357
22414
  interpolation: interpolationConfig,
22358
- defer: createR3ComponentDeferMetadata(boundTarget)
22415
+ defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies)
22359
22416
  };
22360
22417
  }
22361
22418
  function convertToProviderExpression(obj, property2) {
@@ -22395,11 +22452,12 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
22395
22452
  const attributeNameType = isAttributeDep ? literal("unknown") : null;
22396
22453
  return { token, attributeNameType, host, optional, self, skipSelf };
22397
22454
  }
22398
- function createR3ComponentDeferMetadata(boundTarget) {
22455
+ function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
22399
22456
  const deferredBlocks = boundTarget.getDeferBlocks();
22400
22457
  const blocks = /* @__PURE__ */ new Map();
22401
- for (const block of deferredBlocks) {
22402
- blocks.set(block, null);
22458
+ for (let i = 0; i < deferredBlocks.length; i++) {
22459
+ const dependencyFn = deferBlockDependencies == null ? void 0 : deferBlockDependencies[i];
22460
+ blocks.set(deferredBlocks[i], dependencyFn ? new WrappedNodeExpr(dependencyFn) : null);
22403
22461
  }
22404
22462
  return { mode: 0, blocks };
22405
22463
  }
@@ -22529,7 +22587,7 @@ function publishFacade(global) {
22529
22587
  }
22530
22588
 
22531
22589
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
22532
- var VERSION2 = new Version("18.0.0-next.1");
22590
+ var VERSION2 = new Version("18.0.0-next.2");
22533
22591
 
22534
22592
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
22535
22593
  var _VisitorMode;
@@ -22971,8 +23029,11 @@ function updateImportClause(clause, removeCommonModule) {
22971
23029
  function updateClassImports(propAssignment, removeCommonModule) {
22972
23030
  const printer = import_typescript6.default.createPrinter();
22973
23031
  const importList = propAssignment.initializer;
23032
+ if (!import_typescript6.default.isArrayLiteralExpression(importList)) {
23033
+ return null;
23034
+ }
22974
23035
  const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
22975
- const elements = importList.elements.filter((el) => !removals.includes(el.getText()));
23036
+ const elements = importList.elements.filter((el) => !import_typescript6.default.isIdentifier(el) || !removals.includes(el.text));
22976
23037
  if (elements.length === importList.elements.length) {
22977
23038
  return null;
22978
23039
  }