@angular/compiler-cli 20.2.0-next.0 → 20.2.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 (54) hide show
  1. package/bundles/{chunk-5TMRGUHP.js → chunk-56QTHZ7G.js} +27 -11
  2. package/bundles/{chunk-UZOSFHTN.js → chunk-5LTXARS2.js} +2328 -750
  3. package/bundles/{chunk-SEKYV57I.js → chunk-6HOSNZU5.js} +2 -3
  4. package/bundles/{chunk-FPHHL4UV.js → chunk-BPDNYZBC.js} +253 -49
  5. package/bundles/chunk-DWRM7PIK.js +14 -0
  6. package/bundles/{chunk-TPEB2IXF.js → chunk-GWZQLAGK.js} +35 -7
  7. package/bundles/{chunk-PML5JK7B.js → chunk-HYJ2H3FU.js} +120 -7
  8. package/bundles/{chunk-6ECVYRSU.js → chunk-I2BHWRAU.js} +11 -6
  9. package/bundles/{chunk-YNE6T2TY.js → chunk-MQ6W6B7H.js} +613 -110
  10. package/bundles/{chunk-5JF7HF3W.js → chunk-SZY7NM6F.js} +2 -3
  11. package/bundles/{chunk-JXYBFWGA.js → chunk-UVWZGTBX.js} +19 -7
  12. package/bundles/index.js +34 -19
  13. package/bundles/linker/babel/index.js +70 -18
  14. package/bundles/linker/index.js +11 -5
  15. package/bundles/private/localize.js +5 -6
  16. package/bundles/private/migrations.js +5 -6
  17. package/bundles/private/tooling.js +27 -11
  18. package/bundles/src/bin/ng_xi18n.js +11 -12
  19. package/bundles/src/bin/ngc.js +9 -10
  20. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  21. package/package.json +3 -3
  22. package/src/ngtsc/annotations/component/src/animations.d.ts +15 -0
  23. package/src/ngtsc/diagnostics/src/error_code.d.ts +14 -0
  24. package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +2 -1
  25. package/src/ngtsc/perf/src/api.d.ts +24 -16
  26. package/src/ngtsc/typecheck/api/api.d.ts +1 -1
  27. package/src/ngtsc/typecheck/api/checker.d.ts +15 -0
  28. package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +7 -1
  29. package/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_text_interpolation/index.d.ts +10 -0
  30. package/src/ngtsc/typecheck/src/checker.d.ts +2 -0
  31. package/src/ngtsc/typecheck/src/dom.d.ts +2 -1
  32. package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
  33. package/bundles/chunk-2FHBFXPC.js +0 -34
  34. package/bundles/chunk-2FHBFXPC.js.map +0 -6
  35. package/bundles/chunk-5JF7HF3W.js.map +0 -6
  36. package/bundles/chunk-5TMRGUHP.js.map +0 -6
  37. package/bundles/chunk-6ECVYRSU.js.map +0 -6
  38. package/bundles/chunk-FPHHL4UV.js.map +0 -6
  39. package/bundles/chunk-JXYBFWGA.js.map +0 -6
  40. package/bundles/chunk-KPQ72R34.js +0 -23
  41. package/bundles/chunk-KPQ72R34.js.map +0 -6
  42. package/bundles/chunk-PML5JK7B.js.map +0 -6
  43. package/bundles/chunk-SEKYV57I.js.map +0 -6
  44. package/bundles/chunk-TPEB2IXF.js.map +0 -6
  45. package/bundles/chunk-UZOSFHTN.js.map +0 -6
  46. package/bundles/chunk-YNE6T2TY.js.map +0 -6
  47. package/bundles/index.js.map +0 -6
  48. package/bundles/linker/babel/index.js.map +0 -6
  49. package/bundles/linker/index.js.map +0 -6
  50. package/bundles/private/localize.js.map +0 -6
  51. package/bundles/private/migrations.js.map +0 -6
  52. package/bundles/private/tooling.js.map +0 -6
  53. package/bundles/src/bin/ng_xi18n.js.map +0 -6
  54. package/bundles/src/bin/ngc.js.map +0 -6
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-5TMRGUHP.js";
7
+ } from "./chunk-56QTHZ7G.js";
8
8
  import {
9
9
  AbsoluteModuleStrategy,
10
10
  ActivePerfRecorder,
@@ -92,7 +92,7 @@ import {
92
92
  toUnredirectedSourceFile,
93
93
  tryParseInitializerApi,
94
94
  untagAllTsFiles
95
- } from "./chunk-UZOSFHTN.js";
95
+ } from "./chunk-5LTXARS2.js";
96
96
  import {
97
97
  LogicalFileSystem,
98
98
  absoluteFrom,
@@ -102,9 +102,9 @@ import {
102
102
  getFileSystem,
103
103
  join,
104
104
  resolve
105
- } from "./chunk-TPEB2IXF.js";
105
+ } from "./chunk-GWZQLAGK.js";
106
106
 
107
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.js
107
+ // packages/compiler-cli/src/transformers/api.js
108
108
  var DEFAULT_ERROR_CODE = 100;
109
109
  var UNKNOWN_ERROR_CODE = 500;
110
110
  var SOURCE = "angular";
@@ -122,7 +122,7 @@ var EmitFlags;
122
122
  EmitFlags2[EmitFlags2["All"] = 31] = "All";
123
123
  })(EmitFlags || (EmitFlags = {}));
124
124
 
125
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.js
125
+ // packages/compiler-cli/src/transformers/compiler_host.js
126
126
  import ts from "typescript";
127
127
  var wrapHostForTest = null;
128
128
  function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
@@ -132,7 +132,7 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
132
132
  return tsHost;
133
133
  }
134
134
 
135
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/entities.js
135
+ // packages/compiler-cli/src/ngtsc/docs/src/entities.js
136
136
  var EntryType;
137
137
  (function(EntryType2) {
138
138
  EntryType2["Block"] = "block";
@@ -179,22 +179,22 @@ function isDocEntryWithSourceInfo(entry) {
179
179
  return "source" in entry;
180
180
  }
181
181
 
182
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.js
182
+ // packages/compiler-cli/src/ngtsc/docs/src/extractor.js
183
183
  import ts12 from "typescript";
184
184
 
185
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
185
+ // packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
186
186
  import ts6 from "typescript";
187
187
 
188
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/filters.js
188
+ // packages/compiler-cli/src/ngtsc/docs/src/filters.js
189
189
  function isAngularPrivateName(name) {
190
190
  const firstChar = name[0] ?? "";
191
191
  return firstChar === "\u0275" || firstChar === "_";
192
192
  }
193
193
 
194
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
194
+ // packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
195
195
  import ts4 from "typescript";
196
196
 
197
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
197
+ // packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
198
198
  function extractGenerics(declaration) {
199
199
  return declaration.typeParameters?.map((typeParam) => ({
200
200
  name: typeParam.name.getText(),
@@ -203,7 +203,7 @@ function extractGenerics(declaration) {
203
203
  })) ?? [];
204
204
  }
205
205
 
206
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.js
206
+ // packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.js
207
207
  import ts2 from "typescript";
208
208
  var decoratorExpression = /@(?=(Injectable|Component|Directive|Pipe|NgModule|Input|Output|HostBinding|HostListener|Inject|Optional|Self|Host|SkipSelf|ViewChild|ViewChildren|ContentChild|ContentChildren))/g;
209
209
  function extractJsDocTags(node) {
@@ -244,13 +244,13 @@ function unescapeAngularDecorators(comment) {
244
244
  return comment.replace(/_NG_AT_/g, "@");
245
245
  }
246
246
 
247
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_extractor.js
247
+ // packages/compiler-cli/src/ngtsc/docs/src/type_extractor.js
248
248
  import ts3 from "typescript";
249
249
  function extractResolvedTypeString(node, checker) {
250
250
  return checker.typeToString(checker.getTypeAtLocation(node), void 0, ts3.TypeFormatFlags.NoTruncation);
251
251
  }
252
252
 
253
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
253
+ // packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
254
254
  var FunctionExtractor = class {
255
255
  name;
256
256
  exportDeclaration;
@@ -348,6 +348,7 @@ function extractReturnType(signature, typeChecker) {
348
348
  return typeChecker.typeToString(
349
349
  typeChecker.getReturnTypeOfSignature(signature),
350
350
  void 0,
351
+ // This ensures that e.g. `T | undefined` is not reduced to `T`.
351
352
  ts4.TypeFormatFlags.NoTypeReduction | ts4.TypeFormatFlags.NoTruncation
352
353
  );
353
354
  }
@@ -360,7 +361,7 @@ function findImplementationOfFunction(node, typeChecker) {
360
361
  return implementation;
361
362
  }
362
363
 
363
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/internal.js
364
+ // packages/compiler-cli/src/ngtsc/docs/src/internal.js
364
365
  import ts5 from "typescript";
365
366
  function isInternal(member) {
366
367
  return extractJsDocTags(member).some((tag) => tag.name === "internal") || hasLeadingInternalComment(member);
@@ -373,12 +374,14 @@ function hasLeadingInternalComment(member) {
373
374
  (pos, end, kind, hasTrailingNewLine, containsInternal) => {
374
375
  return containsInternal || memberText.slice(pos, end).includes("@internal");
375
376
  },
377
+ /* state */
376
378
  false,
379
+ /* initial */
377
380
  false
378
381
  ) ?? false;
379
382
  }
380
383
 
381
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
384
+ // packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
382
385
  var ClassExtractor = class {
383
386
  declaration;
384
387
  typeChecker;
@@ -386,6 +389,7 @@ var ClassExtractor = class {
386
389
  this.declaration = declaration;
387
390
  this.typeChecker = typeChecker;
388
391
  }
392
+ /** Extract docs info specific to classes. */
389
393
  extract() {
390
394
  return {
391
395
  name: this.declaration.name.text,
@@ -400,6 +404,7 @@ var ClassExtractor = class {
400
404
  implements: this.extractInterfaceConformance(this.declaration)
401
405
  };
402
406
  }
407
+ /** Extracts doc info for a class's members. */
403
408
  extractAllClassMembers() {
404
409
  const members = [];
405
410
  for (const member of this.getMemberDeclarations()) {
@@ -412,6 +417,7 @@ var ClassExtractor = class {
412
417
  }
413
418
  return members;
414
419
  }
420
+ /** Extract docs for a class's members (methods and properties). */
415
421
  extractClassMember(memberDeclaration) {
416
422
  if (this.isMethod(memberDeclaration)) {
417
423
  return this.extractMethod(memberDeclaration);
@@ -424,9 +430,11 @@ var ClassExtractor = class {
424
430
  }
425
431
  return void 0;
426
432
  }
433
+ /** Extract docs for all call signatures in the current class/interface. */
427
434
  extractSignatures() {
428
435
  return this.computeAllSignatureDeclarations().map((s) => this.extractSignature(s));
429
436
  }
437
+ /** Extracts docs for a class method. */
430
438
  extractMethod(methodDeclaration) {
431
439
  const functionExtractor = new FunctionExtractor(methodDeclaration.name.getText(), methodDeclaration, this.typeChecker);
432
440
  return {
@@ -435,6 +443,7 @@ var ClassExtractor = class {
435
443
  memberTags: this.getMemberTags(methodDeclaration)
436
444
  };
437
445
  }
446
+ /** Extracts docs for a signature element (usually inside an interface). */
438
447
  extractSignature(signature) {
439
448
  const functionExtractor = new FunctionExtractor(ts6.isConstructSignatureDeclaration(signature) ? "new" : "", signature, this.typeChecker);
440
449
  return {
@@ -443,6 +452,7 @@ var ClassExtractor = class {
443
452
  memberTags: []
444
453
  };
445
454
  }
455
+ /** Extracts doc info for a property declaration. */
446
456
  extractClassProperty(propertyDeclaration) {
447
457
  return {
448
458
  name: propertyDeclaration.name.getText(),
@@ -453,6 +463,7 @@ var ClassExtractor = class {
453
463
  jsdocTags: extractJsDocTags(propertyDeclaration)
454
464
  };
455
465
  }
466
+ /** Extracts doc info for an accessor member (getter/setter). */
456
467
  extractGetterSetter(accessor) {
457
468
  return {
458
469
  ...this.extractClassProperty(accessor),
@@ -486,6 +497,7 @@ var ClassExtractor = class {
486
497
  const implementClause = declaration.heritageClauses?.find((clause) => clause.token === ts6.SyntaxKind.ImplementsKeyword);
487
498
  return implementClause?.types.map((m) => m.getText()) ?? [];
488
499
  }
500
+ /** Gets the tags for a member (protected, readonly, static, etc.) */
489
501
  getMemberTags(member) {
490
502
  const tags = this.getMemberTagsFromModifiers(member.modifiers ?? []);
491
503
  if (member.questionToken) {
@@ -496,6 +508,7 @@ var ClassExtractor = class {
496
508
  }
497
509
  return tags;
498
510
  }
511
+ /** Computes all signature declarations of the class/interface. */
499
512
  computeAllSignatureDeclarations() {
500
513
  const type = this.typeChecker.getTypeAtLocation(this.declaration);
501
514
  const signatures = [...type.getCallSignatures(), ...type.getConstructSignatures()];
@@ -508,6 +521,7 @@ var ClassExtractor = class {
508
521
  }
509
522
  return result;
510
523
  }
524
+ /** Gets all member declarations, including inherited members. */
511
525
  getMemberDeclarations() {
512
526
  const type = this.typeChecker.getTypeAtLocation(this.declaration);
513
527
  const members = type.getProperties();
@@ -525,6 +539,7 @@ var ClassExtractor = class {
525
539
  }
526
540
  return result;
527
541
  }
542
+ /** The result only contains properties, method implementations and abstracts */
528
543
  filterMethodOverloads(declarations) {
529
544
  return declarations.filter((declaration, index) => {
530
545
  if (ts6.isFunctionDeclaration(declaration) || ts6.isMethodDeclaration(declaration) || ts6.isConstructorDeclaration(declaration)) {
@@ -535,6 +550,7 @@ var ClassExtractor = class {
535
550
  return true;
536
551
  });
537
552
  }
553
+ /** Get the tags for a member that come from the declaration modifiers. */
538
554
  getMemberTagsFromModifiers(mods) {
539
555
  const tags = [];
540
556
  for (const mod of mods) {
@@ -544,6 +560,7 @@ var ClassExtractor = class {
544
560
  }
545
561
  return tags;
546
562
  }
563
+ /** Gets the doc tag corresponding to a class member modifier (readonly, protected, etc.). */
547
564
  getTagForMemberModifier(mod) {
548
565
  switch (mod.kind) {
549
566
  case ts6.SyntaxKind.StaticKeyword:
@@ -558,34 +575,55 @@ var ClassExtractor = class {
558
575
  return void 0;
559
576
  }
560
577
  }
578
+ /**
579
+ * Gets whether a given class member should be excluded from public API docs.
580
+ * This is the case if:
581
+ * - The member does not have a name
582
+ * - The member is neither a method nor property
583
+ * - The member is private
584
+ * - The member has a name that marks it as Angular-internal.
585
+ * - The member is marked as internal via JSDoc.
586
+ */
561
587
  isMemberExcluded(member) {
562
588
  if (ts6.isConstructorDeclaration(member)) {
563
589
  return false;
564
590
  }
565
591
  return !member.name || !this.isDocumentableMember(member) || !ts6.isCallSignatureDeclaration(member) && member.modifiers?.some((mod) => mod.kind === ts6.SyntaxKind.PrivateKeyword) || member.name.getText() === "prototype" || isAngularPrivateName(member.name.getText()) || isInternal(member);
566
592
  }
593
+ /** Gets whether a class member is a method, property, or accessor. */
567
594
  isDocumentableMember(member) {
568
- return this.isMethod(member) || this.isProperty(member) || ts6.isAccessor(member) || ts6.isConstructorDeclaration(member) || ts6.isCallSignatureDeclaration(member);
595
+ return this.isMethod(member) || this.isProperty(member) || ts6.isAccessor(member) || ts6.isConstructorDeclaration(member) || // Signatures are documentable if they are part of an interface.
596
+ ts6.isCallSignatureDeclaration(member);
569
597
  }
598
+ /** Check if the parameter is a constructor parameter with a public modifier */
570
599
  isPublicConstructorParameterProperty(node) {
571
600
  if (ts6.isParameterPropertyDeclaration(node, node.parent) && node.modifiers) {
572
601
  return node.modifiers.some((modifier) => modifier.kind === ts6.SyntaxKind.PublicKeyword);
573
602
  }
574
603
  return false;
575
604
  }
605
+ /** Gets whether a member is a property. */
576
606
  isProperty(member) {
577
607
  return ts6.isPropertyDeclaration(member) || ts6.isPropertySignature(member) || this.isPublicConstructorParameterProperty(member);
578
608
  }
609
+ /** Gets whether a member is a method. */
579
610
  isMethod(member) {
580
611
  return ts6.isMethodDeclaration(member) || ts6.isMethodSignature(member);
581
612
  }
613
+ /** Gets whether the given signature declaration is documentable. */
582
614
  isDocumentableSignature(signature) {
583
615
  return ts6.isConstructSignatureDeclaration(signature) || ts6.isCallSignatureDeclaration(signature);
584
616
  }
617
+ /** Gets whether the declaration for this extractor is abstract. */
585
618
  isAbstract() {
586
619
  const modifiers = this.declaration.modifiers ?? [];
587
620
  return modifiers.some((mod) => mod.kind === ts6.SyntaxKind.AbstractKeyword);
588
621
  }
622
+ /**
623
+ * Check wether a member has a private computed property name like [ɵWRITABLE_SIGNAL]
624
+ *
625
+ * This will prevent exposing private computed properties in the docs.
626
+ */
589
627
  hasPrivateComputedProperty(property) {
590
628
  return ts6.isComputedPropertyName(property.name) && property.name.expression.getText().startsWith("\u0275");
591
629
  }
@@ -598,6 +636,7 @@ var DirectiveExtractor = class extends ClassExtractor {
598
636
  this.reference = reference;
599
637
  this.metadata = metadata;
600
638
  }
639
+ /** Extract docs info for directives and components (including underlying class info). */
601
640
  extract() {
602
641
  return {
603
642
  ...super.extract(),
@@ -607,6 +646,7 @@ var DirectiveExtractor = class extends ClassExtractor {
607
646
  entryType: this.metadata.isComponent ? EntryType.Component : EntryType.Directive
608
647
  };
609
648
  }
649
+ /** Extracts docs info for a directive property, including input/output metadata. */
610
650
  extractClassProperty(propertyDeclaration) {
611
651
  const entry = super.extractClassProperty(propertyDeclaration);
612
652
  const inputMetadata = this.getInputMetadata(propertyDeclaration);
@@ -622,10 +662,12 @@ var DirectiveExtractor = class extends ClassExtractor {
622
662
  }
623
663
  return entry;
624
664
  }
665
+ /** Gets the input metadata for a directive property. */
625
666
  getInputMetadata(prop) {
626
667
  const propName = prop.name.getText();
627
668
  return this.metadata.inputs?.getByClassPropertyName(propName) ?? void 0;
628
669
  }
670
+ /** Gets the output metadata for a directive property. */
629
671
  getOutputMetadata(prop) {
630
672
  const propName = prop.name.getText();
631
673
  return this.metadata?.outputs?.getByClassPropertyName(propName) ?? void 0;
@@ -696,7 +738,7 @@ function extractPipeSyntax(metadata, classDeclaration) {
696
738
  return `{{ value_expression | ${metadata.name}${paramNames.length ? ":" + paramNames.join(":") : ""} }}`;
697
739
  }
698
740
 
699
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.js
741
+ // packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.js
700
742
  import ts7 from "typescript";
701
743
  var LITERAL_AS_ENUM_TAG = "object-literal-as-enum";
702
744
  function extractConstant(declaration, typeChecker) {
@@ -754,7 +796,7 @@ function extractLiteralPropertiesAsEnumMembers(declaration) {
754
796
  });
755
797
  }
756
798
 
757
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.js
799
+ // packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.js
758
800
  import ts8 from "typescript";
759
801
  function extractorDecorator(declaration, typeChecker) {
760
802
  const documentedNode = getDecoratorJsDocNode(declaration, typeChecker);
@@ -889,7 +931,7 @@ function expandType(decl, sourceFile, printer) {
889
931
  return `{${props}}`;
890
932
  }
891
933
 
892
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.js
934
+ // packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.js
893
935
  import ts9 from "typescript";
894
936
  function extractEnum(declaration, typeChecker) {
895
937
  return {
@@ -919,7 +961,7 @@ function getEnumMemberValue(memberNode) {
919
961
  return literal?.getText() ?? "";
920
962
  }
921
963
 
922
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
964
+ // packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
923
965
  import ts10 from "typescript";
924
966
  var initializerApiTag = "initializerApiFunction";
925
967
  function isInitializerApiFunction(node, typeChecker) {
@@ -1023,11 +1065,12 @@ function extractFunctionWithOverloads(name, type, typeChecker) {
1023
1065
  return {
1024
1066
  name,
1025
1067
  signatures: extractCallSignatures(name, typeChecker, type),
1068
+ // Implementation may be populated later.
1026
1069
  implementation: null
1027
1070
  };
1028
1071
  }
1029
1072
 
1030
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_alias_extractor.js
1073
+ // packages/compiler-cli/src/ngtsc/docs/src/type_alias_extractor.js
1031
1074
  function extractTypeAlias(declaration) {
1032
1075
  return {
1033
1076
  name: declaration.name.getText(),
@@ -1040,7 +1083,7 @@ function extractTypeAlias(declaration) {
1040
1083
  };
1041
1084
  }
1042
1085
 
1043
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/import_extractor.js
1086
+ // packages/compiler-cli/src/ngtsc/docs/src/import_extractor.js
1044
1087
  import ts11 from "typescript";
1045
1088
  function getImportedSymbols(sourceFile) {
1046
1089
  const importSpecifiers = /* @__PURE__ */ new Map();
@@ -1064,7 +1107,7 @@ function getImportedSymbols(sourceFile) {
1064
1107
  return importSpecifiers;
1065
1108
  }
1066
1109
 
1067
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.js
1110
+ // packages/compiler-cli/src/ngtsc/docs/src/extractor.js
1068
1111
  var DocsExtractor = class {
1069
1112
  typeChecker;
1070
1113
  metadataReader;
@@ -1072,6 +1115,12 @@ var DocsExtractor = class {
1072
1115
  this.typeChecker = typeChecker;
1073
1116
  this.metadataReader = metadataReader;
1074
1117
  }
1118
+ /**
1119
+ * Gets the set of all documentable entries from a source file, including
1120
+ * declarations that are re-exported from this file as an entry-point.
1121
+ *
1122
+ * @param sourceFile The file from which to extract documentable entries.
1123
+ */
1075
1124
  extractAll(sourceFile, rootDir, privateModules) {
1076
1125
  const entries = [];
1077
1126
  const symbols = /* @__PURE__ */ new Map();
@@ -1095,6 +1144,7 @@ var DocsExtractor = class {
1095
1144
  });
1096
1145
  entry.source = {
1097
1146
  filePath: getRelativeFilePath(realSourceFile, rootDir),
1147
+ // Start & End are off by 1
1098
1148
  startLine: ts12.getLineAndCharacterOfPosition(realSourceFile, node.getStart()).line + 1,
1099
1149
  endLine: ts12.getLineAndCharacterOfPosition(realSourceFile, node.getEnd()).line + 1
1100
1150
  };
@@ -1103,6 +1153,7 @@ var DocsExtractor = class {
1103
1153
  }
1104
1154
  return { entries, symbols };
1105
1155
  }
1156
+ /** Extract the doc entry for a single declaration. */
1106
1157
  extractDeclaration(node) {
1107
1158
  if (isNamedClassDeclaration(node)) {
1108
1159
  return extractClass(node, this.metadataReader, this.typeChecker);
@@ -1128,6 +1179,7 @@ var DocsExtractor = class {
1128
1179
  }
1129
1180
  return null;
1130
1181
  }
1182
+ /** Gets the list of exported declarations for doc extraction. */
1131
1183
  getExportedDeclarations(sourceFile) {
1132
1184
  const reflector = new TypeScriptReflectionHost(this.typeChecker, false, true);
1133
1185
  const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
@@ -1151,11 +1203,11 @@ function getRelativeFilePath(sourceFile, rootDir) {
1151
1203
  return relativePath;
1152
1204
  }
1153
1205
 
1154
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.js
1206
+ // packages/compiler-cli/src/ngtsc/program.js
1155
1207
  import { HtmlParser, MessageBundle } from "@angular/compiler";
1156
1208
  import ts27 from "typescript";
1157
1209
 
1158
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.js
1210
+ // packages/compiler-cli/src/transformers/i18n.js
1159
1211
  import { Xliff, Xliff2, Xmb } from "@angular/compiler";
1160
1212
  import * as path from "path";
1161
1213
  function i18nGetExtension(formatName) {
@@ -1206,10 +1258,10 @@ function getPathNormalizer(basePath) {
1206
1258
  };
1207
1259
  }
1208
1260
 
1209
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.js
1261
+ // packages/compiler-cli/src/typescript_support.js
1210
1262
  import ts13 from "typescript";
1211
1263
 
1212
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version_helpers.js
1264
+ // packages/compiler-cli/src/version_helpers.js
1213
1265
  function toNumbers(value) {
1214
1266
  const suffixIndex = value.lastIndexOf("-");
1215
1267
  return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
@@ -1244,9 +1296,9 @@ function compareVersions(v1, v2) {
1244
1296
  return compareNumbers(toNumbers(v1), toNumbers(v2));
1245
1297
  }
1246
1298
 
1247
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.js
1299
+ // packages/compiler-cli/src/typescript_support.js
1248
1300
  var MIN_TS_VERSION = "5.8.0";
1249
- var MAX_TS_VERSION = "5.9.0";
1301
+ var MAX_TS_VERSION = "6.0.0";
1250
1302
  var tsVersion = ts13.version;
1251
1303
  function checkVersion(version, minVersion, maxVersion) {
1252
1304
  if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
@@ -1257,22 +1309,41 @@ function verifySupportedTypeScriptVersion() {
1257
1309
  checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
1258
1310
  }
1259
1311
 
1260
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.js
1312
+ // packages/compiler-cli/src/ngtsc/core/src/compiler.js
1261
1313
  import ts25 from "typescript";
1262
1314
 
1263
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
1315
+ // packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
1264
1316
  var CycleAnalyzer = class {
1265
1317
  importGraph;
1318
+ /**
1319
+ * Cycle detection is requested with the same `from` source file for all used directives and pipes
1320
+ * within a component, which makes it beneficial to cache the results as long as the `from` source
1321
+ * file has not changed. This avoids visiting the import graph that is reachable from multiple
1322
+ * directives/pipes more than once.
1323
+ */
1266
1324
  cachedResults = null;
1267
1325
  constructor(importGraph) {
1268
1326
  this.importGraph = importGraph;
1269
1327
  }
1328
+ /**
1329
+ * Check for a cycle to be created in the `ts.Program` by adding an import between `from` and
1330
+ * `to`.
1331
+ *
1332
+ * @returns a `Cycle` object if an import between `from` and `to` would create a cycle; `null`
1333
+ * otherwise.
1334
+ */
1270
1335
  wouldCreateCycle(from, to) {
1271
1336
  if (this.cachedResults === null || this.cachedResults.from !== from) {
1272
1337
  this.cachedResults = new CycleResults(from, this.importGraph);
1273
1338
  }
1274
1339
  return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
1275
1340
  }
1341
+ /**
1342
+ * Record a synthetic import from `from` to `to`.
1343
+ *
1344
+ * This is an import that doesn't exist in the `ts.Program` but will be considered as part of the
1345
+ * import graph for cycle creation.
1346
+ */
1276
1347
  recordSyntheticImport(from, to) {
1277
1348
  this.cachedResults = null;
1278
1349
  this.importGraph.addSyntheticImport(from, to);
@@ -1306,6 +1377,10 @@ var CycleResults = class {
1306
1377
  }
1307
1378
  return false;
1308
1379
  }
1380
+ /**
1381
+ * Returns whether the source file is already known to be cyclic, or `null` if the result is not
1382
+ * yet known.
1383
+ */
1309
1384
  getCachedResult(sf) {
1310
1385
  const result = sf[NgCyclicResult];
1311
1386
  if (result === this.cyclic) {
@@ -1332,12 +1407,18 @@ var Cycle = class {
1332
1407
  this.from = from;
1333
1408
  this.to = to;
1334
1409
  }
1410
+ /**
1411
+ * Compute an array of source-files that illustrates the cyclic path between `from` and `to`.
1412
+ *
1413
+ * Note that a `Cycle` will not be created unless a path is available between `to` and `from`,
1414
+ * so `findPath()` will never return `null`.
1415
+ */
1335
1416
  getPath() {
1336
1417
  return [this.from, ...this.importGraph.findPath(this.to, this.from)];
1337
1418
  }
1338
1419
  };
1339
1420
 
1340
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.js
1421
+ // packages/compiler-cli/src/ngtsc/cycles/src/imports.js
1341
1422
  import ts14 from "typescript";
1342
1423
  var ImportGraph = class {
1343
1424
  checker;
@@ -1347,12 +1428,28 @@ var ImportGraph = class {
1347
1428
  this.checker = checker;
1348
1429
  this.perf = perf;
1349
1430
  }
1431
+ /**
1432
+ * List the direct (not transitive) imports of a given `ts.SourceFile`.
1433
+ *
1434
+ * This operation is cached.
1435
+ */
1350
1436
  importsOf(sf) {
1351
1437
  if (!this.imports.has(sf)) {
1352
1438
  this.imports.set(sf, this.scanImports(sf));
1353
1439
  }
1354
1440
  return this.imports.get(sf);
1355
1441
  }
1442
+ /**
1443
+ * Find an import path from the `start` SourceFile to the `end` SourceFile.
1444
+ *
1445
+ * This function implements a breadth first search that results in finding the
1446
+ * shortest path between the `start` and `end` points.
1447
+ *
1448
+ * @param start the starting point of the path.
1449
+ * @param end the ending point of the path.
1450
+ * @returns an array of source files that connect the `start` and `end` source files, or `null` if
1451
+ * no path could be found.
1452
+ */
1356
1453
  findPath(start, end) {
1357
1454
  if (start === end) {
1358
1455
  return [start];
@@ -1375,6 +1472,10 @@ var ImportGraph = class {
1375
1472
  }
1376
1473
  return null;
1377
1474
  }
1475
+ /**
1476
+ * Add a record of an import from `sf` to `imported`, that's not present in the original
1477
+ * `ts.Program` but will be remembered by the `ImportGraph`.
1478
+ */
1378
1479
  addSyntheticImport(sf, imported) {
1379
1480
  if (isLocalFile(imported)) {
1380
1481
  this.importsOf(sf).add(imported);
@@ -1422,6 +1523,10 @@ var Found = class {
1422
1523
  this.sourceFile = sourceFile;
1423
1524
  this.parent = parent;
1424
1525
  }
1526
+ /**
1527
+ * Back track through this found SourceFile and its ancestors to generate an array of
1528
+ * SourceFiles that form am import path between two SourceFiles.
1529
+ */
1425
1530
  toPath() {
1426
1531
  const array = [];
1427
1532
  let current = this;
@@ -1433,7 +1538,7 @@ var Found = class {
1433
1538
  }
1434
1539
  };
1435
1540
 
1436
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.js
1541
+ // packages/compiler-cli/src/ngtsc/entry_point/src/generator.js
1437
1542
  import ts15 from "typescript";
1438
1543
  var FlatIndexGenerator = class {
1439
1544
  entryPoint;
@@ -1461,7 +1566,7 @@ export * from '${relativeEntryPoint}';
1461
1566
  }
1462
1567
  };
1463
1568
 
1464
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.js
1569
+ // packages/compiler-cli/src/ngtsc/entry_point/src/logic.js
1465
1570
  function findFlatIndexEntryPoint(rootFiles) {
1466
1571
  const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
1467
1572
  let resolvedEntryPoint = null;
@@ -1477,7 +1582,7 @@ function findFlatIndexEntryPoint(rootFiles) {
1477
1582
  return resolvedEntryPoint;
1478
1583
  }
1479
1584
 
1480
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.js
1585
+ // packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.js
1481
1586
  import ts16 from "typescript";
1482
1587
  function checkForPrivateExports(entryPoint, checker, refGraph) {
1483
1588
  const diagnostics = [];
@@ -1557,7 +1662,7 @@ function getDescriptorOfDeclaration(decl) {
1557
1662
  }
1558
1663
  }
1559
1664
 
1560
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.js
1665
+ // packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.js
1561
1666
  var ReferenceGraph = class {
1562
1667
  references = /* @__PURE__ */ new Map();
1563
1668
  add(from, to) {
@@ -1609,7 +1714,7 @@ var ReferenceGraph = class {
1609
1714
  }
1610
1715
  };
1611
1716
 
1612
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.js
1717
+ // packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.js
1613
1718
  var FileDependencyGraph = class {
1614
1719
  nodes = /* @__PURE__ */ new Map();
1615
1720
  addDependency(from, on) {
@@ -1625,6 +1730,27 @@ var FileDependencyGraph = class {
1625
1730
  const node = this.nodes.get(from);
1626
1731
  return node ? [...node.usesResources] : [];
1627
1732
  }
1733
+ /**
1734
+ * Update the current dependency graph from a previous one, incorporating a set of physical
1735
+ * changes.
1736
+ *
1737
+ * This method performs two tasks:
1738
+ *
1739
+ * 1. For files which have not logically changed, their dependencies from `previous` are added to
1740
+ * `this` graph.
1741
+ * 2. For files which have logically changed, they're added to a set of logically changed files
1742
+ * which is eventually returned.
1743
+ *
1744
+ * In essence, for build `n`, this method performs:
1745
+ *
1746
+ * G(n) + L(n) = G(n - 1) + P(n)
1747
+ *
1748
+ * where:
1749
+ *
1750
+ * G(n) = the dependency graph of build `n`
1751
+ * L(n) = the logically changed files from build n - 1 to build n.
1752
+ * P(n) = the physically changed files from build n - 1 to build n.
1753
+ */
1628
1754
  updateWithPhysicalChanges(previous, changedTsPaths, deletedTsPaths, changedResources) {
1629
1755
  const logicallyChanged = /* @__PURE__ */ new Set();
1630
1756
  for (const sf of previous.nodes.keys()) {
@@ -1674,7 +1800,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
1674
1800
  return false;
1675
1801
  }
1676
1802
 
1677
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.js
1803
+ // packages/compiler-cli/src/ngtsc/incremental/src/state.js
1678
1804
  var IncrementalStateKind;
1679
1805
  (function(IncrementalStateKind2) {
1680
1806
  IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
@@ -1682,17 +1808,23 @@ var IncrementalStateKind;
1682
1808
  IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
1683
1809
  })(IncrementalStateKind || (IncrementalStateKind = {}));
1684
1810
 
1685
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.js
1811
+ // packages/compiler-cli/src/ngtsc/incremental/src/incremental.js
1686
1812
  var PhaseKind;
1687
1813
  (function(PhaseKind2) {
1688
1814
  PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
1689
1815
  PhaseKind2[PhaseKind2["TypeCheckAndEmit"] = 1] = "TypeCheckAndEmit";
1690
1816
  })(PhaseKind || (PhaseKind = {}));
1691
- var IncrementalCompilation = class {
1817
+ var IncrementalCompilation = class _IncrementalCompilation {
1692
1818
  depGraph;
1693
1819
  versions;
1694
1820
  step;
1695
1821
  phase;
1822
+ /**
1823
+ * `IncrementalState` of this compilation if it were to be reused in a subsequent incremental
1824
+ * compilation at the current moment.
1825
+ *
1826
+ * Exposed via the `state` read-only getter.
1827
+ */
1696
1828
  _state;
1697
1829
  constructor(state, depGraph, versions, step) {
1698
1830
  this.depGraph = depGraph;
@@ -1704,11 +1836,20 @@ var IncrementalCompilation = class {
1704
1836
  semanticDepGraphUpdater: new SemanticDepGraphUpdater(step !== null ? step.priorState.semanticDepGraph : null)
1705
1837
  };
1706
1838
  }
1839
+ /**
1840
+ * Begin a fresh `IncrementalCompilation`.
1841
+ */
1707
1842
  static fresh(program, versions) {
1708
1843
  const state = {
1709
1844
  kind: IncrementalStateKind.Fresh
1710
1845
  };
1711
- return new IncrementalCompilation(state, new FileDependencyGraph(), versions, null);
1846
+ return new _IncrementalCompilation(
1847
+ state,
1848
+ new FileDependencyGraph(),
1849
+ versions,
1850
+ /* reuse */
1851
+ null
1852
+ );
1712
1853
  }
1713
1854
  static incremental(program, newVersions, oldProgram, oldState, modifiedResourceFiles, perf) {
1714
1855
  return perf.inPhase(PerfPhase.Reconciliation, () => {
@@ -1717,7 +1858,7 @@ var IncrementalCompilation = class {
1717
1858
  let priorAnalysis;
1718
1859
  switch (oldState.kind) {
1719
1860
  case IncrementalStateKind.Fresh:
1720
- return IncrementalCompilation.fresh(program, newVersions);
1861
+ return _IncrementalCompilation.fresh(program, newVersions);
1721
1862
  case IncrementalStateKind.Analyzed:
1722
1863
  priorAnalysis = oldState;
1723
1864
  break;
@@ -1748,7 +1889,7 @@ var IncrementalCompilation = class {
1748
1889
  }
1749
1890
  }
1750
1891
  if (sf.isDeclarationFile) {
1751
- return IncrementalCompilation.fresh(program, newVersions);
1892
+ return _IncrementalCompilation.fresh(program, newVersions);
1752
1893
  }
1753
1894
  physicallyChangedTsFiles.add(sfPath);
1754
1895
  }
@@ -1766,7 +1907,7 @@ var IncrementalCompilation = class {
1766
1907
  changedResourceFiles,
1767
1908
  lastAnalyzedState: priorAnalysis
1768
1909
  };
1769
- return new IncrementalCompilation(state, depGraph, newVersions, {
1910
+ return new _IncrementalCompilation(state, depGraph, newVersions, {
1770
1911
  priorState: priorAnalysis,
1771
1912
  logicallyChangedTsFiles
1772
1913
  });
@@ -1888,8 +2029,8 @@ function toOriginalSourceFile(sf) {
1888
2029
  }
1889
2030
  }
1890
2031
 
1891
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.js
1892
- var TrackedIncrementalBuildStrategy = class {
2032
+ // packages/compiler-cli/src/ngtsc/incremental/src/strategy.js
2033
+ var TrackedIncrementalBuildStrategy = class _TrackedIncrementalBuildStrategy {
1893
2034
  state = null;
1894
2035
  isSet = false;
1895
2036
  getIncrementalState() {
@@ -1900,7 +2041,7 @@ var TrackedIncrementalBuildStrategy = class {
1900
2041
  this.isSet = true;
1901
2042
  }
1902
2043
  toNextBuildStrategy() {
1903
- const strategy = new TrackedIncrementalBuildStrategy();
2044
+ const strategy = new _TrackedIncrementalBuildStrategy();
1904
2045
  strategy.state = this.isSet ? this.state : null;
1905
2046
  return strategy;
1906
2047
  }
@@ -1922,7 +2063,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
1922
2063
  };
1923
2064
  var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
1924
2065
 
1925
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.js
2066
+ // packages/compiler-cli/src/ngtsc/indexer/src/api.js
1926
2067
  var IdentifierKind;
1927
2068
  (function(IdentifierKind2) {
1928
2069
  IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
@@ -1945,30 +2086,47 @@ var AbsoluteSourceSpan = class {
1945
2086
  }
1946
2087
  };
1947
2088
 
1948
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.js
2089
+ // packages/compiler-cli/src/ngtsc/indexer/src/context.js
1949
2090
  var IndexingContext = class {
1950
2091
  components = /* @__PURE__ */ new Set();
2092
+ /**
2093
+ * Adds a component to the context.
2094
+ */
1951
2095
  addComponent(info) {
1952
2096
  this.components.add(info);
1953
2097
  }
1954
2098
  };
1955
2099
 
1956
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.js
2100
+ // packages/compiler-cli/src/ngtsc/indexer/src/transform.js
1957
2101
  import { ParseSourceFile } from "@angular/compiler";
1958
2102
 
1959
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.js
2103
+ // packages/compiler-cli/src/ngtsc/indexer/src/template.js
1960
2104
  import { ASTWithSource, CombinedRecursiveAstVisitor, ImplicitReceiver, PropertyRead, TmplAstComponent, TmplAstDirective, TmplAstElement, TmplAstReference, TmplAstTemplate, TmplAstVariable, tmplAstVisitAll } from "@angular/compiler";
1961
2105
  var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
1962
2106
  boundTemplate;
2107
+ // Identifiers of interest found in the template.
1963
2108
  identifiers = /* @__PURE__ */ new Set();
1964
2109
  errors = [];
1965
2110
  currentAstWithSource = null;
2111
+ // Map of targets in a template to their identifiers.
1966
2112
  targetIdentifierCache = /* @__PURE__ */ new Map();
2113
+ // Map of elements and templates to their identifiers.
1967
2114
  directiveHostIdentifierCache = /* @__PURE__ */ new Map();
2115
+ /**
2116
+ * Creates a template visitor for a bound template target. The bound target can be used when
2117
+ * deferred to the expression visitor to get information about the target of an expression.
2118
+ *
2119
+ * @param boundTemplate bound template target
2120
+ */
1968
2121
  constructor(boundTemplate) {
1969
2122
  super();
1970
2123
  this.boundTemplate = boundTemplate;
1971
2124
  }
2125
+ /**
2126
+ * Add an identifier for an HTML element and visit its children recursively.
2127
+ *
2128
+ * @param element
2129
+ */
1972
2130
  visitElement(element) {
1973
2131
  const elementIdentifier = this.directiveHostToIdentifier(element);
1974
2132
  if (elementIdentifier !== null) {
@@ -2031,6 +2189,7 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
2031
2189
  this.visit(attribute.value instanceof ASTWithSource ? attribute.value.ast : attribute.value);
2032
2190
  this.currentAstWithSource = previous;
2033
2191
  }
2192
+ /** Creates an identifier for a template element or template node. */
2034
2193
  directiveHostToIdentifier(node) {
2035
2194
  if (this.directiveHostIdentifierCache.has(node)) {
2036
2195
  return this.directiveHostIdentifierCache.get(node);
@@ -2078,10 +2237,12 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
2078
2237
  selector: dir.selector
2079
2238
  };
2080
2239
  }))
2240
+ // cast b/c pre-TypeScript 3.5 unions aren't well discriminated
2081
2241
  };
2082
2242
  this.directiveHostIdentifierCache.set(node, identifier);
2083
2243
  return identifier;
2084
2244
  }
2245
+ /** Creates an identifier for a template reference or template variable target. */
2085
2246
  targetToIdentifier(node) {
2086
2247
  if (this.targetIdentifierCache.has(node)) {
2087
2248
  return this.targetIdentifierCache.get(node);
@@ -2135,6 +2296,7 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
2135
2296
  this.targetIdentifierCache.set(node, identifier);
2136
2297
  return identifier;
2137
2298
  }
2299
+ /** Gets the start location of a string in a SourceSpan */
2138
2300
  getStartLocation(name, context) {
2139
2301
  const localStr = context.toString();
2140
2302
  if (!localStr.includes(name)) {
@@ -2143,6 +2305,12 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
2143
2305
  }
2144
2306
  return context.start.offset + localStr.indexOf(name);
2145
2307
  }
2308
+ /**
2309
+ * Visits a node's expression and adds its identifiers, if any, to the visitor's state.
2310
+ * Only ASTs with information about the expression source and its location are visited.
2311
+ *
2312
+ * @param node node whose expression to visit
2313
+ */
2146
2314
  visit(node) {
2147
2315
  if (node instanceof ASTWithSource) {
2148
2316
  const previous = this.currentAstWithSource;
@@ -2153,6 +2321,12 @@ var TemplateVisitor = class extends CombinedRecursiveAstVisitor {
2153
2321
  super.visit(node);
2154
2322
  }
2155
2323
  }
2324
+ /**
2325
+ * Visits an identifier, adding it to the identifier store if it is useful for indexing.
2326
+ *
2327
+ * @param ast expression AST the identifier is in
2328
+ * @param kind identifier kind
2329
+ */
2156
2330
  visitIdentifier(ast, kind) {
2157
2331
  if (this.currentAstWithSource === null || this.currentAstWithSource.source === null) {
2158
2332
  return;
@@ -2190,7 +2364,7 @@ function getTemplateIdentifiers(boundTemplate) {
2190
2364
  return { identifiers: visitor.identifiers, errors: visitor.errors };
2191
2365
  }
2192
2366
 
2193
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.js
2367
+ // packages/compiler-cli/src/ngtsc/indexer/src/transform.js
2194
2368
  function generateAnalysis(context) {
2195
2369
  const analysis = /* @__PURE__ */ new Map();
2196
2370
  context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
@@ -2226,7 +2400,7 @@ function generateAnalysis(context) {
2226
2400
  return analysis;
2227
2401
  }
2228
2402
 
2229
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/ng_module_index.js
2403
+ // packages/compiler-cli/src/ngtsc/metadata/src/ng_module_index.js
2230
2404
  var NgModuleIndexImpl = class {
2231
2405
  metaReader;
2232
2406
  localReader;
@@ -2234,7 +2408,11 @@ var NgModuleIndexImpl = class {
2234
2408
  this.metaReader = metaReader;
2235
2409
  this.localReader = localReader;
2236
2410
  }
2411
+ // A map from an NgModule's Class Declaration to the "main" reference to that module, aka the one
2412
+ // present in the reader metadata object
2237
2413
  ngModuleAuthoritativeReference = /* @__PURE__ */ new Map();
2414
+ // A map from a Directive/Pipe's class declaration to the class declarations of all re-exporting
2415
+ // NgModules
2238
2416
  typeToExportingModules = /* @__PURE__ */ new Map();
2239
2417
  indexed = false;
2240
2418
  updateWith(cache, key, elem) {
@@ -2316,7 +2494,7 @@ var NgModuleIndexImpl = class {
2316
2494
  }
2317
2495
  };
2318
2496
 
2319
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.js
2497
+ // packages/compiler-cli/src/ngtsc/resource/src/loader.js
2320
2498
  import ts17 from "typescript";
2321
2499
  var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
2322
2500
  var RESOURCE_MARKER = ".$ngresource$";
@@ -2336,6 +2514,18 @@ var AdapterResourceLoader = class {
2336
2514
  this.canPreload = !!this.adapter.readResource;
2337
2515
  this.canPreprocess = !!this.adapter.transformResource;
2338
2516
  }
2517
+ /**
2518
+ * Resolve the url of a resource relative to the file that contains the reference to it.
2519
+ * The return value of this method can be used in the `load()` and `preload()` methods.
2520
+ *
2521
+ * Uses the provided CompilerHost if it supports mapping resources to filenames.
2522
+ * Otherwise, uses a fallback mechanism that searches the module resolution candidates.
2523
+ *
2524
+ * @param url The, possibly relative, url of the resource.
2525
+ * @param fromFile The path to the file that contains the URL of the resource.
2526
+ * @returns A resolved url of resource.
2527
+ * @throws An error if the resource cannot be resolved.
2528
+ */
2339
2529
  resolve(url, fromFile) {
2340
2530
  let resolvedUrl = null;
2341
2531
  if (this.adapter.resourceNameToFileName) {
@@ -2348,6 +2538,18 @@ var AdapterResourceLoader = class {
2348
2538
  }
2349
2539
  return resolvedUrl;
2350
2540
  }
2541
+ /**
2542
+ * Preload the specified resource, asynchronously.
2543
+ *
2544
+ * Once the resource is loaded, its value is cached so it can be accessed synchronously via the
2545
+ * `load()` method.
2546
+ *
2547
+ * @param resolvedUrl The url (resolved by a call to `resolve()`) of the resource to preload.
2548
+ * @param context Information about the resource such as the type and containing file.
2549
+ * @returns A Promise that is resolved once the resource has been loaded or `undefined` if the
2550
+ * file has already been loaded.
2551
+ * @throws An Error if pre-loading is not available.
2552
+ */
2351
2553
  preload(resolvedUrl, context) {
2352
2554
  if (!this.adapter.readResource) {
2353
2555
  throw new Error("HostResourceLoader: the CompilerHost provided does not support pre-loading resources.");
@@ -2382,6 +2584,14 @@ var AdapterResourceLoader = class {
2382
2584
  return fetchCompletion;
2383
2585
  }
2384
2586
  }
2587
+ /**
2588
+ * Preprocess the content data of an inline resource, asynchronously.
2589
+ *
2590
+ * @param data The existing content data from the inline resource.
2591
+ * @param context Information regarding the resource such as the type and containing file.
2592
+ * @returns A Promise that resolves to the processed data. If no processing occurs, the
2593
+ * same data string that was passed to the function will be resolved.
2594
+ */
2385
2595
  async preprocessInline(data, context) {
2386
2596
  if (!this.adapter.transformResource || context.type !== "style") {
2387
2597
  return data;
@@ -2398,6 +2608,14 @@ var AdapterResourceLoader = class {
2398
2608
  }
2399
2609
  return transformResult.content;
2400
2610
  }
2611
+ /**
2612
+ * Load the resource at the given url, synchronously.
2613
+ *
2614
+ * The contents of the resource may have been cached by a previous call to `preload()`.
2615
+ *
2616
+ * @param resolvedUrl The url (resolved by a call to `resolve()`) of the resource to load.
2617
+ * @returns The contents of the resource.
2618
+ */
2401
2619
  load(resolvedUrl) {
2402
2620
  if (this.cache.has(resolvedUrl)) {
2403
2621
  return this.cache.get(resolvedUrl);
@@ -2409,9 +2627,16 @@ var AdapterResourceLoader = class {
2409
2627
  this.cache.set(resolvedUrl, result);
2410
2628
  return result;
2411
2629
  }
2630
+ /**
2631
+ * Invalidate the entire resource cache.
2632
+ */
2412
2633
  invalidate() {
2413
2634
  this.cache.clear();
2414
2635
  }
2636
+ /**
2637
+ * Attempt to resolve `url` in the context of `fromFile`, while respecting the rootDirs
2638
+ * option from the tsconfig. First, normalize the file name.
2639
+ */
2415
2640
  fallbackResolve(url, fromFile) {
2416
2641
  let candidateLocations;
2417
2642
  if (url.startsWith("/")) {
@@ -2438,6 +2663,13 @@ var AdapterResourceLoader = class {
2438
2663
  const segment = "." + url;
2439
2664
  return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
2440
2665
  }
2666
+ /**
2667
+ * TypeScript provides utilities to resolve module names, but not resource files (which aren't
2668
+ * a part of the ts.Program). However, TypeScript's module resolution can be used creatively
2669
+ * to locate where resource files should be expected to exist. Since module resolution returns
2670
+ * a list of file names that were considered, the loader can enumerate the possible locations
2671
+ * for the file by setting up a module resolution for it that will fail.
2672
+ */
2441
2673
  getResolvedCandidateLocations(url, fromFile) {
2442
2674
  const failedLookup = ts17.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
2443
2675
  if (failedLookup.failedLookupLocations === void 0) {
@@ -2473,7 +2705,7 @@ function createLookupResolutionHost(adapter) {
2473
2705
  };
2474
2706
  }
2475
2707
 
2476
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/standalone.js
2708
+ // packages/compiler-cli/src/ngtsc/scope/src/standalone.js
2477
2709
  var StandaloneComponentScopeReader = class {
2478
2710
  metaReader;
2479
2711
  localModuleReader;
@@ -2571,10 +2803,10 @@ var StandaloneComponentScopeReader = class {
2571
2803
  }
2572
2804
  };
2573
2805
 
2574
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
2806
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
2575
2807
  import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute } from "@angular/compiler";
2576
2808
 
2577
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
2809
+ // packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
2578
2810
  import ts18 from "typescript";
2579
2811
  var SIGNAL_FNS = /* @__PURE__ */ new Set([
2580
2812
  "WritableSignal",
@@ -2584,7 +2816,9 @@ var SIGNAL_FNS = /* @__PURE__ */ new Set([
2584
2816
  "ModelSignal"
2585
2817
  ]);
2586
2818
  function isSignalReference(symbol) {
2587
- 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));
2819
+ return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable || symbol.kind === SymbolKind.LetDeclaration) && // Note that `tsType.symbol` isn't optional in the typings,
2820
+ // but it appears that it can be undefined at runtime.
2821
+ (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
2588
2822
  }
2589
2823
  function isSignalSymbol(symbol) {
2590
2824
  const declarations = symbol.getDeclarations();
@@ -2594,10 +2828,23 @@ function isSignalSymbol(symbol) {
2594
2828
  });
2595
2829
  }
2596
2830
 
2597
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.js
2831
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.js
2598
2832
  import { CombinedRecursiveAstVisitor as CombinedRecursiveAstVisitor2 } from "@angular/compiler";
2599
2833
  var TemplateCheckWithVisitor = class {
2834
+ /**
2835
+ * When extended diagnostics were first introduced, the visitor wasn't implemented correctly
2836
+ * which meant that it wasn't visiting the `templateAttrs` of structural directives (e.g.
2837
+ * the expression of `*ngIf`). Fixing the issue causes a lot of internal breakages and will likely
2838
+ * need to be done in a major version to avoid external breakages. This flag is used to opt out
2839
+ * pre-existing diagnostics from the correct behavior until the breakages have been fixed while
2840
+ * ensuring that newly-written diagnostics are correct from the beginning.
2841
+ * TODO(crisbeto): remove this flag and fix the internal brekages.
2842
+ */
2600
2843
  canVisitStructuralAttributes = true;
2844
+ /**
2845
+ * Base implementation for run function, visits all nodes in template and calls
2846
+ * `visitNode()` for each one.
2847
+ */
2601
2848
  run(ctx, component, template) {
2602
2849
  const visitor = new TemplateVisitor2(ctx, component, this);
2603
2850
  return visitor.getDiagnostics(template);
@@ -2640,7 +2887,7 @@ var TemplateVisitor2 = class extends CombinedRecursiveAstVisitor2 {
2640
2887
  }
2641
2888
  };
2642
2889
 
2643
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
2890
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
2644
2891
  var SIGNAL_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["set", "update", "asReadonly"]);
2645
2892
  var FUNCTION_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["name", "length", "prototype"]);
2646
2893
  var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
@@ -2654,7 +2901,15 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
2654
2901
  return [];
2655
2902
  }
2656
2903
  const nodeAst = isPropertyReadNodeAst(node);
2657
- if ((node.type === BindingType.Property || node.type === BindingType.Class || node.type === BindingType.Style || node.type === BindingType.Attribute || node.type === BindingType.LegacyAnimation) && nodeAst) {
2904
+ if (
2905
+ // a bound property like `[prop]="mySignal"`
2906
+ (node.type === BindingType.Property || // or a class binding like `[class.myClass]="mySignal"`
2907
+ node.type === BindingType.Class || // or a style binding like `[style.width]="mySignal"`
2908
+ node.type === BindingType.Style || // or an attribute binding like `[attr.role]="mySignal"`
2909
+ node.type === BindingType.Attribute || // or an animation binding like `[animate.enter]="mySignal"`
2910
+ node.type === BindingType.Animation || // or an animation binding like `[@myAnimation]="mySignal"`
2911
+ node.type === BindingType.LegacyAnimation) && nodeAst
2912
+ ) {
2658
2913
  return buildDiagnosticForSignal(ctx, nodeAst, component);
2659
2914
  }
2660
2915
  }
@@ -2702,7 +2957,7 @@ var factory = {
2702
2957
  create: () => new InterpolatedSignalCheck()
2703
2958
  };
2704
2959
 
2705
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.js
2960
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.js
2706
2961
  import { TmplAstBoundEvent } from "@angular/compiler";
2707
2962
  var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
2708
2963
  code = ErrorCode.INVALID_BANANA_IN_BOX;
@@ -2725,7 +2980,7 @@ var factory2 = {
2725
2980
  create: () => new InvalidBananaInBoxCheck()
2726
2981
  };
2727
2982
 
2728
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.js
2983
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.js
2729
2984
  import { TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
2730
2985
  var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
2731
2986
  ["ngIf", { directive: "NgIf", builtIn: "@if" }],
@@ -2767,7 +3022,7 @@ var factory3 = {
2767
3022
  }
2768
3023
  };
2769
3024
 
2770
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.js
3025
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.js
2771
3026
  import { TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
2772
3027
  var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
2773
3028
  code = ErrorCode.MISSING_NGFOROF_LET;
@@ -2797,7 +3052,7 @@ var factory4 = {
2797
3052
  create: () => new MissingNgForOfLetCheck()
2798
3053
  };
2799
3054
 
2800
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_structural_directive/index.js
3055
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_structural_directive/index.js
2801
3056
  import { TmplAstTemplate as TmplAstTemplate4 } from "@angular/compiler";
2802
3057
  var KNOWN_CONTROL_FLOW_DIRECTIVES2 = /* @__PURE__ */ new Set([
2803
3058
  "ngIf",
@@ -2837,7 +3092,7 @@ var factory5 = {
2837
3092
  create: () => new MissingStructuralDirectiveCheck()
2838
3093
  };
2839
3094
 
2840
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
3095
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
2841
3096
  import { Binary } from "@angular/compiler";
2842
3097
  import ts19 from "typescript";
2843
3098
  var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
@@ -2880,7 +3135,7 @@ var factory6 = {
2880
3135
  }
2881
3136
  };
2882
3137
 
2883
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
3138
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
2884
3139
  import { SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
2885
3140
  import ts20 from "typescript";
2886
3141
  var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
@@ -2924,7 +3179,7 @@ var factory7 = {
2924
3179
  }
2925
3180
  };
2926
3181
 
2927
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/skip_hydration_not_static/index.js
3182
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/skip_hydration_not_static/index.js
2928
3183
  import { TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstTextAttribute } from "@angular/compiler";
2929
3184
  var NG_SKIP_HYDRATION_ATTR_NAME = "ngSkipHydration";
2930
3185
  var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
@@ -2935,7 +3190,11 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
2935
3190
  const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
2936
3191
  return [diagnostic];
2937
3192
  }
2938
- const acceptedValues = ["true", ""];
3193
+ const acceptedValues = [
3194
+ "true",
3195
+ ""
3196
+ /* empty string */
3197
+ ];
2939
3198
  if (node instanceof TmplAstTextAttribute && node.name === NG_SKIP_HYDRATION_ATTR_NAME && !acceptedValues.includes(node.value) && node.value !== void 0) {
2940
3199
  const errorString = `ngSkipHydration only accepts "true" or "" as value or no value at all. For example 'ngSkipHydration="true"' or 'ngSkipHydration'`;
2941
3200
  const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
@@ -2950,7 +3209,7 @@ var factory8 = {
2950
3209
  create: () => new NgSkipHydrationSpec()
2951
3210
  };
2952
3211
 
2953
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.js
3212
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.js
2954
3213
  import { TmplAstBoundAttribute as TmplAstBoundAttribute3 } from "@angular/compiler";
2955
3214
  var STYLE_SUFFIXES = ["px", "%", "em"];
2956
3215
  var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
@@ -2971,7 +3230,7 @@ var factory9 = {
2971
3230
  create: () => new SuffixNotSupportedCheck()
2972
3231
  };
2973
3232
 
2974
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.js
3233
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.js
2975
3234
  import { TmplAstTextAttribute as TmplAstTextAttribute2 } from "@angular/compiler";
2976
3235
  var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
2977
3236
  code = ErrorCode.TEXT_ATTRIBUTE_NOT_BINDING;
@@ -2991,7 +3250,11 @@ var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
2991
3250
  }
2992
3251
  } else {
2993
3252
  const expectedKey = `[${name}]`;
2994
- const expectedValue = node.value === "true" || node.value === "false" ? node.value : `'${node.value}'`;
3253
+ const expectedValue = (
3254
+ // true/false are special cases because we don't want to convert them to strings but
3255
+ // rather maintain the logical true/false when bound.
3256
+ node.value === "true" || node.value === "false" ? node.value : `'${node.value}'`
3257
+ );
2995
3258
  errorString = "Attribute, style, and class bindings should be enclosed with square braces.";
2996
3259
  if (node.value) {
2997
3260
  errorString += ` For example, '${expectedKey}="${expectedValue}"'.`;
@@ -3007,7 +3270,7 @@ var factory10 = {
3007
3270
  create: () => new TextAttributeNotBindingSpec()
3008
3271
  };
3009
3272
 
3010
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_event_binding/index.js
3273
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_event_binding/index.js
3011
3274
  import { ASTWithSource as ASTWithSource3, Call, Chain, Conditional, ParsedEventType, PropertyRead as PropertyRead3, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead2, TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
3012
3275
  var UninvokedFunctionInEventBindingSpec = class extends TemplateCheckWithVisitor {
3013
3276
  code = ErrorCode.UNINVOKED_FUNCTION_IN_EVENT_BINDING;
@@ -3055,7 +3318,7 @@ var factory11 = {
3055
3318
  create: () => new UninvokedFunctionInEventBindingSpec()
3056
3319
  };
3057
3320
 
3058
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unparenthesized_nullish_coalescing/index.js
3321
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unparenthesized_nullish_coalescing/index.js
3059
3322
  import { Binary as Binary2 } from "@angular/compiler";
3060
3323
  var UnparenthesizedNullishCoalescing = class extends TemplateCheckWithVisitor {
3061
3324
  code = ErrorCode.UNPARENTHESIZED_NULLISH_COALESCING;
@@ -3085,7 +3348,7 @@ var factory12 = {
3085
3348
  create: () => new UnparenthesizedNullishCoalescing()
3086
3349
  };
3087
3350
 
3088
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.js
3351
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.js
3089
3352
  import { AST, ASTWithSource as ASTWithSource4, TmplAstLetDeclaration } from "@angular/compiler";
3090
3353
  var UnusedLetDeclarationCheck = class extends TemplateCheckWithVisitor {
3091
3354
  code = ErrorCode.UNUSED_LET_DECLARATION;
@@ -3127,7 +3390,7 @@ var factory13 = {
3127
3390
  create: () => new UnusedLetDeclarationCheck()
3128
3391
  };
3129
3392
 
3130
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_track_function/index.js
3393
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_track_function/index.js
3131
3394
  import { Call as Call2, PropertyRead as PropertyRead4, SafeCall as SafeCall3, SafePropertyRead as SafePropertyRead3, TmplAstForLoopBlock } from "@angular/compiler";
3132
3395
  var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
3133
3396
  code = ErrorCode.UNINVOKED_TRACK_FUNCTION;
@@ -3159,10 +3422,45 @@ var factory14 = {
3159
3422
  create: () => new UninvokedTrackFunctionCheck()
3160
3423
  };
3161
3424
 
3162
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3425
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_text_interpolation/index.js
3426
+ import { Interpolation as Interpolation2, PropertyRead as PropertyRead5, SafePropertyRead as SafePropertyRead4 } from "@angular/compiler";
3427
+ var UninvokedFunctionInTextInterpolation = class extends TemplateCheckWithVisitor {
3428
+ code = ErrorCode.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION;
3429
+ visitNode(ctx, component, node) {
3430
+ if (node instanceof Interpolation2) {
3431
+ return node.expressions.flatMap((item) => assertExpressionInvoked2(item, component, node.sourceSpan, ctx));
3432
+ }
3433
+ return [];
3434
+ }
3435
+ };
3436
+ function assertExpressionInvoked2(expression, component, sourceSpan, ctx) {
3437
+ if (!(expression instanceof PropertyRead5) && !(expression instanceof SafePropertyRead4)) {
3438
+ return [];
3439
+ }
3440
+ const symbol = ctx.templateTypeChecker.getSymbolOfNode(expression, component);
3441
+ if (symbol !== null && symbol.kind === SymbolKind.Expression) {
3442
+ if (symbol.tsType.getCallSignatures()?.length > 0) {
3443
+ const fullExpressionText = generateStringFromExpression3(expression, sourceSpan.toString());
3444
+ const errorString = `Function in text interpolation should be invoked: ${fullExpressionText}()`;
3445
+ const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbol.tcbLocation);
3446
+ return [ctx.makeTemplateDiagnostic(templateMapping.span, errorString)];
3447
+ }
3448
+ }
3449
+ return [];
3450
+ }
3451
+ function generateStringFromExpression3(expression, source) {
3452
+ return source.substring(expression.span.start, expression.span.end);
3453
+ }
3454
+ var factory15 = {
3455
+ code: ErrorCode.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION,
3456
+ name: ExtendedTemplateDiagnosticName.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION,
3457
+ create: () => new UninvokedFunctionInTextInterpolation()
3458
+ };
3459
+
3460
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3163
3461
  import ts21 from "typescript";
3164
3462
 
3165
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
3463
+ // packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
3166
3464
  var DiagnosticCategoryLabel;
3167
3465
  (function(DiagnosticCategoryLabel2) {
3168
3466
  DiagnosticCategoryLabel2["Warning"] = "warning";
@@ -3170,19 +3468,19 @@ var DiagnosticCategoryLabel;
3170
3468
  DiagnosticCategoryLabel2["Suppress"] = "suppress";
3171
3469
  })(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
3172
3470
 
3173
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3471
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3174
3472
  var ExtendedTemplateCheckerImpl = class {
3175
3473
  partialCtx;
3176
3474
  templateChecks;
3177
3475
  constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
3178
3476
  this.partialCtx = { templateTypeChecker, typeChecker };
3179
3477
  this.templateChecks = /* @__PURE__ */ new Map();
3180
- for (const factory15 of templateCheckFactories) {
3181
- const category = diagnosticLabelToCategory(options?.extendedDiagnostics?.checks?.[factory15.name] ?? options?.extendedDiagnostics?.defaultCategory ?? DiagnosticCategoryLabel.Warning);
3478
+ for (const factory16 of templateCheckFactories) {
3479
+ const category = diagnosticLabelToCategory(options?.extendedDiagnostics?.checks?.[factory16.name] ?? options?.extendedDiagnostics?.defaultCategory ?? DiagnosticCategoryLabel.Warning);
3182
3480
  if (category === null) {
3183
3481
  continue;
3184
3482
  }
3185
- const check = factory15.create(options);
3483
+ const check = factory16.create(options);
3186
3484
  if (check === null) {
3187
3485
  continue;
3188
3486
  }
@@ -3198,6 +3496,8 @@ var ExtendedTemplateCheckerImpl = class {
3198
3496
  for (const [check, category] of this.templateChecks.entries()) {
3199
3497
  const ctx = {
3200
3498
  ...this.partialCtx,
3499
+ // Wrap `templateTypeChecker.makeTemplateDiagnostic()` to implicitly provide all the known
3500
+ // options.
3201
3501
  makeTemplateDiagnostic: (span, message, relatedInformation) => {
3202
3502
  return this.partialCtx.templateTypeChecker.makeTemplateDiagnostic(component, span, category, check.code, message, relatedInformation);
3203
3503
  }
@@ -3224,7 +3524,7 @@ function assertNever(value) {
3224
3524
  ${value}`);
3225
3525
  }
3226
3526
 
3227
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.js
3527
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/index.js
3228
3528
  var ALL_DIAGNOSTIC_FACTORIES = [
3229
3529
  factory2,
3230
3530
  factory6,
@@ -3239,16 +3539,17 @@ var ALL_DIAGNOSTIC_FACTORIES = [
3239
3539
  factory13,
3240
3540
  factory8,
3241
3541
  factory12,
3242
- factory14
3542
+ factory14,
3543
+ factory15
3243
3544
  ];
3244
3545
  var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
3245
3546
  ExtendedTemplateDiagnosticName.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION,
3246
3547
  ExtendedTemplateDiagnosticName.UNUSED_STANDALONE_IMPORTS,
3247
- ...ALL_DIAGNOSTIC_FACTORIES.map((factory15) => factory15.name)
3548
+ ...ALL_DIAGNOSTIC_FACTORIES.map((factory16) => factory16.name)
3248
3549
  ]);
3249
3550
 
3250
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
3251
- import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead5, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
3551
+ // packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
3552
+ import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead6, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
3252
3553
  import ts22 from "typescript";
3253
3554
  var TemplateSemanticsCheckerImpl = class {
3254
3555
  templateTypeChecker;
@@ -3260,7 +3561,7 @@ var TemplateSemanticsCheckerImpl = class {
3260
3561
  return template !== null ? TemplateSemanticsVisitor.visit(template, component, this.templateTypeChecker) : [];
3261
3562
  }
3262
3563
  };
3263
- var TemplateSemanticsVisitor = class extends TmplAstRecursiveVisitor {
3564
+ var TemplateSemanticsVisitor = class _TemplateSemanticsVisitor extends TmplAstRecursiveVisitor {
3264
3565
  expressionVisitor;
3265
3566
  constructor(expressionVisitor) {
3266
3567
  super();
@@ -3269,7 +3570,7 @@ var TemplateSemanticsVisitor = class extends TmplAstRecursiveVisitor {
3269
3570
  static visit(nodes, component, templateTypeChecker) {
3270
3571
  const diagnostics = [];
3271
3572
  const expressionVisitor = new ExpressionsSemanticsVisitor(templateTypeChecker, component, diagnostics);
3272
- const templateVisitor = new TemplateSemanticsVisitor(expressionVisitor);
3573
+ const templateVisitor = new _TemplateSemanticsVisitor(expressionVisitor);
3273
3574
  nodes.forEach((node) => node.visit(templateVisitor));
3274
3575
  return diagnostics;
3275
3576
  }
@@ -3289,7 +3590,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
3289
3590
  this.diagnostics = diagnostics;
3290
3591
  }
3291
3592
  visitBinary(ast, context) {
3292
- if (Binary3.isAssignmentOperation(ast.operation) && ast.left instanceof PropertyRead5) {
3593
+ if (Binary3.isAssignmentOperation(ast.operation) && ast.left instanceof PropertyRead6) {
3293
3594
  this.checkForIllegalWriteInEventBinding(ast.left, context);
3294
3595
  } else {
3295
3596
  super.visitBinary(ast, context);
@@ -3346,7 +3647,7 @@ function unwrapAstWithSource(ast) {
3346
3647
  return ast instanceof ASTWithSource5 ? ast.ast : ast;
3347
3648
  }
3348
3649
 
3349
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
3650
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
3350
3651
  import ts23 from "typescript";
3351
3652
  var APIS_TO_CHECK = [
3352
3653
  INPUT_INITIALIZER_FN,
@@ -3398,7 +3699,7 @@ var InitializerApiUsageRule = class {
3398
3699
  }
3399
3700
  };
3400
3701
 
3401
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
3702
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
3402
3703
  import ts24 from "typescript";
3403
3704
  var UnusedStandaloneImportsRule = class {
3404
3705
  templateTypeChecker;
@@ -3463,6 +3764,11 @@ var UnusedStandaloneImportsRule = class {
3463
3764
  }
3464
3765
  return unused;
3465
3766
  }
3767
+ /**
3768
+ * Determines if an import reference *might* be coming from a shared imports array.
3769
+ * @param reference Reference to be checked.
3770
+ * @param rawImports AST node that defines the `imports` array.
3771
+ */
3466
3772
  isPotentialSharedReference(reference, rawImports) {
3467
3773
  if (reference.getIdentityInExpression(rawImports) !== null) {
3468
3774
  return false;
@@ -3489,13 +3795,17 @@ function closestNode(start, predicate) {
3489
3795
  return null;
3490
3796
  }
3491
3797
 
3492
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3798
+ // packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3493
3799
  var SourceFileValidator = class {
3494
3800
  rules;
3495
3801
  constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
3496
3802
  this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
3497
3803
  this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
3498
3804
  }
3805
+ /**
3806
+ * Gets the diagnostics for a specific file, or null if the file is valid.
3807
+ * @param sourceFile File to be checked.
3808
+ */
3499
3809
  getDiagnosticsForFile(sourceFile) {
3500
3810
  if (sourceFile.isDeclarationFile || sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
3501
3811
  return null;
@@ -3529,7 +3839,7 @@ var SourceFileValidator = class {
3529
3839
  }
3530
3840
  };
3531
3841
 
3532
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/feature_detection.js
3842
+ // packages/compiler-cli/src/ngtsc/core/src/feature_detection.js
3533
3843
  import semver from "semver";
3534
3844
  function coreVersionSupportsFeature(coreVersion, minVersion) {
3535
3845
  if (coreVersion === `0.0.0-${"PLACEHOLDER"}`) {
@@ -3538,7 +3848,7 @@ function coreVersionSupportsFeature(coreVersion, minVersion) {
3538
3848
  return semver.satisfies(coreVersion, minVersion, { includePrerelease: true });
3539
3849
  }
3540
3850
 
3541
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.js
3851
+ // packages/compiler-cli/src/ngtsc/core/src/compiler.js
3542
3852
  var CompilationTicketKind;
3543
3853
  (function(CompilationTicketKind2) {
3544
3854
  CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
@@ -3596,7 +3906,7 @@ function incrementalFromStateTicket(oldProgram, oldState, newProgram, options, i
3596
3906
  perfRecorder
3597
3907
  };
3598
3908
  }
3599
- var NgCompiler = class {
3909
+ var NgCompiler = class _NgCompiler {
3600
3910
  adapter;
3601
3911
  options;
3602
3912
  inputProgram;
@@ -3605,8 +3915,24 @@ var NgCompiler = class {
3605
3915
  incrementalCompilation;
3606
3916
  usePoisonedData;
3607
3917
  livePerfRecorder;
3918
+ /**
3919
+ * Lazily evaluated state of the compilation.
3920
+ *
3921
+ * This is created on demand by calling `ensureAnalyzed`.
3922
+ */
3608
3923
  compilation = null;
3924
+ /**
3925
+ * Any diagnostics related to the construction of the compilation.
3926
+ *
3927
+ * These are diagnostics which arose during setup of the host and/or program.
3928
+ */
3609
3929
  constructionDiagnostics = [];
3930
+ /**
3931
+ * Non-template diagnostics related to the program itself. Does not include template
3932
+ * diagnostics because the template type checker memoizes them itself.
3933
+ *
3934
+ * This is set by (and memoizes) `getNonTemplateDiagnostics`.
3935
+ */
3610
3936
  nonTemplateDiagnostics = null;
3611
3937
  closureCompilerEnabled;
3612
3938
  currentProgram;
@@ -3624,13 +3950,27 @@ var NgCompiler = class {
3624
3950
  implicitStandaloneValue;
3625
3951
  enableSelectorless;
3626
3952
  emitDeclarationOnly;
3953
+ /**
3954
+ * `NgCompiler` can be reused for multiple compilations (for resource-only changes), and each
3955
+ * new compilation uses a fresh `PerfRecorder`. Thus, classes created with a lifespan of the
3956
+ * `NgCompiler` use a `DelegatingPerfRecorder` so the `PerfRecorder` they write to can be updated
3957
+ * with each fresh compilation.
3958
+ */
3627
3959
  delegatingPerfRecorder;
3960
+ /**
3961
+ * Convert a `CompilationTicket` into an `NgCompiler` instance for the requested compilation.
3962
+ *
3963
+ * Depending on the nature of the compilation request, the `NgCompiler` instance may be reused
3964
+ * from a previous compilation and updated with any changes, it may be a new instance which
3965
+ * incrementally reuses state from a previous compilation, or it may represent a fresh
3966
+ * compilation entirely.
3967
+ */
3628
3968
  static fromTicket(ticket, adapter) {
3629
3969
  switch (ticket.kind) {
3630
3970
  case CompilationTicketKind.Fresh:
3631
- return new NgCompiler(adapter, ticket.options, ticket.tsProgram, ticket.programDriver, ticket.incrementalBuildStrategy, IncrementalCompilation.fresh(ticket.tsProgram, versionMapFromProgram(ticket.tsProgram, ticket.programDriver)), ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3971
+ return new _NgCompiler(adapter, ticket.options, ticket.tsProgram, ticket.programDriver, ticket.incrementalBuildStrategy, IncrementalCompilation.fresh(ticket.tsProgram, versionMapFromProgram(ticket.tsProgram, ticket.programDriver)), ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3632
3972
  case CompilationTicketKind.IncrementalTypeScript:
3633
- return new NgCompiler(adapter, ticket.options, ticket.newProgram, ticket.programDriver, ticket.incrementalBuildStrategy, ticket.incrementalCompilation, ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3973
+ return new _NgCompiler(adapter, ticket.options, ticket.newProgram, ticket.programDriver, ticket.incrementalBuildStrategy, ticket.incrementalCompilation, ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3634
3974
  case CompilationTicketKind.IncrementalResource:
3635
3975
  const compiler = ticket.compiler;
3636
3976
  compiler.updateWithChangedResources(ticket.modifiedResourceFiles, ticket.perfRecorder);
@@ -3662,6 +4002,10 @@ var NgCompiler = class {
3662
4002
  this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
3663
4003
  const moduleResolutionCache = ts25.createModuleResolutionCache(
3664
4004
  this.adapter.getCurrentDirectory(),
4005
+ // doen't retain a reference to `this`, if other closures in the constructor here reference
4006
+ // `this` internally then a closure created here would retain them. This can cause major
4007
+ // memory leak issues since the `moduleResolutionCache` is a long-lived object and finds its
4008
+ // way into all kinds of places inside TS internal objects.
3665
4009
  this.adapter.getCanonicalFileName.bind(this.adapter)
3666
4010
  );
3667
4011
  this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
@@ -3711,10 +4055,18 @@ var NgCompiler = class {
3711
4055
  }
3712
4056
  });
3713
4057
  }
4058
+ /**
4059
+ * Get the resource dependencies of a file.
4060
+ *
4061
+ * If the file is not part of the compilation, an empty array will be returned.
4062
+ */
3714
4063
  getResourceDependencies(file) {
3715
4064
  this.ensureAnalyzed();
3716
4065
  return this.incrementalCompilation.depGraph.getResourceDependencies(file);
3717
4066
  }
4067
+ /**
4068
+ * Get all Angular-related diagnostics for this compilation.
4069
+ */
3718
4070
  getDiagnostics() {
3719
4071
  const diagnostics = [...this.getNonTemplateDiagnostics()];
3720
4072
  try {
@@ -3727,6 +4079,11 @@ var NgCompiler = class {
3727
4079
  }
3728
4080
  return this.addMessageTextDetails(diagnostics);
3729
4081
  }
4082
+ /**
4083
+ * Get all Angular-related diagnostics for this compilation.
4084
+ *
4085
+ * If a `ts.SourceFile` is passed, only diagnostics related to that file are returned.
4086
+ */
3730
4087
  getDiagnosticsForFile(file, optimizeFor) {
3731
4088
  const diagnostics = [
3732
4089
  ...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file)
@@ -3741,6 +4098,9 @@ var NgCompiler = class {
3741
4098
  }
3742
4099
  return this.addMessageTextDetails(diagnostics);
3743
4100
  }
4101
+ /**
4102
+ * Get all `ts.Diagnostic`s currently available that pertain to the given component.
4103
+ */
3744
4104
  getDiagnosticsForComponent(component) {
3745
4105
  const compilation = this.ensureAnalyzed();
3746
4106
  const ttc = compilation.templateTypeChecker;
@@ -3762,6 +4122,9 @@ var NgCompiler = class {
3762
4122
  }
3763
4123
  return this.addMessageTextDetails(diagnostics);
3764
4124
  }
4125
+ /**
4126
+ * Add Angular.io error guide links to diagnostics for this compilation.
4127
+ */
3765
4128
  addMessageTextDetails(diagnostics) {
3766
4129
  return diagnostics.map((diag) => {
3767
4130
  if (diag.code && COMPILER_ERRORS_WITH_GUIDES.has(ngErrorCode(diag.code))) {
@@ -3773,9 +4136,27 @@ var NgCompiler = class {
3773
4136
  return diag;
3774
4137
  });
3775
4138
  }
4139
+ /**
4140
+ * Get all setup-related diagnostics for this compilation.
4141
+ */
3776
4142
  getOptionDiagnostics() {
3777
4143
  return this.constructionDiagnostics;
3778
4144
  }
4145
+ /**
4146
+ * Get the current `ts.Program` known to this `NgCompiler`.
4147
+ *
4148
+ * Compilation begins with an input `ts.Program`, and during template type-checking operations new
4149
+ * `ts.Program`s may be produced using the `ProgramDriver`. The most recent such `ts.Program` to
4150
+ * be produced is available here.
4151
+ *
4152
+ * This `ts.Program` serves two key purposes:
4153
+ *
4154
+ * * As an incremental starting point for creating the next `ts.Program` based on files that the
4155
+ * user has changed (for clients using the TS compiler program APIs).
4156
+ *
4157
+ * * As the "before" point for an incremental compilation invocation, to determine what's changed
4158
+ * between the old and new programs (for all compilations).
4159
+ */
3779
4160
  getCurrentProgram() {
3780
4161
  return this.currentProgram;
3781
4162
  }
@@ -3785,14 +4166,23 @@ var NgCompiler = class {
3785
4166
  }
3786
4167
  return this.ensureAnalyzed().templateTypeChecker;
3787
4168
  }
4169
+ /**
4170
+ * Retrieves the `ts.Declaration`s for any component(s) which use the given template file.
4171
+ */
3788
4172
  getComponentsWithTemplateFile(templateFilePath) {
3789
4173
  const { resourceRegistry } = this.ensureAnalyzed();
3790
4174
  return resourceRegistry.getComponentsWithTemplate(resolve(templateFilePath));
3791
4175
  }
4176
+ /**
4177
+ * Retrieves the `ts.Declaration`s for any component(s) which use the given template file.
4178
+ */
3792
4179
  getComponentsWithStyleFile(styleFilePath) {
3793
4180
  const { resourceRegistry } = this.ensureAnalyzed();
3794
4181
  return resourceRegistry.getComponentsWithStyle(resolve(styleFilePath));
3795
4182
  }
4183
+ /**
4184
+ * Retrieves external resources for the given directive.
4185
+ */
3796
4186
  getDirectiveResources(classDecl) {
3797
4187
  if (!isNamedClassDeclaration(classDecl)) {
3798
4188
  return null;
@@ -3815,6 +4205,15 @@ var NgCompiler = class {
3815
4205
  }
3816
4206
  return meta;
3817
4207
  }
4208
+ /**
4209
+ * Perform Angular's analysis step (as a precursor to `getDiagnostics` or `prepareEmit`)
4210
+ * asynchronously.
4211
+ *
4212
+ * Normally, this operation happens lazily whenever `getDiagnostics` or `prepareEmit` are called.
4213
+ * However, certain consumers may wish to allow for an asynchronous phase of analysis, where
4214
+ * resources such as `styleUrls` are resolved asynchronously. In these cases `analyzeAsync` must
4215
+ * be called first, and its `Promise` awaited prior to calling any other APIs of `NgCompiler`.
4216
+ */
3818
4217
  async analyzeAsync() {
3819
4218
  if (this.compilation !== null) {
3820
4219
  return;
@@ -3836,6 +4235,10 @@ var NgCompiler = class {
3836
4235
  this.resolveCompilation(this.compilation.traitCompiler);
3837
4236
  });
3838
4237
  }
4238
+ /**
4239
+ * Fetch transformers and other information which is necessary for a consumer to `emit` the
4240
+ * program with Angular-added definitions.
4241
+ */
3839
4242
  prepareEmit() {
3840
4243
  const compilation = this.ensureAnalyzed();
3841
4244
  untagAllTsFiles(this.inputProgram);
@@ -3884,12 +4287,27 @@ var NgCompiler = class {
3884
4287
  }
3885
4288
  return { transformers: { before, afterDeclarations } };
3886
4289
  }
4290
+ /**
4291
+ * Run the indexing process and return a `Map` of all indexed components.
4292
+ *
4293
+ * See the `indexing` package for more details.
4294
+ */
3887
4295
  getIndexedComponents() {
3888
4296
  const compilation = this.ensureAnalyzed();
3889
4297
  const context = new IndexingContext();
3890
4298
  compilation.traitCompiler.index(context);
3891
4299
  return generateAnalysis(context);
3892
4300
  }
4301
+ /**
4302
+ * Gets information for the current program that may be used to generate API
4303
+ * reference documentation. This includes Angular-specific information, such
4304
+ * as component inputs and outputs.
4305
+ *
4306
+ * @param entryPoint Path to the entry point for the package for which API
4307
+ * docs should be extracted.
4308
+ *
4309
+ * @returns A map of symbols with their associated module, eg: ApplicationRef => @angular/core
4310
+ */
3893
4311
  getApiDocumentation(entryPoint, privateModules) {
3894
4312
  const compilation = this.ensureAnalyzed();
3895
4313
  const checker = this.inputProgram.getTypeChecker();
@@ -3903,10 +4321,17 @@ var NgCompiler = class {
3903
4321
  const rootDir = this.inputProgram.getCurrentDirectory();
3904
4322
  return docsExtractor.extractAll(entryPointSourceFile, rootDir, privateModules);
3905
4323
  }
4324
+ /**
4325
+ * Collect i18n messages into the `Xi18nContext`.
4326
+ */
3906
4327
  xi18n(ctx) {
3907
4328
  const compilation = this.ensureAnalyzed();
3908
4329
  compilation.traitCompiler.xi18n(ctx);
3909
4330
  }
4331
+ /**
4332
+ * Emits the JavaScript module that can be used to replace the metadata of a class during HMR.
4333
+ * @param node Class for which to generate the update module.
4334
+ */
3910
4335
  emitHmrUpdateModule(node) {
3911
4336
  const { traitCompiler, reflector } = this.ensureAnalyzed();
3912
4337
  if (!reflector.isClass(node)) {
@@ -3922,6 +4347,9 @@ var NgCompiler = class {
3922
4347
  return ts25.transpileModule(nodeText, {
3923
4348
  compilerOptions: {
3924
4349
  ...this.options,
4350
+ // Some module types can produce additional code (see #60795) whereas we need the
4351
+ // HMR update module to use a native `export`. Override the `target` and `module`
4352
+ // to ensure that it looks as expected.
3925
4353
  module: ts25.ModuleKind.ES2022,
3926
4354
  target: ts25.ScriptTarget.ES2022
3927
4355
  },
@@ -3976,18 +4404,28 @@ var NgCompiler = class {
3976
4404
  checkControlFlowBodies: true,
3977
4405
  strictNullInputBindings: strictTemplates,
3978
4406
  checkTypeOfAttributes: strictTemplates,
4407
+ // Even in full template type-checking mode, DOM binding checks are not quite ready yet.
3979
4408
  checkTypeOfDomBindings: false,
3980
4409
  checkTypeOfOutputEvents: strictTemplates,
3981
4410
  checkTypeOfAnimationEvents: strictTemplates,
4411
+ // Checking of DOM events currently has an adverse effect on developer experience,
4412
+ // e.g. for `<input (blur)="update($event.target.value)">` enabling this check results in:
4413
+ // - error TS2531: Object is possibly 'null'.
4414
+ // - error TS2339: Property 'value' does not exist on type 'EventTarget'.
3982
4415
  checkTypeOfDomEvents: strictTemplates,
3983
4416
  checkTypeOfDomReferences: strictTemplates,
4417
+ // Non-DOM references have the correct type in View Engine so there is no strictness flag.
3984
4418
  checkTypeOfNonDomReferences: true,
4419
+ // Pipes are checked in View Engine so there is no strictness flag.
3985
4420
  checkTypeOfPipes: true,
3986
4421
  strictSafeNavigationTypes: strictTemplates,
3987
4422
  useContextGenericType: strictTemplates,
3988
4423
  strictLiteralTypes: true,
3989
4424
  enableTemplateTypeChecker: this.enableTemplateTypeChecker,
3990
4425
  useInlineTypeConstructors,
4426
+ // Warnings for suboptimal type inference are only enabled if in Language Service mode
4427
+ // (providing the full TemplateTypeChecker API) and if strict mode is not enabled. In strict
4428
+ // mode, the user is in full control of type inference.
3991
4429
  suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates,
3992
4430
  controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
3993
4431
  unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
@@ -4000,6 +4438,8 @@ var NgCompiler = class {
4000
4438
  checkQueries: false,
4001
4439
  checkTemplateBodies: false,
4002
4440
  checkControlFlowBodies: false,
4441
+ // Enable deep schema checking in "basic" template type-checking mode only if Closure
4442
+ // compilation is requested, which is a good proxy for "only in google3".
4003
4443
  alwaysCheckSchemaInTemplateBodies: this.closureCompilerEnabled,
4004
4444
  checkTypeOfInputBindings: false,
4005
4445
  strictNullInputBindings: false,
@@ -4017,6 +4457,8 @@ var NgCompiler = class {
4017
4457
  strictLiteralTypes: false,
4018
4458
  enableTemplateTypeChecker: this.enableTemplateTypeChecker,
4019
4459
  useInlineTypeConstructors,
4460
+ // In "basic" template type-checking mode, no warnings are produced since most things are
4461
+ // not checked anyways.
4020
4462
  suggestionsForSuboptimalTypeInference: false,
4021
4463
  controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
4022
4464
  unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
@@ -4155,8 +4597,13 @@ var NgCompiler = class {
4155
4597
  localImportStrategy = new RelativePathStrategy(reflector);
4156
4598
  }
4157
4599
  refEmitter = new ReferenceEmitter([
4600
+ // First, try to use local identifiers if available.
4158
4601
  new LocalIdentifierStrategy(),
4602
+ // Next, attempt to use an absolute import.
4159
4603
  new AbsoluteModuleStrategy(this.inputProgram, checker, this.moduleResolver, reflector),
4604
+ // Finally, check if the reference is being written into a file within the project's .ts
4605
+ // sources, and use a relative import if so. If this fails, ReferenceEmitter will throw
4606
+ // an error.
4160
4607
  localImportStrategy
4161
4608
  ]);
4162
4609
  if (this.entryPoint === null && this.options.generateDeepReexports === true) {
@@ -4164,8 +4611,11 @@ var NgCompiler = class {
4164
4611
  }
4165
4612
  } else {
4166
4613
  refEmitter = new ReferenceEmitter([
4614
+ // First, try to use local identifiers if available.
4167
4615
  new LocalIdentifierStrategy(),
4616
+ // Then use aliased references (this is a workaround to StrictDeps checks).
4168
4617
  ...this.options["_useHostForImportAndAliasGeneration"] ? [new AliasStrategy()] : [],
4618
+ // Then use fileNameToModuleName to emit imports.
4169
4619
  new UnifiedModulesStrategy(reflector, this.adapter.unifiedModulesHost)
4170
4620
  ]);
4171
4621
  if (this.options["_useHostForImportAndAliasGeneration"]) {
@@ -4227,7 +4677,11 @@ var NgCompiler = class {
4227
4677
  const jitDeclarationRegistry = new JitDeclarationRegistry();
4228
4678
  const handlers = [
4229
4679
  new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, this.adapter, 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, externalRuntimeStyles, localCompilationExtraImportsTracker, jitDeclarationRegistry, this.options.i18nPreserveWhitespaceForLegacyExtraction ?? true, !!this.options.strictStandalone, this.enableHmr, this.implicitStandaloneValue, typeCheckHostBindings, this.enableSelectorless, this.emitDeclarationOnly),
4680
+ // TODO(alxhub): understand why the cast here is necessary (something to do with `null`
4681
+ // not being assignable to `unknown` when wrapped in `Readonly`).
4230
4682
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, typeCheckScopeRegistry, compilationMode, jitDeclarationRegistry, resourceRegistry, !!this.options.strictStandalone, this.implicitStandaloneValue, this.usePoisonedData, typeCheckHostBindings, this.emitDeclarationOnly),
4683
+ // Pipe handler must be before injectable handler in list so pipe factories are printed
4684
+ // before injectable factories (so injectable factories can delegate to them)
4231
4685
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode, !!this.options.strictStandalone, this.implicitStandaloneValue),
4232
4686
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
4233
4687
  new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, this.options.onlyPublishPublicTypingsForNgModules ?? false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode, localCompilationExtraImportsTracker, jitDeclarationRegistry, this.emitDeclarationOnly)
@@ -4426,7 +4880,7 @@ function versionMapFromProgram(program, driver) {
4426
4880
  return versions;
4427
4881
  }
4428
4882
 
4429
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.js
4883
+ // packages/compiler-cli/src/ngtsc/core/src/host.js
4430
4884
  import ts26 from "typescript";
4431
4885
  var DelegatingCompilerHost = class {
4432
4886
  delegate;
@@ -4459,6 +4913,8 @@ var DelegatingCompilerHost = class {
4459
4913
  hasInvalidatedResolutions;
4460
4914
  resolveModuleNameLiterals;
4461
4915
  resolveTypeReferenceDirectiveReferences;
4916
+ // jsDocParsingMode is not a method like the other elements above
4917
+ // TODO: ignore usage can be dropped once 5.2 support is dropped
4462
4918
  get jsDocParsingMode() {
4463
4919
  return this.delegate.jsDocParsingMode;
4464
4920
  }
@@ -4501,7 +4957,7 @@ var DelegatingCompilerHost = class {
4501
4957
  return this.delegate[name] !== void 0 ? this.delegate[name].bind(this.delegate) : void 0;
4502
4958
  }
4503
4959
  };
4504
- var NgCompilerHost = class extends DelegatingCompilerHost {
4960
+ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
4505
4961
  shimAdapter;
4506
4962
  shimTagger;
4507
4963
  entryPoint = null;
@@ -4520,15 +4976,32 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4520
4976
  this.resolveModuleNames = this.createCachedResolveModuleNamesFunction();
4521
4977
  }
4522
4978
  }
4979
+ /**
4980
+ * Retrieves a set of `ts.SourceFile`s which should not be emitted as JS files.
4981
+ *
4982
+ * Available after this host is used to create a `ts.Program` (which causes all the files in the
4983
+ * program to be enumerated).
4984
+ */
4523
4985
  get ignoreForEmit() {
4524
4986
  return this.shimAdapter.ignoreForEmit;
4525
4987
  }
4988
+ /**
4989
+ * Retrieve the array of shim extension prefixes for which shims were created for each original
4990
+ * file.
4991
+ */
4526
4992
  get shimExtensionPrefixes() {
4527
4993
  return this.shimAdapter.extensionPrefixes;
4528
4994
  }
4995
+ /**
4996
+ * Performs cleanup that needs to happen after a `ts.Program` has been created using this host.
4997
+ */
4529
4998
  postProgramCreationCleanup() {
4530
4999
  this.shimTagger.finalize();
4531
5000
  }
5001
+ /**
5002
+ * Create an `NgCompilerHost` from a delegate host, an array of input filenames, and the full set
5003
+ * of TypeScript and Angular compiler options.
5004
+ */
4532
5005
  static wrap(delegate, inputFiles, options, oldProgram) {
4533
5006
  const topLevelShimGenerators = [];
4534
5007
  const perFileShimGenerators = [];
@@ -4563,11 +5036,22 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4563
5036
  }
4564
5037
  const shimAdapter = new ShimAdapter(delegate, normalizedTsInputFiles, topLevelShimGenerators, perFileShimGenerators, oldProgram);
4565
5038
  const shimTagger = new ShimReferenceTagger(perFileShimGenerators.map((gen) => gen.extensionPrefix));
4566
- return new NgCompilerHost(delegate, inputFiles, rootDirs, shimAdapter, shimTagger, entryPoint, diagnostics);
5039
+ return new _NgCompilerHost(delegate, inputFiles, rootDirs, shimAdapter, shimTagger, entryPoint, diagnostics);
4567
5040
  }
5041
+ /**
5042
+ * Check whether the given `ts.SourceFile` is a shim file.
5043
+ *
5044
+ * If this returns false, the file is user-provided.
5045
+ */
4568
5046
  isShim(sf) {
4569
5047
  return isShim(sf);
4570
5048
  }
5049
+ /**
5050
+ * Check whether the given `ts.SourceFile` is a resource file.
5051
+ *
5052
+ * This simply returns `false` for the compiler-cli since resource files are not added as root
5053
+ * files to the project.
5054
+ */
4571
5055
  isResource(sf) {
4572
5056
  return false;
4573
5057
  }
@@ -4600,10 +5084,13 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4600
5084
  }
4601
5085
  };
4602
5086
 
4603
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.js
5087
+ // packages/compiler-cli/src/ngtsc/program.js
4604
5088
  var NgtscProgram = class {
4605
5089
  options;
4606
5090
  compiler;
5091
+ /**
5092
+ * The primary TypeScript program, which is used for analysis and emit.
5093
+ */
4607
5094
  tsProgram;
4608
5095
  host;
4609
5096
  incrementalStrategy;
@@ -4645,7 +5132,9 @@ var NgtscProgram = class {
4645
5132
  this.incrementalStrategy,
4646
5133
  programDriver,
4647
5134
  perfRecorder,
5135
+ /* enableTemplateTypeChecker */
4648
5136
  false,
5137
+ /* usePoisonedData */
4649
5138
  false
4650
5139
  );
4651
5140
  } else {
@@ -4727,6 +5216,13 @@ var NgtscProgram = class {
4727
5216
  return this.compiler.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
4728
5217
  }
4729
5218
  }
5219
+ /**
5220
+ * Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
5221
+ * loading of any resources during the process.
5222
+ *
5223
+ * This is used by the Angular CLI to allow for spawning (async) child compilations for things
5224
+ * like SASS files used in `styleUrls`.
5225
+ */
4730
5226
  loadNgStructureAsync() {
4731
5227
  return this.compiler.analyzeAsync();
4732
5228
  }
@@ -4808,6 +5304,14 @@ var NgtscProgram = class {
4808
5304
  getIndexedComponents() {
4809
5305
  return this.compiler.getIndexedComponents();
4810
5306
  }
5307
+ /**
5308
+ * Gets information for the current program that may be used to generate API
5309
+ * reference documentation. This includes Angular-specific information, such
5310
+ * as component inputs and outputs.
5311
+ *
5312
+ * @param entryPoint Path to the entry point for the package for which API
5313
+ * docs should be extracted.
5314
+ */
4811
5315
  getApiDocumentation(entryPoint, privateModules) {
4812
5316
  return this.compiler.getApiDocumentation(entryPoint, privateModules);
4813
5317
  }
@@ -4828,15 +5332,15 @@ function mergeEmitResults(emitResults) {
4828
5332
  return { diagnostics, emitSkipped, emittedFiles };
4829
5333
  }
4830
5334
 
4831
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.js
5335
+ // packages/compiler-cli/src/transformers/program.js
4832
5336
  function createProgram({ rootNames, options, host, oldProgram }) {
4833
5337
  return new NgtscProgram(rootNames, options, host, oldProgram);
4834
5338
  }
4835
5339
 
4836
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.js
5340
+ // packages/compiler-cli/src/perform_compile.js
4837
5341
  import ts29 from "typescript";
4838
5342
 
4839
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.js
5343
+ // packages/compiler-cli/src/transformers/util.js
4840
5344
  import ts28 from "typescript";
4841
5345
  function createMessageDiagnostic(messageText) {
4842
5346
  return {
@@ -4850,7 +5354,7 @@ function createMessageDiagnostic(messageText) {
4850
5354
  };
4851
5355
  }
4852
5356
 
4853
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.js
5357
+ // packages/compiler-cli/src/perform_compile.js
4854
5358
  var defaultFormatHost = {
4855
5359
  getCurrentDirectory: () => ts29.sys.getCurrentDirectory(),
4856
5360
  getCanonicalFileName: (fileName) => fileName,
@@ -5066,18 +5570,17 @@ export {
5066
5570
  performCompilation,
5067
5571
  defaultGatherDiagnostics
5068
5572
  };
5069
- /*!
5573
+ /**
5070
5574
  * @license
5071
5575
  * Copyright Google LLC All Rights Reserved.
5072
5576
  *
5073
5577
  * Use of this source code is governed by an MIT-style license that can be
5074
5578
  * found in the LICENSE file at https://angular.dev/license
5075
5579
  */
5076
- /**
5580
+ /*!
5077
5581
  * @license
5078
5582
  * Copyright Google LLC All Rights Reserved.
5079
5583
  *
5080
5584
  * Use of this source code is governed by an MIT-style license that can be
5081
5585
  * found in the LICENSE file at https://angular.dev/license
5082
5586
  */
5083
- //# sourceMappingURL=chunk-YNE6T2TY.js.map