@angular/compiler-cli 14.0.0-next.7 → 14.0.0-rc.0

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 (125) hide show
  1. package/bundles/{chunk-AR265E4B.js → chunk-2IMT6JFI.js} +1 -1
  2. package/bundles/chunk-2IMT6JFI.js.map +6 -0
  3. package/bundles/{chunk-VGNMN2NK.js → chunk-53V6MPBS.js} +19 -8
  4. package/bundles/chunk-53V6MPBS.js.map +6 -0
  5. package/bundles/{chunk-OOJDZK5W.js → chunk-7XY4OMWJ.js} +110 -70
  6. package/bundles/chunk-7XY4OMWJ.js.map +6 -0
  7. package/bundles/{chunk-NM2N677S.js → chunk-BHGVN4MI.js} +70 -25
  8. package/bundles/chunk-BHGVN4MI.js.map +6 -0
  9. package/bundles/{chunk-26T3CJIJ.js → chunk-GJVJ6GH4.js} +1079 -815
  10. package/bundles/chunk-GJVJ6GH4.js.map +6 -0
  11. package/bundles/{chunk-WQ3TNYTD.js → chunk-GMSUYBZP.js} +8 -11
  12. package/bundles/{chunk-WQ3TNYTD.js.map → chunk-GMSUYBZP.js.map} +0 -0
  13. package/bundles/{chunk-5RC6M6GX.js → chunk-JDKMNZ6O.js} +6 -8
  14. package/bundles/chunk-JDKMNZ6O.js.map +6 -0
  15. package/bundles/{chunk-U5ES6WUL.js → chunk-KPGMJT2X.js} +3 -3
  16. package/bundles/chunk-KPGMJT2X.js.map +6 -0
  17. package/bundles/{chunk-646P2DOR.js → chunk-LX5Q27EF.js} +1 -1
  18. package/bundles/chunk-LX5Q27EF.js.map +6 -0
  19. package/bundles/{chunk-KMCI52ED.js → chunk-N6HUFHQ6.js} +967 -901
  20. package/bundles/chunk-N6HUFHQ6.js.map +6 -0
  21. package/bundles/{chunk-MXJN5K6C.js → chunk-OLGEBPBY.js} +3 -3
  22. package/bundles/chunk-OLGEBPBY.js.map +6 -0
  23. package/bundles/{chunk-QDWL7SZJ.js → chunk-R3C7RFJ4.js} +1 -1
  24. package/bundles/chunk-R3C7RFJ4.js.map +6 -0
  25. package/bundles/{chunk-GLCRIILX.js → chunk-R4NY3TJC.js} +1 -1
  26. package/bundles/chunk-R4NY3TJC.js.map +6 -0
  27. package/bundles/{chunk-FXU7FMZC.js → chunk-T7MYRXIE.js} +3 -3
  28. package/bundles/chunk-T7MYRXIE.js.map +6 -0
  29. package/bundles/{chunk-3MNDX4LL.js → chunk-W6KM7BUM.js} +3 -3
  30. package/bundles/chunk-W6KM7BUM.js.map +6 -0
  31. package/bundles/{chunk-K2Z44JHH.js → chunk-WGBFSDVQ.js} +3 -3
  32. package/bundles/chunk-WGBFSDVQ.js.map +6 -0
  33. package/bundles/index.js +11 -12
  34. package/bundles/index.js.map +1 -1
  35. package/bundles/linker/babel/index.js +6 -6
  36. package/bundles/linker/babel/index.js.map +1 -1
  37. package/bundles/linker/index.js +5 -5
  38. package/bundles/ngcc/index.js +12 -12
  39. package/bundles/ngcc/index.js.map +1 -1
  40. package/bundles/ngcc/main-ngcc.js +13 -13
  41. package/bundles/ngcc/main-ngcc.js.map +1 -1
  42. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +11 -11
  43. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
  44. package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
  45. package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js.map +1 -1
  46. package/bundles/private/bazel.js +2 -2
  47. package/bundles/private/localize.js +4 -4
  48. package/bundles/private/migrations.js +6 -6
  49. package/bundles/private/tooling.js +3 -3
  50. package/bundles/src/bin/ng_xi18n.js +8 -8
  51. package/bundles/src/bin/ng_xi18n.js.map +1 -1
  52. package/bundles/src/bin/ngc.js +8 -8
  53. package/bundles/src/bin/ngc.js.map +1 -1
  54. package/bundles_metadata.json +1 -1
  55. package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +7 -3
  56. package/linker/src/file_linker/emit_scopes/{iife_emit_scope.d.ts → local_emit_scope.d.ts} +7 -11
  57. package/linker/src/file_linker/partial_linkers/partial_class_metadata_linker_1.d.ts +3 -3
  58. package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +3 -3
  59. package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +3 -3
  60. package/linker/src/file_linker/partial_linkers/partial_factory_linker_1.d.ts +3 -3
  61. package/linker/src/file_linker/partial_linkers/partial_injectable_linker_1.d.ts +3 -3
  62. package/linker/src/file_linker/partial_linkers/partial_injector_linker_1.d.ts +3 -3
  63. package/linker/src/file_linker/partial_linkers/partial_linker.d.ts +8 -1
  64. package/linker/src/file_linker/partial_linkers/partial_ng_module_linker_1.d.ts +4 -4
  65. package/linker/src/file_linker/partial_linkers/partial_pipe_linker_1.d.ts +3 -3
  66. package/ngcc/src/dependencies/module_resolver.d.ts +5 -2
  67. package/ngcc/src/execution/cluster/api.d.ts +1 -1
  68. package/ngcc/src/execution/cluster/package_json_updater.d.ts +1 -1
  69. package/ngcc/src/execution/tasks/api.d.ts +2 -2
  70. package/ngcc/src/packages/build_marker.d.ts +1 -1
  71. package/ngcc/src/packages/entry_point.d.ts +1 -7
  72. package/ngcc/src/utils.d.ts +26 -0
  73. package/ngcc/src/writing/package_json_updater.d.ts +2 -1
  74. package/package.json +4 -4
  75. package/src/ngtsc/annotations/common/index.d.ts +1 -0
  76. package/src/ngtsc/annotations/common/src/schema.d.ts +12 -0
  77. package/src/ngtsc/annotations/common/src/util.d.ts +1 -1
  78. package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -8
  79. package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
  80. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +10 -7
  81. package/src/ngtsc/core/api/src/adapter.d.ts +12 -1
  82. package/src/ngtsc/core/src/host.d.ts +9 -2
  83. package/src/ngtsc/diagnostics/src/error_code.d.ts +10 -0
  84. package/src/ngtsc/metadata/src/api.d.ts +32 -5
  85. package/src/ngtsc/metadata/src/util.d.ts +1 -0
  86. package/src/ngtsc/partial_evaluator/index.d.ts +1 -0
  87. package/src/ngtsc/partial_evaluator/src/dynamic.d.ts +9 -1
  88. package/src/ngtsc/partial_evaluator/src/interface.d.ts +2 -1
  89. package/src/ngtsc/partial_evaluator/src/result.d.ts +2 -1
  90. package/src/ngtsc/partial_evaluator/src/synthetic.d.ts +19 -0
  91. package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
  92. package/src/ngtsc/scope/index.d.ts +4 -3
  93. package/src/ngtsc/scope/src/api.d.ts +36 -14
  94. package/src/ngtsc/scope/src/component_scope.d.ts +2 -16
  95. package/src/ngtsc/scope/src/local.d.ts +4 -11
  96. package/src/ngtsc/scope/src/standalone.d.ts +26 -0
  97. package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
  98. package/src/ngtsc/scope/src/util.d.ts +15 -0
  99. package/src/ngtsc/shims/api.d.ts +0 -1
  100. package/src/ngtsc/transform/src/compilation.d.ts +3 -1
  101. package/src/ngtsc/tsc_plugin.d.ts +1 -1
  102. package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
  103. package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
  104. package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
  105. package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
  106. package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
  107. package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
  108. package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
  109. package/src/ngtsc/util/src/typescript.d.ts +0 -5
  110. package/bundles/chunk-26T3CJIJ.js.map +0 -6
  111. package/bundles/chunk-3MNDX4LL.js.map +0 -6
  112. package/bundles/chunk-5RC6M6GX.js.map +0 -6
  113. package/bundles/chunk-646P2DOR.js.map +0 -6
  114. package/bundles/chunk-AR265E4B.js.map +0 -6
  115. package/bundles/chunk-FXU7FMZC.js.map +0 -6
  116. package/bundles/chunk-GLCRIILX.js.map +0 -6
  117. package/bundles/chunk-K2Z44JHH.js.map +0 -6
  118. package/bundles/chunk-KMCI52ED.js.map +0 -6
  119. package/bundles/chunk-MXJN5K6C.js.map +0 -6
  120. package/bundles/chunk-NM2N677S.js.map +0 -6
  121. package/bundles/chunk-OOJDZK5W.js.map +0 -6
  122. package/bundles/chunk-QDWL7SZJ.js.map +0 -6
  123. package/bundles/chunk-U5ES6WUL.js.map +0 -6
  124. package/bundles/chunk-VGNMN2NK.js.map +0 -6
  125. package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
@@ -13,7 +13,7 @@ import {
13
13
  reflectObjectLiteral,
14
14
  reflectTypeEntityToDeclaration,
15
15
  typeNodeToValueExpr
16
- } from "./chunk-AR265E4B.js";
16
+ } from "./chunk-2IMT6JFI.js";
17
17
  import {
18
18
  ErrorCode,
19
19
  FatalDiagnosticError,
@@ -22,34 +22,31 @@ import {
22
22
  Reference,
23
23
  assertSuccessfulReferenceEmit,
24
24
  attachDefaultImportDeclaration,
25
- createExportSpecifier,
26
25
  getDefaultImportDeclaration,
27
26
  getSourceFile,
28
27
  identifierOfNode,
29
28
  isDeclaration,
30
- isDtsPath,
31
- isNonDeclarationTsPath,
32
29
  makeDiagnostic,
33
30
  makeRelatedInformation,
34
31
  nodeDebugInfo,
32
+ nodeNameForError,
35
33
  translateExpression,
36
34
  translateStatement,
37
35
  translateType
38
- } from "./chunk-5RC6M6GX.js";
36
+ } from "./chunk-JDKMNZ6O.js";
39
37
  import {
40
38
  absoluteFrom,
41
39
  absoluteFromSourceFile,
42
- basename,
43
40
  relative
44
- } from "./chunk-FXU7FMZC.js";
41
+ } from "./chunk-T7MYRXIE.js";
45
42
  import {
46
43
  PerfEvent,
47
44
  PerfPhase
48
- } from "./chunk-GLCRIILX.js";
45
+ } from "./chunk-R4NY3TJC.js";
49
46
  import {
50
47
  __spreadProps,
51
48
  __spreadValues
52
- } from "./chunk-WQ3TNYTD.js";
49
+ } from "./chunk-GMSUYBZP.js";
53
50
 
54
51
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
55
52
  import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
@@ -144,21 +141,26 @@ function tryUnwrapForwardRef(node, reflector) {
144
141
  }
145
142
  return expr;
146
143
  }
147
- function forwardRefResolver(ref, args) {
148
- if (!isAngularCoreReference(ref, "forwardRef") || args.length !== 1) {
149
- return null;
144
+ var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
145
+ if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
146
+ return unresolvable;
150
147
  }
151
- return expandForwardRef(args[0]);
152
- }
148
+ const expanded = expandForwardRef(callExpr.arguments[0]);
149
+ if (expanded !== null) {
150
+ return resolve(expanded);
151
+ } else {
152
+ return unresolvable;
153
+ }
154
+ };
153
155
  function combineResolvers(resolvers) {
154
- return (ref, args) => {
156
+ return (fn, callExpr, resolve, unresolvable) => {
155
157
  for (const resolver of resolvers) {
156
- const resolved = resolver(ref, args);
157
- if (resolved !== null) {
158
+ const resolved = resolver(fn, callExpr, resolve, unresolvable);
159
+ if (resolved !== unresolvable) {
158
160
  return resolved;
159
161
  }
160
162
  }
161
- return null;
163
+ return unresolvable;
162
164
  };
163
165
  }
164
166
  function isExpressionForwardReference(expr, context, contextSource) {
@@ -304,8 +306,11 @@ var DynamicValue = class {
304
306
  static fromDynamicType(node) {
305
307
  return new DynamicValue(node, void 0, 7);
306
308
  }
309
+ static fromSyntheticInput(node, value) {
310
+ return new DynamicValue(node, value, 8);
311
+ }
307
312
  static fromUnknown(node) {
308
- return new DynamicValue(node, void 0, 8);
313
+ return new DynamicValue(node, void 0, 9);
309
314
  }
310
315
  isFromDynamicInput() {
311
316
  return this.code === 0;
@@ -332,7 +337,7 @@ var DynamicValue = class {
332
337
  return this.code === 7;
333
338
  }
334
339
  isFromUnknown() {
335
- return this.code === 8;
340
+ return this.code === 9;
336
341
  }
337
342
  accept(visitor) {
338
343
  switch (this.code) {
@@ -353,6 +358,8 @@ var DynamicValue = class {
353
358
  case 7:
354
359
  return visitor.visitDynamicType(this);
355
360
  case 8:
361
+ return visitor.visitSyntheticInput(this);
362
+ case 9:
356
363
  return visitor.visitUnknown(this);
357
364
  }
358
365
  }
@@ -539,6 +546,13 @@ function resolveKnownDeclaration(decl) {
539
546
  }
540
547
  }
541
548
 
549
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/synthetic.mjs
550
+ var SyntheticValue = class {
551
+ constructor(value) {
552
+ this.value = value;
553
+ }
554
+ };
555
+
542
556
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
543
557
  function literalBinaryOp(op) {
544
558
  return { op, literal: true };
@@ -854,6 +868,8 @@ var StaticInterpreter = class {
854
868
  }
855
869
  } else if (lhs instanceof DynamicValue) {
856
870
  return DynamicValue.fromDynamicInput(node, lhs);
871
+ } else if (lhs instanceof SyntheticValue) {
872
+ return DynamicValue.fromSyntheticInput(node, lhs);
857
873
  }
858
874
  return DynamicValue.fromUnknown(node);
859
875
  }
@@ -875,31 +891,24 @@ var StaticInterpreter = class {
875
891
  if (!isFunctionOrMethodReference(lhs)) {
876
892
  return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
877
893
  }
878
- if (fn.body === null) {
879
- let expr = null;
880
- if (context.foreignFunctionResolver) {
881
- expr = context.foreignFunctionResolver(lhs, node.arguments);
882
- }
883
- if (expr === null) {
884
- return DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
885
- }
886
- if (expr.getSourceFile() !== node.expression.getSourceFile() && lhs.bestGuessOwningModule !== null) {
887
- context = __spreadProps(__spreadValues({}, context), {
894
+ const resolveFfrExpr = (expr) => {
895
+ let contextExtension = {};
896
+ if (fn.body === null && expr.getSourceFile() !== node.expression.getSourceFile() && lhs.bestGuessOwningModule !== null) {
897
+ contextExtension = {
888
898
  absoluteModuleName: lhs.bestGuessOwningModule.specifier,
889
899
  resolutionContext: lhs.bestGuessOwningModule.resolutionContext
890
- });
900
+ };
891
901
  }
892
- return this.visitFfrExpression(expr, context);
902
+ return this.visitFfrExpression(expr, __spreadValues(__spreadValues({}, context), contextExtension));
903
+ };
904
+ if (fn.body === null && context.foreignFunctionResolver !== void 0) {
905
+ const unresolvable = DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
906
+ return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
893
907
  }
894
- let res = this.visitFunctionBody(node, fn, context);
908
+ const res = this.visitFunctionBody(node, fn, context);
895
909
  if (res instanceof DynamicValue && context.foreignFunctionResolver !== void 0) {
896
- const ffrExpr = context.foreignFunctionResolver(lhs, node.arguments);
897
- if (ffrExpr !== null) {
898
- const ffrRes = this.visitFfrExpression(ffrExpr, context);
899
- if (!(ffrRes instanceof DynamicValue)) {
900
- res = ffrRes;
901
- }
902
- }
910
+ const unresolvable = DynamicValue.fromComplexFunctionCall(node, fn);
911
+ return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
903
912
  }
904
913
  return res;
905
914
  }
@@ -1206,6 +1215,9 @@ var TraceDynamicValueVisitor = class {
1206
1215
  }
1207
1216
  return trace;
1208
1217
  }
1218
+ visitSyntheticInput(value) {
1219
+ return [makeRelatedInformation(value.node, "Unable to evaluate this expression further.")];
1220
+ }
1209
1221
  visitDynamicString(value) {
1210
1222
  return [makeRelatedInformation(value.node, "A string value could not be determined statically.")];
1211
1223
  }
@@ -1663,9 +1675,39 @@ var NoopReferencesRegistry = class {
1663
1675
  }
1664
1676
  };
1665
1677
 
1678
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/schema.mjs
1679
+ import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from "@angular/compiler";
1680
+ function extractSchemas(rawExpr, evaluator, context) {
1681
+ const schemas = [];
1682
+ const result = evaluator.evaluate(rawExpr);
1683
+ if (!Array.isArray(result)) {
1684
+ throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array`);
1685
+ }
1686
+ for (const schemaRef of result) {
1687
+ if (!(schemaRef instanceof Reference)) {
1688
+ throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
1689
+ }
1690
+ const id = schemaRef.getIdentityIn(schemaRef.node.getSourceFile());
1691
+ if (id === null || schemaRef.ownedByModuleGuess !== "@angular/core") {
1692
+ throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
1693
+ }
1694
+ switch (id.text) {
1695
+ case "CUSTOM_ELEMENTS_SCHEMA":
1696
+ schemas.push(CUSTOM_ELEMENTS_SCHEMA);
1697
+ break;
1698
+ case "NO_ERRORS_SCHEMA":
1699
+ schemas.push(NO_ERRORS_SCHEMA);
1700
+ break;
1701
+ default:
1702
+ throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid ${context} schema`);
1703
+ }
1704
+ }
1705
+ return schemas;
1706
+ }
1707
+
1666
1708
  // 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 ts25 from "typescript";
1709
+ import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
1710
+ import ts23 from "typescript";
1669
1711
 
1670
1712
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
1671
1713
  import ts8 from "typescript";
@@ -1900,11 +1942,12 @@ function isTypeParameterEqual(a, b) {
1900
1942
  }
1901
1943
 
1902
1944
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
1903
- var MetaType;
1904
- (function(MetaType2) {
1905
- MetaType2[MetaType2["Pipe"] = 0] = "Pipe";
1906
- MetaType2[MetaType2["Directive"] = 1] = "Directive";
1907
- })(MetaType || (MetaType = {}));
1945
+ var MetaKind;
1946
+ (function(MetaKind2) {
1947
+ MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
1948
+ MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
1949
+ MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
1950
+ })(MetaKind || (MetaKind = {}));
1908
1951
 
1909
1952
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
1910
1953
  import ts11 from "typescript";
@@ -2007,6 +2050,19 @@ function extractReferencesFromType(checker, def, bestGuessOwningModule) {
2007
2050
  }
2008
2051
  });
2009
2052
  }
2053
+ function readBooleanType(type) {
2054
+ if (!ts10.isLiteralTypeNode(type)) {
2055
+ return null;
2056
+ }
2057
+ switch (type.literal.kind) {
2058
+ case ts10.SyntaxKind.TrueKeyword:
2059
+ return true;
2060
+ case ts10.SyntaxKind.FalseKeyword:
2061
+ return false;
2062
+ default:
2063
+ return null;
2064
+ }
2065
+ }
2010
2066
  function readStringType(type) {
2011
2067
  if (!ts10.isLiteralTypeNode(type) || !ts10.isStringLiteral(type.literal)) {
2012
2068
  return null;
@@ -2145,7 +2201,7 @@ function afterUnderscore(str) {
2145
2201
  if (pos === -1) {
2146
2202
  throw new Error(`Expected '${str}' to contain '_'`);
2147
2203
  }
2148
- return str.substr(pos + 1);
2204
+ return str.slice(pos + 1);
2149
2205
  }
2150
2206
  function hasInjectableFields(clazz, host) {
2151
2207
  const members = host.getMembersOfClass(clazz);
@@ -2168,15 +2224,19 @@ var DtsMetadataReader = class {
2168
2224
  }
2169
2225
  const [_, declarationMetadata, importMetadata, exportMetadata] = ngModuleDef.type.typeArguments;
2170
2226
  return {
2227
+ kind: MetaKind.NgModule,
2171
2228
  ref,
2172
2229
  declarations: extractReferencesFromType(this.checker, declarationMetadata, ref.bestGuessOwningModule),
2173
2230
  exports: extractReferencesFromType(this.checker, exportMetadata, ref.bestGuessOwningModule),
2174
2231
  imports: extractReferencesFromType(this.checker, importMetadata, ref.bestGuessOwningModule),
2175
2232
  schemas: [],
2176
- rawDeclarations: null
2233
+ rawDeclarations: null,
2234
+ rawImports: null,
2235
+ rawExports: null
2177
2236
  };
2178
2237
  }
2179
2238
  getDirectiveMetadata(ref) {
2239
+ var _a;
2180
2240
  const clazz = ref.node;
2181
2241
  const def = this.reflector.getMembersOfClass(clazz).find((field) => field.isStatic && (field.name === "\u0275cmp" || field.name === "\u0275dir"));
2182
2242
  if (def === void 0) {
@@ -2189,10 +2249,11 @@ var DtsMetadataReader = class {
2189
2249
  const isStructural = !isComponent && ctorParams !== null && ctorParams.some((param) => {
2190
2250
  return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
2191
2251
  });
2252
+ const isStandalone = def.type.typeArguments.length > 7 && ((_a = readBooleanType(def.type.typeArguments[7])) != null ? _a : false);
2192
2253
  const inputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[3]));
2193
2254
  const outputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[4]));
2194
2255
  return __spreadProps(__spreadValues({
2195
- type: MetaType.Directive,
2256
+ kind: MetaKind.Directive,
2196
2257
  ref,
2197
2258
  name: clazz.name.text,
2198
2259
  isComponent,
@@ -2206,10 +2267,13 @@ var DtsMetadataReader = class {
2206
2267
  isPoisoned: false,
2207
2268
  isStructural,
2208
2269
  animationTriggerNames: null,
2209
- isStandalone: false
2270
+ isStandalone,
2271
+ imports: null,
2272
+ schemas: null
2210
2273
  });
2211
2274
  }
2212
2275
  getPipeMetadata(ref) {
2276
+ var _a;
2213
2277
  const def = this.reflector.getMembersOfClass(ref.node).find((field) => field.isStatic && field.name === "\u0275pipe");
2214
2278
  if (def === void 0) {
2215
2279
  return null;
@@ -2221,12 +2285,13 @@ var DtsMetadataReader = class {
2221
2285
  return null;
2222
2286
  }
2223
2287
  const name = type.literal.text;
2288
+ const isStandalone = def.type.typeArguments.length > 2 && ((_a = readBooleanType(def.type.typeArguments[2])) != null ? _a : false);
2224
2289
  return {
2225
- type: MetaType.Pipe,
2290
+ kind: MetaKind.Pipe,
2226
2291
  ref,
2227
2292
  name,
2228
2293
  nameExpr: null,
2229
- isStandalone: false
2294
+ isStandalone
2230
2295
  };
2231
2296
  }
2232
2297
  };
@@ -2436,443 +2501,583 @@ var ResourceRegistry = class {
2436
2501
  }
2437
2502
  };
2438
2503
 
2439
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/api.mjs
2440
- var CompilationMode;
2441
- (function(CompilationMode2) {
2442
- CompilationMode2[CompilationMode2["FULL"] = 0] = "FULL";
2443
- CompilationMode2[CompilationMode2["PARTIAL"] = 1] = "PARTIAL";
2444
- })(CompilationMode || (CompilationMode = {}));
2445
- var HandlerPrecedence;
2446
- (function(HandlerPrecedence2) {
2447
- HandlerPrecedence2[HandlerPrecedence2["PRIMARY"] = 0] = "PRIMARY";
2448
- HandlerPrecedence2[HandlerPrecedence2["SHARED"] = 1] = "SHARED";
2449
- HandlerPrecedence2[HandlerPrecedence2["WEAK"] = 2] = "WEAK";
2450
- })(HandlerPrecedence || (HandlerPrecedence = {}));
2451
- var HandlerFlags;
2452
- (function(HandlerFlags2) {
2453
- HandlerFlags2[HandlerFlags2["NONE"] = 0] = "NONE";
2454
- HandlerFlags2[HandlerFlags2["FULL_INHERITANCE"] = 1] = "FULL_INHERITANCE";
2455
- })(HandlerFlags || (HandlerFlags = {}));
2504
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/api.mjs
2505
+ var ComponentScopeKind;
2506
+ (function(ComponentScopeKind2) {
2507
+ ComponentScopeKind2[ComponentScopeKind2["NgModule"] = 0] = "NgModule";
2508
+ ComponentScopeKind2[ComponentScopeKind2["Standalone"] = 1] = "Standalone";
2509
+ })(ComponentScopeKind || (ComponentScopeKind = {}));
2456
2510
 
2457
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
2458
- import ts12 from "typescript";
2459
- function aliasTransformFactory(exportStatements) {
2460
- return (context) => {
2461
- return (file) => {
2462
- if (ts12.isBundle(file) || !exportStatements.has(file.fileName)) {
2463
- return file;
2464
- }
2465
- const statements = [...file.statements];
2466
- exportStatements.get(file.fileName).forEach(([moduleName, symbolName], aliasName) => {
2467
- const stmt = ts12.factory.createExportDeclaration(void 0, void 0, false, ts12.createNamedExports([createExportSpecifier(symbolName, aliasName)]), ts12.factory.createStringLiteral(moduleName));
2468
- statements.push(stmt);
2469
- });
2470
- return ts12.factory.updateSourceFile(file, statements);
2471
- };
2472
- };
2473
- }
2474
-
2475
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
2476
- import ts16 from "typescript";
2477
-
2478
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
2479
- import ts13 from "typescript";
2480
-
2481
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
2482
- var NgExtension = Symbol("NgExtension");
2483
- function isExtended(sf) {
2484
- return sf[NgExtension] !== void 0;
2485
- }
2486
- function sfExtensionData(sf) {
2487
- const extSf = sf;
2488
- if (extSf[NgExtension] !== void 0) {
2489
- return extSf[NgExtension];
2490
- }
2491
- const extension = {
2492
- isTopLevelShim: false,
2493
- fileShim: null,
2494
- originalReferencedFiles: null,
2495
- taggedReferenceFiles: null
2496
- };
2497
- extSf[NgExtension] = extension;
2498
- return extension;
2499
- }
2500
- function isFileShimSourceFile(sf) {
2501
- return isExtended(sf) && sf[NgExtension].fileShim !== null;
2502
- }
2503
- function isShim(sf) {
2504
- return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
2505
- }
2506
- function copyFileShimData(from, to) {
2507
- if (!isFileShimSourceFile(from)) {
2508
- return;
2509
- }
2510
- sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
2511
- }
2512
- function untagAllTsFiles(program) {
2513
- for (const sf of program.getSourceFiles()) {
2514
- untagTsFile(sf);
2515
- }
2516
- }
2517
- function retagAllTsFiles(program) {
2518
- for (const sf of program.getSourceFiles()) {
2519
- retagTsFile(sf);
2520
- }
2521
- }
2522
- function untagTsFile(sf) {
2523
- if (sf.isDeclarationFile || !isExtended(sf)) {
2524
- return;
2525
- }
2526
- const ext = sfExtensionData(sf);
2527
- if (ext.originalReferencedFiles !== null) {
2528
- sf.referencedFiles = ext.originalReferencedFiles;
2529
- }
2530
- }
2531
- function retagTsFile(sf) {
2532
- if (sf.isDeclarationFile || !isExtended(sf)) {
2533
- return;
2534
- }
2535
- const ext = sfExtensionData(sf);
2536
- if (ext.taggedReferenceFiles !== null) {
2537
- sf.referencedFiles = ext.taggedReferenceFiles;
2538
- }
2539
- }
2540
-
2541
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
2542
- var TS_EXTENSIONS = /\.tsx?$/i;
2543
- function makeShimFileName(fileName, suffix) {
2544
- return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
2545
- }
2546
- function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
2547
- let moduleName;
2548
- if (originalFileName.endsWith("/index.ts")) {
2549
- moduleName = originalModuleName + "/index" + genSuffix;
2550
- } else {
2551
- moduleName = originalModuleName + genSuffix;
2511
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/component_scope.mjs
2512
+ var CompoundComponentScopeReader = class {
2513
+ constructor(readers) {
2514
+ this.readers = readers;
2552
2515
  }
2553
- return moduleName;
2554
- }
2555
-
2556
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
2557
- var ShimAdapter = class {
2558
- constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
2559
- this.delegate = delegate;
2560
- this.shims = /* @__PURE__ */ new Map();
2561
- this.priorShims = /* @__PURE__ */ new Map();
2562
- this.notShims = /* @__PURE__ */ new Set();
2563
- this.generators = [];
2564
- this.ignoreForEmit = /* @__PURE__ */ new Set();
2565
- this.extensionPrefixes = [];
2566
- for (const gen of perFileGenerators) {
2567
- const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
2568
- const regexp = new RegExp(pattern, "i");
2569
- this.generators.push({
2570
- generator: gen,
2571
- test: regexp,
2572
- suffix: `.${gen.extensionPrefix}.ts`
2573
- });
2574
- this.extensionPrefixes.push(gen.extensionPrefix);
2575
- }
2576
- const extraInputFiles = [];
2577
- for (const gen of topLevelGenerators) {
2578
- const sf = gen.makeTopLevelShim();
2579
- sfExtensionData(sf).isTopLevelShim = true;
2580
- if (!gen.shouldEmit) {
2581
- this.ignoreForEmit.add(sf);
2582
- }
2583
- const fileName = absoluteFromSourceFile(sf);
2584
- this.shims.set(fileName, sf);
2585
- extraInputFiles.push(fileName);
2586
- }
2587
- for (const rootFile of tsRootFiles) {
2588
- for (const gen of this.generators) {
2589
- extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
2516
+ getScopeForComponent(clazz) {
2517
+ for (const reader of this.readers) {
2518
+ const meta = reader.getScopeForComponent(clazz);
2519
+ if (meta !== null) {
2520
+ return meta;
2590
2521
  }
2591
2522
  }
2592
- this.extraInputFiles = extraInputFiles;
2593
- if (oldProgram !== null) {
2594
- for (const oldSf of oldProgram.getSourceFiles()) {
2595
- if (oldSf.isDeclarationFile || !isFileShimSourceFile(oldSf)) {
2596
- continue;
2597
- }
2598
- this.priorShims.set(absoluteFromSourceFile(oldSf), oldSf);
2523
+ return null;
2524
+ }
2525
+ getRemoteScope(clazz) {
2526
+ for (const reader of this.readers) {
2527
+ const remoteScope = reader.getRemoteScope(clazz);
2528
+ if (remoteScope !== null) {
2529
+ return remoteScope;
2599
2530
  }
2600
2531
  }
2532
+ return null;
2601
2533
  }
2602
- maybeGenerate(fileName) {
2603
- if (this.notShims.has(fileName)) {
2604
- return null;
2605
- } else if (this.shims.has(fileName)) {
2606
- return this.shims.get(fileName);
2534
+ };
2535
+
2536
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/dependency.mjs
2537
+ var MetadataDtsModuleScopeResolver = class {
2538
+ constructor(dtsMetaReader, aliasingHost) {
2539
+ this.dtsMetaReader = dtsMetaReader;
2540
+ this.aliasingHost = aliasingHost;
2541
+ this.cache = /* @__PURE__ */ new Map();
2542
+ }
2543
+ resolve(ref) {
2544
+ const clazz = ref.node;
2545
+ const sourceFile = clazz.getSourceFile();
2546
+ if (!sourceFile.isDeclarationFile) {
2547
+ throw new Error(`Debug error: DtsModuleScopeResolver.read(${ref.debugName} from ${sourceFile.fileName}), but not a .d.ts file`);
2607
2548
  }
2608
- if (isDtsPath(fileName)) {
2609
- this.notShims.add(fileName);
2549
+ if (this.cache.has(clazz)) {
2550
+ return this.cache.get(clazz);
2551
+ }
2552
+ const dependencies = [];
2553
+ const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
2554
+ if (meta === null) {
2555
+ this.cache.set(clazz, null);
2610
2556
  return null;
2611
2557
  }
2612
- for (const record of this.generators) {
2613
- const match = record.test.exec(fileName);
2614
- if (match === null) {
2558
+ const declarations = /* @__PURE__ */ new Set();
2559
+ for (const declRef of meta.declarations) {
2560
+ declarations.add(declRef.node);
2561
+ }
2562
+ for (const exportRef of meta.exports) {
2563
+ const directive = this.dtsMetaReader.getDirectiveMetadata(exportRef);
2564
+ if (directive !== null) {
2565
+ const isReExport = !declarations.has(exportRef.node);
2566
+ dependencies.push(this.maybeAlias(directive, sourceFile, isReExport));
2615
2567
  continue;
2616
2568
  }
2617
- const prefix = match[1];
2618
- let baseFileName = absoluteFrom(prefix + ".ts");
2619
- if (!this.delegate.fileExists(baseFileName)) {
2620
- baseFileName = absoluteFrom(prefix + ".tsx");
2621
- if (!this.delegate.fileExists(baseFileName)) {
2622
- return void 0;
2623
- }
2569
+ const pipe = this.dtsMetaReader.getPipeMetadata(exportRef);
2570
+ if (pipe !== null) {
2571
+ const isReExport = !declarations.has(exportRef.node);
2572
+ dependencies.push(this.maybeAlias(pipe, sourceFile, isReExport));
2573
+ continue;
2624
2574
  }
2625
- const inputFile = this.delegate.getSourceFile(baseFileName, ts13.ScriptTarget.Latest);
2626
- if (inputFile === void 0 || isShim(inputFile)) {
2627
- return void 0;
2575
+ const exportScope2 = this.resolve(exportRef);
2576
+ if (exportScope2 !== null) {
2577
+ if (this.aliasingHost === null) {
2578
+ dependencies.push(...exportScope2.exported.dependencies);
2579
+ } else {
2580
+ for (const dep of exportScope2.exported.dependencies) {
2581
+ dependencies.push(this.maybeAlias(dep, sourceFile, true));
2582
+ }
2583
+ }
2628
2584
  }
2629
- return this.generateSpecific(fileName, record.generator, inputFile);
2585
+ continue;
2630
2586
  }
2631
- this.notShims.add(fileName);
2632
- return null;
2587
+ const exportScope = {
2588
+ exported: {
2589
+ dependencies,
2590
+ isPoisoned: false
2591
+ }
2592
+ };
2593
+ this.cache.set(clazz, exportScope);
2594
+ return exportScope;
2633
2595
  }
2634
- generateSpecific(fileName, generator, inputFile) {
2635
- let priorShimSf = null;
2636
- if (this.priorShims.has(fileName)) {
2637
- priorShimSf = this.priorShims.get(fileName);
2638
- this.priorShims.delete(fileName);
2596
+ maybeAlias(dirOrPipe, maybeAliasFrom, isReExport) {
2597
+ const ref = dirOrPipe.ref;
2598
+ if (this.aliasingHost === null || ref.node.getSourceFile() === maybeAliasFrom) {
2599
+ return dirOrPipe;
2639
2600
  }
2640
- const shimSf = generator.generateShimForFile(inputFile, fileName, priorShimSf);
2641
- sfExtensionData(shimSf).fileShim = {
2642
- extension: generator.extensionPrefix,
2643
- generatedFrom: absoluteFromSourceFile(inputFile)
2644
- };
2645
- if (!generator.shouldEmit) {
2646
- this.ignoreForEmit.add(shimSf);
2601
+ const alias = this.aliasingHost.getAliasIn(ref.node, maybeAliasFrom, isReExport);
2602
+ if (alias === null) {
2603
+ return dirOrPipe;
2647
2604
  }
2648
- this.shims.set(fileName, shimSf);
2649
- return shimSf;
2605
+ return __spreadProps(__spreadValues({}, dirOrPipe), {
2606
+ ref: ref.cloneWithAlias(alias)
2607
+ });
2650
2608
  }
2651
2609
  };
2652
2610
 
2653
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
2654
- import ts14 from "typescript";
2655
- var TS_DTS_SUFFIX = /(\.d)?\.ts$/;
2656
- var STRIP_NG_FACTORY = /(.*)NgFactory$/;
2657
- var FactoryGenerator = class {
2658
- constructor() {
2659
- this.sourceInfo = /* @__PURE__ */ new Map();
2660
- this.sourceToFactorySymbols = /* @__PURE__ */ new Map();
2661
- this.shouldEmit = true;
2662
- this.extensionPrefix = "ngfactory";
2663
- }
2664
- generateShimForFile(sf, genFilePath) {
2665
- const absoluteSfPath = absoluteFromSourceFile(sf);
2666
- const relativePathToSource = "./" + basename(sf.fileName).replace(TS_DTS_SUFFIX, "");
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);
2668
- let sourceText = "";
2669
- const leadingComment = getFileoverviewComment(sf);
2670
- if (leadingComment !== null) {
2671
- sourceText = leadingComment + "\n\n";
2672
- }
2673
- if (symbolNames.length > 0) {
2674
- const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
2675
- sourceText += [
2676
- `import * as i0 from '@angular/core';`,
2677
- `import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
2678
- ...varLines
2679
- ].join("\n");
2680
- }
2681
- sourceText += "\nexport const \u0275NonEmptyModule = true;";
2682
- const genFile = ts14.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts14.ScriptKind.TS);
2683
- if (sf.moduleName !== void 0) {
2684
- genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
2685
- }
2686
- const moduleSymbols = /* @__PURE__ */ new Map();
2687
- this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
2688
- this.sourceInfo.set(genFilePath, {
2689
- sourceFilePath: absoluteSfPath,
2690
- moduleSymbols
2691
- });
2692
- return genFile;
2693
- }
2694
- track(sf, moduleInfo) {
2695
- if (this.sourceToFactorySymbols.has(sf.fileName)) {
2696
- this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
2611
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
2612
+ import { ExternalExpr as ExternalExpr3 } from "@angular/compiler";
2613
+ import ts12 from "typescript";
2614
+
2615
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/util.mjs
2616
+ function getDiagnosticNode(ref, rawExpr) {
2617
+ return rawExpr !== null ? ref.getOriginForDiagnostics(rawExpr) : ref.node.name;
2618
+ }
2619
+ function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
2620
+ const scope = scopeReader.getScopeForComponent(ref.node);
2621
+ let message = `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly.`;
2622
+ let relatedInformation = void 0;
2623
+ if (scope !== null && scope.kind === ComponentScopeKind.NgModule) {
2624
+ const isExported = scope.exported.dependencies.some((dep) => dep.ref.node === ref.node);
2625
+ if (isExported) {
2626
+ relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It can be imported using its NgModule '${scope.ngModule.name.text}' instead.`)];
2627
+ } else {
2628
+ relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It's declared in the NgModule '${scope.ngModule.name.text}', but is not exported. Consider exporting it.`)];
2697
2629
  }
2630
+ } else {
2698
2631
  }
2699
- };
2700
- function isExported(decl) {
2701
- return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts14.SyntaxKind.ExportKeyword);
2632
+ if (relatedInformation === void 0) {
2633
+ message += " It must be imported via an NgModule.";
2634
+ }
2635
+ return makeDiagnostic(ErrorCode.COMPONENT_IMPORT_NOT_STANDALONE, getDiagnosticNode(ref, rawExpr), message, relatedInformation);
2702
2636
  }
2703
- function generatedFactoryTransform(factoryMap, importRewriter) {
2704
- return (context) => {
2705
- return (file) => {
2706
- return transformFactorySourceFile(factoryMap, context, importRewriter, file);
2707
- };
2708
- };
2637
+ function makeUnknownComponentImportDiagnostic(ref, rawExpr) {
2638
+ return makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, getDiagnosticNode(ref, rawExpr), `Component imports must be standalone components, directives, pipes, or must be NgModules.`);
2709
2639
  }
2710
- function transformFactorySourceFile(factoryMap, context, importRewriter, file) {
2711
- if (!factoryMap.has(file.fileName)) {
2712
- return file;
2713
- }
2714
- const { moduleSymbols, sourceFilePath } = factoryMap.get(file.fileName);
2715
- const transformedStatements = [];
2716
- let nonEmptyExport = null;
2717
- const coreImportIdentifiers = /* @__PURE__ */ new Set();
2718
- for (const stmt of file.statements) {
2719
- if (ts14.isImportDeclaration(stmt) && ts14.isStringLiteral(stmt.moduleSpecifier) && stmt.moduleSpecifier.text === "@angular/core") {
2720
- const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier("@angular/core", sourceFilePath);
2721
- if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
2722
- transformedStatements.push(ts14.factory.updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts14.factory.createStringLiteral(rewrittenModuleSpecifier), void 0));
2723
- if (stmt.importClause !== void 0 && stmt.importClause.namedBindings !== void 0 && ts14.isNamespaceImport(stmt.importClause.namedBindings)) {
2724
- coreImportIdentifiers.add(stmt.importClause.namedBindings.name.text);
2640
+
2641
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
2642
+ var LocalModuleScopeRegistry = class {
2643
+ constructor(localReader, fullReader, dependencyScopeReader, refEmitter, aliasingHost) {
2644
+ this.localReader = localReader;
2645
+ this.fullReader = fullReader;
2646
+ this.dependencyScopeReader = dependencyScopeReader;
2647
+ this.refEmitter = refEmitter;
2648
+ this.aliasingHost = aliasingHost;
2649
+ this.sealed = false;
2650
+ this.declarationToModule = /* @__PURE__ */ new Map();
2651
+ this.duplicateDeclarations = /* @__PURE__ */ new Map();
2652
+ this.moduleToRef = /* @__PURE__ */ new Map();
2653
+ this.cache = /* @__PURE__ */ new Map();
2654
+ this.remoteScoping = /* @__PURE__ */ new Map();
2655
+ this.scopeErrors = /* @__PURE__ */ new Map();
2656
+ this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
2657
+ }
2658
+ registerNgModuleMetadata(data) {
2659
+ this.assertCollecting();
2660
+ const ngModule = data.ref.node;
2661
+ this.moduleToRef.set(data.ref.node, data.ref);
2662
+ for (const decl of data.declarations) {
2663
+ this.registerDeclarationOfModule(ngModule, decl, data.rawDeclarations);
2664
+ }
2665
+ }
2666
+ registerDirectiveMetadata(directive) {
2667
+ }
2668
+ registerPipeMetadata(pipe) {
2669
+ }
2670
+ getScopeForComponent(clazz) {
2671
+ const scope = !this.declarationToModule.has(clazz) ? null : this.getScopeOfModule(this.declarationToModule.get(clazz).ngModule);
2672
+ return scope;
2673
+ }
2674
+ getDuplicateDeclarations(node) {
2675
+ if (!this.duplicateDeclarations.has(node)) {
2676
+ return null;
2677
+ }
2678
+ return Array.from(this.duplicateDeclarations.get(node).values());
2679
+ }
2680
+ getScopeOfModule(clazz) {
2681
+ return this.moduleToRef.has(clazz) ? this.getScopeOfModuleReference(this.moduleToRef.get(clazz)) : null;
2682
+ }
2683
+ getDiagnosticsOfModule(clazz) {
2684
+ this.getScopeOfModule(clazz);
2685
+ if (this.scopeErrors.has(clazz)) {
2686
+ return this.scopeErrors.get(clazz);
2687
+ } else {
2688
+ return null;
2689
+ }
2690
+ }
2691
+ registerDeclarationOfModule(ngModule, decl, rawDeclarations) {
2692
+ const declData = {
2693
+ ngModule,
2694
+ ref: decl,
2695
+ rawDeclarations
2696
+ };
2697
+ if (this.duplicateDeclarations.has(decl.node)) {
2698
+ this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
2699
+ } else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
2700
+ const duplicateDeclMap = /* @__PURE__ */ new Map();
2701
+ const firstDeclData = this.declarationToModule.get(decl.node);
2702
+ this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
2703
+ this.modulesWithStructuralErrors.add(ngModule);
2704
+ duplicateDeclMap.set(firstDeclData.ngModule, firstDeclData);
2705
+ duplicateDeclMap.set(ngModule, declData);
2706
+ this.duplicateDeclarations.set(decl.node, duplicateDeclMap);
2707
+ this.declarationToModule.delete(decl.node);
2708
+ } else {
2709
+ this.declarationToModule.set(decl.node, declData);
2710
+ }
2711
+ }
2712
+ getScopeOfModuleReference(ref) {
2713
+ if (this.cache.has(ref.node)) {
2714
+ return this.cache.get(ref.node);
2715
+ }
2716
+ this.sealed = true;
2717
+ const ngModule = this.localReader.getNgModuleMetadata(ref);
2718
+ if (ngModule === null) {
2719
+ this.cache.set(ref.node, null);
2720
+ return null;
2721
+ }
2722
+ const diagnostics = [];
2723
+ const compilationDirectives = /* @__PURE__ */ new Map();
2724
+ const compilationPipes = /* @__PURE__ */ new Map();
2725
+ const declared = /* @__PURE__ */ new Set();
2726
+ const exportDirectives = /* @__PURE__ */ new Map();
2727
+ const exportPipes = /* @__PURE__ */ new Map();
2728
+ let isPoisoned = false;
2729
+ if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
2730
+ isPoisoned = true;
2731
+ }
2732
+ for (const decl of ngModule.imports) {
2733
+ const importScope = this.getExportedScope(decl, diagnostics, ref.node, "import");
2734
+ if (importScope !== null) {
2735
+ if (importScope === "invalid" || importScope.exported.isPoisoned) {
2736
+ diagnostics.push(invalidTransitiveNgModuleRef(decl, ngModule.rawImports, "import"));
2737
+ isPoisoned = true;
2738
+ if (importScope === "invalid") {
2739
+ continue;
2740
+ }
2741
+ }
2742
+ for (const dep of importScope.exported.dependencies) {
2743
+ if (dep.kind === MetaKind.Directive) {
2744
+ compilationDirectives.set(dep.ref.node, dep);
2745
+ } else if (dep.kind === MetaKind.Pipe) {
2746
+ compilationPipes.set(dep.ref.node, dep);
2747
+ }
2725
2748
  }
2749
+ continue;
2750
+ }
2751
+ const directive = this.fullReader.getDirectiveMetadata(decl);
2752
+ if (directive !== null) {
2753
+ if (directive.isStandalone) {
2754
+ compilationDirectives.set(directive.ref.node, directive);
2755
+ } else {
2756
+ diagnostics.push(makeNotStandaloneDiagnostic(this, decl, ngModule.rawImports, directive.isComponent ? "component" : "directive"));
2757
+ isPoisoned = true;
2758
+ }
2759
+ continue;
2760
+ }
2761
+ const pipe = this.fullReader.getPipeMetadata(decl);
2762
+ if (pipe !== null) {
2763
+ if (pipe.isStandalone) {
2764
+ compilationPipes.set(pipe.ref.node, pipe);
2765
+ } else {
2766
+ diagnostics.push(makeNotStandaloneDiagnostic(this, decl, ngModule.rawImports, "pipe"));
2767
+ isPoisoned = true;
2768
+ }
2769
+ continue;
2770
+ }
2771
+ diagnostics.push(invalidRef(decl, ngModule.rawImports, "import"));
2772
+ isPoisoned = true;
2773
+ }
2774
+ for (const decl of ngModule.declarations) {
2775
+ const directive = this.localReader.getDirectiveMetadata(decl);
2776
+ const pipe = this.localReader.getPipeMetadata(decl);
2777
+ if (directive !== null) {
2778
+ if (directive.isStandalone) {
2779
+ const refType = directive.isComponent ? "Component" : "Directive";
2780
+ diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(ngModule.rawDeclarations), `${refType} ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
2781
+ isPoisoned = true;
2782
+ continue;
2783
+ }
2784
+ compilationDirectives.set(decl.node, __spreadProps(__spreadValues({}, directive), { ref: decl }));
2785
+ if (directive.isPoisoned) {
2786
+ isPoisoned = true;
2787
+ }
2788
+ } else if (pipe !== null) {
2789
+ if (pipe.isStandalone) {
2790
+ diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(ngModule.rawDeclarations), `Pipe ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
2791
+ isPoisoned = true;
2792
+ continue;
2793
+ }
2794
+ compilationPipes.set(decl.node, __spreadProps(__spreadValues({}, pipe), { ref: decl }));
2726
2795
  } else {
2727
- transformedStatements.push(stmt);
2796
+ const errorNode = decl.getOriginForDiagnostics(ngModule.rawDeclarations);
2797
+ diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_INVALID_DECLARATION, errorNode, `The class '${decl.node.name.text}' is listed in the declarations of the NgModule '${ngModule.ref.node.name.text}', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.`, [makeRelatedInformation(decl.node.name, `'${decl.node.name.text}' is declared here.`)]));
2798
+ isPoisoned = true;
2799
+ continue;
2728
2800
  }
2729
- } else if (ts14.isVariableStatement(stmt) && stmt.declarationList.declarations.length === 1) {
2730
- const decl = stmt.declarationList.declarations[0];
2731
- if (ts14.isIdentifier(decl.name)) {
2732
- if (decl.name.text === "\u0275NonEmptyModule") {
2733
- nonEmptyExport = stmt;
2801
+ declared.add(decl.node);
2802
+ }
2803
+ for (const decl of ngModule.exports) {
2804
+ const exportScope = this.getExportedScope(decl, diagnostics, ref.node, "export");
2805
+ if (exportScope === "invalid" || exportScope !== null && exportScope.exported.isPoisoned) {
2806
+ diagnostics.push(invalidTransitiveNgModuleRef(decl, ngModule.rawExports, "export"));
2807
+ isPoisoned = true;
2808
+ if (exportScope === "invalid") {
2734
2809
  continue;
2735
2810
  }
2736
- const match = STRIP_NG_FACTORY.exec(decl.name.text);
2737
- const module = match ? moduleSymbols.get(match[1]) : null;
2738
- if (module) {
2739
- const moduleIsTreeShakable = !module.hasId;
2740
- const newStmt = !moduleIsTreeShakable ? stmt : updateInitializers(stmt, (init) => init ? wrapInNoSideEffects(init) : void 0);
2741
- transformedStatements.push(newStmt);
2811
+ } else if (exportScope !== null) {
2812
+ for (const dep of exportScope.exported.dependencies) {
2813
+ if (dep.kind == MetaKind.Directive) {
2814
+ exportDirectives.set(dep.ref.node, dep);
2815
+ } else if (dep.kind === MetaKind.Pipe) {
2816
+ exportPipes.set(dep.ref.node, dep);
2817
+ }
2742
2818
  }
2819
+ } else if (compilationDirectives.has(decl.node)) {
2820
+ const directive = compilationDirectives.get(decl.node);
2821
+ exportDirectives.set(decl.node, directive);
2822
+ } else if (compilationPipes.has(decl.node)) {
2823
+ const pipe = compilationPipes.get(decl.node);
2824
+ exportPipes.set(decl.node, pipe);
2743
2825
  } else {
2744
- transformedStatements.push(stmt);
2826
+ const dirMeta = this.fullReader.getDirectiveMetadata(decl);
2827
+ const pipeMeta = this.fullReader.getPipeMetadata(decl);
2828
+ if (dirMeta !== null || pipeMeta !== null) {
2829
+ const isStandalone = dirMeta !== null ? dirMeta.isStandalone : pipeMeta.isStandalone;
2830
+ diagnostics.push(invalidReexport(decl, ngModule.rawExports, isStandalone));
2831
+ } else {
2832
+ diagnostics.push(invalidRef(decl, ngModule.rawExports, "export"));
2833
+ }
2834
+ isPoisoned = true;
2835
+ continue;
2745
2836
  }
2746
- } else {
2747
- transformedStatements.push(stmt);
2748
2837
  }
2838
+ const exported = {
2839
+ dependencies: [...exportDirectives.values(), ...exportPipes.values()],
2840
+ isPoisoned
2841
+ };
2842
+ const reexports = this.getReexports(ngModule, ref, declared, exported.dependencies, diagnostics);
2843
+ const scope = {
2844
+ kind: ComponentScopeKind.NgModule,
2845
+ ngModule: ngModule.ref.node,
2846
+ compilation: {
2847
+ dependencies: [...compilationDirectives.values(), ...compilationPipes.values()],
2848
+ isPoisoned
2849
+ },
2850
+ exported,
2851
+ reexports,
2852
+ schemas: ngModule.schemas
2853
+ };
2854
+ if (diagnostics.length > 0) {
2855
+ this.scopeErrors.set(ref.node, diagnostics);
2856
+ this.modulesWithStructuralErrors.add(ref.node);
2857
+ }
2858
+ this.cache.set(ref.node, scope);
2859
+ return scope;
2749
2860
  }
2750
- if (!transformedStatements.some(ts14.isVariableStatement) && nonEmptyExport !== null) {
2751
- transformedStatements.push(nonEmptyExport);
2861
+ getRemoteScope(node) {
2862
+ return this.remoteScoping.has(node) ? this.remoteScoping.get(node) : null;
2752
2863
  }
2753
- file = ts14.factory.updateSourceFile(file, transformedStatements);
2754
- if (coreImportIdentifiers.size > 0) {
2755
- const visit2 = (node) => {
2756
- node = ts14.visitEachChild(node, (child) => visit2(child), context);
2757
- if (ts14.isPropertyAccessExpression(node) && ts14.isIdentifier(node.expression) && coreImportIdentifiers.has(node.expression.text)) {
2758
- const rewrittenSymbol = importRewriter.rewriteSymbol(node.name.text, "@angular/core");
2759
- if (rewrittenSymbol !== node.name.text) {
2760
- const updated = ts14.factory.updatePropertyAccessExpression(node, node.expression, ts14.factory.createIdentifier(rewrittenSymbol));
2761
- node = updated;
2864
+ setComponentRemoteScope(node, directives, pipes) {
2865
+ this.remoteScoping.set(node, { directives, pipes });
2866
+ }
2867
+ getExportedScope(ref, diagnostics, ownerForErrors, type) {
2868
+ if (ref.node.getSourceFile().isDeclarationFile) {
2869
+ if (!ts12.isClassDeclaration(ref.node)) {
2870
+ const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
2871
+ diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
2872
+ return "invalid";
2873
+ }
2874
+ return this.dependencyScopeReader.resolve(ref);
2875
+ } else {
2876
+ return this.getScopeOfModuleReference(ref);
2877
+ }
2878
+ }
2879
+ getReexports(ngModule, ref, declared, exported, diagnostics) {
2880
+ let reexports = null;
2881
+ const sourceFile = ref.node.getSourceFile();
2882
+ if (this.aliasingHost === null) {
2883
+ return null;
2884
+ }
2885
+ reexports = [];
2886
+ const reexportMap = /* @__PURE__ */ new Map();
2887
+ const ngModuleRef = ref;
2888
+ const addReexport = (exportRef) => {
2889
+ if (exportRef.node.getSourceFile() === sourceFile) {
2890
+ return;
2891
+ }
2892
+ const isReExport = !declared.has(exportRef.node);
2893
+ const exportName = this.aliasingHost.maybeAliasSymbolAs(exportRef, sourceFile, ngModule.ref.node.name.text, isReExport);
2894
+ if (exportName === null) {
2895
+ return;
2896
+ }
2897
+ if (!reexportMap.has(exportName)) {
2898
+ if (exportRef.alias && exportRef.alias instanceof ExternalExpr3) {
2899
+ reexports.push({
2900
+ fromModule: exportRef.alias.value.moduleName,
2901
+ symbolName: exportRef.alias.value.name,
2902
+ asAlias: exportName
2903
+ });
2904
+ } else {
2905
+ const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
2906
+ assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
2907
+ const expr = emittedRef.expression;
2908
+ if (!(expr instanceof ExternalExpr3) || expr.value.moduleName === null || expr.value.name === null) {
2909
+ throw new Error("Expected ExternalExpr");
2910
+ }
2911
+ reexports.push({
2912
+ fromModule: expr.value.moduleName,
2913
+ symbolName: expr.value.name,
2914
+ asAlias: exportName
2915
+ });
2762
2916
  }
2917
+ reexportMap.set(exportName, exportRef);
2918
+ } else {
2919
+ const prevRef = reexportMap.get(exportName);
2920
+ diagnostics.push(reexportCollision(ngModuleRef.node, prevRef, exportRef));
2763
2921
  }
2764
- return node;
2765
2922
  };
2766
- file = visit2(file);
2767
- }
2768
- return file;
2769
- }
2770
- function getFileoverviewComment(sourceFile) {
2771
- const text = sourceFile.getFullText();
2772
- const trivia = text.substring(0, sourceFile.getStart());
2773
- const leadingComments = ts14.getLeadingCommentRanges(trivia, 0);
2774
- if (!leadingComments || leadingComments.length === 0) {
2775
- return null;
2923
+ for (const { ref: ref2 } of exported) {
2924
+ addReexport(ref2);
2925
+ }
2926
+ return reexports;
2776
2927
  }
2777
- const comment = leadingComments[0];
2778
- if (comment.kind !== ts14.SyntaxKind.MultiLineCommentTrivia) {
2779
- return null;
2928
+ assertCollecting() {
2929
+ if (this.sealed) {
2930
+ throw new Error(`Assertion: LocalModuleScopeRegistry is not COLLECTING`);
2931
+ }
2780
2932
  }
2781
- if (text.substring(comment.end, comment.end + 2) !== "\n\n") {
2782
- return null;
2933
+ };
2934
+ function invalidRef(decl, rawExpr, type) {
2935
+ const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
2936
+ const resolveTarget = type === "import" ? "NgModule" : "NgModule, Component, Directive, or Pipe";
2937
+ const message = `'${decl.node.name.text}' does not appear to be an ${resolveTarget} class.`;
2938
+ const library = decl.ownedByModuleGuess !== null ? ` (${decl.ownedByModuleGuess})` : "";
2939
+ const sf = decl.node.getSourceFile();
2940
+ let relatedMessage;
2941
+ if (!sf.isDeclarationFile) {
2942
+ const annotationType = type === "import" ? "@NgModule" : "Angular";
2943
+ relatedMessage = `Is it missing an ${annotationType} annotation?`;
2944
+ } else if (sf.fileName.indexOf("node_modules") !== -1) {
2945
+ relatedMessage = `This likely means that the library${library} which declares ${decl.debugName} has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.`;
2946
+ } else {
2947
+ relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName} has not been processed correctly by ngcc.`;
2783
2948
  }
2784
- const commentText = text.substring(comment.pos, comment.end);
2785
- if (commentText.indexOf("@license") !== -1) {
2786
- return null;
2949
+ return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), message, [makeRelatedInformation(decl.node.name, relatedMessage)]);
2950
+ }
2951
+ function invalidTransitiveNgModuleRef(decl, rawExpr, type) {
2952
+ const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
2953
+ return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), `This ${type} contains errors, which may affect components that depend on this NgModule.`);
2954
+ }
2955
+ function invalidReexport(decl, rawExpr, isStandalone) {
2956
+ let message = `Can't be exported from this NgModule, as `;
2957
+ if (isStandalone) {
2958
+ message += "it must be imported first";
2959
+ } else if (decl.node.getSourceFile().isDeclarationFile) {
2960
+ message += "it must be imported via its NgModule first";
2961
+ } else {
2962
+ message += "it must be either declared by this NgModule, or imported here via its NgModule first";
2787
2963
  }
2788
- return commentText;
2964
+ return makeDiagnostic(ErrorCode.NGMODULE_INVALID_REEXPORT, getDiagnosticNode(decl, rawExpr), message);
2789
2965
  }
2790
- function wrapInNoSideEffects(expr) {
2791
- const noSideEffects = ts14.factory.createPropertyAccessExpression(ts14.factory.createIdentifier("i0"), "\u0275noSideEffects");
2792
- return ts14.factory.createCallExpression(noSideEffects, [], [
2793
- ts14.factory.createFunctionExpression([], void 0, void 0, [], [], void 0, ts14.factory.createBlock([
2794
- ts14.factory.createReturnStatement(expr)
2795
- ]))
2966
+ function reexportCollision(module, refA, refB) {
2967
+ const childMessageText = `This directive/pipe is part of the exports of '${module.name.text}' and shares the same name as another exported directive/pipe.`;
2968
+ return makeDiagnostic(ErrorCode.NGMODULE_REEXPORT_NAME_COLLISION, module.name, `
2969
+ There was a name collision between two classes named '${refA.node.name.text}', which are both part of the exports of '${module.name.text}'.
2970
+
2971
+ Angular generates re-exports of an NgModule's exported directives/pipes from the module's source file in certain cases, using the declared name of the class. If two classes of the same name are exported, this automatic naming does not work.
2972
+
2973
+ To fix this problem please re-export one or both classes directly from this file.
2974
+ `.trim(), [
2975
+ makeRelatedInformation(refA.node.name, childMessageText),
2976
+ makeRelatedInformation(refB.node.name, childMessageText)
2796
2977
  ]);
2797
2978
  }
2798
- function updateInitializers(stmt, update) {
2799
- return ts14.factory.updateVariableStatement(stmt, stmt.modifiers, ts14.factory.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts14.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
2800
- }
2801
2979
 
2802
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
2803
- var ShimReferenceTagger = class {
2804
- constructor(shimExtensions) {
2805
- this.tagged = /* @__PURE__ */ new Set();
2806
- this.enabled = true;
2807
- this.suffixes = shimExtensions.map((extension) => `.${extension}.ts`);
2808
- }
2809
- tag(sf) {
2810
- if (!this.enabled || sf.isDeclarationFile || isShim(sf) || this.tagged.has(sf) || !isNonDeclarationTsPath(sf.fileName)) {
2811
- return;
2812
- }
2813
- const ext = sfExtensionData(sf);
2814
- if (ext.originalReferencedFiles === null) {
2815
- ext.originalReferencedFiles = sf.referencedFiles;
2816
- }
2817
- const referencedFiles = [...ext.originalReferencedFiles];
2818
- const sfPath = absoluteFromSourceFile(sf);
2819
- for (const suffix of this.suffixes) {
2820
- referencedFiles.push({
2821
- fileName: makeShimFileName(sfPath, suffix),
2822
- pos: 0,
2823
- end: 0
2824
- });
2825
- }
2826
- ext.taggedReferenceFiles = referencedFiles;
2827
- sf.referencedFiles = referencedFiles;
2828
- this.tagged.add(sf);
2829
- }
2830
- finalize() {
2831
- this.enabled = false;
2832
- this.tagged.clear();
2980
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
2981
+ import { CssSelector, SelectorMatcher } from "@angular/compiler";
2982
+ import ts13 from "typescript";
2983
+ var TypeCheckScopeRegistry = class {
2984
+ constructor(scopeReader, metaReader) {
2985
+ this.scopeReader = scopeReader;
2986
+ this.metaReader = metaReader;
2987
+ this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
2988
+ this.scopeCache = /* @__PURE__ */ new Map();
2833
2989
  }
2834
- };
2835
-
2836
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
2837
- import ts15 from "typescript";
2838
- var SummaryGenerator = class {
2839
- constructor() {
2840
- this.shouldEmit = true;
2841
- this.extensionPrefix = "ngsummary";
2842
- }
2843
- generateShimForFile(sf, genFilePath) {
2844
- const symbolNames = [];
2845
- for (const stmt of sf.statements) {
2846
- if (ts15.isClassDeclaration(stmt)) {
2847
- if (!isExported2(stmt) || stmt.decorators === void 0 || stmt.name === void 0) {
2848
- continue;
2849
- }
2850
- symbolNames.push(stmt.name.text);
2851
- } else if (ts15.isExportDeclaration(stmt)) {
2852
- if (stmt.exportClause === void 0 || stmt.moduleSpecifier !== void 0 || !ts15.isNamedExports(stmt.exportClause)) {
2853
- continue;
2854
- }
2855
- for (const specifier of stmt.exportClause.elements) {
2856
- symbolNames.push(specifier.name.text);
2990
+ getTypeCheckScope(node) {
2991
+ const matcher = new SelectorMatcher();
2992
+ const directives = [];
2993
+ const pipes = /* @__PURE__ */ new Map();
2994
+ const scope = this.scopeReader.getScopeForComponent(node);
2995
+ if (scope === null) {
2996
+ return {
2997
+ matcher,
2998
+ directives,
2999
+ pipes,
3000
+ schemas: [],
3001
+ isPoisoned: false
3002
+ };
3003
+ }
3004
+ const cacheKey = scope.kind === ComponentScopeKind.NgModule ? scope.ngModule : scope.component;
3005
+ const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
3006
+ if (this.scopeCache.has(cacheKey)) {
3007
+ return this.scopeCache.get(cacheKey);
3008
+ }
3009
+ for (const meta of dependencies) {
3010
+ if (meta.kind === MetaKind.Directive && meta.selector !== null) {
3011
+ const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
3012
+ matcher.addSelectables(CssSelector.parse(meta.selector), extMeta);
3013
+ directives.push(extMeta);
3014
+ } else if (meta.kind === MetaKind.Pipe) {
3015
+ if (!ts13.isClassDeclaration(meta.ref.node)) {
3016
+ throw new Error(`Unexpected non-class declaration ${ts13.SyntaxKind[meta.ref.node.kind]} for pipe ${meta.ref.debugName}`);
2857
3017
  }
3018
+ pipes.set(meta.name, meta.ref);
2858
3019
  }
2859
3020
  }
2860
- const varLines = symbolNames.map((name) => `export const ${name}NgSummary: any = null;`);
2861
- if (varLines.length === 0) {
2862
- varLines.push(`export const \u0275empty = null;`);
2863
- }
2864
- const sourceText = varLines.join("\n");
2865
- const genFile = ts15.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts15.ScriptKind.TS);
2866
- if (sf.moduleName !== void 0) {
2867
- genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
3021
+ const typeCheckScope = {
3022
+ matcher,
3023
+ directives,
3024
+ pipes,
3025
+ schemas: scope.schemas,
3026
+ isPoisoned: scope.kind === ComponentScopeKind.NgModule ? scope.compilation.isPoisoned || scope.exported.isPoisoned : scope.isPoisoned
3027
+ };
3028
+ this.scopeCache.set(cacheKey, typeCheckScope);
3029
+ return typeCheckScope;
3030
+ }
3031
+ getTypeCheckDirectiveMetadata(ref) {
3032
+ const clazz = ref.node;
3033
+ if (this.flattenedDirectiveMetaCache.has(clazz)) {
3034
+ return this.flattenedDirectiveMetaCache.get(clazz);
2868
3035
  }
2869
- return genFile;
3036
+ const meta = flattenInheritedDirectiveMetadata(this.metaReader, ref);
3037
+ this.flattenedDirectiveMetaCache.set(clazz, meta);
3038
+ return meta;
2870
3039
  }
2871
3040
  };
2872
- function isExported2(decl) {
2873
- return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts15.SyntaxKind.ExportKeyword);
3041
+
3042
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/api.mjs
3043
+ var CompilationMode;
3044
+ (function(CompilationMode2) {
3045
+ CompilationMode2[CompilationMode2["FULL"] = 0] = "FULL";
3046
+ CompilationMode2[CompilationMode2["PARTIAL"] = 1] = "PARTIAL";
3047
+ })(CompilationMode || (CompilationMode = {}));
3048
+ var HandlerPrecedence;
3049
+ (function(HandlerPrecedence2) {
3050
+ HandlerPrecedence2[HandlerPrecedence2["PRIMARY"] = 0] = "PRIMARY";
3051
+ HandlerPrecedence2[HandlerPrecedence2["SHARED"] = 1] = "SHARED";
3052
+ HandlerPrecedence2[HandlerPrecedence2["WEAK"] = 2] = "WEAK";
3053
+ })(HandlerPrecedence || (HandlerPrecedence = {}));
3054
+ var HandlerFlags;
3055
+ (function(HandlerFlags2) {
3056
+ HandlerFlags2[HandlerFlags2["NONE"] = 0] = "NONE";
3057
+ HandlerFlags2[HandlerFlags2["FULL_INHERITANCE"] = 1] = "FULL_INHERITANCE";
3058
+ })(HandlerFlags || (HandlerFlags = {}));
3059
+
3060
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
3061
+ import ts14 from "typescript";
3062
+ function aliasTransformFactory(exportStatements) {
3063
+ return (context) => {
3064
+ return (file) => {
3065
+ if (ts14.isBundle(file) || !exportStatements.has(file.fileName)) {
3066
+ return file;
3067
+ }
3068
+ const statements = [...file.statements];
3069
+ exportStatements.get(file.fileName).forEach(([moduleName, symbolName], aliasName) => {
3070
+ const stmt = ts14.factory.createExportDeclaration(void 0, void 0, false, ts14.createNamedExports([ts14.factory.createExportSpecifier(false, symbolName, aliasName)]), ts14.factory.createStringLiteral(moduleName));
3071
+ statements.push(stmt);
3072
+ });
3073
+ return ts14.factory.updateSourceFile(file, statements);
3074
+ };
3075
+ };
2874
3076
  }
2875
3077
 
3078
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
3079
+ import ts15 from "typescript";
3080
+
2876
3081
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/trait.mjs
2877
3082
  var TraitState;
2878
3083
  (function(TraitState2) {
@@ -2930,7 +3135,7 @@ var TraitImpl = class {
2930
3135
 
2931
3136
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
2932
3137
  var TraitCompiler = class {
2933
- constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater) {
3138
+ constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater, sourceFileTypeIdentifier) {
2934
3139
  this.handlers = handlers;
2935
3140
  this.reflector = reflector;
2936
3141
  this.perf = perf;
@@ -2939,6 +3144,7 @@ var TraitCompiler = class {
2939
3144
  this.compilationMode = compilationMode;
2940
3145
  this.dtsTransforms = dtsTransforms;
2941
3146
  this.semanticDepGraphUpdater = semanticDepGraphUpdater;
3147
+ this.sourceFileTypeIdentifier = sourceFileTypeIdentifier;
2942
3148
  this.classes = /* @__PURE__ */ new Map();
2943
3149
  this.fileToClasses = /* @__PURE__ */ new Map();
2944
3150
  this.filesWithoutTraits = /* @__PURE__ */ new Set();
@@ -2955,7 +3161,7 @@ var TraitCompiler = class {
2955
3161
  return this.analyze(sf, true);
2956
3162
  }
2957
3163
  analyze(sf, preanalyze) {
2958
- if (sf.isDeclarationFile || isShim(sf)) {
3164
+ if (sf.isDeclarationFile || this.sourceFileTypeIdentifier.isShim(sf) || this.sourceFileTypeIdentifier.isResource(sf)) {
2959
3165
  return void 0;
2960
3166
  }
2961
3167
  const promises = [];
@@ -2976,7 +3182,7 @@ var TraitCompiler = class {
2976
3182
  if (this.reflector.isClass(node)) {
2977
3183
  this.analyzeClass(node, preanalyze ? promises : null);
2978
3184
  }
2979
- ts16.forEachChild(node, visit2);
3185
+ ts15.forEachChild(node, visit2);
2980
3186
  };
2981
3187
  visit2(sf);
2982
3188
  if (!this.fileToClasses.has(sf)) {
@@ -3090,7 +3296,7 @@ var TraitCompiler = class {
3090
3296
  }
3091
3297
  if (isPrimaryHandler && record.hasPrimaryHandler) {
3092
3298
  record.metaDiagnostics = [{
3093
- category: ts16.DiagnosticCategory.Error,
3299
+ category: ts15.DiagnosticCategory.Error,
3094
3300
  code: Number("-99" + ErrorCode.DECORATOR_COLLISION),
3095
3301
  file: getSourceFile(clazz),
3096
3302
  start: clazz.getStart(void 0, false),
@@ -3298,14 +3504,14 @@ var TraitCompiler = class {
3298
3504
  }
3299
3505
  }
3300
3506
  compile(clazz, constantPool) {
3301
- const original = ts16.getOriginalNode(clazz);
3507
+ const original = ts15.getOriginalNode(clazz);
3302
3508
  if (!this.reflector.isClass(clazz) || !this.reflector.isClass(original) || !this.classes.has(original)) {
3303
3509
  return null;
3304
3510
  }
3305
3511
  const record = this.classes.get(original);
3306
3512
  let res = [];
3307
3513
  for (const trait of record.traits) {
3308
- if (trait.state !== TraitState.Resolved || trait.analysisDiagnostics !== null || trait.resolveDiagnostics !== null) {
3514
+ if (trait.state !== TraitState.Resolved || containsErrors(trait.analysisDiagnostics) || containsErrors(trait.resolveDiagnostics)) {
3309
3515
  continue;
3310
3516
  }
3311
3517
  let compileRes;
@@ -3329,7 +3535,7 @@ var TraitCompiler = class {
3329
3535
  return res.length > 0 ? res : null;
3330
3536
  }
3331
3537
  decoratorsFor(node) {
3332
- const original = ts16.getOriginalNode(node);
3538
+ const original = ts15.getOriginalNode(node);
3333
3539
  if (!this.reflector.isClass(original) || !this.classes.has(original)) {
3334
3540
  return [];
3335
3541
  }
@@ -3339,7 +3545,7 @@ var TraitCompiler = class {
3339
3545
  if (trait.state !== TraitState.Resolved) {
3340
3546
  continue;
3341
3547
  }
3342
- if (trait.detected.trigger !== null && ts16.isDecorator(trait.detected.trigger)) {
3548
+ if (trait.detected.trigger !== null && ts15.isDecorator(trait.detected.trigger)) {
3343
3549
  decorators.push(trait.detected.trigger);
3344
3550
  }
3345
3551
  }
@@ -3367,25 +3573,28 @@ var TraitCompiler = class {
3367
3573
  return this.reexportMap;
3368
3574
  }
3369
3575
  };
3576
+ function containsErrors(diagnostics) {
3577
+ return diagnostics !== null && diagnostics.some((diag) => diag.category === ts15.DiagnosticCategory.Error);
3578
+ }
3370
3579
 
3371
3580
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
3372
- import ts18 from "typescript";
3581
+ import ts17 from "typescript";
3373
3582
 
3374
3583
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
3375
- import ts17 from "typescript";
3584
+ import ts16 from "typescript";
3376
3585
  function addImports(importManager, sf, extraStatements = []) {
3377
3586
  const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
3378
- const qualifier = ts17.factory.createIdentifier(i.qualifier.text);
3379
- const importClause = ts17.factory.createImportClause(false, void 0, ts17.factory.createNamespaceImport(qualifier));
3380
- const decl = ts17.factory.createImportDeclaration(void 0, void 0, importClause, ts17.factory.createStringLiteral(i.specifier));
3381
- ts17.setOriginalNode(i.qualifier, decl);
3587
+ const qualifier = ts16.factory.createIdentifier(i.qualifier.text);
3588
+ const importClause = ts16.factory.createImportClause(false, void 0, ts16.factory.createNamespaceImport(qualifier));
3589
+ const decl = ts16.factory.createImportDeclaration(void 0, void 0, importClause, ts16.factory.createStringLiteral(i.specifier));
3590
+ ts16.setOriginalNode(i.qualifier, decl);
3382
3591
  return decl;
3383
3592
  });
3384
3593
  const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
3385
3594
  const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
3386
3595
  if (addedImports.length > 0) {
3387
- const fileoverviewAnchorStmt = ts17.factory.createNotEmittedStatement(sf);
3388
- return ts17.factory.updateSourceFile(sf, ts17.factory.createNodeArray([
3596
+ const fileoverviewAnchorStmt = ts16.factory.createNotEmittedStatement(sf);
3597
+ return ts16.factory.updateSourceFile(sf, ts16.factory.createNodeArray([
3389
3598
  fileoverviewAnchorStmt,
3390
3599
  ...existingImports,
3391
3600
  ...addedImports,
@@ -3396,7 +3605,7 @@ function addImports(importManager, sf, extraStatements = []) {
3396
3605
  return sf;
3397
3606
  }
3398
3607
  function isImportStatement(stmt) {
3399
- return ts17.isImportDeclaration(stmt) || ts17.isImportEqualsDeclaration(stmt) || ts17.isNamespaceImport(stmt);
3608
+ return ts16.isImportDeclaration(stmt) || ts16.isImportEqualsDeclaration(stmt) || ts16.isNamespaceImport(stmt);
3400
3609
  }
3401
3610
 
3402
3611
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
@@ -3414,7 +3623,7 @@ var DtsTransformRegistry = class {
3414
3623
  if (!sf.isDeclarationFile) {
3415
3624
  return null;
3416
3625
  }
3417
- const originalSf = ts18.getOriginalNode(sf);
3626
+ const originalSf = ts17.getOriginalNode(sf);
3418
3627
  let transforms = null;
3419
3628
  if (this.ivyDeclarationTransforms.has(originalSf)) {
3420
3629
  transforms = [];
@@ -3427,7 +3636,7 @@ function declarationTransformFactory(transformRegistry, importRewriter, importPr
3427
3636
  return (context) => {
3428
3637
  const transformer = new DtsTransformer(context, importRewriter, importPrefix);
3429
3638
  return (fileOrBundle) => {
3430
- if (ts18.isBundle(fileOrBundle)) {
3639
+ if (ts17.isBundle(fileOrBundle)) {
3431
3640
  return fileOrBundle;
3432
3641
  }
3433
3642
  const transforms = transformRegistry.getAllTransforms(fileOrBundle);
@@ -3447,15 +3656,15 @@ var DtsTransformer = class {
3447
3656
  transform(sf, transforms) {
3448
3657
  const imports = new ImportManager(this.importRewriter, this.importPrefix);
3449
3658
  const visitor = (node) => {
3450
- if (ts18.isClassDeclaration(node)) {
3659
+ if (ts17.isClassDeclaration(node)) {
3451
3660
  return this.transformClassDeclaration(node, transforms, imports);
3452
- } else if (ts18.isFunctionDeclaration(node)) {
3661
+ } else if (ts17.isFunctionDeclaration(node)) {
3453
3662
  return this.transformFunctionDeclaration(node, transforms, imports);
3454
3663
  } else {
3455
- return ts18.visitEachChild(node, visitor, this.ctx);
3664
+ return ts17.visitEachChild(node, visitor, this.ctx);
3456
3665
  }
3457
3666
  };
3458
- sf = ts18.visitNode(sf, visitor);
3667
+ sf = ts17.visitNode(sf, visitor);
3459
3668
  return addImports(imports, sf);
3460
3669
  }
3461
3670
  transformClassDeclaration(clazz, transforms, imports) {
@@ -3483,7 +3692,7 @@ var DtsTransformer = class {
3483
3692
  }
3484
3693
  }
3485
3694
  if (elementsChanged && clazz === newClazz) {
3486
- newClazz = ts18.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, elements);
3695
+ newClazz = ts17.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, elements);
3487
3696
  }
3488
3697
  return newClazz;
3489
3698
  }
@@ -3505,31 +3714,31 @@ var IvyDeclarationDtsTransform = class {
3505
3714
  this.declarationFields.set(decl, fields);
3506
3715
  }
3507
3716
  transformClass(clazz, members, imports) {
3508
- const original = ts18.getOriginalNode(clazz);
3717
+ const original = ts17.getOriginalNode(clazz);
3509
3718
  if (!this.declarationFields.has(original)) {
3510
3719
  return clazz;
3511
3720
  }
3512
3721
  const fields = this.declarationFields.get(original);
3513
3722
  const newMembers = fields.map((decl) => {
3514
- const modifiers = [ts18.factory.createModifier(ts18.SyntaxKind.StaticKeyword)];
3723
+ const modifiers = [ts17.factory.createModifier(ts17.SyntaxKind.StaticKeyword)];
3515
3724
  const typeRef = translateType(decl.type, imports);
3516
3725
  markForEmitAsSingleLine(typeRef);
3517
- return ts18.factory.createPropertyDeclaration(void 0, modifiers, decl.name, void 0, typeRef, void 0);
3726
+ return ts17.factory.createPropertyDeclaration(void 0, modifiers, decl.name, void 0, typeRef, void 0);
3518
3727
  });
3519
- return ts18.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
3728
+ return ts17.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
3520
3729
  }
3521
3730
  };
3522
3731
  function markForEmitAsSingleLine(node) {
3523
- ts18.setEmitFlags(node, ts18.EmitFlags.SingleLine);
3524
- ts18.forEachChild(node, markForEmitAsSingleLine);
3732
+ ts17.setEmitFlags(node, ts17.EmitFlags.SingleLine);
3733
+ ts17.forEachChild(node, markForEmitAsSingleLine);
3525
3734
  }
3526
3735
 
3527
3736
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
3528
3737
  import { ConstantPool } from "@angular/compiler";
3529
- import ts20 from "typescript";
3738
+ import ts19 from "typescript";
3530
3739
 
3531
3740
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
3532
- import ts19 from "typescript";
3741
+ import ts18 from "typescript";
3533
3742
  function visit(node, visitor, context) {
3534
3743
  return visitor._visit(node, context);
3535
3744
  }
@@ -3553,8 +3762,8 @@ var Visitor = class {
3553
3762
  }
3554
3763
  _visit(node, context) {
3555
3764
  let visitedNode = null;
3556
- node = ts19.visitEachChild(node, (child) => this._visit(child, context), context);
3557
- if (ts19.isClassDeclaration(node)) {
3765
+ node = ts18.visitEachChild(node, (child) => this._visit(child, context), context);
3766
+ if (ts18.isClassDeclaration(node)) {
3558
3767
  visitedNode = this._visitListEntryNode(node, (node2) => this.visitClassDeclaration(node2));
3559
3768
  } else {
3560
3769
  visitedNode = this.visitOtherNode(node);
@@ -3568,7 +3777,7 @@ var Visitor = class {
3568
3777
  if (node.statements.every((stmt) => !this._before.has(stmt) && !this._after.has(stmt))) {
3569
3778
  return node;
3570
3779
  }
3571
- const clone = ts19.getMutableClone(node);
3780
+ const clone = ts18.getMutableClone(node);
3572
3781
  const newStatements = [];
3573
3782
  clone.statements.forEach((stmt) => {
3574
3783
  if (this._before.has(stmt)) {
@@ -3581,7 +3790,7 @@ var Visitor = class {
3581
3790
  this._after.delete(stmt);
3582
3791
  }
3583
3792
  });
3584
- clone.statements = ts19.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
3793
+ clone.statements = ts18.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
3585
3794
  return clone;
3586
3795
  }
3587
3796
  };
@@ -3639,14 +3848,14 @@ var IvyTransformationVisitor = class extends Visitor {
3639
3848
  const members = [...node.members];
3640
3849
  for (const field of this.classCompilationMap.get(node)) {
3641
3850
  const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
3642
- const property = ts20.factory.createPropertyDeclaration(void 0, [ts20.factory.createToken(ts20.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
3851
+ const property = ts19.factory.createPropertyDeclaration(void 0, [ts19.factory.createToken(ts19.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
3643
3852
  if (this.isClosureCompilerEnabled) {
3644
- ts20.addSyntheticLeadingComment(property, ts20.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
3853
+ ts19.addSyntheticLeadingComment(property, ts19.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
3645
3854
  }
3646
3855
  field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
3647
3856
  members.push(property);
3648
3857
  }
3649
- node = ts20.factory.updateClassDeclaration(node, maybeFilterDecorator(node.decorators, this.compilation.decoratorsFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], members.map((member) => this._stripAngularDecorators(member)));
3858
+ node = ts19.factory.updateClassDeclaration(node, maybeFilterDecorator(node.decorators, this.compilation.decoratorsFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], members.map((member) => this._stripAngularDecorators(member)));
3650
3859
  return { node, after: statements };
3651
3860
  }
3652
3861
  _angularCoreDecorators(decl) {
@@ -3675,25 +3884,25 @@ var IvyTransformationVisitor = class extends Visitor {
3675
3884
  if (filtered.length === 0) {
3676
3885
  return void 0;
3677
3886
  }
3678
- const array = ts20.factory.createNodeArray(filtered);
3887
+ const array = ts19.factory.createNodeArray(filtered);
3679
3888
  array.pos = node.decorators.pos;
3680
3889
  array.end = node.decorators.end;
3681
3890
  return array;
3682
3891
  }
3683
3892
  _stripAngularDecorators(node) {
3684
- if (ts20.isParameter(node)) {
3685
- node = ts20.factory.updateParameterDeclaration(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.factory.updateMethodDeclaration(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.factory.updatePropertyDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.questionToken, node.type, node.initializer);
3690
- } else if (ts20.isGetAccessor(node)) {
3691
- node = ts20.factory.updateGetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.type, node.body);
3692
- } else if (ts20.isSetAccessor(node)) {
3693
- node = ts20.factory.updateSetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.body);
3694
- } else if (ts20.isConstructorDeclaration(node)) {
3893
+ if (ts19.isParameter(node)) {
3894
+ node = ts19.factory.updateParameterDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
3895
+ } else if (ts19.isMethodDeclaration(node) && node.decorators !== void 0) {
3896
+ node = ts19.factory.updateMethodDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
3897
+ } else if (ts19.isPropertyDeclaration(node) && node.decorators !== void 0) {
3898
+ node = ts19.factory.updatePropertyDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.questionToken, node.type, node.initializer);
3899
+ } else if (ts19.isGetAccessor(node)) {
3900
+ node = ts19.factory.updateGetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.type, node.body);
3901
+ } else if (ts19.isSetAccessor(node)) {
3902
+ node = ts19.factory.updateSetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.body);
3903
+ } else if (ts19.isConstructorDeclaration(node)) {
3695
3904
  const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
3696
- node = ts20.factory.updateConstructorDeclaration(node, node.decorators, node.modifiers, parameters, node.body);
3905
+ node = ts19.factory.updateConstructorDeclaration(node, node.decorators, node.modifiers, parameters, node.body);
3697
3906
  }
3698
3907
  return node;
3699
3908
  }
@@ -3705,7 +3914,7 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
3705
3914
  visit(file, compilationVisitor, context);
3706
3915
  const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore);
3707
3916
  let sf = visit(file, transformationVisitor, context);
3708
- const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts20.ScriptTarget.ES2015;
3917
+ const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts19.ScriptTarget.ES2015;
3709
3918
  const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
3710
3919
  recordWrappedNode,
3711
3920
  downlevelTaggedTemplates: downlevelTranslatedCode,
@@ -3720,17 +3929,17 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
3720
3929
  return sf;
3721
3930
  }
3722
3931
  function getLocalizeCompileTarget(context) {
3723
- const target = context.getCompilerOptions().target || ts20.ScriptTarget.ES2015;
3724
- return target !== ts20.ScriptTarget.JSON ? target : ts20.ScriptTarget.ES2015;
3932
+ const target = context.getCompilerOptions().target || ts19.ScriptTarget.ES2015;
3933
+ return target !== ts19.ScriptTarget.JSON ? target : ts19.ScriptTarget.ES2015;
3725
3934
  }
3726
3935
  function getFileOverviewComment(statements) {
3727
3936
  if (statements.length > 0) {
3728
3937
  const host = statements[0];
3729
3938
  let trailing = false;
3730
- let comments = ts20.getSyntheticLeadingComments(host);
3939
+ let comments = ts19.getSyntheticLeadingComments(host);
3731
3940
  if (!comments || comments.length === 0) {
3732
3941
  trailing = true;
3733
- comments = ts20.getSyntheticTrailingComments(host);
3942
+ comments = ts19.getSyntheticTrailingComments(host);
3734
3943
  }
3735
3944
  if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
3736
3945
  return { comments, host, trailing };
@@ -3742,22 +3951,22 @@ function setFileOverviewComment(sf, fileoverview) {
3742
3951
  const { comments, host, trailing } = fileoverview;
3743
3952
  if (sf.statements.length > 0 && host !== sf.statements[0]) {
3744
3953
  if (trailing) {
3745
- ts20.setSyntheticTrailingComments(host, void 0);
3954
+ ts19.setSyntheticTrailingComments(host, void 0);
3746
3955
  } else {
3747
- ts20.setSyntheticLeadingComments(host, void 0);
3956
+ ts19.setSyntheticLeadingComments(host, void 0);
3748
3957
  }
3749
- ts20.setSyntheticLeadingComments(sf.statements[0], comments);
3958
+ ts19.setSyntheticLeadingComments(sf.statements[0], comments);
3750
3959
  }
3751
3960
  }
3752
3961
  function maybeFilterDecorator(decorators, toRemove) {
3753
3962
  if (decorators === void 0) {
3754
3963
  return void 0;
3755
3964
  }
3756
- const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts20.getOriginalNode(dec) === decToRemove) === void 0);
3965
+ const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts19.getOriginalNode(dec) === decToRemove) === void 0);
3757
3966
  if (filtered.length === 0) {
3758
3967
  return void 0;
3759
3968
  }
3760
- return ts20.factory.createNodeArray(filtered);
3969
+ return ts19.factory.createNodeArray(filtered);
3761
3970
  }
3762
3971
  function isFromAngularCore(decorator) {
3763
3972
  return decorator.import !== null && decorator.import.from === "@angular/core";
@@ -3775,8 +3984,8 @@ function createRecorderFn(defaultImportTracker) {
3775
3984
  import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
3776
3985
 
3777
3986
  // 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";
3987
+ import { createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr4, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr4 } from "@angular/compiler";
3988
+ import ts20 from "typescript";
3780
3989
  var EMPTY_OBJECT = {};
3781
3990
  var QUERY_TYPES = /* @__PURE__ */ new Set([
3782
3991
  "ContentChild",
@@ -3792,7 +4001,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
3792
4001
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
3793
4002
  } else {
3794
4003
  const meta = unwrapExpression(decorator.args[0]);
3795
- if (!ts21.isObjectLiteralExpression(meta)) {
4004
+ if (!ts20.isObjectLiteralExpression(meta)) {
3796
4005
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
3797
4006
  }
3798
4007
  directive = reflectObjectLiteral(meta);
@@ -3844,7 +4053,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
3844
4053
  }
3845
4054
  const rawCtorDeps = getConstructorDependencies(clazz, reflector, isCore);
3846
4055
  const ctorDeps = selector !== null ? validateConstructorDependencies(clazz, rawCtorDeps) : unwrapConstructorDependencies(rawCtorDeps);
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");
4056
+ const isStructural = ctorDeps !== null && ctorDeps !== "invalid" && ctorDeps.some((dep) => dep.token instanceof ExternalExpr4 && dep.token.value.moduleName === "@angular/core" && dep.token.value.name === "TemplateRef");
3848
4057
  let isStandalone = false;
3849
4058
  if (directive.has("standalone")) {
3850
4059
  const expr = directive.get("standalone");
@@ -3913,7 +4122,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
3913
4122
  let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
3914
4123
  if (args.length === 2) {
3915
4124
  const optionsExpr = unwrapExpression(args[1]);
3916
- if (!ts21.isObjectLiteralExpression(optionsExpr)) {
4125
+ if (!ts20.isObjectLiteralExpression(optionsExpr)) {
3917
4126
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
3918
4127
  }
3919
4128
  const options = reflectObjectLiteral(optionsExpr);
@@ -4008,16 +4217,16 @@ function extractHostBindings(members, evaluator, coreModule, metadata) {
4008
4217
  }
4009
4218
  function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
4010
4219
  const content = [], view = [];
4011
- if (!ts21.isObjectLiteralExpression(queryData)) {
4220
+ if (!ts20.isObjectLiteralExpression(queryData)) {
4012
4221
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
4013
4222
  }
4014
4223
  reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
4015
4224
  queryExpr = unwrapExpression(queryExpr);
4016
- if (!ts21.isNewExpression(queryExpr)) {
4225
+ if (!ts20.isNewExpression(queryExpr)) {
4017
4226
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4018
4227
  }
4019
- const queryType = ts21.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4020
- if (!ts21.isIdentifier(queryType)) {
4228
+ const queryType = ts20.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4229
+ if (!ts20.isIdentifier(queryType)) {
4021
4230
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4022
4231
  }
4023
4232
  const type = reflector.getImportOfIdentifier(queryType);
@@ -4263,6 +4472,9 @@ var DirectiveDecoratorHandler = class {
4263
4472
  }
4264
4473
  analyze(node, decorator, flags = HandlerFlags.NONE) {
4265
4474
  if (this.compileUndecoratedClassesWithAngularFeatures === false && decorator === null) {
4475
+ if (this.isCore) {
4476
+ return {};
4477
+ }
4266
4478
  return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
4267
4479
  }
4268
4480
  this.perf.eventCount(PerfEvent.AnalyzeDirective);
@@ -4296,7 +4508,7 @@ var DirectiveDecoratorHandler = class {
4296
4508
  register(node, analysis) {
4297
4509
  const ref = new Reference(node);
4298
4510
  this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
4299
- type: MetaType.Directive,
4511
+ kind: MetaKind.Directive,
4300
4512
  ref,
4301
4513
  name: node.name.text,
4302
4514
  selector: analysis.meta.selector,
@@ -4310,7 +4522,9 @@ var DirectiveDecoratorHandler = class {
4310
4522
  isPoisoned: analysis.isPoisoned,
4311
4523
  isStructural: analysis.isStructural,
4312
4524
  animationTriggerNames: null,
4313
- isStandalone: analysis.meta.isStandalone
4525
+ isStandalone: analysis.meta.isStandalone,
4526
+ imports: null,
4527
+ schemas: null
4314
4528
  }));
4315
4529
  this.injectableRegistry.registerInjectable(node);
4316
4530
  }
@@ -4355,8 +4569,8 @@ var DirectiveDecoratorHandler = class {
4355
4569
  };
4356
4570
 
4357
4571
  // 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";
4572
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3SelectorScopeMode, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
4573
+ import ts21 from "typescript";
4360
4574
  var NgModuleSymbol = class extends SemanticSymbol {
4361
4575
  constructor() {
4362
4576
  super(...arguments);
@@ -4439,8 +4653,8 @@ var NgModuleDecoratorHandler = class {
4439
4653
  if (decorator.args === null || decorator.args.length > 1) {
4440
4654
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @NgModule decorator`);
4441
4655
  }
4442
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts22.factory.createObjectLiteralExpression([]);
4443
- if (!ts22.isObjectLiteralExpression(meta)) {
4656
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts21.factory.createObjectLiteralExpression([]);
4657
+ if (!ts21.isObjectLiteralExpression(meta)) {
4444
4658
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
4445
4659
  }
4446
4660
  const ngModule = reflectObjectLiteral(meta);
@@ -4448,7 +4662,7 @@ var NgModuleDecoratorHandler = class {
4448
4662
  return {};
4449
4663
  }
4450
4664
  const moduleResolvers = combineResolvers([
4451
- (ref) => this._extractModuleFromModuleWithProvidersFn(ref.node),
4665
+ (fn, call, resolve, unresolvable) => this._extractModuleFromModuleWithProvidersFn(fn, call, resolve, unresolvable),
4452
4666
  forwardRefResolver
4453
4667
  ]);
4454
4668
  const diagnostics = [];
@@ -4457,7 +4671,7 @@ var NgModuleDecoratorHandler = class {
4457
4671
  if (ngModule.has("declarations")) {
4458
4672
  rawDeclarations = ngModule.get("declarations");
4459
4673
  const declarationMeta = this.evaluator.evaluate(rawDeclarations, forwardRefResolver);
4460
- declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations");
4674
+ declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations", 0).references;
4461
4675
  for (const ref of declarationRefs) {
4462
4676
  if (ref.node.getSourceFile().isDeclarationFile) {
4463
4677
  const errorNode = ref.getOriginForDiagnostics(rawDeclarations);
@@ -4469,52 +4683,44 @@ var NgModuleDecoratorHandler = class {
4469
4683
  return { diagnostics };
4470
4684
  }
4471
4685
  let importRefs = [];
4686
+ let rawImports = null;
4472
4687
  if (ngModule.has("imports")) {
4473
- const rawImports = ngModule.get("imports");
4688
+ rawImports = ngModule.get("imports");
4474
4689
  const importsMeta = this.evaluator.evaluate(rawImports, moduleResolvers);
4475
- importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports");
4690
+ importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports", 0).references;
4476
4691
  }
4477
4692
  let exportRefs = [];
4693
+ let rawExports = null;
4478
4694
  if (ngModule.has("exports")) {
4479
- const rawExports = ngModule.get("exports");
4695
+ rawExports = ngModule.get("exports");
4480
4696
  const exportsMeta = this.evaluator.evaluate(rawExports, moduleResolvers);
4481
- exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports");
4697
+ exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports", 0).references;
4482
4698
  this.referencesRegistry.add(node, ...exportRefs);
4483
4699
  }
4484
4700
  let bootstrapRefs = [];
4485
4701
  if (ngModule.has("bootstrap")) {
4486
4702
  const expr = ngModule.get("bootstrap");
4487
4703
  const bootstrapMeta = this.evaluator.evaluate(expr, forwardRefResolver);
4488
- bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap");
4489
- }
4490
- const schemas = [];
4491
- if (ngModule.has("schemas")) {
4492
- const rawExpr = ngModule.get("schemas");
4493
- const result = this.evaluator.evaluate(rawExpr);
4494
- if (!Array.isArray(result)) {
4495
- throw createValueHasWrongTypeError(rawExpr, result, `NgModule.schemas must be an array`);
4496
- }
4497
- for (const schemaRef of result) {
4498
- if (!(schemaRef instanceof Reference)) {
4499
- throw createValueHasWrongTypeError(rawExpr, result, "NgModule.schemas must be an array of schemas");
4500
- }
4501
- const id2 = schemaRef.getIdentityIn(schemaRef.node.getSourceFile());
4502
- if (id2 === null || schemaRef.ownedByModuleGuess !== "@angular/core") {
4503
- throw createValueHasWrongTypeError(rawExpr, result, "NgModule.schemas must be an array of schemas");
4504
- }
4505
- switch (id2.text) {
4506
- case "CUSTOM_ELEMENTS_SCHEMA":
4507
- schemas.push(CUSTOM_ELEMENTS_SCHEMA);
4508
- break;
4509
- case "NO_ERRORS_SCHEMA":
4510
- schemas.push(NO_ERRORS_SCHEMA);
4511
- break;
4512
- default:
4513
- throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid NgModule schema`);
4704
+ bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap", 0).references;
4705
+ for (const ref of bootstrapRefs) {
4706
+ const dirMeta = this.metaReader.getDirectiveMetadata(ref);
4707
+ if (dirMeta == null ? void 0 : dirMeta.isStandalone) {
4708
+ diagnostics.push(makeStandaloneBootstrapDiagnostic(node, ref, expr));
4514
4709
  }
4515
4710
  }
4516
4711
  }
4517
- const id = ngModule.has("id") ? new WrappedNodeExpr6(ngModule.get("id")) : null;
4712
+ const schemas = ngModule.has("schemas") ? extractSchemas(ngModule.get("schemas"), this.evaluator, "NgModule") : [];
4713
+ let id = null;
4714
+ if (ngModule.has("id")) {
4715
+ const idExpr = ngModule.get("id");
4716
+ if (!isModuleIdExpression(idExpr)) {
4717
+ id = new WrappedNodeExpr6(idExpr);
4718
+ } else {
4719
+ const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
4720
+ diag.category = ts21.DiagnosticCategory.Warning;
4721
+ diagnostics.push(diag);
4722
+ }
4723
+ }
4518
4724
  const valueContext = node.getSourceFile();
4519
4725
  let typeContext = valueContext;
4520
4726
  const typeNode = this.reflector.getDtsDeclaration(node);
@@ -4540,21 +4746,43 @@ var NgModuleDecoratorHandler = class {
4540
4746
  imports,
4541
4747
  containsForwardDecls,
4542
4748
  id,
4543
- emitInline: false,
4749
+ selectorScopeMode: R3SelectorScopeMode.SideEffect,
4544
4750
  schemas: []
4545
4751
  };
4546
4752
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
4547
4753
  const wrapperProviders = rawProviders !== null ? new WrappedNodeExpr6(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders) : null;
4548
- const injectorImports = [];
4754
+ const topLevelImports = [];
4549
4755
  if (ngModule.has("imports")) {
4550
- injectorImports.push(new WrappedNodeExpr6(ngModule.get("imports")));
4756
+ const rawImports2 = unwrapExpression(ngModule.get("imports"));
4757
+ let topLevelExpressions = [];
4758
+ if (ts21.isArrayLiteralExpression(rawImports2)) {
4759
+ for (const element of rawImports2.elements) {
4760
+ if (ts21.isSpreadElement(element)) {
4761
+ topLevelExpressions.push(element.expression);
4762
+ continue;
4763
+ }
4764
+ topLevelExpressions.push(element);
4765
+ }
4766
+ } else {
4767
+ topLevelExpressions.push(rawImports2);
4768
+ }
4769
+ let absoluteIndex = 0;
4770
+ for (const importExpr of topLevelExpressions) {
4771
+ const resolved = this.evaluator.evaluate(importExpr, moduleResolvers);
4772
+ const { references, hasModuleWithProviders } = this.resolveTypeList(importExpr, [resolved], node.name.text, "imports", absoluteIndex);
4773
+ absoluteIndex += references.length;
4774
+ topLevelImports.push({
4775
+ expression: importExpr,
4776
+ resolvedReferences: references,
4777
+ hasModuleWithProviders
4778
+ });
4779
+ }
4551
4780
  }
4552
4781
  const injectorMetadata = {
4553
4782
  name,
4554
4783
  type,
4555
4784
  internalType,
4556
- providers: wrapperProviders,
4557
- imports: injectorImports
4785
+ providers: wrapperProviders
4558
4786
  };
4559
4787
  const factoryMetadata = {
4560
4788
  name,
@@ -4565,6 +4793,7 @@ var NgModuleDecoratorHandler = class {
4565
4793
  target: FactoryTarget2.NgModule
4566
4794
  };
4567
4795
  return {
4796
+ diagnostics: diagnostics.length > 0 ? diagnostics : void 0,
4568
4797
  analysis: {
4569
4798
  id,
4570
4799
  schemas,
@@ -4573,8 +4802,11 @@ var NgModuleDecoratorHandler = class {
4573
4802
  fac: factoryMetadata,
4574
4803
  declarations: declarationRefs,
4575
4804
  rawDeclarations,
4576
- imports: importRefs,
4805
+ imports: topLevelImports,
4806
+ rawImports,
4807
+ importRefs,
4577
4808
  exports: exportRefs,
4809
+ rawExports,
4578
4810
  providers: rawProviders,
4579
4811
  providersRequiringFactory: rawProviders ? resolveProvidersRequiringFactory(rawProviders, this.reflector, this.evaluator) : null,
4580
4812
  classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
@@ -4587,17 +4819,19 @@ var NgModuleDecoratorHandler = class {
4587
4819
  }
4588
4820
  register(node, analysis) {
4589
4821
  this.metaRegistry.registerNgModuleMetadata({
4822
+ kind: MetaKind.NgModule,
4590
4823
  ref: new Reference(node),
4591
4824
  schemas: analysis.schemas,
4592
4825
  declarations: analysis.declarations,
4593
- imports: analysis.imports,
4826
+ imports: analysis.importRefs,
4594
4827
  exports: analysis.exports,
4595
- rawDeclarations: analysis.rawDeclarations
4828
+ rawDeclarations: analysis.rawDeclarations,
4829
+ rawImports: analysis.rawImports,
4830
+ rawExports: analysis.rawExports
4596
4831
  });
4597
4832
  if (this.factoryTracker !== null) {
4598
4833
  this.factoryTracker.track(node.getSourceFile(), {
4599
- name: analysis.factorySymbolName,
4600
- hasId: analysis.id !== null
4834
+ name: analysis.factorySymbolName
4601
4835
  });
4602
4836
  }
4603
4837
  this.injectableRegistry.registerInjectable(node);
@@ -4616,6 +4850,34 @@ var NgModuleDecoratorHandler = class {
4616
4850
  const data = {
4617
4851
  injectorImports: []
4618
4852
  };
4853
+ for (const topLevelImport of analysis.imports) {
4854
+ if (topLevelImport.hasModuleWithProviders) {
4855
+ data.injectorImports.push(new WrappedNodeExpr6(topLevelImport.expression));
4856
+ continue;
4857
+ }
4858
+ const refsToEmit = [];
4859
+ for (const ref of topLevelImport.resolvedReferences) {
4860
+ const dirMeta = this.metaReader.getDirectiveMetadata(ref);
4861
+ if (dirMeta !== null && !dirMeta.isComponent) {
4862
+ continue;
4863
+ }
4864
+ const pipeMeta = dirMeta === null ? this.metaReader.getPipeMetadata(ref) : null;
4865
+ if (pipeMeta !== null) {
4866
+ continue;
4867
+ }
4868
+ refsToEmit.push(ref);
4869
+ }
4870
+ if (refsToEmit.length === topLevelImport.resolvedReferences.length) {
4871
+ data.injectorImports.push(new WrappedNodeExpr6(topLevelImport.expression));
4872
+ } else {
4873
+ const context = node.getSourceFile();
4874
+ for (const ref of refsToEmit) {
4875
+ const emittedRef = this.refEmitter.emit(ref, context);
4876
+ assertSuccessfulReferenceEmit(emittedRef, topLevelImport.expression, "class");
4877
+ data.injectorImports.push(emittedRef.expression);
4878
+ }
4879
+ }
4880
+ }
4619
4881
  if (scope !== null && !scope.compilation.isPoisoned) {
4620
4882
  const context = getSourceFile(node);
4621
4883
  for (const exportRef of analysis.exports) {
@@ -4632,15 +4894,8 @@ var NgModuleDecoratorHandler = class {
4632
4894
  if (dirMeta.selector === null) {
4633
4895
  throw new FatalDiagnosticError(ErrorCode.DIRECTIVE_MISSING_SELECTOR, decl.node, `${refType} ${decl.node.name.text} has no selector, please add it!`);
4634
4896
  }
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
4897
  continue;
4639
4898
  }
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?`));
4643
- }
4644
4899
  }
4645
4900
  }
4646
4901
  if (diagnostics.length > 0) {
@@ -4657,7 +4912,9 @@ var NgModuleDecoratorHandler = class {
4657
4912
  }
4658
4913
  compileFull(node, { inj, mod, fac, classMetadata, declarations }, { injectorImports }) {
4659
4914
  const factoryFn = compileNgFactoryDefField(fac);
4660
- const ngInjectorDef = compileInjector(this.mergeInjectorImports(inj, injectorImports));
4915
+ const ngInjectorDef = compileInjector(__spreadProps(__spreadValues({}, inj), {
4916
+ imports: injectorImports
4917
+ }));
4661
4918
  const ngModuleDef = compileNgModule(mod);
4662
4919
  const statements = ngModuleDef.statements;
4663
4920
  const metadata = classMetadata !== null ? compileClassMetadata2(classMetadata) : null;
@@ -4667,15 +4924,14 @@ var NgModuleDecoratorHandler = class {
4667
4924
  }
4668
4925
  compilePartial(node, { inj, fac, mod, classMetadata }, { injectorImports }) {
4669
4926
  const factoryFn = compileDeclareFactory(fac);
4670
- const injectorDef = compileDeclareInjectorFromMetadata(this.mergeInjectorImports(inj, injectorImports));
4927
+ const injectorDef = compileDeclareInjectorFromMetadata(__spreadProps(__spreadValues({}, inj), {
4928
+ imports: injectorImports
4929
+ }));
4671
4930
  const ngModuleDef = compileDeclareNgModuleFromMetadata(mod);
4672
4931
  const metadata = classMetadata !== null ? compileDeclareClassMetadata2(classMetadata) : null;
4673
4932
  this.insertMetadataStatement(ngModuleDef.statements, metadata);
4674
4933
  return this.compileNgModule(factoryFn, injectorDef, ngModuleDef);
4675
4934
  }
4676
- mergeInjectorImports(inj, injectorImports) {
4677
- return __spreadProps(__spreadValues({}, inj), { imports: [...inj.imports, ...injectorImports] });
4678
- }
4679
4935
  insertMetadataStatement(ngModuleStatements, metadata) {
4680
4936
  if (metadata !== null) {
4681
4937
  ngModuleStatements.unshift(metadata.toStmt());
@@ -4701,7 +4957,7 @@ var NgModuleDecoratorHandler = class {
4701
4957
  const componentType = this.refEmitter.emit(decl, context);
4702
4958
  assertSuccessfulReferenceEmit(componentType, node, "component");
4703
4959
  const declExpr = componentType.expression;
4704
- const setComponentScope = new ExternalExpr4(R3Identifiers.setComponentScope);
4960
+ const setComponentScope = new ExternalExpr5(R3Identifiers.setComponentScope);
4705
4961
  const callExpr = new InvokeFunctionExpr(setComponentScope, [declExpr, directiveArray, pipesArray]);
4706
4962
  ngModuleStatements.push(callExpr.toStmt());
4707
4963
  }
@@ -4737,15 +4993,26 @@ var NgModuleDecoratorHandler = class {
4737
4993
  return toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, this.refEmitter);
4738
4994
  }
4739
4995
  }
4740
- _extractModuleFromModuleWithProvidersFn(node) {
4741
- const type = node.type || null;
4742
- return type && (this._reflectModuleFromTypeParam(type, node) || this._reflectModuleFromLiteralType(type));
4996
+ _extractModuleFromModuleWithProvidersFn(fn, node, resolve, unresolvable) {
4997
+ const rawType = fn.node.type || null;
4998
+ const type = rawType && (this._reflectModuleFromTypeParam(rawType, fn.node) || this._reflectModuleFromLiteralType(rawType));
4999
+ if (type === null) {
5000
+ return unresolvable;
5001
+ }
5002
+ const ngModule = resolve(type);
5003
+ if (!(ngModule instanceof Reference) || !isNamedClassDeclaration(ngModule.node)) {
5004
+ return unresolvable;
5005
+ }
5006
+ return new SyntheticValue({
5007
+ ngModule,
5008
+ mwpCall: node
5009
+ });
4743
5010
  }
4744
5011
  _reflectModuleFromTypeParam(type, node) {
4745
- if (!ts22.isTypeReferenceNode(type)) {
5012
+ if (!ts21.isTypeReferenceNode(type)) {
4746
5013
  return null;
4747
5014
  }
4748
- const typeName = type && (ts22.isIdentifier(type.typeName) && type.typeName || ts22.isQualifiedName(type.typeName) && type.typeName.right) || null;
5015
+ const typeName = type && (ts21.isIdentifier(type.typeName) && type.typeName || ts21.isQualifiedName(type.typeName) && type.typeName.right) || null;
4749
5016
  if (typeName === null) {
4750
5017
  return null;
4751
5018
  }
@@ -4757,7 +5024,7 @@ var NgModuleDecoratorHandler = class {
4757
5024
  return null;
4758
5025
  }
4759
5026
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
4760
- const parent = ts22.isMethodDeclaration(node) && ts22.isClassDeclaration(node.parent) ? node.parent : null;
5027
+ const parent = ts21.isMethodDeclaration(node) && ts21.isClassDeclaration(node.parent) ? node.parent : null;
4761
5028
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
4762
5029
  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.`);
4763
5030
  }
@@ -4765,13 +5032,13 @@ var NgModuleDecoratorHandler = class {
4765
5032
  return typeNodeToValueExpr(arg);
4766
5033
  }
4767
5034
  _reflectModuleFromLiteralType(type) {
4768
- if (!ts22.isIntersectionTypeNode(type)) {
5035
+ if (!ts21.isIntersectionTypeNode(type)) {
4769
5036
  return null;
4770
5037
  }
4771
5038
  for (const t of type.types) {
4772
- if (ts22.isTypeLiteralNode(t)) {
5039
+ if (ts21.isTypeLiteralNode(t)) {
4773
5040
  for (const m of t.members) {
4774
- const ngModuleType = ts22.isPropertySignature(m) && ts22.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
5041
+ const ngModuleType = ts21.isPropertySignature(m) && ts21.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
4775
5042
  const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
4776
5043
  if (ngModuleExpression) {
4777
5044
  return ngModuleExpression;
@@ -4784,31 +5051,56 @@ var NgModuleDecoratorHandler = class {
4784
5051
  isClassDeclarationReference(ref) {
4785
5052
  return this.reflector.isClass(ref.node);
4786
5053
  }
4787
- resolveTypeList(expr, resolvedList, className, arrayName) {
5054
+ resolveTypeList(expr, resolvedList, className, arrayName, absoluteIndex) {
5055
+ let hasModuleWithProviders = false;
4788
5056
  const refList = [];
4789
5057
  if (!Array.isArray(resolvedList)) {
4790
5058
  throw createValueHasWrongTypeError(expr, resolvedList, `Expected array when reading the NgModule.${arrayName} of ${className}`);
4791
5059
  }
4792
- resolvedList.forEach((entry, idx) => {
4793
- if (entry instanceof Map && entry.has("ngModule")) {
5060
+ for (let idx = 0; idx < resolvedList.length; idx++) {
5061
+ let entry = resolvedList[idx];
5062
+ if (entry instanceof SyntheticValue && isResolvedModuleWithProviders(entry)) {
5063
+ entry = entry.value.ngModule;
5064
+ hasModuleWithProviders = true;
5065
+ } else if (entry instanceof Map && entry.has("ngModule")) {
4794
5066
  entry = entry.get("ngModule");
5067
+ hasModuleWithProviders = true;
4795
5068
  }
4796
5069
  if (Array.isArray(entry)) {
4797
- refList.push(...this.resolveTypeList(expr, entry, className, arrayName));
5070
+ const recursiveResult = this.resolveTypeList(expr, entry, className, arrayName, absoluteIndex);
5071
+ refList.push(...recursiveResult.references);
5072
+ absoluteIndex += recursiveResult.references.length;
5073
+ hasModuleWithProviders = hasModuleWithProviders || recursiveResult.hasModuleWithProviders;
4798
5074
  } else if (entry instanceof Reference) {
4799
5075
  if (!this.isClassDeclarationReference(entry)) {
4800
- throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a class`);
5076
+ throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${absoluteIndex} in the NgModule.${arrayName} of ${className} is not a class`);
4801
5077
  }
4802
5078
  refList.push(entry);
5079
+ absoluteIndex += 1;
4803
5080
  } else {
4804
- throw createValueHasWrongTypeError(expr, entry, `Value at position ${idx} in the NgModule.${arrayName} of ${className} is not a reference`);
5081
+ throw createValueHasWrongTypeError(expr, entry, `Value at position ${absoluteIndex} in the NgModule.${arrayName} of ${className} is not a reference`);
4805
5082
  }
4806
- });
4807
- return refList;
5083
+ }
5084
+ return {
5085
+ references: refList,
5086
+ hasModuleWithProviders
5087
+ };
4808
5088
  }
4809
5089
  };
4810
5090
  function isNgModule(node, compilation) {
4811
- return !compilation.directives.some((directive) => directive.ref.node === node) && !compilation.pipes.some((pipe) => pipe.ref.node === node);
5091
+ return !compilation.dependencies.some((dep) => dep.ref.node === node);
5092
+ }
5093
+ function isModuleIdExpression(expr) {
5094
+ return ts21.isPropertyAccessExpression(expr) && ts21.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
5095
+ }
5096
+ function isResolvedModuleWithProviders(sv) {
5097
+ return typeof sv.value === "object" && sv.value != null && sv.value.hasOwnProperty("ngModule") && sv.value.hasOwnProperty("mwpCall");
5098
+ }
5099
+ function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
5100
+ const componentClassName = bootstrappedClassRef.node.name.text;
5101
+ const message = `The \`${componentClassName}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`;
5102
+ const relatedInformation = [makeRelatedInformation(ngModuleClass, `The 'bootstrap' array is present on this NgModule.`)];
5103
+ return makeDiagnostic(ErrorCode.NGMODULE_BOOTSTRAP_IS_STANDALONE, getDiagnosticNode(bootstrappedClassRef, rawBootstrapExpr), message, relatedInformation);
4812
5104
  }
4813
5105
 
4814
5106
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/diagnostics.mjs
@@ -4836,7 +5128,7 @@ function checkCustomElementSelectorForErrors(selector) {
4836
5128
 
4837
5129
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
4838
5130
  import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
4839
- import ts23 from "typescript";
5131
+ import ts22 from "typescript";
4840
5132
  function getTemplateDeclarationNodeForError(declaration) {
4841
5133
  switch (declaration.isInline) {
4842
5134
  case true:
@@ -4853,7 +5145,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
4853
5145
  let sourceMapping;
4854
5146
  let escapedString = false;
4855
5147
  let sourceMapUrl;
4856
- if (ts23.isStringLiteral(template.expression) || ts23.isNoSubstitutionTemplateLiteral(template.expression)) {
5148
+ if (ts22.isStringLiteral(template.expression) || ts22.isNoSubstitutionTemplateLiteral(template.expression)) {
4857
5149
  sourceParseRange = getTemplateRange(template.expression);
4858
5150
  sourceStr = template.expression.getSourceFile().text;
4859
5151
  templateContent = template.expression.text;
@@ -5011,7 +5303,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
5011
5303
  }
5012
5304
  function getTemplateRange(templateExpr) {
5013
5305
  const startPos = templateExpr.getStart() + 1;
5014
- const { line, character } = ts23.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
5306
+ const { line, character } = ts22.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
5015
5307
  return {
5016
5308
  startPos,
5017
5309
  startLine: line,
@@ -5034,27 +5326,38 @@ function makeResourceNotFoundError(file, nodeForError, resourceType) {
5034
5326
  }
5035
5327
  return new FatalDiagnosticError(ErrorCode.COMPONENT_RESOURCE_NOT_FOUND, nodeForError, errorText);
5036
5328
  }
5037
- function transformDecoratorToInlineResources(dec, component, styles, template) {
5329
+ function transformDecoratorResources(dec, component, styles, template) {
5038
5330
  if (dec.name !== "Component") {
5039
5331
  return dec;
5040
5332
  }
5041
- if (!component.has("templateUrl") && !component.has("styleUrls")) {
5333
+ if (!component.has("templateUrl") && !component.has("styleUrls") && !component.has("styles")) {
5042
5334
  return dec;
5043
5335
  }
5044
5336
  const metadata = new Map(component);
5045
5337
  if (metadata.has("templateUrl")) {
5046
5338
  metadata.delete("templateUrl");
5047
- metadata.set("template", ts23.factory.createStringLiteral(template.content));
5339
+ metadata.set("template", ts22.factory.createStringLiteral(template.content));
5048
5340
  }
5049
- if (metadata.has("styleUrls")) {
5341
+ if (metadata.has("styleUrls") || metadata.has("styles")) {
5342
+ metadata.delete("styles");
5050
5343
  metadata.delete("styleUrls");
5051
- metadata.set("styles", ts23.factory.createArrayLiteralExpression(styles.map((s) => ts23.factory.createStringLiteral(s))));
5344
+ if (styles.length > 0) {
5345
+ const styleNodes = styles.reduce((result, style) => {
5346
+ if (style.trim().length > 0) {
5347
+ result.push(ts22.factory.createStringLiteral(style));
5348
+ }
5349
+ return result;
5350
+ }, []);
5351
+ if (styleNodes.length > 0) {
5352
+ metadata.set("styles", ts22.factory.createArrayLiteralExpression(styleNodes));
5353
+ }
5354
+ }
5052
5355
  }
5053
5356
  const newMetadataFields = [];
5054
5357
  for (const [name, value] of metadata.entries()) {
5055
- newMetadataFields.push(ts23.factory.createPropertyAssignment(name, value));
5358
+ newMetadataFields.push(ts22.factory.createPropertyAssignment(name, value));
5056
5359
  }
5057
- return __spreadProps(__spreadValues({}, dec), { args: [ts23.factory.createObjectLiteralExpression(newMetadataFields)] });
5360
+ return __spreadProps(__spreadValues({}, dec), { args: [ts22.factory.createObjectLiteralExpression(newMetadataFields)] });
5058
5361
  }
5059
5362
  function extractComponentStyleUrls(evaluator, component) {
5060
5363
  if (!component.has("styleUrls")) {
@@ -5064,9 +5367,9 @@ function extractComponentStyleUrls(evaluator, component) {
5064
5367
  }
5065
5368
  function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
5066
5369
  const styleUrls = [];
5067
- if (ts23.isArrayLiteralExpression(styleUrlsExpr)) {
5370
+ if (ts22.isArrayLiteralExpression(styleUrlsExpr)) {
5068
5371
  for (const styleUrlExpr of styleUrlsExpr.elements) {
5069
- if (ts23.isSpreadElement(styleUrlExpr)) {
5372
+ if (ts22.isSpreadElement(styleUrlExpr)) {
5070
5373
  styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
5071
5374
  } else {
5072
5375
  const styleUrl = evaluator.evaluate(styleUrlExpr);
@@ -5098,10 +5401,10 @@ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
5098
5401
  function extractStyleResources(resourceLoader, component, containingFile) {
5099
5402
  const styles = /* @__PURE__ */ new Set();
5100
5403
  function stringLiteralElements(array) {
5101
- return array.elements.filter((e) => ts23.isStringLiteralLike(e));
5404
+ return array.elements.filter((e) => ts22.isStringLiteralLike(e));
5102
5405
  }
5103
5406
  const styleUrlsExpr = component.get("styleUrls");
5104
- if (styleUrlsExpr !== void 0 && ts23.isArrayLiteralExpression(styleUrlsExpr)) {
5407
+ if (styleUrlsExpr !== void 0 && ts22.isArrayLiteralExpression(styleUrlsExpr)) {
5105
5408
  for (const expression of stringLiteralElements(styleUrlsExpr)) {
5106
5409
  try {
5107
5410
  const resourceUrl = resourceLoader.resolve(expression.text, containingFile);
@@ -5111,7 +5414,7 @@ function extractStyleResources(resourceLoader, component, containingFile) {
5111
5414
  }
5112
5415
  }
5113
5416
  const stylesExpr = component.get("styles");
5114
- if (stylesExpr !== void 0 && ts23.isArrayLiteralExpression(stylesExpr)) {
5417
+ if (stylesExpr !== void 0 && ts22.isArrayLiteralExpression(stylesExpr)) {
5115
5418
  for (const expression of stringLiteralElements(stylesExpr)) {
5116
5419
  styles.add({ path: null, expression });
5117
5420
  }
@@ -5126,112 +5429,6 @@ function _extractTemplateStyleUrls(template) {
5126
5429
  return template.styleUrls.map((url) => ({ url, source: 1, nodeForError }));
5127
5430
  }
5128
5431
 
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
- };
5214
- }
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.`)];
5225
- }
5226
- } else {
5227
- }
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);
5233
- }
5234
-
5235
5432
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/symbol.mjs
5236
5433
  var ComponentSymbol = class extends DirectiveSymbol {
5237
5434
  constructor() {
@@ -5268,7 +5465,6 @@ var ComponentSymbol = class extends DirectiveSymbol {
5268
5465
  };
5269
5466
 
5270
5467
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/util.mjs
5271
- import ts24 from "typescript";
5272
5468
  function collectAnimationNames(value, animationTriggerNames) {
5273
5469
  if (value instanceof Map) {
5274
5470
  const name = value.get("name");
@@ -5288,19 +5484,18 @@ function collectAnimationNames(value, animationTriggerNames) {
5288
5484
  function isAngularAnimationsReference(reference, symbolName) {
5289
5485
  return reference.ownedByModuleGuess === "@angular/animations" && reference.debugName === symbolName;
5290
5486
  }
5291
- var animationTriggerResolver = (ref, args) => {
5487
+ var animationTriggerResolver = (fn, node, resolve, unresolvable) => {
5292
5488
  const animationTriggerMethodName = "trigger";
5293
- if (!isAngularAnimationsReference(ref, animationTriggerMethodName)) {
5294
- return null;
5489
+ if (!isAngularAnimationsReference(fn, animationTriggerMethodName)) {
5490
+ return unresolvable;
5295
5491
  }
5296
- const triggerNameExpression = args[0];
5492
+ const triggerNameExpression = node.arguments[0];
5297
5493
  if (!triggerNameExpression) {
5298
- return null;
5494
+ return unresolvable;
5299
5495
  }
5300
- const factory = ts24.factory;
5301
- return factory.createObjectLiteralExpression([
5302
- factory.createPropertyAssignment(factory.createIdentifier("name"), triggerNameExpression)
5303
- ], true);
5496
+ const res = /* @__PURE__ */ new Map();
5497
+ res.set("name", resolve(triggerNameExpression));
5498
+ return res;
5304
5499
  };
5305
5500
  function validateAndFlattenComponentImports(imports, expr) {
5306
5501
  const flattened = [];
@@ -5331,7 +5526,6 @@ function validateAndFlattenComponentImports(imports, expr) {
5331
5526
  }
5332
5527
 
5333
5528
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
5334
- var EMPTY_MAP = /* @__PURE__ */ new Map();
5335
5529
  var EMPTY_ARRAY = [];
5336
5530
  var ComponentDecoratorHandler = class {
5337
5531
  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) {
@@ -5471,20 +5665,20 @@ var ComponentDecoratorHandler = class {
5471
5665
  if (component.has("providers")) {
5472
5666
  providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
5473
5667
  }
5474
- let imports = null;
5668
+ let resolvedImports = null;
5669
+ let rawImports = null;
5475
5670
  if (component.has("imports") && !metadata.isStandalone) {
5476
5671
  if (diagnostics === void 0) {
5477
5672
  diagnostics = [];
5478
5673
  }
5479
- diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`));
5674
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
5675
+ isPoisoned = true;
5480
5676
  } else if (component.has("imports")) {
5481
5677
  const expr = component.get("imports");
5482
- const imported = this.evaluator.evaluate(expr);
5678
+ const imported = this.evaluator.evaluate(expr, forwardRefResolver);
5483
5679
  const { imports: flattened, diagnostics: importDiagnostics } = validateAndFlattenComponentImports(imported, expr);
5484
- imports = {
5485
- resolved: flattened,
5486
- raw: expr
5487
- };
5680
+ resolvedImports = flattened;
5681
+ rawImports = expr;
5488
5682
  if (importDiagnostics.length > 0) {
5489
5683
  isPoisoned = true;
5490
5684
  if (diagnostics === void 0) {
@@ -5493,6 +5687,17 @@ var ComponentDecoratorHandler = class {
5493
5687
  diagnostics.push(...importDiagnostics);
5494
5688
  }
5495
5689
  }
5690
+ let schemas = null;
5691
+ if (component.has("schemas") && !metadata.isStandalone) {
5692
+ if (diagnostics === void 0) {
5693
+ diagnostics = [];
5694
+ }
5695
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("schemas"), `'schemas' is only valid on a component that is standalone.`));
5696
+ } else if (component.has("schemas")) {
5697
+ schemas = extractSchemas(component.get("schemas"), this.evaluator, "Component");
5698
+ } else if (metadata.isStandalone) {
5699
+ schemas = [];
5700
+ }
5496
5701
  let template;
5497
5702
  if (this.preanalyzeTemplateCache.has(node)) {
5498
5703
  const preanalyzed = this.preanalyzeTemplateCache.get(node);
@@ -5582,7 +5787,7 @@ var ComponentDecoratorHandler = class {
5582
5787
  relativeContextFilePath
5583
5788
  }),
5584
5789
  typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
5585
- classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorToInlineResources(dec, component, styles, template)),
5790
+ classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template)),
5586
5791
  template,
5587
5792
  providersRequiringFactory,
5588
5793
  viewProvidersRequiringFactory,
@@ -5594,7 +5799,9 @@ var ComponentDecoratorHandler = class {
5594
5799
  },
5595
5800
  isPoisoned,
5596
5801
  animationTriggerNames,
5597
- imports
5802
+ rawImports,
5803
+ resolvedImports,
5804
+ schemas
5598
5805
  },
5599
5806
  diagnostics
5600
5807
  };
@@ -5610,7 +5817,7 @@ var ComponentDecoratorHandler = class {
5610
5817
  register(node, analysis) {
5611
5818
  const ref = new Reference(node);
5612
5819
  this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
5613
- type: MetaType.Directive,
5820
+ kind: MetaKind.Directive,
5614
5821
  ref,
5615
5822
  name: node.name.text,
5616
5823
  selector: analysis.meta.selector,
@@ -5624,7 +5831,9 @@ var ComponentDecoratorHandler = class {
5624
5831
  isPoisoned: analysis.isPoisoned,
5625
5832
  isStructural: false,
5626
5833
  isStandalone: analysis.meta.isStandalone,
5627
- animationTriggerNames: analysis.animationTriggerNames
5834
+ imports: analysis.resolvedImports,
5835
+ animationTriggerNames: analysis.animationTriggerNames,
5836
+ schemas: analysis.schemas
5628
5837
  }));
5629
5838
  this.resourceRegistry.registerResources(analysis.resources, node);
5630
5839
  this.injectableRegistry.registerInjectable(node);
@@ -5635,14 +5844,15 @@ var ComponentDecoratorHandler = class {
5635
5844
  }
5636
5845
  const scope = this.scopeReader.getScopeForComponent(node);
5637
5846
  const selector = analysis.meta.selector;
5638
- const matcher = new SelectorMatcher();
5847
+ const matcher = new SelectorMatcher2();
5639
5848
  if (scope !== null) {
5640
- if ((scope.compilation.isPoisoned || scope.exported.isPoisoned) && !this.usePoisonedData) {
5849
+ let { dependencies, isPoisoned } = scope.kind === ComponentScopeKind.NgModule ? scope.compilation : scope;
5850
+ if ((isPoisoned || scope.kind === ComponentScopeKind.NgModule && scope.exported.isPoisoned) && !this.usePoisonedData) {
5641
5851
  return null;
5642
5852
  }
5643
- for (const directive of scope.compilation.directives) {
5644
- if (directive.selector !== null) {
5645
- matcher.addSelectables(CssSelector.parse(directive.selector), directive);
5853
+ for (const dep of dependencies) {
5854
+ if (dep.kind === MetaKind.Directive && dep.selector !== null) {
5855
+ matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
5646
5856
  }
5647
5857
  }
5648
5858
  }
@@ -5659,7 +5869,7 @@ var ComponentDecoratorHandler = class {
5659
5869
  });
5660
5870
  }
5661
5871
  typeCheck(ctx, node, meta) {
5662
- if (this.typeCheckScopeRegistry === null || !ts25.isClassDeclaration(node)) {
5872
+ if (this.typeCheckScopeRegistry === null || !ts23.isClassDeclaration(node)) {
5663
5873
  return;
5664
5874
  }
5665
5875
  if (meta.isPoisoned && !this.usePoisonedData) {
@@ -5685,90 +5895,120 @@ var ComponentDecoratorHandler = class {
5685
5895
  const context = getSourceFile(node);
5686
5896
  const metadata = analysis.meta;
5687
5897
  const data = {
5688
- directives: EMPTY_ARRAY,
5689
- pipes: EMPTY_MAP,
5898
+ declarations: EMPTY_ARRAY,
5690
5899
  declarationListEmitMode: 0
5691
5900
  };
5692
5901
  const diagnostics = [];
5693
- const scope = scopeTemplate(this.scopeReader, this.dtsScopeReader, this.scopeRegistry, this.metaReader, node, analysis, this.usePoisonedData);
5902
+ const scope = this.scopeReader.getScopeForComponent(node);
5694
5903
  if (scope !== null) {
5695
- diagnostics.push(...scope.diagnostics);
5696
- const matcher = new SelectorMatcher();
5697
- for (const dir of scope.directives) {
5698
- if (dir.selector !== null) {
5699
- matcher.addSelectables(CssSelector.parse(dir.selector), dir);
5700
- }
5701
- }
5904
+ const matcher = new SelectorMatcher2();
5702
5905
  const pipes = /* @__PURE__ */ new Map();
5703
- for (const pipe of scope.pipes) {
5704
- pipes.set(pipe.name, pipe.ref);
5906
+ const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
5907
+ for (const dep of dependencies) {
5908
+ if (dep.kind === MetaKind.Directive && dep.selector !== null) {
5909
+ matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
5910
+ } else if (dep.kind === MetaKind.Pipe) {
5911
+ pipes.set(dep.name, dep);
5912
+ }
5705
5913
  }
5706
5914
  const binder = new R3TargetBinder(matcher);
5707
5915
  const bound = binder.bind({ template: metadata.template.nodes });
5708
- const usedDirectives = bound.getUsedDirectives().map((directive) => {
5709
- const type = this.refEmitter.emit(directive.ref, context);
5710
- assertSuccessfulReferenceEmit(type, node.name, directive.isComponent ? "component" : "directive");
5711
- return {
5712
- ref: directive.ref,
5713
- type: type.expression,
5714
- importedFile: type.importedFile,
5715
- selector: directive.selector,
5716
- inputs: directive.inputs.propertyNames,
5717
- outputs: directive.outputs.propertyNames,
5718
- exportAs: directive.exportAs,
5719
- isComponent: directive.isComponent
5720
- };
5721
- });
5722
- const usedPipes = [];
5723
- for (const pipeName of bound.getUsedPipes()) {
5724
- if (!pipes.has(pipeName)) {
5916
+ const used = /* @__PURE__ */ new Set();
5917
+ for (const dir of bound.getUsedDirectives()) {
5918
+ used.add(dir.ref.node);
5919
+ }
5920
+ for (const name of bound.getUsedPipes()) {
5921
+ if (!pipes.has(name)) {
5725
5922
  continue;
5726
5923
  }
5727
- const pipe = pipes.get(pipeName);
5728
- const type = this.refEmitter.emit(pipe, context);
5729
- assertSuccessfulReferenceEmit(type, node.name, "pipe");
5730
- usedPipes.push({
5731
- ref: pipe,
5732
- pipeName,
5733
- expression: type.expression,
5734
- importedFile: type.importedFile
5735
- });
5924
+ used.add(pipes.get(name).ref.node);
5736
5925
  }
5926
+ const declarations = [];
5927
+ const seen = /* @__PURE__ */ new Set();
5928
+ for (const dep of dependencies) {
5929
+ if (seen.has(dep.ref.node)) {
5930
+ continue;
5931
+ }
5932
+ seen.add(dep.ref.node);
5933
+ switch (dep.kind) {
5934
+ case MetaKind.Directive:
5935
+ if (!used.has(dep.ref.node)) {
5936
+ continue;
5937
+ }
5938
+ const dirType = this.refEmitter.emit(dep.ref, context);
5939
+ assertSuccessfulReferenceEmit(dirType, node.name, dep.isComponent ? "component" : "directive");
5940
+ declarations.push({
5941
+ kind: R3TemplateDependencyKind.Directive,
5942
+ ref: dep.ref,
5943
+ type: dirType.expression,
5944
+ importedFile: dirType.importedFile,
5945
+ selector: dep.selector,
5946
+ inputs: dep.inputs.propertyNames,
5947
+ outputs: dep.outputs.propertyNames,
5948
+ exportAs: dep.exportAs,
5949
+ isComponent: dep.isComponent
5950
+ });
5951
+ break;
5952
+ case MetaKind.Pipe:
5953
+ if (!used.has(dep.ref.node)) {
5954
+ continue;
5955
+ }
5956
+ const pipeType = this.refEmitter.emit(dep.ref, context);
5957
+ assertSuccessfulReferenceEmit(pipeType, node.name, "pipe");
5958
+ declarations.push({
5959
+ kind: R3TemplateDependencyKind.Pipe,
5960
+ type: pipeType.expression,
5961
+ name: dep.name,
5962
+ ref: dep.ref,
5963
+ importedFile: pipeType.importedFile
5964
+ });
5965
+ break;
5966
+ case MetaKind.NgModule:
5967
+ const ngModuleType = this.refEmitter.emit(dep.ref, context);
5968
+ assertSuccessfulReferenceEmit(ngModuleType, node.name, "NgModule");
5969
+ declarations.push({
5970
+ kind: R3TemplateDependencyKind.NgModule,
5971
+ type: ngModuleType.expression,
5972
+ importedFile: ngModuleType.importedFile
5973
+ });
5974
+ break;
5975
+ }
5976
+ }
5977
+ const isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
5978
+ const isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
5979
+ const getSemanticReference = (decl) => this.semanticDepGraphUpdater.getSemanticReference(decl.ref.node, decl.type);
5737
5980
  if (this.semanticDepGraphUpdater !== null) {
5738
- symbol.usedDirectives = usedDirectives.map((dir) => this.semanticDepGraphUpdater.getSemanticReference(dir.ref.node, dir.type));
5739
- symbol.usedPipes = usedPipes.map((pipe) => this.semanticDepGraphUpdater.getSemanticReference(pipe.ref.node, pipe.expression));
5981
+ symbol.usedDirectives = declarations.filter(isUsedDirective).map(getSemanticReference);
5982
+ symbol.usedPipes = declarations.filter(isUsedPipe).map(getSemanticReference);
5740
5983
  }
5741
5984
  const cyclesFromDirectives = /* @__PURE__ */ new Map();
5742
- for (const usedDirective of usedDirectives) {
5743
- const cycle = this._checkForCyclicImport(usedDirective.importedFile, usedDirective.type, context);
5744
- if (cycle !== null) {
5745
- cyclesFromDirectives.set(usedDirective, cycle);
5746
- }
5747
- }
5748
5985
  const cyclesFromPipes = /* @__PURE__ */ new Map();
5749
- for (const usedPipe of usedPipes) {
5750
- const cycle = this._checkForCyclicImport(usedPipe.importedFile, usedPipe.expression, context);
5986
+ for (const usedDep of declarations) {
5987
+ const cycle = this._checkForCyclicImport(usedDep.importedFile, usedDep.type, context);
5751
5988
  if (cycle !== null) {
5752
- cyclesFromPipes.set(usedPipe, cycle);
5989
+ switch (usedDep.kind) {
5990
+ case R3TemplateDependencyKind.Directive:
5991
+ cyclesFromDirectives.set(usedDep, cycle);
5992
+ break;
5993
+ case R3TemplateDependencyKind.Pipe:
5994
+ cyclesFromPipes.set(usedDep, cycle);
5995
+ break;
5996
+ }
5753
5997
  }
5754
5998
  }
5755
5999
  const cycleDetected = cyclesFromDirectives.size !== 0 || cyclesFromPipes.size !== 0;
5756
6000
  if (!cycleDetected) {
5757
- for (const { type, importedFile } of usedDirectives) {
6001
+ for (const { type, importedFile } of declarations) {
5758
6002
  this._recordSyntheticImport(importedFile, type, context);
5759
6003
  }
5760
- for (const { expression, importedFile } of usedPipes) {
5761
- this._recordSyntheticImport(importedFile, expression, context);
5762
- }
5763
- const wrapDirectivesAndPipesInClosure = usedDirectives.some((dir) => isExpressionForwardReference(dir.type, node.name, context)) || usedPipes.some((pipe) => isExpressionForwardReference(pipe.expression, node.name, context));
5764
- data.directives = usedDirectives;
5765
- data.pipes = new Map(usedPipes.map((pipe) => [pipe.pipeName, pipe.expression]));
6004
+ const wrapDirectivesAndPipesInClosure = declarations.some((decl) => isExpressionForwardReference(decl.type, node.name, context));
6005
+ data.declarations = declarations;
5766
6006
  data.declarationListEmitMode = wrapDirectivesAndPipesInClosure ? 1 : 0;
5767
6007
  } else {
5768
6008
  if (this.cycleHandlingStrategy === 0) {
5769
- this.scopeRegistry.setComponentRemoteScope(node, usedDirectives.map((dir) => dir.ref), usedPipes.map((pipe) => pipe.ref));
6009
+ this.scopeRegistry.setComponentRemoteScope(node, declarations.filter(isUsedDirective).map((dir) => dir.ref), declarations.filter(isUsedPipe).map((pipe) => pipe.ref));
5770
6010
  symbol.isRemotelyScoped = true;
5771
- if (this.semanticDepGraphUpdater !== null && scope.ngModule !== null) {
6011
+ if (this.semanticDepGraphUpdater !== null && scope.kind === ComponentScopeKind.NgModule && scope.ngModule !== null) {
5772
6012
  const moduleSymbol = this.semanticDepGraphUpdater.getSymbol(scope.ngModule);
5773
6013
  if (!(moduleSymbol instanceof NgModuleSymbol)) {
5774
6014
  throw new Error(`AssertionError: Expected ${scope.ngModule.name} to be an NgModuleSymbol.`);
@@ -5787,6 +6027,10 @@ var ComponentDecoratorHandler = class {
5787
6027
  }
5788
6028
  }
5789
6029
  }
6030
+ if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
6031
+ const standaloneDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader);
6032
+ diagnostics.push(...standaloneDiagnostics);
6033
+ }
5790
6034
  if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr7) {
5791
6035
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
5792
6036
  diagnostics.push(...providerDiagnostics);
@@ -5833,7 +6077,7 @@ var ComponentDecoratorHandler = class {
5833
6077
  for (const styleText of analysis.template.styles) {
5834
6078
  styles.push(styleText);
5835
6079
  }
5836
- analysis.meta.styles = styles;
6080
+ analysis.meta.styles = styles.filter((s) => s.trim().length > 0);
5837
6081
  }
5838
6082
  compileFull(node, analysis, resolution, pool) {
5839
6083
  if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
@@ -5876,10 +6120,35 @@ var ComponentDecoratorHandler = class {
5876
6120
  this.cycleAnalyzer.recordSyntheticImport(origin, imported);
5877
6121
  }
5878
6122
  };
6123
+ function validateStandaloneImports(importRefs, importExpr, metaReader, scopeReader) {
6124
+ const diagnostics = [];
6125
+ for (const ref of importRefs) {
6126
+ const dirMeta = metaReader.getDirectiveMetadata(ref);
6127
+ if (dirMeta !== null) {
6128
+ if (!dirMeta.isStandalone) {
6129
+ diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, importExpr, dirMeta.isComponent ? "component" : "directive"));
6130
+ }
6131
+ continue;
6132
+ }
6133
+ const pipeMeta = metaReader.getPipeMetadata(ref);
6134
+ if (pipeMeta !== null) {
6135
+ if (!pipeMeta.isStandalone) {
6136
+ diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, importExpr, "pipe"));
6137
+ }
6138
+ continue;
6139
+ }
6140
+ const ngModuleMeta = metaReader.getNgModuleMetadata(ref);
6141
+ if (ngModuleMeta !== null) {
6142
+ continue;
6143
+ }
6144
+ diagnostics.push(makeUnknownComponentImportDiagnostic(ref, importExpr));
6145
+ }
6146
+ return diagnostics;
6147
+ }
5879
6148
 
5880
6149
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
5881
6150
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
5882
- import ts26 from "typescript";
6151
+ import ts24 from "typescript";
5883
6152
  var InjectableDecoratorHandler = class {
5884
6153
  constructor(reflector, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
5885
6154
  this.reflector = reflector;
@@ -5970,7 +6239,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5970
6239
  };
5971
6240
  } else if (decorator.args.length === 1) {
5972
6241
  const metaNode = decorator.args[0];
5973
- if (!ts26.isObjectLiteralExpression(metaNode)) {
6242
+ if (!ts24.isObjectLiteralExpression(metaNode)) {
5974
6243
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
5975
6244
  }
5976
6245
  const meta = reflectObjectLiteral(metaNode);
@@ -5978,7 +6247,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
5978
6247
  let deps = void 0;
5979
6248
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
5980
6249
  const depsExpr = meta.get("deps");
5981
- if (!ts26.isArrayLiteralExpression(depsExpr)) {
6250
+ if (!ts24.isArrayLiteralExpression(depsExpr)) {
5982
6251
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
5983
6252
  }
5984
6253
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -6060,12 +6329,12 @@ function getDep(dep, reflector) {
6060
6329
  }
6061
6330
  return true;
6062
6331
  }
6063
- if (ts26.isArrayLiteralExpression(dep)) {
6332
+ if (ts24.isArrayLiteralExpression(dep)) {
6064
6333
  dep.elements.forEach((el) => {
6065
6334
  let isDecorator = false;
6066
- if (ts26.isIdentifier(el)) {
6335
+ if (ts24.isIdentifier(el)) {
6067
6336
  isDecorator = maybeUpdateDecorator(el, reflector);
6068
- } else if (ts26.isNewExpression(el) && ts26.isIdentifier(el.expression)) {
6337
+ } else if (ts24.isNewExpression(el) && ts24.isIdentifier(el.expression)) {
6069
6338
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
6070
6339
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
6071
6340
  }
@@ -6079,7 +6348,7 @@ function getDep(dep, reflector) {
6079
6348
 
6080
6349
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
6081
6350
  import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
6082
- import ts27 from "typescript";
6351
+ import ts25 from "typescript";
6083
6352
  var PipeSymbol = class extends SemanticSymbol {
6084
6353
  constructor(decl, name) {
6085
6354
  super(decl);
@@ -6134,7 +6403,7 @@ var PipeDecoratorHandler = class {
6134
6403
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
6135
6404
  }
6136
6405
  const meta = unwrapExpression(decorator.args[0]);
6137
- if (!ts27.isObjectLiteralExpression(meta)) {
6406
+ if (!ts25.isObjectLiteralExpression(meta)) {
6138
6407
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
6139
6408
  }
6140
6409
  const pipe = reflectObjectLiteral(meta);
@@ -6182,12 +6451,12 @@ var PipeDecoratorHandler = class {
6182
6451
  };
6183
6452
  }
6184
6453
  symbol(node, analysis) {
6185
- return new PipeSymbol(node, analysis.meta.name);
6454
+ return new PipeSymbol(node, analysis.meta.pipeName);
6186
6455
  }
6187
6456
  register(node, analysis) {
6188
6457
  const ref = new Reference(node);
6189
6458
  this.metaRegistry.registerPipeMetadata({
6190
- type: MetaType.Pipe,
6459
+ kind: MetaKind.Pipe,
6191
6460
  ref,
6192
6461
  name: analysis.meta.pipeName,
6193
6462
  nameExpr: analysis.pipeNameExpr,
@@ -6226,25 +6495,21 @@ export {
6226
6495
  PartialEvaluator,
6227
6496
  NoopReferencesRegistry,
6228
6497
  SemanticDepGraphUpdater,
6498
+ MetaKind,
6229
6499
  CompoundMetadataReader,
6230
6500
  DtsMetadataReader,
6231
- flattenInheritedDirectiveMetadata,
6232
6501
  LocalMetadataRegistry,
6233
6502
  CompoundMetadataRegistry,
6234
6503
  InjectableClassRegistry,
6235
6504
  ResourceRegistry,
6505
+ ComponentScopeKind,
6506
+ CompoundComponentScopeReader,
6507
+ MetadataDtsModuleScopeResolver,
6508
+ LocalModuleScopeRegistry,
6509
+ TypeCheckScopeRegistry,
6236
6510
  CompilationMode,
6237
6511
  HandlerFlags,
6238
6512
  aliasTransformFactory,
6239
- isShim,
6240
- copyFileShimData,
6241
- untagAllTsFiles,
6242
- retagAllTsFiles,
6243
- ShimAdapter,
6244
- FactoryGenerator,
6245
- generatedFactoryTransform,
6246
- ShimReferenceTagger,
6247
- SummaryGenerator,
6248
6513
  TraitState,
6249
6514
  TraitCompiler,
6250
6515
  DtsTransformRegistry,
@@ -6263,5 +6528,4 @@ export {
6263
6528
  * Use of this source code is governed by an MIT-style license that can be
6264
6529
  * found in the LICENSE file at https://angular.io/license
6265
6530
  */
6266
- // Closure Compiler ignores @suppress and similar if the comment contains @license.
6267
- //# sourceMappingURL=chunk-26T3CJIJ.js.map
6531
+ //# sourceMappingURL=chunk-GJVJ6GH4.js.map