@angular/compiler-cli 20.2.0-next.0 → 20.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bundles/{chunk-SEKYV57I.js → chunk-6HOSNZU5.js} +2 -3
  2. package/bundles/{chunk-FPHHL4UV.js → chunk-BPDNYZBC.js} +253 -49
  3. package/bundles/chunk-DWRM7PIK.js +14 -0
  4. package/bundles/{chunk-JXYBFWGA.js → chunk-F7QVREVY.js} +19 -7
  5. package/bundles/{chunk-TPEB2IXF.js → chunk-GWZQLAGK.js} +35 -7
  6. package/bundles/{chunk-PML5JK7B.js → chunk-HYJ2H3FU.js} +120 -7
  7. package/bundles/{chunk-6ECVYRSU.js → chunk-I2BHWRAU.js} +11 -6
  8. package/bundles/{chunk-5TMRGUHP.js → chunk-PLUBZWSY.js} +27 -11
  9. package/bundles/{chunk-5JF7HF3W.js → chunk-SZY7NM6F.js} +2 -3
  10. package/bundles/{chunk-UZOSFHTN.js → chunk-TMIC4MKN.js} +2312 -736
  11. package/bundles/{chunk-YNE6T2TY.js → chunk-U3R42CLJ.js} +569 -103
  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/perf/src/api.d.ts +24 -16
  23. package/src/ngtsc/typecheck/api/api.d.ts +1 -1
  24. package/src/ngtsc/typecheck/api/checker.d.ts +15 -0
  25. package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +7 -1
  26. package/src/ngtsc/typecheck/src/checker.d.ts +2 -0
  27. package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
  28. package/bundles/chunk-2FHBFXPC.js +0 -34
  29. package/bundles/chunk-2FHBFXPC.js.map +0 -6
  30. package/bundles/chunk-5JF7HF3W.js.map +0 -6
  31. package/bundles/chunk-5TMRGUHP.js.map +0 -6
  32. package/bundles/chunk-6ECVYRSU.js.map +0 -6
  33. package/bundles/chunk-FPHHL4UV.js.map +0 -6
  34. package/bundles/chunk-JXYBFWGA.js.map +0 -6
  35. package/bundles/chunk-KPQ72R34.js +0 -23
  36. package/bundles/chunk-KPQ72R34.js.map +0 -6
  37. package/bundles/chunk-PML5JK7B.js.map +0 -6
  38. package/bundles/chunk-SEKYV57I.js.map +0 -6
  39. package/bundles/chunk-TPEB2IXF.js.map +0 -6
  40. package/bundles/chunk-UZOSFHTN.js.map +0 -6
  41. package/bundles/chunk-YNE6T2TY.js.map +0 -6
  42. package/bundles/index.js.map +0 -6
  43. package/bundles/linker/babel/index.js.map +0 -6
  44. package/bundles/linker/index.js.map +0 -6
  45. package/bundles/private/localize.js.map +0 -6
  46. package/bundles/private/migrations.js.map +0 -6
  47. package/bundles/private/tooling.js.map +0 -6
  48. package/bundles/src/bin/ng_xi18n.js.map +0 -6
  49. 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-PLUBZWSY.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-TMIC4MKN.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,14 @@ 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 `[@myAnimation]="mySignal"`
2910
+ node.type === BindingType.LegacyAnimation) && nodeAst
2911
+ ) {
2658
2912
  return buildDiagnosticForSignal(ctx, nodeAst, component);
2659
2913
  }
2660
2914
  }
@@ -2702,7 +2956,7 @@ var factory = {
2702
2956
  create: () => new InterpolatedSignalCheck()
2703
2957
  };
2704
2958
 
2705
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.js
2959
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.js
2706
2960
  import { TmplAstBoundEvent } from "@angular/compiler";
2707
2961
  var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
2708
2962
  code = ErrorCode.INVALID_BANANA_IN_BOX;
@@ -2725,7 +2979,7 @@ var factory2 = {
2725
2979
  create: () => new InvalidBananaInBoxCheck()
2726
2980
  };
2727
2981
 
2728
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.js
2982
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.js
2729
2983
  import { TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
2730
2984
  var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
2731
2985
  ["ngIf", { directive: "NgIf", builtIn: "@if" }],
@@ -2767,7 +3021,7 @@ var factory3 = {
2767
3021
  }
2768
3022
  };
2769
3023
 
2770
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.js
3024
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.js
2771
3025
  import { TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
2772
3026
  var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
2773
3027
  code = ErrorCode.MISSING_NGFOROF_LET;
@@ -2797,7 +3051,7 @@ var factory4 = {
2797
3051
  create: () => new MissingNgForOfLetCheck()
2798
3052
  };
2799
3053
 
2800
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_structural_directive/index.js
3054
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_structural_directive/index.js
2801
3055
  import { TmplAstTemplate as TmplAstTemplate4 } from "@angular/compiler";
2802
3056
  var KNOWN_CONTROL_FLOW_DIRECTIVES2 = /* @__PURE__ */ new Set([
2803
3057
  "ngIf",
@@ -2837,7 +3091,7 @@ var factory5 = {
2837
3091
  create: () => new MissingStructuralDirectiveCheck()
2838
3092
  };
2839
3093
 
2840
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
3094
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
2841
3095
  import { Binary } from "@angular/compiler";
2842
3096
  import ts19 from "typescript";
2843
3097
  var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
@@ -2880,7 +3134,7 @@ var factory6 = {
2880
3134
  }
2881
3135
  };
2882
3136
 
2883
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
3137
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
2884
3138
  import { SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
2885
3139
  import ts20 from "typescript";
2886
3140
  var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
@@ -2924,7 +3178,7 @@ var factory7 = {
2924
3178
  }
2925
3179
  };
2926
3180
 
2927
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/skip_hydration_not_static/index.js
3181
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/skip_hydration_not_static/index.js
2928
3182
  import { TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstTextAttribute } from "@angular/compiler";
2929
3183
  var NG_SKIP_HYDRATION_ATTR_NAME = "ngSkipHydration";
2930
3184
  var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
@@ -2935,7 +3189,11 @@ var NgSkipHydrationSpec = class extends TemplateCheckWithVisitor {
2935
3189
  const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
2936
3190
  return [diagnostic];
2937
3191
  }
2938
- const acceptedValues = ["true", ""];
3192
+ const acceptedValues = [
3193
+ "true",
3194
+ ""
3195
+ /* empty string */
3196
+ ];
2939
3197
  if (node instanceof TmplAstTextAttribute && node.name === NG_SKIP_HYDRATION_ATTR_NAME && !acceptedValues.includes(node.value) && node.value !== void 0) {
2940
3198
  const errorString = `ngSkipHydration only accepts "true" or "" as value or no value at all. For example 'ngSkipHydration="true"' or 'ngSkipHydration'`;
2941
3199
  const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, errorString);
@@ -2950,7 +3208,7 @@ var factory8 = {
2950
3208
  create: () => new NgSkipHydrationSpec()
2951
3209
  };
2952
3210
 
2953
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.js
3211
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.js
2954
3212
  import { TmplAstBoundAttribute as TmplAstBoundAttribute3 } from "@angular/compiler";
2955
3213
  var STYLE_SUFFIXES = ["px", "%", "em"];
2956
3214
  var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
@@ -2971,7 +3229,7 @@ var factory9 = {
2971
3229
  create: () => new SuffixNotSupportedCheck()
2972
3230
  };
2973
3231
 
2974
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.js
3232
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.js
2975
3233
  import { TmplAstTextAttribute as TmplAstTextAttribute2 } from "@angular/compiler";
2976
3234
  var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
2977
3235
  code = ErrorCode.TEXT_ATTRIBUTE_NOT_BINDING;
@@ -2991,7 +3249,11 @@ var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
2991
3249
  }
2992
3250
  } else {
2993
3251
  const expectedKey = `[${name}]`;
2994
- const expectedValue = node.value === "true" || node.value === "false" ? node.value : `'${node.value}'`;
3252
+ const expectedValue = (
3253
+ // true/false are special cases because we don't want to convert them to strings but
3254
+ // rather maintain the logical true/false when bound.
3255
+ node.value === "true" || node.value === "false" ? node.value : `'${node.value}'`
3256
+ );
2995
3257
  errorString = "Attribute, style, and class bindings should be enclosed with square braces.";
2996
3258
  if (node.value) {
2997
3259
  errorString += ` For example, '${expectedKey}="${expectedValue}"'.`;
@@ -3007,7 +3269,7 @@ var factory10 = {
3007
3269
  create: () => new TextAttributeNotBindingSpec()
3008
3270
  };
3009
3271
 
3010
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_event_binding/index.js
3272
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_event_binding/index.js
3011
3273
  import { ASTWithSource as ASTWithSource3, Call, Chain, Conditional, ParsedEventType, PropertyRead as PropertyRead3, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead2, TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
3012
3274
  var UninvokedFunctionInEventBindingSpec = class extends TemplateCheckWithVisitor {
3013
3275
  code = ErrorCode.UNINVOKED_FUNCTION_IN_EVENT_BINDING;
@@ -3055,7 +3317,7 @@ var factory11 = {
3055
3317
  create: () => new UninvokedFunctionInEventBindingSpec()
3056
3318
  };
3057
3319
 
3058
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unparenthesized_nullish_coalescing/index.js
3320
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unparenthesized_nullish_coalescing/index.js
3059
3321
  import { Binary as Binary2 } from "@angular/compiler";
3060
3322
  var UnparenthesizedNullishCoalescing = class extends TemplateCheckWithVisitor {
3061
3323
  code = ErrorCode.UNPARENTHESIZED_NULLISH_COALESCING;
@@ -3085,7 +3347,7 @@ var factory12 = {
3085
3347
  create: () => new UnparenthesizedNullishCoalescing()
3086
3348
  };
3087
3349
 
3088
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.js
3350
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.js
3089
3351
  import { AST, ASTWithSource as ASTWithSource4, TmplAstLetDeclaration } from "@angular/compiler";
3090
3352
  var UnusedLetDeclarationCheck = class extends TemplateCheckWithVisitor {
3091
3353
  code = ErrorCode.UNUSED_LET_DECLARATION;
@@ -3127,7 +3389,7 @@ var factory13 = {
3127
3389
  create: () => new UnusedLetDeclarationCheck()
3128
3390
  };
3129
3391
 
3130
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_track_function/index.js
3392
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_track_function/index.js
3131
3393
  import { Call as Call2, PropertyRead as PropertyRead4, SafeCall as SafeCall3, SafePropertyRead as SafePropertyRead3, TmplAstForLoopBlock } from "@angular/compiler";
3132
3394
  var UninvokedTrackFunctionCheck = class extends TemplateCheckWithVisitor {
3133
3395
  code = ErrorCode.UNINVOKED_TRACK_FUNCTION;
@@ -3159,10 +3421,10 @@ var factory14 = {
3159
3421
  create: () => new UninvokedTrackFunctionCheck()
3160
3422
  };
3161
3423
 
3162
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3424
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3163
3425
  import ts21 from "typescript";
3164
3426
 
3165
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
3427
+ // packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
3166
3428
  var DiagnosticCategoryLabel;
3167
3429
  (function(DiagnosticCategoryLabel2) {
3168
3430
  DiagnosticCategoryLabel2["Warning"] = "warning";
@@ -3170,7 +3432,7 @@ var DiagnosticCategoryLabel;
3170
3432
  DiagnosticCategoryLabel2["Suppress"] = "suppress";
3171
3433
  })(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
3172
3434
 
3173
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3435
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
3174
3436
  var ExtendedTemplateCheckerImpl = class {
3175
3437
  partialCtx;
3176
3438
  templateChecks;
@@ -3198,6 +3460,8 @@ var ExtendedTemplateCheckerImpl = class {
3198
3460
  for (const [check, category] of this.templateChecks.entries()) {
3199
3461
  const ctx = {
3200
3462
  ...this.partialCtx,
3463
+ // Wrap `templateTypeChecker.makeTemplateDiagnostic()` to implicitly provide all the known
3464
+ // options.
3201
3465
  makeTemplateDiagnostic: (span, message, relatedInformation) => {
3202
3466
  return this.partialCtx.templateTypeChecker.makeTemplateDiagnostic(component, span, category, check.code, message, relatedInformation);
3203
3467
  }
@@ -3224,7 +3488,7 @@ function assertNever(value) {
3224
3488
  ${value}`);
3225
3489
  }
3226
3490
 
3227
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.js
3491
+ // packages/compiler-cli/src/ngtsc/typecheck/extended/index.js
3228
3492
  var ALL_DIAGNOSTIC_FACTORIES = [
3229
3493
  factory2,
3230
3494
  factory6,
@@ -3247,7 +3511,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
3247
3511
  ...ALL_DIAGNOSTIC_FACTORIES.map((factory15) => factory15.name)
3248
3512
  ]);
3249
3513
 
3250
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
3514
+ // packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
3251
3515
  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";
3252
3516
  import ts22 from "typescript";
3253
3517
  var TemplateSemanticsCheckerImpl = class {
@@ -3260,7 +3524,7 @@ var TemplateSemanticsCheckerImpl = class {
3260
3524
  return template !== null ? TemplateSemanticsVisitor.visit(template, component, this.templateTypeChecker) : [];
3261
3525
  }
3262
3526
  };
3263
- var TemplateSemanticsVisitor = class extends TmplAstRecursiveVisitor {
3527
+ var TemplateSemanticsVisitor = class _TemplateSemanticsVisitor extends TmplAstRecursiveVisitor {
3264
3528
  expressionVisitor;
3265
3529
  constructor(expressionVisitor) {
3266
3530
  super();
@@ -3269,7 +3533,7 @@ var TemplateSemanticsVisitor = class extends TmplAstRecursiveVisitor {
3269
3533
  static visit(nodes, component, templateTypeChecker) {
3270
3534
  const diagnostics = [];
3271
3535
  const expressionVisitor = new ExpressionsSemanticsVisitor(templateTypeChecker, component, diagnostics);
3272
- const templateVisitor = new TemplateSemanticsVisitor(expressionVisitor);
3536
+ const templateVisitor = new _TemplateSemanticsVisitor(expressionVisitor);
3273
3537
  nodes.forEach((node) => node.visit(templateVisitor));
3274
3538
  return diagnostics;
3275
3539
  }
@@ -3346,7 +3610,7 @@ function unwrapAstWithSource(ast) {
3346
3610
  return ast instanceof ASTWithSource5 ? ast.ast : ast;
3347
3611
  }
3348
3612
 
3349
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
3613
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
3350
3614
  import ts23 from "typescript";
3351
3615
  var APIS_TO_CHECK = [
3352
3616
  INPUT_INITIALIZER_FN,
@@ -3398,7 +3662,7 @@ var InitializerApiUsageRule = class {
3398
3662
  }
3399
3663
  };
3400
3664
 
3401
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
3665
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
3402
3666
  import ts24 from "typescript";
3403
3667
  var UnusedStandaloneImportsRule = class {
3404
3668
  templateTypeChecker;
@@ -3463,6 +3727,11 @@ var UnusedStandaloneImportsRule = class {
3463
3727
  }
3464
3728
  return unused;
3465
3729
  }
3730
+ /**
3731
+ * Determines if an import reference *might* be coming from a shared imports array.
3732
+ * @param reference Reference to be checked.
3733
+ * @param rawImports AST node that defines the `imports` array.
3734
+ */
3466
3735
  isPotentialSharedReference(reference, rawImports) {
3467
3736
  if (reference.getIdentityInExpression(rawImports) !== null) {
3468
3737
  return false;
@@ -3489,13 +3758,17 @@ function closestNode(start, predicate) {
3489
3758
  return null;
3490
3759
  }
3491
3760
 
3492
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3761
+ // packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3493
3762
  var SourceFileValidator = class {
3494
3763
  rules;
3495
3764
  constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
3496
3765
  this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
3497
3766
  this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
3498
3767
  }
3768
+ /**
3769
+ * Gets the diagnostics for a specific file, or null if the file is valid.
3770
+ * @param sourceFile File to be checked.
3771
+ */
3499
3772
  getDiagnosticsForFile(sourceFile) {
3500
3773
  if (sourceFile.isDeclarationFile || sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
3501
3774
  return null;
@@ -3529,7 +3802,7 @@ var SourceFileValidator = class {
3529
3802
  }
3530
3803
  };
3531
3804
 
3532
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/feature_detection.js
3805
+ // packages/compiler-cli/src/ngtsc/core/src/feature_detection.js
3533
3806
  import semver from "semver";
3534
3807
  function coreVersionSupportsFeature(coreVersion, minVersion) {
3535
3808
  if (coreVersion === `0.0.0-${"PLACEHOLDER"}`) {
@@ -3538,7 +3811,7 @@ function coreVersionSupportsFeature(coreVersion, minVersion) {
3538
3811
  return semver.satisfies(coreVersion, minVersion, { includePrerelease: true });
3539
3812
  }
3540
3813
 
3541
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.js
3814
+ // packages/compiler-cli/src/ngtsc/core/src/compiler.js
3542
3815
  var CompilationTicketKind;
3543
3816
  (function(CompilationTicketKind2) {
3544
3817
  CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
@@ -3596,7 +3869,7 @@ function incrementalFromStateTicket(oldProgram, oldState, newProgram, options, i
3596
3869
  perfRecorder
3597
3870
  };
3598
3871
  }
3599
- var NgCompiler = class {
3872
+ var NgCompiler = class _NgCompiler {
3600
3873
  adapter;
3601
3874
  options;
3602
3875
  inputProgram;
@@ -3605,8 +3878,24 @@ var NgCompiler = class {
3605
3878
  incrementalCompilation;
3606
3879
  usePoisonedData;
3607
3880
  livePerfRecorder;
3881
+ /**
3882
+ * Lazily evaluated state of the compilation.
3883
+ *
3884
+ * This is created on demand by calling `ensureAnalyzed`.
3885
+ */
3608
3886
  compilation = null;
3887
+ /**
3888
+ * Any diagnostics related to the construction of the compilation.
3889
+ *
3890
+ * These are diagnostics which arose during setup of the host and/or program.
3891
+ */
3609
3892
  constructionDiagnostics = [];
3893
+ /**
3894
+ * Non-template diagnostics related to the program itself. Does not include template
3895
+ * diagnostics because the template type checker memoizes them itself.
3896
+ *
3897
+ * This is set by (and memoizes) `getNonTemplateDiagnostics`.
3898
+ */
3610
3899
  nonTemplateDiagnostics = null;
3611
3900
  closureCompilerEnabled;
3612
3901
  currentProgram;
@@ -3624,13 +3913,27 @@ var NgCompiler = class {
3624
3913
  implicitStandaloneValue;
3625
3914
  enableSelectorless;
3626
3915
  emitDeclarationOnly;
3916
+ /**
3917
+ * `NgCompiler` can be reused for multiple compilations (for resource-only changes), and each
3918
+ * new compilation uses a fresh `PerfRecorder`. Thus, classes created with a lifespan of the
3919
+ * `NgCompiler` use a `DelegatingPerfRecorder` so the `PerfRecorder` they write to can be updated
3920
+ * with each fresh compilation.
3921
+ */
3627
3922
  delegatingPerfRecorder;
3923
+ /**
3924
+ * Convert a `CompilationTicket` into an `NgCompiler` instance for the requested compilation.
3925
+ *
3926
+ * Depending on the nature of the compilation request, the `NgCompiler` instance may be reused
3927
+ * from a previous compilation and updated with any changes, it may be a new instance which
3928
+ * incrementally reuses state from a previous compilation, or it may represent a fresh
3929
+ * compilation entirely.
3930
+ */
3628
3931
  static fromTicket(ticket, adapter) {
3629
3932
  switch (ticket.kind) {
3630
3933
  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);
3934
+ 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
3935
  case CompilationTicketKind.IncrementalTypeScript:
3633
- return new NgCompiler(adapter, ticket.options, ticket.newProgram, ticket.programDriver, ticket.incrementalBuildStrategy, ticket.incrementalCompilation, ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3936
+ return new _NgCompiler(adapter, ticket.options, ticket.newProgram, ticket.programDriver, ticket.incrementalBuildStrategy, ticket.incrementalCompilation, ticket.enableTemplateTypeChecker, ticket.usePoisonedData, ticket.perfRecorder);
3634
3937
  case CompilationTicketKind.IncrementalResource:
3635
3938
  const compiler = ticket.compiler;
3636
3939
  compiler.updateWithChangedResources(ticket.modifiedResourceFiles, ticket.perfRecorder);
@@ -3662,6 +3965,10 @@ var NgCompiler = class {
3662
3965
  this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
3663
3966
  const moduleResolutionCache = ts25.createModuleResolutionCache(
3664
3967
  this.adapter.getCurrentDirectory(),
3968
+ // doen't retain a reference to `this`, if other closures in the constructor here reference
3969
+ // `this` internally then a closure created here would retain them. This can cause major
3970
+ // memory leak issues since the `moduleResolutionCache` is a long-lived object and finds its
3971
+ // way into all kinds of places inside TS internal objects.
3665
3972
  this.adapter.getCanonicalFileName.bind(this.adapter)
3666
3973
  );
3667
3974
  this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
@@ -3711,10 +4018,18 @@ var NgCompiler = class {
3711
4018
  }
3712
4019
  });
3713
4020
  }
4021
+ /**
4022
+ * Get the resource dependencies of a file.
4023
+ *
4024
+ * If the file is not part of the compilation, an empty array will be returned.
4025
+ */
3714
4026
  getResourceDependencies(file) {
3715
4027
  this.ensureAnalyzed();
3716
4028
  return this.incrementalCompilation.depGraph.getResourceDependencies(file);
3717
4029
  }
4030
+ /**
4031
+ * Get all Angular-related diagnostics for this compilation.
4032
+ */
3718
4033
  getDiagnostics() {
3719
4034
  const diagnostics = [...this.getNonTemplateDiagnostics()];
3720
4035
  try {
@@ -3727,6 +4042,11 @@ var NgCompiler = class {
3727
4042
  }
3728
4043
  return this.addMessageTextDetails(diagnostics);
3729
4044
  }
4045
+ /**
4046
+ * Get all Angular-related diagnostics for this compilation.
4047
+ *
4048
+ * If a `ts.SourceFile` is passed, only diagnostics related to that file are returned.
4049
+ */
3730
4050
  getDiagnosticsForFile(file, optimizeFor) {
3731
4051
  const diagnostics = [
3732
4052
  ...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file)
@@ -3741,6 +4061,9 @@ var NgCompiler = class {
3741
4061
  }
3742
4062
  return this.addMessageTextDetails(diagnostics);
3743
4063
  }
4064
+ /**
4065
+ * Get all `ts.Diagnostic`s currently available that pertain to the given component.
4066
+ */
3744
4067
  getDiagnosticsForComponent(component) {
3745
4068
  const compilation = this.ensureAnalyzed();
3746
4069
  const ttc = compilation.templateTypeChecker;
@@ -3762,6 +4085,9 @@ var NgCompiler = class {
3762
4085
  }
3763
4086
  return this.addMessageTextDetails(diagnostics);
3764
4087
  }
4088
+ /**
4089
+ * Add Angular.io error guide links to diagnostics for this compilation.
4090
+ */
3765
4091
  addMessageTextDetails(diagnostics) {
3766
4092
  return diagnostics.map((diag) => {
3767
4093
  if (diag.code && COMPILER_ERRORS_WITH_GUIDES.has(ngErrorCode(diag.code))) {
@@ -3773,9 +4099,27 @@ var NgCompiler = class {
3773
4099
  return diag;
3774
4100
  });
3775
4101
  }
4102
+ /**
4103
+ * Get all setup-related diagnostics for this compilation.
4104
+ */
3776
4105
  getOptionDiagnostics() {
3777
4106
  return this.constructionDiagnostics;
3778
4107
  }
4108
+ /**
4109
+ * Get the current `ts.Program` known to this `NgCompiler`.
4110
+ *
4111
+ * Compilation begins with an input `ts.Program`, and during template type-checking operations new
4112
+ * `ts.Program`s may be produced using the `ProgramDriver`. The most recent such `ts.Program` to
4113
+ * be produced is available here.
4114
+ *
4115
+ * This `ts.Program` serves two key purposes:
4116
+ *
4117
+ * * As an incremental starting point for creating the next `ts.Program` based on files that the
4118
+ * user has changed (for clients using the TS compiler program APIs).
4119
+ *
4120
+ * * As the "before" point for an incremental compilation invocation, to determine what's changed
4121
+ * between the old and new programs (for all compilations).
4122
+ */
3779
4123
  getCurrentProgram() {
3780
4124
  return this.currentProgram;
3781
4125
  }
@@ -3785,14 +4129,23 @@ var NgCompiler = class {
3785
4129
  }
3786
4130
  return this.ensureAnalyzed().templateTypeChecker;
3787
4131
  }
4132
+ /**
4133
+ * Retrieves the `ts.Declaration`s for any component(s) which use the given template file.
4134
+ */
3788
4135
  getComponentsWithTemplateFile(templateFilePath) {
3789
4136
  const { resourceRegistry } = this.ensureAnalyzed();
3790
4137
  return resourceRegistry.getComponentsWithTemplate(resolve(templateFilePath));
3791
4138
  }
4139
+ /**
4140
+ * Retrieves the `ts.Declaration`s for any component(s) which use the given template file.
4141
+ */
3792
4142
  getComponentsWithStyleFile(styleFilePath) {
3793
4143
  const { resourceRegistry } = this.ensureAnalyzed();
3794
4144
  return resourceRegistry.getComponentsWithStyle(resolve(styleFilePath));
3795
4145
  }
4146
+ /**
4147
+ * Retrieves external resources for the given directive.
4148
+ */
3796
4149
  getDirectiveResources(classDecl) {
3797
4150
  if (!isNamedClassDeclaration(classDecl)) {
3798
4151
  return null;
@@ -3815,6 +4168,15 @@ var NgCompiler = class {
3815
4168
  }
3816
4169
  return meta;
3817
4170
  }
4171
+ /**
4172
+ * Perform Angular's analysis step (as a precursor to `getDiagnostics` or `prepareEmit`)
4173
+ * asynchronously.
4174
+ *
4175
+ * Normally, this operation happens lazily whenever `getDiagnostics` or `prepareEmit` are called.
4176
+ * However, certain consumers may wish to allow for an asynchronous phase of analysis, where
4177
+ * resources such as `styleUrls` are resolved asynchronously. In these cases `analyzeAsync` must
4178
+ * be called first, and its `Promise` awaited prior to calling any other APIs of `NgCompiler`.
4179
+ */
3818
4180
  async analyzeAsync() {
3819
4181
  if (this.compilation !== null) {
3820
4182
  return;
@@ -3836,6 +4198,10 @@ var NgCompiler = class {
3836
4198
  this.resolveCompilation(this.compilation.traitCompiler);
3837
4199
  });
3838
4200
  }
4201
+ /**
4202
+ * Fetch transformers and other information which is necessary for a consumer to `emit` the
4203
+ * program with Angular-added definitions.
4204
+ */
3839
4205
  prepareEmit() {
3840
4206
  const compilation = this.ensureAnalyzed();
3841
4207
  untagAllTsFiles(this.inputProgram);
@@ -3884,12 +4250,27 @@ var NgCompiler = class {
3884
4250
  }
3885
4251
  return { transformers: { before, afterDeclarations } };
3886
4252
  }
4253
+ /**
4254
+ * Run the indexing process and return a `Map` of all indexed components.
4255
+ *
4256
+ * See the `indexing` package for more details.
4257
+ */
3887
4258
  getIndexedComponents() {
3888
4259
  const compilation = this.ensureAnalyzed();
3889
4260
  const context = new IndexingContext();
3890
4261
  compilation.traitCompiler.index(context);
3891
4262
  return generateAnalysis(context);
3892
4263
  }
4264
+ /**
4265
+ * Gets information for the current program that may be used to generate API
4266
+ * reference documentation. This includes Angular-specific information, such
4267
+ * as component inputs and outputs.
4268
+ *
4269
+ * @param entryPoint Path to the entry point for the package for which API
4270
+ * docs should be extracted.
4271
+ *
4272
+ * @returns A map of symbols with their associated module, eg: ApplicationRef => @angular/core
4273
+ */
3893
4274
  getApiDocumentation(entryPoint, privateModules) {
3894
4275
  const compilation = this.ensureAnalyzed();
3895
4276
  const checker = this.inputProgram.getTypeChecker();
@@ -3903,10 +4284,17 @@ var NgCompiler = class {
3903
4284
  const rootDir = this.inputProgram.getCurrentDirectory();
3904
4285
  return docsExtractor.extractAll(entryPointSourceFile, rootDir, privateModules);
3905
4286
  }
4287
+ /**
4288
+ * Collect i18n messages into the `Xi18nContext`.
4289
+ */
3906
4290
  xi18n(ctx) {
3907
4291
  const compilation = this.ensureAnalyzed();
3908
4292
  compilation.traitCompiler.xi18n(ctx);
3909
4293
  }
4294
+ /**
4295
+ * Emits the JavaScript module that can be used to replace the metadata of a class during HMR.
4296
+ * @param node Class for which to generate the update module.
4297
+ */
3910
4298
  emitHmrUpdateModule(node) {
3911
4299
  const { traitCompiler, reflector } = this.ensureAnalyzed();
3912
4300
  if (!reflector.isClass(node)) {
@@ -3922,6 +4310,9 @@ var NgCompiler = class {
3922
4310
  return ts25.transpileModule(nodeText, {
3923
4311
  compilerOptions: {
3924
4312
  ...this.options,
4313
+ // Some module types can produce additional code (see #60795) whereas we need the
4314
+ // HMR update module to use a native `export`. Override the `target` and `module`
4315
+ // to ensure that it looks as expected.
3925
4316
  module: ts25.ModuleKind.ES2022,
3926
4317
  target: ts25.ScriptTarget.ES2022
3927
4318
  },
@@ -3976,18 +4367,28 @@ var NgCompiler = class {
3976
4367
  checkControlFlowBodies: true,
3977
4368
  strictNullInputBindings: strictTemplates,
3978
4369
  checkTypeOfAttributes: strictTemplates,
4370
+ // Even in full template type-checking mode, DOM binding checks are not quite ready yet.
3979
4371
  checkTypeOfDomBindings: false,
3980
4372
  checkTypeOfOutputEvents: strictTemplates,
3981
4373
  checkTypeOfAnimationEvents: strictTemplates,
4374
+ // Checking of DOM events currently has an adverse effect on developer experience,
4375
+ // e.g. for `<input (blur)="update($event.target.value)">` enabling this check results in:
4376
+ // - error TS2531: Object is possibly 'null'.
4377
+ // - error TS2339: Property 'value' does not exist on type 'EventTarget'.
3982
4378
  checkTypeOfDomEvents: strictTemplates,
3983
4379
  checkTypeOfDomReferences: strictTemplates,
4380
+ // Non-DOM references have the correct type in View Engine so there is no strictness flag.
3984
4381
  checkTypeOfNonDomReferences: true,
4382
+ // Pipes are checked in View Engine so there is no strictness flag.
3985
4383
  checkTypeOfPipes: true,
3986
4384
  strictSafeNavigationTypes: strictTemplates,
3987
4385
  useContextGenericType: strictTemplates,
3988
4386
  strictLiteralTypes: true,
3989
4387
  enableTemplateTypeChecker: this.enableTemplateTypeChecker,
3990
4388
  useInlineTypeConstructors,
4389
+ // Warnings for suboptimal type inference are only enabled if in Language Service mode
4390
+ // (providing the full TemplateTypeChecker API) and if strict mode is not enabled. In strict
4391
+ // mode, the user is in full control of type inference.
3991
4392
  suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates,
3992
4393
  controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
3993
4394
  unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
@@ -4000,6 +4401,8 @@ var NgCompiler = class {
4000
4401
  checkQueries: false,
4001
4402
  checkTemplateBodies: false,
4002
4403
  checkControlFlowBodies: false,
4404
+ // Enable deep schema checking in "basic" template type-checking mode only if Closure
4405
+ // compilation is requested, which is a good proxy for "only in google3".
4003
4406
  alwaysCheckSchemaInTemplateBodies: this.closureCompilerEnabled,
4004
4407
  checkTypeOfInputBindings: false,
4005
4408
  strictNullInputBindings: false,
@@ -4017,6 +4420,8 @@ var NgCompiler = class {
4017
4420
  strictLiteralTypes: false,
4018
4421
  enableTemplateTypeChecker: this.enableTemplateTypeChecker,
4019
4422
  useInlineTypeConstructors,
4423
+ // In "basic" template type-checking mode, no warnings are produced since most things are
4424
+ // not checked anyways.
4020
4425
  suggestionsForSuboptimalTypeInference: false,
4021
4426
  controlFlowPreventingContentProjection: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
4022
4427
  unusedStandaloneImports: this.options.extendedDiagnostics?.defaultCategory || DiagnosticCategoryLabel.Warning,
@@ -4155,8 +4560,13 @@ var NgCompiler = class {
4155
4560
  localImportStrategy = new RelativePathStrategy(reflector);
4156
4561
  }
4157
4562
  refEmitter = new ReferenceEmitter([
4563
+ // First, try to use local identifiers if available.
4158
4564
  new LocalIdentifierStrategy(),
4565
+ // Next, attempt to use an absolute import.
4159
4566
  new AbsoluteModuleStrategy(this.inputProgram, checker, this.moduleResolver, reflector),
4567
+ // Finally, check if the reference is being written into a file within the project's .ts
4568
+ // sources, and use a relative import if so. If this fails, ReferenceEmitter will throw
4569
+ // an error.
4160
4570
  localImportStrategy
4161
4571
  ]);
4162
4572
  if (this.entryPoint === null && this.options.generateDeepReexports === true) {
@@ -4164,8 +4574,11 @@ var NgCompiler = class {
4164
4574
  }
4165
4575
  } else {
4166
4576
  refEmitter = new ReferenceEmitter([
4577
+ // First, try to use local identifiers if available.
4167
4578
  new LocalIdentifierStrategy(),
4579
+ // Then use aliased references (this is a workaround to StrictDeps checks).
4168
4580
  ...this.options["_useHostForImportAndAliasGeneration"] ? [new AliasStrategy()] : [],
4581
+ // Then use fileNameToModuleName to emit imports.
4169
4582
  new UnifiedModulesStrategy(reflector, this.adapter.unifiedModulesHost)
4170
4583
  ]);
4171
4584
  if (this.options["_useHostForImportAndAliasGeneration"]) {
@@ -4227,7 +4640,11 @@ var NgCompiler = class {
4227
4640
  const jitDeclarationRegistry = new JitDeclarationRegistry();
4228
4641
  const handlers = [
4229
4642
  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),
4643
+ // TODO(alxhub): understand why the cast here is necessary (something to do with `null`
4644
+ // not being assignable to `unknown` when wrapped in `Readonly`).
4230
4645
  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),
4646
+ // Pipe handler must be before injectable handler in list so pipe factories are printed
4647
+ // before injectable factories (so injectable factories can delegate to them)
4231
4648
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode, !!this.options.strictStandalone, this.implicitStandaloneValue),
4232
4649
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
4233
4650
  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 +4843,7 @@ function versionMapFromProgram(program, driver) {
4426
4843
  return versions;
4427
4844
  }
4428
4845
 
4429
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.js
4846
+ // packages/compiler-cli/src/ngtsc/core/src/host.js
4430
4847
  import ts26 from "typescript";
4431
4848
  var DelegatingCompilerHost = class {
4432
4849
  delegate;
@@ -4459,6 +4876,8 @@ var DelegatingCompilerHost = class {
4459
4876
  hasInvalidatedResolutions;
4460
4877
  resolveModuleNameLiterals;
4461
4878
  resolveTypeReferenceDirectiveReferences;
4879
+ // jsDocParsingMode is not a method like the other elements above
4880
+ // TODO: ignore usage can be dropped once 5.2 support is dropped
4462
4881
  get jsDocParsingMode() {
4463
4882
  return this.delegate.jsDocParsingMode;
4464
4883
  }
@@ -4501,7 +4920,7 @@ var DelegatingCompilerHost = class {
4501
4920
  return this.delegate[name] !== void 0 ? this.delegate[name].bind(this.delegate) : void 0;
4502
4921
  }
4503
4922
  };
4504
- var NgCompilerHost = class extends DelegatingCompilerHost {
4923
+ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
4505
4924
  shimAdapter;
4506
4925
  shimTagger;
4507
4926
  entryPoint = null;
@@ -4520,15 +4939,32 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4520
4939
  this.resolveModuleNames = this.createCachedResolveModuleNamesFunction();
4521
4940
  }
4522
4941
  }
4942
+ /**
4943
+ * Retrieves a set of `ts.SourceFile`s which should not be emitted as JS files.
4944
+ *
4945
+ * Available after this host is used to create a `ts.Program` (which causes all the files in the
4946
+ * program to be enumerated).
4947
+ */
4523
4948
  get ignoreForEmit() {
4524
4949
  return this.shimAdapter.ignoreForEmit;
4525
4950
  }
4951
+ /**
4952
+ * Retrieve the array of shim extension prefixes for which shims were created for each original
4953
+ * file.
4954
+ */
4526
4955
  get shimExtensionPrefixes() {
4527
4956
  return this.shimAdapter.extensionPrefixes;
4528
4957
  }
4958
+ /**
4959
+ * Performs cleanup that needs to happen after a `ts.Program` has been created using this host.
4960
+ */
4529
4961
  postProgramCreationCleanup() {
4530
4962
  this.shimTagger.finalize();
4531
4963
  }
4964
+ /**
4965
+ * Create an `NgCompilerHost` from a delegate host, an array of input filenames, and the full set
4966
+ * of TypeScript and Angular compiler options.
4967
+ */
4532
4968
  static wrap(delegate, inputFiles, options, oldProgram) {
4533
4969
  const topLevelShimGenerators = [];
4534
4970
  const perFileShimGenerators = [];
@@ -4563,11 +4999,22 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4563
4999
  }
4564
5000
  const shimAdapter = new ShimAdapter(delegate, normalizedTsInputFiles, topLevelShimGenerators, perFileShimGenerators, oldProgram);
4565
5001
  const shimTagger = new ShimReferenceTagger(perFileShimGenerators.map((gen) => gen.extensionPrefix));
4566
- return new NgCompilerHost(delegate, inputFiles, rootDirs, shimAdapter, shimTagger, entryPoint, diagnostics);
5002
+ return new _NgCompilerHost(delegate, inputFiles, rootDirs, shimAdapter, shimTagger, entryPoint, diagnostics);
4567
5003
  }
5004
+ /**
5005
+ * Check whether the given `ts.SourceFile` is a shim file.
5006
+ *
5007
+ * If this returns false, the file is user-provided.
5008
+ */
4568
5009
  isShim(sf) {
4569
5010
  return isShim(sf);
4570
5011
  }
5012
+ /**
5013
+ * Check whether the given `ts.SourceFile` is a resource file.
5014
+ *
5015
+ * This simply returns `false` for the compiler-cli since resource files are not added as root
5016
+ * files to the project.
5017
+ */
4571
5018
  isResource(sf) {
4572
5019
  return false;
4573
5020
  }
@@ -4600,10 +5047,13 @@ var NgCompilerHost = class extends DelegatingCompilerHost {
4600
5047
  }
4601
5048
  };
4602
5049
 
4603
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.js
5050
+ // packages/compiler-cli/src/ngtsc/program.js
4604
5051
  var NgtscProgram = class {
4605
5052
  options;
4606
5053
  compiler;
5054
+ /**
5055
+ * The primary TypeScript program, which is used for analysis and emit.
5056
+ */
4607
5057
  tsProgram;
4608
5058
  host;
4609
5059
  incrementalStrategy;
@@ -4645,7 +5095,9 @@ var NgtscProgram = class {
4645
5095
  this.incrementalStrategy,
4646
5096
  programDriver,
4647
5097
  perfRecorder,
5098
+ /* enableTemplateTypeChecker */
4648
5099
  false,
5100
+ /* usePoisonedData */
4649
5101
  false
4650
5102
  );
4651
5103
  } else {
@@ -4727,6 +5179,13 @@ var NgtscProgram = class {
4727
5179
  return this.compiler.getDiagnosticsForFile(sf, OptimizeFor.WholeProgram);
4728
5180
  }
4729
5181
  }
5182
+ /**
5183
+ * Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
5184
+ * loading of any resources during the process.
5185
+ *
5186
+ * This is used by the Angular CLI to allow for spawning (async) child compilations for things
5187
+ * like SASS files used in `styleUrls`.
5188
+ */
4730
5189
  loadNgStructureAsync() {
4731
5190
  return this.compiler.analyzeAsync();
4732
5191
  }
@@ -4808,6 +5267,14 @@ var NgtscProgram = class {
4808
5267
  getIndexedComponents() {
4809
5268
  return this.compiler.getIndexedComponents();
4810
5269
  }
5270
+ /**
5271
+ * Gets information for the current program that may be used to generate API
5272
+ * reference documentation. This includes Angular-specific information, such
5273
+ * as component inputs and outputs.
5274
+ *
5275
+ * @param entryPoint Path to the entry point for the package for which API
5276
+ * docs should be extracted.
5277
+ */
4811
5278
  getApiDocumentation(entryPoint, privateModules) {
4812
5279
  return this.compiler.getApiDocumentation(entryPoint, privateModules);
4813
5280
  }
@@ -4828,15 +5295,15 @@ function mergeEmitResults(emitResults) {
4828
5295
  return { diagnostics, emitSkipped, emittedFiles };
4829
5296
  }
4830
5297
 
4831
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.js
5298
+ // packages/compiler-cli/src/transformers/program.js
4832
5299
  function createProgram({ rootNames, options, host, oldProgram }) {
4833
5300
  return new NgtscProgram(rootNames, options, host, oldProgram);
4834
5301
  }
4835
5302
 
4836
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.js
5303
+ // packages/compiler-cli/src/perform_compile.js
4837
5304
  import ts29 from "typescript";
4838
5305
 
4839
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.js
5306
+ // packages/compiler-cli/src/transformers/util.js
4840
5307
  import ts28 from "typescript";
4841
5308
  function createMessageDiagnostic(messageText) {
4842
5309
  return {
@@ -4850,7 +5317,7 @@ function createMessageDiagnostic(messageText) {
4850
5317
  };
4851
5318
  }
4852
5319
 
4853
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.js
5320
+ // packages/compiler-cli/src/perform_compile.js
4854
5321
  var defaultFormatHost = {
4855
5322
  getCurrentDirectory: () => ts29.sys.getCurrentDirectory(),
4856
5323
  getCanonicalFileName: (fileName) => fileName,
@@ -5066,18 +5533,17 @@ export {
5066
5533
  performCompilation,
5067
5534
  defaultGatherDiagnostics
5068
5535
  };
5069
- /*!
5536
+ /**
5070
5537
  * @license
5071
5538
  * Copyright Google LLC All Rights Reserved.
5072
5539
  *
5073
5540
  * Use of this source code is governed by an MIT-style license that can be
5074
5541
  * found in the LICENSE file at https://angular.dev/license
5075
5542
  */
5076
- /**
5543
+ /*!
5077
5544
  * @license
5078
5545
  * Copyright Google LLC All Rights Reserved.
5079
5546
  *
5080
5547
  * Use of this source code is governed by an MIT-style license that can be
5081
5548
  * found in the LICENSE file at https://angular.dev/license
5082
5549
  */
5083
- //# sourceMappingURL=chunk-YNE6T2TY.js.map