@angular/compiler-cli 20.0.0-next.1 → 20.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/bundles/{chunk-QYORKQDN.js → chunk-7HRFJETP.js} +3 -2
  2. package/bundles/{chunk-QYORKQDN.js.map → chunk-7HRFJETP.js.map} +1 -1
  3. package/bundles/{chunk-YSSSYIZJ.js → chunk-B73DMM7T.js} +2 -2
  4. package/bundles/{chunk-PLKJMRGZ.js → chunk-CD575TJ6.js} +276 -205
  5. package/bundles/chunk-CD575TJ6.js.map +6 -0
  6. package/bundles/{chunk-SNXU6YPZ.js → chunk-FVYXSSAL.js} +2 -2
  7. package/bundles/{chunk-SEPXPBD2.js → chunk-PAYJFU4V.js} +3 -3
  8. package/bundles/{chunk-O2OVHMWL.js → chunk-RFDMMGNB.js} +60 -29
  9. package/bundles/chunk-RFDMMGNB.js.map +6 -0
  10. package/bundles/{chunk-UAA7BTBW.js → chunk-SWJRL4N4.js} +3 -3
  11. package/bundles/index.js +6 -6
  12. package/bundles/linker/babel/index.js +2 -2
  13. package/bundles/linker/index.js +2 -2
  14. package/bundles/private/migrations.js +4 -4
  15. package/bundles/private/tooling.js +4 -4
  16. package/bundles/src/bin/ng_xi18n.js +5 -5
  17. package/bundles/src/bin/ngc.js +5 -5
  18. package/bundles_metadata.json +1 -1
  19. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  20. package/package.json +2 -2
  21. package/private/migrations.d.ts +1 -1
  22. package/src/ngtsc/annotations/common/src/evaluation.d.ts +1 -1
  23. package/src/ngtsc/annotations/common/src/util.d.ts +19 -2
  24. package/src/ngtsc/annotations/component/src/metadata.d.ts +2 -2
  25. package/src/ngtsc/annotations/component/src/resources.d.ts +3 -2
  26. package/src/ngtsc/annotations/index.d.ts +1 -1
  27. package/src/ngtsc/core/api/src/options.d.ts +8 -0
  28. package/src/ngtsc/core/src/compiler.d.ts +3 -3
  29. package/src/ngtsc/docs/src/function_extractor.d.ts +1 -1
  30. package/src/ngtsc/hmr/src/update_declaration.d.ts +3 -2
  31. package/src/ngtsc/metadata/index.d.ts +1 -1
  32. package/src/ngtsc/metadata/src/resource_registry.d.ts +9 -8
  33. package/src/ngtsc/typecheck/api/api.d.ts +22 -24
  34. package/src/ngtsc/typecheck/api/checker.d.ts +3 -3
  35. package/src/ngtsc/typecheck/api/context.d.ts +26 -17
  36. package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +2 -2
  37. package/src/ngtsc/typecheck/diagnostics/src/id.d.ts +2 -2
  38. package/src/ngtsc/typecheck/src/checker.d.ts +6 -6
  39. package/src/ngtsc/typecheck/src/completion.d.ts +2 -2
  40. package/src/ngtsc/typecheck/src/context.d.ts +24 -26
  41. package/src/ngtsc/typecheck/src/diagnostics.d.ts +5 -5
  42. package/src/ngtsc/typecheck/src/dom.d.ts +5 -5
  43. package/src/ngtsc/typecheck/src/oob.d.ts +41 -45
  44. package/src/ngtsc/typecheck/src/source.d.ts +11 -11
  45. package/src/ngtsc/typecheck/src/tcb_util.d.ts +15 -15
  46. package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +3 -3
  47. package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -3
  48. package/bundles/chunk-O2OVHMWL.js.map +0 -6
  49. package/bundles/chunk-PLKJMRGZ.js.map +0 -6
  50. /package/bundles/{chunk-YSSSYIZJ.js.map → chunk-B73DMM7T.js.map} +0 -0
  51. /package/bundles/{chunk-SNXU6YPZ.js.map → chunk-FVYXSSAL.js.map} +0 -0
  52. /package/bundles/{chunk-SEPXPBD2.js.map → chunk-PAYJFU4V.js.map} +0 -0
  53. /package/bundles/{chunk-UAA7BTBW.js.map → chunk-SWJRL4N4.js.map} +0 -0
@@ -48,7 +48,7 @@ import {
48
48
  translateStatement,
49
49
  translateType,
50
50
  typeNodeToValueExpr
51
- } from "./chunk-QYORKQDN.js";
51
+ } from "./chunk-7HRFJETP.js";
52
52
  import {
53
53
  PerfCheckpoint,
54
54
  PerfEvent,
@@ -103,8 +103,9 @@ function toR3Reference(origin, ref, context, refEmitter) {
103
103
  function isAngularCore(decorator) {
104
104
  return decorator.import !== null && decorator.import.from === CORE_MODULE;
105
105
  }
106
- function isAngularCoreReference(reference, symbolName) {
107
- return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
106
+ function isAngularCoreReferenceWithPotentialAliasing(reference, symbolName, isCore) {
107
+ var _a;
108
+ return (reference.ownedByModuleGuess === CORE_MODULE || isCore) && ((_a = reference.debugName) == null ? void 0 : _a.replace(/\$\d+$/, "")) === symbolName;
108
109
  }
109
110
  function findAngularDecorator(decorators, name, isCore) {
110
111
  return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
@@ -171,17 +172,19 @@ function tryUnwrapForwardRef(node, reflector) {
171
172
  }
172
173
  return expr;
173
174
  }
174
- var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
175
- if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
176
- return unresolvable;
177
- }
178
- const expanded = expandForwardRef(callExpr.arguments[0]);
179
- if (expanded !== null) {
180
- return resolve(expanded);
181
- } else {
182
- return unresolvable;
183
- }
184
- };
175
+ function createForwardRefResolver(isCore) {
176
+ return (fn, callExpr, resolve, unresolvable) => {
177
+ if (!isAngularCoreReferenceWithPotentialAliasing(fn, "forwardRef", isCore) || callExpr.arguments.length !== 1) {
178
+ return unresolvable;
179
+ }
180
+ const expanded = expandForwardRef(callExpr.arguments[0]);
181
+ if (expanded !== null) {
182
+ return resolve(expanded);
183
+ } else {
184
+ return unresolvable;
185
+ }
186
+ };
187
+ }
185
188
  function combineResolvers(resolvers) {
186
189
  return (fn, callExpr, resolve, unresolvable) => {
187
190
  for (const resolver of resolvers) {
@@ -2097,12 +2100,14 @@ var ResourceRegistry = class {
2097
2100
  }
2098
2101
  return this.externalTemplateToComponentsMap.get(template);
2099
2102
  }
2100
- registerResources(resources, component) {
2103
+ registerResources(resources, directive) {
2101
2104
  if (resources.template !== null) {
2102
- this.registerTemplate(resources.template, component);
2105
+ this.registerTemplate(resources.template, directive);
2103
2106
  }
2104
- for (const style of resources.styles) {
2105
- this.registerStyle(style, component);
2107
+ if (resources.styles !== null) {
2108
+ for (const style of resources.styles) {
2109
+ this.registerStyle(style, directive);
2110
+ }
2106
2111
  }
2107
2112
  }
2108
2113
  registerTemplate(templateResource, component) {
@@ -3513,12 +3518,12 @@ function assertLocalCompilationUnresolvedConst(compilationMode, value, nodeToHig
3513
3518
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
3514
3519
  import { ViewEncapsulation } from "@angular/compiler";
3515
3520
  import ts13 from "typescript";
3516
- function resolveEnumValue(evaluator, metadata, field, enumSymbolName) {
3521
+ function resolveEnumValue(evaluator, metadata, field, enumSymbolName, isCore) {
3517
3522
  let resolved = null;
3518
3523
  if (metadata.has(field)) {
3519
3524
  const expr = metadata.get(field);
3520
3525
  const value = evaluator.evaluate(expr);
3521
- if (value instanceof EnumValue && isAngularCoreReference(value.enumRef, enumSymbolName)) {
3526
+ if (value instanceof EnumValue && isAngularCoreReferenceWithPotentialAliasing(value.enumRef, enumSymbolName, isCore)) {
3522
3527
  resolved = value.resolved;
3523
3528
  } else {
3524
3529
  throw createValueHasWrongTypeError(expr, value, `${field} must be a member of ${enumSymbolName} enum from @angular/core`);
@@ -3777,7 +3782,7 @@ var JitDeclarationRegistry = class {
3777
3782
 
3778
3783
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
3779
3784
  import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector4, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as ExternalExpr8, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, outputAst as o4, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher3, ViewEncapsulation as ViewEncapsulation2 } from "@angular/compiler";
3780
- import ts47 from "typescript";
3785
+ import ts48 from "typescript";
3781
3786
 
3782
3787
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
3783
3788
  import ts15 from "typescript";
@@ -5005,7 +5010,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
5005
5010
  const sourceFile = clazz.getSourceFile();
5006
5011
  const type = wrapTypeReference(reflector, clazz);
5007
5012
  const rawHostDirectives = directive.get("hostDirectives") || null;
5008
- const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, compilationMode);
5013
+ const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, compilationMode, createForwardRefResolver(isCore));
5009
5014
  if (compilationMode !== CompilationMode.LOCAL && hostDirectives !== null) {
5010
5015
  referencesRegistry.add(clazz, ...hostDirectives.map((hostDir) => {
5011
5016
  if (!isHostDirectiveMetaForGlobalMode(hostDir)) {
@@ -5642,7 +5647,7 @@ function getHostBindingErrorNode(error, hostExpr) {
5642
5647
  }
5643
5648
  return hostExpr;
5644
5649
  }
5645
- function extractHostDirectives(rawHostDirectives, evaluator, compilationMode) {
5650
+ function extractHostDirectives(rawHostDirectives, evaluator, compilationMode, forwardRefResolver) {
5646
5651
  const resolved = evaluator.evaluate(rawHostDirectives, forwardRefResolver);
5647
5652
  if (!Array.isArray(resolved)) {
5648
5653
  throw createValueHasWrongTypeError(rawHostDirectives, resolved, "hostDirectives must be an array");
@@ -6238,6 +6243,7 @@ var NgModuleDecoratorHandler = class {
6238
6243
  this.jitDeclarationRegistry.jitDeclarations.add(node);
6239
6244
  return {};
6240
6245
  }
6246
+ const forwardRefResolver = createForwardRefResolver(this.isCore);
6241
6247
  const moduleResolvers = combineResolvers([
6242
6248
  createModuleWithProvidersResolver(this.reflector, this.isCore),
6243
6249
  forwardRefResolver
@@ -6832,6 +6838,42 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
6832
6838
  };
6833
6839
  }
6834
6840
  }
6841
+ function createEmptyTemplate(componentClass, component, containingFile) {
6842
+ const templateUrl = component.get("templateUrl");
6843
+ const template = component.get("template");
6844
+ return {
6845
+ content: "",
6846
+ diagNodes: [],
6847
+ nodes: [],
6848
+ errors: null,
6849
+ styles: [],
6850
+ styleUrls: [],
6851
+ ngContentSelectors: [],
6852
+ file: new ParseSourceFile2("", ""),
6853
+ sourceMapping: templateUrl ? { type: "direct", node: template } : {
6854
+ type: "external",
6855
+ componentClass,
6856
+ node: templateUrl,
6857
+ template: "",
6858
+ templateUrl: "missing.ng.html"
6859
+ },
6860
+ declaration: templateUrl ? {
6861
+ isInline: false,
6862
+ interpolationConfig: InterpolationConfig.fromArray(null),
6863
+ preserveWhitespaces: false,
6864
+ templateUrlExpression: templateUrl,
6865
+ templateUrl: "missing.ng.html",
6866
+ resolvedTemplateUrl: "/missing.ng.html"
6867
+ } : {
6868
+ isInline: true,
6869
+ interpolationConfig: InterpolationConfig.fromArray(null),
6870
+ preserveWhitespaces: false,
6871
+ expression: template,
6872
+ templateUrl: containingFile,
6873
+ resolvedTemplateUrl: containingFile
6874
+ }
6875
+ };
6876
+ }
6835
6877
  function parseExtractedTemplate(template, sourceStr, sourceParseRange, escapedString, sourceMapUrl, options) {
6836
6878
  const i18nNormalizeLineEndingsInICUs = escapedString || options.i18nNormalizeLineEndingsInICUs;
6837
6879
  const commonParseOptions = {
@@ -7575,7 +7617,7 @@ var TsCreateProgramDriver = class {
7575
7617
 
7576
7618
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
7577
7619
  import ts28 from "typescript";
7578
- function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
7620
+ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText, relatedMessages) {
7579
7621
  var _a;
7580
7622
  if (mapping.type === "direct") {
7581
7623
  let relatedInformation = void 0;
@@ -7598,8 +7640,8 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
7598
7640
  category,
7599
7641
  messageText,
7600
7642
  file: mapping.node.getSourceFile(),
7601
- componentFile: mapping.node.getSourceFile(),
7602
- templateId,
7643
+ sourceFile: mapping.node.getSourceFile(),
7644
+ typeCheckId: id,
7603
7645
  start: span.start.offset,
7604
7646
  length: span.end.offset - span.start.offset,
7605
7647
  relatedInformation
@@ -7632,8 +7674,8 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
7632
7674
  code,
7633
7675
  messageText: addDiagnosticChain(messageText, [failureChain]),
7634
7676
  file: componentSf,
7635
- componentFile: componentSf,
7636
- templateId,
7677
+ sourceFile: componentSf,
7678
+ typeCheckId: id,
7637
7679
  start: mapping.node.getStart(),
7638
7680
  length: mapping.node.getEnd() - mapping.node.getStart(),
7639
7681
  relatedInformation
@@ -7653,8 +7695,8 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
7653
7695
  code,
7654
7696
  messageText,
7655
7697
  file: sf,
7656
- componentFile: componentSf,
7657
- templateId,
7698
+ sourceFile: componentSf,
7699
+ typeCheckId: id,
7658
7700
  start: span.start.offset,
7659
7701
  length: span.end.offset - span.start.offset,
7660
7702
  relatedInformation
@@ -7685,16 +7727,16 @@ function parseTemplateAsSourceFile(fileName, template) {
7685
7727
  }
7686
7728
 
7687
7729
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
7688
- var TEMPLATE_ID_MAP = Symbol("ngTemplateId");
7689
- function getTemplateId(clazz) {
7730
+ var TYPE_CHECK_ID_MAP = Symbol("TypeCheckId");
7731
+ function getTypeCheckId(clazz) {
7690
7732
  const sf = clazz.getSourceFile();
7691
- if (sf[TEMPLATE_ID_MAP] === void 0) {
7692
- sf[TEMPLATE_ID_MAP] = /* @__PURE__ */ new Map();
7733
+ if (sf[TYPE_CHECK_ID_MAP] === void 0) {
7734
+ sf[TYPE_CHECK_ID_MAP] = /* @__PURE__ */ new Map();
7693
7735
  }
7694
- if (sf[TEMPLATE_ID_MAP].get(clazz) === void 0) {
7695
- sf[TEMPLATE_ID_MAP].set(clazz, `tcb${sf[TEMPLATE_ID_MAP].size + 1}`);
7736
+ if (sf[TYPE_CHECK_ID_MAP].get(clazz) === void 0) {
7737
+ sf[TYPE_CHECK_ID_MAP].set(clazz, `tcb${sf[TYPE_CHECK_ID_MAP].size + 1}`);
7696
7738
  }
7697
- return sf[TEMPLATE_ID_MAP].get(clazz);
7739
+ return sf[TYPE_CHECK_ID_MAP].get(clazz);
7698
7740
  }
7699
7741
 
7700
7742
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
@@ -9059,7 +9101,7 @@ var RegistryDomSchemaChecker = class {
9059
9101
  checkElement(id, element, schemas, hostIsStandalone) {
9060
9102
  const name = element.name.replace(REMOVE_XHTML_REGEX, "");
9061
9103
  if (!REGISTRY.hasElement(name, schemas)) {
9062
- const mapping = this.resolver.getSourceMapping(id);
9104
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9063
9105
  const schemas2 = `'${hostIsStandalone ? "@Component" : "@NgModule"}.schemas'`;
9064
9106
  let errorMsg = `'${name}' is not a known element:
9065
9107
  `;
@@ -9076,7 +9118,7 @@ var RegistryDomSchemaChecker = class {
9076
9118
  }
9077
9119
  checkProperty(id, element, name, span, schemas, hostIsStandalone) {
9078
9120
  if (!REGISTRY.hasProperty(element.name, name, schemas)) {
9079
- const mapping = this.resolver.getSourceMapping(id);
9121
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9080
9122
  const decorator = hostIsStandalone ? "@Component" : "@NgModule";
9081
9123
  const schemas2 = `'${decorator}.schemas'`;
9082
9124
  let errorMsg = `Can't bind to '${name}' since it isn't a known property of '${element.name}'.`;
@@ -9326,22 +9368,22 @@ function requiresInlineTypeCheckBlock(ref, env, usedPipes, reflector) {
9326
9368
  return TcbInliningRequirement.None;
9327
9369
  }
9328
9370
  }
9329
- function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
9371
+ function getSourceMapping(shimSf, position, resolver, isDiagnosticRequest) {
9330
9372
  const node = getTokenAtPosition(shimSf, position);
9331
9373
  const sourceLocation = findSourceLocation(node, shimSf, isDiagnosticRequest);
9332
9374
  if (sourceLocation === null) {
9333
9375
  return null;
9334
9376
  }
9335
- const mapping = resolver.getSourceMapping(sourceLocation.id);
9336
- const span = resolver.toParseSourceSpan(sourceLocation.id, sourceLocation.span);
9377
+ const mapping = resolver.getTemplateSourceMapping(sourceLocation.id);
9378
+ const span = resolver.toTemplateParseSourceSpan(sourceLocation.id, sourceLocation.span);
9337
9379
  if (span === null) {
9338
9380
  return null;
9339
9381
  }
9340
- return { sourceLocation, templateSourceMapping: mapping, span };
9382
+ return { sourceLocation, sourceMapping: mapping, span };
9341
9383
  }
9342
9384
  function findTypeCheckBlock(file, id, isDiagnosticRequest) {
9343
9385
  for (const stmt of file.statements) {
9344
- if (ts34.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
9386
+ if (ts34.isFunctionDeclaration(stmt) && getTemplateId(stmt, file, isDiagnosticRequest) === id) {
9345
9387
  return stmt;
9346
9388
  }
9347
9389
  }
@@ -9354,7 +9396,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
9354
9396
  }
9355
9397
  const span = readSpanComment(node, sourceFile);
9356
9398
  if (span !== null) {
9357
- const id = getTemplateId2(node, sourceFile, isDiagnosticsRequest);
9399
+ const id = getTemplateId(node, sourceFile, isDiagnosticsRequest);
9358
9400
  if (id === null) {
9359
9401
  return null;
9360
9402
  }
@@ -9364,7 +9406,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
9364
9406
  }
9365
9407
  return null;
9366
9408
  }
9367
- function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
9409
+ function getTemplateId(node, sourceFile, isDiagnosticRequest) {
9368
9410
  while (!ts34.isFunctionDeclaration(node)) {
9369
9411
  if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
9370
9412
  return null;
@@ -9606,53 +9648,53 @@ var OutOfBandDiagnosticRecorderImpl = class {
9606
9648
  get diagnostics() {
9607
9649
  return this._diagnostics;
9608
9650
  }
9609
- missingReferenceTarget(templateId, ref) {
9610
- const mapping = this.resolver.getSourceMapping(templateId);
9651
+ missingReferenceTarget(id, ref) {
9652
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9611
9653
  const value = ref.value.trim();
9612
9654
  const errorMsg = `No directive found with exportAs '${value}'.`;
9613
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
9655
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
9614
9656
  }
9615
- missingPipe(templateId, ast) {
9657
+ missingPipe(id, ast) {
9616
9658
  if (this.recordedPipes.has(ast)) {
9617
9659
  return;
9618
9660
  }
9619
- const mapping = this.resolver.getSourceMapping(templateId);
9661
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9620
9662
  const errorMsg = `No pipe found with name '${ast.name}'.`;
9621
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, ast.nameSpan);
9663
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, ast.nameSpan);
9622
9664
  if (sourceSpan === null) {
9623
9665
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
9624
9666
  }
9625
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
9667
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
9626
9668
  this.recordedPipes.add(ast);
9627
9669
  }
9628
- deferredPipeUsedEagerly(templateId, ast) {
9670
+ deferredPipeUsedEagerly(id, ast) {
9629
9671
  if (this.recordedPipes.has(ast)) {
9630
9672
  return;
9631
9673
  }
9632
- const mapping = this.resolver.getSourceMapping(templateId);
9674
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9633
9675
  const errorMsg = `Pipe '${ast.name}' was imported via \`@Component.deferredImports\`, but was used outside of a \`@defer\` block in a template. To fix this, either use the '${ast.name}' pipe inside of a \`@defer\` block or import this dependency using the \`@Component.imports\` field.`;
9634
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, ast.nameSpan);
9676
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, ast.nameSpan);
9635
9677
  if (sourceSpan === null) {
9636
9678
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
9637
9679
  }
9638
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
9680
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
9639
9681
  this.recordedPipes.add(ast);
9640
9682
  }
9641
- deferredComponentUsedEagerly(templateId, element) {
9642
- const mapping = this.resolver.getSourceMapping(templateId);
9683
+ deferredComponentUsedEagerly(id, element) {
9684
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9643
9685
  const errorMsg = `Element '${element.name}' contains a component or a directive that was imported via \`@Component.deferredImports\`, but the element itself is located outside of a \`@defer\` block in a template. To fix this, either use the '${element.name}' element inside of a \`@defer\` block or import referenced component/directive dependency using the \`@Component.imports\` field.`;
9644
9686
  const { start, end } = element.startSourceSpan;
9645
9687
  const absoluteSourceSpan = new AbsoluteSourceSpan2(start.offset, end.offset);
9646
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, absoluteSourceSpan);
9688
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, absoluteSourceSpan);
9647
9689
  if (sourceSpan === null) {
9648
9690
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
9649
9691
  }
9650
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
9692
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
9651
9693
  }
9652
- duplicateTemplateVar(templateId, variable, firstDecl) {
9653
- const mapping = this.resolver.getSourceMapping(templateId);
9694
+ duplicateTemplateVar(id, variable, firstDecl) {
9695
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9654
9696
  const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
9655
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
9697
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
9656
9698
  {
9657
9699
  text: `The variable '${firstDecl.name}' was first declared here.`,
9658
9700
  start: firstDecl.sourceSpan.start.offset,
@@ -9661,20 +9703,20 @@ var OutOfBandDiagnosticRecorderImpl = class {
9661
9703
  }
9662
9704
  ]));
9663
9705
  }
9664
- requiresInlineTcb(templateId, node) {
9665
- this._diagnostics.push(makeInlineDiagnostic(templateId, ErrorCode.INLINE_TCB_REQUIRED, node.name, `This component requires inline template type-checking, which is not supported by the current environment.`));
9706
+ requiresInlineTcb(id, node) {
9707
+ this._diagnostics.push(makeInlineDiagnostic(id, ErrorCode.INLINE_TCB_REQUIRED, node.name, `This component requires inline template type-checking, which is not supported by the current environment.`));
9666
9708
  }
9667
- requiresInlineTypeConstructors(templateId, node, directives) {
9709
+ requiresInlineTypeConstructors(id, node, directives) {
9668
9710
  let message;
9669
9711
  if (directives.length > 1) {
9670
9712
  message = `This component uses directives which require inline type constructors, which are not supported by the current environment.`;
9671
9713
  } else {
9672
9714
  message = `This component uses a directive which requires an inline type constructor, which is not supported by the current environment.`;
9673
9715
  }
9674
- this._diagnostics.push(makeInlineDiagnostic(templateId, ErrorCode.INLINE_TYPE_CTOR_REQUIRED, node.name, message, directives.map((dir) => makeRelatedInformation(dir.name, `Requires an inline type constructor.`))));
9716
+ this._diagnostics.push(makeInlineDiagnostic(id, ErrorCode.INLINE_TYPE_CTOR_REQUIRED, node.name, message, directives.map((dir) => makeRelatedInformation(dir.name, `Requires an inline type constructor.`))));
9675
9717
  }
9676
- suboptimalTypeInference(templateId, variables) {
9677
- const mapping = this.resolver.getSourceMapping(templateId);
9718
+ suboptimalTypeInference(id, variables) {
9719
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9678
9720
  let diagnosticVar = null;
9679
9721
  for (const variable of variables) {
9680
9722
  if (diagnosticVar === null || variable.value === "" || variable.value === "$implicit") {
@@ -9693,10 +9735,10 @@ var OutOfBandDiagnosticRecorderImpl = class {
9693
9735
  const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
9694
9736
 
9695
9737
  Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
9696
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts37.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
9738
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts37.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
9697
9739
  }
9698
- splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
9699
- const mapping = this.resolver.getSourceMapping(templateId);
9740
+ splitTwoWayBinding(id, input, output, inputConsumer, outputConsumer) {
9741
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9700
9742
  const errorMsg = `The property and event halves of the two-way binding '${input.name}' are not bound to the same target.
9701
9743
  Find more at https://angular.dev/guide/templates/two-way-binding#how-two-way-binding-works`;
9702
9744
  const relatedMessages = [];
@@ -9727,22 +9769,22 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
9727
9769
  sourceFile: outputConsumer.name.getSourceFile()
9728
9770
  });
9729
9771
  }
9730
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
9772
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
9731
9773
  }
9732
- missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
9774
+ missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
9733
9775
  const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
9734
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
9776
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), element.startSourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
9735
9777
  }
9736
- illegalForLoopTrackAccess(templateId, block, access) {
9737
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, access.sourceSpan);
9778
+ illegalForLoopTrackAccess(id, block, access) {
9779
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
9738
9780
  if (sourceSpan === null) {
9739
9781
  throw new Error(`Assertion failure: no SourceLocation found for property read.`);
9740
9782
  }
9741
9783
  const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
9742
9784
  const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
9743
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
9785
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
9744
9786
  }
9745
- inaccessibleDeferredTriggerElement(templateId, trigger) {
9787
+ inaccessibleDeferredTriggerElement(id, trigger) {
9746
9788
  let message;
9747
9789
  if (trigger.reference === null) {
9748
9790
  message = `Trigger cannot find reference. Make sure that the @defer block has a @placeholder with at least one root element node.`;
@@ -9751,9 +9793,9 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
9751
9793
  Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
9752
9794
  Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
9753
9795
  }
9754
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
9796
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
9755
9797
  }
9756
- controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
9798
+ controlFlowPreventingContentProjection(id, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
9757
9799
  const blockName = controlFlowNode.nameSpan.toString().trim();
9758
9800
  const lines = [
9759
9801
  `Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
@@ -9766,33 +9808,33 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
9766
9808
  lines.push("Note: the host component has `preserveWhitespaces: true` which may cause whitespace to affect content projection.");
9767
9809
  }
9768
9810
  lines.push("", 'This check can be disabled using the `extendedDiagnostics.checks.controlFlowPreventingContentProjection = "suppress" compiler option.`');
9769
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), projectionNode.startSourceSpan, category, ngErrorCode(ErrorCode.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION), lines.join("\n")));
9811
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), projectionNode.startSourceSpan, category, ngErrorCode(ErrorCode.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION), lines.join("\n")));
9770
9812
  }
9771
- illegalWriteToLetDeclaration(templateId, node, target) {
9772
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
9813
+ illegalWriteToLetDeclaration(id, node, target) {
9814
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
9773
9815
  if (sourceSpan === null) {
9774
9816
  throw new Error(`Assertion failure: no SourceLocation found for property write.`);
9775
9817
  }
9776
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
9818
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
9777
9819
  }
9778
- letUsedBeforeDefinition(templateId, node, target) {
9779
- const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
9820
+ letUsedBeforeDefinition(id, node, target) {
9821
+ const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
9780
9822
  if (sourceSpan === null) {
9781
9823
  throw new Error(`Assertion failure: no SourceLocation found for property read.`);
9782
9824
  }
9783
- this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
9825
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
9784
9826
  }
9785
- conflictingDeclaration(templateId, decl) {
9786
- const mapping = this.resolver.getSourceMapping(templateId);
9827
+ conflictingDeclaration(id, decl) {
9828
+ const mapping = this.resolver.getTemplateSourceMapping(id);
9787
9829
  const errorMsg = `Cannot declare @let called '${decl.name}' as there is another symbol in the template with the same name.`;
9788
- this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, decl.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
9830
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts37.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
9789
9831
  }
9790
9832
  };
9791
- function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
9833
+ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
9792
9834
  return {
9793
9835
  ...makeDiagnostic(code, node, messageText, relatedInformation),
9794
- componentFile: node.getSourceFile(),
9795
- templateId
9836
+ sourceFile: node.getSourceFile(),
9837
+ typeCheckId: id
9796
9838
  };
9797
9839
  }
9798
9840
 
@@ -9839,7 +9881,7 @@ function addParseSpanInfo(node, span) {
9839
9881
  false
9840
9882
  );
9841
9883
  }
9842
- function addTemplateId(tcb, id) {
9884
+ function addTypeCheckId(tcb, id) {
9843
9885
  ts39.addSyntheticLeadingComment(tcb, ts39.SyntaxKind.MultiLineCommentTrivia, id, true);
9844
9886
  }
9845
9887
  function shouldReportDiagnostic(diagnostic) {
@@ -9859,7 +9901,7 @@ function translateDiagnostic(diagnostic, resolver) {
9859
9901
  if (diagnostic.file === void 0 || diagnostic.start === void 0) {
9860
9902
  return null;
9861
9903
  }
9862
- const fullMapping = getTemplateMapping(
9904
+ const fullMapping = getSourceMapping(
9863
9905
  diagnostic.file,
9864
9906
  diagnostic.start,
9865
9907
  resolver,
@@ -9868,7 +9910,7 @@ function translateDiagnostic(diagnostic, resolver) {
9868
9910
  if (fullMapping === null) {
9869
9911
  return null;
9870
9912
  }
9871
- const { sourceLocation, templateSourceMapping, span } = fullMapping;
9913
+ const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
9872
9914
  return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
9873
9915
  }
9874
9916
 
@@ -10161,6 +10203,9 @@ var AstTranslator = class {
10161
10203
  visitTaggedTemplateLiteral(ast) {
10162
10204
  return ts40.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
10163
10205
  }
10206
+ visitParenthesizedExpression(ast) {
10207
+ return ts40.factory.createParenthesizedExpression(this.translate(ast.expression));
10208
+ }
10164
10209
  convertToSafeCall(ast, expr, args) {
10165
10210
  if (this.config.strictSafeNavigationTypes) {
10166
10211
  const call = ts40.factory.createCallExpression(ts40.factory.createNonNullExpression(expr), void 0, args);
@@ -10255,6 +10300,9 @@ var _VeSafeLhsInferenceBugDetector = class {
10255
10300
  visitTaggedTemplateLiteral(ast, context) {
10256
10301
  return false;
10257
10302
  }
10303
+ visitParenthesizedExpression(ast, context) {
10304
+ return ast.expression.visit(this);
10305
+ }
10258
10306
  };
10259
10307
  var VeSafeLhsInferenceBugDetector = _VeSafeLhsInferenceBugDetector;
10260
10308
  __publicField(VeSafeLhsInferenceBugDetector, "SINGLETON", new _VeSafeLhsInferenceBugDetector());
@@ -10308,7 +10356,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
10308
10356
  void 0,
10309
10357
  body
10310
10358
  );
10311
- addTemplateId(fnDecl, meta.id);
10359
+ addTypeCheckId(fnDecl, meta.id);
10312
10360
  return fnDecl;
10313
10361
  }
10314
10362
  var TcbOp = class {
@@ -11272,7 +11320,7 @@ var Context = class {
11272
11320
  return ts41.factory.createIdentifier(`_t${this.nextId++}`);
11273
11321
  }
11274
11322
  getPipeByName(name) {
11275
- if (!this.pipes.has(name)) {
11323
+ if (this.pipes === null || !this.pipes.has(name)) {
11276
11324
  return null;
11277
11325
  }
11278
11326
  return this.pipes.get(name);
@@ -12032,18 +12080,19 @@ var TypeCheckContextImpl = class {
12032
12080
  }
12033
12081
  opMap = /* @__PURE__ */ new Map();
12034
12082
  typeCtorPending = /* @__PURE__ */ new Set();
12035
- addTemplate(ref, binder, template, pipes, schemas, sourceMapping, file, parseErrors, isStandalone, preserveWhitespaces) {
12036
- if (!this.host.shouldCheckComponent(ref.node)) {
12083
+ addDirective(ref, binder, schemas, templateContext, isStandalone) {
12084
+ var _a;
12085
+ if (!this.host.shouldCheckClass(ref.node)) {
12037
12086
  return;
12038
12087
  }
12039
12088
  const fileData = this.dataForFile(ref.node.getSourceFile());
12040
- const shimData = this.pendingShimForComponent(ref.node);
12041
- const templateId = fileData.sourceManager.getTemplateId(ref.node);
12042
- const templateDiagnostics = [];
12043
- if (parseErrors !== null) {
12044
- templateDiagnostics.push(...getTemplateDiagnostics(parseErrors, templateId, sourceMapping));
12089
+ const shimData = this.pendingShimForClass(ref.node);
12090
+ const id = fileData.sourceManager.getTypeCheckId(ref.node);
12091
+ const templateParsingDiagnostics = [];
12092
+ if (templateContext !== null && templateContext.parseErrors !== null) {
12093
+ templateParsingDiagnostics.push(...getTemplateDiagnostics(templateContext.parseErrors, id, templateContext.sourceMapping));
12045
12094
  }
12046
- const boundTarget = binder.bind({ template });
12095
+ const boundTarget = binder.bind({ template: templateContext == null ? void 0 : templateContext.nodes });
12047
12096
  if (this.inlining === InliningMode.InlineOps) {
12048
12097
  for (const dir of boundTarget.getUsedDirectives()) {
12049
12098
  const dirRef = dir.ref;
@@ -12062,31 +12111,35 @@ var TypeCheckContextImpl = class {
12062
12111
  });
12063
12112
  }
12064
12113
  }
12065
- shimData.templates.set(templateId, {
12066
- template,
12114
+ shimData.data.set(id, {
12115
+ template: (templateContext == null ? void 0 : templateContext.nodes) || null,
12067
12116
  boundTarget,
12068
- templateDiagnostics
12117
+ templateParsingDiagnostics
12069
12118
  });
12070
12119
  const usedPipes = [];
12071
- for (const name of boundTarget.getUsedPipes()) {
12072
- if (!pipes.has(name)) {
12073
- continue;
12120
+ if (templateContext !== null) {
12121
+ for (const name of boundTarget.getUsedPipes()) {
12122
+ if (templateContext.pipes.has(name)) {
12123
+ usedPipes.push(templateContext.pipes.get(name).ref);
12124
+ }
12074
12125
  }
12075
- usedPipes.push(pipes.get(name).ref);
12076
12126
  }
12077
12127
  const inliningRequirement = requiresInlineTypeCheckBlock(ref, shimData.file, usedPipes, this.reflector);
12078
12128
  if (this.inlining === InliningMode.Error && inliningRequirement === TcbInliningRequirement.MustInline) {
12079
- shimData.oobRecorder.requiresInlineTcb(templateId, ref.node);
12129
+ shimData.oobRecorder.requiresInlineTcb(id, ref.node);
12080
12130
  this.perf.eventCount(PerfEvent.SkipGenerateTcbNoInline);
12081
12131
  return;
12082
12132
  }
12133
+ if (templateContext !== null) {
12134
+ fileData.sourceManager.captureTemplateSource(id, templateContext.sourceMapping, templateContext.file);
12135
+ }
12083
12136
  const meta = {
12084
- id: fileData.sourceManager.captureSource(ref.node, sourceMapping, file),
12137
+ id,
12085
12138
  boundTarget,
12086
- pipes,
12139
+ pipes: (templateContext == null ? void 0 : templateContext.pipes) || null,
12087
12140
  schemas,
12088
12141
  isStandalone,
12089
- preserveWhitespaces
12142
+ preserveWhitespaces: (_a = templateContext == null ? void 0 : templateContext.preserveWhitespaces) != null ? _a : false
12090
12143
  };
12091
12144
  this.perf.eventCount(PerfEvent.GenerateTcb);
12092
12145
  if (inliningRequirement !== TcbInliningRequirement.None && this.inlining === InliningMode.InlineOps) {
@@ -12172,7 +12225,7 @@ var TypeCheckContextImpl = class {
12172
12225
  ],
12173
12226
  hasInlines: pendingFileData.hasInlines,
12174
12227
  path: pendingShimData.file.fileName,
12175
- templates: pendingShimData.templates
12228
+ data: pendingShimData.data
12176
12229
  });
12177
12230
  const sfText = pendingShimData.file.render(false);
12178
12231
  updates.set(pendingShimData.file.fileName, {
@@ -12192,7 +12245,7 @@ var TypeCheckContextImpl = class {
12192
12245
  ops.push(new InlineTcbOp(ref, tcbMeta, this.config, this.reflector, shimData.domSchemaChecker, shimData.oobRecorder));
12193
12246
  fileData.hasInlines = true;
12194
12247
  }
12195
- pendingShimForComponent(node) {
12248
+ pendingShimForClass(node) {
12196
12249
  const fileData = this.dataForFile(node.getSourceFile());
12197
12250
  const shimPath = TypeCheckShimGenerator.shimFor(absoluteFromSourceFile(node.getSourceFile()));
12198
12251
  if (!fileData.shimData.has(shimPath)) {
@@ -12200,7 +12253,7 @@ var TypeCheckContextImpl = class {
12200
12253
  domSchemaChecker: new RegistryDomSchemaChecker(fileData.sourceManager),
12201
12254
  oobRecorder: new OutOfBandDiagnosticRecorderImpl(fileData.sourceManager),
12202
12255
  file: new TypeCheckFile(shimPath, this.config, this.refEmitter, this.reflector, this.compilerHost),
12203
- templates: /* @__PURE__ */ new Map()
12256
+ data: /* @__PURE__ */ new Map()
12204
12257
  });
12205
12258
  }
12206
12259
  return fileData.shimData.get(shimPath);
@@ -12341,23 +12394,21 @@ var TemplateSource = class {
12341
12394
  return this.lineStarts;
12342
12395
  }
12343
12396
  };
12344
- var TemplateSourceManager = class {
12397
+ var DirectiveSourceManager = class {
12345
12398
  templateSources = /* @__PURE__ */ new Map();
12346
- getTemplateId(node) {
12347
- return getTemplateId(node);
12399
+ getTypeCheckId(node) {
12400
+ return getTypeCheckId(node);
12348
12401
  }
12349
- captureSource(node, mapping, file) {
12350
- const id = getTemplateId(node);
12402
+ captureTemplateSource(id, mapping, file) {
12351
12403
  this.templateSources.set(id, new TemplateSource(mapping, file));
12352
- return id;
12353
12404
  }
12354
- getSourceMapping(id) {
12405
+ getTemplateSourceMapping(id) {
12355
12406
  if (!this.templateSources.has(id)) {
12356
- throw new Error(`Unexpected unknown template ID: ${id}`);
12407
+ throw new Error(`Unexpected unknown type check ID: ${id}`);
12357
12408
  }
12358
12409
  return this.templateSources.get(id).mapping;
12359
12410
  }
12360
- toParseSourceSpan(id, span) {
12411
+ toTemplateParseSourceSpan(id, span) {
12361
12412
  if (!this.templateSources.has(id)) {
12362
12413
  return null;
12363
12414
  }
@@ -12373,15 +12424,15 @@ var SymbolBuilder = class {
12373
12424
  tcbPath;
12374
12425
  tcbIsShim;
12375
12426
  typeCheckBlock;
12376
- templateData;
12427
+ typeCheckData;
12377
12428
  componentScopeReader;
12378
12429
  getTypeChecker;
12379
12430
  symbolCache = /* @__PURE__ */ new Map();
12380
- constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
12431
+ constructor(tcbPath, tcbIsShim, typeCheckBlock, typeCheckData, componentScopeReader, getTypeChecker) {
12381
12432
  this.tcbPath = tcbPath;
12382
12433
  this.tcbIsShim = tcbIsShim;
12383
12434
  this.typeCheckBlock = typeCheckBlock;
12384
- this.templateData = templateData;
12435
+ this.typeCheckData = typeCheckData;
12385
12436
  this.componentScopeReader = componentScopeReader;
12386
12437
  this.getTypeChecker = getTypeChecker;
12387
12438
  }
@@ -12511,12 +12562,12 @@ var SymbolBuilder = class {
12511
12562
  }
12512
12563
  getDirectiveMeta(host, directiveDeclaration) {
12513
12564
  var _a;
12514
- let directives = this.templateData.boundTarget.getDirectivesOfNode(host);
12565
+ let directives = this.typeCheckData.boundTarget.getDirectivesOfNode(host);
12515
12566
  const firstChild = host.children[0];
12516
12567
  if (firstChild instanceof TmplAstElement3) {
12517
12568
  const isMicrosyntaxTemplate = host instanceof TmplAstTemplate2 && sourceSpanEqual(firstChild.sourceSpan, host.sourceSpan);
12518
12569
  if (isMicrosyntaxTemplate) {
12519
- const firstChildDirectives = this.templateData.boundTarget.getDirectivesOfNode(firstChild);
12570
+ const firstChildDirectives = this.typeCheckData.boundTarget.getDirectivesOfNode(firstChild);
12520
12571
  if (firstChildDirectives !== null && directives !== null) {
12521
12572
  directives = directives.concat(firstChildDirectives);
12522
12573
  } else {
@@ -12537,7 +12588,7 @@ var SymbolBuilder = class {
12537
12588
  return scope.ngModule;
12538
12589
  }
12539
12590
  getSymbolOfBoundEvent(eventBinding) {
12540
- const consumer = this.templateData.boundTarget.getConsumerOfBinding(eventBinding);
12591
+ const consumer = this.typeCheckData.boundTarget.getConsumerOfBinding(eventBinding);
12541
12592
  if (consumer === null) {
12542
12593
  return null;
12543
12594
  }
@@ -12623,7 +12674,7 @@ var SymbolBuilder = class {
12623
12674
  return { kind: SymbolKind.Output, bindings };
12624
12675
  }
12625
12676
  getSymbolOfInputBinding(binding) {
12626
- const consumer = this.templateData.boundTarget.getConsumerOfBinding(binding);
12677
+ const consumer = this.typeCheckData.boundTarget.getConsumerOfBinding(binding);
12627
12678
  if (consumer === null) {
12628
12679
  return null;
12629
12680
  }
@@ -12743,7 +12794,7 @@ var SymbolBuilder = class {
12743
12794
  };
12744
12795
  }
12745
12796
  getSymbolOfReference(ref) {
12746
- const target = this.templateData.boundTarget.getReferenceTarget(ref);
12797
+ const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
12747
12798
  let node = findFirstMatchingNode(this.typeCheckBlock, {
12748
12799
  withSpan: ref.sourceSpan,
12749
12800
  filter: ts44.isVariableDeclaration
@@ -12848,7 +12899,7 @@ var SymbolBuilder = class {
12848
12899
  if (expression instanceof ASTWithSource2) {
12849
12900
  expression = expression.ast;
12850
12901
  }
12851
- const expressionTarget = this.templateData.boundTarget.getExpressionTarget(expression);
12902
+ const expressionTarget = this.typeCheckData.boundTarget.getExpressionTarget(expression);
12852
12903
  if (expressionTarget !== null) {
12853
12904
  return this.getSymbol(expressionTarget);
12854
12905
  }
@@ -13018,9 +13069,8 @@ var TemplateTypeCheckerImpl = class {
13018
13069
  if (!fileRecord.shimData.has(shimPath)) {
13019
13070
  return { data: null, tcb: null, tcbPath: shimPath, tcbIsShim: true };
13020
13071
  }
13021
- const templateId = fileRecord.sourceManager.getTemplateId(component);
13072
+ const id = fileRecord.sourceManager.getTypeCheckId(component);
13022
13073
  const shimRecord = fileRecord.shimData.get(shimPath);
13023
- const id = fileRecord.sourceManager.getTemplateId(component);
13024
13074
  const program = this.programDriver.getProgram();
13025
13075
  const shimSf = getSourceFileOrNull(program, shimPath);
13026
13076
  if (shimSf === null || !fileRecord.shimData.has(shimPath)) {
@@ -13036,8 +13086,8 @@ var TemplateTypeCheckerImpl = class {
13036
13086
  }
13037
13087
  }
13038
13088
  let data = null;
13039
- if (shimRecord.templates.has(templateId)) {
13040
- data = shimRecord.templates.get(templateId);
13089
+ if (shimRecord.data.has(id)) {
13090
+ data = shimRecord.data.get(id);
13041
13091
  }
13042
13092
  return { data, tcb, tcbPath, tcbIsShim: tcbPath === shimPath };
13043
13093
  }
@@ -13067,7 +13117,7 @@ var TemplateTypeCheckerImpl = class {
13067
13117
  }
13068
13118
  return null;
13069
13119
  }
13070
- getTemplateMappingAtTcbLocation(tcbLocation) {
13120
+ getSourceMappingAtTcbLocation(tcbLocation) {
13071
13121
  const fileRecord = this.getFileRecordForTcbLocation(tcbLocation);
13072
13122
  if (fileRecord === null) {
13073
13123
  return null;
@@ -13076,7 +13126,7 @@ var TemplateTypeCheckerImpl = class {
13076
13126
  if (shimSf === void 0) {
13077
13127
  return null;
13078
13128
  }
13079
- return getTemplateMapping(
13129
+ return getSourceMapping(
13080
13130
  shimSf,
13081
13131
  tcbLocation.positionInFile,
13082
13132
  fileRecord.sourceManager,
@@ -13108,8 +13158,8 @@ var TemplateTypeCheckerImpl = class {
13108
13158
  const shimSf = getSourceFileOrError(typeCheckProgram, shimPath);
13109
13159
  diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map((diag) => convertDiagnostic(diag, fileRecord.sourceManager)));
13110
13160
  diagnostics.push(...shimRecord.genesisDiagnostics);
13111
- for (const templateData of shimRecord.templates.values()) {
13112
- diagnostics.push(...templateData.templateDiagnostics);
13161
+ for (const templateData of shimRecord.data.values()) {
13162
+ diagnostics.push(...templateData.templateParsingDiagnostics);
13113
13163
  }
13114
13164
  }
13115
13165
  return diagnostics.filter((diag) => diag !== null);
@@ -13125,7 +13175,7 @@ var TemplateTypeCheckerImpl = class {
13125
13175
  if (!fileRecord.shimData.has(shimPath)) {
13126
13176
  return [];
13127
13177
  }
13128
- const templateId = fileRecord.sourceManager.getTemplateId(component);
13178
+ const id = fileRecord.sourceManager.getTypeCheckId(component);
13129
13179
  const shimRecord = fileRecord.shimData.get(shimPath);
13130
13180
  const typeCheckProgram = this.programDriver.getProgram();
13131
13181
  const diagnostics = [];
@@ -13136,10 +13186,10 @@ var TemplateTypeCheckerImpl = class {
13136
13186
  const shimSf = getSourceFileOrError(typeCheckProgram, shimPath);
13137
13187
  diagnostics.push(...typeCheckProgram.getSemanticDiagnostics(shimSf).map((diag) => convertDiagnostic(diag, fileRecord.sourceManager)));
13138
13188
  diagnostics.push(...shimRecord.genesisDiagnostics);
13139
- for (const templateData of shimRecord.templates.values()) {
13140
- diagnostics.push(...templateData.templateDiagnostics);
13189
+ for (const templateData of shimRecord.data.values()) {
13190
+ diagnostics.push(...templateData.templateParsingDiagnostics);
13141
13191
  }
13142
- return diagnostics.filter((diag) => diag !== null && diag.templateId === templateId);
13192
+ return diagnostics.filter((diag) => diag !== null && diag.typeCheckId === id);
13143
13193
  });
13144
13194
  }
13145
13195
  getTypeCheckBlock(component) {
@@ -13175,7 +13225,7 @@ var TemplateTypeCheckerImpl = class {
13175
13225
  const sfPath = absoluteFromSourceFile(sf);
13176
13226
  const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
13177
13227
  const fileData = this.getFileData(sfPath);
13178
- const templateId = fileData.sourceManager.getTemplateId(clazz);
13228
+ const id = fileData.sourceManager.getTypeCheckId(clazz);
13179
13229
  fileData.shimData.delete(shimPath);
13180
13230
  fileData.isComplete = false;
13181
13231
  this.isComplete = false;
@@ -13187,10 +13237,10 @@ var TemplateTypeCheckerImpl = class {
13187
13237
  makeTemplateDiagnostic(clazz, sourceSpan, category, errorCode, message, relatedInformation) {
13188
13238
  const sfPath = absoluteFromSourceFile(clazz.getSourceFile());
13189
13239
  const fileRecord = this.state.get(sfPath);
13190
- const templateId = fileRecord.sourceManager.getTemplateId(clazz);
13191
- const mapping = fileRecord.sourceManager.getSourceMapping(templateId);
13240
+ const id = fileRecord.sourceManager.getTypeCheckId(clazz);
13241
+ const mapping = fileRecord.sourceManager.getTemplateSourceMapping(id);
13192
13242
  return {
13193
- ...makeTemplateDiagnostic(templateId, mapping, sourceSpan, category, ngErrorCode(errorCode), message, relatedInformation),
13243
+ ...makeTemplateDiagnostic(id, mapping, sourceSpan, category, ngErrorCode(errorCode), message, relatedInformation),
13194
13244
  __ngCode: errorCode
13195
13245
  };
13196
13246
  }
@@ -13308,7 +13358,7 @@ var TemplateTypeCheckerImpl = class {
13308
13358
  if (!this.state.has(path)) {
13309
13359
  this.state.set(path, {
13310
13360
  hasInlines: false,
13311
- sourceManager: new TemplateSourceManager(),
13361
+ sourceManager: new DirectiveSourceManager(),
13312
13362
  isComplete: false,
13313
13363
  shimData: /* @__PURE__ */ new Map()
13314
13364
  });
@@ -13596,7 +13646,7 @@ var WholeProgramTypeCheckingHost = class {
13596
13646
  getSourceManager(sfPath) {
13597
13647
  return this.impl.getFileData(sfPath).sourceManager;
13598
13648
  }
13599
- shouldCheckComponent(node) {
13649
+ shouldCheckClass(node) {
13600
13650
  const sfPath = absoluteFromSourceFile(node.getSourceFile());
13601
13651
  const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
13602
13652
  const fileData = this.impl.getFileData(sfPath);
@@ -13632,7 +13682,7 @@ var SingleFileTypeCheckingHost = class {
13632
13682
  this.assertPath(sfPath);
13633
13683
  return this.fileData.sourceManager;
13634
13684
  }
13635
- shouldCheckComponent(node) {
13685
+ shouldCheckClass(node) {
13636
13686
  if (this.sfPath !== absoluteFromSourceFile(node.getSourceFile())) {
13637
13687
  return false;
13638
13688
  }
@@ -13683,7 +13733,7 @@ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, c
13683
13733
  var _a, _b;
13684
13734
  const name = ts45.isClassDeclaration(node) && node.name ? node.name.text : null;
13685
13735
  const visitor = new PotentialTopLevelReadsVisitor();
13686
- const sourceFile = node.getSourceFile();
13736
+ const sourceFile = ts45.getOriginalNode(node).getSourceFile();
13687
13737
  definition.expression.visitExpression(visitor, null);
13688
13738
  definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
13689
13739
  (_a = factory.initializer) == null ? void 0 : _a.visitExpression(visitor, null);
@@ -13889,11 +13939,12 @@ function isConstEnumReference(node, reflection) {
13889
13939
  }
13890
13940
 
13891
13941
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/metadata.mjs
13942
+ import ts46 from "typescript";
13892
13943
  function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13893
13944
  if (!reflection.isClass(clazz)) {
13894
13945
  return null;
13895
13946
  }
13896
- const sourceFile = clazz.getSourceFile();
13947
+ const sourceFile = ts46.getOriginalNode(clazz).getSourceFile();
13897
13948
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
13898
13949
  const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
13899
13950
  if (dependencies === null) {
@@ -13911,8 +13962,8 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
13911
13962
 
13912
13963
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.mjs
13913
13964
  import { compileHmrUpdateCallback } from "@angular/compiler";
13914
- import ts46 from "typescript";
13915
- function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, sourceFile) {
13965
+ import ts47 from "typescript";
13966
+ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
13916
13967
  const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
13917
13968
  result.set(current.moduleName, current.assignedName);
13918
13969
  return result;
@@ -13923,10 +13974,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, s
13923
13974
  rewriter: importRewriter
13924
13975
  });
13925
13976
  const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
13977
+ const sourceFile = ts47.getOriginalNode(declaration).getSourceFile();
13926
13978
  const node = translateStatement(sourceFile, callback, importManager);
13927
- return ts46.factory.updateFunctionDeclaration(node, [
13928
- ts46.factory.createToken(ts46.SyntaxKind.ExportKeyword),
13929
- ts46.factory.createToken(ts46.SyntaxKind.DefaultKeyword)
13979
+ return ts47.factory.updateFunctionDeclaration(node, [
13980
+ ts47.factory.createToken(ts47.SyntaxKind.ExportKeyword),
13981
+ ts47.factory.createToken(ts47.SyntaxKind.DefaultKeyword)
13930
13982
  ], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
13931
13983
  }
13932
13984
  var HmrModuleImportRewriter = class {
@@ -14151,10 +14203,10 @@ var ComponentDecoratorHandler = class {
14151
14203
  return {};
14152
14204
  }
14153
14205
  const { decorator: component, metadata, inputs, outputs, hostDirectives, rawHostDirectives } = directiveResult;
14154
- const encapsulation = (_a = this.compilationMode !== CompilationMode.LOCAL ? resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation") : resolveEncapsulationEnumValueLocally(component.get("encapsulation"))) != null ? _a : ViewEncapsulation2.Emulated;
14206
+ const encapsulation = (_a = this.compilationMode !== CompilationMode.LOCAL ? resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation", this.isCore) : resolveEncapsulationEnumValueLocally(component.get("encapsulation"))) != null ? _a : ViewEncapsulation2.Emulated;
14155
14207
  let changeDetection = null;
14156
14208
  if (this.compilationMode !== CompilationMode.LOCAL) {
14157
- changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy");
14209
+ changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy", this.isCore);
14158
14210
  } else if (component.has("changeDetection")) {
14159
14211
  changeDetection = new o4.WrappedNodeExpr(component.get("changeDetection"));
14160
14212
  }
@@ -14202,7 +14254,7 @@ var ComponentDecoratorHandler = class {
14202
14254
  } else if (this.compilationMode !== CompilationMode.LOCAL && (rawImports || rawDeferredImports)) {
14203
14255
  const importResolvers = combineResolvers([
14204
14256
  createModuleWithProvidersResolver(this.reflector, this.isCore),
14205
- forwardRefResolver
14257
+ createForwardRefResolver(this.isCore)
14206
14258
  ]);
14207
14259
  const importDiagnostics = [];
14208
14260
  if (rawImports) {
@@ -14246,31 +14298,42 @@ var ComponentDecoratorHandler = class {
14246
14298
  this.preanalyzeTemplateCache.delete(node);
14247
14299
  template = preanalyzed;
14248
14300
  } else {
14249
- const templateDecl = parseTemplateDeclaration(node, decorator, component, containingFile, this.evaluator, this.depTracker, this.resourceLoader, this.defaultPreserveWhitespaces);
14250
- template = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, {
14251
- enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
14252
- i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
14253
- usePoisonedData: this.usePoisonedData,
14254
- enableBlockSyntax: this.enableBlockSyntax,
14255
- enableLetSyntax: this.enableLetSyntax,
14256
- preserveSignificantWhitespace: this.i18nPreserveSignificantWhitespace
14257
- }, this.compilationMode);
14258
- if (this.compilationMode === CompilationMode.LOCAL && template.errors && template.errors.length > 0) {
14259
- if (diagnostics === void 0) {
14260
- diagnostics = [];
14301
+ try {
14302
+ const templateDecl = parseTemplateDeclaration(node, decorator, component, containingFile, this.evaluator, this.depTracker, this.resourceLoader, this.defaultPreserveWhitespaces);
14303
+ template = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, {
14304
+ enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
14305
+ i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
14306
+ usePoisonedData: this.usePoisonedData,
14307
+ enableBlockSyntax: this.enableBlockSyntax,
14308
+ enableLetSyntax: this.enableLetSyntax,
14309
+ preserveSignificantWhitespace: this.i18nPreserveSignificantWhitespace
14310
+ }, this.compilationMode);
14311
+ if (this.compilationMode === CompilationMode.LOCAL && template.errors && template.errors.length > 0) {
14312
+ if (diagnostics === void 0) {
14313
+ diagnostics = [];
14314
+ }
14315
+ diagnostics.push(...getTemplateDiagnostics(
14316
+ template.errors,
14317
+ "",
14318
+ template.sourceMapping
14319
+ ));
14320
+ }
14321
+ } catch (e) {
14322
+ if (e instanceof FatalDiagnosticError) {
14323
+ diagnostics != null ? diagnostics : diagnostics = [];
14324
+ diagnostics.push(e.toDiagnostic());
14325
+ isPoisoned = true;
14326
+ template = createEmptyTemplate(node, component, containingFile);
14327
+ } else {
14328
+ throw e;
14261
14329
  }
14262
- diagnostics.push(...getTemplateDiagnostics(
14263
- template.errors,
14264
- "",
14265
- template.sourceMapping
14266
- ));
14267
14330
  }
14268
14331
  }
14269
14332
  const templateResource = template.declaration.isInline ? { path: null, expression: component.get("template") } : {
14270
14333
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
14271
14334
  expression: template.sourceMapping.node
14272
14335
  };
14273
- const relativeTemplatePath = getProjectRelativePath((_d = templateResource.path) != null ? _d : ts47.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
14336
+ const relativeTemplatePath = getProjectRelativePath((_d = templateResource.path) != null ? _d : ts48.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
14274
14337
  let styles = [];
14275
14338
  const externalStyles = [];
14276
14339
  const styleResources = extractInlineStyleResources(component);
@@ -14285,7 +14348,7 @@ var ComponentDecoratorHandler = class {
14285
14348
  externalStyles.push(resourceUrl);
14286
14349
  continue;
14287
14350
  }
14288
- if (styleUrl.source === 2 && ts47.isStringLiteralLike(styleUrl.expression)) {
14351
+ if (styleUrl.source === 2 && ts48.isStringLiteralLike(styleUrl.expression)) {
14289
14352
  styleResources.add({
14290
14353
  path: absoluteFrom(resourceUrl),
14291
14354
  expression: styleUrl.expression
@@ -14488,7 +14551,7 @@ var ComponentDecoratorHandler = class {
14488
14551
  }
14489
14552
  typeCheck(ctx, node, meta) {
14490
14553
  var _a;
14491
- if (this.typeCheckScopeRegistry === null || !ts47.isClassDeclaration(node)) {
14554
+ if (this.typeCheckScopeRegistry === null || !ts48.isClassDeclaration(node)) {
14492
14555
  return;
14493
14556
  }
14494
14557
  if (meta.isPoisoned && !this.usePoisonedData) {
@@ -14499,7 +14562,15 @@ var ComponentDecoratorHandler = class {
14499
14562
  return;
14500
14563
  }
14501
14564
  const binder = new R3TargetBinder(scope.matcher);
14502
- ctx.addTemplate(new Reference(node), binder, meta.template.diagNodes, scope.pipes, scope.schemas, meta.template.sourceMapping, meta.template.file, meta.template.errors, meta.meta.isStandalone, (_a = meta.meta.template.preserveWhitespaces) != null ? _a : false);
14565
+ const templateContext = {
14566
+ nodes: meta.template.diagNodes,
14567
+ pipes: scope.pipes,
14568
+ sourceMapping: meta.template.sourceMapping,
14569
+ file: meta.template.file,
14570
+ parseErrors: meta.template.errors,
14571
+ preserveWhitespaces: (_a = meta.meta.template.preserveWhitespaces) != null ? _a : false
14572
+ };
14573
+ ctx.addDirective(new Reference(node), binder, scope.schemas, templateContext, meta.meta.isStandalone);
14503
14574
  }
14504
14575
  extendedTemplateCheck(component, extendedTemplateChecker) {
14505
14576
  return extendedTemplateChecker.getDiagnosticsForComponent(component);
@@ -14879,7 +14950,7 @@ var ComponentDecoratorHandler = class {
14879
14950
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14880
14951
  const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14881
14952
  const res = compileResults(fac, def, classMetadata, "\u0275cmp", null, null, debugInfo, null);
14882
- return hmrMeta === null || res.length === 0 ? null : getHmrUpdateDeclaration(res, pool.statements, hmrMeta, node.getSourceFile());
14953
+ return hmrMeta === null || res.length === 0 ? null : getHmrUpdateDeclaration(res, pool.statements, hmrMeta, node);
14883
14954
  }
14884
14955
  locateDeferBlocksWithoutScope(template) {
14885
14956
  const deferBlocks = /* @__PURE__ */ new Map();
@@ -14914,12 +14985,12 @@ var ComponentDecoratorHandler = class {
14914
14985
  }
14915
14986
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
14916
14987
  const deferredTypes = /* @__PURE__ */ new Map();
14917
- if (!ts47.isArrayLiteralExpression(rawDeferredImports)) {
14988
+ if (!ts48.isArrayLiteralExpression(rawDeferredImports)) {
14918
14989
  return deferredTypes;
14919
14990
  }
14920
14991
  for (const element of rawDeferredImports.elements) {
14921
14992
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
14922
- if (!ts47.isIdentifier(node)) {
14993
+ if (!ts48.isIdentifier(node)) {
14923
14994
  continue;
14924
14995
  }
14925
14996
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -14986,12 +15057,12 @@ var ComponentDecoratorHandler = class {
14986
15057
  }
14987
15058
  }
14988
15059
  registerDeferrableCandidates(componentClassDecl, importsExpr, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
14989
- if (!ts47.isArrayLiteralExpression(importsExpr)) {
15060
+ if (!ts48.isArrayLiteralExpression(importsExpr)) {
14990
15061
  return;
14991
15062
  }
14992
15063
  for (const element of importsExpr.elements) {
14993
15064
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
14994
- if (!ts47.isIdentifier(node)) {
15065
+ if (!ts48.isIdentifier(node)) {
14995
15066
  continue;
14996
15067
  }
14997
15068
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -15125,7 +15196,7 @@ function isDefaultImport(node) {
15125
15196
 
15126
15197
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
15127
15198
  import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
15128
- import ts48 from "typescript";
15199
+ import ts49 from "typescript";
15129
15200
  var InjectableDecoratorHandler = class {
15130
15201
  reflector;
15131
15202
  evaluator;
@@ -15254,7 +15325,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
15254
15325
  };
15255
15326
  } else if (decorator.args.length === 1) {
15256
15327
  const metaNode = decorator.args[0];
15257
- if (!ts48.isObjectLiteralExpression(metaNode)) {
15328
+ if (!ts49.isObjectLiteralExpression(metaNode)) {
15258
15329
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
15259
15330
  }
15260
15331
  const meta = reflectObjectLiteral(metaNode);
@@ -15262,7 +15333,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
15262
15333
  let deps = void 0;
15263
15334
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
15264
15335
  const depsExpr = meta.get("deps");
15265
- if (!ts48.isArrayLiteralExpression(depsExpr)) {
15336
+ if (!ts49.isArrayLiteralExpression(depsExpr)) {
15266
15337
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
15267
15338
  }
15268
15339
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -15347,12 +15418,12 @@ function getDep(dep, reflector) {
15347
15418
  }
15348
15419
  return true;
15349
15420
  }
15350
- if (ts48.isArrayLiteralExpression(dep)) {
15421
+ if (ts49.isArrayLiteralExpression(dep)) {
15351
15422
  dep.elements.forEach((el) => {
15352
15423
  let isDecorator = false;
15353
- if (ts48.isIdentifier(el)) {
15424
+ if (ts49.isIdentifier(el)) {
15354
15425
  isDecorator = maybeUpdateDecorator(el, reflector);
15355
- } else if (ts48.isNewExpression(el) && ts48.isIdentifier(el.expression)) {
15426
+ } else if (ts49.isNewExpression(el) && ts49.isIdentifier(el.expression)) {
15356
15427
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
15357
15428
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
15358
15429
  }
@@ -15366,7 +15437,7 @@ function getDep(dep, reflector) {
15366
15437
 
15367
15438
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
15368
15439
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
15369
- import ts49 from "typescript";
15440
+ import ts50 from "typescript";
15370
15441
  var PipeSymbol = class extends SemanticSymbol {
15371
15442
  name;
15372
15443
  constructor(decl, name) {
@@ -15439,7 +15510,7 @@ var PipeDecoratorHandler = class {
15439
15510
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
15440
15511
  }
15441
15512
  const meta = unwrapExpression(decorator.args[0]);
15442
- if (!ts49.isObjectLiteralExpression(meta)) {
15513
+ if (!ts50.isObjectLiteralExpression(meta)) {
15443
15514
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
15444
15515
  }
15445
15516
  const pipe = reflectObjectLiteral(meta);
@@ -15542,7 +15613,7 @@ var PipeDecoratorHandler = class {
15542
15613
  export {
15543
15614
  isAngularDecorator,
15544
15615
  getAngularDecorators,
15545
- forwardRefResolver,
15616
+ createForwardRefResolver,
15546
15617
  MetaKind,
15547
15618
  CompoundMetadataReader,
15548
15619
  DtsMetadataReader,
@@ -15612,4 +15683,4 @@ export {
15612
15683
  * Use of this source code is governed by an MIT-style license that can be
15613
15684
  * found in the LICENSE file at https://angular.dev/license
15614
15685
  */
15615
- //# sourceMappingURL=chunk-PLKJMRGZ.js.map
15686
+ //# sourceMappingURL=chunk-CD575TJ6.js.map