@angular/compiler-cli 18.0.1 → 18.0.3

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 (40) hide show
  1. package/bundles/{chunk-ZLHOM56K.js → chunk-7E6Q23KF.js} +172 -39
  2. package/bundles/chunk-7E6Q23KF.js.map +6 -0
  3. package/bundles/{chunk-LDI6GWO5.js → chunk-DYQ2FDEK.js} +2 -2
  4. package/bundles/{chunk-CDSIZK6E.js → chunk-E2VPC2QT.js} +18 -17
  5. package/bundles/{chunk-CDSIZK6E.js.map → chunk-E2VPC2QT.js.map} +1 -1
  6. package/bundles/{chunk-27KMND5I.js → chunk-KBGMAHKE.js} +3 -3
  7. package/bundles/{chunk-6AZ42I2O.js → chunk-SFKDQKE5.js} +3 -1
  8. package/bundles/{chunk-6AZ42I2O.js.map → chunk-SFKDQKE5.js.map} +1 -1
  9. package/bundles/{chunk-TPUY2KMQ.js → chunk-VE7PCF6B.js} +4 -1
  10. package/bundles/chunk-VE7PCF6B.js.map +6 -0
  11. package/bundles/{chunk-IFIN3A3P.js → chunk-Y4KWPMGX.js} +3 -3
  12. package/bundles/index.js +6 -6
  13. package/bundles/linker/babel/index.js +2 -2
  14. package/bundles/linker/index.js +2 -2
  15. package/bundles/private/migrations.js +3 -3
  16. package/bundles/private/tooling.js +3 -3
  17. package/bundles/src/bin/ng_xi18n.js +5 -5
  18. package/bundles/src/bin/ngc.js +5 -5
  19. package/bundles_metadata.json +1 -1
  20. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  21. package/package.json +4 -4
  22. package/src/ngtsc/annotations/component/src/handler.d.ts +2 -1
  23. package/src/ngtsc/annotations/component/src/resources.d.ts +1 -0
  24. package/src/ngtsc/core/src/compiler.d.ts +1 -0
  25. package/src/ngtsc/diagnostics/src/error_code.d.ts +6 -0
  26. package/src/ngtsc/docs/src/entities.d.ts +1 -0
  27. package/src/ngtsc/indexer/src/api.d.ts +8 -3
  28. package/src/ngtsc/typecheck/api/checker.d.ts +2 -2
  29. package/src/ngtsc/typecheck/api/completion.d.ts +15 -4
  30. package/src/ngtsc/typecheck/api/symbols.d.ts +28 -3
  31. package/src/ngtsc/typecheck/src/checker.d.ts +2 -2
  32. package/src/ngtsc/typecheck/src/oob.d.ts +16 -1
  33. package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
  34. package/src/ngtsc/typecheck/src/ts_util.d.ts +1 -1
  35. package/src/ngtsc/typecheck/src/type_check_block.d.ts +13 -2
  36. package/bundles/chunk-TPUY2KMQ.js.map +0 -6
  37. package/bundles/chunk-ZLHOM56K.js.map +0 -6
  38. /package/bundles/{chunk-LDI6GWO5.js.map → chunk-DYQ2FDEK.js.map} +0 -0
  39. /package/bundles/{chunk-27KMND5I.js.map → chunk-KBGMAHKE.js.map} +0 -0
  40. /package/bundles/{chunk-IFIN3A3P.js.map → chunk-Y4KWPMGX.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  PotentialImportKind,
9
9
  PotentialImportMode,
10
10
  SymbolKind
11
- } from "./chunk-6AZ42I2O.js";
11
+ } from "./chunk-SFKDQKE5.js";
12
12
  import {
13
13
  CompilationMode,
14
14
  ComponentDecoratorHandler,
@@ -44,7 +44,7 @@ import {
44
44
  isHostDirectiveMetaForGlobalMode,
45
45
  ivyTransformFactory,
46
46
  tryParseInitializerApi
47
- } from "./chunk-CDSIZK6E.js";
47
+ } from "./chunk-E2VPC2QT.js";
48
48
  import {
49
49
  AbsoluteModuleStrategy,
50
50
  AliasStrategy,
@@ -94,7 +94,7 @@ import {
94
94
  toUnredirectedSourceFile,
95
95
  translateExpression,
96
96
  translateType
97
- } from "./chunk-TPUY2KMQ.js";
97
+ } from "./chunk-VE7PCF6B.js";
98
98
  import {
99
99
  ActivePerfRecorder,
100
100
  DelegatingPerfRecorder,
@@ -274,17 +274,20 @@ var FunctionExtractor = class {
274
274
  this.typeChecker = typeChecker;
275
275
  }
276
276
  extract() {
277
+ var _a;
277
278
  const signature = this.typeChecker.getSignatureFromDeclaration(this.declaration);
278
279
  const returnType = signature ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature)) : "unknown";
280
+ const jsdocsTags = extractJsDocTags(this.declaration);
279
281
  return {
280
282
  params: extractAllParams(this.declaration.parameters, this.typeChecker),
281
283
  name: this.name,
282
284
  isNewType: ts3.isConstructSignatureDeclaration(this.declaration),
283
285
  returnType,
286
+ returnDescription: (_a = jsdocsTags.find((tag) => tag.name === "returns")) == null ? void 0 : _a.comment,
284
287
  entryType: EntryType.Function,
285
288
  generics: extractGenerics(this.declaration),
286
289
  description: extractJsDocDescription(this.declaration),
287
- jsdocTags: extractJsDocTags(this.declaration),
290
+ jsdocTags: jsdocsTags,
288
291
  rawComment: extractRawJsDoc(this.declaration)
289
292
  };
290
293
  }
@@ -2092,6 +2095,7 @@ var IdentifierKind;
2092
2095
  IdentifierKind2[IdentifierKind2["Attribute"] = 4] = "Attribute";
2093
2096
  IdentifierKind2[IdentifierKind2["Reference"] = 5] = "Reference";
2094
2097
  IdentifierKind2[IdentifierKind2["Variable"] = 6] = "Variable";
2098
+ IdentifierKind2[IdentifierKind2["LetDeclaration"] = 7] = "LetDeclaration";
2095
2099
  })(IdentifierKind || (IdentifierKind = {}));
2096
2100
  var AbsoluteSourceSpan = class {
2097
2101
  constructor(start, end) {
@@ -2114,7 +2118,7 @@ var IndexingContext = class {
2114
2118
  import { ParseSourceFile } from "@angular/compiler";
2115
2119
 
2116
2120
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
2117
- import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstBoundDeferredTrigger, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
2121
+ import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstBoundDeferredTrigger, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate, TmplAstVariable } from "@angular/compiler";
2118
2122
  var ExpressionVisitor = class extends RecursiveAstVisitor {
2119
2123
  constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
2120
2124
  super();
@@ -2276,6 +2280,13 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
2276
2280
  (_a = block.expressionAlias) == null ? void 0 : _a.visit(this);
2277
2281
  this.visitAll(block.children);
2278
2282
  }
2283
+ visitLetDeclaration(decl) {
2284
+ const identifier = this.targetToIdentifier(decl);
2285
+ if (identifier !== null) {
2286
+ this.identifiers.add(identifier);
2287
+ }
2288
+ this.visitExpression(decl.value);
2289
+ }
2279
2290
  elementOrTemplateToIdentifier(node) {
2280
2291
  var _a;
2281
2292
  if (this.elementAndTemplateIdentifierCache.has(node)) {
@@ -2359,12 +2370,18 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
2359
2370
  kind: IdentifierKind.Reference,
2360
2371
  target
2361
2372
  };
2362
- } else {
2373
+ } else if (node instanceof TmplAstVariable) {
2363
2374
  identifier = {
2364
2375
  name,
2365
2376
  span,
2366
2377
  kind: IdentifierKind.Variable
2367
2378
  };
2379
+ } else {
2380
+ identifier = {
2381
+ name,
2382
+ span,
2383
+ kind: IdentifierKind.LetDeclaration
2384
+ };
2368
2385
  }
2369
2386
  this.targetIdentifierCache.set(node, identifier);
2370
2387
  return identifier;
@@ -2898,7 +2915,7 @@ function allocateTemplateId(sf) {
2898
2915
  }
2899
2916
 
2900
2917
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
2901
- import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
2918
+ import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstLetDeclaration, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
2902
2919
  import ts20 from "typescript";
2903
2920
 
2904
2921
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
@@ -3177,6 +3194,11 @@ var CompletionEngine = class {
3177
3194
  kind: CompletionKind.Reference,
3178
3195
  node
3179
3196
  });
3197
+ } else if (node instanceof TmplAstLetDeclaration) {
3198
+ templateContext.set(node.name, {
3199
+ kind: CompletionKind.LetDeclaration,
3200
+ node
3201
+ });
3180
3202
  } else {
3181
3203
  templateContext.set(node.name, {
3182
3204
  kind: CompletionKind.Variable,
@@ -4351,7 +4373,7 @@ function tsDeclareVariable(id, type) {
4351
4373
  function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
4352
4374
  return ts22.factory.createTypeQueryNode(ts22.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
4353
4375
  }
4354
- function tsCreateVariable(id, initializer) {
4376
+ function tsCreateVariable(id, initializer, flags = null) {
4355
4377
  const decl = ts22.factory.createVariableDeclaration(
4356
4378
  id,
4357
4379
  void 0,
@@ -4360,7 +4382,7 @@ function tsCreateVariable(id, initializer) {
4360
4382
  );
4361
4383
  return ts22.factory.createVariableStatement(
4362
4384
  void 0,
4363
- [decl]
4385
+ flags === null ? [decl] : ts22.factory.createVariableDeclarationList([decl], flags)
4364
4386
  );
4365
4387
  }
4366
4388
  function tsCallMethod(receiver, methodName, args = []) {
@@ -4929,6 +4951,25 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
4929
4951
  lines.push("", 'This check can be disabled using the `extendedDiagnostics.checks.controlFlowPreventingContentProjection = "suppress" compiler option.`');
4930
4952
  this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), projectionNode.startSourceSpan, category, ngErrorCode(ErrorCode.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION), lines.join("\n")));
4931
4953
  }
4954
+ illegalWriteToLetDeclaration(templateId, node, target) {
4955
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
4956
+ if (sourceSpan === null) {
4957
+ throw new Error(`Assertion failure: no SourceLocation found for property write.`);
4958
+ }
4959
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
4960
+ }
4961
+ letUsedBeforeDefinition(templateId, node, target) {
4962
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
4963
+ if (sourceSpan === null) {
4964
+ throw new Error(`Assertion failure: no SourceLocation found for property read.`);
4965
+ }
4966
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
4967
+ }
4968
+ duplicateLetDeclaration(templateId, current) {
4969
+ const mapping = this.resolver.getSourceMapping(templateId);
4970
+ const errorMsg = `Cannot declare @let called '${current.name}' as there is another @let declaration with the same name.`;
4971
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, current.sourceSpan, ts27.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_LET_DECLARATION), errorMsg));
4972
+ }
4932
4973
  };
4933
4974
  function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
4934
4975
  return {
@@ -4957,7 +4998,7 @@ var TypeCheckShimGenerator = class {
4957
4998
  };
4958
4999
 
4959
5000
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
4960
- import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TransplantedType } from "@angular/compiler";
5001
+ import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
4961
5002
  import ts31 from "typescript";
4962
5003
 
4963
5004
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
@@ -5469,6 +5510,24 @@ var TcbTemplateContextOp = class extends TcbOp {
5469
5510
  return ctx;
5470
5511
  }
5471
5512
  };
5513
+ var TcbLetDeclarationOp = class extends TcbOp {
5514
+ constructor(tcb, scope, node) {
5515
+ super();
5516
+ this.tcb = tcb;
5517
+ this.scope = scope;
5518
+ this.node = node;
5519
+ this.optional = false;
5520
+ }
5521
+ execute() {
5522
+ const id = this.tcb.allocateId();
5523
+ addParseSpanInfo(id, this.node.nameSpan);
5524
+ const value = tcbExpression(this.node.value, this.tcb, this.scope);
5525
+ const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), ts31.NodeFlags.Const);
5526
+ addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
5527
+ this.scope.addStatement(varStatement);
5528
+ return id;
5529
+ }
5530
+ };
5472
5531
  var TcbTemplateBodyOp = class extends TcbOp {
5473
5532
  constructor(tcb, scope, template) {
5474
5533
  super();
@@ -6272,6 +6331,7 @@ var _Scope = class {
6272
6331
  this.referenceOpMap = /* @__PURE__ */ new Map();
6273
6332
  this.templateCtxOpMap = /* @__PURE__ */ new Map();
6274
6333
  this.varMap = /* @__PURE__ */ new Map();
6334
+ this.letDeclOpMap = /* @__PURE__ */ new Map();
6275
6335
  this.statements = [];
6276
6336
  }
6277
6337
  static forNodes(tcb, parentScope, scopedNode, children, guard) {
@@ -6309,6 +6369,14 @@ var _Scope = class {
6309
6369
  }
6310
6370
  for (const node of children) {
6311
6371
  scope.appendNode(node);
6372
+ if (node instanceof TmplAstLetDeclaration2) {
6373
+ const opIndex = scope.opQueue.push(new TcbLetDeclarationOp(tcb, scope, node)) - 1;
6374
+ if (scope.letDeclOpMap.has(node.name)) {
6375
+ tcb.oobRecorder.duplicateLetDeclaration(tcb.id, node);
6376
+ } else {
6377
+ scope.letDeclOpMap.set(node.name, opIndex);
6378
+ }
6379
+ }
6312
6380
  }
6313
6381
  return scope;
6314
6382
  }
@@ -6359,10 +6427,21 @@ var _Scope = class {
6359
6427
  return ts31.factory.createBinaryExpression(parentGuards, ts31.SyntaxKind.AmpersandAmpersandToken, this.guard);
6360
6428
  }
6361
6429
  }
6430
+ isLocal(node) {
6431
+ if (node instanceof TmplAstVariable2) {
6432
+ return this.varMap.has(node);
6433
+ }
6434
+ if (node instanceof TmplAstLetDeclaration2) {
6435
+ return this.letDeclOpMap.has(node.name);
6436
+ }
6437
+ return this.referenceOpMap.has(node);
6438
+ }
6362
6439
  resolveLocal(ref, directive) {
6363
6440
  if (ref instanceof TmplAstReference3 && this.referenceOpMap.has(ref)) {
6364
6441
  return this.resolveOp(this.referenceOpMap.get(ref));
6365
- } else if (ref instanceof TmplAstVariable && this.varMap.has(ref)) {
6442
+ } else if (ref instanceof TmplAstLetDeclaration2 && this.letDeclOpMap.has(ref.name)) {
6443
+ return this.resolveOp(this.letDeclOpMap.get(ref.name));
6444
+ } else if (ref instanceof TmplAstVariable2 && this.varMap.has(ref)) {
6366
6445
  const opIndexOrNode = this.varMap.get(ref);
6367
6446
  return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
6368
6447
  } else if (ref instanceof TmplAstTemplate2 && directive === void 0 && this.templateCtxOpMap.has(ref)) {
@@ -6638,15 +6717,24 @@ var TcbExpressionTranslator = class {
6638
6717
  }
6639
6718
  resolve(ast) {
6640
6719
  if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3) {
6641
- return this.resolveTarget(ast);
6720
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
6721
+ if (target instanceof TmplAstLetDeclaration2) {
6722
+ this.validateLetDeclarationAccess(target, ast);
6723
+ }
6724
+ return target === null ? null : this.getTargetNodeExpression(target, ast);
6642
6725
  } else if (ast instanceof PropertyWrite3 && ast.receiver instanceof ImplicitReceiver3) {
6643
- const target = this.resolveTarget(ast);
6726
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
6644
6727
  if (target === null) {
6645
6728
  return null;
6646
6729
  }
6730
+ const targetExpression = this.getTargetNodeExpression(target, ast);
6647
6731
  const expr = this.translate(ast.value);
6648
- const result = ts31.factory.createParenthesizedExpression(ts31.factory.createBinaryExpression(target, ts31.SyntaxKind.EqualsToken, expr));
6732
+ const result = ts31.factory.createParenthesizedExpression(ts31.factory.createBinaryExpression(targetExpression, ts31.SyntaxKind.EqualsToken, expr));
6649
6733
  addParseSpanInfo(result, ast.sourceSpan);
6734
+ if (target instanceof TmplAstLetDeclaration2) {
6735
+ markIgnoreDiagnostics(result);
6736
+ this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, ast, target);
6737
+ }
6650
6738
  return result;
6651
6739
  } else if (ast instanceof ImplicitReceiver3) {
6652
6740
  return ts31.factory.createThis();
@@ -6684,10 +6772,11 @@ var TcbExpressionTranslator = class {
6684
6772
  addParseSpanInfo(result, ast.sourceSpan);
6685
6773
  return result;
6686
6774
  }
6687
- const receiver = this.resolveTarget(ast);
6688
- if (receiver === null) {
6775
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
6776
+ if (target === null) {
6689
6777
  return null;
6690
6778
  }
6779
+ const receiver = this.getTargetNodeExpression(target, ast);
6691
6780
  const method = wrapForDiagnostics(receiver);
6692
6781
  addParseSpanInfo(method, ast.receiver.nameSpan);
6693
6782
  const args = ast.args.map((arg) => this.translate(arg));
@@ -6698,15 +6787,19 @@ var TcbExpressionTranslator = class {
6698
6787
  return null;
6699
6788
  }
6700
6789
  }
6701
- resolveTarget(ast) {
6702
- const binding = this.tcb.boundTarget.getExpressionTarget(ast);
6703
- if (binding === null) {
6704
- return null;
6705
- }
6706
- const expr = this.scope.resolve(binding);
6707
- addParseSpanInfo(expr, ast.sourceSpan);
6790
+ getTargetNodeExpression(targetNode, expressionNode) {
6791
+ const expr = this.scope.resolve(targetNode);
6792
+ addParseSpanInfo(expr, expressionNode.sourceSpan);
6708
6793
  return expr;
6709
6794
  }
6795
+ validateLetDeclarationAccess(target, ast) {
6796
+ const targetStart = target.sourceSpan.start.offset;
6797
+ const targetEnd = target.sourceSpan.end.offset;
6798
+ const astStart = ast.sourceSpan.start;
6799
+ if ((targetStart > astStart || astStart >= targetStart && astStart <= targetEnd) && this.scope.isLocal(target)) {
6800
+ this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
6801
+ }
6802
+ }
6710
6803
  };
6711
6804
  function tcbCallTypeCtor(dir, tcb, inputs) {
6712
6805
  const typeCtor = tcb.env.typeCtorFor(dir);
@@ -6849,6 +6942,8 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
6849
6942
  }
6850
6943
  return super.resolve(ast);
6851
6944
  }
6945
+ validateLetDeclarationAccess() {
6946
+ }
6852
6947
  };
6853
6948
  var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
6854
6949
  constructor(tcb, scope, block) {
@@ -6864,7 +6959,7 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
6864
6959
  resolve(ast) {
6865
6960
  if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3) {
6866
6961
  const target = this.tcb.boundTarget.getExpressionTarget(ast);
6867
- if (target !== null && !this.allowedVariables.has(target)) {
6962
+ if (target !== null && (!(target instanceof TmplAstVariable2) || !this.allowedVariables.has(target))) {
6868
6963
  this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
6869
6964
  }
6870
6965
  }
@@ -7268,7 +7363,7 @@ var TemplateSourceManager = class {
7268
7363
  };
7269
7364
 
7270
7365
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
7271
- import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, R3Identifiers as R3Identifiers4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
7366
+ import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, R3Identifiers as R3Identifiers4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
7272
7367
  import ts34 from "typescript";
7273
7368
  var SymbolBuilder = class {
7274
7369
  constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
@@ -7293,8 +7388,10 @@ var SymbolBuilder = class {
7293
7388
  symbol = this.getSymbolOfElement(node);
7294
7389
  } else if (node instanceof TmplAstTemplate3) {
7295
7390
  symbol = this.getSymbolOfAstTemplate(node);
7296
- } else if (node instanceof TmplAstVariable2) {
7391
+ } else if (node instanceof TmplAstVariable3) {
7297
7392
  symbol = this.getSymbolOfVariable(node);
7393
+ } else if (node instanceof TmplAstLetDeclaration3) {
7394
+ symbol = this.getSymbolOfLetDeclaration(node);
7298
7395
  } else if (node instanceof TmplAstReference4) {
7299
7396
  symbol = this.getSymbolOfReference(node);
7300
7397
  } else if (node instanceof BindingPipe2) {
@@ -7682,6 +7779,31 @@ var SymbolBuilder = class {
7682
7779
  };
7683
7780
  }
7684
7781
  }
7782
+ getSymbolOfLetDeclaration(decl) {
7783
+ const node = findFirstMatchingNode(this.typeCheckBlock, {
7784
+ withSpan: decl.sourceSpan,
7785
+ filter: ts34.isVariableDeclaration
7786
+ });
7787
+ if (node === null) {
7788
+ return null;
7789
+ }
7790
+ const nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
7791
+ if (nodeValueSymbol === null) {
7792
+ return null;
7793
+ }
7794
+ return {
7795
+ tsType: nodeValueSymbol.tsType,
7796
+ tsSymbol: nodeValueSymbol.tsSymbol,
7797
+ initializerLocation: nodeValueSymbol.tcbLocation,
7798
+ kind: SymbolKind.LetDeclaration,
7799
+ declaration: decl,
7800
+ localVarLocation: {
7801
+ tcbPath: this.tcbPath,
7802
+ isShimFile: this.tcbIsShim,
7803
+ positionInFile: this.getTcbPositionForNode(node.name)
7804
+ }
7805
+ };
7806
+ }
7685
7807
  getSymbolOfPipe(expression) {
7686
7808
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
7687
7809
  withSpan: expression.nameSpan,
@@ -8528,7 +8650,7 @@ var SIGNAL_FNS = /* @__PURE__ */ new Set([
8528
8650
  "ModelSignal"
8529
8651
  ]);
8530
8652
  function isSignalReference(symbol) {
8531
- return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable) && (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
8653
+ return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable || symbol.kind === SymbolKind.LetDeclaration) && (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
8532
8654
  }
8533
8655
  function isSignalSymbol(symbol) {
8534
8656
  const declarations = symbol.getDeclarations();
@@ -8656,6 +8778,9 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
8656
8778
  (_a = block.expressionAlias) == null ? void 0 : _a.visit(this);
8657
8779
  this.visitAllNodes(block.children);
8658
8780
  }
8781
+ visitLetDeclaration(decl) {
8782
+ this.visitAst(decl.value);
8783
+ }
8659
8784
  getDiagnostics(template) {
8660
8785
  this.diagnostics = [];
8661
8786
  this.visitAllNodes(template);
@@ -9054,7 +9179,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
9054
9179
  ]);
9055
9180
 
9056
9181
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
9057
- import { ASTWithSource as ASTWithSource6, ImplicitReceiver as ImplicitReceiver4, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
9182
+ import { ASTWithSource as ASTWithSource6, ImplicitReceiver as ImplicitReceiver4, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration4, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable4 } from "@angular/compiler";
9058
9183
  import ts39 from "typescript";
9059
9184
  var TemplateSemanticsCheckerImpl = class {
9060
9185
  constructor(templateTypeChecker) {
@@ -9102,7 +9227,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
9102
9227
  return;
9103
9228
  }
9104
9229
  const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
9105
- if (target instanceof TmplAstVariable3) {
9230
+ if (target instanceof TmplAstVariable4) {
9106
9231
  const errorMessage = `Cannot use variable '${target.name}' as the left-hand side of an assignment expression. Template variables are read-only.`;
9107
9232
  this.diagnostics.push(this.makeIllegalTemplateVarDiagnostic(target, context, errorMessage));
9108
9233
  }
@@ -9112,22 +9237,29 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
9112
9237
  return;
9113
9238
  }
9114
9239
  const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
9115
- if (!(target instanceof TmplAstVariable3)) {
9240
+ const isVariable = target instanceof TmplAstVariable4;
9241
+ const isLet = target instanceof TmplAstLetDeclaration4;
9242
+ if (!isVariable && !isLet) {
9116
9243
  return;
9117
9244
  }
9118
9245
  const symbol = this.templateTypeChecker.getSymbolOfNode(target, this.component);
9119
9246
  if (symbol !== null && !isSignalReference(symbol)) {
9120
- const errorMessage = `Cannot use a non-signal variable '${target.name}' in a two-way binding expression. Template variables are read-only.`;
9247
+ let errorMessage;
9248
+ if (isVariable) {
9249
+ errorMessage = `Cannot use a non-signal variable '${target.name}' in a two-way binding expression. Template variables are read-only.`;
9250
+ } else {
9251
+ errorMessage = `Cannot use non-signal @let declaration '${target.name}' in a two-way binding expression. @let declarations are read-only.`;
9252
+ }
9121
9253
  this.diagnostics.push(this.makeIllegalTemplateVarDiagnostic(target, context, errorMessage));
9122
9254
  }
9123
9255
  }
9124
9256
  makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
9125
- var _a, _b;
9257
+ const span = target instanceof TmplAstVariable4 ? target.valueSpan || target.sourceSpan : target.sourceSpan;
9126
9258
  return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts39.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
9127
9259
  {
9128
- text: `The variable ${target.name} is declared here.`,
9129
- start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
9130
- end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
9260
+ text: `'${target.name}' is declared here.`,
9261
+ start: span.start.offset,
9262
+ end: span.end.offset,
9131
9263
  sourceFile: this.component.getSourceFile()
9132
9264
  }
9133
9265
  ]);
@@ -9326,7 +9458,7 @@ var NgCompiler = class {
9326
9458
  }
9327
9459
  }
9328
9460
  constructor(adapter, options, inputProgram, programDriver, incrementalStrategy, incrementalCompilation, enableTemplateTypeChecker, usePoisonedData, livePerfRecorder) {
9329
- var _a, _b, _c;
9461
+ var _a, _b, _c, _d;
9330
9462
  this.adapter = adapter;
9331
9463
  this.options = options;
9332
9464
  this.inputProgram = inputProgram;
@@ -9341,7 +9473,8 @@ var NgCompiler = class {
9341
9473
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
9342
9474
  this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a = options["_enableTemplateTypeChecker"]) != null ? _a : false);
9343
9475
  this.enableBlockSyntax = (_b = options["_enableBlockSyntax"]) != null ? _b : true;
9344
- this.angularCoreVersion = (_c = options["_angularCoreVersion"]) != null ? _c : null;
9476
+ this.enableLetSyntax = (_c = options["_enableLetSyntax"]) != null ? _c : false;
9477
+ this.angularCoreVersion = (_d = options["_angularCoreVersion"]) != null ? _d : null;
9345
9478
  this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
9346
9479
  this.currentProgram = inputProgram;
9347
9480
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
@@ -9857,7 +9990,7 @@ var NgCompiler = class {
9857
9990
  throw new Error('JIT mode support ("supportJitMode" option) cannot be disabled when forbidOrphanComponents is set to true');
9858
9991
  }
9859
9992
  const handlers = [
9860
- new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, localCompilationExtraImportsTracker),
9993
+ new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, this.enableLetSyntax, localCompilationExtraImportsTracker),
9861
9994
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
9862
9995
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
9863
9996
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
@@ -10673,4 +10806,4 @@ export {
10673
10806
  * Use of this source code is governed by an MIT-style license that can be
10674
10807
  * found in the LICENSE file at https://angular.io/license
10675
10808
  */
10676
- //# sourceMappingURL=chunk-ZLHOM56K.js.map
10809
+ //# sourceMappingURL=chunk-7E6Q23KF.js.map