@angular/compiler-cli 13.2.3 → 14.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/bundles/{chunk-PJPAHVUO.js → chunk-2N3G5KYJ.js} +5 -11
  2. package/bundles/chunk-2N3G5KYJ.js.map +6 -0
  3. package/bundles/{chunk-C44PYKVA.js → chunk-7C3Q5ZSV.js} +1732 -1502
  4. package/bundles/chunk-7C3Q5ZSV.js.map +6 -0
  5. package/bundles/{chunk-O57ZKMWS.js → chunk-JKIKUGPN.js} +2 -2
  6. package/bundles/{chunk-O57ZKMWS.js.map → chunk-JKIKUGPN.js.map} +0 -0
  7. package/bundles/{chunk-XNYP2SFR.js → chunk-QMGQEVL2.js} +5 -1
  8. package/bundles/chunk-QMGQEVL2.js.map +6 -0
  9. package/bundles/{chunk-XLVWXQAR.js → chunk-QYWK7GNC.js} +5 -5
  10. package/bundles/{chunk-XLVWXQAR.js.map → chunk-QYWK7GNC.js.map} +1 -1
  11. package/bundles/{chunk-ALKVYGAK.js → chunk-TYUIAZWZ.js} +9 -6
  12. package/bundles/chunk-TYUIAZWZ.js.map +6 -0
  13. package/bundles/{chunk-NRJCXTRC.js → chunk-YG7H35RB.js} +3 -3
  14. package/bundles/{chunk-NRJCXTRC.js.map → chunk-YG7H35RB.js.map} +0 -0
  15. package/bundles/index.js +4 -4
  16. package/bundles/linker/babel/index.js +2 -2
  17. package/bundles/linker/index.js +2 -2
  18. package/bundles/ngcc/index.js +5 -5
  19. package/bundles/ngcc/main-ngcc.js +5 -5
  20. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +4 -4
  21. package/bundles/private/migrations.js +2 -2
  22. package/bundles/src/bin/ng_xi18n.js +4 -4
  23. package/bundles/src/bin/ngc.js +4 -4
  24. package/bundles_metadata.json +1 -1
  25. package/ngcc/src/packages/build_marker.d.ts +1 -1
  26. package/package.json +2 -2
  27. package/src/ngtsc/annotations/common/index.d.ts +16 -0
  28. package/src/ngtsc/annotations/{src → common/src}/api.d.ts +1 -1
  29. package/src/ngtsc/annotations/common/src/di.d.ts +38 -0
  30. package/src/ngtsc/annotations/{src → common/src}/diagnostics.d.ts +15 -7
  31. package/src/ngtsc/annotations/common/src/evaluation.d.ts +18 -0
  32. package/src/ngtsc/annotations/{src → common/src}/factory.d.ts +2 -2
  33. package/src/ngtsc/annotations/{src → common/src}/metadata.d.ts +2 -2
  34. package/src/ngtsc/annotations/{src → common/src}/references_registry.d.ts +3 -3
  35. package/src/ngtsc/annotations/{src → common/src}/util.d.ts +7 -43
  36. package/src/ngtsc/annotations/component/index.d.ts +9 -0
  37. package/src/ngtsc/annotations/component/src/diagnostics.d.ts +20 -0
  38. package/src/ngtsc/annotations/component/src/handler.d.ts +92 -0
  39. package/src/ngtsc/annotations/component/src/metadata.d.ts +61 -0
  40. package/src/ngtsc/annotations/component/src/resources.d.ts +123 -0
  41. package/src/ngtsc/annotations/component/src/scope.d.ts +20 -0
  42. package/src/ngtsc/annotations/component/src/symbol.d.ts +20 -0
  43. package/src/ngtsc/annotations/component/src/util.d.ts +24 -0
  44. package/src/ngtsc/annotations/directive/index.d.ts +11 -0
  45. package/src/ngtsc/annotations/directive/src/handler.d.ts +59 -0
  46. package/src/ngtsc/annotations/directive/src/shared.d.ts +30 -0
  47. package/src/ngtsc/annotations/directive/src/symbol.d.ts +27 -0
  48. package/src/ngtsc/annotations/index.d.ts +4 -6
  49. package/src/ngtsc/annotations/ng_module/index.d.ts +9 -0
  50. package/src/ngtsc/annotations/{src/ng_module.d.ts → ng_module/src/handler.d.ts} +11 -11
  51. package/src/ngtsc/diagnostics/src/error_code.d.ts +17 -0
  52. package/src/ngtsc/metadata/src/api.d.ts +5 -0
  53. package/bundles/chunk-ALKVYGAK.js.map +0 -6
  54. package/bundles/chunk-C44PYKVA.js.map +0 -6
  55. package/bundles/chunk-PJPAHVUO.js.map +0 -6
  56. package/bundles/chunk-XNYP2SFR.js.map +0 -6
  57. package/src/ngtsc/annotations/src/component.d.ts +0 -246
  58. package/src/ngtsc/annotations/src/directive.d.ts +0 -99
@@ -35,7 +35,7 @@ import {
35
35
  translateExpression,
36
36
  translateStatement,
37
37
  translateType
38
- } from "./chunk-XNYP2SFR.js";
38
+ } from "./chunk-QMGQEVL2.js";
39
39
  import {
40
40
  absoluteFrom,
41
41
  absoluteFromSourceFile,
@@ -51,6 +51,228 @@ import {
51
51
  __spreadValues
52
52
  } from "./chunk-WQ3TNYTD.js";
53
53
 
54
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
55
+ import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
56
+ import ts from "typescript";
57
+ function valueReferenceToExpression(valueRef) {
58
+ if (valueRef.kind === 2) {
59
+ return null;
60
+ } else if (valueRef.kind === 0) {
61
+ const expr = new WrappedNodeExpr(valueRef.expression);
62
+ if (valueRef.defaultImportStatement !== null) {
63
+ attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
64
+ }
65
+ return expr;
66
+ } else {
67
+ let importExpr = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
68
+ if (valueRef.nestedPath !== null) {
69
+ for (const property of valueRef.nestedPath) {
70
+ importExpr = new ReadPropExpr(importExpr, property);
71
+ }
72
+ }
73
+ return importExpr;
74
+ }
75
+ }
76
+ function toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, refEmitter) {
77
+ const emittedValueRef = refEmitter.emit(valueRef, valueContext);
78
+ assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
79
+ const emittedTypeRef = refEmitter.emit(typeRef, typeContext, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
80
+ assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
81
+ return {
82
+ value: emittedValueRef.expression,
83
+ type: emittedTypeRef.expression
84
+ };
85
+ }
86
+ function isAngularCore(decorator) {
87
+ return decorator.import !== null && decorator.import.from === "@angular/core";
88
+ }
89
+ function isAngularCoreReference(reference, symbolName) {
90
+ return reference.ownedByModuleGuess === "@angular/core" && reference.debugName === symbolName;
91
+ }
92
+ function findAngularDecorator(decorators, name, isCore) {
93
+ return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
94
+ }
95
+ function isAngularDecorator(decorator, name, isCore) {
96
+ if (isCore) {
97
+ return decorator.name === name;
98
+ } else if (isAngularCore(decorator)) {
99
+ return decorator.import.name === name;
100
+ }
101
+ return false;
102
+ }
103
+ function unwrapExpression(node) {
104
+ while (ts.isAsExpression(node) || ts.isParenthesizedExpression(node)) {
105
+ node = node.expression;
106
+ }
107
+ return node;
108
+ }
109
+ function expandForwardRef(arg) {
110
+ arg = unwrapExpression(arg);
111
+ if (!ts.isArrowFunction(arg) && !ts.isFunctionExpression(arg)) {
112
+ return null;
113
+ }
114
+ const body = arg.body;
115
+ if (ts.isBlock(body)) {
116
+ if (body.statements.length !== 1) {
117
+ return null;
118
+ }
119
+ const stmt = body.statements[0];
120
+ if (!ts.isReturnStatement(stmt) || stmt.expression === void 0) {
121
+ return null;
122
+ }
123
+ return stmt.expression;
124
+ } else {
125
+ return body;
126
+ }
127
+ }
128
+ function tryUnwrapForwardRef(node, reflector) {
129
+ node = unwrapExpression(node);
130
+ if (!ts.isCallExpression(node) || node.arguments.length !== 1) {
131
+ return null;
132
+ }
133
+ const fn = ts.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
134
+ if (!ts.isIdentifier(fn)) {
135
+ return null;
136
+ }
137
+ const expr = expandForwardRef(node.arguments[0]);
138
+ if (expr === null) {
139
+ return null;
140
+ }
141
+ const imp = reflector.getImportOfIdentifier(fn);
142
+ if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
143
+ return null;
144
+ }
145
+ return expr;
146
+ }
147
+ function forwardRefResolver(ref, args) {
148
+ if (!isAngularCoreReference(ref, "forwardRef") || args.length !== 1) {
149
+ return null;
150
+ }
151
+ return expandForwardRef(args[0]);
152
+ }
153
+ function combineResolvers(resolvers) {
154
+ return (ref, args) => {
155
+ for (const resolver of resolvers) {
156
+ const resolved = resolver(ref, args);
157
+ if (resolved !== null) {
158
+ return resolved;
159
+ }
160
+ }
161
+ return null;
162
+ };
163
+ }
164
+ function isExpressionForwardReference(expr, context, contextSource) {
165
+ if (isWrappedTsNodeExpr(expr)) {
166
+ const node = ts.getOriginalNode(expr.node);
167
+ return node.getSourceFile() === contextSource && context.pos < node.pos;
168
+ } else {
169
+ return false;
170
+ }
171
+ }
172
+ function isWrappedTsNodeExpr(expr) {
173
+ return expr instanceof WrappedNodeExpr;
174
+ }
175
+ function readBaseClass(node, reflector, evaluator) {
176
+ const baseExpression = reflector.getBaseClassExpression(node);
177
+ if (baseExpression !== null) {
178
+ const baseClass = evaluator.evaluate(baseExpression);
179
+ if (baseClass instanceof Reference && reflector.isClass(baseClass.node)) {
180
+ return baseClass;
181
+ } else {
182
+ return "dynamic";
183
+ }
184
+ }
185
+ return null;
186
+ }
187
+ var parensWrapperTransformerFactory = (context) => {
188
+ const visitor = (node) => {
189
+ const visited = ts.visitEachChild(node, visitor, context);
190
+ if (ts.isArrowFunction(visited) || ts.isFunctionExpression(visited)) {
191
+ return ts.createParen(visited);
192
+ }
193
+ return visited;
194
+ };
195
+ return (node) => ts.visitEachChild(node, visitor, context);
196
+ };
197
+ function wrapFunctionExpressionsInParens(expression) {
198
+ return ts.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
199
+ }
200
+ function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
201
+ const providers = /* @__PURE__ */ new Set();
202
+ const resolvedProviders = evaluator.evaluate(rawProviders);
203
+ if (!Array.isArray(resolvedProviders)) {
204
+ return providers;
205
+ }
206
+ resolvedProviders.forEach(function processProviders(provider) {
207
+ let tokenClass = null;
208
+ if (Array.isArray(provider)) {
209
+ provider.forEach(processProviders);
210
+ } else if (provider instanceof Reference) {
211
+ tokenClass = provider;
212
+ } else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
213
+ const useExisting = provider.get("useClass");
214
+ if (useExisting instanceof Reference) {
215
+ tokenClass = useExisting;
216
+ }
217
+ }
218
+ if (tokenClass !== null && !tokenClass.node.getSourceFile().isDeclarationFile && reflector.isClass(tokenClass.node)) {
219
+ const constructorParameters = reflector.getConstructorParameters(tokenClass.node);
220
+ if (constructorParameters !== null && constructorParameters.length > 0) {
221
+ providers.add(tokenClass);
222
+ }
223
+ }
224
+ });
225
+ return providers;
226
+ }
227
+ function wrapTypeReference(reflector, clazz) {
228
+ const dtsClass = reflector.getDtsDeclaration(clazz);
229
+ const value = new WrappedNodeExpr(clazz.name);
230
+ const type = dtsClass !== null && isNamedClassDeclaration(dtsClass) ? new WrappedNodeExpr(dtsClass.name) : value;
231
+ return { value, type };
232
+ }
233
+ function createSourceSpan(node) {
234
+ const sf = node.getSourceFile();
235
+ const [startOffset, endOffset] = [node.getStart(), node.getEnd()];
236
+ const { line: startLine, character: startCol } = sf.getLineAndCharacterOfPosition(startOffset);
237
+ const { line: endLine, character: endCol } = sf.getLineAndCharacterOfPosition(endOffset);
238
+ const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
239
+ return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
240
+ }
241
+ function compileResults(fac, def, metadataStmt, propName) {
242
+ const statements = def.statements;
243
+ if (metadataStmt !== null) {
244
+ statements.push(metadataStmt);
245
+ }
246
+ return [
247
+ fac,
248
+ {
249
+ name: propName,
250
+ initializer: def.expression,
251
+ statements: def.statements,
252
+ type: def.type
253
+ }
254
+ ];
255
+ }
256
+ function toFactoryMetadata(meta, target) {
257
+ return {
258
+ name: meta.name,
259
+ type: meta.type,
260
+ internalType: meta.internalType,
261
+ typeArgumentCount: meta.typeArgumentCount,
262
+ deps: meta.deps,
263
+ target
264
+ };
265
+ }
266
+ function resolveImportedFile(moduleResolver, importedFile, expr, origin) {
267
+ if (importedFile !== "unknown") {
268
+ return importedFile;
269
+ }
270
+ if (!(expr instanceof ExternalExpr)) {
271
+ return null;
272
+ }
273
+ return moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
274
+ }
275
+
54
276
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
55
277
  var DynamicValue = class {
56
278
  constructor(node, reason, code) {
@@ -137,7 +359,7 @@ var DynamicValue = class {
137
359
  };
138
360
 
139
361
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
140
- import ts from "typescript";
362
+ import ts2 from "typescript";
141
363
 
142
364
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/result.mjs
143
365
  var ResolvedModule = class {
@@ -325,34 +547,34 @@ function referenceBinaryOp(op) {
325
547
  return { op, literal: false };
326
548
  }
327
549
  var BINARY_OPERATORS = /* @__PURE__ */ new Map([
328
- [ts.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
329
- [ts.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
330
- [ts.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
331
- [ts.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
332
- [ts.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
333
- [ts.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
334
- [ts.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
335
- [ts.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
336
- [ts.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
337
- [ts.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
338
- [ts.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
339
- [ts.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
340
- [ts.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
341
- [ts.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
342
- [ts.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
343
- [ts.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
344
- [ts.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
345
- [ts.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
346
- [ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
347
- [ts.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
348
- [ts.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
349
- [ts.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)]
550
+ [ts2.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
551
+ [ts2.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
552
+ [ts2.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
553
+ [ts2.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
554
+ [ts2.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
555
+ [ts2.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
556
+ [ts2.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
557
+ [ts2.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
558
+ [ts2.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
559
+ [ts2.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
560
+ [ts2.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
561
+ [ts2.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
562
+ [ts2.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
563
+ [ts2.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
564
+ [ts2.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
565
+ [ts2.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
566
+ [ts2.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
567
+ [ts2.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
568
+ [ts2.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
569
+ [ts2.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
570
+ [ts2.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
571
+ [ts2.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)]
350
572
  ]);
351
573
  var UNARY_OPERATORS = /* @__PURE__ */ new Map([
352
- [ts.SyntaxKind.TildeToken, (a) => ~a],
353
- [ts.SyntaxKind.MinusToken, (a) => -a],
354
- [ts.SyntaxKind.PlusToken, (a) => +a],
355
- [ts.SyntaxKind.ExclamationToken, (a) => !a]
574
+ [ts2.SyntaxKind.TildeToken, (a) => ~a],
575
+ [ts2.SyntaxKind.MinusToken, (a) => -a],
576
+ [ts2.SyntaxKind.PlusToken, (a) => +a],
577
+ [ts2.SyntaxKind.ExclamationToken, (a) => !a]
356
578
  ]);
357
579
  var StaticInterpreter = class {
358
580
  constructor(host, checker, dependencyTracker) {
@@ -365,43 +587,43 @@ var StaticInterpreter = class {
365
587
  }
366
588
  visitExpression(node, context) {
367
589
  let result;
368
- if (node.kind === ts.SyntaxKind.TrueKeyword) {
590
+ if (node.kind === ts2.SyntaxKind.TrueKeyword) {
369
591
  return true;
370
- } else if (node.kind === ts.SyntaxKind.FalseKeyword) {
592
+ } else if (node.kind === ts2.SyntaxKind.FalseKeyword) {
371
593
  return false;
372
- } else if (node.kind === ts.SyntaxKind.NullKeyword) {
594
+ } else if (node.kind === ts2.SyntaxKind.NullKeyword) {
373
595
  return null;
374
- } else if (ts.isStringLiteral(node)) {
596
+ } else if (ts2.isStringLiteral(node)) {
375
597
  return node.text;
376
- } else if (ts.isNoSubstitutionTemplateLiteral(node)) {
598
+ } else if (ts2.isNoSubstitutionTemplateLiteral(node)) {
377
599
  return node.text;
378
- } else if (ts.isTemplateExpression(node)) {
600
+ } else if (ts2.isTemplateExpression(node)) {
379
601
  result = this.visitTemplateExpression(node, context);
380
- } else if (ts.isNumericLiteral(node)) {
602
+ } else if (ts2.isNumericLiteral(node)) {
381
603
  return parseFloat(node.text);
382
- } else if (ts.isObjectLiteralExpression(node)) {
604
+ } else if (ts2.isObjectLiteralExpression(node)) {
383
605
  result = this.visitObjectLiteralExpression(node, context);
384
- } else if (ts.isIdentifier(node)) {
606
+ } else if (ts2.isIdentifier(node)) {
385
607
  result = this.visitIdentifier(node, context);
386
- } else if (ts.isPropertyAccessExpression(node)) {
608
+ } else if (ts2.isPropertyAccessExpression(node)) {
387
609
  result = this.visitPropertyAccessExpression(node, context);
388
- } else if (ts.isCallExpression(node)) {
610
+ } else if (ts2.isCallExpression(node)) {
389
611
  result = this.visitCallExpression(node, context);
390
- } else if (ts.isConditionalExpression(node)) {
612
+ } else if (ts2.isConditionalExpression(node)) {
391
613
  result = this.visitConditionalExpression(node, context);
392
- } else if (ts.isPrefixUnaryExpression(node)) {
614
+ } else if (ts2.isPrefixUnaryExpression(node)) {
393
615
  result = this.visitPrefixUnaryExpression(node, context);
394
- } else if (ts.isBinaryExpression(node)) {
616
+ } else if (ts2.isBinaryExpression(node)) {
395
617
  result = this.visitBinaryExpression(node, context);
396
- } else if (ts.isArrayLiteralExpression(node)) {
618
+ } else if (ts2.isArrayLiteralExpression(node)) {
397
619
  result = this.visitArrayLiteralExpression(node, context);
398
- } else if (ts.isParenthesizedExpression(node)) {
620
+ } else if (ts2.isParenthesizedExpression(node)) {
399
621
  result = this.visitParenthesizedExpression(node, context);
400
- } else if (ts.isElementAccessExpression(node)) {
622
+ } else if (ts2.isElementAccessExpression(node)) {
401
623
  result = this.visitElementAccessExpression(node, context);
402
- } else if (ts.isAsExpression(node)) {
624
+ } else if (ts2.isAsExpression(node)) {
403
625
  result = this.visitExpression(node.expression, context);
404
- } else if (ts.isNonNullExpression(node)) {
626
+ } else if (ts2.isNonNullExpression(node)) {
405
627
  result = this.visitExpression(node.expression, context);
406
628
  } else if (this.host.isClass(node)) {
407
629
  result = this.visitDeclaration(node, context);
@@ -417,7 +639,7 @@ var StaticInterpreter = class {
417
639
  const array = [];
418
640
  for (let i = 0; i < node.elements.length; i++) {
419
641
  const element = node.elements[i];
420
- if (ts.isSpreadElement(element)) {
642
+ if (ts2.isSpreadElement(element)) {
421
643
  array.push(...this.visitSpreadElement(element, context));
422
644
  } else {
423
645
  array.push(this.visitExpression(element, context));
@@ -429,20 +651,20 @@ var StaticInterpreter = class {
429
651
  const map = /* @__PURE__ */ new Map();
430
652
  for (let i = 0; i < node.properties.length; i++) {
431
653
  const property = node.properties[i];
432
- if (ts.isPropertyAssignment(property)) {
654
+ if (ts2.isPropertyAssignment(property)) {
433
655
  const name = this.stringNameFromPropertyName(property.name, context);
434
656
  if (name === void 0) {
435
657
  return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property.name));
436
658
  }
437
659
  map.set(name, this.visitExpression(property.initializer, context));
438
- } else if (ts.isShorthandPropertyAssignment(property)) {
660
+ } else if (ts2.isShorthandPropertyAssignment(property)) {
439
661
  const symbol = this.checker.getShorthandAssignmentValueSymbol(property);
440
662
  if (symbol === void 0 || symbol.valueDeclaration === void 0) {
441
663
  map.set(property.name.text, DynamicValue.fromUnknown(property));
442
664
  } else {
443
665
  map.set(property.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
444
666
  }
445
- } else if (ts.isSpreadAssignment(property)) {
667
+ } else if (ts2.isSpreadAssignment(property)) {
446
668
  const spread = this.visitExpression(property.expression, context);
447
669
  if (spread instanceof DynamicValue) {
448
670
  return DynamicValue.fromDynamicInput(node, spread);
@@ -474,7 +696,7 @@ var StaticInterpreter = class {
474
696
  visitIdentifier(node, context) {
475
697
  const decl = this.host.getDeclarationOfIdentifier(node);
476
698
  if (decl === null) {
477
- if (node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword) {
699
+ if (node.originalKeywordKind === ts2.SyntaxKind.UndefinedKeyword) {
478
700
  return void 0;
479
701
  } else {
480
702
  if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
@@ -505,17 +727,17 @@ var StaticInterpreter = class {
505
727
  }
506
728
  if (this.host.isClass(node)) {
507
729
  return this.getReference(node, context);
508
- } else if (ts.isVariableDeclaration(node)) {
730
+ } else if (ts2.isVariableDeclaration(node)) {
509
731
  return this.visitVariableDeclaration(node, context);
510
- } else if (ts.isParameter(node) && context.scope.has(node)) {
732
+ } else if (ts2.isParameter(node) && context.scope.has(node)) {
511
733
  return context.scope.get(node);
512
- } else if (ts.isExportAssignment(node)) {
734
+ } else if (ts2.isExportAssignment(node)) {
513
735
  return this.visitExpression(node.expression, context);
514
- } else if (ts.isEnumDeclaration(node)) {
736
+ } else if (ts2.isEnumDeclaration(node)) {
515
737
  return this.visitEnumDeclaration(node, context);
516
- } else if (ts.isSourceFile(node)) {
738
+ } else if (ts2.isSourceFile(node)) {
517
739
  return this.visitSourceFile(node, context);
518
- } else if (ts.isBindingElement(node)) {
740
+ } else if (ts2.isBindingElement(node)) {
519
741
  return this.visitBindingElement(node, context);
520
742
  } else {
521
743
  return this.getReference(node, context);
@@ -691,7 +913,7 @@ var StaticInterpreter = class {
691
913
  visitFunctionBody(node, fn, context) {
692
914
  if (fn.body === null) {
693
915
  return DynamicValue.fromUnknown(node);
694
- } else if (fn.body.length !== 1 || !ts.isReturnStatement(fn.body[0])) {
916
+ } else if (fn.body.length !== 1 || !ts2.isReturnStatement(fn.body[0])) {
695
917
  return DynamicValue.fromComplexFunctionCall(node, fn);
696
918
  }
697
919
  const ret = fn.body[0];
@@ -762,7 +984,7 @@ var StaticInterpreter = class {
762
984
  evaluateFunctionArguments(node, context) {
763
985
  const args = [];
764
986
  for (const arg of node.arguments) {
765
- if (ts.isSpreadElement(arg)) {
987
+ if (ts2.isSpreadElement(arg)) {
766
988
  args.push(...this.visitSpreadElement(arg, context));
767
989
  } else {
768
990
  args.push(this.visitExpression(arg, context));
@@ -783,23 +1005,23 @@ var StaticInterpreter = class {
783
1005
  visitBindingElement(node, context) {
784
1006
  const path = [];
785
1007
  let closestDeclaration = node;
786
- while (ts.isBindingElement(closestDeclaration) || ts.isArrayBindingPattern(closestDeclaration) || ts.isObjectBindingPattern(closestDeclaration)) {
787
- if (ts.isBindingElement(closestDeclaration)) {
1008
+ while (ts2.isBindingElement(closestDeclaration) || ts2.isArrayBindingPattern(closestDeclaration) || ts2.isObjectBindingPattern(closestDeclaration)) {
1009
+ if (ts2.isBindingElement(closestDeclaration)) {
788
1010
  path.unshift(closestDeclaration);
789
1011
  }
790
1012
  closestDeclaration = closestDeclaration.parent;
791
1013
  }
792
- if (!ts.isVariableDeclaration(closestDeclaration) || closestDeclaration.initializer === void 0) {
1014
+ if (!ts2.isVariableDeclaration(closestDeclaration) || closestDeclaration.initializer === void 0) {
793
1015
  return DynamicValue.fromUnknown(node);
794
1016
  }
795
1017
  let value = this.visit(closestDeclaration.initializer, context);
796
1018
  for (const element of path) {
797
1019
  let key;
798
- if (ts.isArrayBindingPattern(element.parent)) {
1020
+ if (ts2.isArrayBindingPattern(element.parent)) {
799
1021
  key = element.parent.elements.indexOf(element);
800
1022
  } else {
801
1023
  const name = element.propertyName || element.name;
802
- if (ts.isIdentifier(name)) {
1024
+ if (ts2.isIdentifier(name)) {
803
1025
  key = name.text;
804
1026
  } else {
805
1027
  return DynamicValue.fromUnknown(element);
@@ -813,9 +1035,9 @@ var StaticInterpreter = class {
813
1035
  return value;
814
1036
  }
815
1037
  stringNameFromPropertyName(node, context) {
816
- if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {
1038
+ if (ts2.isIdentifier(node) || ts2.isStringLiteral(node) || ts2.isNumericLiteral(node)) {
817
1039
  return node.text;
818
- } else if (ts.isComputedPropertyName(node)) {
1040
+ } else if (ts2.isComputedPropertyName(node)) {
819
1041
  const literal2 = this.visitExpression(node.expression, context);
820
1042
  return typeof literal2 === "string" ? literal2 : void 0;
821
1043
  } else {
@@ -838,11 +1060,11 @@ var StaticInterpreter = class {
838
1060
  return new Reference(node, owningModule(context));
839
1061
  }
840
1062
  visitType(node, context) {
841
- if (ts.isLiteralTypeNode(node)) {
1063
+ if (ts2.isLiteralTypeNode(node)) {
842
1064
  return this.visitExpression(node.literal, context);
843
- } else if (ts.isTupleTypeNode(node)) {
1065
+ } else if (ts2.isTupleTypeNode(node)) {
844
1066
  return this.visitTupleType(node, context);
845
- } else if (ts.isNamedTupleMember(node)) {
1067
+ } else if (ts2.isNamedTupleMember(node)) {
846
1068
  return this.visitType(node.type, context);
847
1069
  }
848
1070
  return DynamicValue.fromDynamicType(node);
@@ -856,7 +1078,7 @@ var StaticInterpreter = class {
856
1078
  }
857
1079
  };
858
1080
  function isFunctionOrMethodReference(ref) {
859
- return ts.isFunctionDeclaration(ref.node) || ts.isMethodDeclaration(ref.node) || ts.isFunctionExpression(ref.node);
1081
+ return ts2.isFunctionDeclaration(ref.node) || ts2.isMethodDeclaration(ref.node) || ts2.isFunctionExpression(ref.node);
860
1082
  }
861
1083
  function literal(value, reject) {
862
1084
  if (value instanceof EnumValue) {
@@ -868,15 +1090,15 @@ function literal(value, reject) {
868
1090
  return reject(value);
869
1091
  }
870
1092
  function isVariableDeclarationDeclared(node) {
871
- if (node.parent === void 0 || !ts.isVariableDeclarationList(node.parent)) {
1093
+ if (node.parent === void 0 || !ts2.isVariableDeclarationList(node.parent)) {
872
1094
  return false;
873
1095
  }
874
1096
  const declList = node.parent;
875
- if (declList.parent === void 0 || !ts.isVariableStatement(declList.parent)) {
1097
+ if (declList.parent === void 0 || !ts2.isVariableStatement(declList.parent)) {
876
1098
  return false;
877
1099
  }
878
1100
  const varStmt = declList.parent;
879
- return varStmt.modifiers !== void 0 && varStmt.modifiers.some((mod) => mod.kind === ts.SyntaxKind.DeclareKeyword);
1101
+ return varStmt.modifiers !== void 0 && varStmt.modifiers.some((mod) => mod.kind === ts2.SyntaxKind.DeclareKeyword);
880
1102
  }
881
1103
  var EMPTY = {};
882
1104
  function joinModuleContext(existing, node, decl) {
@@ -925,7 +1147,7 @@ var PartialEvaluator = class {
925
1147
  };
926
1148
 
927
1149
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/diagnostics.mjs
928
- import ts2 from "typescript";
1150
+ import ts3 from "typescript";
929
1151
  function describeResolvedType(value, maxDepth = 1) {
930
1152
  var _a, _b;
931
1153
  if (value === null) {
@@ -1029,21 +1251,21 @@ function getContainerNode(node) {
1029
1251
  let currentNode = node;
1030
1252
  while (currentNode !== void 0) {
1031
1253
  switch (currentNode.kind) {
1032
- case ts2.SyntaxKind.ExpressionStatement:
1033
- case ts2.SyntaxKind.VariableStatement:
1034
- case ts2.SyntaxKind.ReturnStatement:
1035
- case ts2.SyntaxKind.IfStatement:
1036
- case ts2.SyntaxKind.SwitchStatement:
1037
- case ts2.SyntaxKind.DoStatement:
1038
- case ts2.SyntaxKind.WhileStatement:
1039
- case ts2.SyntaxKind.ForStatement:
1040
- case ts2.SyntaxKind.ForInStatement:
1041
- case ts2.SyntaxKind.ForOfStatement:
1042
- case ts2.SyntaxKind.ContinueStatement:
1043
- case ts2.SyntaxKind.BreakStatement:
1044
- case ts2.SyntaxKind.ThrowStatement:
1045
- case ts2.SyntaxKind.ObjectBindingPattern:
1046
- case ts2.SyntaxKind.ArrayBindingPattern:
1254
+ case ts3.SyntaxKind.ExpressionStatement:
1255
+ case ts3.SyntaxKind.VariableStatement:
1256
+ case ts3.SyntaxKind.ReturnStatement:
1257
+ case ts3.SyntaxKind.IfStatement:
1258
+ case ts3.SyntaxKind.SwitchStatement:
1259
+ case ts3.SyntaxKind.DoStatement:
1260
+ case ts3.SyntaxKind.WhileStatement:
1261
+ case ts3.SyntaxKind.ForStatement:
1262
+ case ts3.SyntaxKind.ForInStatement:
1263
+ case ts3.SyntaxKind.ForOfStatement:
1264
+ case ts3.SyntaxKind.ContinueStatement:
1265
+ case ts3.SyntaxKind.BreakStatement:
1266
+ case ts3.SyntaxKind.ThrowStatement:
1267
+ case ts3.SyntaxKind.ObjectBindingPattern:
1268
+ case ts3.SyntaxKind.ArrayBindingPattern:
1047
1269
  return currentNode;
1048
1270
  }
1049
1271
  currentNode = currentNode.parent;
@@ -1051,9 +1273,9 @@ function getContainerNode(node) {
1051
1273
  return node.getSourceFile();
1052
1274
  }
1053
1275
 
1054
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/util.mjs
1055
- import { ExternalExpr, LiteralExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
1056
- import ts3 from "typescript";
1276
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
1277
+ import { LiteralExpr, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
1278
+ import ts4 from "typescript";
1057
1279
  function getConstructorDependencies(clazz, reflector, isCore) {
1058
1280
  const deps = [];
1059
1281
  const errors = [];
@@ -1075,7 +1297,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
1075
1297
  if (dec.args === null || dec.args.length !== 1) {
1076
1298
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(dec), `Unexpected number of arguments to @Inject().`);
1077
1299
  }
1078
- token = new WrappedNodeExpr(dec.args[0]);
1300
+ token = new WrappedNodeExpr2(dec.args[0]);
1079
1301
  } else if (name === "Optional") {
1080
1302
  optional = true;
1081
1303
  } else if (name === "SkipSelf") {
@@ -1089,11 +1311,11 @@ function getConstructorDependencies(clazz, reflector, isCore) {
1089
1311
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(dec), `Unexpected number of arguments to @Attribute().`);
1090
1312
  }
1091
1313
  const attributeName = dec.args[0];
1092
- token = new WrappedNodeExpr(attributeName);
1093
- if (ts3.isStringLiteralLike(attributeName)) {
1314
+ token = new WrappedNodeExpr2(attributeName);
1315
+ if (ts4.isStringLiteralLike(attributeName)) {
1094
1316
  attributeNameType = new LiteralExpr(attributeName.text);
1095
1317
  } else {
1096
- attributeNameType = new WrappedNodeExpr(ts3.createKeywordTypeNode(ts3.SyntaxKind.UnknownKeyword));
1318
+ attributeNameType = new WrappedNodeExpr2(ts4.createKeywordTypeNode(ts4.SyntaxKind.UnknownKeyword));
1097
1319
  }
1098
1320
  } else {
1099
1321
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, Decorator.nodeForError(dec), `Unexpected decorator ${name} on parameter.`);
@@ -1118,25 +1340,6 @@ function getConstructorDependencies(clazz, reflector, isCore) {
1118
1340
  return { deps: null, errors };
1119
1341
  }
1120
1342
  }
1121
- function valueReferenceToExpression(valueRef) {
1122
- if (valueRef.kind === 2) {
1123
- return null;
1124
- } else if (valueRef.kind === 0) {
1125
- const expr = new WrappedNodeExpr(valueRef.expression);
1126
- if (valueRef.defaultImportStatement !== null) {
1127
- attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
1128
- }
1129
- return expr;
1130
- } else {
1131
- let importExpr = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
1132
- if (valueRef.nestedPath !== null) {
1133
- for (const property of valueRef.nestedPath) {
1134
- importExpr = new ReadPropExpr(importExpr, property);
1135
- }
1136
- }
1137
- return importExpr;
1138
- }
1139
- }
1140
1343
  function unwrapConstructorDependencies(deps) {
1141
1344
  if (deps === null) {
1142
1345
  return null;
@@ -1203,224 +1406,269 @@ function createUnsuitableInjectionTokenError(clazz, error) {
1203
1406
  }
1204
1407
  const chain = {
1205
1408
  messageText: `No suitable injection token for parameter '${param.name || index}' of class '${clazz.name.text}'.`,
1206
- category: ts3.DiagnosticCategory.Error,
1409
+ category: ts4.DiagnosticCategory.Error,
1207
1410
  code: 0,
1208
1411
  next: [{
1209
1412
  messageText: chainMessage,
1210
- category: ts3.DiagnosticCategory.Message,
1413
+ category: ts4.DiagnosticCategory.Message,
1211
1414
  code: 0
1212
1415
  }]
1213
1416
  };
1214
1417
  return new FatalDiagnosticError(ErrorCode.PARAM_MISSING_TOKEN, param.nameNode, chain, hints);
1215
1418
  }
1216
- function toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, refEmitter) {
1217
- const emittedValueRef = refEmitter.emit(valueRef, valueContext);
1218
- assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
1219
- const emittedTypeRef = refEmitter.emit(typeRef, typeContext, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
1220
- assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
1221
- return {
1222
- value: emittedValueRef.expression,
1223
- type: emittedTypeRef.expression
1224
- };
1225
- }
1226
- function isAngularCore(decorator) {
1227
- return decorator.import !== null && decorator.import.from === "@angular/core";
1228
- }
1229
- function isAngularCoreReference(reference, symbolName) {
1230
- return reference.ownedByModuleGuess === "@angular/core" && reference.debugName === symbolName;
1419
+
1420
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/diagnostics.mjs
1421
+ import ts5 from "typescript";
1422
+ function makeDuplicateDeclarationError(node, data, kind) {
1423
+ const context = [];
1424
+ for (const decl of data) {
1425
+ if (decl.rawDeclarations === null) {
1426
+ continue;
1427
+ }
1428
+ const contextNode = decl.ref.getOriginForDiagnostics(decl.rawDeclarations, decl.ngModule.name);
1429
+ context.push(makeRelatedInformation(contextNode, `'${node.name.text}' is listed in the declarations of the NgModule '${decl.ngModule.name.text}'.`));
1430
+ }
1431
+ return makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_NOT_UNIQUE, node.name, `The ${kind} '${node.name.text}' is declared by more than one NgModule.`, context);
1231
1432
  }
1232
- function findAngularDecorator(decorators, name, isCore) {
1233
- return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
1433
+ function createValueHasWrongTypeError(node, value, messageText) {
1434
+ var _a;
1435
+ let chainedMessage;
1436
+ let relatedInformation;
1437
+ if (value instanceof DynamicValue) {
1438
+ chainedMessage = "Value could not be determined statically.";
1439
+ relatedInformation = traceDynamicValue(node, value);
1440
+ } else if (value instanceof Reference) {
1441
+ const target = value.debugName !== null ? `'${value.debugName}'` : "an anonymous declaration";
1442
+ chainedMessage = `Value is a reference to ${target}.`;
1443
+ const referenceNode = (_a = identifierOfNode(value.node)) != null ? _a : value.node;
1444
+ relatedInformation = [makeRelatedInformation(referenceNode, "Reference is declared here.")];
1445
+ } else {
1446
+ chainedMessage = `Value is of type '${describeResolvedType(value)}'.`;
1447
+ }
1448
+ const chain = {
1449
+ messageText,
1450
+ category: ts5.DiagnosticCategory.Error,
1451
+ code: 0,
1452
+ next: [{
1453
+ messageText: chainedMessage,
1454
+ category: ts5.DiagnosticCategory.Message,
1455
+ code: 0
1456
+ }]
1457
+ };
1458
+ return new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, node, chain, relatedInformation);
1234
1459
  }
1235
- function isAngularDecorator(decorator, name, isCore) {
1236
- if (isCore) {
1237
- return decorator.name === name;
1238
- } else if (isAngularCore(decorator)) {
1239
- return decorator.import.name === name;
1460
+ function getProviderDiagnostics(providerClasses, providersDeclaration, registry) {
1461
+ const diagnostics = [];
1462
+ for (const provider of providerClasses) {
1463
+ if (registry.isInjectable(provider.node)) {
1464
+ continue;
1465
+ }
1466
+ const contextNode = provider.getOriginForDiagnostics(providersDeclaration);
1467
+ diagnostics.push(makeDiagnostic(ErrorCode.UNDECORATED_PROVIDER, contextNode, `The class '${provider.node.name.text}' cannot be created via dependency injection, as it does not have an Angular decorator. This will result in an error at runtime.
1468
+
1469
+ Either add the @Injectable() decorator to '${provider.node.name.text}', or configure a different provider (such as a provider with 'useFactory').
1470
+ `, [makeRelatedInformation(provider.node, `'${provider.node.name.text}' is declared here.`)]));
1240
1471
  }
1241
- return false;
1472
+ return diagnostics;
1242
1473
  }
1243
- function unwrapExpression(node) {
1244
- while (ts3.isAsExpression(node) || ts3.isParenthesizedExpression(node)) {
1245
- node = node.expression;
1474
+ function getDirectiveDiagnostics(node, reader, evaluator, reflector, scopeRegistry, kind) {
1475
+ let diagnostics = [];
1476
+ const addDiagnostics = (more) => {
1477
+ if (more === null) {
1478
+ return;
1479
+ } else if (diagnostics === null) {
1480
+ diagnostics = Array.isArray(more) ? more : [more];
1481
+ } else if (Array.isArray(more)) {
1482
+ diagnostics.push(...more);
1483
+ } else {
1484
+ diagnostics.push(more);
1485
+ }
1486
+ };
1487
+ const duplicateDeclarations = scopeRegistry.getDuplicateDeclarations(node);
1488
+ if (duplicateDeclarations !== null) {
1489
+ addDiagnostics(makeDuplicateDeclarationError(node, duplicateDeclarations, kind));
1246
1490
  }
1247
- return node;
1491
+ addDiagnostics(checkInheritanceOfDirective(node, reader, reflector, evaluator));
1492
+ return diagnostics;
1248
1493
  }
1249
- function expandForwardRef(arg) {
1250
- arg = unwrapExpression(arg);
1251
- if (!ts3.isArrowFunction(arg) && !ts3.isFunctionExpression(arg)) {
1494
+ function getUndecoratedClassWithAngularFeaturesDiagnostic(node) {
1495
+ return makeDiagnostic(ErrorCode.UNDECORATED_CLASS_USING_ANGULAR_FEATURES, node.name, `Class is using Angular features but is not decorated. Please add an explicit Angular decorator.`);
1496
+ }
1497
+ function checkInheritanceOfDirective(node, reader, reflector, evaluator) {
1498
+ if (!reflector.isClass(node) || reflector.getConstructorParameters(node) !== null) {
1252
1499
  return null;
1253
1500
  }
1254
- const body = arg.body;
1255
- if (ts3.isBlock(body)) {
1256
- if (body.statements.length !== 1) {
1501
+ let baseClass = readBaseClass(node, reflector, evaluator);
1502
+ while (baseClass !== null) {
1503
+ if (baseClass === "dynamic") {
1257
1504
  return null;
1258
1505
  }
1259
- const stmt = body.statements[0];
1260
- if (!ts3.isReturnStatement(stmt) || stmt.expression === void 0) {
1506
+ const baseClassMeta = reader.getDirectiveMetadata(baseClass);
1507
+ if (baseClassMeta !== null) {
1261
1508
  return null;
1262
1509
  }
1263
- return stmt.expression;
1264
- } else {
1265
- return body;
1510
+ const baseClassConstructorParams = reflector.getConstructorParameters(baseClass.node);
1511
+ const newParentClass = readBaseClass(baseClass.node, reflector, evaluator);
1512
+ if (baseClassConstructorParams !== null && baseClassConstructorParams.length > 0) {
1513
+ return getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader);
1514
+ } else if (baseClassConstructorParams !== null || newParentClass === null) {
1515
+ return null;
1516
+ }
1517
+ baseClass = newParentClass;
1266
1518
  }
1519
+ return null;
1267
1520
  }
1268
- function tryUnwrapForwardRef(node, reflector) {
1269
- node = unwrapExpression(node);
1270
- if (!ts3.isCallExpression(node) || node.arguments.length !== 1) {
1271
- return null;
1521
+ function getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader) {
1522
+ const subclassMeta = reader.getDirectiveMetadata(new Reference(node));
1523
+ const dirOrComp = subclassMeta.isComponent ? "Component" : "Directive";
1524
+ const baseClassName = baseClass.debugName;
1525
+ return makeDiagnostic(ErrorCode.DIRECTIVE_INHERITS_UNDECORATED_CTOR, node.name, `The ${dirOrComp.toLowerCase()} ${node.name.text} inherits its constructor from ${baseClassName}, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of ${baseClassName}'s constructor. Either add a @Directive decorator to ${baseClassName}, or add an explicit constructor to ${node.name.text}.`);
1526
+ }
1527
+
1528
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
1529
+ import ts6 from "typescript";
1530
+ function resolveEnumValue(evaluator, metadata, field, enumSymbolName) {
1531
+ let resolved = null;
1532
+ if (metadata.has(field)) {
1533
+ const expr = metadata.get(field);
1534
+ const value = evaluator.evaluate(expr);
1535
+ if (value instanceof EnumValue && isAngularCoreReference(value.enumRef, enumSymbolName)) {
1536
+ resolved = value.resolved;
1537
+ } else {
1538
+ throw createValueHasWrongTypeError(expr, value, `${field} must be a member of ${enumSymbolName} enum from @angular/core`);
1539
+ }
1272
1540
  }
1273
- const fn = ts3.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
1274
- if (!ts3.isIdentifier(fn)) {
1275
- return null;
1541
+ return resolved;
1542
+ }
1543
+ function isStringArray(resolvedValue) {
1544
+ return Array.isArray(resolvedValue) && resolvedValue.every((elem) => typeof elem === "string");
1545
+ }
1546
+ function resolveLiteral(decorator, literalCache) {
1547
+ if (literalCache.has(decorator)) {
1548
+ return literalCache.get(decorator);
1276
1549
  }
1277
- const expr = expandForwardRef(node.arguments[0]);
1278
- if (expr === null) {
1279
- return null;
1550
+ if (decorator.args === null || decorator.args.length !== 1) {
1551
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
1280
1552
  }
1281
- const imp = reflector.getImportOfIdentifier(fn);
1282
- if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
1283
- return null;
1553
+ const meta = unwrapExpression(decorator.args[0]);
1554
+ if (!ts6.isObjectLiteralExpression(meta)) {
1555
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `Decorator argument must be literal.`);
1284
1556
  }
1285
- return expr;
1557
+ literalCache.set(decorator, meta);
1558
+ return meta;
1286
1559
  }
1287
- function forwardRefResolver(ref, args) {
1288
- if (!isAngularCoreReference(ref, "forwardRef") || args.length !== 1) {
1560
+
1561
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/factory.mjs
1562
+ import { compileDeclareFactoryFunction, compileFactoryFunction } from "@angular/compiler";
1563
+ function compileNgFactoryDefField(metadata) {
1564
+ const res = compileFactoryFunction(metadata);
1565
+ return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
1566
+ }
1567
+ function compileDeclareFactory(metadata) {
1568
+ const res = compileDeclareFactoryFunction(metadata);
1569
+ return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
1570
+ }
1571
+
1572
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/metadata.mjs
1573
+ import { FunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
1574
+ import ts7 from "typescript";
1575
+ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
1576
+ if (!reflection.isClass(clazz)) {
1289
1577
  return null;
1290
1578
  }
1291
- return expandForwardRef(args[0]);
1292
- }
1293
- function combineResolvers(resolvers) {
1294
- return (ref, args) => {
1295
- for (const resolver of resolvers) {
1296
- const resolved = resolver(ref, args);
1297
- if (resolved !== null) {
1298
- return resolved;
1299
- }
1300
- }
1579
+ const id = reflection.getAdjacentNameOfClass(clazz);
1580
+ const classDecorators = reflection.getDecoratorsOfDeclaration(clazz);
1581
+ if (classDecorators === null) {
1582
+ return null;
1583
+ }
1584
+ const ngClassDecorators = classDecorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(angularDecoratorTransform(decorator), annotateForClosureCompiler)).map((decorator) => removeIdentifierReferences(decorator, id.text));
1585
+ if (ngClassDecorators.length === 0) {
1301
1586
  return null;
1587
+ }
1588
+ const metaDecorators = new WrappedNodeExpr3(ts7.createArrayLiteral(ngClassDecorators));
1589
+ let metaCtorParameters = null;
1590
+ const classCtorParameters = reflection.getConstructorParameters(clazz);
1591
+ if (classCtorParameters !== null) {
1592
+ const ctorParameters = classCtorParameters.map((param) => ctorParameterToMetadata(param, isCore));
1593
+ metaCtorParameters = new FunctionExpr([], [
1594
+ new ReturnStatement(new LiteralArrayExpr(ctorParameters))
1595
+ ]);
1596
+ }
1597
+ let metaPropDecorators = null;
1598
+ const classMembers = reflection.getMembersOfClass(clazz).filter((member) => !member.isStatic && member.decorators !== null && member.decorators.length > 0);
1599
+ const duplicateDecoratedMemberNames = classMembers.map((member) => member.name).filter((name, i, arr) => arr.indexOf(name) < i);
1600
+ if (duplicateDecoratedMemberNames.length > 0) {
1601
+ throw new Error(`Duplicate decorated properties found on class '${clazz.name.text}': ` + duplicateDecoratedMemberNames.join(", "));
1602
+ }
1603
+ const decoratedMembers = classMembers.map((member) => {
1604
+ var _a;
1605
+ return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
1606
+ });
1607
+ if (decoratedMembers.length > 0) {
1608
+ metaPropDecorators = new WrappedNodeExpr3(ts7.createObjectLiteral(decoratedMembers));
1609
+ }
1610
+ return {
1611
+ type: new WrappedNodeExpr3(id),
1612
+ decorators: metaDecorators,
1613
+ ctorParameters: metaCtorParameters,
1614
+ propDecorators: metaPropDecorators
1302
1615
  };
1303
1616
  }
1304
- function isExpressionForwardReference(expr, context, contextSource) {
1305
- if (isWrappedTsNodeExpr(expr)) {
1306
- const node = ts3.getOriginalNode(expr.node);
1307
- return node.getSourceFile() === contextSource && context.pos < node.pos;
1308
- } else {
1309
- return false;
1617
+ function ctorParameterToMetadata(param, isCore) {
1618
+ const type = param.typeValueReference.kind !== 2 ? valueReferenceToExpression(param.typeValueReference) : new LiteralExpr2(void 0);
1619
+ const mapEntries = [
1620
+ { key: "type", value: type, quoted: false }
1621
+ ];
1622
+ if (param.decorators !== null) {
1623
+ const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
1624
+ const value = new WrappedNodeExpr3(ts7.createArrayLiteral(ngDecorators));
1625
+ mapEntries.push({ key: "decorators", value, quoted: false });
1310
1626
  }
1627
+ return literalMap(mapEntries);
1311
1628
  }
1312
- function isWrappedTsNodeExpr(expr) {
1313
- return expr instanceof WrappedNodeExpr;
1629
+ function classMemberToMetadata(name, decorators, isCore) {
1630
+ const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
1631
+ const decoratorMeta = ts7.createArrayLiteral(ngDecorators);
1632
+ return ts7.createPropertyAssignment(name, decoratorMeta);
1314
1633
  }
1315
- function readBaseClass(node, reflector, evaluator) {
1316
- const baseExpression = reflector.getBaseClassExpression(node);
1317
- if (baseExpression !== null) {
1318
- const baseClass = evaluator.evaluate(baseExpression);
1319
- if (baseClass instanceof Reference && reflector.isClass(baseClass.node)) {
1320
- return baseClass;
1321
- } else {
1322
- return "dynamic";
1323
- }
1634
+ function decoratorToMetadata(decorator, wrapFunctionsInParens) {
1635
+ if (decorator.identifier === null) {
1636
+ throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
1324
1637
  }
1325
- return null;
1638
+ const properties = [
1639
+ ts7.createPropertyAssignment("type", ts7.getMutableClone(decorator.identifier))
1640
+ ];
1641
+ if (decorator.args !== null && decorator.args.length > 0) {
1642
+ const args = decorator.args.map((arg) => {
1643
+ const expr = ts7.getMutableClone(arg);
1644
+ return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(expr) : expr;
1645
+ });
1646
+ properties.push(ts7.createPropertyAssignment("args", ts7.createArrayLiteral(args)));
1647
+ }
1648
+ return ts7.createObjectLiteral(properties, true);
1326
1649
  }
1327
- var parensWrapperTransformerFactory = (context) => {
1328
- const visitor = (node) => {
1329
- const visited = ts3.visitEachChild(node, visitor, context);
1330
- if (ts3.isArrowFunction(visited) || ts3.isFunctionExpression(visited)) {
1331
- return ts3.createParen(visited);
1332
- }
1333
- return visited;
1334
- };
1335
- return (node) => ts3.visitEachChild(node, visitor, context);
1336
- };
1337
- function wrapFunctionExpressionsInParens(expression) {
1338
- return ts3.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
1650
+ function isAngularDecorator2(decorator, isCore) {
1651
+ return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
1339
1652
  }
1340
- function makeDuplicateDeclarationError(node, data, kind) {
1341
- const context = [];
1342
- for (const decl of data) {
1343
- if (decl.rawDeclarations === null) {
1344
- continue;
1345
- }
1346
- const contextNode = decl.ref.getOriginForDiagnostics(decl.rawDeclarations, decl.ngModule.name);
1347
- context.push(makeRelatedInformation(contextNode, `'${node.name.text}' is listed in the declarations of the NgModule '${decl.ngModule.name.text}'.`));
1348
- }
1349
- return makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_NOT_UNIQUE, node.name, `The ${kind} '${node.name.text}' is declared by more than one NgModule.`, context);
1653
+ function removeIdentifierReferences(node, name) {
1654
+ const result = ts7.transform(node, [(context) => (root) => ts7.visitNode(root, function walk(current) {
1655
+ return ts7.isIdentifier(current) && current.text === name ? ts7.createIdentifier(current.text) : ts7.visitEachChild(current, walk, context);
1656
+ })]);
1657
+ return result.transformed[0];
1350
1658
  }
1351
- function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
1352
- const providers = /* @__PURE__ */ new Set();
1353
- const resolvedProviders = evaluator.evaluate(rawProviders);
1354
- if (!Array.isArray(resolvedProviders)) {
1355
- return providers;
1659
+
1660
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/references_registry.mjs
1661
+ var NoopReferencesRegistry = class {
1662
+ add(source, ...references) {
1356
1663
  }
1357
- resolvedProviders.forEach(function processProviders(provider) {
1358
- let tokenClass = null;
1359
- if (Array.isArray(provider)) {
1360
- provider.forEach(processProviders);
1361
- } else if (provider instanceof Reference) {
1362
- tokenClass = provider;
1363
- } else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
1364
- const useExisting = provider.get("useClass");
1365
- if (useExisting instanceof Reference) {
1366
- tokenClass = useExisting;
1367
- }
1368
- }
1369
- if (tokenClass !== null && !tokenClass.node.getSourceFile().isDeclarationFile && reflector.isClass(tokenClass.node)) {
1370
- const constructorParameters = reflector.getConstructorParameters(tokenClass.node);
1371
- if (constructorParameters !== null && constructorParameters.length > 0) {
1372
- providers.add(tokenClass);
1373
- }
1374
- }
1375
- });
1376
- return providers;
1377
- }
1378
- function wrapTypeReference(reflector, clazz) {
1379
- const dtsClass = reflector.getDtsDeclaration(clazz);
1380
- const value = new WrappedNodeExpr(clazz.name);
1381
- const type = dtsClass !== null && isNamedClassDeclaration(dtsClass) ? new WrappedNodeExpr(dtsClass.name) : value;
1382
- return { value, type };
1383
- }
1384
- function createSourceSpan(node) {
1385
- const sf = node.getSourceFile();
1386
- const [startOffset, endOffset] = [node.getStart(), node.getEnd()];
1387
- const { line: startLine, character: startCol } = sf.getLineAndCharacterOfPosition(startOffset);
1388
- const { line: endLine, character: endCol } = sf.getLineAndCharacterOfPosition(endOffset);
1389
- const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
1390
- return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
1391
- }
1392
- function compileResults(fac, def, metadataStmt, propName) {
1393
- const statements = def.statements;
1394
- if (metadataStmt !== null) {
1395
- statements.push(metadataStmt);
1396
- }
1397
- return [
1398
- fac,
1399
- {
1400
- name: propName,
1401
- initializer: def.expression,
1402
- statements: def.statements,
1403
- type: def.type
1404
- }
1405
- ];
1406
- }
1407
- function toFactoryMetadata(meta, target) {
1408
- return {
1409
- name: meta.name,
1410
- type: meta.type,
1411
- internalType: meta.internalType,
1412
- typeArgumentCount: meta.typeArgumentCount,
1413
- deps: meta.deps,
1414
- target
1415
- };
1416
- }
1664
+ };
1417
1665
 
1418
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
1419
- import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DomElementSchemaRegistry, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget3, InterpolationConfig, makeBindingParser as makeBindingParser2, ParseSourceFile as ParseSourceFile2, parseTemplate, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
1420
- import ts21 from "typescript";
1666
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
1667
+ import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
1668
+ import ts24 from "typescript";
1421
1669
 
1422
1670
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
1423
- import ts4 from "typescript";
1671
+ import ts8 from "typescript";
1424
1672
  var SemanticSymbol = class {
1425
1673
  constructor(decl) {
1426
1674
  this.decl = decl;
@@ -1429,7 +1677,7 @@ var SemanticSymbol = class {
1429
1677
  }
1430
1678
  };
1431
1679
  function getSymbolIdentifier(decl) {
1432
- if (!ts4.isSourceFile(decl.parent)) {
1680
+ if (!ts8.isSourceFile(decl.parent)) {
1433
1681
  return null;
1434
1682
  }
1435
1683
  return decl.name.text;
@@ -1579,7 +1827,7 @@ function getImportPath(expr) {
1579
1827
  }
1580
1828
 
1581
1829
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
1582
- import ts5 from "typescript";
1830
+ import ts9 from "typescript";
1583
1831
 
1584
1832
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
1585
1833
  function isSymbolEqual(a, b) {
@@ -1633,7 +1881,7 @@ function isSetEqual(a, b, equalityTester = referenceEquality) {
1633
1881
 
1634
1882
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
1635
1883
  function extractSemanticTypeParameters(node) {
1636
- if (!ts5.isClassDeclaration(node) || node.typeParameters === void 0) {
1884
+ if (!ts9.isClassDeclaration(node) || node.typeParameters === void 0) {
1637
1885
  return null;
1638
1886
  }
1639
1887
  return node.typeParameters.map((typeParam) => ({ hasGenericTypeBound: typeParam.constraint !== void 0 }));
@@ -1659,7 +1907,7 @@ var MetaType;
1659
1907
  })(MetaType || (MetaType = {}));
1660
1908
 
1661
1909
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
1662
- import ts7 from "typescript";
1910
+ import ts11 from "typescript";
1663
1911
 
1664
1912
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/property_mapping.mjs
1665
1913
  var ClassPropertyMapping = class {
@@ -1738,13 +1986,13 @@ function reverseMapFromForwardMap(forwardMap) {
1738
1986
  }
1739
1987
 
1740
1988
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/util.mjs
1741
- import ts6 from "typescript";
1989
+ import ts10 from "typescript";
1742
1990
  function extractReferencesFromType(checker, def, bestGuessOwningModule) {
1743
- if (!ts6.isTupleTypeNode(def)) {
1991
+ if (!ts10.isTupleTypeNode(def)) {
1744
1992
  return [];
1745
1993
  }
1746
1994
  return def.elements.map((element) => {
1747
- if (!ts6.isTypeQueryNode(element)) {
1995
+ if (!ts10.isTypeQueryNode(element)) {
1748
1996
  throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(element)}`);
1749
1997
  }
1750
1998
  const type = element.exprName;
@@ -1760,18 +2008,18 @@ function extractReferencesFromType(checker, def, bestGuessOwningModule) {
1760
2008
  });
1761
2009
  }
1762
2010
  function readStringType(type) {
1763
- if (!ts6.isLiteralTypeNode(type) || !ts6.isStringLiteral(type.literal)) {
2011
+ if (!ts10.isLiteralTypeNode(type) || !ts10.isStringLiteral(type.literal)) {
1764
2012
  return null;
1765
2013
  }
1766
2014
  return type.literal.text;
1767
2015
  }
1768
2016
  function readStringMapType(type) {
1769
- if (!ts6.isTypeLiteralNode(type)) {
2017
+ if (!ts10.isTypeLiteralNode(type)) {
1770
2018
  return {};
1771
2019
  }
1772
2020
  const obj = {};
1773
2021
  type.members.forEach((member) => {
1774
- if (!ts6.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts6.isStringLiteral(member.name)) {
2022
+ if (!ts10.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts10.isStringLiteral(member.name)) {
1775
2023
  return;
1776
2024
  }
1777
2025
  const value = readStringType(member.type);
@@ -1783,12 +2031,12 @@ function readStringMapType(type) {
1783
2031
  return obj;
1784
2032
  }
1785
2033
  function readStringArrayType(type) {
1786
- if (!ts6.isTupleTypeNode(type)) {
2034
+ if (!ts10.isTupleTypeNode(type)) {
1787
2035
  return [];
1788
2036
  }
1789
2037
  const res = [];
1790
2038
  type.elements.forEach((el) => {
1791
- if (!ts6.isLiteralTypeNode(el) || !ts6.isStringLiteral(el.literal)) {
2039
+ if (!ts10.isLiteralTypeNode(el) || !ts10.isStringLiteral(el.literal)) {
1792
2040
  return;
1793
2041
  }
1794
2042
  res.push(el.literal.text);
@@ -1813,7 +2061,7 @@ function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
1813
2061
  if (isRestricted(field.node)) {
1814
2062
  restrictedInputFields.add(classPropertyName);
1815
2063
  }
1816
- if (field.nameNode !== null && ts6.isStringLiteral(field.nameNode)) {
2064
+ if (field.nameNode !== null && ts10.isStringLiteral(field.nameNode)) {
1817
2065
  stringLiteralInputFields.add(classPropertyName);
1818
2066
  }
1819
2067
  }
@@ -1832,7 +2080,7 @@ function isRestricted(node) {
1832
2080
  if (node.modifiers === void 0) {
1833
2081
  return false;
1834
2082
  }
1835
- return node.modifiers.some((modifier) => modifier.kind === ts6.SyntaxKind.PrivateKeyword || modifier.kind === ts6.SyntaxKind.ProtectedKeyword || modifier.kind === ts6.SyntaxKind.ReadonlyKeyword);
2083
+ return node.modifiers.some((modifier) => modifier.kind === ts10.SyntaxKind.PrivateKeyword || modifier.kind === ts10.SyntaxKind.ProtectedKeyword || modifier.kind === ts10.SyntaxKind.ReadonlyKeyword);
1836
2084
  }
1837
2085
  function extractTemplateGuard(member) {
1838
2086
  if (!member.name.startsWith("ngTemplateGuard_")) {
@@ -1841,7 +2089,7 @@ function extractTemplateGuard(member) {
1841
2089
  const inputName = afterUnderscore(member.name);
1842
2090
  if (member.kind === ClassMemberKind.Property) {
1843
2091
  let type = null;
1844
- if (member.type !== null && ts6.isLiteralTypeNode(member.type) && ts6.isStringLiteral(member.type.literal)) {
2092
+ if (member.type !== null && ts10.isLiteralTypeNode(member.type) && ts10.isStringLiteral(member.type.literal)) {
1845
2093
  type = member.type.literal.text;
1846
2094
  }
1847
2095
  if (type !== "binding") {
@@ -1915,7 +2163,7 @@ var DtsMetadataReader = class {
1915
2163
  const ngModuleDef = this.reflector.getMembersOfClass(clazz).find((member) => member.name === "\u0275mod" && member.isStatic);
1916
2164
  if (ngModuleDef === void 0) {
1917
2165
  return null;
1918
- } else if (ngModuleDef.type === null || !ts7.isTypeReferenceNode(ngModuleDef.type) || ngModuleDef.type.typeArguments === void 0 || ngModuleDef.type.typeArguments.length !== 4) {
2166
+ } else if (ngModuleDef.type === null || !ts11.isTypeReferenceNode(ngModuleDef.type) || ngModuleDef.type.typeArguments === void 0 || ngModuleDef.type.typeArguments.length !== 4) {
1919
2167
  return null;
1920
2168
  }
1921
2169
  const [_, declarationMetadata, importMetadata, exportMetadata] = ngModuleDef.type.typeArguments;
@@ -1933,7 +2181,7 @@ var DtsMetadataReader = class {
1933
2181
  const def = this.reflector.getMembersOfClass(clazz).find((field) => field.isStatic && (field.name === "\u0275cmp" || field.name === "\u0275dir"));
1934
2182
  if (def === void 0) {
1935
2183
  return null;
1936
- } else if (def.type === null || !ts7.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
2184
+ } else if (def.type === null || !ts11.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
1937
2185
  return null;
1938
2186
  }
1939
2187
  const isComponent = def.name === "\u0275cmp";
@@ -1957,18 +2205,19 @@ var DtsMetadataReader = class {
1957
2205
  baseClass: readBaseClass2(clazz, this.checker, this.reflector),
1958
2206
  isPoisoned: false,
1959
2207
  isStructural,
1960
- animationTriggerNames: null
2208
+ animationTriggerNames: null,
2209
+ isStandalone: false
1961
2210
  });
1962
2211
  }
1963
2212
  getPipeMetadata(ref) {
1964
2213
  const def = this.reflector.getMembersOfClass(ref.node).find((field) => field.isStatic && field.name === "\u0275pipe");
1965
2214
  if (def === void 0) {
1966
2215
  return null;
1967
- } else if (def.type === null || !ts7.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
2216
+ } else if (def.type === null || !ts11.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
1968
2217
  return null;
1969
2218
  }
1970
2219
  const type = def.type.typeArguments[1];
1971
- if (!ts7.isLiteralTypeNode(type) || !ts7.isStringLiteral(type.literal)) {
2220
+ if (!ts11.isLiteralTypeNode(type) || !ts11.isStringLiteral(type.literal)) {
1972
2221
  return null;
1973
2222
  }
1974
2223
  const name = type.literal.text;
@@ -1976,7 +2225,8 @@ var DtsMetadataReader = class {
1976
2225
  type: MetaType.Pipe,
1977
2226
  ref,
1978
2227
  name,
1979
- nameExpr: null
2228
+ nameExpr: null,
2229
+ isStandalone: false
1980
2230
  };
1981
2231
  }
1982
2232
  };
@@ -1986,12 +2236,12 @@ function readBaseClass2(clazz, checker, reflector) {
1986
2236
  }
1987
2237
  if (clazz.heritageClauses !== void 0) {
1988
2238
  for (const clause of clazz.heritageClauses) {
1989
- if (clause.token === ts7.SyntaxKind.ExtendsKeyword) {
2239
+ if (clause.token === ts11.SyntaxKind.ExtendsKeyword) {
1990
2240
  const baseExpr = clause.types[0].expression;
1991
2241
  let symbol = checker.getSymbolAtLocation(baseExpr);
1992
2242
  if (symbol === void 0) {
1993
2243
  return "dynamic";
1994
- } else if (symbol.flags & ts7.SymbolFlags.Alias) {
2244
+ } else if (symbol.flags & ts11.SymbolFlags.Alias) {
1995
2245
  symbol = checker.getAliasedSymbol(symbol);
1996
2246
  }
1997
2247
  if (symbol.valueDeclaration !== void 0 && isNamedClassDeclaration(symbol.valueDeclaration)) {
@@ -2205,28 +2455,28 @@ var HandlerFlags;
2205
2455
  })(HandlerFlags || (HandlerFlags = {}));
2206
2456
 
2207
2457
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
2208
- import ts8 from "typescript";
2458
+ import ts12 from "typescript";
2209
2459
  function aliasTransformFactory(exportStatements) {
2210
2460
  return (context) => {
2211
2461
  return (file) => {
2212
- if (ts8.isBundle(file) || !exportStatements.has(file.fileName)) {
2462
+ if (ts12.isBundle(file) || !exportStatements.has(file.fileName)) {
2213
2463
  return file;
2214
2464
  }
2215
2465
  const statements = [...file.statements];
2216
2466
  exportStatements.get(file.fileName).forEach(([moduleName, symbolName], aliasName) => {
2217
- const stmt = ts8.createExportDeclaration(void 0, void 0, ts8.createNamedExports([createExportSpecifier(symbolName, aliasName)]), ts8.createStringLiteral(moduleName));
2467
+ const stmt = ts12.createExportDeclaration(void 0, void 0, ts12.createNamedExports([createExportSpecifier(symbolName, aliasName)]), ts12.createStringLiteral(moduleName));
2218
2468
  statements.push(stmt);
2219
2469
  });
2220
- return ts8.updateSourceFileNode(file, statements);
2470
+ return ts12.updateSourceFileNode(file, statements);
2221
2471
  };
2222
2472
  };
2223
2473
  }
2224
2474
 
2225
2475
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
2226
- import ts12 from "typescript";
2476
+ import ts16 from "typescript";
2227
2477
 
2228
2478
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
2229
- import ts9 from "typescript";
2479
+ import ts13 from "typescript";
2230
2480
 
2231
2481
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
2232
2482
  var NgExtension = Symbol("NgExtension");
@@ -2372,7 +2622,7 @@ var ShimAdapter = class {
2372
2622
  return void 0;
2373
2623
  }
2374
2624
  }
2375
- const inputFile = this.delegate.getSourceFile(baseFileName, ts9.ScriptTarget.Latest);
2625
+ const inputFile = this.delegate.getSourceFile(baseFileName, ts13.ScriptTarget.Latest);
2376
2626
  if (inputFile === void 0 || isShim(inputFile)) {
2377
2627
  return void 0;
2378
2628
  }
@@ -2401,7 +2651,7 @@ var ShimAdapter = class {
2401
2651
  };
2402
2652
 
2403
2653
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
2404
- import ts10 from "typescript";
2654
+ import ts14 from "typescript";
2405
2655
  var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
2406
2656
  var STRIP_NG_FACTORY = /(.*)NgFactory$/;
2407
2657
  var FactoryGenerator = class {
@@ -2414,7 +2664,7 @@ var FactoryGenerator = class {
2414
2664
  generateShimForFile(sf, genFilePath) {
2415
2665
  const absoluteSfPath = absoluteFromSourceFile(sf);
2416
2666
  const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
2417
- const symbolNames = sf.statements.filter(ts10.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
2667
+ const symbolNames = sf.statements.filter(ts14.isClassDeclaration).filter((decl) => isExported(decl) && decl.decorators !== void 0 && decl.name !== void 0).map((decl) => decl.name.text);
2418
2668
  let sourceText = "";
2419
2669
  const leadingComment = getFileoverviewComment(sf);
2420
2670
  if (leadingComment !== null) {
@@ -2429,7 +2679,7 @@ var FactoryGenerator = class {
2429
2679
  ].join("\n");
2430
2680
  }
2431
2681
  sourceText += "\nexport const \u0275NonEmptyModule = true;";
2432
- const genFile = ts10.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts10.ScriptKind.TS);
2682
+ const genFile = ts14.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts14.ScriptKind.TS);
2433
2683
  if (sf.moduleName !== void 0) {
2434
2684
  genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
2435
2685
  }
@@ -2448,7 +2698,7 @@ var FactoryGenerator = class {
2448
2698
  }
2449
2699
  };
2450
2700
  function isExported(decl) {
2451
- return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts10.SyntaxKind.ExportKeyword);
2701
+ return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts14.SyntaxKind.ExportKeyword);
2452
2702
  }
2453
2703
  function generatedFactoryTransform(factoryMap, importRewriter) {
2454
2704
  return (context) => {
@@ -2466,19 +2716,19 @@ function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
2466
2716
  let nonEmptyExport = null;
2467
2717
  const coreImportIdentifiers = /* @__PURE__ */ new Set();
2468
2718
  for (const stmt of file.statements) {
2469
- if (ts10.isImportDeclaration(stmt) && ts10.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
2719
+ if (ts14.isImportDeclaration(stmt) && ts14.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
2470
2720
  const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
2471
2721
  if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
2472
- transformedStatements.push(ts10.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts10.createStringLiteral(rewrittenModuleSpecifier), void 0));
2473
- if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts10.isNamespaceImport(stmt.importClause.namedBindings)) {
2722
+ transformedStatements.push(ts14.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts14.createStringLiteral(rewrittenModuleSpecifier), void 0));
2723
+ if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts14.isNamespaceImport(stmt.importClause.namedBindings)) {
2474
2724
  coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
2475
2725
  }
2476
2726
  } else {
2477
2727
  transformedStatements.push(stmt);
2478
2728
  }
2479
- } else if (ts10.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
2729
+ } else if (ts14.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
2480
2730
  const decl = stmt.declarationList.declarations[0];
2481
- if (ts10.isIdentifier(decl.name)) {
2731
+ if (ts14.isIdentifier(decl.name)) {
2482
2732
  if (decl.name.text === "\u0275NonEmptyModule") {
2483
2733
  nonEmptyExport = stmt;
2484
2734
  continue;
@@ -2497,17 +2747,17 @@ function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
2497
2747
  transformedStatements.push(stmt);
2498
2748
  }
2499
2749
  }
2500
- if (!transformedStatements.some(ts10.isVariableStatement) && nonEmptyExport !== null) {
2750
+ if (!transformedStatements.some(ts14.isVariableStatement) && nonEmptyExport !== null) {
2501
2751
  transformedStatements.push(nonEmptyExport);
2502
2752
  }
2503
- file = ts10.updateSourceFileNode(file, transformedStatements);
2753
+ file = ts14.updateSourceFileNode(file, transformedStatements);
2504
2754
  if (coreImportIdentifiers.size > 0) {
2505
2755
  const visit2 = (node) => {
2506
- node = ts10.visitEachChild(node, (child) => visit2(child), context);
2507
- if (ts10.isPropertyAccessExpression(node) && ts10.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
2756
+ node = ts14.visitEachChild(node, (child) => visit2(child), context);
2757
+ if (ts14.isPropertyAccessExpression(node) && ts14.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
2508
2758
  const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
2509
2759
  if (rewrittenSymbol !== node.name.text) {
2510
- const updated = ts10.updatePropertyAccess(node, node.expression, ts10.createIdentifier(rewrittenSymbol));
2760
+ const updated = ts14.updatePropertyAccess(node, node.expression, ts14.createIdentifier(rewrittenSymbol));
2511
2761
  node = updated;
2512
2762
  }
2513
2763
  }
@@ -2520,12 +2770,12 @@ function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
2520
2770
  function getFileoverviewComment(sourceFile) {
2521
2771
  const text = sourceFile.getFullText();
2522
2772
  const trivia = text.substring(0, sourceFile.getStart());
2523
- const leadingComments = ts10.getLeadingCommentRanges(trivia, 0);
2773
+ const leadingComments = ts14.getLeadingCommentRanges(trivia, 0);
2524
2774
  if (!leadingComments || leadingComments.length === 0) {
2525
2775
  return null;
2526
2776
  }
2527
2777
  const comment = leadingComments[0];
2528
- if (comment.kind !== ts10.SyntaxKind.MultiLineCommentTrivia) {
2778
+ if (comment.kind !== ts14.SyntaxKind.MultiLineCommentTrivia) {
2529
2779
  return null;
2530
2780
  }
2531
2781
  if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
@@ -2538,15 +2788,15 @@ function getFileoverviewComment(sourceFile) {
2538
2788
  return commentText;
2539
2789
  }
2540
2790
  function wrapInNoSideEffects(expr) {
2541
- const noSideEffects = ts10.createPropertyAccess(ts10.createIdentifier("i0"), "\u0275noSideEffects");
2542
- return ts10.createCall(noSideEffects, [], [
2543
- ts10.createFunctionExpression([], void 0, void 0, [], [], void 0, ts10.createBlock([
2544
- ts10.createReturn(expr)
2791
+ const noSideEffects = ts14.createPropertyAccess(ts14.createIdentifier("i0"), "\u0275noSideEffects");
2792
+ return ts14.createCall(noSideEffects, [], [
2793
+ ts14.createFunctionExpression([], void 0, void 0, [], [], void 0, ts14.createBlock([
2794
+ ts14.createReturn(expr)
2545
2795
  ]))
2546
2796
  ]);
2547
2797
  }
2548
2798
  function updateInitializers(stmt, update) {
2549
- return ts10.updateVariableStatement(stmt, stmt.modifiers, ts10.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts10.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
2799
+ return ts14.updateVariableStatement(stmt, stmt.modifiers, ts14.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts14.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
2550
2800
  }
2551
2801
 
2552
2802
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
@@ -2584,7 +2834,7 @@ var ShimReferenceTagger = class {
2584
2834
  };
2585
2835
 
2586
2836
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
2587
- import ts11 from "typescript";
2837
+ import ts15 from "typescript";
2588
2838
  var SummaryGenerator = class {
2589
2839
  constructor() {
2590
2840
  this.shouldEmit = true;
@@ -2593,13 +2843,13 @@ var SummaryGenerator = class {
2593
2843
  generateShimForFile(sf, genFilePath) {
2594
2844
  const symbolNames = [];
2595
2845
  for (const stmt of sf.statements) {
2596
- if (ts11.isClassDeclaration(stmt)) {
2846
+ if (ts15.isClassDeclaration(stmt)) {
2597
2847
  if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
2598
2848
  continue;
2599
2849
  }
2600
2850
  symbolNames.push(stmt.name.text);
2601
- } else if (ts11.isExportDeclaration(stmt)) {
2602
- if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts11.isNamedExports(stmt.exportClause)) {
2851
+ } else if (ts15.isExportDeclaration(stmt)) {
2852
+ if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts15.isNamedExports(stmt.exportClause)) {
2603
2853
  continue;
2604
2854
  }
2605
2855
  for (const specifier of stmt.exportClause.elements) {
@@ -2612,7 +2862,7 @@ var SummaryGenerator = class {
2612
2862
  varLines.push(`export const \u0275empty = null;`);
2613
2863
  }
2614
2864
  const sourceText = varLines.join("\n");
2615
- const genFile = ts11.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts11.ScriptKind.TS);
2865
+ const genFile = ts15.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts15.ScriptKind.TS);
2616
2866
  if (sf.moduleName !== void 0) {
2617
2867
  genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
2618
2868
  }
@@ -2620,7 +2870,7 @@ var SummaryGenerator = class {
2620
2870
  }
2621
2871
  };
2622
2872
  function isExported2(decl) {
2623
- return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts11.SyntaxKind.ExportKeyword);
2873
+ return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts15.SyntaxKind.ExportKeyword);
2624
2874
  }
2625
2875
 
2626
2876
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/trait.mjs
@@ -2726,7 +2976,7 @@ var TraitCompiler = class {
2726
2976
  if (this.reflector.isClass(node)) {
2727
2977
  this.analyzeClass(node, preanalyze ? promises : null);
2728
2978
  }
2729
- ts12.forEachChild(node, visit2);
2979
+ ts16.forEachChild(node, visit2);
2730
2980
  };
2731
2981
  visit2(sf);
2732
2982
  if (!this.fileToClasses.has(sf)) {
@@ -2840,7 +3090,7 @@ var TraitCompiler = class {
2840
3090
  }
2841
3091
  if (isPrimaryHandler && record.hasPrimaryHandler) {
2842
3092
  record.metaDiagnostics = [{
2843
- category: ts12.DiagnosticCategory.Error,
3093
+ category: ts16.DiagnosticCategory.Error,
2844
3094
  code: Number("-99" + ErrorCode.DECORATOR_COLLISION),
2845
3095
  file: getSourceFile(clazz),
2846
3096
  start: clazz.getStart(void 0, false),
@@ -3048,7 +3298,7 @@ var TraitCompiler = class {
3048
3298
  }
3049
3299
  }
3050
3300
  compile(clazz, constantPool) {
3051
- const original = ts12.getOriginalNode(clazz);
3301
+ const original = ts16.getOriginalNode(clazz);
3052
3302
  if (!this.reflector.isClass(clazz) || !this.reflector.isClass(original) || !this.classes.has(original)) {
3053
3303
  return null;
3054
3304
  }
@@ -3079,7 +3329,7 @@ var TraitCompiler = class {
3079
3329
  return res.length > 0 ? res : null;
3080
3330
  }
3081
3331
  decoratorsFor(node) {
3082
- const original = ts12.getOriginalNode(node);
3332
+ const original = ts16.getOriginalNode(node);
3083
3333
  if (!this.reflector.isClass(original) || !this.classes.has(original)) {
3084
3334
  return [];
3085
3335
  }
@@ -3089,7 +3339,7 @@ var TraitCompiler = class {
3089
3339
  if (trait.state !== TraitState.Resolved) {
3090
3340
  continue;
3091
3341
  }
3092
- if (trait.detected.trigger !== null && ts12.isDecorator(trait.detected.trigger)) {
3342
+ if (trait.detected.trigger !== null && ts16.isDecorator(trait.detected.trigger)) {
3093
3343
  decorators.push(trait.detected.trigger);
3094
3344
  }
3095
3345
  }
@@ -3119,23 +3369,23 @@ var TraitCompiler = class {
3119
3369
  };
3120
3370
 
3121
3371
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
3122
- import ts14 from "typescript";
3372
+ import ts18 from "typescript";
3123
3373
 
3124
3374
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
3125
- import ts13 from "typescript";
3375
+ import ts17 from "typescript";
3126
3376
  function addImports(importManager, sf, extraStatements = []) {
3127
3377
  const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
3128
- const qualifier = ts13.createIdentifier(i.qualifier.text);
3129
- const importClause = ts13.createImportClause(void 0, ts13.createNamespaceImport(qualifier));
3130
- const decl = ts13.createImportDeclaration(void 0, void 0, importClause, ts13.createLiteral(i.specifier));
3131
- ts13.setOriginalNode(i.qualifier, decl);
3378
+ const qualifier = ts17.createIdentifier(i.qualifier.text);
3379
+ const importClause = ts17.createImportClause(void 0, ts17.createNamespaceImport(qualifier));
3380
+ const decl = ts17.createImportDeclaration(void 0, void 0, importClause, ts17.createLiteral(i.specifier));
3381
+ ts17.setOriginalNode(i.qualifier, decl);
3132
3382
  return decl;
3133
3383
  });
3134
3384
  const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
3135
3385
  const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
3136
3386
  if (addedImports.length > 0) {
3137
- const fileoverviewAnchorStmt = ts13.createNotEmittedStatement(sf);
3138
- return ts13.updateSourceFileNode(sf, ts13.createNodeArray([
3387
+ const fileoverviewAnchorStmt = ts17.createNotEmittedStatement(sf);
3388
+ return ts17.updateSourceFileNode(sf, ts17.createNodeArray([
3139
3389
  fileoverviewAnchorStmt,
3140
3390
  ...existingImports,
3141
3391
  ...addedImports,
@@ -3146,7 +3396,7 @@ function addImports(importManager, sf, extraStatements = []) {
3146
3396
  return sf;
3147
3397
  }
3148
3398
  function isImportStatement(stmt) {
3149
- return ts13.isImportDeclaration(stmt) || ts13.isImportEqualsDeclaration(stmt) || ts13.isNamespaceImport(stmt);
3399
+ return ts17.isImportDeclaration(stmt) || ts17.isImportEqualsDeclaration(stmt) || ts17.isNamespaceImport(stmt);
3150
3400
  }
3151
3401
 
3152
3402
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
@@ -3164,7 +3414,7 @@ var DtsTransformRegistry = class {
3164
3414
  if (!sf.isDeclarationFile) {
3165
3415
  return null;
3166
3416
  }
3167
- const originalSf = ts14.getOriginalNode(sf);
3417
+ const originalSf = ts18.getOriginalNode(sf);
3168
3418
  let transforms = null;
3169
3419
  if (this.ivyDeclarationTransforms.has(originalSf)) {
3170
3420
  transforms = [];
@@ -3177,7 +3427,7 @@ function declarationTransformFactory(transformRegistry, importRewriter, importPr
3177
3427
  return (context) => {
3178
3428
  const transformer = new DtsTransformer(context, importRewriter, importPrefix);
3179
3429
  return (fileOrBundle) => {
3180
- if (ts14.isBundle(fileOrBundle)) {
3430
+ if (ts18.isBundle(fileOrBundle)) {
3181
3431
  return fileOrBundle;
3182
3432
  }
3183
3433
  const transforms = transformRegistry.getAllTransforms(fileOrBundle);
@@ -3197,15 +3447,15 @@ var DtsTransformer = class {
3197
3447
  transform(sf, transforms) {
3198
3448
  const imports = new ImportManager(this.importRewriter, this.importPrefix);
3199
3449
  const visitor = (node) => {
3200
- if (ts14.isClassDeclaration(node)) {
3450
+ if (ts18.isClassDeclaration(node)) {
3201
3451
  return this.transformClassDeclaration(node, transforms, imports);
3202
- } else if (ts14.isFunctionDeclaration(node)) {
3452
+ } else if (ts18.isFunctionDeclaration(node)) {
3203
3453
  return this.transformFunctionDeclaration(node, transforms, imports);
3204
3454
  } else {
3205
- return ts14.visitEachChild(node, visitor, this.ctx);
3455
+ return ts18.visitEachChild(node, visitor, this.ctx);
3206
3456
  }
3207
3457
  };
3208
- sf = ts14.visitNode(sf, visitor);
3458
+ sf = ts18.visitNode(sf, visitor);
3209
3459
  return addImports(imports, sf);
3210
3460
  }
3211
3461
  transformClassDeclaration(clazz, transforms, imports) {
@@ -3233,7 +3483,7 @@ var DtsTransformer = class {
3233
3483
  }
3234
3484
  }
3235
3485
  if (elementsChanged && clazz === newClazz) {
3236
- newClazz = ts14.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, elements);
3486
+ newClazz = ts18.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, elements);
3237
3487
  }
3238
3488
  return newClazz;
3239
3489
  }
@@ -3255,31 +3505,31 @@ var IvyDeclarationDtsTransform = class {
3255
3505
  this.declarationFields.set(decl, fields);
3256
3506
  }
3257
3507
  transformClass(clazz, members, imports) {
3258
- const original = ts14.getOriginalNode(clazz);
3508
+ const original = ts18.getOriginalNode(clazz);
3259
3509
  if (!this.declarationFields.has(original)) {
3260
3510
  return clazz;
3261
3511
  }
3262
3512
  const fields = this.declarationFields.get(original);
3263
3513
  const newMembers = fields.map((decl) => {
3264
- const modifiers = [ts14.createModifier(ts14.SyntaxKind.StaticKeyword)];
3514
+ const modifiers = [ts18.createModifier(ts18.SyntaxKind.StaticKeyword)];
3265
3515
  const typeRef = translateType(decl.type, imports);
3266
3516
  markForEmitAsSingleLine(typeRef);
3267
- return ts14.createProperty(void 0, modifiers, decl.name, void 0, typeRef, void 0);
3517
+ return ts18.createProperty(void 0, modifiers, decl.name, void 0, typeRef, void 0);
3268
3518
  });
3269
- return ts14.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
3519
+ return ts18.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
3270
3520
  }
3271
3521
  };
3272
3522
  function markForEmitAsSingleLine(node) {
3273
- ts14.setEmitFlags(node, ts14.EmitFlags.SingleLine);
3274
- ts14.forEachChild(node, markForEmitAsSingleLine);
3523
+ ts18.setEmitFlags(node, ts18.EmitFlags.SingleLine);
3524
+ ts18.forEachChild(node, markForEmitAsSingleLine);
3275
3525
  }
3276
3526
 
3277
3527
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
3278
3528
  import { ConstantPool } from "@angular/compiler";
3279
- import ts16 from "typescript";
3529
+ import ts20 from "typescript";
3280
3530
 
3281
3531
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
3282
- import ts15 from "typescript";
3532
+ import ts19 from "typescript";
3283
3533
  function visit(node, visitor, context) {
3284
3534
  return visitor._visit(node, context);
3285
3535
  }
@@ -3303,8 +3553,8 @@ var Visitor = class {
3303
3553
  }
3304
3554
  _visit(node, context) {
3305
3555
  let visitedNode = null;
3306
- node = ts15.visitEachChild(node, (child) => this._visit(child, context), context);
3307
- if (ts15.isClassDeclaration(node)) {
3556
+ node = ts19.visitEachChild(node, (child) => this._visit(child, context), context);
3557
+ if (ts19.isClassDeclaration(node)) {
3308
3558
  visitedNode = this._visitListEntryNode(node, (node2) => this.visitClassDeclaration(node2));
3309
3559
  } else {
3310
3560
  visitedNode = this.visitOtherNode(node);
@@ -3318,7 +3568,7 @@ var Visitor = class {
3318
3568
  if (node.statements.every((stmt) => !this._before.has(stmt) && !this._after.has(stmt))) {
3319
3569
  return node;
3320
3570
  }
3321
- const clone = ts15.getMutableClone(node);
3571
+ const clone = ts19.getMutableClone(node);
3322
3572
  const newStatements = [];
3323
3573
  clone.statements.forEach((stmt) => {
3324
3574
  if (this._before.has(stmt)) {
@@ -3331,7 +3581,7 @@ var Visitor = class {
3331
3581
  this._after.delete(stmt);
3332
3582
  }
3333
3583
  });
3334
- clone.statements = ts15.createNodeArray(newStatements, node.statements.hasTrailingComma);
3584
+ clone.statements = ts19.createNodeArray(newStatements, node.statements.hasTrailingComma);
3335
3585
  return clone;
3336
3586
  }
3337
3587
  };
@@ -3369,571 +3619,171 @@ var IvyCompilationVisitor = class extends Visitor {
3369
3619
  var IvyTransformationVisitor = class extends Visitor {
3370
3620
  constructor(compilation, classCompilationMap, reflector, importManager, recordWrappedNodeExpr, isClosureCompilerEnabled, isCore) {
3371
3621
  super();
3372
- this.compilation = compilation;
3373
- this.classCompilationMap = classCompilationMap;
3374
- this.reflector = reflector;
3375
- this.importManager = importManager;
3376
- this.recordWrappedNodeExpr = recordWrappedNodeExpr;
3377
- this.isClosureCompilerEnabled = isClosureCompilerEnabled;
3378
- this.isCore = isCore;
3379
- }
3380
- visitClassDeclaration(node) {
3381
- if (!this.classCompilationMap.has(node)) {
3382
- return { node };
3383
- }
3384
- const translateOptions = {
3385
- recordWrappedNode: this.recordWrappedNodeExpr,
3386
- annotateForClosureCompiler: this.isClosureCompilerEnabled
3387
- };
3388
- const statements = [];
3389
- const members = [...node.members];
3390
- for (const field of this.classCompilationMap.get(node)) {
3391
- const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
3392
- const property = ts16.createProperty(void 0, [ts16.createToken(ts16.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
3393
- if (this.isClosureCompilerEnabled) {
3394
- ts16.addSyntheticLeadingComment(property, ts16.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
3395
- }
3396
- field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
3397
- members.push(property);
3398
- }
3399
- node = ts16.updateClassDeclaration(node, maybeFilterDecorator(node.decorators, this.compilation.decoratorsFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], members.map((member) => this._stripAngularDecorators(member)));
3400
- return { node, after: statements };
3401
- }
3402
- _angularCoreDecorators(decl) {
3403
- const decorators = this.reflector.getDecoratorsOfDeclaration(decl);
3404
- if (decorators === null) {
3405
- return NO_DECORATORS;
3406
- }
3407
- const coreDecorators = decorators.filter((dec) => this.isCore || isFromAngularCore(dec)).map((dec) => dec.node);
3408
- if (coreDecorators.length > 0) {
3409
- return new Set(coreDecorators);
3410
- } else {
3411
- return NO_DECORATORS;
3412
- }
3413
- }
3414
- _nonCoreDecoratorsOnly(node) {
3415
- if (node.decorators === void 0) {
3416
- return void 0;
3417
- }
3418
- const coreDecorators = this._angularCoreDecorators(node);
3419
- if (coreDecorators.size === node.decorators.length) {
3420
- return void 0;
3421
- } else if (coreDecorators.size === 0) {
3422
- return node.decorators;
3423
- }
3424
- const filtered = node.decorators.filter((dec) => !coreDecorators.has(dec));
3425
- if (filtered.length === 0) {
3426
- return void 0;
3427
- }
3428
- const array = ts16.createNodeArray(filtered);
3429
- array.pos = node.decorators.pos;
3430
- array.end = node.decorators.end;
3431
- return array;
3432
- }
3433
- _stripAngularDecorators(node) {
3434
- if (ts16.isParameter(node)) {
3435
- node = ts16.updateParameter(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
3436
- } else if (ts16.isMethodDeclaration(node) && node.decorators !== void 0) {
3437
- node = ts16.updateMethod(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
3438
- } else if (ts16.isPropertyDeclaration(node) && node.decorators !== void 0) {
3439
- node = ts16.updateProperty(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.questionToken, node.type, node.initializer);
3440
- } else if (ts16.isGetAccessor(node)) {
3441
- node = ts16.updateGetAccessor(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.type, node.body);
3442
- } else if (ts16.isSetAccessor(node)) {
3443
- node = ts16.updateSetAccessor(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.body);
3444
- } else if (ts16.isConstructorDeclaration(node)) {
3445
- const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
3446
- node = ts16.updateConstructor(node, node.decorators, node.modifiers, parameters, node.body);
3447
- }
3448
- return node;
3449
- }
3450
- };
3451
- function transformIvySourceFile(compilation, context, reflector, importRewriter, file, isCore, isClosureCompilerEnabled, recordWrappedNode) {
3452
- const constantPool = new ConstantPool(isClosureCompilerEnabled);
3453
- const importManager = new ImportManager(importRewriter);
3454
- const compilationVisitor = new IvyCompilationVisitor(compilation, constantPool);
3455
- visit(file, compilationVisitor, context);
3456
- const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore);
3457
- let sf = visit(file, transformationVisitor, context);
3458
- const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts16.ScriptTarget.ES2015;
3459
- const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
3460
- recordWrappedNode,
3461
- downlevelTaggedTemplates: downlevelTranslatedCode,
3462
- downlevelVariableDeclarations: downlevelTranslatedCode,
3463
- annotateForClosureCompiler: isClosureCompilerEnabled
3464
- }));
3465
- const fileOverviewMeta = isClosureCompilerEnabled ? getFileOverviewComment(sf.statements) : null;
3466
- sf = addImports(importManager, sf, constants);
3467
- if (fileOverviewMeta !== null) {
3468
- setFileOverviewComment(sf, fileOverviewMeta);
3469
- }
3470
- return sf;
3471
- }
3472
- function getLocalizeCompileTarget(context) {
3473
- const target = context.getCompilerOptions().target || ts16.ScriptTarget.ES2015;
3474
- return target !== ts16.ScriptTarget.JSON ? target : ts16.ScriptTarget.ES2015;
3475
- }
3476
- function getFileOverviewComment(statements) {
3477
- if (statements.length > 0) {
3478
- const host = statements[0];
3479
- let trailing = false;
3480
- let comments = ts16.getSyntheticLeadingComments(host);
3481
- if (!comments || comments.length === 0) {
3482
- trailing = true;
3483
- comments = ts16.getSyntheticTrailingComments(host);
3484
- }
3485
- if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
3486
- return { comments, host, trailing };
3487
- }
3488
- }
3489
- return null;
3490
- }
3491
- function setFileOverviewComment(sf, fileoverview) {
3492
- const { comments, host, trailing } = fileoverview;
3493
- if (sf.statements.length > 0 && host !== sf.statements[0]) {
3494
- if (trailing) {
3495
- ts16.setSyntheticTrailingComments(host, void 0);
3496
- } else {
3497
- ts16.setSyntheticLeadingComments(host, void 0);
3498
- }
3499
- ts16.setSyntheticLeadingComments(sf.statements[0], comments);
3500
- }
3501
- }
3502
- function maybeFilterDecorator(decorators, toRemove) {
3503
- if (decorators === void 0) {
3504
- return void 0;
3505
- }
3506
- const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts16.getOriginalNode(dec) === decToRemove) === void 0);
3507
- if (filtered.length === 0) {
3508
- return void 0;
3509
- }
3510
- return ts16.createNodeArray(filtered);
3511
- }
3512
- function isFromAngularCore(decorator) {
3513
- return decorator.import !== null && decorator.import.from === "@angular/core";
3514
- }
3515
- function createRecorderFn(defaultImportTracker) {
3516
- return (node) => {
3517
- const importDecl = getDefaultImportDeclaration(node);
3518
- if (importDecl !== null) {
3519
- defaultImportTracker.recordUsedImport(importDecl);
3520
- }
3521
- };
3522
- }
3523
-
3524
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/diagnostics.mjs
3525
- import ts17 from "typescript";
3526
- function createValueHasWrongTypeError(node, value, messageText) {
3527
- var _a;
3528
- let chainedMessage;
3529
- let relatedInformation;
3530
- if (value instanceof DynamicValue) {
3531
- chainedMessage = "Value could not be determined statically.";
3532
- relatedInformation = traceDynamicValue(node, value);
3533
- } else if (value instanceof Reference) {
3534
- const target = value.debugName !== null ? `'${value.debugName}'` : "an anonymous declaration";
3535
- chainedMessage = `Value is a reference to ${target}.`;
3536
- const referenceNode = (_a = identifierOfNode(value.node)) != null ? _a : value.node;
3537
- relatedInformation = [makeRelatedInformation(referenceNode, "Reference is declared here.")];
3538
- } else {
3539
- chainedMessage = `Value is of type '${describeResolvedType(value)}'.`;
3540
- }
3541
- const chain = {
3542
- messageText,
3543
- category: ts17.DiagnosticCategory.Error,
3544
- code: 0,
3545
- next: [{
3546
- messageText: chainedMessage,
3547
- category: ts17.DiagnosticCategory.Message,
3548
- code: 0
3549
- }]
3550
- };
3551
- return new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, node, chain, relatedInformation);
3552
- }
3553
- function getProviderDiagnostics(providerClasses, providersDeclaration, registry) {
3554
- const diagnostics = [];
3555
- for (const provider of providerClasses) {
3556
- if (registry.isInjectable(provider.node)) {
3557
- continue;
3558
- }
3559
- const contextNode = provider.getOriginForDiagnostics(providersDeclaration);
3560
- diagnostics.push(makeDiagnostic(ErrorCode.UNDECORATED_PROVIDER, contextNode, `The class '${provider.node.name.text}' cannot be created via dependency injection, as it does not have an Angular decorator. This will result in an error at runtime.
3561
-
3562
- Either add the @Injectable() decorator to '${provider.node.name.text}', or configure a different provider (such as a provider with 'useFactory').
3563
- `, [makeRelatedInformation(provider.node, `'${provider.node.name.text}' is declared here.`)]));
3564
- }
3565
- return diagnostics;
3566
- }
3567
- function getDirectiveDiagnostics(node, reader, evaluator, reflector, scopeRegistry, kind) {
3568
- let diagnostics = [];
3569
- const addDiagnostics = (more) => {
3570
- if (more === null) {
3571
- return;
3572
- } else if (diagnostics === null) {
3573
- diagnostics = Array.isArray(more) ? more : [more];
3574
- } else if (Array.isArray(more)) {
3575
- diagnostics.push(...more);
3576
- } else {
3577
- diagnostics.push(more);
3578
- }
3579
- };
3580
- const duplicateDeclarations = scopeRegistry.getDuplicateDeclarations(node);
3581
- if (duplicateDeclarations !== null) {
3582
- addDiagnostics(makeDuplicateDeclarationError(node, duplicateDeclarations, kind));
3583
- }
3584
- addDiagnostics(checkInheritanceOfDirective(node, reader, reflector, evaluator));
3585
- return diagnostics;
3586
- }
3587
- function getUndecoratedClassWithAngularFeaturesDiagnostic(node) {
3588
- return makeDiagnostic(ErrorCode.UNDECORATED_CLASS_USING_ANGULAR_FEATURES, node.name, `Class is using Angular features but is not decorated. Please add an explicit Angular decorator.`);
3589
- }
3590
- function checkInheritanceOfDirective(node, reader, reflector, evaluator) {
3591
- if (!reflector.isClass(node) || reflector.getConstructorParameters(node) !== null) {
3592
- return null;
3593
- }
3594
- let baseClass = readBaseClass(node, reflector, evaluator);
3595
- while (baseClass !== null) {
3596
- if (baseClass === "dynamic") {
3597
- return null;
3598
- }
3599
- const baseClassMeta = reader.getDirectiveMetadata(baseClass);
3600
- if (baseClassMeta !== null) {
3601
- return null;
3602
- }
3603
- const baseClassConstructorParams = reflector.getConstructorParameters(baseClass.node);
3604
- const newParentClass = readBaseClass(baseClass.node, reflector, evaluator);
3605
- if (baseClassConstructorParams !== null && baseClassConstructorParams.length > 0) {
3606
- return getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader);
3607
- } else if (baseClassConstructorParams !== null || newParentClass === null) {
3608
- return null;
3609
- }
3610
- baseClass = newParentClass;
3611
- }
3612
- return null;
3613
- }
3614
- function getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader) {
3615
- const subclassMeta = reader.getDirectiveMetadata(new Reference(node));
3616
- const dirOrComp = subclassMeta.isComponent ? "Component" : "Directive";
3617
- const baseClassName = baseClass.debugName;
3618
- return makeDiagnostic(ErrorCode.DIRECTIVE_INHERITS_UNDECORATED_CTOR, node.name, `The ${dirOrComp.toLowerCase()} ${node.name.text} inherits its constructor from ${baseClassName}, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of ${baseClassName}'s constructor. Either add a @Directive decorator to ${baseClassName}, or add an explicit constructor to ${node.name.text}.`);
3619
- }
3620
-
3621
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/directive.mjs
3622
- import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr3, FactoryTarget, getSafePropertyAccessString, makeBindingParser, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
3623
- import ts19 from "typescript";
3624
-
3625
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/factory.mjs
3626
- import { compileDeclareFactoryFunction, compileFactoryFunction } from "@angular/compiler";
3627
- function compileNgFactoryDefField(metadata) {
3628
- const res = compileFactoryFunction(metadata);
3629
- return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
3630
- }
3631
- function compileDeclareFactory(metadata) {
3632
- const res = compileDeclareFactoryFunction(metadata);
3633
- return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
3634
- }
3635
-
3636
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/metadata.mjs
3637
- import { FunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
3638
- import ts18 from "typescript";
3639
- function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
3640
- if (!reflection.isClass(clazz)) {
3641
- return null;
3642
- }
3643
- const id = reflection.getAdjacentNameOfClass(clazz);
3644
- const classDecorators = reflection.getDecoratorsOfDeclaration(clazz);
3645
- if (classDecorators === null) {
3646
- return null;
3647
- }
3648
- const ngClassDecorators = classDecorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(angularDecoratorTransform(decorator), annotateForClosureCompiler)).map((decorator) => removeIdentifierReferences(decorator, id.text));
3649
- if (ngClassDecorators.length === 0) {
3650
- return null;
3651
- }
3652
- const metaDecorators = new WrappedNodeExpr2(ts18.createArrayLiteral(ngClassDecorators));
3653
- let metaCtorParameters = null;
3654
- const classCtorParameters = reflection.getConstructorParameters(clazz);
3655
- if (classCtorParameters !== null) {
3656
- const ctorParameters = classCtorParameters.map((param) => ctorParameterToMetadata(param, isCore));
3657
- metaCtorParameters = new FunctionExpr([], [
3658
- new ReturnStatement(new LiteralArrayExpr(ctorParameters))
3659
- ]);
3660
- }
3661
- let metaPropDecorators = null;
3662
- const classMembers = reflection.getMembersOfClass(clazz).filter((member) => !member.isStatic && member.decorators !== null && member.decorators.length > 0);
3663
- const duplicateDecoratedMemberNames = classMembers.map((member) => member.name).filter((name, i, arr) => arr.indexOf(name) < i);
3664
- if (duplicateDecoratedMemberNames.length > 0) {
3665
- throw new Error(`Duplicate decorated properties found on class '${clazz.name.text}': ` + duplicateDecoratedMemberNames.join(", "));
3666
- }
3667
- const decoratedMembers = classMembers.map((member) => {
3668
- var _a;
3669
- return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
3670
- });
3671
- if (decoratedMembers.length > 0) {
3672
- metaPropDecorators = new WrappedNodeExpr2(ts18.createObjectLiteral(decoratedMembers));
3673
- }
3674
- return {
3675
- type: new WrappedNodeExpr2(id),
3676
- decorators: metaDecorators,
3677
- ctorParameters: metaCtorParameters,
3678
- propDecorators: metaPropDecorators
3679
- };
3680
- }
3681
- function ctorParameterToMetadata(param, isCore) {
3682
- const type = param.typeValueReference.kind !== 2 ? valueReferenceToExpression(param.typeValueReference) : new LiteralExpr2(void 0);
3683
- const mapEntries = [
3684
- { key: "type", value: type, quoted: false }
3685
- ];
3686
- if (param.decorators !== null) {
3687
- const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
3688
- const value = new WrappedNodeExpr2(ts18.createArrayLiteral(ngDecorators));
3689
- mapEntries.push({ key: "decorators", value, quoted: false });
3690
- }
3691
- return literalMap(mapEntries);
3692
- }
3693
- function classMemberToMetadata(name, decorators, isCore) {
3694
- const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
3695
- const decoratorMeta = ts18.createArrayLiteral(ngDecorators);
3696
- return ts18.createPropertyAssignment(name, decoratorMeta);
3697
- }
3698
- function decoratorToMetadata(decorator, wrapFunctionsInParens) {
3699
- if (decorator.identifier === null) {
3700
- throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
3701
- }
3702
- const properties = [
3703
- ts18.createPropertyAssignment("type", ts18.getMutableClone(decorator.identifier))
3704
- ];
3705
- if (decorator.args !== null && decorator.args.length > 0) {
3706
- const args = decorator.args.map((arg) => {
3707
- const expr = ts18.getMutableClone(arg);
3708
- return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(expr) : expr;
3709
- });
3710
- properties.push(ts18.createPropertyAssignment("args", ts18.createArrayLiteral(args)));
3711
- }
3712
- return ts18.createObjectLiteral(properties, true);
3713
- }
3714
- function isAngularDecorator2(decorator, isCore) {
3715
- return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
3716
- }
3717
- function removeIdentifierReferences(node, name) {
3718
- const result = ts18.transform(node, [(context) => (root) => ts18.visitNode(root, function walk(current) {
3719
- return ts18.isIdentifier(current) && current.text === name ? ts18.createIdentifier(current.text) : ts18.visitEachChild(current, walk, context);
3720
- })]);
3721
- return result.transformed[0];
3722
- }
3723
-
3724
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/directive.mjs
3725
- var EMPTY_OBJECT = {};
3726
- var FIELD_DECORATORS = [
3727
- "Input",
3728
- "Output",
3729
- "ViewChild",
3730
- "ViewChildren",
3731
- "ContentChild",
3732
- "ContentChildren",
3733
- "HostBinding",
3734
- "HostListener"
3735
- ];
3736
- var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
3737
- "ngOnChanges",
3738
- "ngOnInit",
3739
- "ngOnDestroy",
3740
- "ngDoCheck",
3741
- "ngAfterViewInit",
3742
- "ngAfterViewChecked",
3743
- "ngAfterContentInit",
3744
- "ngAfterContentChecked"
3745
- ]);
3746
- var DirectiveSymbol = class extends SemanticSymbol {
3747
- constructor(decl, selector, inputs, outputs, exportAs, typeCheckMeta, typeParameters) {
3748
- super(decl);
3749
- this.selector = selector;
3750
- this.inputs = inputs;
3751
- this.outputs = outputs;
3752
- this.exportAs = exportAs;
3753
- this.typeCheckMeta = typeCheckMeta;
3754
- this.typeParameters = typeParameters;
3755
- this.baseClass = null;
3756
- }
3757
- isPublicApiAffected(previousSymbol) {
3758
- if (!(previousSymbol instanceof DirectiveSymbol)) {
3759
- return true;
3760
- }
3761
- return this.selector !== previousSymbol.selector || !isArrayEqual(this.inputs.propertyNames, previousSymbol.inputs.propertyNames) || !isArrayEqual(this.outputs.propertyNames, previousSymbol.outputs.propertyNames) || !isArrayEqual(this.exportAs, previousSymbol.exportAs);
3762
- }
3763
- isTypeCheckApiAffected(previousSymbol) {
3764
- if (this.isPublicApiAffected(previousSymbol)) {
3765
- return true;
3766
- }
3767
- if (!(previousSymbol instanceof DirectiveSymbol)) {
3768
- return true;
3769
- }
3770
- if (!isArrayEqual(Array.from(this.inputs), Array.from(previousSymbol.inputs), isInputMappingEqual) || !isArrayEqual(Array.from(this.outputs), Array.from(previousSymbol.outputs), isInputMappingEqual)) {
3771
- return true;
3772
- }
3773
- if (!areTypeParametersEqual(this.typeParameters, previousSymbol.typeParameters)) {
3774
- return true;
3775
- }
3776
- if (!isTypeCheckMetaEqual(this.typeCheckMeta, previousSymbol.typeCheckMeta)) {
3777
- return true;
3778
- }
3779
- if (!isBaseClassEqual(this.baseClass, previousSymbol.baseClass)) {
3780
- return true;
3781
- }
3782
- return false;
3783
- }
3784
- };
3785
- function isInputMappingEqual(current, previous) {
3786
- return current[0] === previous[0] && current[1] === previous[1];
3787
- }
3788
- function isTypeCheckMetaEqual(current, previous) {
3789
- if (current.hasNgTemplateContextGuard !== previous.hasNgTemplateContextGuard) {
3790
- return false;
3791
- }
3792
- if (current.isGeneric !== previous.isGeneric) {
3793
- return false;
3794
- }
3795
- if (!isArrayEqual(current.ngTemplateGuards, previous.ngTemplateGuards, isTemplateGuardEqual)) {
3796
- return false;
3797
- }
3798
- if (!isSetEqual(current.coercedInputFields, previous.coercedInputFields)) {
3799
- return false;
3800
- }
3801
- if (!isSetEqual(current.restrictedInputFields, previous.restrictedInputFields)) {
3802
- return false;
3803
- }
3804
- if (!isSetEqual(current.stringLiteralInputFields, previous.stringLiteralInputFields)) {
3805
- return false;
3806
- }
3807
- if (!isSetEqual(current.undeclaredInputFields, previous.undeclaredInputFields)) {
3808
- return false;
3809
- }
3810
- return true;
3811
- }
3812
- function isTemplateGuardEqual(current, previous) {
3813
- return current.inputName === previous.inputName && current.type === previous.type;
3814
- }
3815
- function isBaseClassEqual(current, previous) {
3816
- if (current === null || previous === null) {
3817
- return current === previous;
3818
- }
3819
- return isSymbolEqual(current, previous);
3820
- }
3821
- var DirectiveDecoratorHandler = class {
3822
- constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
3823
- this.reflector = reflector;
3824
- this.evaluator = evaluator;
3825
- this.metaRegistry = metaRegistry;
3826
- this.scopeRegistry = scopeRegistry;
3827
- this.metaReader = metaReader;
3828
- this.injectableRegistry = injectableRegistry;
3622
+ this.compilation = compilation;
3623
+ this.classCompilationMap = classCompilationMap;
3624
+ this.reflector = reflector;
3625
+ this.importManager = importManager;
3626
+ this.recordWrappedNodeExpr = recordWrappedNodeExpr;
3627
+ this.isClosureCompilerEnabled = isClosureCompilerEnabled;
3829
3628
  this.isCore = isCore;
3830
- this.semanticDepGraphUpdater = semanticDepGraphUpdater;
3831
- this.annotateForClosureCompiler = annotateForClosureCompiler;
3832
- this.compileUndecoratedClassesWithAngularFeatures = compileUndecoratedClassesWithAngularFeatures;
3833
- this.perf = perf;
3834
- this.precedence = HandlerPrecedence.PRIMARY;
3835
- this.name = DirectiveDecoratorHandler.name;
3836
3629
  }
3837
- detect(node, decorators) {
3838
- if (!decorators) {
3839
- const angularField = this.findClassFieldWithAngularFeatures(node);
3840
- return angularField ? { trigger: angularField.node, decorator: null, metadata: null } : void 0;
3630
+ visitClassDeclaration(node) {
3631
+ if (!this.classCompilationMap.has(node)) {
3632
+ return { node };
3633
+ }
3634
+ const translateOptions = {
3635
+ recordWrappedNode: this.recordWrappedNodeExpr,
3636
+ annotateForClosureCompiler: this.isClosureCompilerEnabled
3637
+ };
3638
+ const statements = [];
3639
+ const members = [...node.members];
3640
+ for (const field of this.classCompilationMap.get(node)) {
3641
+ const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
3642
+ const property = ts20.createProperty(void 0, [ts20.createToken(ts20.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
3643
+ if (this.isClosureCompilerEnabled) {
3644
+ ts20.addSyntheticLeadingComment(property, ts20.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
3645
+ }
3646
+ field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
3647
+ members.push(property);
3648
+ }
3649
+ node = ts20.updateClassDeclaration(node, maybeFilterDecorator(node.decorators, this.compilation.decoratorsFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], members.map((member) => this._stripAngularDecorators(member)));
3650
+ return { node, after: statements };
3651
+ }
3652
+ _angularCoreDecorators(decl) {
3653
+ const decorators = this.reflector.getDecoratorsOfDeclaration(decl);
3654
+ if (decorators === null) {
3655
+ return NO_DECORATORS;
3656
+ }
3657
+ const coreDecorators = decorators.filter((dec) => this.isCore || isFromAngularCore(dec)).map((dec) => dec.node);
3658
+ if (coreDecorators.length > 0) {
3659
+ return new Set(coreDecorators);
3841
3660
  } else {
3842
- const decorator = findAngularDecorator(decorators, "Directive", this.isCore);
3843
- return decorator ? { trigger: decorator.node, decorator, metadata: decorator } : void 0;
3661
+ return NO_DECORATORS;
3844
3662
  }
3845
3663
  }
3846
- analyze(node, decorator, flags = HandlerFlags.NONE) {
3847
- if (this.compileUndecoratedClassesWithAngularFeatures === false && decorator === null) {
3848
- return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
3664
+ _nonCoreDecoratorsOnly(node) {
3665
+ if (node.decorators === void 0) {
3666
+ return void 0;
3849
3667
  }
3850
- this.perf.eventCount(PerfEvent.AnalyzeDirective);
3851
- const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.isCore, flags, this.annotateForClosureCompiler);
3852
- if (directiveResult === void 0) {
3853
- return {};
3668
+ const coreDecorators = this._angularCoreDecorators(node);
3669
+ if (coreDecorators.size === node.decorators.length) {
3670
+ return void 0;
3671
+ } else if (coreDecorators.size === 0) {
3672
+ return node.decorators;
3854
3673
  }
3855
- const analysis = directiveResult.metadata;
3856
- let providersRequiringFactory = null;
3857
- if (directiveResult !== void 0 && directiveResult.decorator.has("providers")) {
3858
- providersRequiringFactory = resolveProvidersRequiringFactory(directiveResult.decorator.get("providers"), this.reflector, this.evaluator);
3674
+ const filtered = node.decorators.filter((dec) => !coreDecorators.has(dec));
3675
+ if (filtered.length === 0) {
3676
+ return void 0;
3859
3677
  }
3860
- return {
3861
- analysis: {
3862
- inputs: directiveResult.inputs,
3863
- outputs: directiveResult.outputs,
3864
- meta: analysis,
3865
- classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
3866
- baseClass: readBaseClass(node, this.reflector, this.evaluator),
3867
- typeCheckMeta: extractDirectiveTypeCheckMeta(node, directiveResult.inputs, this.reflector),
3868
- providersRequiringFactory,
3869
- isPoisoned: false,
3870
- isStructural: directiveResult.isStructural
3871
- }
3872
- };
3678
+ const array = ts20.createNodeArray(filtered);
3679
+ array.pos = node.decorators.pos;
3680
+ array.end = node.decorators.end;
3681
+ return array;
3873
3682
  }
3874
- symbol(node, analysis) {
3875
- const typeParameters = extractSemanticTypeParameters(node);
3876
- return new DirectiveSymbol(node, analysis.meta.selector, analysis.inputs, analysis.outputs, analysis.meta.exportAs, analysis.typeCheckMeta, typeParameters);
3683
+ _stripAngularDecorators(node) {
3684
+ if (ts20.isParameter(node)) {
3685
+ node = ts20.updateParameter(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
3686
+ } else if (ts20.isMethodDeclaration(node) && node.decorators !== void 0) {
3687
+ node = ts20.updateMethod(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
3688
+ } else if (ts20.isPropertyDeclaration(node) && node.decorators !== void 0) {
3689
+ node = ts20.updateProperty(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.questionToken, node.type, node.initializer);
3690
+ } else if (ts20.isGetAccessor(node)) {
3691
+ node = ts20.updateGetAccessor(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.type, node.body);
3692
+ } else if (ts20.isSetAccessor(node)) {
3693
+ node = ts20.updateSetAccessor(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.body);
3694
+ } else if (ts20.isConstructorDeclaration(node)) {
3695
+ const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
3696
+ node = ts20.updateConstructor(node, node.decorators, node.modifiers, parameters, node.body);
3697
+ }
3698
+ return node;
3877
3699
  }
3878
- register(node, analysis) {
3879
- const ref = new Reference(node);
3880
- this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
3881
- type: MetaType.Directive,
3882
- ref,
3883
- name: node.name.text,
3884
- selector: analysis.meta.selector,
3885
- exportAs: analysis.meta.exportAs,
3886
- inputs: analysis.inputs,
3887
- outputs: analysis.outputs,
3888
- queries: analysis.meta.queries.map((query) => query.propertyName),
3889
- isComponent: false,
3890
- baseClass: analysis.baseClass
3891
- }, analysis.typeCheckMeta), {
3892
- isPoisoned: analysis.isPoisoned,
3893
- isStructural: analysis.isStructural,
3894
- animationTriggerNames: null
3895
- }));
3896
- this.injectableRegistry.registerInjectable(node);
3700
+ };
3701
+ function transformIvySourceFile(compilation, context, reflector, importRewriter, file, isCore, isClosureCompilerEnabled, recordWrappedNode) {
3702
+ const constantPool = new ConstantPool(isClosureCompilerEnabled);
3703
+ const importManager = new ImportManager(importRewriter);
3704
+ const compilationVisitor = new IvyCompilationVisitor(compilation, constantPool);
3705
+ visit(file, compilationVisitor, context);
3706
+ const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore);
3707
+ let sf = visit(file, transformationVisitor, context);
3708
+ const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts20.ScriptTarget.ES2015;
3709
+ const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
3710
+ recordWrappedNode,
3711
+ downlevelTaggedTemplates: downlevelTranslatedCode,
3712
+ downlevelVariableDeclarations: downlevelTranslatedCode,
3713
+ annotateForClosureCompiler: isClosureCompilerEnabled
3714
+ }));
3715
+ const fileOverviewMeta = isClosureCompilerEnabled ? getFileOverviewComment(sf.statements) : null;
3716
+ sf = addImports(importManager, sf, constants);
3717
+ if (fileOverviewMeta !== null) {
3718
+ setFileOverviewComment(sf, fileOverviewMeta);
3897
3719
  }
3898
- resolve(node, analysis, symbol) {
3899
- if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference) {
3900
- symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
3901
- }
3902
- const diagnostics = [];
3903
- if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr3) {
3904
- const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
3905
- diagnostics.push(...providerDiagnostics);
3720
+ return sf;
3721
+ }
3722
+ function getLocalizeCompileTarget(context) {
3723
+ const target = context.getCompilerOptions().target || ts20.ScriptTarget.ES2015;
3724
+ return target !== ts20.ScriptTarget.JSON ? target : ts20.ScriptTarget.ES2015;
3725
+ }
3726
+ function getFileOverviewComment(statements) {
3727
+ if (statements.length > 0) {
3728
+ const host = statements[0];
3729
+ let trailing = false;
3730
+ let comments = ts20.getSyntheticLeadingComments(host);
3731
+ if (!comments || comments.length === 0) {
3732
+ trailing = true;
3733
+ comments = ts20.getSyntheticTrailingComments(host);
3906
3734
  }
3907
- const directiveDiagnostics = getDirectiveDiagnostics(node, this.metaReader, this.evaluator, this.reflector, this.scopeRegistry, "Directive");
3908
- if (directiveDiagnostics !== null) {
3909
- diagnostics.push(...directiveDiagnostics);
3735
+ if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
3736
+ return { comments, host, trailing };
3910
3737
  }
3911
- return { diagnostics: diagnostics.length > 0 ? diagnostics : void 0 };
3912
3738
  }
3913
- compileFull(node, analysis, resolution, pool) {
3914
- const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
3915
- const def = compileDirectiveFromMetadata(analysis.meta, pool, makeBindingParser());
3916
- const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
3917
- return compileResults(fac, def, classMetadata, "\u0275dir");
3739
+ return null;
3740
+ }
3741
+ function setFileOverviewComment(sf, fileoverview) {
3742
+ const { comments, host, trailing } = fileoverview;
3743
+ if (sf.statements.length > 0 && host !== sf.statements[0]) {
3744
+ if (trailing) {
3745
+ ts20.setSyntheticTrailingComments(host, void 0);
3746
+ } else {
3747
+ ts20.setSyntheticLeadingComments(host, void 0);
3748
+ }
3749
+ ts20.setSyntheticLeadingComments(sf.statements[0], comments);
3918
3750
  }
3919
- compilePartial(node, analysis, resolution) {
3920
- const fac = compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
3921
- const def = compileDeclareDirectiveFromMetadata(analysis.meta);
3922
- const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
3923
- return compileResults(fac, def, classMetadata, "\u0275dir");
3751
+ }
3752
+ function maybeFilterDecorator(decorators, toRemove) {
3753
+ if (decorators === void 0) {
3754
+ return void 0;
3924
3755
  }
3925
- findClassFieldWithAngularFeatures(node) {
3926
- return this.reflector.getMembersOfClass(node).find((member) => {
3927
- if (!member.isStatic && member.kind === ClassMemberKind.Method && LIFECYCLE_HOOKS.has(member.name)) {
3928
- return true;
3929
- }
3930
- if (member.decorators) {
3931
- return member.decorators.some((decorator) => FIELD_DECORATORS.some((decoratorName) => isAngularDecorator(decorator, decoratorName, this.isCore)));
3932
- }
3933
- return false;
3934
- });
3756
+ const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts20.getOriginalNode(dec) === decToRemove) === void 0);
3757
+ if (filtered.length === 0) {
3758
+ return void 0;
3935
3759
  }
3936
- };
3760
+ return ts20.createNodeArray(filtered);
3761
+ }
3762
+ function isFromAngularCore(decorator) {
3763
+ return decorator.import !== null && decorator.import.from === "@angular/core";
3764
+ }
3765
+ function createRecorderFn(defaultImportTracker) {
3766
+ return (node) => {
3767
+ const importDecl = getDefaultImportDeclaration(node);
3768
+ if (importDecl !== null) {
3769
+ defaultImportTracker.recordUsedImport(importDecl);
3770
+ }
3771
+ };
3772
+ }
3773
+
3774
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.mjs
3775
+ import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
3776
+
3777
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
3778
+ import { createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr3, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr4 } from "@angular/compiler";
3779
+ import ts21 from "typescript";
3780
+ var EMPTY_OBJECT = {};
3781
+ var QUERY_TYPES = /* @__PURE__ */ new Set([
3782
+ "ContentChild",
3783
+ "ContentChildren",
3784
+ "ViewChild",
3785
+ "ViewChildren"
3786
+ ]);
3937
3787
  function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore, flags, annotateForClosureCompiler, defaultSelector = null) {
3938
3788
  let directive;
3939
3789
  if (decorator === null || decorator.args === null || decorator.args.length === 0) {
@@ -3942,7 +3792,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
3942
3792
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
3943
3793
  } else {
3944
3794
  const meta = unwrapExpression(decorator.args[0]);
3945
- if (!ts19.isObjectLiteralExpression(meta)) {
3795
+ if (!ts21.isObjectLiteralExpression(meta)) {
3946
3796
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
3947
3797
  }
3948
3798
  directive = reflectObjectLiteral(meta);
@@ -3981,7 +3831,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
3981
3831
  }
3982
3832
  }
3983
3833
  const host = extractHostBindings(decoratedElements, evaluator, coreModule, directive);
3984
- const providers = directive.has("providers") ? new WrappedNodeExpr3(annotateForClosureCompiler ? wrapFunctionExpressionsInParens(directive.get("providers")) : directive.get("providers")) : null;
3834
+ const providers = directive.has("providers") ? new WrappedNodeExpr4(annotateForClosureCompiler ? wrapFunctionExpressionsInParens(directive.get("providers")) : directive.get("providers")) : null;
3985
3835
  const usesOnChanges = members.some((member) => !member.isStatic && member.kind === ClassMemberKind.Method && member.name === "ngOnChanges");
3986
3836
  let exportAs = null;
3987
3837
  if (directive.has("exportAs")) {
@@ -3995,9 +3845,18 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
3995
3845
  const rawCtorDeps = getConstructorDependencies(clazz, reflector, isCore);
3996
3846
  const ctorDeps = selector !== null ? validateConstructorDependencies(clazz, rawCtorDeps) : unwrapConstructorDependencies(rawCtorDeps);
3997
3847
  const isStructural = ctorDeps !== null && ctorDeps !== "invalid" && ctorDeps.some((dep) => dep.token instanceof ExternalExpr3 && dep.token.value.moduleName === "@angular/core" && dep.token.value.name === "TemplateRef");
3848
+ let isStandalone = false;
3849
+ if (directive.has("standalone")) {
3850
+ const expr = directive.get("standalone");
3851
+ const resolved = evaluator.evaluate(expr);
3852
+ if (typeof resolved !== "boolean") {
3853
+ throw createValueHasWrongTypeError(expr, resolved, `standalone flag must be a boolean`);
3854
+ }
3855
+ isStandalone = resolved;
3856
+ }
3998
3857
  const usesInheritance = reflector.hasBaseClass(clazz);
3999
3858
  const type = wrapTypeReference(reflector, clazz);
4000
- const internalType = new WrappedNodeExpr3(reflector.getInternalNameOfClass(clazz));
3859
+ const internalType = new WrappedNodeExpr4(reflector.getInternalNameOfClass(clazz));
4001
3860
  const inputs = ClassPropertyMapping.fromMappedObject(__spreadValues(__spreadValues({}, inputsFromMeta), inputsFromFields));
4002
3861
  const outputs = ClassPropertyMapping.fromMappedObject(__spreadValues(__spreadValues({}, outputsFromMeta), outputsFromFields));
4003
3862
  const metadata = {
@@ -4019,7 +3878,8 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
4019
3878
  typeSourceSpan: createSourceSpan(clazz.name),
4020
3879
  usesInheritance,
4021
3880
  exportAs,
4022
- providers
3881
+ providers,
3882
+ isStandalone
4023
3883
  };
4024
3884
  return {
4025
3885
  decorator: directive,
@@ -4040,7 +3900,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4040
3900
  let isStatic = false;
4041
3901
  let predicate = null;
4042
3902
  if (arg instanceof Reference || arg instanceof DynamicValue) {
4043
- predicate = createMayBeForwardRefExpression(new WrappedNodeExpr3(node), forwardReferenceTarget !== null ? 2 : 0);
3903
+ predicate = createMayBeForwardRefExpression(new WrappedNodeExpr4(node), forwardReferenceTarget !== null ? 2 : 0);
4044
3904
  } else if (typeof arg === "string") {
4045
3905
  predicate = [arg];
4046
3906
  } else if (isStringArrayOrDie(arg, `@${name} predicate`, node)) {
@@ -4053,12 +3913,12 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4053
3913
  let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
4054
3914
  if (args.length === 2) {
4055
3915
  const optionsExpr = unwrapExpression(args[1]);
4056
- if (!ts19.isObjectLiteralExpression(optionsExpr)) {
3916
+ if (!ts21.isObjectLiteralExpression(optionsExpr)) {
4057
3917
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
4058
3918
  }
4059
3919
  const options = reflectObjectLiteral(optionsExpr);
4060
3920
  if (options.has("read")) {
4061
- read = new WrappedNodeExpr3(options.get("read"));
3921
+ read = new WrappedNodeExpr4(options.get("read"));
4062
3922
  }
4063
3923
  if (options.has("descendants")) {
4064
3924
  const descendantsExpr = options.get("descendants");
@@ -4096,18 +3956,68 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4096
3956
  emitDistinctChangesOnly
4097
3957
  };
4098
3958
  }
3959
+ function extractHostBindings(members, evaluator, coreModule, metadata) {
3960
+ let bindings;
3961
+ if (metadata && metadata.has("host")) {
3962
+ bindings = evaluateHostExpressionBindings(metadata.get("host"), evaluator);
3963
+ } else {
3964
+ bindings = parseHostBindings({});
3965
+ }
3966
+ filterToMembersWithDecorator(members, "HostBinding", coreModule).forEach(({ member, decorators }) => {
3967
+ decorators.forEach((decorator) => {
3968
+ let hostPropertyName = member.name;
3969
+ if (decorator.args !== null && decorator.args.length > 0) {
3970
+ if (decorator.args.length !== 1) {
3971
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `@HostBinding can have at most one argument, got ${decorator.args.length} argument(s)`);
3972
+ }
3973
+ const resolved = evaluator.evaluate(decorator.args[0]);
3974
+ if (typeof resolved !== "string") {
3975
+ throw createValueHasWrongTypeError(Decorator.nodeForError(decorator), resolved, `@HostBinding's argument must be a string`);
3976
+ }
3977
+ hostPropertyName = resolved;
3978
+ }
3979
+ bindings.properties[hostPropertyName] = getSafePropertyAccessString("this", member.name);
3980
+ });
3981
+ });
3982
+ filterToMembersWithDecorator(members, "HostListener", coreModule).forEach(({ member, decorators }) => {
3983
+ decorators.forEach((decorator) => {
3984
+ let eventName = member.name;
3985
+ let args = [];
3986
+ if (decorator.args !== null && decorator.args.length > 0) {
3987
+ if (decorator.args.length > 2) {
3988
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.args[2], `@HostListener can have at most two arguments`);
3989
+ }
3990
+ const resolved = evaluator.evaluate(decorator.args[0]);
3991
+ if (typeof resolved !== "string") {
3992
+ throw createValueHasWrongTypeError(decorator.args[0], resolved, `@HostListener's event name argument must be a string`);
3993
+ }
3994
+ eventName = resolved;
3995
+ if (decorator.args.length === 2) {
3996
+ const expression = decorator.args[1];
3997
+ const resolvedArgs = evaluator.evaluate(decorator.args[1]);
3998
+ if (!isStringArrayOrDie(resolvedArgs, "@HostListener.args", expression)) {
3999
+ throw createValueHasWrongTypeError(decorator.args[1], resolvedArgs, `@HostListener's second argument must be a string array`);
4000
+ }
4001
+ args = resolvedArgs;
4002
+ }
4003
+ }
4004
+ bindings.listeners[eventName] = `${member.name}(${args.join(",")})`;
4005
+ });
4006
+ });
4007
+ return bindings;
4008
+ }
4099
4009
  function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
4100
4010
  const content = [], view = [];
4101
- if (!ts19.isObjectLiteralExpression(queryData)) {
4011
+ if (!ts21.isObjectLiteralExpression(queryData)) {
4102
4012
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
4103
4013
  }
4104
4014
  reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
4105
4015
  queryExpr = unwrapExpression(queryExpr);
4106
- if (!ts19.isNewExpression(queryExpr)) {
4016
+ if (!ts21.isNewExpression(queryExpr)) {
4107
4017
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4108
4018
  }
4109
- const queryType = ts19.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4110
- if (!ts19.isIdentifier(queryType)) {
4019
+ const queryType = ts21.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4020
+ if (!ts21.isIdentifier(queryType)) {
4111
4021
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4112
4022
  }
4113
4023
  const type = reflector.getImportOfIdentifier(queryType);
@@ -4123,6 +4033,17 @@ function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
4123
4033
  });
4124
4034
  return { content, view };
4125
4035
  }
4036
+ function parseFieldArrayValue(directive, field, evaluator) {
4037
+ if (!directive.has(field)) {
4038
+ return null;
4039
+ }
4040
+ const expression = directive.get(field);
4041
+ const value = evaluator.evaluate(expression);
4042
+ if (!isStringArrayOrDie(value, field, expression)) {
4043
+ throw createValueHasWrongTypeError(expression, value, `Failed to resolve @Directive.${field} to a string array`);
4044
+ }
4045
+ return value;
4046
+ }
4126
4047
  function isStringArrayOrDie(value, name, node) {
4127
4048
  if (!Array.isArray(value)) {
4128
4049
  return false;
@@ -4134,16 +4055,23 @@ function isStringArrayOrDie(value, name, node) {
4134
4055
  }
4135
4056
  return true;
4136
4057
  }
4137
- function parseFieldArrayValue(directive, field, evaluator) {
4138
- if (!directive.has(field)) {
4139
- return null;
4140
- }
4141
- const expression = directive.get(field);
4142
- const value = evaluator.evaluate(expression);
4143
- if (!isStringArrayOrDie(value, field, expression)) {
4144
- throw createValueHasWrongTypeError(expression, value, `Failed to resolve @Directive.${field} to a string array`);
4145
- }
4146
- return value;
4058
+ function queriesFromFields(fields, reflector, evaluator) {
4059
+ return fields.map(({ member, decorators }) => {
4060
+ const decorator = decorators[0];
4061
+ const node = member.node || Decorator.nodeForError(decorator);
4062
+ if (member.decorators.some((v) => v.name === "Input")) {
4063
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
4064
+ }
4065
+ if (decorators.length !== 1) {
4066
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot have multiple query decorators on the same class member");
4067
+ } else if (!isPropertyTypeMember(member)) {
4068
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, node, "Query decorator must go on a property-type member");
4069
+ }
4070
+ return extractQueryMetadata(node, decorator.name, decorator.args || [], member.name, reflector, evaluator);
4071
+ });
4072
+ }
4073
+ function isPropertyTypeMember(member) {
4074
+ return member.kind === ClassMemberKind.Getter || member.kind === ClassMemberKind.Setter || member.kind === ClassMemberKind.Property;
4147
4075
  }
4148
4076
  function parseFieldToPropertyMapping(directive, field, evaluator) {
4149
4077
  const metaValues = parseFieldArrayValue(directive, field, evaluator);
@@ -4181,24 +4109,6 @@ function resolveInput(publicName, internalName) {
4181
4109
  function resolveOutput(publicName, internalName) {
4182
4110
  return publicName;
4183
4111
  }
4184
- function queriesFromFields(fields, reflector, evaluator) {
4185
- return fields.map(({ member, decorators }) => {
4186
- const decorator = decorators[0];
4187
- const node = member.node || Decorator.nodeForError(decorator);
4188
- if (member.decorators.some((v) => v.name === "Input")) {
4189
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
4190
- }
4191
- if (decorators.length !== 1) {
4192
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot have multiple query decorators on the same class member");
4193
- } else if (!isPropertyTypeMember(member)) {
4194
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, node, "Query decorator must go on a property-type member");
4195
- }
4196
- return extractQueryMetadata(node, decorator.name, decorator.args || [], member.name, reflector, evaluator);
4197
- });
4198
- }
4199
- function isPropertyTypeMember(member) {
4200
- return member.kind === ClassMemberKind.Getter || member.kind === ClassMemberKind.Setter || member.kind === ClassMemberKind.Property;
4201
- }
4202
4112
  function evaluateHostExpressionBindings(hostExpr, evaluator) {
4203
4113
  const hostMetaMap = evaluator.evaluate(hostExpr);
4204
4114
  if (!(hostMetaMap instanceof Map)) {
@@ -4215,7 +4125,7 @@ function evaluateHostExpressionBindings(hostExpr, evaluator) {
4215
4125
  if (typeof value == "string") {
4216
4126
  hostMetadata[key] = value;
4217
4127
  } else if (value instanceof DynamicValue) {
4218
- hostMetadata[key] = new WrappedNodeExpr3(value.node);
4128
+ hostMetadata[key] = new WrappedNodeExpr4(value.node);
4219
4129
  } else {
4220
4130
  throw createValueHasWrongTypeError(hostExpr, value, `Decorator host metadata must be a string -> string object, but found unparseable value`);
4221
4131
  }
@@ -4225,68 +4135,228 @@ function evaluateHostExpressionBindings(hostExpr, evaluator) {
4225
4135
  if (errors.length > 0) {
4226
4136
  throw new FatalDiagnosticError(ErrorCode.HOST_BINDING_PARSE_ERROR, hostExpr, errors.map((error) => error.msg).join("\n"));
4227
4137
  }
4228
- return bindings;
4229
- }
4230
- function extractHostBindings(members, evaluator, coreModule, metadata) {
4231
- let bindings;
4232
- if (metadata && metadata.has("host")) {
4233
- bindings = evaluateHostExpressionBindings(metadata.get("host"), evaluator);
4234
- } else {
4235
- bindings = parseHostBindings({});
4138
+ return bindings;
4139
+ }
4140
+
4141
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.mjs
4142
+ var DirectiveSymbol = class extends SemanticSymbol {
4143
+ constructor(decl, selector, inputs, outputs, exportAs, typeCheckMeta, typeParameters) {
4144
+ super(decl);
4145
+ this.selector = selector;
4146
+ this.inputs = inputs;
4147
+ this.outputs = outputs;
4148
+ this.exportAs = exportAs;
4149
+ this.typeCheckMeta = typeCheckMeta;
4150
+ this.typeParameters = typeParameters;
4151
+ this.baseClass = null;
4152
+ }
4153
+ isPublicApiAffected(previousSymbol) {
4154
+ if (!(previousSymbol instanceof DirectiveSymbol)) {
4155
+ return true;
4156
+ }
4157
+ return this.selector !== previousSymbol.selector || !isArrayEqual(this.inputs.propertyNames, previousSymbol.inputs.propertyNames) || !isArrayEqual(this.outputs.propertyNames, previousSymbol.outputs.propertyNames) || !isArrayEqual(this.exportAs, previousSymbol.exportAs);
4158
+ }
4159
+ isTypeCheckApiAffected(previousSymbol) {
4160
+ if (this.isPublicApiAffected(previousSymbol)) {
4161
+ return true;
4162
+ }
4163
+ if (!(previousSymbol instanceof DirectiveSymbol)) {
4164
+ return true;
4165
+ }
4166
+ if (!isArrayEqual(Array.from(this.inputs), Array.from(previousSymbol.inputs), isInputMappingEqual) || !isArrayEqual(Array.from(this.outputs), Array.from(previousSymbol.outputs), isInputMappingEqual)) {
4167
+ return true;
4168
+ }
4169
+ if (!areTypeParametersEqual(this.typeParameters, previousSymbol.typeParameters)) {
4170
+ return true;
4171
+ }
4172
+ if (!isTypeCheckMetaEqual(this.typeCheckMeta, previousSymbol.typeCheckMeta)) {
4173
+ return true;
4174
+ }
4175
+ if (!isBaseClassEqual(this.baseClass, previousSymbol.baseClass)) {
4176
+ return true;
4177
+ }
4178
+ return false;
4179
+ }
4180
+ };
4181
+ function isInputMappingEqual(current, previous) {
4182
+ return current[0] === previous[0] && current[1] === previous[1];
4183
+ }
4184
+ function isTypeCheckMetaEqual(current, previous) {
4185
+ if (current.hasNgTemplateContextGuard !== previous.hasNgTemplateContextGuard) {
4186
+ return false;
4187
+ }
4188
+ if (current.isGeneric !== previous.isGeneric) {
4189
+ return false;
4190
+ }
4191
+ if (!isArrayEqual(current.ngTemplateGuards, previous.ngTemplateGuards, isTemplateGuardEqual)) {
4192
+ return false;
4193
+ }
4194
+ if (!isSetEqual(current.coercedInputFields, previous.coercedInputFields)) {
4195
+ return false;
4196
+ }
4197
+ if (!isSetEqual(current.restrictedInputFields, previous.restrictedInputFields)) {
4198
+ return false;
4199
+ }
4200
+ if (!isSetEqual(current.stringLiteralInputFields, previous.stringLiteralInputFields)) {
4201
+ return false;
4202
+ }
4203
+ if (!isSetEqual(current.undeclaredInputFields, previous.undeclaredInputFields)) {
4204
+ return false;
4205
+ }
4206
+ return true;
4207
+ }
4208
+ function isTemplateGuardEqual(current, previous) {
4209
+ return current.inputName === previous.inputName && current.type === previous.type;
4210
+ }
4211
+ function isBaseClassEqual(current, previous) {
4212
+ if (current === null || previous === null) {
4213
+ return current === previous;
4214
+ }
4215
+ return isSymbolEqual(current, previous);
4216
+ }
4217
+
4218
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.mjs
4219
+ var FIELD_DECORATORS = [
4220
+ "Input",
4221
+ "Output",
4222
+ "ViewChild",
4223
+ "ViewChildren",
4224
+ "ContentChild",
4225
+ "ContentChildren",
4226
+ "HostBinding",
4227
+ "HostListener"
4228
+ ];
4229
+ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
4230
+ "ngOnChanges",
4231
+ "ngOnInit",
4232
+ "ngOnDestroy",
4233
+ "ngDoCheck",
4234
+ "ngAfterViewInit",
4235
+ "ngAfterViewChecked",
4236
+ "ngAfterContentInit",
4237
+ "ngAfterContentChecked"
4238
+ ]);
4239
+ var DirectiveDecoratorHandler = class {
4240
+ constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
4241
+ this.reflector = reflector;
4242
+ this.evaluator = evaluator;
4243
+ this.metaRegistry = metaRegistry;
4244
+ this.scopeRegistry = scopeRegistry;
4245
+ this.metaReader = metaReader;
4246
+ this.injectableRegistry = injectableRegistry;
4247
+ this.isCore = isCore;
4248
+ this.semanticDepGraphUpdater = semanticDepGraphUpdater;
4249
+ this.annotateForClosureCompiler = annotateForClosureCompiler;
4250
+ this.compileUndecoratedClassesWithAngularFeatures = compileUndecoratedClassesWithAngularFeatures;
4251
+ this.perf = perf;
4252
+ this.precedence = HandlerPrecedence.PRIMARY;
4253
+ this.name = DirectiveDecoratorHandler.name;
4254
+ }
4255
+ detect(node, decorators) {
4256
+ if (!decorators) {
4257
+ const angularField = this.findClassFieldWithAngularFeatures(node);
4258
+ return angularField ? { trigger: angularField.node, decorator: null, metadata: null } : void 0;
4259
+ } else {
4260
+ const decorator = findAngularDecorator(decorators, "Directive", this.isCore);
4261
+ return decorator ? { trigger: decorator.node, decorator, metadata: decorator } : void 0;
4262
+ }
4263
+ }
4264
+ analyze(node, decorator, flags = HandlerFlags.NONE) {
4265
+ if (this.compileUndecoratedClassesWithAngularFeatures === false && decorator === null) {
4266
+ return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
4267
+ }
4268
+ this.perf.eventCount(PerfEvent.AnalyzeDirective);
4269
+ const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.isCore, flags, this.annotateForClosureCompiler);
4270
+ if (directiveResult === void 0) {
4271
+ return {};
4272
+ }
4273
+ const analysis = directiveResult.metadata;
4274
+ let providersRequiringFactory = null;
4275
+ if (directiveResult !== void 0 && directiveResult.decorator.has("providers")) {
4276
+ providersRequiringFactory = resolveProvidersRequiringFactory(directiveResult.decorator.get("providers"), this.reflector, this.evaluator);
4277
+ }
4278
+ return {
4279
+ analysis: {
4280
+ inputs: directiveResult.inputs,
4281
+ outputs: directiveResult.outputs,
4282
+ meta: analysis,
4283
+ classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
4284
+ baseClass: readBaseClass(node, this.reflector, this.evaluator),
4285
+ typeCheckMeta: extractDirectiveTypeCheckMeta(node, directiveResult.inputs, this.reflector),
4286
+ providersRequiringFactory,
4287
+ isPoisoned: false,
4288
+ isStructural: directiveResult.isStructural
4289
+ }
4290
+ };
4291
+ }
4292
+ symbol(node, analysis) {
4293
+ const typeParameters = extractSemanticTypeParameters(node);
4294
+ return new DirectiveSymbol(node, analysis.meta.selector, analysis.inputs, analysis.outputs, analysis.meta.exportAs, analysis.typeCheckMeta, typeParameters);
4295
+ }
4296
+ register(node, analysis) {
4297
+ const ref = new Reference(node);
4298
+ this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
4299
+ type: MetaType.Directive,
4300
+ ref,
4301
+ name: node.name.text,
4302
+ selector: analysis.meta.selector,
4303
+ exportAs: analysis.meta.exportAs,
4304
+ inputs: analysis.inputs,
4305
+ outputs: analysis.outputs,
4306
+ queries: analysis.meta.queries.map((query) => query.propertyName),
4307
+ isComponent: false,
4308
+ baseClass: analysis.baseClass
4309
+ }, analysis.typeCheckMeta), {
4310
+ isPoisoned: analysis.isPoisoned,
4311
+ isStructural: analysis.isStructural,
4312
+ animationTriggerNames: null,
4313
+ isStandalone: analysis.meta.isStandalone
4314
+ }));
4315
+ this.injectableRegistry.registerInjectable(node);
4316
+ }
4317
+ resolve(node, analysis, symbol) {
4318
+ if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference) {
4319
+ symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
4320
+ }
4321
+ const diagnostics = [];
4322
+ if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr5) {
4323
+ const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
4324
+ diagnostics.push(...providerDiagnostics);
4325
+ }
4326
+ const directiveDiagnostics = getDirectiveDiagnostics(node, this.metaReader, this.evaluator, this.reflector, this.scopeRegistry, "Directive");
4327
+ if (directiveDiagnostics !== null) {
4328
+ diagnostics.push(...directiveDiagnostics);
4329
+ }
4330
+ return { diagnostics: diagnostics.length > 0 ? diagnostics : void 0 };
4331
+ }
4332
+ compileFull(node, analysis, resolution, pool) {
4333
+ const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
4334
+ const def = compileDirectiveFromMetadata(analysis.meta, pool, makeBindingParser());
4335
+ const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
4336
+ return compileResults(fac, def, classMetadata, "\u0275dir");
4337
+ }
4338
+ compilePartial(node, analysis, resolution) {
4339
+ const fac = compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
4340
+ const def = compileDeclareDirectiveFromMetadata(analysis.meta);
4341
+ const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
4342
+ return compileResults(fac, def, classMetadata, "\u0275dir");
4236
4343
  }
4237
- filterToMembersWithDecorator(members, "HostBinding", coreModule).forEach(({ member, decorators }) => {
4238
- decorators.forEach((decorator) => {
4239
- let hostPropertyName = member.name;
4240
- if (decorator.args !== null && decorator.args.length > 0) {
4241
- if (decorator.args.length !== 1) {
4242
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `@HostBinding can have at most one argument, got ${decorator.args.length} argument(s)`);
4243
- }
4244
- const resolved = evaluator.evaluate(decorator.args[0]);
4245
- if (typeof resolved !== "string") {
4246
- throw createValueHasWrongTypeError(Decorator.nodeForError(decorator), resolved, `@HostBinding's argument must be a string`);
4247
- }
4248
- hostPropertyName = resolved;
4344
+ findClassFieldWithAngularFeatures(node) {
4345
+ return this.reflector.getMembersOfClass(node).find((member) => {
4346
+ if (!member.isStatic && member.kind === ClassMemberKind.Method && LIFECYCLE_HOOKS.has(member.name)) {
4347
+ return true;
4249
4348
  }
4250
- bindings.properties[hostPropertyName] = getSafePropertyAccessString("this", member.name);
4251
- });
4252
- });
4253
- filterToMembersWithDecorator(members, "HostListener", coreModule).forEach(({ member, decorators }) => {
4254
- decorators.forEach((decorator) => {
4255
- let eventName = member.name;
4256
- let args = [];
4257
- if (decorator.args !== null && decorator.args.length > 0) {
4258
- if (decorator.args.length > 2) {
4259
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.args[2], `@HostListener can have at most two arguments`);
4260
- }
4261
- const resolved = evaluator.evaluate(decorator.args[0]);
4262
- if (typeof resolved !== "string") {
4263
- throw createValueHasWrongTypeError(decorator.args[0], resolved, `@HostListener's event name argument must be a string`);
4264
- }
4265
- eventName = resolved;
4266
- if (decorator.args.length === 2) {
4267
- const expression = decorator.args[1];
4268
- const resolvedArgs = evaluator.evaluate(decorator.args[1]);
4269
- if (!isStringArrayOrDie(resolvedArgs, "@HostListener.args", expression)) {
4270
- throw createValueHasWrongTypeError(decorator.args[1], resolvedArgs, `@HostListener's second argument must be a string array`);
4271
- }
4272
- args = resolvedArgs;
4273
- }
4349
+ if (member.decorators) {
4350
+ return member.decorators.some((decorator) => FIELD_DECORATORS.some((decoratorName) => isAngularDecorator(decorator, decoratorName, this.isCore)));
4274
4351
  }
4275
- bindings.listeners[eventName] = `${member.name}(${args.join(",")})`;
4352
+ return false;
4276
4353
  });
4277
- });
4278
- return bindings;
4279
- }
4280
- var QUERY_TYPES = /* @__PURE__ */ new Set([
4281
- "ContentChild",
4282
- "ContentChildren",
4283
- "ViewChild",
4284
- "ViewChildren"
4285
- ]);
4354
+ }
4355
+ };
4286
4356
 
4287
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.mjs
4288
- import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, CUSTOM_ELEMENTS_SCHEMA, ExternalExpr as ExternalExpr4, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, NO_ERRORS_SCHEMA, R3Identifiers, WrappedNodeExpr as WrappedNodeExpr4 } from "@angular/compiler";
4289
- import ts20 from "typescript";
4357
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
4358
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, CUSTOM_ELEMENTS_SCHEMA, ExternalExpr as ExternalExpr4, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, NO_ERRORS_SCHEMA, R3Identifiers, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
4359
+ import ts22 from "typescript";
4290
4360
  var NgModuleSymbol = class extends SemanticSymbol {
4291
4361
  constructor() {
4292
4362
  super(...arguments);
@@ -4369,8 +4439,8 @@ var NgModuleDecoratorHandler = class {
4369
4439
  if (decorator.args === null || decorator.args.length > 1) {
4370
4440
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @NgModule decorator`);
4371
4441
  }
4372
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts20.createObjectLiteral([]);
4373
- if (!ts20.isObjectLiteralExpression(meta)) {
4442
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts22.createObjectLiteral([]);
4443
+ if (!ts22.isObjectLiteralExpression(meta)) {
4374
4444
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
4375
4445
  }
4376
4446
  const ngModule = reflectObjectLiteral(meta);
@@ -4444,7 +4514,7 @@ var NgModuleDecoratorHandler = class {
4444
4514
  }
4445
4515
  }
4446
4516
  }
4447
- const id = ngModule.has("id") ? new WrappedNodeExpr4(ngModule.get("id")) : null;
4517
+ const id = ngModule.has("id") ? new WrappedNodeExpr6(ngModule.get("id")) : null;
4448
4518
  const valueContext = node.getSourceFile();
4449
4519
  let typeContext = valueContext;
4450
4520
  const typeNode = this.reflector.getDtsDeclaration(node);
@@ -4458,8 +4528,8 @@ var NgModuleDecoratorHandler = class {
4458
4528
  const isForwardReference = (ref) => isExpressionForwardReference(ref.value, node.name, valueContext);
4459
4529
  const containsForwardDecls = bootstrap.some(isForwardReference) || declarations.some(isForwardReference) || imports.some(isForwardReference) || exports.some(isForwardReference);
4460
4530
  const type = wrapTypeReference(this.reflector, node);
4461
- const internalType = new WrappedNodeExpr4(this.reflector.getInternalNameOfClass(node));
4462
- const adjacentType = new WrappedNodeExpr4(this.reflector.getAdjacentNameOfClass(node));
4531
+ const internalType = new WrappedNodeExpr6(this.reflector.getInternalNameOfClass(node));
4532
+ const adjacentType = new WrappedNodeExpr6(this.reflector.getAdjacentNameOfClass(node));
4463
4533
  const ngModuleMetadata = {
4464
4534
  type,
4465
4535
  internalType,
@@ -4474,10 +4544,10 @@ var NgModuleDecoratorHandler = class {
4474
4544
  schemas: []
4475
4545
  };
4476
4546
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
4477
- const wrapperProviders = rawProviders !== null ? new WrappedNodeExpr4(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders) : null;
4547
+ const wrapperProviders = rawProviders !== null ? new WrappedNodeExpr6(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders) : null;
4478
4548
  const injectorImports = [];
4479
4549
  if (ngModule.has("imports")) {
4480
- injectorImports.push(new WrappedNodeExpr4(ngModule.get("imports")));
4550
+ injectorImports.push(new WrappedNodeExpr6(ngModule.get("imports")));
4481
4551
  }
4482
4552
  const injectorMetadata = {
4483
4553
  name,
@@ -4556,9 +4626,20 @@ var NgModuleDecoratorHandler = class {
4556
4626
  }
4557
4627
  }
4558
4628
  for (const decl of analysis.declarations) {
4559
- const metadata = this.metaReader.getDirectiveMetadata(decl);
4560
- if (metadata !== null && metadata.selector === null) {
4561
- throw new FatalDiagnosticError(ErrorCode.DIRECTIVE_MISSING_SELECTOR, decl.node, `Directive ${decl.node.name.text} has no selector, please add it!`);
4629
+ const dirMeta = this.metaReader.getDirectiveMetadata(decl);
4630
+ if (dirMeta !== null) {
4631
+ const refType = dirMeta.isComponent ? "Component" : "Directive";
4632
+ if (dirMeta.selector === null) {
4633
+ throw new FatalDiagnosticError(ErrorCode.DIRECTIVE_MISSING_SELECTOR, decl.node, `${refType} ${decl.node.name.text} has no selector, please add it!`);
4634
+ }
4635
+ if (dirMeta.isStandalone) {
4636
+ diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(analysis.rawDeclarations), `${refType} ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
4637
+ }
4638
+ continue;
4639
+ }
4640
+ const pipeMeta = this.metaReader.getPipeMetadata(decl);
4641
+ if (pipeMeta !== null && pipeMeta.isStandalone) {
4642
+ diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(analysis.rawDeclarations), `Pipe ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
4562
4643
  }
4563
4644
  }
4564
4645
  }
@@ -4661,10 +4742,10 @@ var NgModuleDecoratorHandler = class {
4661
4742
  return type && (this._reflectModuleFromTypeParam(type, node) || this._reflectModuleFromLiteralType(type));
4662
4743
  }
4663
4744
  _reflectModuleFromTypeParam(type, node) {
4664
- if (!ts20.isTypeReferenceNode(type)) {
4745
+ if (!ts22.isTypeReferenceNode(type)) {
4665
4746
  return null;
4666
4747
  }
4667
- const typeName = type && (ts20.isIdentifier(type.typeName) && type.typeName || ts20.isQualifiedName(type.typeName) && type.typeName.right) || null;
4748
+ const typeName = type && (ts22.isIdentifier(type.typeName) && type.typeName || ts22.isQualifiedName(type.typeName) && type.typeName.right) || null;
4668
4749
  if (typeName === null) {
4669
4750
  return null;
4670
4751
  }
@@ -4676,7 +4757,7 @@ var NgModuleDecoratorHandler = class {
4676
4757
  return null;
4677
4758
  }
4678
4759
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
4679
- const parent = ts20.isMethodDeclaration(node) && ts20.isClassDeclaration(node.parent) ? node.parent : null;
4760
+ const parent = ts22.isMethodDeclaration(node) && ts22.isClassDeclaration(node.parent) ? node.parent : null;
4680
4761
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
4681
4762
  throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
4682
4763
  }
@@ -4684,13 +4765,13 @@ var NgModuleDecoratorHandler = class {
4684
4765
  return typeNodeToValueExpr(arg);
4685
4766
  }
4686
4767
  _reflectModuleFromLiteralType(type) {
4687
- if (!ts20.isIntersectionTypeNode(type)) {
4768
+ if (!ts22.isIntersectionTypeNode(type)) {
4688
4769
  return null;
4689
4770
  }
4690
4771
  for (const t of type.types) {
4691
- if (ts20.isTypeLiteralNode(t)) {
4772
+ if (ts22.isTypeLiteralNode(t)) {
4692
4773
  for (const m of t.members) {
4693
- const ngModuleType = ts20.isPropertySignature(m) && ts20.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
4774
+ const ngModuleType = ts22.isPropertySignature(m) && ts22.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
4694
4775
  const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
4695
4776
  if (ngModuleExpression) {
4696
4777
  return ngModuleExpression;
@@ -4698,41 +4779,460 @@ var NgModuleDecoratorHandler = class {
4698
4779
  }
4699
4780
  }
4700
4781
  }
4701
- return null;
4702
- }
4703
- isClassDeclarationReference(ref) {
4704
- return this.reflector.isClass(ref.node);
4782
+ return null;
4783
+ }
4784
+ isClassDeclarationReference(ref) {
4785
+ return this.reflector.isClass(ref.node);
4786
+ }
4787
+ resolveTypeList(expr, resolvedList, className, arrayName) {
4788
+ const refList = [];
4789
+ if (!Array.isArray(resolvedList)) {
4790
+ throw createValueHasWrongTypeError(expr, resolvedList, `Expected array when reading the NgModule.${arrayName} of ${className}`);
4791
+ }
4792
+ resolvedList.forEach((entry, idx) => {
4793
+ if (entry instanceof Map && entry.has("ngModule")) {
4794
+ entry = entry.get("ngModule");
4795
+ }
4796
+ if (Array.isArray(entry)) {
4797
+ refList.push(...this.resolveTypeList(expr, entry, className, arrayName));
4798
+ } else if (entry instanceof Reference) {
4799
+ if (!this.isClassDeclarationReference(entry)) {
4800
+ throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a class`);
4801
+ }
4802
+ refList.push(entry);
4803
+ } else {
4804
+ throw createValueHasWrongTypeError(expr, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a reference`);
4805
+ }
4806
+ });
4807
+ return refList;
4808
+ }
4809
+ };
4810
+ function isNgModule(node, compilation) {
4811
+ return !compilation.directives.some((directive) => directive.ref.node === node) && !compilation.pipes.some((pipe) => pipe.ref.node === node);
4812
+ }
4813
+
4814
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/diagnostics.mjs
4815
+ function makeCyclicImportInfo(ref, type, cycle) {
4816
+ const name = ref.debugName || "(unknown)";
4817
+ const path = cycle.getPath().map((sf) => sf.fileName).join(" -> ");
4818
+ const message = `The ${type} '${name}' is used in the template but importing it would create a cycle: `;
4819
+ return makeRelatedInformation(ref.node, message + path);
4820
+ }
4821
+ function checkCustomElementSelectorForErrors(selector) {
4822
+ if (selector.includes(".") || selector.includes("[") && selector.includes("]")) {
4823
+ return null;
4824
+ }
4825
+ if (!/^[a-z]/.test(selector)) {
4826
+ return "Selector of a ShadowDom-encapsulated component must start with a lower case letter.";
4827
+ }
4828
+ if (/[A-Z]/.test(selector)) {
4829
+ return "Selector of a ShadowDom-encapsulated component must all be in lower case.";
4830
+ }
4831
+ if (!selector.includes("-")) {
4832
+ return "Selector of a component that uses ViewEncapsulation.ShadowDom must contain a hyphen.";
4833
+ }
4834
+ return null;
4835
+ }
4836
+
4837
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
4838
+ import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
4839
+ import ts23 from "typescript";
4840
+ function getTemplateDeclarationNodeForError(declaration) {
4841
+ switch (declaration.isInline) {
4842
+ case true:
4843
+ return declaration.expression;
4844
+ case false:
4845
+ return declaration.templateUrlExpression;
4846
+ }
4847
+ }
4848
+ function extractTemplate(node, template, evaluator, depTracker, resourceLoader, options) {
4849
+ if (template.isInline) {
4850
+ let sourceStr;
4851
+ let sourceParseRange = null;
4852
+ let templateContent;
4853
+ let sourceMapping;
4854
+ let escapedString = false;
4855
+ let sourceMapUrl;
4856
+ if (ts23.isStringLiteral(template.expression) || ts23.isNoSubstitutionTemplateLiteral(template.expression)) {
4857
+ sourceParseRange = getTemplateRange(template.expression);
4858
+ sourceStr = template.expression.getSourceFile().text;
4859
+ templateContent = template.expression.text;
4860
+ escapedString = true;
4861
+ sourceMapping = {
4862
+ type: "direct",
4863
+ node: template.expression
4864
+ };
4865
+ sourceMapUrl = template.resolvedTemplateUrl;
4866
+ } else {
4867
+ const resolvedTemplate = evaluator.evaluate(template.expression);
4868
+ if (typeof resolvedTemplate !== "string") {
4869
+ throw createValueHasWrongTypeError(template.expression, resolvedTemplate, "template must be a string");
4870
+ }
4871
+ sourceStr = resolvedTemplate;
4872
+ templateContent = resolvedTemplate;
4873
+ sourceMapping = {
4874
+ type: "indirect",
4875
+ node: template.expression,
4876
+ componentClass: node,
4877
+ template: templateContent
4878
+ };
4879
+ sourceMapUrl = null;
4880
+ }
4881
+ return __spreadProps(__spreadValues({}, parseExtractedTemplate(template, sourceStr, sourceParseRange, escapedString, sourceMapUrl, options)), {
4882
+ content: templateContent,
4883
+ sourceMapping,
4884
+ declaration: template
4885
+ });
4886
+ } else {
4887
+ const templateContent = resourceLoader.load(template.resolvedTemplateUrl);
4888
+ if (depTracker !== null) {
4889
+ depTracker.addResourceDependency(node.getSourceFile(), absoluteFrom(template.resolvedTemplateUrl));
4890
+ }
4891
+ return __spreadProps(__spreadValues({}, parseExtractedTemplate(template, templateContent, null, false, template.resolvedTemplateUrl, options)), {
4892
+ content: templateContent,
4893
+ sourceMapping: {
4894
+ type: "external",
4895
+ componentClass: node,
4896
+ node: template.templateUrlExpression,
4897
+ template: templateContent,
4898
+ templateUrl: template.resolvedTemplateUrl
4899
+ },
4900
+ declaration: template
4901
+ });
4902
+ }
4903
+ }
4904
+ function parseExtractedTemplate(template, sourceStr, sourceParseRange, escapedString, sourceMapUrl, options) {
4905
+ const i18nNormalizeLineEndingsInICUs = escapedString || options.i18nNormalizeLineEndingsInICUs;
4906
+ const parsedTemplate = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
4907
+ preserveWhitespaces: template.preserveWhitespaces,
4908
+ interpolationConfig: template.interpolationConfig,
4909
+ range: sourceParseRange != null ? sourceParseRange : void 0,
4910
+ escapedString,
4911
+ enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
4912
+ i18nNormalizeLineEndingsInICUs,
4913
+ alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData
4914
+ });
4915
+ const { nodes: diagNodes } = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
4916
+ preserveWhitespaces: true,
4917
+ preserveLineEndings: true,
4918
+ interpolationConfig: template.interpolationConfig,
4919
+ range: sourceParseRange != null ? sourceParseRange : void 0,
4920
+ escapedString,
4921
+ enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
4922
+ i18nNormalizeLineEndingsInICUs,
4923
+ leadingTriviaChars: [],
4924
+ alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData
4925
+ });
4926
+ return __spreadProps(__spreadValues({}, parsedTemplate), {
4927
+ diagNodes,
4928
+ file: new ParseSourceFile2(sourceStr, sourceMapUrl != null ? sourceMapUrl : "")
4929
+ });
4930
+ }
4931
+ function parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces) {
4932
+ let preserveWhitespaces = defaultPreserveWhitespaces;
4933
+ if (component.has("preserveWhitespaces")) {
4934
+ const expr = component.get("preserveWhitespaces");
4935
+ const value = evaluator.evaluate(expr);
4936
+ if (typeof value !== "boolean") {
4937
+ throw createValueHasWrongTypeError(expr, value, "preserveWhitespaces must be a boolean");
4938
+ }
4939
+ preserveWhitespaces = value;
4940
+ }
4941
+ let interpolationConfig = DEFAULT_INTERPOLATION_CONFIG;
4942
+ if (component.has("interpolation")) {
4943
+ const expr = component.get("interpolation");
4944
+ const value = evaluator.evaluate(expr);
4945
+ if (!Array.isArray(value) || value.length !== 2 || !value.every((element) => typeof element === "string")) {
4946
+ throw createValueHasWrongTypeError(expr, value, "interpolation must be an array with 2 elements of string type");
4947
+ }
4948
+ interpolationConfig = InterpolationConfig.fromArray(value);
4949
+ }
4950
+ if (component.has("templateUrl")) {
4951
+ const templateUrlExpr = component.get("templateUrl");
4952
+ const templateUrl = evaluator.evaluate(templateUrlExpr);
4953
+ if (typeof templateUrl !== "string") {
4954
+ throw createValueHasWrongTypeError(templateUrlExpr, templateUrl, "templateUrl must be a string");
4955
+ }
4956
+ try {
4957
+ const resourceUrl = resourceLoader.resolve(templateUrl, containingFile);
4958
+ return {
4959
+ isInline: false,
4960
+ interpolationConfig,
4961
+ preserveWhitespaces,
4962
+ templateUrl,
4963
+ templateUrlExpression: templateUrlExpr,
4964
+ resolvedTemplateUrl: resourceUrl
4965
+ };
4966
+ } catch (e) {
4967
+ throw makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
4968
+ }
4969
+ } else if (component.has("template")) {
4970
+ return {
4971
+ isInline: true,
4972
+ interpolationConfig,
4973
+ preserveWhitespaces,
4974
+ expression: component.get("template"),
4975
+ templateUrl: containingFile,
4976
+ resolvedTemplateUrl: containingFile
4977
+ };
4978
+ } else {
4979
+ throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE, Decorator.nodeForError(decorator), "component is missing a template");
4980
+ }
4981
+ }
4982
+ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanalyzeTemplateCache, node, decorator, component, containingFile, defaultPreserveWhitespaces, options) {
4983
+ if (component.has("templateUrl")) {
4984
+ const templateUrlExpr = component.get("templateUrl");
4985
+ const templateUrl = evaluator.evaluate(templateUrlExpr);
4986
+ if (typeof templateUrl !== "string") {
4987
+ throw createValueHasWrongTypeError(templateUrlExpr, templateUrl, "templateUrl must be a string");
4988
+ }
4989
+ try {
4990
+ const resourceUrl = resourceLoader.resolve(templateUrl, containingFile);
4991
+ const templatePromise = resourceLoader.preload(resourceUrl, { type: "template", containingFile });
4992
+ if (templatePromise !== void 0) {
4993
+ return templatePromise.then(() => {
4994
+ const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces);
4995
+ const template = extractTemplate(node, templateDecl, evaluator, depTracker, resourceLoader, options);
4996
+ preanalyzeTemplateCache.set(node, template);
4997
+ return template;
4998
+ });
4999
+ } else {
5000
+ return Promise.resolve(null);
5001
+ }
5002
+ } catch (e) {
5003
+ throw makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
5004
+ }
5005
+ } else {
5006
+ const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces);
5007
+ const template = extractTemplate(node, templateDecl, evaluator, depTracker, resourceLoader, options);
5008
+ preanalyzeTemplateCache.set(node, template);
5009
+ return Promise.resolve(template);
5010
+ }
5011
+ }
5012
+ function getTemplateRange(templateExpr) {
5013
+ const startPos = templateExpr.getStart() + 1;
5014
+ const { line, character } = ts23.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
5015
+ return {
5016
+ startPos,
5017
+ startLine: line,
5018
+ startCol: character,
5019
+ endPos: templateExpr.getEnd() - 1
5020
+ };
5021
+ }
5022
+ function makeResourceNotFoundError(file, nodeForError, resourceType) {
5023
+ let errorText;
5024
+ switch (resourceType) {
5025
+ case 0:
5026
+ errorText = `Could not find template file '${file}'.`;
5027
+ break;
5028
+ case 1:
5029
+ errorText = `Could not find stylesheet file '${file}' linked from the template.`;
5030
+ break;
5031
+ case 2:
5032
+ errorText = `Could not find stylesheet file '${file}'.`;
5033
+ break;
5034
+ }
5035
+ return new FatalDiagnosticError(ErrorCode.COMPONENT_RESOURCE_NOT_FOUND, nodeForError, errorText);
5036
+ }
5037
+ function transformDecoratorToInlineResources(dec, component, styles, template) {
5038
+ if (dec.name !== "Component") {
5039
+ return dec;
5040
+ }
5041
+ if (!component.has("templateUrl") && !component.has("styleUrls")) {
5042
+ return dec;
5043
+ }
5044
+ const metadata = new Map(component);
5045
+ if (metadata.has("templateUrl")) {
5046
+ metadata.delete("templateUrl");
5047
+ metadata.set("template", ts23.createStringLiteral(template.content));
5048
+ }
5049
+ if (metadata.has("styleUrls")) {
5050
+ metadata.delete("styleUrls");
5051
+ metadata.set("styles", ts23.createArrayLiteral(styles.map((s) => ts23.createStringLiteral(s))));
5052
+ }
5053
+ const newMetadataFields = [];
5054
+ for (const [name, value] of metadata.entries()) {
5055
+ newMetadataFields.push(ts23.createPropertyAssignment(name, value));
5056
+ }
5057
+ return __spreadProps(__spreadValues({}, dec), { args: [ts23.createObjectLiteral(newMetadataFields)] });
5058
+ }
5059
+ function extractComponentStyleUrls(evaluator, component) {
5060
+ if (!component.has("styleUrls")) {
5061
+ return [];
5062
+ }
5063
+ return extractStyleUrlsFromExpression(evaluator, component.get("styleUrls"));
5064
+ }
5065
+ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
5066
+ const styleUrls = [];
5067
+ if (ts23.isArrayLiteralExpression(styleUrlsExpr)) {
5068
+ for (const styleUrlExpr of styleUrlsExpr.elements) {
5069
+ if (ts23.isSpreadElement(styleUrlExpr)) {
5070
+ styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
5071
+ } else {
5072
+ const styleUrl = evaluator.evaluate(styleUrlExpr);
5073
+ if (typeof styleUrl !== "string") {
5074
+ throw createValueHasWrongTypeError(styleUrlExpr, styleUrl, "styleUrl must be a string");
5075
+ }
5076
+ styleUrls.push({
5077
+ url: styleUrl,
5078
+ source: 2,
5079
+ nodeForError: styleUrlExpr
5080
+ });
5081
+ }
5082
+ }
5083
+ } else {
5084
+ const evaluatedStyleUrls = evaluator.evaluate(styleUrlsExpr);
5085
+ if (!isStringArray(evaluatedStyleUrls)) {
5086
+ throw createValueHasWrongTypeError(styleUrlsExpr, evaluatedStyleUrls, "styleUrls must be an array of strings");
5087
+ }
5088
+ for (const styleUrl of evaluatedStyleUrls) {
5089
+ styleUrls.push({
5090
+ url: styleUrl,
5091
+ source: 2,
5092
+ nodeForError: styleUrlsExpr
5093
+ });
5094
+ }
5095
+ }
5096
+ return styleUrls;
5097
+ }
5098
+ function extractStyleResources(resourceLoader, component, containingFile) {
5099
+ const styles = /* @__PURE__ */ new Set();
5100
+ function stringLiteralElements(array) {
5101
+ return array.elements.filter((e) => ts23.isStringLiteralLike(e));
5102
+ }
5103
+ const styleUrlsExpr = component.get("styleUrls");
5104
+ if (styleUrlsExpr !== void 0 && ts23.isArrayLiteralExpression(styleUrlsExpr)) {
5105
+ for (const expression of stringLiteralElements(styleUrlsExpr)) {
5106
+ try {
5107
+ const resourceUrl = resourceLoader.resolve(expression.text, containingFile);
5108
+ styles.add({ path: absoluteFrom(resourceUrl), expression });
5109
+ } catch {
5110
+ }
5111
+ }
5112
+ }
5113
+ const stylesExpr = component.get("styles");
5114
+ if (stylesExpr !== void 0 && ts23.isArrayLiteralExpression(stylesExpr)) {
5115
+ for (const expression of stringLiteralElements(stylesExpr)) {
5116
+ styles.add({ path: null, expression });
5117
+ }
5118
+ }
5119
+ return styles;
5120
+ }
5121
+ function _extractTemplateStyleUrls(template) {
5122
+ if (template.styleUrls === null) {
5123
+ return [];
5124
+ }
5125
+ const nodeForError = getTemplateDeclarationNodeForError(template.declaration);
5126
+ return template.styleUrls.map((url) => ({ url, source: 1, nodeForError }));
5127
+ }
5128
+
5129
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/scope.mjs
5130
+ function scopeTemplate(scopeReader, dtsScopeReader, scopeRegistry, metaReader, node, analysis, usePoisonedData) {
5131
+ const scope = scopeReader.getScopeForComponent(node);
5132
+ if (analysis.meta.isStandalone && scope !== null) {
5133
+ return null;
5134
+ } else if (scope !== null && scope.compilation.isPoisoned && !usePoisonedData) {
5135
+ return null;
5136
+ }
5137
+ if (scope !== null) {
5138
+ return {
5139
+ directives: scope.compilation.directives,
5140
+ pipes: scope.compilation.pipes,
5141
+ ngModule: scope.ngModule,
5142
+ diagnostics: []
5143
+ };
5144
+ } else if (analysis.meta.isStandalone) {
5145
+ if (analysis.imports === null) {
5146
+ return {
5147
+ directives: [],
5148
+ pipes: [],
5149
+ ngModule: null,
5150
+ diagnostics: []
5151
+ };
5152
+ }
5153
+ const diagnostics = [];
5154
+ const directives = /* @__PURE__ */ new Map();
5155
+ const pipes = /* @__PURE__ */ new Map();
5156
+ for (const ref of analysis.imports.resolved) {
5157
+ const dirMeta = metaReader.getDirectiveMetadata(ref);
5158
+ if (dirMeta !== null) {
5159
+ if (!dirMeta.isStandalone) {
5160
+ diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, analysis.imports.raw, dirMeta.isComponent ? "component" : "directive"));
5161
+ continue;
5162
+ }
5163
+ if (!directives.has(ref.node)) {
5164
+ directives.set(ref.node, dirMeta);
5165
+ }
5166
+ continue;
5167
+ }
5168
+ const pipeMeta = metaReader.getPipeMetadata(ref);
5169
+ if (pipeMeta !== null) {
5170
+ if (!pipeMeta.isStandalone) {
5171
+ diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, analysis.imports.raw, "pipe"));
5172
+ continue;
5173
+ }
5174
+ }
5175
+ const ngModuleMeta = metaReader.getNgModuleMetadata(ref);
5176
+ if (ngModuleMeta !== null) {
5177
+ let scope2;
5178
+ if (ref.node.getSourceFile().isDeclarationFile) {
5179
+ scope2 = dtsScopeReader.resolve(ref);
5180
+ } else {
5181
+ scope2 = scopeRegistry.getScopeOfModule(ref.node);
5182
+ }
5183
+ if (scope2 === null) {
5184
+ continue;
5185
+ }
5186
+ if (scope2.exported.isPoisoned && !usePoisonedData) {
5187
+ return null;
5188
+ }
5189
+ for (const dir of scope2.exported.directives) {
5190
+ if (!directives.has(dir.ref.node)) {
5191
+ directives.set(dir.ref.node, dir);
5192
+ }
5193
+ }
5194
+ for (const pipe of scope2.exported.pipes) {
5195
+ if (!pipes.has(pipe.ref.node)) {
5196
+ pipes.set(pipe.ref.node, pipe);
5197
+ }
5198
+ }
5199
+ }
5200
+ }
5201
+ return {
5202
+ directives: Array.from(directives.values()),
5203
+ pipes: Array.from(pipes.values()),
5204
+ diagnostics,
5205
+ ngModule: null
5206
+ };
5207
+ } else {
5208
+ return {
5209
+ directives: [],
5210
+ pipes: [],
5211
+ ngModule: null,
5212
+ diagnostics: []
5213
+ };
4705
5214
  }
4706
- resolveTypeList(expr, resolvedList, className, arrayName) {
4707
- const refList = [];
4708
- if (!Array.isArray(resolvedList)) {
4709
- throw createValueHasWrongTypeError(expr, resolvedList, `Expected array when reading the NgModule.${arrayName} of ${className}`);
5215
+ }
5216
+ function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
5217
+ const scope = scopeReader.getScopeForComponent(ref.node);
5218
+ let relatedInformation = void 0;
5219
+ if (scope !== null) {
5220
+ const isExported3 = scope.exported.directives.some((exp) => exp.ref.node === ref.node) || scope.exported.pipes.some((exp) => exp.ref.node);
5221
+ if (isExported3) {
5222
+ relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It can be imported using its NgModule '${scope.ngModule.name.text}' instead.`)];
5223
+ } else {
5224
+ relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It's declared in the NgModule '${scope.ngModule.name.text}', but is not exported. Consider exporting it.`)];
4710
5225
  }
4711
- resolvedList.forEach((entry, idx) => {
4712
- if (entry instanceof Map && entry.has("ngModule")) {
4713
- entry = entry.get("ngModule");
4714
- }
4715
- if (Array.isArray(entry)) {
4716
- refList.push(...this.resolveTypeList(expr, entry, className, arrayName));
4717
- } else if (entry instanceof Reference) {
4718
- if (!this.isClassDeclarationReference(entry)) {
4719
- throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a class`);
4720
- }
4721
- refList.push(entry);
4722
- } else {
4723
- throw createValueHasWrongTypeError(expr, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a reference`);
4724
- }
4725
- });
4726
- return refList;
5226
+ } else {
4727
5227
  }
4728
- };
4729
- function isNgModule(node, compilation) {
4730
- return !compilation.directives.some((directive) => directive.ref.node === node) && !compilation.pipes.some((pipe) => pipe.ref.node === node);
5228
+ let extraText = "";
5229
+ if (relatedInformation === void 0) {
5230
+ extraText = " It must be imported via an NgModule.";
5231
+ }
5232
+ return makeDiagnostic(ErrorCode.COMPONENT_IMPORT_NOT_STANDALONE, ref.getOriginForDiagnostics(rawExpr), `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly.${extraText}`, relatedInformation);
4731
5233
  }
4732
5234
 
4733
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
4734
- var EMPTY_MAP = /* @__PURE__ */ new Map();
4735
- var EMPTY_ARRAY = [];
5235
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/symbol.mjs
4736
5236
  var ComponentSymbol = class extends DirectiveSymbol {
4737
5237
  constructor() {
4738
5238
  super(...arguments);
@@ -4766,13 +5266,63 @@ var ComponentSymbol = class extends DirectiveSymbol {
4766
5266
  return !isArrayEqual(this.usedDirectives, previousSymbol.usedDirectives, isDirectiveUnaffected) || !isArrayEqual(this.usedPipes, previousSymbol.usedPipes, isPipeUnaffected);
4767
5267
  }
4768
5268
  };
5269
+
5270
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/util.mjs
5271
+ function collectAnimationNames(value, animationTriggerNames) {
5272
+ if (value instanceof Map) {
5273
+ const name = value.get("name");
5274
+ if (typeof name === "string") {
5275
+ animationTriggerNames.staticTriggerNames.push(name);
5276
+ } else {
5277
+ animationTriggerNames.includesDynamicAnimations = true;
5278
+ }
5279
+ } else if (Array.isArray(value)) {
5280
+ for (const resolvedValue of value) {
5281
+ collectAnimationNames(resolvedValue, animationTriggerNames);
5282
+ }
5283
+ } else {
5284
+ animationTriggerNames.includesDynamicAnimations = true;
5285
+ }
5286
+ }
5287
+ function validateAndFlattenComponentImports(imports, expr) {
5288
+ const flattened = [];
5289
+ if (!Array.isArray(imports)) {
5290
+ const error = createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules`).toDiagnostic();
5291
+ return {
5292
+ imports: [],
5293
+ diagnostics: [error]
5294
+ };
5295
+ }
5296
+ const diagnostics = [];
5297
+ for (const ref of imports) {
5298
+ if (Array.isArray(ref)) {
5299
+ const { imports: childImports, diagnostics: childDiagnostics } = validateAndFlattenComponentImports(ref, expr);
5300
+ flattened.push(...childImports);
5301
+ diagnostics.push(...childDiagnostics);
5302
+ } else if (ref instanceof Reference) {
5303
+ if (isNamedClassDeclaration(ref.node)) {
5304
+ flattened.push(ref);
5305
+ } else {
5306
+ diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, `'imports' must be an array of components, directives, pipes, or NgModules`).toDiagnostic());
5307
+ }
5308
+ } else {
5309
+ diagnostics.push(createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules`).toDiagnostic());
5310
+ }
5311
+ }
5312
+ return { imports: flattened, diagnostics };
5313
+ }
5314
+
5315
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
5316
+ var EMPTY_MAP = /* @__PURE__ */ new Map();
5317
+ var EMPTY_ARRAY = [];
4769
5318
  var ComponentDecoratorHandler = class {
4770
- constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
5319
+ constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
4771
5320
  this.reflector = reflector;
4772
5321
  this.evaluator = evaluator;
4773
5322
  this.metaRegistry = metaRegistry;
4774
5323
  this.metaReader = metaReader;
4775
5324
  this.scopeReader = scopeReader;
5325
+ this.dtsScopeReader = dtsScopeReader;
4776
5326
  this.scopeRegistry = scopeRegistry;
4777
5327
  this.typeCheckScopeRegistry = typeCheckScopeRegistry;
4778
5328
  this.resourceRegistry = resourceRegistry;
@@ -4797,6 +5347,11 @@ var ComponentDecoratorHandler = class {
4797
5347
  this.elementSchemaRegistry = new DomElementSchemaRegistry();
4798
5348
  this.preanalyzeTemplateCache = /* @__PURE__ */ new Map();
4799
5349
  this.preanalyzeStylesCache = /* @__PURE__ */ new Map();
5350
+ this.extractTemplateOptions = {
5351
+ enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
5352
+ i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
5353
+ usePoisonedData: this.usePoisonedData
5354
+ };
4800
5355
  this.precedence = HandlerPrecedence.PRIMARY;
4801
5356
  this.name = ComponentDecoratorHandler.name;
4802
5357
  }
@@ -4819,7 +5374,7 @@ var ComponentDecoratorHandler = class {
4819
5374
  if (!this.resourceLoader.canPreload) {
4820
5375
  return void 0;
4821
5376
  }
4822
- const meta = this._resolveLiteral(decorator);
5377
+ const meta = resolveLiteral(decorator, this.literalCache);
4823
5378
  const component = reflectObjectLiteral(meta);
4824
5379
  const containingFile = node.getSourceFile().fileName;
4825
5380
  const resolveStyleUrl = (styleUrl) => {
@@ -4830,13 +5385,13 @@ var ComponentDecoratorHandler = class {
4830
5385
  return void 0;
4831
5386
  }
4832
5387
  };
4833
- const templateAndTemplateStyleResources = this._preloadAndParseTemplate(node, decorator, component, containingFile).then((template) => {
5388
+ const templateAndTemplateStyleResources = preloadAndParseTemplate(this.evaluator, this.resourceLoader, this.depTracker, this.preanalyzeTemplateCache, node, decorator, component, containingFile, this.defaultPreserveWhitespaces, this.extractTemplateOptions).then((template) => {
4834
5389
  if (template === null) {
4835
5390
  return void 0;
4836
5391
  }
4837
5392
  return Promise.all(template.styleUrls.map((styleUrl) => resolveStyleUrl(styleUrl))).then(() => void 0);
4838
5393
  });
4839
- const componentStyleUrls = this._extractComponentStyleUrls(component);
5394
+ const componentStyleUrls = extractComponentStyleUrls(this.evaluator, component);
4840
5395
  let inlineStyles;
4841
5396
  if (component.has("styles")) {
4842
5397
  const litStyles = parseFieldArrayValue(component, "styles", this.evaluator);
@@ -4868,12 +5423,12 @@ var ComponentDecoratorHandler = class {
4868
5423
  return {};
4869
5424
  }
4870
5425
  const { decorator: component, metadata, inputs, outputs } = directiveResult;
4871
- const encapsulation = (_a = this._resolveEnumValue(component, "encapsulation", "ViewEncapsulation")) != null ? _a : ViewEncapsulation.Emulated;
4872
- const changeDetection = this._resolveEnumValue(component, "changeDetection", "ChangeDetectionStrategy");
5426
+ const encapsulation = (_a = resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation")) != null ? _a : ViewEncapsulation.Emulated;
5427
+ const changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy");
4873
5428
  let animations = null;
4874
5429
  let animationTriggerNames = null;
4875
5430
  if (component.has("animations")) {
4876
- animations = new WrappedNodeExpr5(component.get("animations"));
5431
+ animations = new WrappedNodeExpr7(component.get("animations"));
4877
5432
  const animationsValue = this.evaluator.evaluate(component.get("animations"));
4878
5433
  animationTriggerNames = { includesDynamicAnimations: false, staticTriggerNames: [] };
4879
5434
  collectAnimationNames(animationsValue, animationTriggerNames);
@@ -4892,29 +5447,55 @@ var ComponentDecoratorHandler = class {
4892
5447
  if (component.has("viewProviders")) {
4893
5448
  const viewProviders = component.get("viewProviders");
4894
5449
  viewProvidersRequiringFactory = resolveProvidersRequiringFactory(viewProviders, this.reflector, this.evaluator);
4895
- wrappedViewProviders = new WrappedNodeExpr5(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(viewProviders) : viewProviders);
5450
+ wrappedViewProviders = new WrappedNodeExpr7(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(viewProviders) : viewProviders);
4896
5451
  }
4897
5452
  if (component.has("providers")) {
4898
5453
  providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
4899
5454
  }
5455
+ let imports = null;
5456
+ if (component.has("imports") && !metadata.isStandalone) {
5457
+ if (diagnostics === void 0) {
5458
+ diagnostics = [];
5459
+ }
5460
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`));
5461
+ } else if (component.has("imports")) {
5462
+ const expr = component.get("imports");
5463
+ const imported = this.evaluator.evaluate(expr);
5464
+ const { imports: flattened, diagnostics: importDiagnostics } = validateAndFlattenComponentImports(imported, expr);
5465
+ imports = {
5466
+ resolved: flattened,
5467
+ raw: expr
5468
+ };
5469
+ if (importDiagnostics.length > 0) {
5470
+ isPoisoned = true;
5471
+ if (diagnostics === void 0) {
5472
+ diagnostics = [];
5473
+ }
5474
+ diagnostics.push(...importDiagnostics);
5475
+ }
5476
+ }
4900
5477
  let template;
4901
5478
  if (this.preanalyzeTemplateCache.has(node)) {
4902
5479
  const preanalyzed = this.preanalyzeTemplateCache.get(node);
4903
5480
  this.preanalyzeTemplateCache.delete(node);
4904
5481
  template = preanalyzed;
4905
5482
  } else {
4906
- const templateDecl = this.parseTemplateDeclaration(decorator, component, containingFile);
4907
- template = this.extractTemplate(node, templateDecl);
5483
+ const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, this.evaluator, this.resourceLoader, this.defaultPreserveWhitespaces);
5484
+ template = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, {
5485
+ enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
5486
+ i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
5487
+ usePoisonedData: this.usePoisonedData
5488
+ });
4908
5489
  }
4909
5490
  const templateResource = template.declaration.isInline ? { path: null, expression: component.get("template") } : {
4910
5491
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
4911
5492
  expression: template.sourceMapping.node
4912
5493
  };
4913
5494
  let styles = [];
4914
- const styleResources = this._extractStyleResources(component, containingFile);
5495
+ const styleResources = extractStyleResources(this.resourceLoader, component, containingFile);
4915
5496
  const styleUrls = [
4916
- ...this._extractComponentStyleUrls(component),
4917
- ...this._extractTemplateStyleUrls(template)
5497
+ ...extractComponentStyleUrls(this.evaluator, component),
5498
+ ..._extractTemplateStyleUrls(template)
4918
5499
  ];
4919
5500
  for (const styleUrl of styleUrls) {
4920
5501
  try {
@@ -4929,7 +5510,7 @@ var ComponentDecoratorHandler = class {
4929
5510
  diagnostics = [];
4930
5511
  }
4931
5512
  const resourceType = styleUrl.source === 2 ? 2 : 1;
4932
- diagnostics.push(this.makeResourceNotFoundError(styleUrl.url, styleUrl.nodeForError, resourceType).toDiagnostic());
5513
+ diagnostics.push(makeResourceNotFoundError(styleUrl.url, styleUrl.nodeForError, resourceType).toDiagnostic());
4933
5514
  }
4934
5515
  }
4935
5516
  if (encapsulation === ViewEncapsulation.ShadowDom && metadata.selector !== null) {
@@ -4974,7 +5555,7 @@ var ComponentDecoratorHandler = class {
4974
5555
  ngContentSelectors: template.ngContentSelectors
4975
5556
  },
4976
5557
  encapsulation,
4977
- interpolation: (_b = template.interpolationConfig) != null ? _b : DEFAULT_INTERPOLATION_CONFIG,
5558
+ interpolation: (_b = template.interpolationConfig) != null ? _b : DEFAULT_INTERPOLATION_CONFIG2,
4978
5559
  styles,
4979
5560
  animations,
4980
5561
  viewProviders: wrappedViewProviders,
@@ -4982,7 +5563,7 @@ var ComponentDecoratorHandler = class {
4982
5563
  relativeContextFilePath
4983
5564
  }),
4984
5565
  typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
4985
- classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => this._transformDecoratorToInlineResources(dec, component, styles, template)),
5566
+ classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorToInlineResources(dec, component, styles, template)),
4986
5567
  template,
4987
5568
  providersRequiringFactory,
4988
5569
  viewProvidersRequiringFactory,
@@ -4993,7 +5574,8 @@ var ComponentDecoratorHandler = class {
4993
5574
  template: templateResource
4994
5575
  },
4995
5576
  isPoisoned,
4996
- animationTriggerNames
5577
+ animationTriggerNames,
5578
+ imports
4997
5579
  },
4998
5580
  diagnostics
4999
5581
  };
@@ -5022,6 +5604,7 @@ var ComponentDecoratorHandler = class {
5022
5604
  }, analysis.typeCheckMeta), {
5023
5605
  isPoisoned: analysis.isPoisoned,
5024
5606
  isStructural: false,
5607
+ isStandalone: analysis.meta.isStandalone,
5025
5608
  animationTriggerNames: analysis.animationTriggerNames
5026
5609
  }));
5027
5610
  this.resourceRegistry.registerResources(analysis.resources, node);
@@ -5057,7 +5640,7 @@ var ComponentDecoratorHandler = class {
5057
5640
  });
5058
5641
  }
5059
5642
  typeCheck(ctx, node, meta) {
5060
- if (this.typeCheckScopeRegistry === null || !ts21.isClassDeclaration(node)) {
5643
+ if (this.typeCheckScopeRegistry === null || !ts24.isClassDeclaration(node)) {
5061
5644
  return;
5062
5645
  }
5063
5646
  if (meta.isPoisoned && !this.usePoisonedData) {
@@ -5080,23 +5663,25 @@ var ComponentDecoratorHandler = class {
5080
5663
  if (analysis.isPoisoned && !this.usePoisonedData) {
5081
5664
  return {};
5082
5665
  }
5083
- const context = node.getSourceFile();
5084
- const scope = this.scopeReader.getScopeForComponent(node);
5085
- let metadata = analysis.meta;
5666
+ const context = getSourceFile(node);
5667
+ const metadata = analysis.meta;
5086
5668
  const data = {
5087
5669
  directives: EMPTY_ARRAY,
5088
5670
  pipes: EMPTY_MAP,
5089
5671
  declarationListEmitMode: 0
5090
5672
  };
5091
- if (scope !== null && (!scope.compilation.isPoisoned || this.usePoisonedData)) {
5673
+ const diagnostics = [];
5674
+ const scope = scopeTemplate(this.scopeReader, this.dtsScopeReader, this.scopeRegistry, this.metaReader, node, analysis, this.usePoisonedData);
5675
+ if (scope !== null) {
5676
+ diagnostics.push(...scope.diagnostics);
5092
5677
  const matcher = new SelectorMatcher();
5093
- for (const dir of scope.compilation.directives) {
5678
+ for (const dir of scope.directives) {
5094
5679
  if (dir.selector !== null) {
5095
5680
  matcher.addSelectables(CssSelector.parse(dir.selector), dir);
5096
5681
  }
5097
5682
  }
5098
5683
  const pipes = /* @__PURE__ */ new Map();
5099
- for (const pipe of scope.compilation.pipes) {
5684
+ for (const pipe of scope.pipes) {
5100
5685
  pipes.set(pipe.name, pipe.ref);
5101
5686
  }
5102
5687
  const binder = new R3TargetBinder(matcher);
@@ -5164,7 +5749,7 @@ var ComponentDecoratorHandler = class {
5164
5749
  if (this.cycleHandlingStrategy === 0) {
5165
5750
  this.scopeRegistry.setComponentRemoteScope(node, usedDirectives.map((dir) => dir.ref), usedPipes.map((pipe) => pipe.ref));
5166
5751
  symbol.isRemotelyScoped = true;
5167
- if (this.semanticDepGraphUpdater !== null) {
5752
+ if (this.semanticDepGraphUpdater !== null && scope.ngModule !== null) {
5168
5753
  const moduleSymbol = this.semanticDepGraphUpdater.getSymbol(scope.ngModule);
5169
5754
  if (!(moduleSymbol instanceof NgModuleSymbol)) {
5170
5755
  throw new Error(`AssertionError: Expected ${scope.ngModule.name} to be an NgModuleSymbol.`);
@@ -5183,12 +5768,11 @@ var ComponentDecoratorHandler = class {
5183
5768
  }
5184
5769
  }
5185
5770
  }
5186
- const diagnostics = [];
5187
- if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr5) {
5771
+ if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr7) {
5188
5772
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
5189
5773
  diagnostics.push(...providerDiagnostics);
5190
5774
  }
5191
- if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof WrappedNodeExpr5) {
5775
+ if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof WrappedNodeExpr7) {
5192
5776
  const viewProviderDiagnostics = getProviderDiagnostics(analysis.viewProvidersRequiringFactory, analysis.meta.viewProviders.node, this.injectableRegistry);
5193
5777
  diagnostics.push(...viewProviderDiagnostics);
5194
5778
  }
@@ -5203,13 +5787,13 @@ var ComponentDecoratorHandler = class {
5203
5787
  }
5204
5788
  xi18n(ctx, node, analysis) {
5205
5789
  var _a;
5206
- ctx.updateFromTemplate(analysis.template.content, analysis.template.declaration.resolvedTemplateUrl, (_a = analysis.template.interpolationConfig) != null ? _a : DEFAULT_INTERPOLATION_CONFIG);
5790
+ ctx.updateFromTemplate(analysis.template.content, analysis.template.declaration.resolvedTemplateUrl, (_a = analysis.template.interpolationConfig) != null ? _a : DEFAULT_INTERPOLATION_CONFIG2);
5207
5791
  }
5208
5792
  updateResources(node, analysis) {
5209
5793
  const containingFile = node.getSourceFile().fileName;
5210
5794
  const templateDecl = analysis.template.declaration;
5211
5795
  if (!templateDecl.isInline) {
5212
- analysis.template = this.extractTemplate(node, templateDecl);
5796
+ analysis.template = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, this.extractTemplateOptions);
5213
5797
  }
5214
5798
  let styles = [];
5215
5799
  if (analysis.styleUrls !== null) {
@@ -5250,7 +5834,7 @@ var ComponentDecoratorHandler = class {
5250
5834
  content: analysis.template.content,
5251
5835
  sourceUrl: analysis.template.declaration.resolvedTemplateUrl,
5252
5836
  isInline: analysis.template.declaration.isInline,
5253
- inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new WrappedNodeExpr5(analysis.template.sourceMapping.node) : null
5837
+ inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new WrappedNodeExpr7(analysis.template.sourceMapping.node) : null
5254
5838
  };
5255
5839
  const meta = __spreadValues(__spreadValues({}, analysis.meta), resolution);
5256
5840
  const fac = compileDeclareFactory(toFactoryMetadata(meta, FactoryTarget3.Component));
@@ -5258,389 +5842,25 @@ var ComponentDecoratorHandler = class {
5258
5842
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata3(analysis.classMetadata).toStmt() : null;
5259
5843
  return compileResults(fac, def, classMetadata, "\u0275cmp");
5260
5844
  }
5261
- _transformDecoratorToInlineResources(dec, component, styles, template) {
5262
- if (dec.name !== "Component") {
5263
- return dec;
5264
- }
5265
- if (!component.has("templateUrl") && !component.has("styleUrls")) {
5266
- return dec;
5267
- }
5268
- const metadata = new Map(component);
5269
- if (metadata.has("templateUrl")) {
5270
- metadata.delete("templateUrl");
5271
- metadata.set("template", ts21.createStringLiteral(template.content));
5272
- }
5273
- if (metadata.has("styleUrls")) {
5274
- metadata.delete("styleUrls");
5275
- metadata.set("styles", ts21.createArrayLiteral(styles.map((s) => ts21.createStringLiteral(s))));
5276
- }
5277
- const newMetadataFields = [];
5278
- for (const [name, value] of metadata.entries()) {
5279
- newMetadataFields.push(ts21.createPropertyAssignment(name, value));
5280
- }
5281
- return __spreadProps(__spreadValues({}, dec), { args: [ts21.createObjectLiteral(newMetadataFields)] });
5282
- }
5283
- _resolveLiteral(decorator) {
5284
- if (this.literalCache.has(decorator)) {
5285
- return this.literalCache.get(decorator);
5286
- }
5287
- if (decorator.args === null || decorator.args.length !== 1) {
5288
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @Component decorator`);
5289
- }
5290
- const meta = unwrapExpression(decorator.args[0]);
5291
- if (!ts21.isObjectLiteralExpression(meta)) {
5292
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `Decorator argument must be literal.`);
5293
- }
5294
- this.literalCache.set(decorator, meta);
5295
- return meta;
5296
- }
5297
- _resolveEnumValue(component, field, enumSymbolName) {
5298
- let resolved = null;
5299
- if (component.has(field)) {
5300
- const expr = component.get(field);
5301
- const value = this.evaluator.evaluate(expr);
5302
- if (value instanceof EnumValue && isAngularCoreReference(value.enumRef, enumSymbolName)) {
5303
- resolved = value.resolved;
5304
- } else {
5305
- throw createValueHasWrongTypeError(expr, value, `${field} must be a member of ${enumSymbolName} enum from @angular/core`);
5306
- }
5307
- }
5308
- return resolved;
5309
- }
5310
- _extractComponentStyleUrls(component) {
5311
- if (!component.has("styleUrls")) {
5312
- return [];
5313
- }
5314
- return this._extractStyleUrlsFromExpression(component.get("styleUrls"));
5315
- }
5316
- _extractStyleUrlsFromExpression(styleUrlsExpr) {
5317
- const styleUrls = [];
5318
- if (ts21.isArrayLiteralExpression(styleUrlsExpr)) {
5319
- for (const styleUrlExpr of styleUrlsExpr.elements) {
5320
- if (ts21.isSpreadElement(styleUrlExpr)) {
5321
- styleUrls.push(...this._extractStyleUrlsFromExpression(styleUrlExpr.expression));
5322
- } else {
5323
- const styleUrl = this.evaluator.evaluate(styleUrlExpr);
5324
- if (typeof styleUrl !== "string") {
5325
- throw createValueHasWrongTypeError(styleUrlExpr, styleUrl, "styleUrl must be a string");
5326
- }
5327
- styleUrls.push({
5328
- url: styleUrl,
5329
- source: 2,
5330
- nodeForError: styleUrlExpr
5331
- });
5332
- }
5333
- }
5334
- } else {
5335
- const evaluatedStyleUrls = this.evaluator.evaluate(styleUrlsExpr);
5336
- if (!isStringArray(evaluatedStyleUrls)) {
5337
- throw createValueHasWrongTypeError(styleUrlsExpr, evaluatedStyleUrls, "styleUrls must be an array of strings");
5338
- }
5339
- for (const styleUrl of evaluatedStyleUrls) {
5340
- styleUrls.push({
5341
- url: styleUrl,
5342
- source: 2,
5343
- nodeForError: styleUrlsExpr
5344
- });
5345
- }
5346
- }
5347
- return styleUrls;
5348
- }
5349
- _extractStyleResources(component, containingFile) {
5350
- const styles = /* @__PURE__ */ new Set();
5351
- function stringLiteralElements(array) {
5352
- return array.elements.filter((e) => ts21.isStringLiteralLike(e));
5353
- }
5354
- const styleUrlsExpr = component.get("styleUrls");
5355
- if (styleUrlsExpr !== void 0 && ts21.isArrayLiteralExpression(styleUrlsExpr)) {
5356
- for (const expression of stringLiteralElements(styleUrlsExpr)) {
5357
- try {
5358
- const resourceUrl = this.resourceLoader.resolve(expression.text, containingFile);
5359
- styles.add({ path: absoluteFrom(resourceUrl), expression });
5360
- } catch {
5361
- }
5362
- }
5363
- }
5364
- const stylesExpr = component.get("styles");
5365
- if (stylesExpr !== void 0 && ts21.isArrayLiteralExpression(stylesExpr)) {
5366
- for (const expression of stringLiteralElements(stylesExpr)) {
5367
- styles.add({ path: null, expression });
5368
- }
5369
- }
5370
- return styles;
5371
- }
5372
- _preloadAndParseTemplate(node, decorator, component, containingFile) {
5373
- if (component.has("templateUrl")) {
5374
- const templateUrlExpr = component.get("templateUrl");
5375
- const templateUrl = this.evaluator.evaluate(templateUrlExpr);
5376
- if (typeof templateUrl !== "string") {
5377
- throw createValueHasWrongTypeError(templateUrlExpr, templateUrl, "templateUrl must be a string");
5378
- }
5379
- try {
5380
- const resourceUrl = this.resourceLoader.resolve(templateUrl, containingFile);
5381
- const templatePromise = this.resourceLoader.preload(resourceUrl, { type: "template", containingFile });
5382
- if (templatePromise !== void 0) {
5383
- return templatePromise.then(() => {
5384
- const templateDecl = this.parseTemplateDeclaration(decorator, component, containingFile);
5385
- const template = this.extractTemplate(node, templateDecl);
5386
- this.preanalyzeTemplateCache.set(node, template);
5387
- return template;
5388
- });
5389
- } else {
5390
- return Promise.resolve(null);
5391
- }
5392
- } catch (e) {
5393
- throw this.makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
5394
- }
5395
- } else {
5396
- const templateDecl = this.parseTemplateDeclaration(decorator, component, containingFile);
5397
- const template = this.extractTemplate(node, templateDecl);
5398
- this.preanalyzeTemplateCache.set(node, template);
5399
- return Promise.resolve(template);
5400
- }
5401
- }
5402
- extractTemplate(node, template) {
5403
- if (template.isInline) {
5404
- let sourceStr;
5405
- let sourceParseRange = null;
5406
- let templateContent;
5407
- let sourceMapping;
5408
- let escapedString = false;
5409
- let sourceMapUrl;
5410
- if (ts21.isStringLiteral(template.expression) || ts21.isNoSubstitutionTemplateLiteral(template.expression)) {
5411
- sourceParseRange = getTemplateRange(template.expression);
5412
- sourceStr = template.expression.getSourceFile().text;
5413
- templateContent = template.expression.text;
5414
- escapedString = true;
5415
- sourceMapping = {
5416
- type: "direct",
5417
- node: template.expression
5418
- };
5419
- sourceMapUrl = template.resolvedTemplateUrl;
5420
- } else {
5421
- const resolvedTemplate = this.evaluator.evaluate(template.expression);
5422
- if (typeof resolvedTemplate !== "string") {
5423
- throw createValueHasWrongTypeError(template.expression, resolvedTemplate, "template must be a string");
5424
- }
5425
- sourceStr = resolvedTemplate;
5426
- templateContent = resolvedTemplate;
5427
- sourceMapping = {
5428
- type: "indirect",
5429
- node: template.expression,
5430
- componentClass: node,
5431
- template: templateContent
5432
- };
5433
- sourceMapUrl = null;
5434
- }
5435
- return __spreadProps(__spreadValues({}, this._parseTemplate(template, sourceStr, sourceParseRange, escapedString, sourceMapUrl)), {
5436
- content: templateContent,
5437
- sourceMapping,
5438
- declaration: template
5439
- });
5440
- } else {
5441
- const templateContent = this.resourceLoader.load(template.resolvedTemplateUrl);
5442
- if (this.depTracker !== null) {
5443
- this.depTracker.addResourceDependency(node.getSourceFile(), absoluteFrom(template.resolvedTemplateUrl));
5444
- }
5445
- return __spreadProps(__spreadValues({}, this._parseTemplate(template, templateContent, null, false, template.resolvedTemplateUrl)), {
5446
- content: templateContent,
5447
- sourceMapping: {
5448
- type: "external",
5449
- componentClass: node,
5450
- node: template.templateUrlExpression,
5451
- template: templateContent,
5452
- templateUrl: template.resolvedTemplateUrl
5453
- },
5454
- declaration: template
5455
- });
5456
- }
5457
- }
5458
- _parseTemplate(template, sourceStr, sourceParseRange, escapedString, sourceMapUrl) {
5459
- const i18nNormalizeLineEndingsInICUs = escapedString || this.i18nNormalizeLineEndingsInICUs;
5460
- const parsedTemplate = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
5461
- preserveWhitespaces: template.preserveWhitespaces,
5462
- interpolationConfig: template.interpolationConfig,
5463
- range: sourceParseRange != null ? sourceParseRange : void 0,
5464
- escapedString,
5465
- enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
5466
- i18nNormalizeLineEndingsInICUs,
5467
- alwaysAttemptHtmlToR3AstConversion: this.usePoisonedData
5468
- });
5469
- const { nodes: diagNodes } = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
5470
- preserveWhitespaces: true,
5471
- preserveLineEndings: true,
5472
- interpolationConfig: template.interpolationConfig,
5473
- range: sourceParseRange != null ? sourceParseRange : void 0,
5474
- escapedString,
5475
- enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
5476
- i18nNormalizeLineEndingsInICUs,
5477
- leadingTriviaChars: [],
5478
- alwaysAttemptHtmlToR3AstConversion: this.usePoisonedData
5479
- });
5480
- return __spreadProps(__spreadValues({}, parsedTemplate), {
5481
- diagNodes,
5482
- file: new ParseSourceFile2(sourceStr, sourceMapUrl != null ? sourceMapUrl : "")
5483
- });
5484
- }
5485
- parseTemplateDeclaration(decorator, component, containingFile) {
5486
- let preserveWhitespaces = this.defaultPreserveWhitespaces;
5487
- if (component.has("preserveWhitespaces")) {
5488
- const expr = component.get("preserveWhitespaces");
5489
- const value = this.evaluator.evaluate(expr);
5490
- if (typeof value !== "boolean") {
5491
- throw createValueHasWrongTypeError(expr, value, "preserveWhitespaces must be a boolean");
5492
- }
5493
- preserveWhitespaces = value;
5494
- }
5495
- let interpolationConfig = DEFAULT_INTERPOLATION_CONFIG;
5496
- if (component.has("interpolation")) {
5497
- const expr = component.get("interpolation");
5498
- const value = this.evaluator.evaluate(expr);
5499
- if (!Array.isArray(value) || value.length !== 2 || !value.every((element) => typeof element === "string")) {
5500
- throw createValueHasWrongTypeError(expr, value, "interpolation must be an array with 2 elements of string type");
5501
- }
5502
- interpolationConfig = InterpolationConfig.fromArray(value);
5503
- }
5504
- if (component.has("templateUrl")) {
5505
- const templateUrlExpr = component.get("templateUrl");
5506
- const templateUrl = this.evaluator.evaluate(templateUrlExpr);
5507
- if (typeof templateUrl !== "string") {
5508
- throw createValueHasWrongTypeError(templateUrlExpr, templateUrl, "templateUrl must be a string");
5509
- }
5510
- try {
5511
- const resourceUrl = this.resourceLoader.resolve(templateUrl, containingFile);
5512
- return {
5513
- isInline: false,
5514
- interpolationConfig,
5515
- preserveWhitespaces,
5516
- templateUrl,
5517
- templateUrlExpression: templateUrlExpr,
5518
- resolvedTemplateUrl: resourceUrl
5519
- };
5520
- } catch (e) {
5521
- throw this.makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
5522
- }
5523
- } else if (component.has("template")) {
5524
- return {
5525
- isInline: true,
5526
- interpolationConfig,
5527
- preserveWhitespaces,
5528
- expression: component.get("template"),
5529
- templateUrl: containingFile,
5530
- resolvedTemplateUrl: containingFile
5531
- };
5532
- } else {
5533
- throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE, Decorator.nodeForError(decorator), "component is missing a template");
5534
- }
5535
- }
5536
- _resolveImportedFile(importedFile, expr, origin) {
5537
- if (importedFile !== "unknown") {
5538
- return importedFile;
5539
- }
5540
- if (!(expr instanceof ExternalExpr5)) {
5541
- return null;
5542
- }
5543
- return this.moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
5544
- }
5545
5845
  _checkForCyclicImport(importedFile, expr, origin) {
5546
- const imported = this._resolveImportedFile(importedFile, expr, origin);
5846
+ const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
5547
5847
  if (imported === null) {
5548
5848
  return null;
5549
5849
  }
5550
5850
  return this.cycleAnalyzer.wouldCreateCycle(origin, imported);
5551
5851
  }
5552
5852
  _recordSyntheticImport(importedFile, expr, origin) {
5553
- const imported = this._resolveImportedFile(importedFile, expr, origin);
5853
+ const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
5554
5854
  if (imported === null) {
5555
5855
  return;
5556
5856
  }
5557
5857
  this.cycleAnalyzer.recordSyntheticImport(origin, imported);
5558
5858
  }
5559
- makeResourceNotFoundError(file, nodeForError, resourceType) {
5560
- let errorText;
5561
- switch (resourceType) {
5562
- case 0:
5563
- errorText = `Could not find template file '${file}'.`;
5564
- break;
5565
- case 1:
5566
- errorText = `Could not find stylesheet file '${file}' linked from the template.`;
5567
- break;
5568
- case 2:
5569
- errorText = `Could not find stylesheet file '${file}'.`;
5570
- break;
5571
- }
5572
- return new FatalDiagnosticError(ErrorCode.COMPONENT_RESOURCE_NOT_FOUND, nodeForError, errorText);
5573
- }
5574
- _extractTemplateStyleUrls(template) {
5575
- if (template.styleUrls === null) {
5576
- return [];
5577
- }
5578
- const nodeForError = getTemplateDeclarationNodeForError(template.declaration);
5579
- return template.styleUrls.map((url) => ({ url, source: 1, nodeForError }));
5580
- }
5581
5859
  };
5582
- function getTemplateRange(templateExpr) {
5583
- const startPos = templateExpr.getStart() + 1;
5584
- const { line, character } = ts21.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
5585
- return {
5586
- startPos,
5587
- startLine: line,
5588
- startCol: character,
5589
- endPos: templateExpr.getEnd() - 1
5590
- };
5591
- }
5592
- function isStringArray(resolvedValue) {
5593
- return Array.isArray(resolvedValue) && resolvedValue.every((elem) => typeof elem === "string");
5594
- }
5595
- function getTemplateDeclarationNodeForError(declaration) {
5596
- switch (declaration.isInline) {
5597
- case true:
5598
- return declaration.expression;
5599
- case false:
5600
- return declaration.templateUrlExpression;
5601
- }
5602
- }
5603
- function makeCyclicImportInfo(ref, type, cycle) {
5604
- const name = ref.debugName || "(unknown)";
5605
- const path = cycle.getPath().map((sf) => sf.fileName).join(" -> ");
5606
- const message = `The ${type} '${name}' is used in the template but importing it would create a cycle: `;
5607
- return makeRelatedInformation(ref.node, message + path);
5608
- }
5609
- function checkCustomElementSelectorForErrors(selector) {
5610
- if (selector.includes(".") || selector.includes("[") && selector.includes("]")) {
5611
- return null;
5612
- }
5613
- if (!/^[a-z]/.test(selector)) {
5614
- return "Selector of a ShadowDom-encapsulated component must start with a lower case letter.";
5615
- }
5616
- if (/[A-Z]/.test(selector)) {
5617
- return "Selector of a ShadowDom-encapsulated component must all be in lower case.";
5618
- }
5619
- if (!selector.includes("-")) {
5620
- return "Selector of a component that uses ViewEncapsulation.ShadowDom must contain a hyphen.";
5621
- }
5622
- return null;
5623
- }
5624
- function collectAnimationNames(value, animationTriggerNames) {
5625
- if (value instanceof Map) {
5626
- const name = value.get("name");
5627
- if (typeof name === "string") {
5628
- animationTriggerNames.staticTriggerNames.push(name);
5629
- } else {
5630
- animationTriggerNames.includesDynamicAnimations = true;
5631
- }
5632
- } else if (Array.isArray(value)) {
5633
- for (const resolvedValue of value) {
5634
- collectAnimationNames(resolvedValue, animationTriggerNames);
5635
- }
5636
- } else {
5637
- animationTriggerNames.includesDynamicAnimations = true;
5638
- }
5639
- }
5640
5860
 
5641
5861
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
5642
- import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
5643
- import ts22 from "typescript";
5862
+ import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
5863
+ import ts25 from "typescript";
5644
5864
  var InjectableDecoratorHandler = class {
5645
5865
  constructor(reflector, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
5646
5866
  this.reflector = reflector;
@@ -5716,7 +5936,7 @@ var InjectableDecoratorHandler = class {
5716
5936
  function extractInjectableMetadata(clazz, decorator, reflector) {
5717
5937
  const name = clazz.name.text;
5718
5938
  const type = wrapTypeReference(reflector, clazz);
5719
- const internalType = new WrappedNodeExpr6(reflector.getInternalNameOfClass(clazz));
5939
+ const internalType = new WrappedNodeExpr8(reflector.getInternalNameOfClass(clazz));
5720
5940
  const typeArgumentCount = reflector.getGenericArityOfClass(clazz) || 0;
5721
5941
  if (decorator.args === null) {
5722
5942
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, Decorator.nodeForError(decorator), "@Injectable must be called");
@@ -5731,7 +5951,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5731
5951
  };
5732
5952
  } else if (decorator.args.length === 1) {
5733
5953
  const metaNode = decorator.args[0];
5734
- if (!ts22.isObjectLiteralExpression(metaNode)) {
5954
+ if (!ts25.isObjectLiteralExpression(metaNode)) {
5735
5955
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
5736
5956
  }
5737
5957
  const meta = reflectObjectLiteral(metaNode);
@@ -5739,7 +5959,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5739
5959
  let deps = void 0;
5740
5960
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
5741
5961
  const depsExpr = meta.get("deps");
5742
- if (!ts22.isArrayLiteralExpression(depsExpr)) {
5962
+ if (!ts25.isArrayLiteralExpression(depsExpr)) {
5743
5963
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
5744
5964
  }
5745
5965
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -5753,7 +5973,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5753
5973
  result.useClass = getProviderExpression(meta.get("useClass"), reflector);
5754
5974
  result.deps = deps;
5755
5975
  } else if (meta.has("useFactory")) {
5756
- result.useFactory = new WrappedNodeExpr6(meta.get("useFactory"));
5976
+ result.useFactory = new WrappedNodeExpr8(meta.get("useFactory"));
5757
5977
  result.deps = deps;
5758
5978
  }
5759
5979
  return result;
@@ -5763,7 +5983,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5763
5983
  }
5764
5984
  function getProviderExpression(expression, reflector) {
5765
5985
  const forwardRefValue = tryUnwrapForwardRef(expression, reflector);
5766
- return createMayBeForwardRefExpression2(new WrappedNodeExpr6(forwardRefValue != null ? forwardRefValue : expression), forwardRefValue !== null ? 2 : 0);
5986
+ return createMayBeForwardRefExpression2(new WrappedNodeExpr8(forwardRefValue != null ? forwardRefValue : expression), forwardRefValue !== null ? 2 : 0);
5767
5987
  }
5768
5988
  function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, strictCtorDeps) {
5769
5989
  if (decorator.args === null) {
@@ -5789,7 +6009,7 @@ function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, st
5789
6009
  }
5790
6010
  function getDep(dep, reflector) {
5791
6011
  const meta = {
5792
- token: new WrappedNodeExpr6(dep),
6012
+ token: new WrappedNodeExpr8(dep),
5793
6013
  attributeNameType: null,
5794
6014
  host: false,
5795
6015
  optional: false,
@@ -5804,7 +6024,7 @@ function getDep(dep, reflector) {
5804
6024
  switch (source.name) {
5805
6025
  case "Inject":
5806
6026
  if (token !== void 0) {
5807
- meta.token = new WrappedNodeExpr6(token);
6027
+ meta.token = new WrappedNodeExpr8(token);
5808
6028
  }
5809
6029
  break;
5810
6030
  case "Optional":
@@ -5821,17 +6041,17 @@ function getDep(dep, reflector) {
5821
6041
  }
5822
6042
  return true;
5823
6043
  }
5824
- if (ts22.isArrayLiteralExpression(dep)) {
6044
+ if (ts25.isArrayLiteralExpression(dep)) {
5825
6045
  dep.elements.forEach((el) => {
5826
6046
  let isDecorator = false;
5827
- if (ts22.isIdentifier(el)) {
6047
+ if (ts25.isIdentifier(el)) {
5828
6048
  isDecorator = maybeUpdateDecorator(el, reflector);
5829
- } else if (ts22.isNewExpression(el) && ts22.isIdentifier(el.expression)) {
6049
+ } else if (ts25.isNewExpression(el) && ts25.isIdentifier(el.expression)) {
5830
6050
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
5831
6051
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
5832
6052
  }
5833
6053
  if (!isDecorator) {
5834
- meta.token = new WrappedNodeExpr6(el);
6054
+ meta.token = new WrappedNodeExpr8(el);
5835
6055
  }
5836
6056
  });
5837
6057
  }
@@ -5839,8 +6059,8 @@ function getDep(dep, reflector) {
5839
6059
  }
5840
6060
 
5841
6061
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
5842
- import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
5843
- import ts23 from "typescript";
6062
+ import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
6063
+ import ts26 from "typescript";
5844
6064
  var PipeSymbol = class extends SemanticSymbol {
5845
6065
  constructor(decl, name) {
5846
6066
  super(decl);
@@ -5887,7 +6107,7 @@ var PipeDecoratorHandler = class {
5887
6107
  this.perf.eventCount(PerfEvent.AnalyzePipe);
5888
6108
  const name = clazz.name.text;
5889
6109
  const type = wrapTypeReference(this.reflector, clazz);
5890
- const internalType = new WrappedNodeExpr7(this.reflector.getInternalNameOfClass(clazz));
6110
+ const internalType = new WrappedNodeExpr9(this.reflector.getInternalNameOfClass(clazz));
5891
6111
  if (decorator.args === null) {
5892
6112
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, Decorator.nodeForError(decorator), `@Pipe must be called`);
5893
6113
  }
@@ -5895,7 +6115,7 @@ var PipeDecoratorHandler = class {
5895
6115
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
5896
6116
  }
5897
6117
  const meta = unwrapExpression(decorator.args[0]);
5898
- if (!ts23.isObjectLiteralExpression(meta)) {
6118
+ if (!ts26.isObjectLiteralExpression(meta)) {
5899
6119
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
5900
6120
  }
5901
6121
  const pipe = reflectObjectLiteral(meta);
@@ -5916,6 +6136,15 @@ var PipeDecoratorHandler = class {
5916
6136
  }
5917
6137
  pure = pureValue;
5918
6138
  }
6139
+ let isStandalone = false;
6140
+ if (pipe.has("standalone")) {
6141
+ const expr = pipe.get("standalone");
6142
+ const resolved = this.evaluator.evaluate(expr);
6143
+ if (typeof resolved !== "boolean") {
6144
+ throw createValueHasWrongTypeError(expr, resolved, `standalone flag must be a boolean`);
6145
+ }
6146
+ isStandalone = resolved;
6147
+ }
5919
6148
  return {
5920
6149
  analysis: {
5921
6150
  meta: {
@@ -5925,7 +6154,8 @@ var PipeDecoratorHandler = class {
5925
6154
  typeArgumentCount: this.reflector.getGenericArityOfClass(clazz) || 0,
5926
6155
  pipeName,
5927
6156
  deps: getValidConstructorDependencies(clazz, this.reflector, this.isCore),
5928
- pure
6157
+ pure,
6158
+ isStandalone
5929
6159
  },
5930
6160
  classMetadata: extractClassMetadata(clazz, this.reflector, this.isCore),
5931
6161
  pipeNameExpr
@@ -5937,7 +6167,13 @@ var PipeDecoratorHandler = class {
5937
6167
  }
5938
6168
  register(node, analysis) {
5939
6169
  const ref = new Reference(node);
5940
- this.metaRegistry.registerPipeMetadata({ type: MetaType.Pipe, ref, name: analysis.meta.pipeName, nameExpr: analysis.pipeNameExpr });
6170
+ this.metaRegistry.registerPipeMetadata({
6171
+ type: MetaType.Pipe,
6172
+ ref,
6173
+ name: analysis.meta.pipeName,
6174
+ nameExpr: analysis.pipeNameExpr,
6175
+ isStandalone: analysis.meta.isStandalone
6176
+ });
5941
6177
  this.injectableRegistry.registerInjectable(node);
5942
6178
  }
5943
6179
  resolve(node) {
@@ -5963,13 +6199,13 @@ var PipeDecoratorHandler = class {
5963
6199
  }
5964
6200
  };
5965
6201
 
5966
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/references_registry.mjs
5967
- var NoopReferencesRegistry = class {
5968
- add(source, ...references) {
5969
- }
5970
- };
5971
-
5972
6202
  export {
6203
+ forwardRefResolver,
6204
+ readBaseClass,
6205
+ DynamicValue,
6206
+ StaticInterpreter,
6207
+ PartialEvaluator,
6208
+ NoopReferencesRegistry,
5973
6209
  SemanticDepGraphUpdater,
5974
6210
  CompoundMetadataReader,
5975
6211
  DtsMetadataReader,
@@ -5978,9 +6214,6 @@ export {
5978
6214
  CompoundMetadataRegistry,
5979
6215
  InjectableClassRegistry,
5980
6216
  ResourceRegistry,
5981
- DynamicValue,
5982
- StaticInterpreter,
5983
- PartialEvaluator,
5984
6217
  CompilationMode,
5985
6218
  HandlerFlags,
5986
6219
  aliasTransformFactory,
@@ -5998,14 +6231,11 @@ export {
5998
6231
  DtsTransformRegistry,
5999
6232
  declarationTransformFactory,
6000
6233
  ivyTransformFactory,
6001
- forwardRefResolver,
6002
- readBaseClass,
6003
6234
  DirectiveDecoratorHandler,
6004
6235
  NgModuleDecoratorHandler,
6005
6236
  ComponentDecoratorHandler,
6006
6237
  InjectableDecoratorHandler,
6007
- PipeDecoratorHandler,
6008
- NoopReferencesRegistry
6238
+ PipeDecoratorHandler
6009
6239
  };
6010
6240
  /**
6011
6241
  * @license
@@ -6015,4 +6245,4 @@ export {
6015
6245
  * found in the LICENSE file at https://angular.io/license
6016
6246
  */
6017
6247
  // Closure Compiler ignores @suppress and similar if the comment contains @license.
6018
- //# sourceMappingURL=chunk-C44PYKVA.js.map
6248
+ //# sourceMappingURL=chunk-7C3Q5ZSV.js.map