@angular/compiler-cli 20.1.2 → 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.
@@ -5576,22 +5576,24 @@ var PerfPhase;
5576
5576
  PerfPhase2[PerfPhase2["Compile"] = 12] = "Compile";
5577
5577
  PerfPhase2[PerfPhase2["TtcAutocompletion"] = 13] = "TtcAutocompletion";
5578
5578
  PerfPhase2[PerfPhase2["TtcDiagnostics"] = 14] = "TtcDiagnostics";
5579
- PerfPhase2[PerfPhase2["TtcSymbol"] = 15] = "TtcSymbol";
5580
- PerfPhase2[PerfPhase2["LsReferencesAndRenames"] = 16] = "LsReferencesAndRenames";
5581
- PerfPhase2[PerfPhase2["LsQuickInfo"] = 17] = "LsQuickInfo";
5582
- PerfPhase2[PerfPhase2["LsDefinition"] = 18] = "LsDefinition";
5583
- PerfPhase2[PerfPhase2["LsCompletions"] = 19] = "LsCompletions";
5584
- PerfPhase2[PerfPhase2["LsTcb"] = 20] = "LsTcb";
5585
- PerfPhase2[PerfPhase2["LsDiagnostics"] = 21] = "LsDiagnostics";
5586
- PerfPhase2[PerfPhase2["LsComponentLocations"] = 22] = "LsComponentLocations";
5587
- PerfPhase2[PerfPhase2["LsSignatureHelp"] = 23] = "LsSignatureHelp";
5588
- PerfPhase2[PerfPhase2["OutliningSpans"] = 24] = "OutliningSpans";
5589
- PerfPhase2[PerfPhase2["LsCodeFixes"] = 25] = "LsCodeFixes";
5590
- PerfPhase2[PerfPhase2["LsCodeFixesAll"] = 26] = "LsCodeFixesAll";
5591
- PerfPhase2[PerfPhase2["LSComputeApplicableRefactorings"] = 27] = "LSComputeApplicableRefactorings";
5592
- PerfPhase2[PerfPhase2["LSApplyRefactoring"] = 28] = "LSApplyRefactoring";
5593
- PerfPhase2[PerfPhase2["LSSemanticClassification"] = 29] = "LSSemanticClassification";
5594
- PerfPhase2[PerfPhase2["LAST"] = 30] = "LAST";
5579
+ PerfPhase2[PerfPhase2["TtcSuggestionDiagnostics"] = 15] = "TtcSuggestionDiagnostics";
5580
+ PerfPhase2[PerfPhase2["TtcSymbol"] = 16] = "TtcSymbol";
5581
+ PerfPhase2[PerfPhase2["LsReferencesAndRenames"] = 17] = "LsReferencesAndRenames";
5582
+ PerfPhase2[PerfPhase2["LsQuickInfo"] = 18] = "LsQuickInfo";
5583
+ PerfPhase2[PerfPhase2["LsDefinition"] = 19] = "LsDefinition";
5584
+ PerfPhase2[PerfPhase2["LsCompletions"] = 20] = "LsCompletions";
5585
+ PerfPhase2[PerfPhase2["LsTcb"] = 21] = "LsTcb";
5586
+ PerfPhase2[PerfPhase2["LsDiagnostics"] = 22] = "LsDiagnostics";
5587
+ PerfPhase2[PerfPhase2["LsSuggestionDiagnostics"] = 23] = "LsSuggestionDiagnostics";
5588
+ PerfPhase2[PerfPhase2["LsComponentLocations"] = 24] = "LsComponentLocations";
5589
+ PerfPhase2[PerfPhase2["LsSignatureHelp"] = 25] = "LsSignatureHelp";
5590
+ PerfPhase2[PerfPhase2["OutliningSpans"] = 26] = "OutliningSpans";
5591
+ PerfPhase2[PerfPhase2["LsCodeFixes"] = 27] = "LsCodeFixes";
5592
+ PerfPhase2[PerfPhase2["LsCodeFixesAll"] = 28] = "LsCodeFixesAll";
5593
+ PerfPhase2[PerfPhase2["LSComputeApplicableRefactorings"] = 29] = "LSComputeApplicableRefactorings";
5594
+ PerfPhase2[PerfPhase2["LSApplyRefactoring"] = 30] = "LSApplyRefactoring";
5595
+ PerfPhase2[PerfPhase2["LSSemanticClassification"] = 31] = "LSSemanticClassification";
5596
+ PerfPhase2[PerfPhase2["LAST"] = 32] = "LAST";
5595
5597
  })(PerfPhase || (PerfPhase = {}));
5596
5598
  var PerfEvent;
5597
5599
  (function(PerfEvent2) {
@@ -9910,6 +9912,262 @@ function isBaseClassEqual(current, previous) {
9910
9912
 
9911
9913
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
9912
9914
  import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
9915
+
9916
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
9917
+ import ts45 from "typescript";
9918
+
9919
+ // packages/compiler-cli/src/ngtsc/typecheck/src/comments.js
9920
+ import { AbsoluteSourceSpan } from "@angular/compiler";
9921
+ import ts44 from "typescript";
9922
+ var parseSpanComment = /^(\d+),(\d+)$/;
9923
+ function readSpanComment(node, sourceFile = node.getSourceFile()) {
9924
+ return ts44.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
9925
+ if (kind !== ts44.SyntaxKind.MultiLineCommentTrivia) {
9926
+ return null;
9927
+ }
9928
+ const commentText = sourceFile.text.substring(pos + 2, end - 2);
9929
+ const match = commentText.match(parseSpanComment);
9930
+ if (match === null) {
9931
+ return null;
9932
+ }
9933
+ return new AbsoluteSourceSpan(+match[1], +match[2]);
9934
+ }) || null;
9935
+ }
9936
+ var CommentTriviaType;
9937
+ (function(CommentTriviaType2) {
9938
+ CommentTriviaType2["DIAGNOSTIC"] = "D";
9939
+ CommentTriviaType2["EXPRESSION_TYPE_IDENTIFIER"] = "T";
9940
+ })(CommentTriviaType || (CommentTriviaType = {}));
9941
+ var ExpressionIdentifier;
9942
+ (function(ExpressionIdentifier2) {
9943
+ ExpressionIdentifier2["DIRECTIVE"] = "DIR";
9944
+ ExpressionIdentifier2["COMPONENT_COMPLETION"] = "COMPCOMP";
9945
+ ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
9946
+ ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
9947
+ })(ExpressionIdentifier || (ExpressionIdentifier = {}));
9948
+ function addExpressionIdentifier(node, identifier) {
9949
+ ts44.addSyntheticTrailingComment(
9950
+ node,
9951
+ ts44.SyntaxKind.MultiLineCommentTrivia,
9952
+ `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
9953
+ /* hasTrailingNewLine */
9954
+ false
9955
+ );
9956
+ }
9957
+ var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
9958
+ function markIgnoreDiagnostics(node) {
9959
+ ts44.addSyntheticTrailingComment(
9960
+ node,
9961
+ ts44.SyntaxKind.MultiLineCommentTrivia,
9962
+ IGNORE_FOR_DIAGNOSTICS_MARKER,
9963
+ /* hasTrailingNewLine */
9964
+ false
9965
+ );
9966
+ }
9967
+ function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
9968
+ return ts44.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
9969
+ if (kind !== ts44.SyntaxKind.MultiLineCommentTrivia) {
9970
+ return null;
9971
+ }
9972
+ const commentText = sourceFile.text.substring(pos + 2, end - 2);
9973
+ return commentText === IGNORE_FOR_DIAGNOSTICS_MARKER;
9974
+ }) === true;
9975
+ }
9976
+ function makeRecursiveVisitor(visitor) {
9977
+ function recursiveVisitor(node) {
9978
+ const res = visitor(node);
9979
+ return res !== null ? res : node.forEachChild(recursiveVisitor);
9980
+ }
9981
+ return recursiveVisitor;
9982
+ }
9983
+ function getSpanFromOptions(opts) {
9984
+ let withSpan = null;
9985
+ if (opts.withSpan !== void 0) {
9986
+ if (opts.withSpan instanceof AbsoluteSourceSpan) {
9987
+ withSpan = opts.withSpan;
9988
+ } else {
9989
+ withSpan = { start: opts.withSpan.start.offset, end: opts.withSpan.end.offset };
9990
+ }
9991
+ }
9992
+ return withSpan;
9993
+ }
9994
+ function findFirstMatchingNode(tcb, opts) {
9995
+ const withSpan = getSpanFromOptions(opts);
9996
+ const withExpressionIdentifier = opts.withExpressionIdentifier;
9997
+ const sf = tcb.getSourceFile();
9998
+ const visitor = makeRecursiveVisitor((node) => {
9999
+ if (!opts.filter(node)) {
10000
+ return null;
10001
+ }
10002
+ if (withSpan !== null) {
10003
+ const comment = readSpanComment(node, sf);
10004
+ if (comment === null || withSpan.start !== comment.start || withSpan.end !== comment.end) {
10005
+ return null;
10006
+ }
10007
+ }
10008
+ if (withExpressionIdentifier !== void 0 && !hasExpressionIdentifier(sf, node, withExpressionIdentifier)) {
10009
+ return null;
10010
+ }
10011
+ return node;
10012
+ });
10013
+ return tcb.forEachChild(visitor) ?? null;
10014
+ }
10015
+ function findAllMatchingNodes(tcb, opts) {
10016
+ const withSpan = getSpanFromOptions(opts);
10017
+ const withExpressionIdentifier = opts.withExpressionIdentifier;
10018
+ const results = [];
10019
+ const stack = [tcb];
10020
+ const sf = tcb.getSourceFile();
10021
+ while (stack.length > 0) {
10022
+ const node = stack.pop();
10023
+ if (!opts.filter(node)) {
10024
+ stack.push(...node.getChildren());
10025
+ continue;
10026
+ }
10027
+ if (withSpan !== null) {
10028
+ const comment = readSpanComment(node, sf);
10029
+ if (comment === null || withSpan.start !== comment.start || withSpan.end !== comment.end) {
10030
+ stack.push(...node.getChildren());
10031
+ continue;
10032
+ }
10033
+ }
10034
+ if (withExpressionIdentifier !== void 0 && !hasExpressionIdentifier(sf, node, withExpressionIdentifier)) {
10035
+ continue;
10036
+ }
10037
+ results.push(node);
10038
+ }
10039
+ return results;
10040
+ }
10041
+ function hasExpressionIdentifier(sourceFile, node, identifier) {
10042
+ return ts44.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
10043
+ if (kind !== ts44.SyntaxKind.MultiLineCommentTrivia) {
10044
+ return false;
10045
+ }
10046
+ const commentText = sourceFile.text.substring(pos + 2, end - 2);
10047
+ return commentText === `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`;
10048
+ }) || false;
10049
+ }
10050
+
10051
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
10052
+ var SAFE_TO_CAST_WITHOUT_PARENS = null;
10053
+ function tsCastToAny(expr) {
10054
+ if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
10055
+ SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
10056
+ // Expressions which are already parenthesized can be cast without further wrapping.
10057
+ ts45.SyntaxKind.ParenthesizedExpression,
10058
+ // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
10059
+ ts45.SyntaxKind.Identifier,
10060
+ ts45.SyntaxKind.CallExpression,
10061
+ ts45.SyntaxKind.NonNullExpression,
10062
+ ts45.SyntaxKind.ElementAccessExpression,
10063
+ ts45.SyntaxKind.PropertyAccessExpression,
10064
+ ts45.SyntaxKind.ArrayLiteralExpression,
10065
+ ts45.SyntaxKind.ObjectLiteralExpression,
10066
+ // The same goes for various literals.
10067
+ ts45.SyntaxKind.StringLiteral,
10068
+ ts45.SyntaxKind.NumericLiteral,
10069
+ ts45.SyntaxKind.TrueKeyword,
10070
+ ts45.SyntaxKind.FalseKeyword,
10071
+ ts45.SyntaxKind.NullKeyword,
10072
+ ts45.SyntaxKind.UndefinedKeyword
10073
+ ]);
10074
+ }
10075
+ if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
10076
+ expr = ts45.factory.createParenthesizedExpression(expr);
10077
+ }
10078
+ return ts45.factory.createParenthesizedExpression(ts45.factory.createAsExpression(expr, ts45.factory.createKeywordTypeNode(ts45.SyntaxKind.AnyKeyword)));
10079
+ }
10080
+ function tsCreateElement(...tagNames) {
10081
+ const createElement = ts45.factory.createPropertyAccessExpression(
10082
+ /* expression */
10083
+ ts45.factory.createIdentifier("document"),
10084
+ "createElement"
10085
+ );
10086
+ let arg;
10087
+ if (tagNames.length === 1) {
10088
+ arg = ts45.factory.createStringLiteral(tagNames[0]);
10089
+ } else {
10090
+ const assertedNullExpression = ts45.factory.createNonNullExpression(ts45.factory.createNull());
10091
+ const type = ts45.factory.createUnionTypeNode(tagNames.map((tag) => ts45.factory.createLiteralTypeNode(ts45.factory.createStringLiteral(tag))));
10092
+ arg = ts45.factory.createAsExpression(assertedNullExpression, type);
10093
+ }
10094
+ return ts45.factory.createCallExpression(
10095
+ /* expression */
10096
+ createElement,
10097
+ /* typeArguments */
10098
+ void 0,
10099
+ /* argumentsArray */
10100
+ [arg]
10101
+ );
10102
+ }
10103
+ function tsDeclareVariable(id, type) {
10104
+ addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
10105
+ const initializer = ts45.factory.createAsExpression(ts45.factory.createNonNullExpression(ts45.factory.createNull()), type);
10106
+ const decl = ts45.factory.createVariableDeclaration(
10107
+ /* name */
10108
+ id,
10109
+ /* exclamationToken */
10110
+ void 0,
10111
+ /* type */
10112
+ void 0,
10113
+ /* initializer */
10114
+ initializer
10115
+ );
10116
+ return ts45.factory.createVariableStatement(
10117
+ /* modifiers */
10118
+ void 0,
10119
+ /* declarationList */
10120
+ [decl]
10121
+ );
10122
+ }
10123
+ function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
10124
+ return ts45.factory.createTypeQueryNode(ts45.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
10125
+ }
10126
+ function tsCreateVariable(id, initializer, flags = null) {
10127
+ const decl = ts45.factory.createVariableDeclaration(
10128
+ /* name */
10129
+ id,
10130
+ /* exclamationToken */
10131
+ void 0,
10132
+ /* type */
10133
+ void 0,
10134
+ /* initializer */
10135
+ initializer
10136
+ );
10137
+ return ts45.factory.createVariableStatement(
10138
+ /* modifiers */
10139
+ void 0,
10140
+ /* declarationList */
10141
+ flags === null ? [decl] : ts45.factory.createVariableDeclarationList([decl], flags)
10142
+ );
10143
+ }
10144
+ function tsCallMethod(receiver, methodName, args = []) {
10145
+ const methodAccess = ts45.factory.createPropertyAccessExpression(receiver, methodName);
10146
+ return ts45.factory.createCallExpression(
10147
+ /* expression */
10148
+ methodAccess,
10149
+ /* typeArguments */
10150
+ void 0,
10151
+ /* argumentsArray */
10152
+ args
10153
+ );
10154
+ }
10155
+ function isAccessExpression(node) {
10156
+ return ts45.isPropertyAccessExpression(node) || ts45.isElementAccessExpression(node);
10157
+ }
10158
+ function tsNumericExpression2(value) {
10159
+ if (value < 0) {
10160
+ const operand = ts45.factory.createNumericLiteral(Math.abs(value));
10161
+ return ts45.factory.createPrefixUnaryExpression(ts45.SyntaxKind.MinusToken, operand);
10162
+ }
10163
+ return ts45.factory.createNumericLiteral(value);
10164
+ }
10165
+ function isDirectiveDeclaration(node) {
10166
+ const sourceFile = node.getSourceFile();
10167
+ return (ts45.isTypeNode(node) || ts45.isIdentifier(node)) && ts45.isVariableDeclaration(node.parent) && hasExpressionIdentifier(sourceFile, node, ExpressionIdentifier.DIRECTIVE);
10168
+ }
10169
+
10170
+ // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
9913
10171
  import ts64 from "typescript";
9914
10172
 
9915
10173
  // packages/compiler-cli/src/ngtsc/program_driver/src/api.js
@@ -9921,10 +10179,10 @@ var UpdateMode;
9921
10179
  })(UpdateMode || (UpdateMode = {}));
9922
10180
 
9923
10181
  // packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.js
9924
- import ts45 from "typescript";
10182
+ import ts47 from "typescript";
9925
10183
 
9926
10184
  // packages/compiler-cli/src/ngtsc/shims/src/adapter.js
9927
- import ts44 from "typescript";
10185
+ import ts46 from "typescript";
9928
10186
 
9929
10187
  // packages/compiler-cli/src/ngtsc/shims/src/expando.js
9930
10188
  var NgExtension = Symbol("NgExtension");
@@ -10095,10 +10353,10 @@ var ShimAdapter = class {
10095
10353
  }
10096
10354
  const prefix = match[1];
10097
10355
  let baseFileName = absoluteFrom(prefix + ".ts");
10098
- let inputFile = this.delegate.getSourceFile(baseFileName, ts44.ScriptTarget.Latest);
10356
+ let inputFile = this.delegate.getSourceFile(baseFileName, ts46.ScriptTarget.Latest);
10099
10357
  if (inputFile === void 0) {
10100
10358
  baseFileName = absoluteFrom(prefix + ".tsx");
10101
- inputFile = this.delegate.getSourceFile(baseFileName, ts44.ScriptTarget.Latest);
10359
+ inputFile = this.delegate.getSourceFile(baseFileName, ts46.ScriptTarget.Latest);
10102
10360
  }
10103
10361
  if (inputFile === void 0 || isShim(inputFile)) {
10104
10362
  return void 0;
@@ -10328,7 +10586,7 @@ var TsCreateProgramDriver = class {
10328
10586
  this.sfMap.clear();
10329
10587
  }
10330
10588
  for (const [filePath, { newText, originalFile }] of contents.entries()) {
10331
- const sf = ts45.createSourceFile(filePath, newText, ts45.ScriptTarget.Latest, true);
10589
+ const sf = ts47.createSourceFile(filePath, newText, ts47.ScriptTarget.Latest, true);
10332
10590
  if (originalFile !== null) {
10333
10591
  sf[NgOriginalFile] = originalFile;
10334
10592
  }
@@ -10337,7 +10595,7 @@ var TsCreateProgramDriver = class {
10337
10595
  const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
10338
10596
  const oldProgram = this.program;
10339
10597
  retagAllTsFiles(oldProgram);
10340
- this.program = ts45.createProgram({
10598
+ this.program = ts47.createProgram({
10341
10599
  host,
10342
10600
  rootNames: this.program.getRootFileNames(),
10343
10601
  options: this.options,
@@ -10349,15 +10607,14 @@ var TsCreateProgramDriver = class {
10349
10607
  };
10350
10608
 
10351
10609
  // packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.js
10352
- import ts46 from "typescript";
10353
- function makeTemplateDiagnostic(id, mapping, span, category, code, messageText, relatedMessages) {
10610
+ import ts48 from "typescript";
10611
+ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText, relatedMessages, deprecatedDiagInfo) {
10354
10612
  if (mapping.type === "direct") {
10355
- let relatedInformation = void 0;
10613
+ let relatedInformation = [];
10356
10614
  if (relatedMessages !== void 0) {
10357
- relatedInformation = [];
10358
10615
  for (const relatedMessage of relatedMessages) {
10359
10616
  relatedInformation.push({
10360
- category: ts46.DiagnosticCategory.Message,
10617
+ category: ts48.DiagnosticCategory.Message,
10361
10618
  code: 0,
10362
10619
  file: relatedMessage.sourceFile,
10363
10620
  start: relatedMessage.start,
@@ -10366,6 +10623,9 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
10366
10623
  });
10367
10624
  }
10368
10625
  }
10626
+ if (deprecatedDiagInfo !== void 0) {
10627
+ relatedInformation.push(...deprecatedDiagInfo.relatedMessages ?? []);
10628
+ }
10369
10629
  return {
10370
10630
  source: "ngtsc",
10371
10631
  code,
@@ -10376,7 +10636,8 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
10376
10636
  typeCheckId: id,
10377
10637
  start: span.start.offset,
10378
10638
  length: span.end.offset - span.start.offset,
10379
- relatedInformation
10639
+ relatedInformation,
10640
+ reportsDeprecated: deprecatedDiagInfo?.reportsDeprecated
10380
10641
  };
10381
10642
  } else if (mapping.type === "indirect" || mapping.type === "external") {
10382
10643
  const componentSf = mapping.componentClass.getSourceFile();
@@ -10386,7 +10647,7 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
10386
10647
  if (relatedMessages !== void 0) {
10387
10648
  for (const relatedMessage of relatedMessages) {
10388
10649
  relatedInformation.push({
10389
- category: ts46.DiagnosticCategory.Message,
10650
+ category: ts48.DiagnosticCategory.Message,
10390
10651
  code: 0,
10391
10652
  file: relatedMessage.sourceFile,
10392
10653
  start: relatedMessage.start,
@@ -10412,21 +10673,25 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
10412
10673
  // and getEnd() are used because they don't include surrounding whitespace.
10413
10674
  start: mapping.node.getStart(),
10414
10675
  length: mapping.node.getEnd() - mapping.node.getStart(),
10415
- relatedInformation
10676
+ relatedInformation,
10677
+ reportsDeprecated: deprecatedDiagInfo?.reportsDeprecated
10416
10678
  };
10417
10679
  }
10418
10680
  let typeForMessage;
10419
- if (category === ts46.DiagnosticCategory.Warning) {
10681
+ if (category === ts48.DiagnosticCategory.Warning) {
10420
10682
  typeForMessage = "Warning";
10421
- } else if (category === ts46.DiagnosticCategory.Suggestion) {
10683
+ } else if (category === ts48.DiagnosticCategory.Suggestion) {
10422
10684
  typeForMessage = "Suggestion";
10423
- } else if (category === ts46.DiagnosticCategory.Message) {
10685
+ } else if (category === ts48.DiagnosticCategory.Message) {
10424
10686
  typeForMessage = "Message";
10425
10687
  } else {
10426
10688
  typeForMessage = "Error";
10427
10689
  }
10690
+ if (deprecatedDiagInfo !== void 0) {
10691
+ relatedInformation.push(...deprecatedDiagInfo.relatedMessages ?? []);
10692
+ }
10428
10693
  relatedInformation.push({
10429
- category: ts46.DiagnosticCategory.Message,
10694
+ category: ts48.DiagnosticCategory.Message,
10430
10695
  code: 0,
10431
10696
  file: componentSf,
10432
10697
  // mapping.node represents either the 'template' or 'templateUrl' expression. getStart()
@@ -10446,7 +10711,8 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
10446
10711
  start: span.start.offset,
10447
10712
  length: span.end.offset - span.start.offset,
10448
10713
  // Show a secondary message indicating the component whose template contains the error.
10449
- relatedInformation
10714
+ relatedInformation,
10715
+ reportsDeprecated: deprecatedDiagInfo?.reportsDeprecated
10450
10716
  };
10451
10717
  } else {
10452
10718
  throw new Error(`Unexpected source mapping type: ${mapping.type}`);
@@ -10464,13 +10730,13 @@ function parseTemplateAsSourceFile(fileName, template) {
10464
10730
  if (parseTemplateAsSourceFileForTest !== null) {
10465
10731
  return parseTemplateAsSourceFileForTest(fileName, template);
10466
10732
  }
10467
- return ts46.createSourceFile(
10733
+ return ts48.createSourceFile(
10468
10734
  fileName,
10469
10735
  template,
10470
- ts46.ScriptTarget.Latest,
10736
+ ts48.ScriptTarget.Latest,
10471
10737
  /* setParentNodes */
10472
10738
  false,
10473
- ts46.ScriptKind.JSX
10739
+ ts48.ScriptKind.JSX
10474
10740
  );
10475
10741
  }
10476
10742
 
@@ -10489,141 +10755,7 @@ function getTypeCheckId(clazz) {
10489
10755
 
10490
10756
  // packages/compiler-cli/src/ngtsc/typecheck/src/completion.js
10491
10757
  import { EmptyExpr, ImplicitReceiver, PropertyRead, SafePropertyRead, TmplAstLetDeclaration, TmplAstReference, TmplAstTextAttribute } from "@angular/compiler";
10492
- import ts48 from "typescript";
10493
-
10494
- // packages/compiler-cli/src/ngtsc/typecheck/src/comments.js
10495
- import { AbsoluteSourceSpan } from "@angular/compiler";
10496
- import ts47 from "typescript";
10497
- var parseSpanComment = /^(\d+),(\d+)$/;
10498
- function readSpanComment(node, sourceFile = node.getSourceFile()) {
10499
- return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
10500
- if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
10501
- return null;
10502
- }
10503
- const commentText = sourceFile.text.substring(pos + 2, end - 2);
10504
- const match = commentText.match(parseSpanComment);
10505
- if (match === null) {
10506
- return null;
10507
- }
10508
- return new AbsoluteSourceSpan(+match[1], +match[2]);
10509
- }) || null;
10510
- }
10511
- var CommentTriviaType;
10512
- (function(CommentTriviaType2) {
10513
- CommentTriviaType2["DIAGNOSTIC"] = "D";
10514
- CommentTriviaType2["EXPRESSION_TYPE_IDENTIFIER"] = "T";
10515
- })(CommentTriviaType || (CommentTriviaType = {}));
10516
- var ExpressionIdentifier;
10517
- (function(ExpressionIdentifier2) {
10518
- ExpressionIdentifier2["DIRECTIVE"] = "DIR";
10519
- ExpressionIdentifier2["COMPONENT_COMPLETION"] = "COMPCOMP";
10520
- ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
10521
- ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
10522
- })(ExpressionIdentifier || (ExpressionIdentifier = {}));
10523
- function addExpressionIdentifier(node, identifier) {
10524
- ts47.addSyntheticTrailingComment(
10525
- node,
10526
- ts47.SyntaxKind.MultiLineCommentTrivia,
10527
- `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
10528
- /* hasTrailingNewLine */
10529
- false
10530
- );
10531
- }
10532
- var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
10533
- function markIgnoreDiagnostics(node) {
10534
- ts47.addSyntheticTrailingComment(
10535
- node,
10536
- ts47.SyntaxKind.MultiLineCommentTrivia,
10537
- IGNORE_FOR_DIAGNOSTICS_MARKER,
10538
- /* hasTrailingNewLine */
10539
- false
10540
- );
10541
- }
10542
- function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
10543
- return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
10544
- if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
10545
- return null;
10546
- }
10547
- const commentText = sourceFile.text.substring(pos + 2, end - 2);
10548
- return commentText === IGNORE_FOR_DIAGNOSTICS_MARKER;
10549
- }) === true;
10550
- }
10551
- function makeRecursiveVisitor(visitor) {
10552
- function recursiveVisitor(node) {
10553
- const res = visitor(node);
10554
- return res !== null ? res : node.forEachChild(recursiveVisitor);
10555
- }
10556
- return recursiveVisitor;
10557
- }
10558
- function getSpanFromOptions(opts) {
10559
- let withSpan = null;
10560
- if (opts.withSpan !== void 0) {
10561
- if (opts.withSpan instanceof AbsoluteSourceSpan) {
10562
- withSpan = opts.withSpan;
10563
- } else {
10564
- withSpan = { start: opts.withSpan.start.offset, end: opts.withSpan.end.offset };
10565
- }
10566
- }
10567
- return withSpan;
10568
- }
10569
- function findFirstMatchingNode(tcb, opts) {
10570
- const withSpan = getSpanFromOptions(opts);
10571
- const withExpressionIdentifier = opts.withExpressionIdentifier;
10572
- const sf = tcb.getSourceFile();
10573
- const visitor = makeRecursiveVisitor((node) => {
10574
- if (!opts.filter(node)) {
10575
- return null;
10576
- }
10577
- if (withSpan !== null) {
10578
- const comment = readSpanComment(node, sf);
10579
- if (comment === null || withSpan.start !== comment.start || withSpan.end !== comment.end) {
10580
- return null;
10581
- }
10582
- }
10583
- if (withExpressionIdentifier !== void 0 && !hasExpressionIdentifier(sf, node, withExpressionIdentifier)) {
10584
- return null;
10585
- }
10586
- return node;
10587
- });
10588
- return tcb.forEachChild(visitor) ?? null;
10589
- }
10590
- function findAllMatchingNodes(tcb, opts) {
10591
- const withSpan = getSpanFromOptions(opts);
10592
- const withExpressionIdentifier = opts.withExpressionIdentifier;
10593
- const results = [];
10594
- const stack = [tcb];
10595
- const sf = tcb.getSourceFile();
10596
- while (stack.length > 0) {
10597
- const node = stack.pop();
10598
- if (!opts.filter(node)) {
10599
- stack.push(...node.getChildren());
10600
- continue;
10601
- }
10602
- if (withSpan !== null) {
10603
- const comment = readSpanComment(node, sf);
10604
- if (comment === null || withSpan.start !== comment.start || withSpan.end !== comment.end) {
10605
- stack.push(...node.getChildren());
10606
- continue;
10607
- }
10608
- }
10609
- if (withExpressionIdentifier !== void 0 && !hasExpressionIdentifier(sf, node, withExpressionIdentifier)) {
10610
- continue;
10611
- }
10612
- results.push(node);
10613
- }
10614
- return results;
10615
- }
10616
- function hasExpressionIdentifier(sourceFile, node, identifier) {
10617
- return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
10618
- if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
10619
- return false;
10620
- }
10621
- const commentText = sourceFile.text.substring(pos + 2, end - 2);
10622
- return commentText === `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`;
10623
- }) || false;
10624
- }
10625
-
10626
- // packages/compiler-cli/src/ngtsc/typecheck/src/completion.js
10758
+ import ts49 from "typescript";
10627
10759
  var CompletionEngine = class {
10628
10760
  tcb;
10629
10761
  data;
@@ -10646,7 +10778,7 @@ var CompletionEngine = class {
10646
10778
  this.tcbPath = tcbPath;
10647
10779
  this.tcbIsShim = tcbIsShim;
10648
10780
  const globalRead = findFirstMatchingNode(this.tcb, {
10649
- filter: ts48.isPropertyAccessExpression,
10781
+ filter: ts49.isPropertyAccessExpression,
10650
10782
  withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
10651
10783
  });
10652
10784
  if (globalRead !== null) {
@@ -10690,7 +10822,7 @@ var CompletionEngine = class {
10690
10822
  let nodeContext = null;
10691
10823
  if (node instanceof EmptyExpr) {
10692
10824
  const nodeLocation = findFirstMatchingNode(this.tcb, {
10693
- filter: ts48.isIdentifier,
10825
+ filter: ts49.isIdentifier,
10694
10826
  withSpan: node.sourceSpan
10695
10827
  });
10696
10828
  if (nodeLocation !== null) {
@@ -10703,7 +10835,7 @@ var CompletionEngine = class {
10703
10835
  }
10704
10836
  if (node instanceof PropertyRead && node.receiver instanceof ImplicitReceiver) {
10705
10837
  const nodeLocation = findFirstMatchingNode(this.tcb, {
10706
- filter: ts48.isPropertyAccessExpression,
10838
+ filter: ts49.isPropertyAccessExpression,
10707
10839
  withSpan: node.sourceSpan
10708
10840
  });
10709
10841
  if (nodeLocation) {
@@ -10727,21 +10859,21 @@ var CompletionEngine = class {
10727
10859
  let tsExpr = null;
10728
10860
  if (expr instanceof PropertyRead) {
10729
10861
  tsExpr = findFirstMatchingNode(this.tcb, {
10730
- filter: ts48.isPropertyAccessExpression,
10862
+ filter: ts49.isPropertyAccessExpression,
10731
10863
  withSpan: expr.nameSpan
10732
10864
  });
10733
10865
  } else if (expr instanceof SafePropertyRead) {
10734
10866
  const ternaryExpr = findFirstMatchingNode(this.tcb, {
10735
- filter: ts48.isParenthesizedExpression,
10867
+ filter: ts49.isParenthesizedExpression,
10736
10868
  withSpan: expr.sourceSpan
10737
10869
  });
10738
- if (ternaryExpr === null || !ts48.isConditionalExpression(ternaryExpr.expression)) {
10870
+ if (ternaryExpr === null || !ts49.isConditionalExpression(ternaryExpr.expression)) {
10739
10871
  return null;
10740
10872
  }
10741
10873
  const whenTrue = ternaryExpr.expression.whenTrue;
10742
- if (ts48.isPropertyAccessExpression(whenTrue)) {
10874
+ if (ts49.isPropertyAccessExpression(whenTrue)) {
10743
10875
  tsExpr = whenTrue;
10744
- } else if (ts48.isCallExpression(whenTrue) && ts48.isPropertyAccessExpression(whenTrue.expression)) {
10876
+ } else if (ts49.isCallExpression(whenTrue) && ts49.isPropertyAccessExpression(whenTrue.expression)) {
10745
10877
  tsExpr = whenTrue.expression;
10746
10878
  }
10747
10879
  }
@@ -10763,15 +10895,15 @@ var CompletionEngine = class {
10763
10895
  let tsExpr = null;
10764
10896
  if (expr instanceof TmplAstTextAttribute) {
10765
10897
  const strNode = findFirstMatchingNode(this.tcb, {
10766
- filter: ts48.isParenthesizedExpression,
10898
+ filter: ts49.isParenthesizedExpression,
10767
10899
  withSpan: expr.sourceSpan
10768
10900
  });
10769
- if (strNode !== null && ts48.isStringLiteral(strNode.expression)) {
10901
+ if (strNode !== null && ts49.isStringLiteral(strNode.expression)) {
10770
10902
  tsExpr = strNode.expression;
10771
10903
  }
10772
10904
  } else {
10773
10905
  tsExpr = findFirstMatchingNode(this.tcb, {
10774
- filter: (n2) => ts48.isStringLiteral(n2) || ts48.isNumericLiteral(n2),
10906
+ filter: (n2) => ts49.isStringLiteral(n2) || ts49.isNumericLiteral(n2),
10775
10907
  withSpan: expr.sourceSpan
10776
10908
  });
10777
10909
  }
@@ -10779,7 +10911,7 @@ var CompletionEngine = class {
10779
10911
  return null;
10780
10912
  }
10781
10913
  let positionInShimFile = tsExpr.getEnd();
10782
- if (ts48.isStringLiteral(tsExpr)) {
10914
+ if (ts49.isStringLiteral(tsExpr)) {
10783
10915
  positionInShimFile -= 1;
10784
10916
  }
10785
10917
  const res = {
@@ -11807,7 +11939,7 @@ import ts62 from "typescript";
11807
11939
 
11808
11940
  // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
11809
11941
  import { DomElementSchemaRegistry } from "@angular/compiler";
11810
- import ts49 from "typescript";
11942
+ import ts50 from "typescript";
11811
11943
  var REGISTRY = new DomElementSchemaRegistry();
11812
11944
  var REMOVE_XHTML_REGEX = /^:xhtml:/;
11813
11945
  var RegistryDomSchemaChecker = class {
@@ -11833,7 +11965,7 @@ var RegistryDomSchemaChecker = class {
11833
11965
  } else {
11834
11966
  errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
11835
11967
  }
11836
- const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics, ts49.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
11968
+ const diag = makeTemplateDiagnostic(id, mapping, sourceSpanForDiagnostics, ts50.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
11837
11969
  this._diagnostics.push(diag);
11838
11970
  }
11839
11971
  }
@@ -11853,7 +11985,7 @@ var RegistryDomSchemaChecker = class {
11853
11985
  2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
11854
11986
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
11855
11987
  }
11856
- const diag = makeTemplateDiagnostic(id, mapping, span, ts49.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
11988
+ const diag = makeTemplateDiagnostic(id, mapping, span, ts50.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
11857
11989
  this._diagnostics.push(diag);
11858
11990
  }
11859
11991
  }
@@ -11864,7 +11996,7 @@ var RegistryDomSchemaChecker = class {
11864
11996
  }
11865
11997
  const errorMessage = `Can't bind to '${name}' since it isn't a known property of '${tagName}'.`;
11866
11998
  const mapping = this.resolver.getHostBindingsMapping(id);
11867
- const diag = makeTemplateDiagnostic(id, mapping, span, ts49.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMessage);
11999
+ const diag = makeTemplateDiagnostic(id, mapping, span, ts50.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMessage);
11868
12000
  this._diagnostics.push(diag);
11869
12001
  break;
11870
12002
  }
@@ -11929,122 +12061,6 @@ var ReferenceEmitEnvironment = class {
11929
12061
  }
11930
12062
  };
11931
12063
 
11932
- // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11933
- import ts50 from "typescript";
11934
- var SAFE_TO_CAST_WITHOUT_PARENS = null;
11935
- function tsCastToAny(expr) {
11936
- if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
11937
- SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
11938
- // Expressions which are already parenthesized can be cast without further wrapping.
11939
- ts50.SyntaxKind.ParenthesizedExpression,
11940
- // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
11941
- ts50.SyntaxKind.Identifier,
11942
- ts50.SyntaxKind.CallExpression,
11943
- ts50.SyntaxKind.NonNullExpression,
11944
- ts50.SyntaxKind.ElementAccessExpression,
11945
- ts50.SyntaxKind.PropertyAccessExpression,
11946
- ts50.SyntaxKind.ArrayLiteralExpression,
11947
- ts50.SyntaxKind.ObjectLiteralExpression,
11948
- // The same goes for various literals.
11949
- ts50.SyntaxKind.StringLiteral,
11950
- ts50.SyntaxKind.NumericLiteral,
11951
- ts50.SyntaxKind.TrueKeyword,
11952
- ts50.SyntaxKind.FalseKeyword,
11953
- ts50.SyntaxKind.NullKeyword,
11954
- ts50.SyntaxKind.UndefinedKeyword
11955
- ]);
11956
- }
11957
- if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
11958
- expr = ts50.factory.createParenthesizedExpression(expr);
11959
- }
11960
- return ts50.factory.createParenthesizedExpression(ts50.factory.createAsExpression(expr, ts50.factory.createKeywordTypeNode(ts50.SyntaxKind.AnyKeyword)));
11961
- }
11962
- function tsCreateElement(...tagNames) {
11963
- const createElement = ts50.factory.createPropertyAccessExpression(
11964
- /* expression */
11965
- ts50.factory.createIdentifier("document"),
11966
- "createElement"
11967
- );
11968
- let arg;
11969
- if (tagNames.length === 1) {
11970
- arg = ts50.factory.createStringLiteral(tagNames[0]);
11971
- } else {
11972
- const assertedNullExpression = ts50.factory.createNonNullExpression(ts50.factory.createNull());
11973
- const type = ts50.factory.createUnionTypeNode(tagNames.map((tag) => ts50.factory.createLiteralTypeNode(ts50.factory.createStringLiteral(tag))));
11974
- arg = ts50.factory.createAsExpression(assertedNullExpression, type);
11975
- }
11976
- return ts50.factory.createCallExpression(
11977
- /* expression */
11978
- createElement,
11979
- /* typeArguments */
11980
- void 0,
11981
- /* argumentsArray */
11982
- [arg]
11983
- );
11984
- }
11985
- function tsDeclareVariable(id, type) {
11986
- addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
11987
- const initializer = ts50.factory.createAsExpression(ts50.factory.createNonNullExpression(ts50.factory.createNull()), type);
11988
- const decl = ts50.factory.createVariableDeclaration(
11989
- /* name */
11990
- id,
11991
- /* exclamationToken */
11992
- void 0,
11993
- /* type */
11994
- void 0,
11995
- /* initializer */
11996
- initializer
11997
- );
11998
- return ts50.factory.createVariableStatement(
11999
- /* modifiers */
12000
- void 0,
12001
- /* declarationList */
12002
- [decl]
12003
- );
12004
- }
12005
- function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
12006
- return ts50.factory.createTypeQueryNode(ts50.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
12007
- }
12008
- function tsCreateVariable(id, initializer, flags = null) {
12009
- const decl = ts50.factory.createVariableDeclaration(
12010
- /* name */
12011
- id,
12012
- /* exclamationToken */
12013
- void 0,
12014
- /* type */
12015
- void 0,
12016
- /* initializer */
12017
- initializer
12018
- );
12019
- return ts50.factory.createVariableStatement(
12020
- /* modifiers */
12021
- void 0,
12022
- /* declarationList */
12023
- flags === null ? [decl] : ts50.factory.createVariableDeclarationList([decl], flags)
12024
- );
12025
- }
12026
- function tsCallMethod(receiver, methodName, args = []) {
12027
- const methodAccess = ts50.factory.createPropertyAccessExpression(receiver, methodName);
12028
- return ts50.factory.createCallExpression(
12029
- /* expression */
12030
- methodAccess,
12031
- /* typeArguments */
12032
- void 0,
12033
- /* argumentsArray */
12034
- args
12035
- );
12036
- }
12037
- function isAccessExpression(node) {
12038
- return ts50.isPropertyAccessExpression(node) || ts50.isElementAccessExpression(node);
12039
- }
12040
- function tsNumericExpression2(value) {
12041
- if (value < 0) {
12042
- const operand = ts50.factory.createNumericLiteral(Math.abs(value));
12043
- return ts50.factory.createPrefixUnaryExpression(ts50.SyntaxKind.MinusToken, operand);
12044
- }
12045
- return ts50.factory.createNumericLiteral(value);
12046
- }
12047
-
12048
12064
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
12049
12065
  import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers2, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
12050
12066
  import ts54 from "typescript";
@@ -13071,7 +13087,10 @@ function translateDiagnostic(diagnostic, resolver) {
13071
13087
  return null;
13072
13088
  }
13073
13089
  const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
13074
- return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
13090
+ return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
13091
+ reportsDeprecated: diagnostic.reportsDeprecated,
13092
+ relatedMessages: diagnostic.relatedInformation
13093
+ } : void 0);
13075
13094
  }
13076
13095
 
13077
13096
  // packages/compiler-cli/src/ngtsc/typecheck/src/expression.js
@@ -16180,8 +16199,6 @@ var SymbolBuilder = class {
16180
16199
  }
16181
16200
  getDirectivesOfNode(templateNode) {
16182
16201
  const elementSourceSpan = templateNode.startSourceSpan ?? templateNode.sourceSpan;
16183
- const tcbSourceFile = this.typeCheckBlock.getSourceFile();
16184
- const isDirectiveDeclaration = (node) => (ts63.isTypeNode(node) || ts63.isIdentifier(node)) && ts63.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
16185
16202
  const nodes = findAllMatchingNodes(this.typeCheckBlock, {
16186
16203
  withSpan: elementSourceSpan,
16187
16204
  filter: isDirectiveDeclaration
@@ -16944,6 +16961,29 @@ var TemplateTypeCheckerImpl = class {
16944
16961
  return diagnostics.filter((diag) => diag !== null);
16945
16962
  });
16946
16963
  }
16964
+ getSuggestionDiagnosticsForFile(sf, tsLs, optimizeFor) {
16965
+ switch (optimizeFor) {
16966
+ case OptimizeFor.WholeProgram:
16967
+ this.ensureAllShimsForAllFiles();
16968
+ break;
16969
+ case OptimizeFor.SingleFile:
16970
+ this.ensureAllShimsForOneFile(sf);
16971
+ break;
16972
+ }
16973
+ return this.perf.inPhase(PerfPhase.TtcSuggestionDiagnostics, () => {
16974
+ const sfPath = absoluteFromSourceFile(sf);
16975
+ const fileRecord = this.state.get(sfPath);
16976
+ const diagnostics = [];
16977
+ const program = this.programDriver.getProgram();
16978
+ if (fileRecord.hasInlines) {
16979
+ diagnostics.push(...getDeprecatedSuggestionDiagnostics(tsLs, program, sfPath, fileRecord, this));
16980
+ }
16981
+ for (const [shimPath] of fileRecord.shimData) {
16982
+ diagnostics.push(...getDeprecatedSuggestionDiagnostics(tsLs, program, shimPath, fileRecord, this));
16983
+ }
16984
+ return diagnostics.filter((diag) => diag !== null);
16985
+ });
16986
+ }
16947
16987
  getDiagnosticsForComponent(component) {
16948
16988
  this.ensureShimForComponent(component);
16949
16989
  return this.perf.inPhase(PerfPhase.TtcDiagnostics, () => {
@@ -16971,6 +17011,27 @@ var TemplateTypeCheckerImpl = class {
16971
17011
  return diagnostics.filter((diag) => diag !== null && diag.typeCheckId === id);
16972
17012
  });
16973
17013
  }
17014
+ getSuggestionDiagnosticsForComponent(component, tsLs) {
17015
+ this.ensureShimForComponent(component);
17016
+ return this.perf.inPhase(PerfPhase.TtcSuggestionDiagnostics, () => {
17017
+ const sf = component.getSourceFile();
17018
+ const sfPath = absoluteFromSourceFile(sf);
17019
+ const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
17020
+ const fileRecord = this.getFileData(sfPath);
17021
+ if (!fileRecord.shimData.has(shimPath)) {
17022
+ return [];
17023
+ }
17024
+ const templateId = fileRecord.sourceManager.getTypeCheckId(component);
17025
+ const shimRecord = fileRecord.shimData.get(shimPath);
17026
+ const diagnostics = [];
17027
+ const program = this.programDriver.getProgram();
17028
+ if (shimRecord.hasInlines) {
17029
+ diagnostics.push(...getDeprecatedSuggestionDiagnostics(tsLs, program, sfPath, fileRecord, this));
17030
+ }
17031
+ diagnostics.push(...getDeprecatedSuggestionDiagnostics(tsLs, program, shimPath, fileRecord, this));
17032
+ return diagnostics.filter((diag) => diag !== null && diag.typeCheckId === templateId);
17033
+ });
17034
+ }
16974
17035
  getTypeCheckBlock(component) {
16975
17036
  return this.getLatestComponentState(component).tcb;
16976
17037
  }
@@ -17722,6 +17783,87 @@ function getClassDeclFromSymbol(symbol, checker) {
17722
17783
  }
17723
17784
  return null;
17724
17785
  }
17786
+ function getDeprecatedSuggestionDiagnostics(tsLs, program, path, fileRecord, templateTypeChecker) {
17787
+ const sourceFile = program.getSourceFile(path);
17788
+ if (sourceFile === void 0) {
17789
+ return [];
17790
+ }
17791
+ const tsDiags = tsLs.getSuggestionDiagnostics(path).filter(isDeprecatedDiagnostics);
17792
+ const commonTemplateDiags = tsDiags.map((diag) => {
17793
+ return convertDiagnostic(diag, fileRecord.sourceManager);
17794
+ });
17795
+ const elementTagDiags = getTheElementTagDeprecatedSuggestionDiagnostics(path, program, fileRecord, tsDiags, templateTypeChecker);
17796
+ return [...commonTemplateDiags, ...elementTagDiags];
17797
+ }
17798
+ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, fileRecord, diags, templateTypeChecker) {
17799
+ const sourceFile = program.getSourceFile(shimPath);
17800
+ if (sourceFile === void 0) {
17801
+ return [];
17802
+ }
17803
+ const typeChecker = program.getTypeChecker();
17804
+ const nodeToDiag = /* @__PURE__ */ new Map();
17805
+ for (const tsDiag of diags) {
17806
+ const diagNode = getTokenAtPosition(sourceFile, tsDiag.start);
17807
+ const nodeType = typeChecker.getTypeAtLocation(diagNode);
17808
+ const nodeSymbolDeclarations = nodeType.symbol.declarations;
17809
+ const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
17810
+ if (decl === void 0 || !ts64.isClassDeclaration(decl)) {
17811
+ continue;
17812
+ }
17813
+ const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
17814
+ if (directiveForDiagnostic === null || !directiveForDiagnostic.isComponent) {
17815
+ continue;
17816
+ }
17817
+ nodeToDiag.set(decl, tsDiag);
17818
+ }
17819
+ const directiveNodesInTcb = findAllMatchingNodes(sourceFile, {
17820
+ filter: isDirectiveDeclaration
17821
+ });
17822
+ const templateDiagnostics = [];
17823
+ for (const directive of directiveNodesInTcb) {
17824
+ const directiveType = typeChecker.getTypeAtLocation(directive);
17825
+ const directiveSymbolDeclarations = directiveType.symbol.declarations;
17826
+ const decl = directiveSymbolDeclarations !== void 0 && directiveSymbolDeclarations.length > 0 ? directiveSymbolDeclarations[0] : void 0;
17827
+ if (decl === void 0) {
17828
+ continue;
17829
+ }
17830
+ if (!ts64.isClassDeclaration(decl)) {
17831
+ continue;
17832
+ }
17833
+ const diagnostic = nodeToDiag.get(decl);
17834
+ if (diagnostic === void 0) {
17835
+ continue;
17836
+ }
17837
+ const fullMapping = getSourceMapping(
17838
+ diagnostic.file,
17839
+ directive.getStart(),
17840
+ fileRecord.sourceManager,
17841
+ /**
17842
+ * Don't set to true, the deprecated diagnostics will be ignored if this is a diagnostics request.
17843
+ * Only the deprecated diagnostics will be reported here.
17844
+ */
17845
+ // For example:
17846
+ // var _t2 /*T:DIR*/ /*87,104*/ = _ctor1({ "name": ("") /*96,103*/ }) /*D:ignore*/;
17847
+ // At the end of the statement, there is a comment `/*D:ignore*/` which means that this diagnostic
17848
+ // should be ignored in diagnostics request.
17849
+ /*isDiagnosticsRequest*/
17850
+ false
17851
+ );
17852
+ if (fullMapping === null) {
17853
+ continue;
17854
+ }
17855
+ const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
17856
+ const templateDiagnostic = makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
17857
+ reportsDeprecated: diagnostic.reportsDeprecated,
17858
+ relatedMessages: diagnostic.relatedInformation
17859
+ } : void 0);
17860
+ templateDiagnostics.push(templateDiagnostic);
17861
+ }
17862
+ return templateDiagnostics;
17863
+ }
17864
+ function isDeprecatedDiagnostics(diag) {
17865
+ return diag.reportsDeprecated !== void 0;
17866
+ }
17725
17867
 
17726
17868
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
17727
17869
  var FIELD_DECORATORS = [