@angular/core 16.0.0-next.6 → 16.0.0-next.7

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 (40) hide show
  1. package/esm2022/src/application_ref.mjs +1 -3
  2. package/esm2022/src/change_detection/differs/iterable_differs.mjs +1 -1
  3. package/esm2022/src/core_private_export.mjs +2 -3
  4. package/esm2022/src/di/index.mjs +1 -4
  5. package/esm2022/src/errors.mjs +1 -1
  6. package/esm2022/src/hydration/annotate.mjs +4 -2
  7. package/esm2022/src/hydration/api.mjs +6 -37
  8. package/esm2022/src/hydration/error_handling.mjs +8 -8
  9. package/esm2022/src/linker/query_list.mjs +1 -5
  10. package/esm2022/src/linker/view_ref.mjs +1 -1
  11. package/esm2022/src/metadata/ng_module.mjs +1 -2
  12. package/esm2022/src/render3/component_ref.mjs +6 -4
  13. package/esm2022/src/render3/hooks.mjs +32 -28
  14. package/esm2022/src/render3/instructions/shared.mjs +16 -7
  15. package/esm2022/src/render3/pipe.mjs +2 -2
  16. package/esm2022/src/sanitization/url_sanitizer.mjs +7 -6
  17. package/esm2022/src/signals/index.mjs +4 -4
  18. package/esm2022/src/signals/src/graph.mjs +4 -1
  19. package/esm2022/src/signals/src/signal.mjs +15 -1
  20. package/esm2022/src/signals/src/weak_ref.mjs +4 -1
  21. package/esm2022/src/util/decorators.mjs +6 -1
  22. package/esm2022/src/version.mjs +1 -1
  23. package/esm2022/testing/src/fake_async.mjs +2 -2
  24. package/esm2022/testing/src/logger.mjs +3 -3
  25. package/esm2022/testing/src/ng_zone_mock.mjs +3 -3
  26. package/fesm2022/core.mjs +8690 -9455
  27. package/fesm2022/core.mjs.map +1 -1
  28. package/fesm2022/rxjs-interop.mjs +1 -1
  29. package/fesm2022/testing.mjs +7861 -8594
  30. package/fesm2022/testing.mjs.map +1 -1
  31. package/index.d.ts +30 -410
  32. package/package.json +1 -1
  33. package/rxjs-interop/index.d.ts +1 -1
  34. package/schematics/ng-generate/standalone-migration/bundle.js +1470 -1673
  35. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  36. package/testing/index.d.ts +2 -2
  37. package/esm2022/src/di/reflective_errors.mjs +0 -217
  38. package/esm2022/src/di/reflective_injector.mjs +0 -311
  39. package/esm2022/src/di/reflective_key.mjs +0 -73
  40. package/esm2022/src/di/reflective_provider.mjs +0 -209
@@ -3426,7 +3426,7 @@ var FactoryTarget;
3426
3426
  function compileFactoryFunction(meta) {
3427
3427
  const t = variable("t");
3428
3428
  let baseFactoryVar = null;
3429
- const typeForCtor = !isDelegatedFactoryMetadata(meta) ? new BinaryOperatorExpr(BinaryOperator.Or, t, meta.internalType) : t;
3429
+ const typeForCtor = !isDelegatedFactoryMetadata(meta) ? new BinaryOperatorExpr(BinaryOperator.Or, t, meta.type.value) : t;
3430
3430
  let ctorExpr = null;
3431
3431
  if (meta.deps !== null) {
3432
3432
  if (meta.deps !== "invalid") {
@@ -3457,7 +3457,7 @@ function compileFactoryFunction(meta) {
3457
3457
  if (retExpr === null) {
3458
3458
  body.push(importExpr(Identifiers.invalidFactory).callFn([]).toStmt());
3459
3459
  } else if (baseFactoryVar !== null) {
3460
- const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.internalType]);
3460
+ const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.type.value]);
3461
3461
  const baseFactory = new BinaryOperatorExpr(BinaryOperator.Or, baseFactoryVar, baseFactoryVar.set(getInheritedFactoryCall));
3462
3462
  body.push(new ReturnStatement(baseFactory.callFn([typeForCtor])));
3463
3463
  } else {
@@ -4536,13 +4536,12 @@ function compileInjectable(meta, resolveForwardRefs) {
4536
4536
  const factoryMeta = {
4537
4537
  name: meta.name,
4538
4538
  type: meta.type,
4539
- internalType: meta.internalType,
4540
4539
  typeArgumentCount: meta.typeArgumentCount,
4541
4540
  deps: [],
4542
4541
  target: FactoryTarget.Injectable
4543
4542
  };
4544
4543
  if (meta.useClass !== void 0) {
4545
- const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.internalType);
4544
+ const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.type.value);
4546
4545
  let deps = void 0;
4547
4546
  if (meta.deps !== void 0) {
4548
4547
  deps = meta.deps;
@@ -4585,10 +4584,10 @@ function compileInjectable(meta, resolveForwardRefs) {
4585
4584
  } else {
4586
4585
  result = {
4587
4586
  statements: [],
4588
- expression: delegateToFactory(meta.type.value, meta.internalType, resolveForwardRefs)
4587
+ expression: delegateToFactory(meta.type.value, meta.type.value, resolveForwardRefs)
4589
4588
  };
4590
4589
  }
4591
- const token = meta.internalType;
4590
+ const token = meta.type.value;
4592
4591
  const injectableProps = new DefinitionMap();
4593
4592
  injectableProps.set("token", token);
4594
4593
  injectableProps.set("factory", result.expression);
@@ -4605,14 +4604,14 @@ function compileInjectable(meta, resolveForwardRefs) {
4605
4604
  function createInjectableType(meta) {
4606
4605
  return new ExpressionType(importExpr(Identifiers.InjectableDeclaration, [typeWithParameters(meta.type.type, meta.typeArgumentCount)]));
4607
4606
  }
4608
- function delegateToFactory(type, internalType, unwrapForwardRefs) {
4609
- if (type.node === internalType.node) {
4610
- return internalType.prop("\u0275fac");
4607
+ function delegateToFactory(type, useType, unwrapForwardRefs) {
4608
+ if (type.node === useType.node) {
4609
+ return useType.prop("\u0275fac");
4611
4610
  }
4612
4611
  if (!unwrapForwardRefs) {
4613
- return createFactoryFunction(internalType);
4612
+ return createFactoryFunction(useType);
4614
4613
  }
4615
- const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([internalType]);
4614
+ const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([useType]);
4616
4615
  return createFactoryFunction(unwrappedType);
4617
4616
  }
4618
4617
  function createFactoryFunction(type) {
@@ -5125,10 +5124,10 @@ var R3SelectorScopeMode;
5125
5124
  R3SelectorScopeMode2[R3SelectorScopeMode2["Omit"] = 2] = "Omit";
5126
5125
  })(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
5127
5126
  function compileNgModule(meta) {
5128
- const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
5127
+ const { type: moduleType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
5129
5128
  const statements = [];
5130
5129
  const definitionMap = new DefinitionMap();
5131
- definitionMap.set("type", internalType);
5130
+ definitionMap.set("type", moduleType.value);
5132
5131
  if (bootstrap.length > 0) {
5133
5132
  definitionMap.set("bootstrap", refsToArray(bootstrap, containsForwardDecls));
5134
5133
  }
@@ -5154,7 +5153,7 @@ function compileNgModule(meta) {
5154
5153
  }
5155
5154
  if (id !== null) {
5156
5155
  definitionMap.set("id", id);
5157
- statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
5156
+ statements.push(importExpr(Identifiers.registerNgModuleType).callFn([moduleType.value, id]).toStmt());
5158
5157
  }
5159
5158
  const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], void 0, true);
5160
5159
  const type = createNgModuleType(meta);
@@ -5192,7 +5191,7 @@ function createNgModuleType({ type: moduleType, declarations, exports, imports,
5192
5191
  ]));
5193
5192
  }
5194
5193
  function generateSetNgModuleScopeCall(meta) {
5195
- const { adjacentType: moduleType, declarations, imports, exports, containsForwardDecls } = meta;
5194
+ const { type: moduleType, declarations, imports, exports, containsForwardDecls } = meta;
5196
5195
  const scopeMap = new DefinitionMap();
5197
5196
  if (declarations.length > 0) {
5198
5197
  scopeMap.set("declarations", refsToArray(declarations, containsForwardDecls));
@@ -5208,7 +5207,7 @@ function generateSetNgModuleScopeCall(meta) {
5208
5207
  }
5209
5208
  const fnCall = new InvokeFunctionExpr(
5210
5209
  importExpr(Identifiers.setNgModuleScope),
5211
- [moduleType, scopeMap.toLiteralMap()]
5210
+ [moduleType.value, scopeMap.toLiteralMap()]
5212
5211
  );
5213
5212
  const guardedCall = jitOnlyGuardedExpression(fnCall);
5214
5213
  const iife = new FunctionExpr(
@@ -15455,7 +15454,7 @@ var CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
15455
15454
  function baseDirectiveFields(meta, constantPool, bindingParser) {
15456
15455
  const definitionMap = new DefinitionMap();
15457
15456
  const selectors = parseSelectorToR3Selector(meta.selector);
15458
- definitionMap.set("type", meta.internalType);
15457
+ definitionMap.set("type", meta.type.value);
15459
15458
  if (selectors.length > 0) {
15460
15459
  definitionMap.set("selectors", asLiteral(selectors));
15461
15460
  }
@@ -15995,7 +15994,6 @@ var CompilerFacadeImpl = class {
15995
15994
  const metadata = {
15996
15995
  name: facade.name,
15997
15996
  type: wrapReference(facade.type),
15998
- internalType: new WrappedNodeExpr(facade.type),
15999
15997
  typeArgumentCount: 0,
16000
15998
  deps: null,
16001
15999
  pipeName: facade.pipeName,
@@ -16016,7 +16014,6 @@ var CompilerFacadeImpl = class {
16016
16014
  {
16017
16015
  name: facade.name,
16018
16016
  type: wrapReference(facade.type),
16019
- internalType: new WrappedNodeExpr(facade.type),
16020
16017
  typeArgumentCount: facade.typeArgumentCount,
16021
16018
  providedIn: computeProvidedIn(facade.providedIn),
16022
16019
  useClass: convertToProviderExpression(facade, "useClass"),
@@ -16035,7 +16032,6 @@ var CompilerFacadeImpl = class {
16035
16032
  {
16036
16033
  name: facade.type.name,
16037
16034
  type: wrapReference(facade.type),
16038
- internalType: new WrappedNodeExpr(facade.type),
16039
16035
  typeArgumentCount: 0,
16040
16036
  providedIn: computeProvidedIn(facade.providedIn),
16041
16037
  useClass: convertToProviderExpression(facade, "useClass"),
@@ -16052,7 +16048,6 @@ var CompilerFacadeImpl = class {
16052
16048
  const meta = {
16053
16049
  name: facade.name,
16054
16050
  type: wrapReference(facade.type),
16055
- internalType: new WrappedNodeExpr(facade.type),
16056
16051
  providers: facade.providers && facade.providers.length > 0 ? new WrappedNodeExpr(facade.providers) : null,
16057
16052
  imports: facade.imports.map((i) => new WrappedNodeExpr(i))
16058
16053
  };
@@ -16067,8 +16062,6 @@ var CompilerFacadeImpl = class {
16067
16062
  compileNgModule(angularCoreEnv, sourceMapUrl, facade) {
16068
16063
  const meta = {
16069
16064
  type: wrapReference(facade.type),
16070
- internalType: new WrappedNodeExpr(facade.type),
16071
- adjacentType: new WrappedNodeExpr(facade.type),
16072
16065
  bootstrap: facade.bootstrap.map(wrapReference),
16073
16066
  declarations: facade.declarations.map(wrapReference),
16074
16067
  publicDeclarationTypes: null,
@@ -16136,7 +16129,6 @@ var CompilerFacadeImpl = class {
16136
16129
  const factoryRes = compileFactoryFunction({
16137
16130
  name: meta.name,
16138
16131
  type: wrapReference(meta.type),
16139
- internalType: new WrappedNodeExpr(meta.type),
16140
16132
  typeArgumentCount: meta.typeArgumentCount,
16141
16133
  deps: convertR3DependencyMetadataArray(meta.deps),
16142
16134
  target: meta.target
@@ -16147,7 +16139,6 @@ var CompilerFacadeImpl = class {
16147
16139
  const factoryRes = compileFactoryFunction({
16148
16140
  name: meta.type.name,
16149
16141
  type: wrapReference(meta.type),
16150
- internalType: new WrappedNodeExpr(meta.type),
16151
16142
  typeArgumentCount: 0,
16152
16143
  deps: Array.isArray(meta.deps) ? meta.deps.map(convertR3DeclareDependencyMetadata) : meta.deps,
16153
16144
  target: meta.target
@@ -16214,7 +16205,6 @@ function convertDirectiveFacadeToMetadata(facade) {
16214
16205
  typeArgumentCount: 0,
16215
16206
  typeSourceSpan: facade.typeSourceSpan,
16216
16207
  type: wrapReference(facade.type),
16217
- internalType: new WrappedNodeExpr(facade.type),
16218
16208
  deps: null,
16219
16209
  host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host),
16220
16210
  inputs: __spreadValues(__spreadValues({}, inputsFromMetadata), inputsFromType),
@@ -16232,7 +16222,6 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
16232
16222
  name: declaration.type.name,
16233
16223
  type: wrapReference(declaration.type),
16234
16224
  typeSourceSpan,
16235
- internalType: new WrappedNodeExpr(declaration.type),
16236
16225
  selector: (_a = declaration.selector) != null ? _a : null,
16237
16226
  inputs: declaration.inputs ? inputsMappingToInputMetadata(declaration.inputs) : {},
16238
16227
  outputs: (_b = declaration.outputs) != null ? _b : {},
@@ -16474,7 +16463,6 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
16474
16463
  return {
16475
16464
  name: declaration.type.name,
16476
16465
  type: wrapReference(declaration.type),
16477
- internalType: new WrappedNodeExpr(declaration.type),
16478
16466
  typeArgumentCount: 0,
16479
16467
  pipeName: declaration.name,
16480
16468
  deps: null,
@@ -16486,7 +16474,6 @@ function convertDeclareInjectorFacadeToMetadata(declaration) {
16486
16474
  return {
16487
16475
  name: declaration.type.name,
16488
16476
  type: wrapReference(declaration.type),
16489
- internalType: new WrappedNodeExpr(declaration.type),
16490
16477
  providers: declaration.providers !== void 0 && declaration.providers.length > 0 ? new WrappedNodeExpr(declaration.providers) : null,
16491
16478
  imports: declaration.imports !== void 0 ? declaration.imports.map((i) => new WrappedNodeExpr(i)) : []
16492
16479
  };
@@ -16497,7 +16484,7 @@ function publishFacade(global2) {
16497
16484
  }
16498
16485
 
16499
16486
  // bazel-out/darwin-fastbuild/bin/packages/compiler/src/version.mjs
16500
- var VERSION2 = new Version("16.0.0-next.6");
16487
+ var VERSION2 = new Version("16.0.0-next.7");
16501
16488
 
16502
16489
  // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
16503
16490
  var _I18N_ATTR = "i18n";
@@ -17812,7 +17799,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
17812
17799
  function compileDeclareClassMetadata(metadata) {
17813
17800
  const definitionMap = new DefinitionMap();
17814
17801
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
17815
- definitionMap.set("version", literal("16.0.0-next.6"));
17802
+ definitionMap.set("version", literal("16.0.0-next.7"));
17816
17803
  definitionMap.set("ngImport", importExpr(Identifiers.core));
17817
17804
  definitionMap.set("type", metadata.type);
17818
17805
  definitionMap.set("decorators", metadata.decorators);
@@ -17881,8 +17868,8 @@ function createDirectiveDefinitionMap(meta) {
17881
17868
  var _a;
17882
17869
  const definitionMap = new DefinitionMap();
17883
17870
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
17884
- definitionMap.set("version", literal("16.0.0-next.6"));
17885
- definitionMap.set("type", meta.internalType);
17871
+ definitionMap.set("version", literal("16.0.0-next.7"));
17872
+ definitionMap.set("type", meta.type.value);
17886
17873
  if (meta.isStandalone) {
17887
17874
  definitionMap.set("isStandalone", literal(meta.isStandalone));
17888
17875
  }
@@ -18063,9 +18050,9 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
18063
18050
  function compileDeclareFactoryFunction(meta) {
18064
18051
  const definitionMap = new DefinitionMap();
18065
18052
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
18066
- definitionMap.set("version", literal("16.0.0-next.6"));
18053
+ definitionMap.set("version", literal("16.0.0-next.7"));
18067
18054
  definitionMap.set("ngImport", importExpr(Identifiers.core));
18068
- definitionMap.set("type", meta.internalType);
18055
+ definitionMap.set("type", meta.type.value);
18069
18056
  definitionMap.set("deps", compileDependencies(meta.deps));
18070
18057
  definitionMap.set("target", importExpr(Identifiers.FactoryTarget).prop(FactoryTarget[meta.target]));
18071
18058
  return {
@@ -18086,9 +18073,9 @@ function compileDeclareInjectableFromMetadata(meta) {
18086
18073
  function createInjectableDefinitionMap(meta) {
18087
18074
  const definitionMap = new DefinitionMap();
18088
18075
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
18089
- definitionMap.set("version", literal("16.0.0-next.6"));
18076
+ definitionMap.set("version", literal("16.0.0-next.7"));
18090
18077
  definitionMap.set("ngImport", importExpr(Identifiers.core));
18091
- definitionMap.set("type", meta.internalType);
18078
+ definitionMap.set("type", meta.type.value);
18092
18079
  if (meta.providedIn !== void 0) {
18093
18080
  const providedIn = convertFromMaybeForwardRefExpression(meta.providedIn);
18094
18081
  if (providedIn.value !== null) {
@@ -18124,9 +18111,9 @@ function compileDeclareInjectorFromMetadata(meta) {
18124
18111
  function createInjectorDefinitionMap(meta) {
18125
18112
  const definitionMap = new DefinitionMap();
18126
18113
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
18127
- definitionMap.set("version", literal("16.0.0-next.6"));
18114
+ definitionMap.set("version", literal("16.0.0-next.7"));
18128
18115
  definitionMap.set("ngImport", importExpr(Identifiers.core));
18129
- definitionMap.set("type", meta.internalType);
18116
+ definitionMap.set("type", meta.type.value);
18130
18117
  definitionMap.set("providers", meta.providers);
18131
18118
  if (meta.imports.length > 0) {
18132
18119
  definitionMap.set("imports", literalArr(meta.imports));
@@ -18145,9 +18132,9 @@ function compileDeclareNgModuleFromMetadata(meta) {
18145
18132
  function createNgModuleDefinitionMap(meta) {
18146
18133
  const definitionMap = new DefinitionMap();
18147
18134
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
18148
- definitionMap.set("version", literal("16.0.0-next.6"));
18135
+ definitionMap.set("version", literal("16.0.0-next.7"));
18149
18136
  definitionMap.set("ngImport", importExpr(Identifiers.core));
18150
- definitionMap.set("type", meta.internalType);
18137
+ definitionMap.set("type", meta.type.value);
18151
18138
  if (meta.bootstrap.length > 0) {
18152
18139
  definitionMap.set("bootstrap", refsToArray(meta.bootstrap, meta.containsForwardDecls));
18153
18140
  }
@@ -18180,9 +18167,9 @@ function compileDeclarePipeFromMetadata(meta) {
18180
18167
  function createPipeDefinitionMap(meta) {
18181
18168
  const definitionMap = new DefinitionMap();
18182
18169
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
18183
- definitionMap.set("version", literal("16.0.0-next.6"));
18170
+ definitionMap.set("version", literal("16.0.0-next.7"));
18184
18171
  definitionMap.set("ngImport", importExpr(Identifiers.core));
18185
- definitionMap.set("type", meta.internalType);
18172
+ definitionMap.set("type", meta.type.value);
18186
18173
  if (meta.isStandalone) {
18187
18174
  definitionMap.set("isStandalone", literal(meta.isStandalone));
18188
18175
  }
@@ -18197,7 +18184,7 @@ function createPipeDefinitionMap(meta) {
18197
18184
  publishFacade(_global);
18198
18185
 
18199
18186
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/version.mjs
18200
- var VERSION3 = new Version("16.0.0-next.6");
18187
+ var VERSION3 = new Version("16.0.0-next.7");
18201
18188
 
18202
18189
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
18203
18190
  var EmitFlags;
@@ -18322,7 +18309,7 @@ function verifySupportedTypeScriptVersion() {
18322
18309
  var import_typescript90 = __toESM(require("typescript"), 1);
18323
18310
 
18324
18311
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
18325
- var import_typescript19 = __toESM(require("typescript"), 1);
18312
+ var import_typescript14 = __toESM(require("typescript"), 1);
18326
18313
 
18327
18314
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
18328
18315
  var ErrorCode;
@@ -18489,1453 +18476,804 @@ var ExtendedTemplateDiagnosticName;
18489
18476
  ExtendedTemplateDiagnosticName2["SKIP_HYDRATION_NOT_STATIC"] = "skipHydrationNotStatic";
18490
18477
  })(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
18491
18478
 
18492
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
18479
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
18480
+ var import_typescript13 = __toESM(require("typescript"), 1);
18481
+
18482
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
18483
+ var import_typescript7 = __toESM(require("typescript"), 1);
18484
+
18485
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
18493
18486
  var import_typescript5 = __toESM(require("typescript"), 1);
18494
- var Decorator = {
18495
- nodeForError: (decorator) => {
18496
- if (decorator.node !== null) {
18497
- return decorator.node;
18498
- } else {
18499
- return decorator.synthesizedFor;
18500
- }
18501
- }
18502
- };
18503
- function isDecoratorIdentifier(exp) {
18504
- return import_typescript5.default.isIdentifier(exp) || import_typescript5.default.isPropertyAccessExpression(exp) && import_typescript5.default.isIdentifier(exp.expression) && import_typescript5.default.isIdentifier(exp.name);
18487
+ var TS = /\.tsx?$/i;
18488
+ var D_TS = /\.d\.ts$/i;
18489
+ function isSymbolWithValueDeclaration(symbol) {
18490
+ return symbol != null && symbol.valueDeclaration !== void 0 && symbol.declarations !== void 0;
18505
18491
  }
18506
- var ClassMemberKind;
18507
- (function(ClassMemberKind2) {
18508
- ClassMemberKind2[ClassMemberKind2["Constructor"] = 0] = "Constructor";
18509
- ClassMemberKind2[ClassMemberKind2["Getter"] = 1] = "Getter";
18510
- ClassMemberKind2[ClassMemberKind2["Setter"] = 2] = "Setter";
18511
- ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
18512
- ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
18513
- })(ClassMemberKind || (ClassMemberKind = {}));
18514
- var KnownDeclaration;
18515
- (function(KnownDeclaration2) {
18516
- KnownDeclaration2[KnownDeclaration2["JsGlobalObject"] = 0] = "JsGlobalObject";
18517
- KnownDeclaration2[KnownDeclaration2["TsHelperAssign"] = 1] = "TsHelperAssign";
18518
- KnownDeclaration2[KnownDeclaration2["TsHelperSpread"] = 2] = "TsHelperSpread";
18519
- KnownDeclaration2[KnownDeclaration2["TsHelperSpreadArrays"] = 3] = "TsHelperSpreadArrays";
18520
- KnownDeclaration2[KnownDeclaration2["TsHelperSpreadArray"] = 4] = "TsHelperSpreadArray";
18521
- KnownDeclaration2[KnownDeclaration2["TsHelperRead"] = 5] = "TsHelperRead";
18522
- })(KnownDeclaration || (KnownDeclaration = {}));
18523
- function isConcreteDeclaration(decl) {
18524
- return decl.kind === 0;
18492
+ function isDtsPath(filePath) {
18493
+ return D_TS.test(filePath);
18525
18494
  }
18526
-
18527
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
18528
- var import_typescript6 = __toESM(require("typescript"), 1);
18529
- function typeToValue(typeNode, checker) {
18530
- if (typeNode === null) {
18531
- return missingType();
18532
- }
18533
- if (!import_typescript6.default.isTypeReferenceNode(typeNode)) {
18534
- return unsupportedType(typeNode);
18535
- }
18536
- const symbols = resolveTypeSymbols(typeNode, checker);
18537
- if (symbols === null) {
18538
- return unknownReference(typeNode);
18539
- }
18540
- const { local, decl } = symbols;
18541
- if (decl.valueDeclaration === void 0 || decl.flags & import_typescript6.default.SymbolFlags.ConstEnum) {
18542
- let typeOnlyDecl = null;
18543
- if (decl.declarations !== void 0 && decl.declarations.length > 0) {
18544
- typeOnlyDecl = decl.declarations[0];
18545
- }
18546
- return noValueDeclaration(typeNode, typeOnlyDecl);
18547
- }
18548
- const firstDecl = local.declarations && local.declarations[0];
18549
- if (firstDecl !== void 0) {
18550
- if (import_typescript6.default.isImportClause(firstDecl) && firstDecl.name !== void 0) {
18551
- if (firstDecl.isTypeOnly) {
18552
- return typeOnlyImport(typeNode, firstDecl);
18553
- }
18554
- return {
18555
- kind: 0,
18556
- expression: firstDecl.name,
18557
- defaultImportStatement: firstDecl.parent
18558
- };
18559
- } else if (import_typescript6.default.isImportSpecifier(firstDecl)) {
18560
- if (firstDecl.isTypeOnly) {
18561
- return typeOnlyImport(typeNode, firstDecl);
18562
- }
18563
- if (firstDecl.parent.parent.isTypeOnly) {
18564
- return typeOnlyImport(typeNode, firstDecl.parent.parent);
18565
- }
18566
- const importedName = (firstDecl.propertyName || firstDecl.name).text;
18567
- const [_localName, ...nestedPath] = symbols.symbolNames;
18568
- const moduleName = extractModuleName(firstDecl.parent.parent.parent);
18569
- return {
18570
- kind: 1,
18571
- valueDeclaration: decl.valueDeclaration,
18572
- moduleName,
18573
- importedName,
18574
- nestedPath
18575
- };
18576
- } else if (import_typescript6.default.isNamespaceImport(firstDecl)) {
18577
- if (firstDecl.parent.isTypeOnly) {
18578
- return typeOnlyImport(typeNode, firstDecl.parent);
18579
- }
18580
- if (symbols.symbolNames.length === 1) {
18581
- return namespaceImport(typeNode, firstDecl.parent);
18582
- }
18583
- const [_ns, importedName, ...nestedPath] = symbols.symbolNames;
18584
- const moduleName = extractModuleName(firstDecl.parent.parent);
18585
- return {
18586
- kind: 1,
18587
- valueDeclaration: decl.valueDeclaration,
18588
- moduleName,
18589
- importedName,
18590
- nestedPath
18591
- };
18592
- }
18495
+ function isNonDeclarationTsPath(filePath) {
18496
+ return TS.test(filePath) && !D_TS.test(filePath);
18497
+ }
18498
+ function isFromDtsFile(node) {
18499
+ let sf = node.getSourceFile();
18500
+ if (sf === void 0) {
18501
+ sf = import_typescript5.default.getOriginalNode(node).getSourceFile();
18593
18502
  }
18594
- const expression = typeNodeToValueExpr(typeNode);
18595
- if (expression !== null) {
18596
- return {
18597
- kind: 0,
18598
- expression,
18599
- defaultImportStatement: null
18600
- };
18503
+ return sf !== void 0 && sf.isDeclarationFile;
18504
+ }
18505
+ function nodeNameForError(node) {
18506
+ if (node.name !== void 0 && import_typescript5.default.isIdentifier(node.name)) {
18507
+ return node.name.text;
18601
18508
  } else {
18602
- return unsupportedType(typeNode);
18509
+ const kind = import_typescript5.default.SyntaxKind[node.kind];
18510
+ const { line, character } = import_typescript5.default.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart());
18511
+ return `${kind}@${line}:${character}`;
18603
18512
  }
18604
18513
  }
18605
- function unsupportedType(typeNode) {
18606
- return {
18607
- kind: 2,
18608
- reason: { kind: 5, typeNode }
18609
- };
18610
- }
18611
- function noValueDeclaration(typeNode, decl) {
18612
- return {
18613
- kind: 2,
18614
- reason: { kind: 1, typeNode, decl }
18615
- };
18616
- }
18617
- function typeOnlyImport(typeNode, node) {
18618
- return {
18619
- kind: 2,
18620
- reason: { kind: 2, typeNode, node }
18621
- };
18622
- }
18623
- function unknownReference(typeNode) {
18624
- return {
18625
- kind: 2,
18626
- reason: { kind: 3, typeNode }
18627
- };
18514
+ function getSourceFile(node) {
18515
+ const directSf = node.getSourceFile();
18516
+ return directSf !== void 0 ? directSf : import_typescript5.default.getOriginalNode(node).getSourceFile();
18628
18517
  }
18629
- function namespaceImport(typeNode, importClause) {
18630
- return {
18631
- kind: 2,
18632
- reason: { kind: 4, typeNode, importClause }
18633
- };
18518
+ function getSourceFileOrNull(program, fileName) {
18519
+ return program.getSourceFile(fileName) || null;
18634
18520
  }
18635
- function missingType() {
18636
- return {
18637
- kind: 2,
18638
- reason: { kind: 0 }
18639
- };
18521
+ function getTokenAtPosition(sf, pos) {
18522
+ return import_typescript5.default.getTokenAtPosition(sf, pos);
18640
18523
  }
18641
- function typeNodeToValueExpr(node) {
18642
- if (import_typescript6.default.isTypeReferenceNode(node)) {
18643
- return entityNameToValue(node.typeName);
18524
+ function identifierOfNode(decl) {
18525
+ if (decl.name !== void 0 && import_typescript5.default.isIdentifier(decl.name)) {
18526
+ return decl.name;
18644
18527
  } else {
18645
18528
  return null;
18646
18529
  }
18647
18530
  }
18648
- function resolveTypeSymbols(typeRef, checker) {
18649
- const typeName = typeRef.typeName;
18650
- const typeRefSymbol = checker.getSymbolAtLocation(typeName);
18651
- if (typeRefSymbol === void 0) {
18652
- return null;
18653
- }
18654
- let local = typeRefSymbol;
18655
- let leftMost = typeName;
18656
- const symbolNames = [];
18657
- while (import_typescript6.default.isQualifiedName(leftMost)) {
18658
- symbolNames.unshift(leftMost.right.text);
18659
- leftMost = leftMost.left;
18660
- }
18661
- symbolNames.unshift(leftMost.text);
18662
- if (leftMost !== typeName) {
18663
- const localTmp = checker.getSymbolAtLocation(leftMost);
18664
- if (localTmp !== void 0) {
18665
- local = localTmp;
18666
- }
18667
- }
18668
- let decl = typeRefSymbol;
18669
- if (typeRefSymbol.flags & import_typescript6.default.SymbolFlags.Alias) {
18670
- decl = checker.getAliasedSymbol(typeRefSymbol);
18671
- }
18672
- return { local, decl, symbolNames };
18531
+ function isDeclaration(node) {
18532
+ return isValueDeclaration(node) || isTypeDeclaration(node);
18673
18533
  }
18674
- function entityNameToValue(node) {
18675
- if (import_typescript6.default.isQualifiedName(node)) {
18676
- const left = entityNameToValue(node.left);
18677
- return left !== null ? import_typescript6.default.factory.createPropertyAccessExpression(left, node.right) : null;
18678
- } else if (import_typescript6.default.isIdentifier(node)) {
18679
- const clone = import_typescript6.default.setOriginalNode(import_typescript6.default.factory.createIdentifier(node.text), node);
18680
- clone.parent = node.parent;
18681
- return clone;
18534
+ function isValueDeclaration(node) {
18535
+ return import_typescript5.default.isClassDeclaration(node) || import_typescript5.default.isFunctionDeclaration(node) || import_typescript5.default.isVariableDeclaration(node);
18536
+ }
18537
+ function isTypeDeclaration(node) {
18538
+ return import_typescript5.default.isEnumDeclaration(node) || import_typescript5.default.isTypeAliasDeclaration(node) || import_typescript5.default.isInterfaceDeclaration(node);
18539
+ }
18540
+ function isNamedDeclaration(node) {
18541
+ const namedNode = node;
18542
+ return namedNode.name !== void 0 && import_typescript5.default.isIdentifier(namedNode.name);
18543
+ }
18544
+ function getRootDirs(host, options) {
18545
+ const rootDirs = [];
18546
+ const cwd = host.getCurrentDirectory();
18547
+ const fs3 = getFileSystem();
18548
+ if (options.rootDirs !== void 0) {
18549
+ rootDirs.push(...options.rootDirs);
18550
+ } else if (options.rootDir !== void 0) {
18551
+ rootDirs.push(options.rootDir);
18682
18552
  } else {
18683
- return null;
18553
+ rootDirs.push(cwd);
18684
18554
  }
18555
+ return rootDirs.map((rootDir) => fs3.resolve(cwd, host.getCanonicalFileName(rootDir)));
18685
18556
  }
18686
- function extractModuleName(node) {
18687
- if (!import_typescript6.default.isStringLiteral(node.moduleSpecifier)) {
18688
- throw new Error("not a module specifier");
18557
+ function nodeDebugInfo(node) {
18558
+ const sf = getSourceFile(node);
18559
+ const { line, character } = import_typescript5.default.getLineAndCharacterOfPosition(sf, node.pos);
18560
+ return `[${sf.fileName}: ${import_typescript5.default.SyntaxKind[node.kind]} @ ${line}:${character}]`;
18561
+ }
18562
+ function resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache) {
18563
+ if (compilerHost.resolveModuleNames) {
18564
+ return compilerHost.resolveModuleNames(
18565
+ [moduleName],
18566
+ containingFile,
18567
+ void 0,
18568
+ void 0,
18569
+ compilerOptions
18570
+ )[0];
18571
+ } else {
18572
+ return import_typescript5.default.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache !== null ? moduleResolutionCache : void 0).resolvedModule;
18689
18573
  }
18690
- return node.moduleSpecifier.text;
18691
18574
  }
18692
-
18693
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
18694
- var import_typescript8 = __toESM(require("typescript"), 1);
18695
-
18696
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
18697
- var import_typescript7 = __toESM(require("typescript"), 1);
18698
- function isNamedClassDeclaration(node) {
18699
- return import_typescript7.default.isClassDeclaration(node) && isIdentifier(node.name);
18575
+ function isAssignment(node) {
18576
+ return import_typescript5.default.isBinaryExpression(node) && node.operatorToken.kind === import_typescript5.default.SyntaxKind.EqualsToken;
18700
18577
  }
18701
- function isIdentifier(node) {
18702
- return node !== void 0 && import_typescript7.default.isIdentifier(node);
18578
+ function toUnredirectedSourceFile(sf) {
18579
+ const redirectInfo = sf.redirectInfo;
18580
+ if (redirectInfo === void 0) {
18581
+ return sf;
18582
+ }
18583
+ return redirectInfo.unredirected;
18703
18584
  }
18704
18585
 
18705
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
18706
- var TypeScriptReflectionHost = class {
18707
- constructor(checker) {
18708
- this.checker = checker;
18709
- }
18710
- getDecoratorsOfDeclaration(declaration) {
18711
- const decorators = import_typescript8.default.canHaveDecorators(declaration) ? import_typescript8.default.getDecorators(declaration) : void 0;
18712
- return decorators !== void 0 && decorators.length ? decorators.map((decorator) => this._reflectDecorator(decorator)).filter((dec) => dec !== null) : null;
18713
- }
18714
- getMembersOfClass(clazz) {
18715
- const tsClazz = castDeclarationToClassOrDie(clazz);
18716
- return tsClazz.members.map((member) => this._reflectMember(member)).filter((member) => member !== null);
18586
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
18587
+ function findExportedNameOfNode(target, file, reflector) {
18588
+ const exports = reflector.getExportsOfModule(file);
18589
+ if (exports === null) {
18590
+ return null;
18717
18591
  }
18718
- getConstructorParameters(clazz) {
18719
- const tsClazz = castDeclarationToClassOrDie(clazz);
18720
- const isDeclaration2 = tsClazz.getSourceFile().isDeclarationFile;
18721
- const ctor = tsClazz.members.find((member) => import_typescript8.default.isConstructorDeclaration(member) && (isDeclaration2 || member.body !== void 0));
18722
- if (ctor === void 0) {
18723
- return null;
18592
+ const declaredName = isNamedDeclaration(target) ? target.name.text : null;
18593
+ let foundExportName = null;
18594
+ for (const [exportName, declaration] of exports) {
18595
+ if (declaration.node !== target) {
18596
+ continue;
18724
18597
  }
18725
- return ctor.parameters.map((node) => {
18726
- const name = parameterName(node.name);
18727
- const decorators = this.getDecoratorsOfDeclaration(node);
18728
- let originalTypeNode = node.type || null;
18729
- let typeNode = originalTypeNode;
18730
- if (typeNode && import_typescript8.default.isUnionTypeNode(typeNode)) {
18731
- let childTypeNodes = typeNode.types.filter((childTypeNode) => !(import_typescript8.default.isLiteralTypeNode(childTypeNode) && childTypeNode.literal.kind === import_typescript8.default.SyntaxKind.NullKeyword));
18732
- if (childTypeNodes.length === 1) {
18733
- typeNode = childTypeNodes[0];
18734
- }
18735
- }
18736
- const typeValueReference = typeToValue(typeNode, this.checker);
18737
- return {
18738
- name,
18739
- nameNode: node.name,
18740
- typeValueReference,
18741
- typeNode: originalTypeNode,
18742
- decorators
18743
- };
18744
- });
18745
- }
18746
- getImportOfIdentifier(id) {
18747
- const directImport = this.getDirectImportOfIdentifier(id);
18748
- if (directImport !== null) {
18749
- return directImport;
18750
- } else if (import_typescript8.default.isQualifiedName(id.parent) && id.parent.right === id) {
18751
- return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent));
18752
- } else if (import_typescript8.default.isPropertyAccessExpression(id.parent) && id.parent.name === id) {
18753
- return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent));
18754
- } else {
18755
- return null;
18598
+ if (exportName === declaredName) {
18599
+ return exportName;
18756
18600
  }
18601
+ foundExportName = exportName;
18757
18602
  }
18758
- getExportsOfModule(node) {
18759
- if (!import_typescript8.default.isSourceFile(node)) {
18760
- throw new Error(`getExportsOfModule() called on non-SourceFile in TS code`);
18761
- }
18762
- const symbol = this.checker.getSymbolAtLocation(node);
18763
- if (symbol === void 0) {
18764
- return null;
18765
- }
18766
- const map = /* @__PURE__ */ new Map();
18767
- this.checker.getExportsOfModule(symbol).forEach((exportSymbol) => {
18768
- const decl = this.getDeclarationOfSymbol(exportSymbol, null);
18769
- if (decl !== null) {
18770
- map.set(exportSymbol.name, decl);
18771
- }
18772
- });
18773
- return map;
18603
+ return foundExportName;
18604
+ }
18605
+
18606
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
18607
+ var ImportFlags;
18608
+ (function(ImportFlags2) {
18609
+ ImportFlags2[ImportFlags2["None"] = 0] = "None";
18610
+ ImportFlags2[ImportFlags2["ForceNewImport"] = 1] = "ForceNewImport";
18611
+ ImportFlags2[ImportFlags2["NoAliasing"] = 2] = "NoAliasing";
18612
+ ImportFlags2[ImportFlags2["AllowTypeImports"] = 4] = "AllowTypeImports";
18613
+ ImportFlags2[ImportFlags2["AllowRelativeDtsImports"] = 8] = "AllowRelativeDtsImports";
18614
+ })(ImportFlags || (ImportFlags = {}));
18615
+ function assertSuccessfulReferenceEmit(result, origin, typeKind) {
18616
+ if (result.kind === 0) {
18617
+ return;
18774
18618
  }
18775
- isClass(node) {
18776
- return isNamedClassDeclaration(node);
18619
+ const message = makeDiagnosticChain(`Unable to import ${typeKind} ${nodeNameForError(result.ref.node)}.`, [makeDiagnosticChain(result.reason)]);
18620
+ throw new FatalDiagnosticError(ErrorCode.IMPORT_GENERATION_FAILURE, origin, message, [makeRelatedInformation(result.ref.node, `The ${typeKind} is declared here.`)]);
18621
+ }
18622
+ var ReferenceEmitter = class {
18623
+ constructor(strategies) {
18624
+ this.strategies = strategies;
18777
18625
  }
18778
- hasBaseClass(clazz) {
18779
- return this.getBaseClassExpression(clazz) !== null;
18626
+ emit(ref, context, importFlags = ImportFlags.None) {
18627
+ for (const strategy of this.strategies) {
18628
+ const emitted = strategy.emit(ref, context, importFlags);
18629
+ if (emitted !== null) {
18630
+ return emitted;
18631
+ }
18632
+ }
18633
+ return {
18634
+ kind: 1,
18635
+ ref,
18636
+ context,
18637
+ reason: `Unable to write a reference to ${nodeNameForError(ref.node)}.`
18638
+ };
18780
18639
  }
18781
- getBaseClassExpression(clazz) {
18782
- if (!(import_typescript8.default.isClassDeclaration(clazz) || import_typescript8.default.isClassExpression(clazz)) || clazz.heritageClauses === void 0) {
18640
+ };
18641
+ var LocalIdentifierStrategy = class {
18642
+ emit(ref, context, importFlags) {
18643
+ const refSf = getSourceFile(ref.node);
18644
+ if (importFlags & ImportFlags.ForceNewImport && refSf !== context) {
18783
18645
  return null;
18784
18646
  }
18785
- const extendsClause = clazz.heritageClauses.find((clause) => clause.token === import_typescript8.default.SyntaxKind.ExtendsKeyword);
18786
- if (extendsClause === void 0) {
18787
- return null;
18647
+ if (!isDeclaration(ref.node) && refSf === context) {
18648
+ return {
18649
+ kind: 0,
18650
+ expression: new WrappedNodeExpr(ref.node),
18651
+ importedFile: null
18652
+ };
18788
18653
  }
18789
- const extendsType = extendsClause.types[0];
18790
- if (extendsType === void 0) {
18654
+ const identifier = ref.getIdentityIn(context);
18655
+ if (identifier !== null) {
18656
+ return {
18657
+ kind: 0,
18658
+ expression: new WrappedNodeExpr(identifier),
18659
+ importedFile: null
18660
+ };
18661
+ } else {
18791
18662
  return null;
18792
18663
  }
18793
- return extendsType.expression;
18794
18664
  }
18795
- getDeclarationOfIdentifier(id) {
18796
- let symbol = this.checker.getSymbolAtLocation(id);
18797
- if (symbol === void 0) {
18798
- return null;
18799
- }
18800
- return this.getDeclarationOfSymbol(symbol, id);
18665
+ };
18666
+ var AbsoluteModuleStrategy = class {
18667
+ constructor(program, checker, moduleResolver, reflectionHost) {
18668
+ this.program = program;
18669
+ this.checker = checker;
18670
+ this.moduleResolver = moduleResolver;
18671
+ this.reflectionHost = reflectionHost;
18672
+ this.moduleExportsCache = /* @__PURE__ */ new Map();
18801
18673
  }
18802
- getDefinitionOfFunction(node) {
18803
- if (!import_typescript8.default.isFunctionDeclaration(node) && !import_typescript8.default.isMethodDeclaration(node) && !import_typescript8.default.isFunctionExpression(node)) {
18674
+ emit(ref, context, importFlags) {
18675
+ if (ref.bestGuessOwningModule === null) {
18804
18676
  return null;
18677
+ } else if (!isDeclaration(ref.node)) {
18678
+ throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${import_typescript7.default.SyntaxKind[ref.node.kind]}.`);
18679
+ } else if ((importFlags & ImportFlags.AllowTypeImports) === 0 && isTypeDeclaration(ref.node)) {
18680
+ throw new Error(`Importing a type-only declaration of type ${import_typescript7.default.SyntaxKind[ref.node.kind]} in a value position is not allowed.`);
18681
+ }
18682
+ const { specifier, resolutionContext } = ref.bestGuessOwningModule;
18683
+ const exports = this.getExportsOfModule(specifier, resolutionContext);
18684
+ if (exports.module === null) {
18685
+ return {
18686
+ kind: 1,
18687
+ ref,
18688
+ context,
18689
+ reason: `The module '${specifier}' could not be found.`
18690
+ };
18691
+ } else if (exports.exportMap === null || !exports.exportMap.has(ref.node)) {
18692
+ return {
18693
+ kind: 1,
18694
+ ref,
18695
+ context,
18696
+ reason: `The symbol is not exported from ${exports.module.fileName} (module '${specifier}').`
18697
+ };
18805
18698
  }
18699
+ const symbolName = exports.exportMap.get(ref.node);
18806
18700
  return {
18807
- node,
18808
- body: node.body !== void 0 ? Array.from(node.body.statements) : null,
18809
- parameters: node.parameters.map((param) => {
18810
- const name = parameterName(param.name);
18811
- const initializer = param.initializer || null;
18812
- return { name, node: param, initializer };
18813
- })
18701
+ kind: 0,
18702
+ expression: new ExternalExpr(new ExternalReference(specifier, symbolName)),
18703
+ importedFile: exports.module
18814
18704
  };
18815
18705
  }
18816
- getGenericArityOfClass(clazz) {
18817
- if (!import_typescript8.default.isClassDeclaration(clazz)) {
18818
- return null;
18706
+ getExportsOfModule(moduleName, fromFile) {
18707
+ if (!this.moduleExportsCache.has(moduleName)) {
18708
+ this.moduleExportsCache.set(moduleName, this.enumerateExportsOfModule(moduleName, fromFile));
18819
18709
  }
18820
- return clazz.typeParameters !== void 0 ? clazz.typeParameters.length : 0;
18821
- }
18822
- getVariableValue(declaration) {
18823
- return declaration.initializer || null;
18824
- }
18825
- getDtsDeclaration(_) {
18826
- return null;
18827
- }
18828
- getInternalNameOfClass(clazz) {
18829
- return clazz.name;
18830
- }
18831
- getAdjacentNameOfClass(clazz) {
18832
- return clazz.name;
18710
+ return this.moduleExportsCache.get(moduleName);
18833
18711
  }
18834
- isStaticallyExported(decl) {
18835
- let topLevel = decl;
18836
- if (import_typescript8.default.isVariableDeclaration(decl) && import_typescript8.default.isVariableDeclarationList(decl.parent)) {
18837
- topLevel = decl.parent.parent;
18712
+ enumerateExportsOfModule(specifier, fromFile) {
18713
+ const entryPointFile = this.moduleResolver.resolveModule(specifier, fromFile);
18714
+ if (entryPointFile === null) {
18715
+ return { module: null, exportMap: null };
18838
18716
  }
18839
- const modifiers = import_typescript8.default.canHaveModifiers(topLevel) ? import_typescript8.default.getModifiers(topLevel) : void 0;
18840
- if (modifiers !== void 0 && modifiers.some((modifier) => modifier.kind === import_typescript8.default.SyntaxKind.ExportKeyword)) {
18841
- return true;
18717
+ const exports = this.reflectionHost.getExportsOfModule(entryPointFile);
18718
+ if (exports === null) {
18719
+ return { module: entryPointFile, exportMap: null };
18842
18720
  }
18843
- if (topLevel.parent === void 0 || !import_typescript8.default.isSourceFile(topLevel.parent)) {
18844
- return false;
18721
+ const exportMap = /* @__PURE__ */ new Map();
18722
+ for (const [name, declaration] of exports) {
18723
+ if (exportMap.has(declaration.node)) {
18724
+ const existingExport = exportMap.get(declaration.node);
18725
+ if (isNamedDeclaration(declaration.node) && declaration.node.name.text === existingExport) {
18726
+ continue;
18727
+ }
18728
+ }
18729
+ exportMap.set(declaration.node, name);
18845
18730
  }
18846
- const localExports = this.getLocalExportedDeclarationsOfSourceFile(decl.getSourceFile());
18847
- return localExports.has(decl);
18731
+ return { module: entryPointFile, exportMap };
18848
18732
  }
18849
- getDirectImportOfIdentifier(id) {
18850
- const symbol = this.checker.getSymbolAtLocation(id);
18851
- if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
18852
- return null;
18853
- }
18854
- const decl = symbol.declarations[0];
18855
- const importDecl = getContainingImportDeclaration(decl);
18856
- if (importDecl === null) {
18857
- return null;
18858
- }
18859
- if (!import_typescript8.default.isStringLiteral(importDecl.moduleSpecifier)) {
18860
- return null;
18861
- }
18862
- return { from: importDecl.moduleSpecifier.text, name: getExportedName(decl, id) };
18733
+ };
18734
+ var LogicalProjectStrategy = class {
18735
+ constructor(reflector, logicalFs) {
18736
+ this.reflector = reflector;
18737
+ this.logicalFs = logicalFs;
18738
+ this.relativePathStrategy = new RelativePathStrategy(this.reflector);
18863
18739
  }
18864
- getImportOfNamespacedIdentifier(id, namespaceIdentifier) {
18865
- if (namespaceIdentifier === null) {
18866
- return null;
18867
- }
18868
- const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier);
18869
- if (!namespaceSymbol || namespaceSymbol.declarations === void 0) {
18870
- return null;
18740
+ emit(ref, context, importFlags) {
18741
+ const destSf = getSourceFile(ref.node);
18742
+ const destPath = this.logicalFs.logicalPathOfSf(destSf);
18743
+ if (destPath === null) {
18744
+ if (destSf.isDeclarationFile && importFlags & ImportFlags.AllowRelativeDtsImports) {
18745
+ return this.relativePathStrategy.emit(ref, context);
18746
+ }
18747
+ return {
18748
+ kind: 1,
18749
+ ref,
18750
+ context,
18751
+ reason: `The file ${destSf.fileName} is outside of the configured 'rootDir'.`
18752
+ };
18871
18753
  }
18872
- const declaration = namespaceSymbol.declarations.length === 1 ? namespaceSymbol.declarations[0] : null;
18873
- if (!declaration) {
18874
- return null;
18754
+ const originPath = this.logicalFs.logicalPathOfSf(context);
18755
+ if (originPath === null) {
18756
+ throw new Error(`Debug assert: attempt to import from ${context.fileName} but it's outside the program?`);
18875
18757
  }
18876
- const namespaceDeclaration = import_typescript8.default.isNamespaceImport(declaration) ? declaration : null;
18877
- if (!namespaceDeclaration) {
18758
+ if (destPath === originPath) {
18878
18759
  return null;
18879
18760
  }
18880
- const importDeclaration = namespaceDeclaration.parent.parent;
18881
- if (!import_typescript8.default.isStringLiteral(importDeclaration.moduleSpecifier)) {
18882
- return null;
18761
+ const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
18762
+ if (name === null) {
18763
+ return {
18764
+ kind: 1,
18765
+ ref,
18766
+ context,
18767
+ reason: `The symbol is not exported from ${destSf.fileName}.`
18768
+ };
18883
18769
  }
18770
+ const moduleName = LogicalProjectPath.relativePathBetween(originPath, destPath);
18884
18771
  return {
18885
- from: importDeclaration.moduleSpecifier.text,
18886
- name: id.text
18772
+ kind: 0,
18773
+ expression: new ExternalExpr({ moduleName, name }),
18774
+ importedFile: destSf
18887
18775
  };
18888
18776
  }
18889
- getDeclarationOfSymbol(symbol, originalId) {
18890
- let valueDeclaration = void 0;
18891
- if (symbol.valueDeclaration !== void 0) {
18892
- valueDeclaration = symbol.valueDeclaration;
18893
- } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
18894
- valueDeclaration = symbol.declarations[0];
18895
- }
18896
- if (valueDeclaration !== void 0 && import_typescript8.default.isShorthandPropertyAssignment(valueDeclaration)) {
18897
- const shorthandSymbol = this.checker.getShorthandAssignmentValueSymbol(valueDeclaration);
18898
- if (shorthandSymbol === void 0) {
18899
- return null;
18900
- }
18901
- return this.getDeclarationOfSymbol(shorthandSymbol, originalId);
18902
- } else if (valueDeclaration !== void 0 && import_typescript8.default.isExportSpecifier(valueDeclaration)) {
18903
- const targetSymbol = this.checker.getExportSpecifierLocalTargetSymbol(valueDeclaration);
18904
- if (targetSymbol === void 0) {
18905
- return null;
18906
- }
18907
- return this.getDeclarationOfSymbol(targetSymbol, originalId);
18908
- }
18909
- const importInfo = originalId && this.getImportOfIdentifier(originalId);
18910
- const viaModule = importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
18911
- while (symbol.flags & import_typescript8.default.SymbolFlags.Alias) {
18912
- symbol = this.checker.getAliasedSymbol(symbol);
18913
- }
18914
- if (symbol.valueDeclaration !== void 0) {
18915
- return {
18916
- node: symbol.valueDeclaration,
18917
- known: null,
18918
- viaModule,
18919
- identity: null,
18920
- kind: 0
18921
- };
18922
- } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
18777
+ };
18778
+ var RelativePathStrategy = class {
18779
+ constructor(reflector) {
18780
+ this.reflector = reflector;
18781
+ }
18782
+ emit(ref, context) {
18783
+ const destSf = getSourceFile(ref.node);
18784
+ const relativePath = relative(dirname(absoluteFromSourceFile(context)), absoluteFromSourceFile(destSf));
18785
+ const moduleName = toRelativeImport(stripExtension(relativePath));
18786
+ const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
18787
+ if (name === null) {
18923
18788
  return {
18924
- node: symbol.declarations[0],
18925
- known: null,
18926
- viaModule,
18927
- identity: null,
18928
- kind: 0
18789
+ kind: 1,
18790
+ ref,
18791
+ context,
18792
+ reason: `The symbol is not exported from ${destSf.fileName}.`
18929
18793
  };
18930
- } else {
18931
- return null;
18932
18794
  }
18795
+ return {
18796
+ kind: 0,
18797
+ expression: new ExternalExpr({ moduleName, name }),
18798
+ importedFile: destSf
18799
+ };
18933
18800
  }
18934
- _reflectDecorator(node) {
18935
- let decoratorExpr = node.expression;
18936
- let args = null;
18937
- if (import_typescript8.default.isCallExpression(decoratorExpr)) {
18938
- args = Array.from(decoratorExpr.arguments);
18939
- decoratorExpr = decoratorExpr.expression;
18940
- }
18941
- if (!isDecoratorIdentifier(decoratorExpr)) {
18801
+ };
18802
+ var UnifiedModulesStrategy = class {
18803
+ constructor(reflector, unifiedModulesHost) {
18804
+ this.reflector = reflector;
18805
+ this.unifiedModulesHost = unifiedModulesHost;
18806
+ }
18807
+ emit(ref, context) {
18808
+ const destSf = getSourceFile(ref.node);
18809
+ const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
18810
+ if (name === null) {
18942
18811
  return null;
18943
18812
  }
18944
- const decoratorIdentifier = import_typescript8.default.isIdentifier(decoratorExpr) ? decoratorExpr : decoratorExpr.name;
18945
- const importDecl = this.getImportOfIdentifier(decoratorIdentifier);
18813
+ const moduleName = this.unifiedModulesHost.fileNameToModuleName(destSf.fileName, context.fileName);
18946
18814
  return {
18947
- name: decoratorIdentifier.text,
18948
- identifier: decoratorExpr,
18949
- import: importDecl,
18950
- node,
18951
- args
18815
+ kind: 0,
18816
+ expression: new ExternalExpr({ moduleName, name }),
18817
+ importedFile: destSf
18952
18818
  };
18953
18819
  }
18954
- _reflectMember(node) {
18955
- let kind = null;
18956
- let value = null;
18957
- let name = null;
18958
- let nameNode = null;
18959
- if (import_typescript8.default.isPropertyDeclaration(node)) {
18960
- kind = ClassMemberKind.Property;
18961
- value = node.initializer || null;
18962
- } else if (import_typescript8.default.isGetAccessorDeclaration(node)) {
18963
- kind = ClassMemberKind.Getter;
18964
- } else if (import_typescript8.default.isSetAccessorDeclaration(node)) {
18965
- kind = ClassMemberKind.Setter;
18966
- } else if (import_typescript8.default.isMethodDeclaration(node)) {
18967
- kind = ClassMemberKind.Method;
18968
- } else if (import_typescript8.default.isConstructorDeclaration(node)) {
18969
- kind = ClassMemberKind.Constructor;
18970
- } else {
18820
+ };
18821
+
18822
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
18823
+ var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
18824
+ var UnifiedModulesAliasingHost = class {
18825
+ constructor(unifiedModulesHost) {
18826
+ this.unifiedModulesHost = unifiedModulesHost;
18827
+ this.aliasExportsInDts = false;
18828
+ }
18829
+ maybeAliasSymbolAs(ref, context, ngModuleName, isReExport) {
18830
+ if (!isReExport) {
18971
18831
  return null;
18972
18832
  }
18973
- if (import_typescript8.default.isConstructorDeclaration(node)) {
18974
- name = "constructor";
18975
- } else if (import_typescript8.default.isIdentifier(node.name)) {
18976
- name = node.name.text;
18977
- nameNode = node.name;
18978
- } else if (import_typescript8.default.isStringLiteral(node.name)) {
18979
- name = node.name.text;
18980
- nameNode = node.name;
18981
- } else {
18833
+ return this.aliasName(ref.node, context);
18834
+ }
18835
+ getAliasIn(decl, via, isReExport) {
18836
+ if (!isReExport) {
18982
18837
  return null;
18983
18838
  }
18984
- const decorators = this.getDecoratorsOfDeclaration(node);
18985
- const modifiers = import_typescript8.default.getModifiers(node);
18986
- const isStatic = modifiers !== void 0 && modifiers.some((mod) => mod.kind === import_typescript8.default.SyntaxKind.StaticKeyword);
18987
- return {
18988
- node,
18989
- implementation: node,
18990
- kind,
18991
- type: node.type || null,
18992
- name,
18993
- nameNode,
18994
- decorators,
18995
- value,
18996
- isStatic
18997
- };
18839
+ const moduleName = this.unifiedModulesHost.fileNameToModuleName(via.fileName, via.fileName);
18840
+ return new ExternalExpr({ moduleName, name: this.aliasName(decl, via) });
18998
18841
  }
18999
- getLocalExportedDeclarationsOfSourceFile(file) {
19000
- const cacheSf = file;
19001
- if (cacheSf[LocalExportedDeclarations] !== void 0) {
19002
- return cacheSf[LocalExportedDeclarations];
19003
- }
19004
- const exportSet = /* @__PURE__ */ new Set();
19005
- cacheSf[LocalExportedDeclarations] = exportSet;
19006
- const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
19007
- if (sfSymbol === void 0 || sfSymbol.exports === void 0) {
19008
- return exportSet;
19009
- }
19010
- const iter = sfSymbol.exports.values();
19011
- let item = iter.next();
19012
- while (item.done !== true) {
19013
- let exportedSymbol = item.value;
19014
- if (exportedSymbol.flags & import_typescript8.default.SymbolFlags.Alias) {
19015
- exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
19016
- }
19017
- if (exportedSymbol.valueDeclaration !== void 0 && exportedSymbol.valueDeclaration.getSourceFile() === file) {
19018
- exportSet.add(exportedSymbol.valueDeclaration);
19019
- }
19020
- item = iter.next();
19021
- }
19022
- return exportSet;
18842
+ aliasName(decl, context) {
18843
+ const declModule = this.unifiedModulesHost.fileNameToModuleName(decl.getSourceFile().fileName, context.fileName);
18844
+ const replaced = declModule.replace(CHARS_TO_ESCAPE, "_").replace(/\//g, "$");
18845
+ return "\u0275ng$" + replaced + "$$" + decl.name.text;
19023
18846
  }
19024
18847
  };
19025
- function reflectTypeEntityToDeclaration(type, checker) {
19026
- let realSymbol = checker.getSymbolAtLocation(type);
19027
- if (realSymbol === void 0) {
19028
- throw new Error(`Cannot resolve type entity ${type.getText()} to symbol`);
19029
- }
19030
- while (realSymbol.flags & import_typescript8.default.SymbolFlags.Alias) {
19031
- realSymbol = checker.getAliasedSymbol(realSymbol);
19032
- }
19033
- let node = null;
19034
- if (realSymbol.valueDeclaration !== void 0) {
19035
- node = realSymbol.valueDeclaration;
19036
- } else if (realSymbol.declarations !== void 0 && realSymbol.declarations.length === 1) {
19037
- node = realSymbol.declarations[0];
19038
- } else {
19039
- throw new Error(`Cannot resolve type entity symbol to declaration`);
19040
- }
19041
- if (import_typescript8.default.isQualifiedName(type)) {
19042
- if (!import_typescript8.default.isIdentifier(type.left)) {
19043
- throw new Error(`Cannot handle qualified name with non-identifier lhs`);
19044
- }
19045
- const symbol = checker.getSymbolAtLocation(type.left);
19046
- if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
19047
- throw new Error(`Cannot resolve qualified type entity lhs to symbol`);
19048
- }
19049
- const decl = symbol.declarations[0];
19050
- if (import_typescript8.default.isNamespaceImport(decl)) {
19051
- const clause = decl.parent;
19052
- const importDecl = clause.parent;
19053
- if (!import_typescript8.default.isStringLiteral(importDecl.moduleSpecifier)) {
19054
- throw new Error(`Module specifier is not a string`);
19055
- }
19056
- return { node, from: importDecl.moduleSpecifier.text };
19057
- } else if (import_typescript8.default.isModuleDeclaration(decl)) {
19058
- return { node, from: null };
19059
- } else {
19060
- throw new Error(`Unknown import type?`);
19061
- }
19062
- } else {
19063
- return { node, from: null };
18848
+ var PrivateExportAliasingHost = class {
18849
+ constructor(host) {
18850
+ this.host = host;
18851
+ this.aliasExportsInDts = true;
19064
18852
  }
19065
- }
19066
- function filterToMembersWithDecorator(members, name, module3) {
19067
- return members.filter((member) => !member.isStatic).map((member) => {
19068
- if (member.decorators === null) {
18853
+ maybeAliasSymbolAs(ref, context, ngModuleName) {
18854
+ if (ref.hasOwningModuleGuess) {
19069
18855
  return null;
19070
18856
  }
19071
- const decorators = member.decorators.filter((dec) => {
19072
- if (dec.import !== null) {
19073
- return dec.import.name === name && (module3 === void 0 || dec.import.from === module3);
19074
- } else {
19075
- return dec.name === name && module3 === void 0;
18857
+ const exports = this.host.getExportsOfModule(context);
18858
+ if (exports === null) {
18859
+ throw new Error(`Could not determine the exports of: ${context.fileName}`);
18860
+ }
18861
+ let found = false;
18862
+ exports.forEach((value) => {
18863
+ if (value.node === ref.node) {
18864
+ found = true;
19076
18865
  }
19077
18866
  });
19078
- if (decorators.length === 0) {
18867
+ if (found) {
19079
18868
  return null;
19080
18869
  }
19081
- return { member, decorators };
19082
- }).filter((value) => value !== null);
19083
- }
19084
- function reflectObjectLiteral(node) {
19085
- const map = /* @__PURE__ */ new Map();
19086
- node.properties.forEach((prop) => {
19087
- if (import_typescript8.default.isPropertyAssignment(prop)) {
19088
- const name = propertyNameToString(prop.name);
19089
- if (name === null) {
19090
- return;
19091
- }
19092
- map.set(name, prop.initializer);
19093
- } else if (import_typescript8.default.isShorthandPropertyAssignment(prop)) {
19094
- map.set(prop.name.text, prop.name);
19095
- } else {
19096
- return;
19097
- }
19098
- });
19099
- return map;
19100
- }
19101
- function castDeclarationToClassOrDie(declaration) {
19102
- if (!import_typescript8.default.isClassDeclaration(declaration)) {
19103
- throw new Error(`Reflecting on a ${import_typescript8.default.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`);
18870
+ return `\u0275ngExport\u0275${ngModuleName}\u0275${ref.node.name.text}`;
19104
18871
  }
19105
- return declaration;
19106
- }
19107
- function parameterName(name) {
19108
- if (import_typescript8.default.isIdentifier(name)) {
19109
- return name.text;
19110
- } else {
18872
+ getAliasIn() {
19111
18873
  return null;
19112
18874
  }
19113
- }
19114
- function propertyNameToString(node) {
19115
- if (import_typescript8.default.isIdentifier(node) || import_typescript8.default.isStringLiteral(node) || import_typescript8.default.isNumericLiteral(node)) {
19116
- return node.text;
19117
- } else {
19118
- return null;
18875
+ };
18876
+ var AliasStrategy = class {
18877
+ emit(ref, context, importMode) {
18878
+ if (importMode & ImportFlags.NoAliasing || ref.alias === null) {
18879
+ return null;
18880
+ }
18881
+ return {
18882
+ kind: 0,
18883
+ expression: ref.alias,
18884
+ importedFile: "unknown"
18885
+ };
19119
18886
  }
18887
+ };
18888
+
18889
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
18890
+ function relativePathBetween(from, to) {
18891
+ const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
18892
+ return relativePath !== "" ? toRelativeImport(relativePath) : null;
19120
18893
  }
19121
- function getQualifiedNameRoot(qualifiedName) {
19122
- while (import_typescript8.default.isQualifiedName(qualifiedName.left)) {
19123
- qualifiedName = qualifiedName.left;
19124
- }
19125
- return import_typescript8.default.isIdentifier(qualifiedName.left) ? qualifiedName.left : null;
19126
- }
19127
- function getFarLeftIdentifier(propertyAccess) {
19128
- while (import_typescript8.default.isPropertyAccessExpression(propertyAccess.expression)) {
19129
- propertyAccess = propertyAccess.expression;
19130
- }
19131
- return import_typescript8.default.isIdentifier(propertyAccess.expression) ? propertyAccess.expression : null;
19132
- }
19133
- function getContainingImportDeclaration(node) {
19134
- return import_typescript8.default.isImportSpecifier(node) ? node.parent.parent.parent : import_typescript8.default.isNamespaceImport(node) ? node.parent.parent : null;
19135
- }
19136
- function getExportedName(decl, originalId) {
19137
- return import_typescript8.default.isImportSpecifier(decl) ? (decl.propertyName !== void 0 ? decl.propertyName : decl.name).text : originalId.text;
18894
+ function normalizeSeparators2(path3) {
18895
+ return path3.replace(/\\/g, "/");
19138
18896
  }
19139
- var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
19140
-
19141
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
19142
- var import_typescript18 = __toESM(require("typescript"), 1);
19143
-
19144
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
19145
- var import_typescript12 = __toESM(require("typescript"), 1);
19146
18897
 
19147
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
19148
- var import_typescript10 = __toESM(require("typescript"), 1);
19149
- var TS = /\.tsx?$/i;
19150
- var D_TS = /\.d\.ts$/i;
19151
- function isSymbolWithValueDeclaration(symbol) {
19152
- return symbol != null && symbol.valueDeclaration !== void 0 && symbol.declarations !== void 0;
19153
- }
19154
- function isDtsPath(filePath) {
19155
- return D_TS.test(filePath);
19156
- }
19157
- function isNonDeclarationTsPath(filePath) {
19158
- return TS.test(filePath) && !D_TS.test(filePath);
19159
- }
19160
- function isFromDtsFile(node) {
19161
- let sf = node.getSourceFile();
19162
- if (sf === void 0) {
19163
- sf = import_typescript10.default.getOriginalNode(node).getSourceFile();
19164
- }
19165
- return sf !== void 0 && sf.isDeclarationFile;
19166
- }
19167
- function nodeNameForError(node) {
19168
- if (node.name !== void 0 && import_typescript10.default.isIdentifier(node.name)) {
19169
- return node.name.text;
19170
- } else {
19171
- const kind = import_typescript10.default.SyntaxKind[node.kind];
19172
- const { line, character } = import_typescript10.default.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart());
19173
- return `${kind}@${line}:${character}`;
18898
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
18899
+ var NoopImportRewriter = class {
18900
+ shouldImportSymbol(symbol, specifier) {
18901
+ return true;
19174
18902
  }
19175
- }
19176
- function getSourceFile(node) {
19177
- const directSf = node.getSourceFile();
19178
- return directSf !== void 0 ? directSf : import_typescript10.default.getOriginalNode(node).getSourceFile();
19179
- }
19180
- function getSourceFileOrNull(program, fileName) {
19181
- return program.getSourceFile(fileName) || null;
19182
- }
19183
- function getTokenAtPosition(sf, pos) {
19184
- return import_typescript10.default.getTokenAtPosition(sf, pos);
19185
- }
19186
- function identifierOfNode(decl) {
19187
- if (decl.name !== void 0 && import_typescript10.default.isIdentifier(decl.name)) {
19188
- return decl.name;
19189
- } else {
19190
- return null;
18903
+ rewriteSymbol(symbol, specifier) {
18904
+ return symbol;
19191
18905
  }
19192
- }
19193
- function isDeclaration(node) {
19194
- return isValueDeclaration(node) || isTypeDeclaration(node);
19195
- }
19196
- function isValueDeclaration(node) {
19197
- return import_typescript10.default.isClassDeclaration(node) || import_typescript10.default.isFunctionDeclaration(node) || import_typescript10.default.isVariableDeclaration(node);
19198
- }
19199
- function isTypeDeclaration(node) {
19200
- return import_typescript10.default.isEnumDeclaration(node) || import_typescript10.default.isTypeAliasDeclaration(node) || import_typescript10.default.isInterfaceDeclaration(node);
19201
- }
19202
- function isNamedDeclaration(node) {
19203
- const namedNode = node;
19204
- return namedNode.name !== void 0 && import_typescript10.default.isIdentifier(namedNode.name);
19205
- }
19206
- function getRootDirs(host, options) {
19207
- const rootDirs = [];
19208
- const cwd = host.getCurrentDirectory();
19209
- const fs3 = getFileSystem();
19210
- if (options.rootDirs !== void 0) {
19211
- rootDirs.push(...options.rootDirs);
19212
- } else if (options.rootDir !== void 0) {
19213
- rootDirs.push(options.rootDir);
19214
- } else {
19215
- rootDirs.push(cwd);
18906
+ rewriteSpecifier(specifier, inContextOfFile) {
18907
+ return specifier;
19216
18908
  }
19217
- return rootDirs.map((rootDir) => fs3.resolve(cwd, host.getCanonicalFileName(rootDir)));
19218
- }
19219
- function nodeDebugInfo(node) {
19220
- const sf = getSourceFile(node);
19221
- const { line, character } = import_typescript10.default.getLineAndCharacterOfPosition(sf, node.pos);
19222
- return `[${sf.fileName}: ${import_typescript10.default.SyntaxKind[node.kind]} @ ${line}:${character}]`;
19223
- }
19224
- function resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache) {
19225
- if (compilerHost.resolveModuleNames) {
19226
- return compilerHost.resolveModuleNames(
19227
- [moduleName],
19228
- containingFile,
19229
- void 0,
19230
- void 0,
19231
- compilerOptions
19232
- )[0];
19233
- } else {
19234
- return import_typescript10.default.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache !== null ? moduleResolutionCache : void 0).resolvedModule;
18909
+ };
18910
+ var CORE_SUPPORTED_SYMBOLS = /* @__PURE__ */ new Map([
18911
+ ["\u0275\u0275defineInjectable", "\u0275\u0275defineInjectable"],
18912
+ ["\u0275\u0275defineInjector", "\u0275\u0275defineInjector"],
18913
+ ["\u0275\u0275defineNgModule", "\u0275\u0275defineNgModule"],
18914
+ ["\u0275\u0275setNgModuleScope", "\u0275\u0275setNgModuleScope"],
18915
+ ["\u0275\u0275inject", "\u0275\u0275inject"],
18916
+ ["\u0275\u0275FactoryDeclaration", "\u0275\u0275FactoryDeclaration"],
18917
+ ["\u0275setClassMetadata", "setClassMetadata"],
18918
+ ["\u0275\u0275InjectableDeclaration", "\u0275\u0275InjectableDeclaration"],
18919
+ ["\u0275\u0275InjectorDeclaration", "\u0275\u0275InjectorDeclaration"],
18920
+ ["\u0275\u0275NgModuleDeclaration", "\u0275\u0275NgModuleDeclaration"],
18921
+ ["\u0275NgModuleFactory", "NgModuleFactory"],
18922
+ ["\u0275noSideEffects", "\u0275noSideEffects"]
18923
+ ]);
18924
+ var CORE_MODULE = "@angular/core";
18925
+ var R3SymbolsImportRewriter = class {
18926
+ constructor(r3SymbolsPath) {
18927
+ this.r3SymbolsPath = r3SymbolsPath;
19235
18928
  }
19236
- }
19237
- function isAssignment(node) {
19238
- return import_typescript10.default.isBinaryExpression(node) && node.operatorToken.kind === import_typescript10.default.SyntaxKind.EqualsToken;
19239
- }
19240
- function toUnredirectedSourceFile(sf) {
19241
- const redirectInfo = sf.redirectInfo;
19242
- if (redirectInfo === void 0) {
19243
- return sf;
18929
+ shouldImportSymbol(symbol, specifier) {
18930
+ return true;
19244
18931
  }
19245
- return redirectInfo.unredirected;
19246
- }
19247
-
19248
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
19249
- function findExportedNameOfNode(target, file, reflector) {
19250
- const exports = reflector.getExportsOfModule(file);
19251
- if (exports === null) {
19252
- return null;
18932
+ rewriteSymbol(symbol, specifier) {
18933
+ if (specifier !== CORE_MODULE) {
18934
+ return symbol;
18935
+ }
18936
+ return validateAndRewriteCoreSymbol(symbol);
19253
18937
  }
19254
- const declaredName = isNamedDeclaration(target) ? target.name.text : null;
19255
- let foundExportName = null;
19256
- for (const [exportName, declaration] of exports) {
19257
- if (declaration.node !== target) {
19258
- continue;
18938
+ rewriteSpecifier(specifier, inContextOfFile) {
18939
+ if (specifier !== CORE_MODULE) {
18940
+ return specifier;
19259
18941
  }
19260
- if (exportName === declaredName) {
19261
- return exportName;
18942
+ const relativePathToR3Symbols = relativePathBetween(inContextOfFile, this.r3SymbolsPath);
18943
+ if (relativePathToR3Symbols === null) {
18944
+ throw new Error(`Failed to rewrite import inside ${CORE_MODULE}: ${inContextOfFile} -> ${this.r3SymbolsPath}`);
19262
18945
  }
19263
- foundExportName = exportName;
18946
+ return relativePathToR3Symbols;
19264
18947
  }
19265
- return foundExportName;
18948
+ };
18949
+ function validateAndRewriteCoreSymbol(name) {
18950
+ if (!CORE_SUPPORTED_SYMBOLS.has(name)) {
18951
+ throw new Error(`Importing unexpected symbol ${name} while compiling ${CORE_MODULE}`);
18952
+ }
18953
+ return CORE_SUPPORTED_SYMBOLS.get(name);
19266
18954
  }
19267
18955
 
19268
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
19269
- var ImportFlags;
19270
- (function(ImportFlags2) {
19271
- ImportFlags2[ImportFlags2["None"] = 0] = "None";
19272
- ImportFlags2[ImportFlags2["ForceNewImport"] = 1] = "ForceNewImport";
19273
- ImportFlags2[ImportFlags2["NoAliasing"] = 2] = "NoAliasing";
19274
- ImportFlags2[ImportFlags2["AllowTypeImports"] = 4] = "AllowTypeImports";
19275
- ImportFlags2[ImportFlags2["AllowRelativeDtsImports"] = 8] = "AllowRelativeDtsImports";
19276
- })(ImportFlags || (ImportFlags = {}));
19277
- function assertSuccessfulReferenceEmit(result, origin, typeKind) {
19278
- if (result.kind === 0) {
19279
- return;
18956
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
18957
+ var import_typescript9 = __toESM(require("typescript"), 1);
18958
+ var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
18959
+ function loadIsReferencedAliasDeclarationPatch(context) {
18960
+ if (!isTransformationContextWithEmitResolver(context)) {
18961
+ throwIncompatibleTransformationContextError();
19280
18962
  }
19281
- const message = makeDiagnosticChain(`Unable to import ${typeKind} ${nodeNameForError(result.ref.node)}.`, [makeDiagnosticChain(result.reason)]);
19282
- throw new FatalDiagnosticError(ErrorCode.IMPORT_GENERATION_FAILURE, origin, message, [makeRelatedInformation(result.ref.node, `The ${typeKind} is declared here.`)]);
18963
+ const emitResolver = context.getEmitResolver();
18964
+ const existingReferencedAliases = emitResolver[patchedReferencedAliasesSymbol];
18965
+ if (existingReferencedAliases !== void 0) {
18966
+ return existingReferencedAliases;
18967
+ }
18968
+ const originalIsReferencedAliasDeclaration = emitResolver.isReferencedAliasDeclaration;
18969
+ if (originalIsReferencedAliasDeclaration === void 0) {
18970
+ throwIncompatibleTransformationContextError();
18971
+ }
18972
+ const referencedAliases = /* @__PURE__ */ new Set();
18973
+ emitResolver.isReferencedAliasDeclaration = function(node, ...args) {
18974
+ if (isAliasImportDeclaration(node) && referencedAliases.has(node)) {
18975
+ return true;
18976
+ }
18977
+ return originalIsReferencedAliasDeclaration.call(emitResolver, node, ...args);
18978
+ };
18979
+ return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
19283
18980
  }
19284
- var ReferenceEmitter = class {
19285
- constructor(strategies) {
19286
- this.strategies = strategies;
18981
+ function isAliasImportDeclaration(node) {
18982
+ return import_typescript9.default.isImportSpecifier(node) || import_typescript9.default.isNamespaceImport(node) || import_typescript9.default.isImportClause(node);
18983
+ }
18984
+ function isTransformationContextWithEmitResolver(context) {
18985
+ return context.getEmitResolver !== void 0;
18986
+ }
18987
+ function throwIncompatibleTransformationContextError() {
18988
+ throw Error("Angular compiler is incompatible with this version of the TypeScript compiler.\n\nIf you recently updated TypeScript and this issue surfaces now, consider downgrading.\n\nPlease report an issue on the Angular repositories when this issue surfaces and you are using a supposedly compatible TypeScript version.");
18989
+ }
18990
+
18991
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
18992
+ var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
18993
+ function attachDefaultImportDeclaration(expr, importDecl) {
18994
+ expr[DefaultImportDeclaration] = importDecl;
18995
+ }
18996
+ function getDefaultImportDeclaration(expr) {
18997
+ var _a;
18998
+ return (_a = expr[DefaultImportDeclaration]) != null ? _a : null;
18999
+ }
19000
+ var DefaultImportTracker = class {
19001
+ constructor() {
19002
+ this.sourceFileToUsedImports = /* @__PURE__ */ new Map();
19287
19003
  }
19288
- emit(ref, context, importFlags = ImportFlags.None) {
19289
- for (const strategy of this.strategies) {
19290
- const emitted = strategy.emit(ref, context, importFlags);
19291
- if (emitted !== null) {
19292
- return emitted;
19004
+ recordUsedImport(importDecl) {
19005
+ if (importDecl.importClause) {
19006
+ const sf = getSourceFile(importDecl);
19007
+ if (!this.sourceFileToUsedImports.has(sf.fileName)) {
19008
+ this.sourceFileToUsedImports.set(sf.fileName, /* @__PURE__ */ new Set());
19293
19009
  }
19010
+ this.sourceFileToUsedImports.get(sf.fileName).add(importDecl.importClause);
19294
19011
  }
19295
- return {
19296
- kind: 1,
19297
- ref,
19298
- context,
19299
- reason: `Unable to write a reference to ${nodeNameForError(ref.node)}.`
19012
+ }
19013
+ importPreservingTransformer() {
19014
+ return (context) => {
19015
+ let clausesToPreserve = null;
19016
+ return (sourceFile) => {
19017
+ const clausesForFile = this.sourceFileToUsedImports.get(sourceFile.fileName);
19018
+ if (clausesForFile !== void 0) {
19019
+ for (const clause of clausesForFile) {
19020
+ if (clausesToPreserve === null) {
19021
+ clausesToPreserve = loadIsReferencedAliasDeclarationPatch(context);
19022
+ }
19023
+ clausesToPreserve.add(clause);
19024
+ }
19025
+ }
19026
+ return sourceFile;
19027
+ };
19300
19028
  };
19301
19029
  }
19302
19030
  };
19303
- var LocalIdentifierStrategy = class {
19304
- emit(ref, context, importFlags) {
19305
- const refSf = getSourceFile(ref.node);
19306
- if (importFlags & ImportFlags.ForceNewImport && refSf !== context) {
19307
- return null;
19308
- }
19309
- if (!isDeclaration(ref.node) && refSf === context) {
19310
- return {
19311
- kind: 0,
19312
- expression: new WrappedNodeExpr(ref.node),
19313
- importedFile: null
19314
- };
19031
+
19032
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
19033
+ var Reference2 = class {
19034
+ constructor(node, bestGuessOwningModule = null) {
19035
+ this.node = node;
19036
+ this.identifiers = [];
19037
+ this.synthetic = false;
19038
+ this._alias = null;
19039
+ this.bestGuessOwningModule = bestGuessOwningModule;
19040
+ const id = identifierOfNode(node);
19041
+ if (id !== null) {
19042
+ this.identifiers.push(id);
19315
19043
  }
19316
- const identifier = ref.getIdentityIn(context);
19317
- if (identifier !== null) {
19318
- return {
19319
- kind: 0,
19320
- expression: new WrappedNodeExpr(identifier),
19321
- importedFile: null
19322
- };
19044
+ }
19045
+ get ownedByModuleGuess() {
19046
+ if (this.bestGuessOwningModule !== null) {
19047
+ return this.bestGuessOwningModule.specifier;
19323
19048
  } else {
19324
19049
  return null;
19325
19050
  }
19326
19051
  }
19327
- };
19328
- var AbsoluteModuleStrategy = class {
19329
- constructor(program, checker, moduleResolver, reflectionHost) {
19330
- this.program = program;
19331
- this.checker = checker;
19332
- this.moduleResolver = moduleResolver;
19333
- this.reflectionHost = reflectionHost;
19334
- this.moduleExportsCache = /* @__PURE__ */ new Map();
19052
+ get hasOwningModuleGuess() {
19053
+ return this.bestGuessOwningModule !== null;
19335
19054
  }
19336
- emit(ref, context, importFlags) {
19337
- if (ref.bestGuessOwningModule === null) {
19338
- return null;
19339
- } else if (!isDeclaration(ref.node)) {
19340
- throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${import_typescript12.default.SyntaxKind[ref.node.kind]}.`);
19341
- } else if ((importFlags & ImportFlags.AllowTypeImports) === 0 && isTypeDeclaration(ref.node)) {
19342
- throw new Error(`Importing a type-only declaration of type ${import_typescript12.default.SyntaxKind[ref.node.kind]} in a value position is not allowed.`);
19343
- }
19344
- const { specifier, resolutionContext } = ref.bestGuessOwningModule;
19345
- const exports = this.getExportsOfModule(specifier, resolutionContext);
19346
- if (exports.module === null) {
19347
- return {
19348
- kind: 1,
19349
- ref,
19350
- context,
19351
- reason: `The module '${specifier}' could not be found.`
19352
- };
19353
- } else if (exports.exportMap === null || !exports.exportMap.has(ref.node)) {
19354
- return {
19355
- kind: 1,
19356
- ref,
19357
- context,
19358
- reason: `The symbol is not exported from ${exports.module.fileName} (module '${specifier}').`
19359
- };
19360
- }
19361
- const symbolName = exports.exportMap.get(ref.node);
19362
- return {
19363
- kind: 0,
19364
- expression: new ExternalExpr(new ExternalReference(specifier, symbolName)),
19365
- importedFile: exports.module
19366
- };
19055
+ get debugName() {
19056
+ const id = identifierOfNode(this.node);
19057
+ return id !== null ? id.text : null;
19367
19058
  }
19368
- getExportsOfModule(moduleName, fromFile) {
19369
- if (!this.moduleExportsCache.has(moduleName)) {
19370
- this.moduleExportsCache.set(moduleName, this.enumerateExportsOfModule(moduleName, fromFile));
19371
- }
19372
- return this.moduleExportsCache.get(moduleName);
19059
+ get alias() {
19060
+ return this._alias;
19373
19061
  }
19374
- enumerateExportsOfModule(specifier, fromFile) {
19375
- const entryPointFile = this.moduleResolver.resolveModule(specifier, fromFile);
19376
- if (entryPointFile === null) {
19377
- return { module: null, exportMap: null };
19378
- }
19379
- const exports = this.reflectionHost.getExportsOfModule(entryPointFile);
19380
- if (exports === null) {
19381
- return { module: entryPointFile, exportMap: null };
19382
- }
19383
- const exportMap = /* @__PURE__ */ new Map();
19384
- for (const [name, declaration] of exports) {
19385
- if (exportMap.has(declaration.node)) {
19386
- const existingExport = exportMap.get(declaration.node);
19387
- if (isNamedDeclaration(declaration.node) && declaration.node.name.text === existingExport) {
19388
- continue;
19389
- }
19390
- }
19391
- exportMap.set(declaration.node, name);
19392
- }
19393
- return { module: entryPointFile, exportMap };
19062
+ addIdentifier(identifier) {
19063
+ this.identifiers.push(identifier);
19394
19064
  }
19395
- };
19396
- var LogicalProjectStrategy = class {
19397
- constructor(reflector, logicalFs) {
19398
- this.reflector = reflector;
19399
- this.logicalFs = logicalFs;
19400
- this.relativePathStrategy = new RelativePathStrategy(this.reflector);
19065
+ getIdentityIn(context) {
19066
+ return this.identifiers.find((id) => id.getSourceFile() === context) || null;
19401
19067
  }
19402
- emit(ref, context, importFlags) {
19403
- const destSf = getSourceFile(ref.node);
19404
- const destPath = this.logicalFs.logicalPathOfSf(destSf);
19405
- if (destPath === null) {
19406
- if (destSf.isDeclarationFile && importFlags & ImportFlags.AllowRelativeDtsImports) {
19407
- return this.relativePathStrategy.emit(ref, context);
19068
+ getIdentityInExpression(expr) {
19069
+ const sf = expr.getSourceFile();
19070
+ return this.identifiers.find((id) => {
19071
+ if (id.getSourceFile() !== sf) {
19072
+ return false;
19408
19073
  }
19409
- return {
19410
- kind: 1,
19411
- ref,
19412
- context,
19413
- reason: `The file ${destSf.fileName} is outside of the configured 'rootDir'.`
19414
- };
19415
- }
19416
- const originPath = this.logicalFs.logicalPathOfSf(context);
19417
- if (originPath === null) {
19418
- throw new Error(`Debug assert: attempt to import from ${context.fileName} but it's outside the program?`);
19419
- }
19420
- if (destPath === originPath) {
19421
- return null;
19422
- }
19423
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
19424
- if (name === null) {
19425
- return {
19426
- kind: 1,
19427
- ref,
19428
- context,
19429
- reason: `The symbol is not exported from ${destSf.fileName}.`
19430
- };
19431
- }
19432
- const moduleName = LogicalProjectPath.relativePathBetween(originPath, destPath);
19433
- return {
19434
- kind: 0,
19435
- expression: new ExternalExpr({ moduleName, name }),
19436
- importedFile: destSf
19437
- };
19074
+ return id.pos >= expr.pos && id.end <= expr.end;
19075
+ }) || null;
19438
19076
  }
19439
- };
19440
- var RelativePathStrategy = class {
19441
- constructor(reflector) {
19442
- this.reflector = reflector;
19077
+ getOriginForDiagnostics(container, fallback = container) {
19078
+ const id = this.getIdentityInExpression(container);
19079
+ return id !== null ? id : fallback;
19443
19080
  }
19444
- emit(ref, context) {
19445
- const destSf = getSourceFile(ref.node);
19446
- const relativePath = relative(dirname(absoluteFromSourceFile(context)), absoluteFromSourceFile(destSf));
19447
- const moduleName = toRelativeImport(stripExtension(relativePath));
19448
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
19449
- if (name === null) {
19450
- return {
19451
- kind: 1,
19452
- ref,
19453
- context,
19454
- reason: `The symbol is not exported from ${destSf.fileName}.`
19455
- };
19456
- }
19457
- return {
19458
- kind: 0,
19459
- expression: new ExternalExpr({ moduleName, name }),
19460
- importedFile: destSf
19461
- };
19081
+ cloneWithAlias(alias) {
19082
+ const ref = new Reference2(this.node, this.bestGuessOwningModule);
19083
+ ref.identifiers = [...this.identifiers];
19084
+ ref._alias = alias;
19085
+ return ref;
19086
+ }
19087
+ cloneWithNoIdentifiers() {
19088
+ const ref = new Reference2(this.node, this.bestGuessOwningModule);
19089
+ ref._alias = this._alias;
19090
+ ref.identifiers = [];
19091
+ return ref;
19462
19092
  }
19463
19093
  };
19464
- var UnifiedModulesStrategy = class {
19465
- constructor(reflector, unifiedModulesHost) {
19466
- this.reflector = reflector;
19467
- this.unifiedModulesHost = unifiedModulesHost;
19094
+
19095
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
19096
+ var ModuleResolver = class {
19097
+ constructor(program, compilerOptions, host, moduleResolutionCache) {
19098
+ this.program = program;
19099
+ this.compilerOptions = compilerOptions;
19100
+ this.host = host;
19101
+ this.moduleResolutionCache = moduleResolutionCache;
19468
19102
  }
19469
- emit(ref, context) {
19470
- const destSf = getSourceFile(ref.node);
19471
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
19472
- if (name === null) {
19103
+ resolveModule(moduleName, containingFile) {
19104
+ const resolved = resolveModuleName(moduleName, containingFile, this.compilerOptions, this.host, this.moduleResolutionCache);
19105
+ if (resolved === void 0) {
19473
19106
  return null;
19474
19107
  }
19475
- const moduleName = this.unifiedModulesHost.fileNameToModuleName(destSf.fileName, context.fileName);
19476
- return {
19477
- kind: 0,
19478
- expression: new ExternalExpr({ moduleName, name }),
19479
- importedFile: destSf
19480
- };
19108
+ return getSourceFileOrNull(this.program, absoluteFrom(resolved.resolvedFileName));
19481
19109
  }
19482
19110
  };
19483
19111
 
19484
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
19485
- var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
19486
- var UnifiedModulesAliasingHost = class {
19487
- constructor(unifiedModulesHost) {
19488
- this.unifiedModulesHost = unifiedModulesHost;
19489
- this.aliasExportsInDts = false;
19490
- }
19491
- maybeAliasSymbolAs(ref, context, ngModuleName, isReExport) {
19492
- if (!isReExport) {
19493
- return null;
19112
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
19113
+ function valueReferenceToExpression(valueRef) {
19114
+ if (valueRef.kind === 2) {
19115
+ return null;
19116
+ } else if (valueRef.kind === 0) {
19117
+ const expr = new WrappedNodeExpr(valueRef.expression);
19118
+ if (valueRef.defaultImportStatement !== null) {
19119
+ attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
19494
19120
  }
19495
- return this.aliasName(ref.node, context);
19496
- }
19497
- getAliasIn(decl, via, isReExport) {
19498
- if (!isReExport) {
19499
- return null;
19121
+ return expr;
19122
+ } else {
19123
+ let importExpr2 = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
19124
+ if (valueRef.nestedPath !== null) {
19125
+ for (const property of valueRef.nestedPath) {
19126
+ importExpr2 = new ReadPropExpr(importExpr2, property);
19127
+ }
19500
19128
  }
19501
- const moduleName = this.unifiedModulesHost.fileNameToModuleName(via.fileName, via.fileName);
19502
- return new ExternalExpr({ moduleName, name: this.aliasName(decl, via) });
19503
- }
19504
- aliasName(decl, context) {
19505
- const declModule = this.unifiedModulesHost.fileNameToModuleName(decl.getSourceFile().fileName, context.fileName);
19506
- const replaced = declModule.replace(CHARS_TO_ESCAPE, "_").replace(/\//g, "$");
19507
- return "\u0275ng$" + replaced + "$$" + decl.name.text;
19508
- }
19509
- };
19510
- var PrivateExportAliasingHost = class {
19511
- constructor(host) {
19512
- this.host = host;
19513
- this.aliasExportsInDts = true;
19129
+ return importExpr2;
19514
19130
  }
19515
- maybeAliasSymbolAs(ref, context, ngModuleName) {
19516
- if (ref.hasOwningModuleGuess) {
19517
- return null;
19518
- }
19519
- const exports = this.host.getExportsOfModule(context);
19520
- if (exports === null) {
19521
- throw new Error(`Could not determine the exports of: ${context.fileName}`);
19522
- }
19523
- let found = false;
19524
- exports.forEach((value) => {
19525
- if (value.node === ref.node) {
19526
- found = true;
19527
- }
19528
- });
19529
- if (found) {
19530
- return null;
19531
- }
19532
- return `\u0275ngExport\u0275${ngModuleName}\u0275${ref.node.name.text}`;
19131
+ }
19132
+ function toR3Reference(origin, ref, context, refEmitter) {
19133
+ const emittedValueRef = refEmitter.emit(ref, context);
19134
+ assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
19135
+ const emittedTypeRef = refEmitter.emit(ref, context, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
19136
+ assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
19137
+ return {
19138
+ value: emittedValueRef.expression,
19139
+ type: emittedTypeRef.expression
19140
+ };
19141
+ }
19142
+ function isAngularCore(decorator) {
19143
+ return decorator.import !== null && decorator.import.from === "@angular/core";
19144
+ }
19145
+ function isAngularCoreReference(reference, symbolName) {
19146
+ return reference.ownedByModuleGuess === "@angular/core" && reference.debugName === symbolName;
19147
+ }
19148
+ function findAngularDecorator(decorators, name, isCore) {
19149
+ return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
19150
+ }
19151
+ function isAngularDecorator(decorator, name, isCore) {
19152
+ if (isCore) {
19153
+ return decorator.name === name;
19154
+ } else if (isAngularCore(decorator)) {
19155
+ return decorator.import.name === name;
19533
19156
  }
19534
- getAliasIn() {
19157
+ return false;
19158
+ }
19159
+ function unwrapExpression(node) {
19160
+ while (import_typescript13.default.isAsExpression(node) || import_typescript13.default.isParenthesizedExpression(node)) {
19161
+ node = node.expression;
19162
+ }
19163
+ return node;
19164
+ }
19165
+ function expandForwardRef(arg) {
19166
+ arg = unwrapExpression(arg);
19167
+ if (!import_typescript13.default.isArrowFunction(arg) && !import_typescript13.default.isFunctionExpression(arg)) {
19535
19168
  return null;
19536
19169
  }
19537
- };
19538
- var AliasStrategy = class {
19539
- emit(ref, context, importMode) {
19540
- if (importMode & ImportFlags.NoAliasing || ref.alias === null) {
19170
+ const body = arg.body;
19171
+ if (import_typescript13.default.isBlock(body)) {
19172
+ if (body.statements.length !== 1) {
19541
19173
  return null;
19542
19174
  }
19543
- return {
19544
- kind: 0,
19545
- expression: ref.alias,
19546
- importedFile: "unknown"
19547
- };
19175
+ const stmt = body.statements[0];
19176
+ if (!import_typescript13.default.isReturnStatement(stmt) || stmt.expression === void 0) {
19177
+ return null;
19178
+ }
19179
+ return stmt.expression;
19180
+ } else {
19181
+ return body;
19548
19182
  }
19549
- };
19550
-
19551
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
19552
- function relativePathBetween(from, to) {
19553
- const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
19554
- return relativePath !== "" ? toRelativeImport(relativePath) : null;
19555
- }
19556
- function normalizeSeparators2(path3) {
19557
- return path3.replace(/\\/g, "/");
19558
19183
  }
19559
-
19560
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
19561
- var NoopImportRewriter = class {
19562
- shouldImportSymbol(symbol, specifier) {
19563
- return true;
19564
- }
19565
- rewriteSymbol(symbol, specifier) {
19566
- return symbol;
19567
- }
19568
- rewriteSpecifier(specifier, inContextOfFile) {
19569
- return specifier;
19570
- }
19571
- };
19572
- var CORE_SUPPORTED_SYMBOLS = /* @__PURE__ */ new Map([
19573
- ["\u0275\u0275defineInjectable", "\u0275\u0275defineInjectable"],
19574
- ["\u0275\u0275defineInjector", "\u0275\u0275defineInjector"],
19575
- ["\u0275\u0275defineNgModule", "\u0275\u0275defineNgModule"],
19576
- ["\u0275\u0275setNgModuleScope", "\u0275\u0275setNgModuleScope"],
19577
- ["\u0275\u0275inject", "\u0275\u0275inject"],
19578
- ["\u0275\u0275FactoryDeclaration", "\u0275\u0275FactoryDeclaration"],
19579
- ["\u0275setClassMetadata", "setClassMetadata"],
19580
- ["\u0275\u0275InjectableDeclaration", "\u0275\u0275InjectableDeclaration"],
19581
- ["\u0275\u0275InjectorDeclaration", "\u0275\u0275InjectorDeclaration"],
19582
- ["\u0275\u0275NgModuleDeclaration", "\u0275\u0275NgModuleDeclaration"],
19583
- ["\u0275NgModuleFactory", "NgModuleFactory"],
19584
- ["\u0275noSideEffects", "\u0275noSideEffects"]
19585
- ]);
19586
- var CORE_MODULE = "@angular/core";
19587
- var R3SymbolsImportRewriter = class {
19588
- constructor(r3SymbolsPath) {
19589
- this.r3SymbolsPath = r3SymbolsPath;
19590
- }
19591
- shouldImportSymbol(symbol, specifier) {
19592
- return true;
19184
+ function tryUnwrapForwardRef(node, reflector) {
19185
+ node = unwrapExpression(node);
19186
+ if (!import_typescript13.default.isCallExpression(node) || node.arguments.length !== 1) {
19187
+ return null;
19593
19188
  }
19594
- rewriteSymbol(symbol, specifier) {
19595
- if (specifier !== CORE_MODULE) {
19596
- return symbol;
19597
- }
19598
- return validateAndRewriteCoreSymbol(symbol);
19189
+ const fn2 = import_typescript13.default.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
19190
+ if (!import_typescript13.default.isIdentifier(fn2)) {
19191
+ return null;
19599
19192
  }
19600
- rewriteSpecifier(specifier, inContextOfFile) {
19601
- if (specifier !== CORE_MODULE) {
19602
- return specifier;
19603
- }
19604
- const relativePathToR3Symbols = relativePathBetween(inContextOfFile, this.r3SymbolsPath);
19605
- if (relativePathToR3Symbols === null) {
19606
- throw new Error(`Failed to rewrite import inside ${CORE_MODULE}: ${inContextOfFile} -> ${this.r3SymbolsPath}`);
19607
- }
19608
- return relativePathToR3Symbols;
19193
+ const expr = expandForwardRef(node.arguments[0]);
19194
+ if (expr === null) {
19195
+ return null;
19609
19196
  }
19610
- };
19611
- function validateAndRewriteCoreSymbol(name) {
19612
- if (!CORE_SUPPORTED_SYMBOLS.has(name)) {
19613
- throw new Error(`Importing unexpected symbol ${name} while compiling ${CORE_MODULE}`);
19197
+ const imp = reflector.getImportOfIdentifier(fn2);
19198
+ if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
19199
+ return null;
19614
19200
  }
19615
- return CORE_SUPPORTED_SYMBOLS.get(name);
19201
+ return expr;
19616
19202
  }
19617
-
19618
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
19619
- var import_typescript14 = __toESM(require("typescript"), 1);
19620
- var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
19621
- function loadIsReferencedAliasDeclarationPatch(context) {
19622
- if (!isTransformationContextWithEmitResolver(context)) {
19623
- throwIncompatibleTransformationContextError();
19624
- }
19625
- const emitResolver = context.getEmitResolver();
19626
- const existingReferencedAliases = emitResolver[patchedReferencedAliasesSymbol];
19627
- if (existingReferencedAliases !== void 0) {
19628
- return existingReferencedAliases;
19203
+ var forwardRefResolver = (fn2, callExpr, resolve6, unresolvable) => {
19204
+ if (!isAngularCoreReference(fn2, "forwardRef") || callExpr.arguments.length !== 1) {
19205
+ return unresolvable;
19629
19206
  }
19630
- const originalIsReferencedAliasDeclaration = emitResolver.isReferencedAliasDeclaration;
19631
- if (originalIsReferencedAliasDeclaration === void 0) {
19632
- throwIncompatibleTransformationContextError();
19207
+ const expanded = expandForwardRef(callExpr.arguments[0]);
19208
+ if (expanded !== null) {
19209
+ return resolve6(expanded);
19210
+ } else {
19211
+ return unresolvable;
19633
19212
  }
19634
- const referencedAliases = /* @__PURE__ */ new Set();
19635
- emitResolver.isReferencedAliasDeclaration = function(node, ...args) {
19636
- if (isAliasImportDeclaration(node) && referencedAliases.has(node)) {
19637
- return true;
19213
+ };
19214
+ function combineResolvers(resolvers) {
19215
+ return (fn2, callExpr, resolve6, unresolvable) => {
19216
+ for (const resolver of resolvers) {
19217
+ const resolved = resolver(fn2, callExpr, resolve6, unresolvable);
19218
+ if (resolved !== unresolvable) {
19219
+ return resolved;
19220
+ }
19638
19221
  }
19639
- return originalIsReferencedAliasDeclaration.call(emitResolver, node, ...args);
19222
+ return unresolvable;
19640
19223
  };
19641
- return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
19642
- }
19643
- function isAliasImportDeclaration(node) {
19644
- return import_typescript14.default.isImportSpecifier(node) || import_typescript14.default.isNamespaceImport(node) || import_typescript14.default.isImportClause(node);
19645
19224
  }
19646
- function isTransformationContextWithEmitResolver(context) {
19647
- return context.getEmitResolver !== void 0;
19225
+ function isExpressionForwardReference(expr, context, contextSource) {
19226
+ if (isWrappedTsNodeExpr(expr)) {
19227
+ const node = import_typescript13.default.getOriginalNode(expr.node);
19228
+ return node.getSourceFile() === contextSource && context.pos < node.pos;
19229
+ } else {
19230
+ return false;
19231
+ }
19648
19232
  }
19649
- function throwIncompatibleTransformationContextError() {
19650
- throw Error("Angular compiler is incompatible with this version of the TypeScript compiler.\n\nIf you recently updated TypeScript and this issue surfaces now, consider downgrading.\n\nPlease report an issue on the Angular repositories when this issue surfaces and you are using a supposedly compatible TypeScript version.");
19233
+ function isWrappedTsNodeExpr(expr) {
19234
+ return expr instanceof WrappedNodeExpr;
19651
19235
  }
19652
-
19653
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
19654
- var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
19655
- function attachDefaultImportDeclaration(expr, importDecl) {
19656
- expr[DefaultImportDeclaration] = importDecl;
19236
+ function readBaseClass(node, reflector, evaluator) {
19237
+ const baseExpression = reflector.getBaseClassExpression(node);
19238
+ if (baseExpression !== null) {
19239
+ const baseClass = evaluator.evaluate(baseExpression);
19240
+ if (baseClass instanceof Reference2 && reflector.isClass(baseClass.node)) {
19241
+ return baseClass;
19242
+ } else {
19243
+ return "dynamic";
19244
+ }
19245
+ }
19246
+ return null;
19657
19247
  }
19658
- function getDefaultImportDeclaration(expr) {
19659
- var _a;
19660
- return (_a = expr[DefaultImportDeclaration]) != null ? _a : null;
19248
+ var parensWrapperTransformerFactory = (context) => {
19249
+ const visitor = (node) => {
19250
+ const visited = import_typescript13.default.visitEachChild(node, visitor, context);
19251
+ if (import_typescript13.default.isArrowFunction(visited) || import_typescript13.default.isFunctionExpression(visited)) {
19252
+ return import_typescript13.default.factory.createParenthesizedExpression(visited);
19253
+ }
19254
+ return visited;
19255
+ };
19256
+ return (node) => import_typescript13.default.visitEachChild(node, visitor, context);
19257
+ };
19258
+ function wrapFunctionExpressionsInParens(expression) {
19259
+ return import_typescript13.default.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
19661
19260
  }
19662
- var DefaultImportTracker = class {
19663
- constructor() {
19664
- this.sourceFileToUsedImports = /* @__PURE__ */ new Map();
19261
+ function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
19262
+ const providers = /* @__PURE__ */ new Set();
19263
+ const resolvedProviders = evaluator.evaluate(rawProviders);
19264
+ if (!Array.isArray(resolvedProviders)) {
19265
+ return providers;
19665
19266
  }
19666
- recordUsedImport(importDecl) {
19667
- if (importDecl.importClause) {
19668
- const sf = getSourceFile(importDecl);
19669
- if (!this.sourceFileToUsedImports.has(sf.fileName)) {
19670
- this.sourceFileToUsedImports.set(sf.fileName, /* @__PURE__ */ new Set());
19671
- }
19672
- this.sourceFileToUsedImports.get(sf.fileName).add(importDecl.importClause);
19673
- }
19674
- }
19675
- importPreservingTransformer() {
19676
- return (context) => {
19677
- let clausesToPreserve = null;
19678
- return (sourceFile) => {
19679
- const clausesForFile = this.sourceFileToUsedImports.get(sourceFile.fileName);
19680
- if (clausesForFile !== void 0) {
19681
- for (const clause of clausesForFile) {
19682
- if (clausesToPreserve === null) {
19683
- clausesToPreserve = loadIsReferencedAliasDeclarationPatch(context);
19684
- }
19685
- clausesToPreserve.add(clause);
19686
- }
19687
- }
19688
- return sourceFile;
19689
- };
19690
- };
19691
- }
19692
- };
19693
-
19694
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
19695
- var Reference2 = class {
19696
- constructor(node, bestGuessOwningModule = null) {
19697
- this.node = node;
19698
- this.identifiers = [];
19699
- this.synthetic = false;
19700
- this._alias = null;
19701
- this.bestGuessOwningModule = bestGuessOwningModule;
19702
- const id = identifierOfNode(node);
19703
- if (id !== null) {
19704
- this.identifiers.push(id);
19705
- }
19706
- }
19707
- get ownedByModuleGuess() {
19708
- if (this.bestGuessOwningModule !== null) {
19709
- return this.bestGuessOwningModule.specifier;
19710
- } else {
19711
- return null;
19712
- }
19713
- }
19714
- get hasOwningModuleGuess() {
19715
- return this.bestGuessOwningModule !== null;
19716
- }
19717
- get debugName() {
19718
- const id = identifierOfNode(this.node);
19719
- return id !== null ? id.text : null;
19720
- }
19721
- get alias() {
19722
- return this._alias;
19723
- }
19724
- addIdentifier(identifier) {
19725
- this.identifiers.push(identifier);
19726
- }
19727
- getIdentityIn(context) {
19728
- return this.identifiers.find((id) => id.getSourceFile() === context) || null;
19729
- }
19730
- getIdentityInExpression(expr) {
19731
- const sf = expr.getSourceFile();
19732
- return this.identifiers.find((id) => {
19733
- if (id.getSourceFile() !== sf) {
19734
- return false;
19735
- }
19736
- return id.pos >= expr.pos && id.end <= expr.end;
19737
- }) || null;
19738
- }
19739
- getOriginForDiagnostics(container, fallback = container) {
19740
- const id = this.getIdentityInExpression(container);
19741
- return id !== null ? id : fallback;
19742
- }
19743
- cloneWithAlias(alias) {
19744
- const ref = new Reference2(this.node, this.bestGuessOwningModule);
19745
- ref.identifiers = [...this.identifiers];
19746
- ref._alias = alias;
19747
- return ref;
19748
- }
19749
- cloneWithNoIdentifiers() {
19750
- const ref = new Reference2(this.node, this.bestGuessOwningModule);
19751
- ref._alias = this._alias;
19752
- ref.identifiers = [];
19753
- return ref;
19754
- }
19755
- };
19756
-
19757
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
19758
- var ModuleResolver = class {
19759
- constructor(program, compilerOptions, host, moduleResolutionCache) {
19760
- this.program = program;
19761
- this.compilerOptions = compilerOptions;
19762
- this.host = host;
19763
- this.moduleResolutionCache = moduleResolutionCache;
19764
- }
19765
- resolveModule(moduleName, containingFile) {
19766
- const resolved = resolveModuleName(moduleName, containingFile, this.compilerOptions, this.host, this.moduleResolutionCache);
19767
- if (resolved === void 0) {
19768
- return null;
19769
- }
19770
- return getSourceFileOrNull(this.program, absoluteFrom(resolved.resolvedFileName));
19771
- }
19772
- };
19773
-
19774
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
19775
- function valueReferenceToExpression(valueRef) {
19776
- if (valueRef.kind === 2) {
19777
- return null;
19778
- } else if (valueRef.kind === 0) {
19779
- const expr = new WrappedNodeExpr(valueRef.expression);
19780
- if (valueRef.defaultImportStatement !== null) {
19781
- attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
19782
- }
19783
- return expr;
19784
- } else {
19785
- let importExpr2 = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
19786
- if (valueRef.nestedPath !== null) {
19787
- for (const property of valueRef.nestedPath) {
19788
- importExpr2 = new ReadPropExpr(importExpr2, property);
19789
- }
19790
- }
19791
- return importExpr2;
19792
- }
19793
- }
19794
- function toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, refEmitter) {
19795
- const emittedValueRef = refEmitter.emit(valueRef, valueContext);
19796
- assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
19797
- const emittedTypeRef = refEmitter.emit(typeRef, typeContext, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
19798
- assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
19799
- return {
19800
- value: emittedValueRef.expression,
19801
- type: emittedTypeRef.expression
19802
- };
19803
- }
19804
- function isAngularCore(decorator) {
19805
- return decorator.import !== null && decorator.import.from === "@angular/core";
19806
- }
19807
- function isAngularCoreReference(reference, symbolName) {
19808
- return reference.ownedByModuleGuess === "@angular/core" && reference.debugName === symbolName;
19809
- }
19810
- function findAngularDecorator(decorators, name, isCore) {
19811
- return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
19812
- }
19813
- function isAngularDecorator(decorator, name, isCore) {
19814
- if (isCore) {
19815
- return decorator.name === name;
19816
- } else if (isAngularCore(decorator)) {
19817
- return decorator.import.name === name;
19818
- }
19819
- return false;
19820
- }
19821
- function unwrapExpression(node) {
19822
- while (import_typescript18.default.isAsExpression(node) || import_typescript18.default.isParenthesizedExpression(node)) {
19823
- node = node.expression;
19824
- }
19825
- return node;
19826
- }
19827
- function expandForwardRef(arg) {
19828
- arg = unwrapExpression(arg);
19829
- if (!import_typescript18.default.isArrowFunction(arg) && !import_typescript18.default.isFunctionExpression(arg)) {
19830
- return null;
19831
- }
19832
- const body = arg.body;
19833
- if (import_typescript18.default.isBlock(body)) {
19834
- if (body.statements.length !== 1) {
19835
- return null;
19836
- }
19837
- const stmt = body.statements[0];
19838
- if (!import_typescript18.default.isReturnStatement(stmt) || stmt.expression === void 0) {
19839
- return null;
19840
- }
19841
- return stmt.expression;
19842
- } else {
19843
- return body;
19844
- }
19845
- }
19846
- function tryUnwrapForwardRef(node, reflector) {
19847
- node = unwrapExpression(node);
19848
- if (!import_typescript18.default.isCallExpression(node) || node.arguments.length !== 1) {
19849
- return null;
19850
- }
19851
- const fn2 = import_typescript18.default.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
19852
- if (!import_typescript18.default.isIdentifier(fn2)) {
19853
- return null;
19854
- }
19855
- const expr = expandForwardRef(node.arguments[0]);
19856
- if (expr === null) {
19857
- return null;
19858
- }
19859
- const imp = reflector.getImportOfIdentifier(fn2);
19860
- if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
19861
- return null;
19862
- }
19863
- return expr;
19864
- }
19865
- var forwardRefResolver = (fn2, callExpr, resolve6, unresolvable) => {
19866
- if (!isAngularCoreReference(fn2, "forwardRef") || callExpr.arguments.length !== 1) {
19867
- return unresolvable;
19868
- }
19869
- const expanded = expandForwardRef(callExpr.arguments[0]);
19870
- if (expanded !== null) {
19871
- return resolve6(expanded);
19872
- } else {
19873
- return unresolvable;
19874
- }
19875
- };
19876
- function combineResolvers(resolvers) {
19877
- return (fn2, callExpr, resolve6, unresolvable) => {
19878
- for (const resolver of resolvers) {
19879
- const resolved = resolver(fn2, callExpr, resolve6, unresolvable);
19880
- if (resolved !== unresolvable) {
19881
- return resolved;
19882
- }
19883
- }
19884
- return unresolvable;
19885
- };
19886
- }
19887
- function isExpressionForwardReference(expr, context, contextSource) {
19888
- if (isWrappedTsNodeExpr(expr)) {
19889
- const node = import_typescript18.default.getOriginalNode(expr.node);
19890
- return node.getSourceFile() === contextSource && context.pos < node.pos;
19891
- } else {
19892
- return false;
19893
- }
19894
- }
19895
- function isWrappedTsNodeExpr(expr) {
19896
- return expr instanceof WrappedNodeExpr;
19897
- }
19898
- function readBaseClass(node, reflector, evaluator) {
19899
- const baseExpression = reflector.getBaseClassExpression(node);
19900
- if (baseExpression !== null) {
19901
- const baseClass = evaluator.evaluate(baseExpression);
19902
- if (baseClass instanceof Reference2 && reflector.isClass(baseClass.node)) {
19903
- return baseClass;
19904
- } else {
19905
- return "dynamic";
19906
- }
19907
- }
19908
- return null;
19909
- }
19910
- var parensWrapperTransformerFactory = (context) => {
19911
- const visitor = (node) => {
19912
- const visited = import_typescript18.default.visitEachChild(node, visitor, context);
19913
- if (import_typescript18.default.isArrowFunction(visited) || import_typescript18.default.isFunctionExpression(visited)) {
19914
- return import_typescript18.default.factory.createParenthesizedExpression(visited);
19915
- }
19916
- return visited;
19917
- };
19918
- return (node) => import_typescript18.default.visitEachChild(node, visitor, context);
19919
- };
19920
- function wrapFunctionExpressionsInParens(expression) {
19921
- return import_typescript18.default.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
19922
- }
19923
- function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
19924
- const providers = /* @__PURE__ */ new Set();
19925
- const resolvedProviders = evaluator.evaluate(rawProviders);
19926
- if (!Array.isArray(resolvedProviders)) {
19927
- return providers;
19928
- }
19929
- resolvedProviders.forEach(function processProviders(provider) {
19930
- let tokenClass = null;
19931
- if (Array.isArray(provider)) {
19932
- provider.forEach(processProviders);
19933
- } else if (provider instanceof Reference2) {
19934
- tokenClass = provider;
19935
- } else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
19936
- const useExisting = provider.get("useClass");
19937
- if (useExisting instanceof Reference2) {
19938
- tokenClass = useExisting;
19267
+ resolvedProviders.forEach(function processProviders(provider) {
19268
+ let tokenClass = null;
19269
+ if (Array.isArray(provider)) {
19270
+ provider.forEach(processProviders);
19271
+ } else if (provider instanceof Reference2) {
19272
+ tokenClass = provider;
19273
+ } else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
19274
+ const useExisting = provider.get("useClass");
19275
+ if (useExisting instanceof Reference2) {
19276
+ tokenClass = useExisting;
19939
19277
  }
19940
19278
  }
19941
19279
  if (tokenClass !== null && !tokenClass.node.getSourceFile().isDeclarationFile && reflector.isClass(tokenClass.node)) {
@@ -19948,9 +19286,8 @@ function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
19948
19286
  return providers;
19949
19287
  }
19950
19288
  function wrapTypeReference(reflector, clazz) {
19951
- const dtsClass = reflector.getDtsDeclaration(clazz);
19952
19289
  const value = new WrappedNodeExpr(clazz.name);
19953
- const type = dtsClass !== null && isNamedClassDeclaration(dtsClass) ? new WrappedNodeExpr(dtsClass.name) : value;
19290
+ const type = value;
19954
19291
  return { value, type };
19955
19292
  }
19956
19293
  function createSourceSpan(node) {
@@ -19980,7 +19317,6 @@ function toFactoryMetadata(meta, target) {
19980
19317
  return {
19981
19318
  name: meta.name,
19982
19319
  type: meta.type,
19983
- internalType: meta.internalType,
19984
19320
  typeArgumentCount: meta.typeArgumentCount,
19985
19321
  deps: meta.deps,
19986
19322
  target
@@ -20001,173 +19337,786 @@ function getOriginNodeForDiagnostics(expr, container) {
20001
19337
  if (nodeSf === exprSf && expr.pos >= container.pos && expr.end <= container.end) {
20002
19338
  return expr;
20003
19339
  } else {
20004
- return container;
19340
+ return container;
19341
+ }
19342
+ }
19343
+ function isAbstractClassDeclaration(clazz) {
19344
+ return import_typescript13.default.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === import_typescript13.default.SyntaxKind.AbstractKeyword) : false;
19345
+ }
19346
+
19347
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
19348
+ function getConstructorDependencies(clazz, reflector, isCore) {
19349
+ const deps = [];
19350
+ const errors = [];
19351
+ let ctorParams = reflector.getConstructorParameters(clazz);
19352
+ if (ctorParams === null) {
19353
+ if (reflector.hasBaseClass(clazz)) {
19354
+ return null;
19355
+ } else {
19356
+ ctorParams = [];
19357
+ }
19358
+ }
19359
+ ctorParams.forEach((param, idx) => {
19360
+ let token = valueReferenceToExpression(param.typeValueReference);
19361
+ let attributeNameType = null;
19362
+ let optional = false, self2 = false, skipSelf = false, host = false;
19363
+ (param.decorators || []).filter((dec) => isCore || isAngularCore(dec)).forEach((dec) => {
19364
+ const name = isCore || dec.import === null ? dec.name : dec.import.name;
19365
+ if (name === "Inject") {
19366
+ if (dec.args === null || dec.args.length !== 1) {
19367
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, dec.node, `Unexpected number of arguments to @Inject().`);
19368
+ }
19369
+ token = new WrappedNodeExpr(dec.args[0]);
19370
+ } else if (name === "Optional") {
19371
+ optional = true;
19372
+ } else if (name === "SkipSelf") {
19373
+ skipSelf = true;
19374
+ } else if (name === "Self") {
19375
+ self2 = true;
19376
+ } else if (name === "Host") {
19377
+ host = true;
19378
+ } else if (name === "Attribute") {
19379
+ if (dec.args === null || dec.args.length !== 1) {
19380
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, dec.node, `Unexpected number of arguments to @Attribute().`);
19381
+ }
19382
+ const attributeName = dec.args[0];
19383
+ token = new WrappedNodeExpr(attributeName);
19384
+ if (import_typescript14.default.isStringLiteralLike(attributeName)) {
19385
+ attributeNameType = new LiteralExpr(attributeName.text);
19386
+ } else {
19387
+ attributeNameType = new WrappedNodeExpr(import_typescript14.default.factory.createKeywordTypeNode(import_typescript14.default.SyntaxKind.UnknownKeyword));
19388
+ }
19389
+ } else {
19390
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, dec.node, `Unexpected decorator ${name} on parameter.`);
19391
+ }
19392
+ });
19393
+ if (token === null) {
19394
+ if (param.typeValueReference.kind !== 2) {
19395
+ throw new Error("Illegal state: expected value reference to be unavailable if no token is present");
19396
+ }
19397
+ errors.push({
19398
+ index: idx,
19399
+ param,
19400
+ reason: param.typeValueReference.reason
19401
+ });
19402
+ } else {
19403
+ deps.push({ token, attributeNameType, optional, self: self2, skipSelf, host });
19404
+ }
19405
+ });
19406
+ if (errors.length === 0) {
19407
+ return { deps };
19408
+ } else {
19409
+ return { deps: null, errors };
19410
+ }
19411
+ }
19412
+ function unwrapConstructorDependencies(deps) {
19413
+ if (deps === null) {
19414
+ return null;
19415
+ } else if (deps.deps !== null) {
19416
+ return deps.deps;
19417
+ } else {
19418
+ return "invalid";
19419
+ }
19420
+ }
19421
+ function getValidConstructorDependencies(clazz, reflector, isCore) {
19422
+ return validateConstructorDependencies(clazz, getConstructorDependencies(clazz, reflector, isCore));
19423
+ }
19424
+ function validateConstructorDependencies(clazz, deps) {
19425
+ if (deps === null) {
19426
+ return null;
19427
+ } else if (deps.deps !== null) {
19428
+ return deps.deps;
19429
+ } else {
19430
+ const error2 = deps.errors[0];
19431
+ throw createUnsuitableInjectionTokenError(clazz, error2);
19432
+ }
19433
+ }
19434
+ function createUnsuitableInjectionTokenError(clazz, error2) {
19435
+ const { param, index, reason } = error2;
19436
+ let chainMessage = void 0;
19437
+ let hints = void 0;
19438
+ switch (reason.kind) {
19439
+ case 5:
19440
+ chainMessage = "Consider using the @Inject decorator to specify an injection token.";
19441
+ hints = [
19442
+ makeRelatedInformation(reason.typeNode, "This type is not supported as injection token.")
19443
+ ];
19444
+ break;
19445
+ case 1:
19446
+ chainMessage = "Consider using the @Inject decorator to specify an injection token.";
19447
+ hints = [
19448
+ makeRelatedInformation(reason.typeNode, "This type does not have a value, so it cannot be used as injection token.")
19449
+ ];
19450
+ if (reason.decl !== null) {
19451
+ hints.push(makeRelatedInformation(reason.decl, "The type is declared here."));
19452
+ }
19453
+ break;
19454
+ case 2:
19455
+ chainMessage = "Consider changing the type-only import to a regular import, or use the @Inject decorator to specify an injection token.";
19456
+ hints = [
19457
+ makeRelatedInformation(reason.typeNode, "This type is imported using a type-only import, which prevents it from being usable as an injection token."),
19458
+ makeRelatedInformation(reason.node, "The type-only import occurs here.")
19459
+ ];
19460
+ break;
19461
+ case 4:
19462
+ chainMessage = "Consider using the @Inject decorator to specify an injection token.";
19463
+ hints = [
19464
+ makeRelatedInformation(reason.typeNode, "This type corresponds with a namespace, which cannot be used as injection token."),
19465
+ makeRelatedInformation(reason.importClause, "The namespace import occurs here.")
19466
+ ];
19467
+ break;
19468
+ case 3:
19469
+ chainMessage = "The type should reference a known declaration.";
19470
+ hints = [makeRelatedInformation(reason.typeNode, "This type could not be resolved.")];
19471
+ break;
19472
+ case 0:
19473
+ chainMessage = "Consider adding a type to the parameter or use the @Inject decorator to specify an injection token.";
19474
+ break;
19475
+ }
19476
+ const chain = {
19477
+ messageText: `No suitable injection token for parameter '${param.name || index}' of class '${clazz.name.text}'.`,
19478
+ category: import_typescript14.default.DiagnosticCategory.Error,
19479
+ code: 0,
19480
+ next: [{
19481
+ messageText: chainMessage,
19482
+ category: import_typescript14.default.DiagnosticCategory.Message,
19483
+ code: 0
19484
+ }]
19485
+ };
19486
+ return new FatalDiagnosticError(ErrorCode.PARAM_MISSING_TOKEN, param.nameNode, chain, hints);
19487
+ }
19488
+
19489
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/diagnostics.mjs
19490
+ var import_typescript27 = __toESM(require("typescript"), 1);
19491
+
19492
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
19493
+ var MetaKind;
19494
+ (function(MetaKind2) {
19495
+ MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
19496
+ MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
19497
+ MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
19498
+ })(MetaKind || (MetaKind = {}));
19499
+ var MatchSource;
19500
+ (function(MatchSource2) {
19501
+ MatchSource2[MatchSource2["Selector"] = 0] = "Selector";
19502
+ MatchSource2[MatchSource2["HostDirective"] = 1] = "HostDirective";
19503
+ })(MatchSource || (MatchSource = {}));
19504
+
19505
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
19506
+ var import_typescript22 = __toESM(require("typescript"), 1);
19507
+
19508
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
19509
+ var import_typescript15 = __toESM(require("typescript"), 1);
19510
+ function isDecoratorIdentifier(exp) {
19511
+ return import_typescript15.default.isIdentifier(exp) || import_typescript15.default.isPropertyAccessExpression(exp) && import_typescript15.default.isIdentifier(exp.expression) && import_typescript15.default.isIdentifier(exp.name);
19512
+ }
19513
+ var ClassMemberKind;
19514
+ (function(ClassMemberKind2) {
19515
+ ClassMemberKind2[ClassMemberKind2["Constructor"] = 0] = "Constructor";
19516
+ ClassMemberKind2[ClassMemberKind2["Getter"] = 1] = "Getter";
19517
+ ClassMemberKind2[ClassMemberKind2["Setter"] = 2] = "Setter";
19518
+ ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
19519
+ ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
19520
+ })(ClassMemberKind || (ClassMemberKind = {}));
19521
+
19522
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
19523
+ var import_typescript16 = __toESM(require("typescript"), 1);
19524
+ function typeToValue(typeNode, checker) {
19525
+ if (typeNode === null) {
19526
+ return missingType();
19527
+ }
19528
+ if (!import_typescript16.default.isTypeReferenceNode(typeNode)) {
19529
+ return unsupportedType(typeNode);
19530
+ }
19531
+ const symbols = resolveTypeSymbols(typeNode, checker);
19532
+ if (symbols === null) {
19533
+ return unknownReference(typeNode);
19534
+ }
19535
+ const { local, decl } = symbols;
19536
+ if (decl.valueDeclaration === void 0 || decl.flags & import_typescript16.default.SymbolFlags.ConstEnum) {
19537
+ let typeOnlyDecl = null;
19538
+ if (decl.declarations !== void 0 && decl.declarations.length > 0) {
19539
+ typeOnlyDecl = decl.declarations[0];
19540
+ }
19541
+ return noValueDeclaration(typeNode, typeOnlyDecl);
19542
+ }
19543
+ const firstDecl = local.declarations && local.declarations[0];
19544
+ if (firstDecl !== void 0) {
19545
+ if (import_typescript16.default.isImportClause(firstDecl) && firstDecl.name !== void 0) {
19546
+ if (firstDecl.isTypeOnly) {
19547
+ return typeOnlyImport(typeNode, firstDecl);
19548
+ }
19549
+ return {
19550
+ kind: 0,
19551
+ expression: firstDecl.name,
19552
+ defaultImportStatement: firstDecl.parent
19553
+ };
19554
+ } else if (import_typescript16.default.isImportSpecifier(firstDecl)) {
19555
+ if (firstDecl.isTypeOnly) {
19556
+ return typeOnlyImport(typeNode, firstDecl);
19557
+ }
19558
+ if (firstDecl.parent.parent.isTypeOnly) {
19559
+ return typeOnlyImport(typeNode, firstDecl.parent.parent);
19560
+ }
19561
+ const importedName = (firstDecl.propertyName || firstDecl.name).text;
19562
+ const [_localName, ...nestedPath] = symbols.symbolNames;
19563
+ const moduleName = extractModuleName(firstDecl.parent.parent.parent);
19564
+ return {
19565
+ kind: 1,
19566
+ valueDeclaration: decl.valueDeclaration,
19567
+ moduleName,
19568
+ importedName,
19569
+ nestedPath
19570
+ };
19571
+ } else if (import_typescript16.default.isNamespaceImport(firstDecl)) {
19572
+ if (firstDecl.parent.isTypeOnly) {
19573
+ return typeOnlyImport(typeNode, firstDecl.parent);
19574
+ }
19575
+ if (symbols.symbolNames.length === 1) {
19576
+ return namespaceImport(typeNode, firstDecl.parent);
19577
+ }
19578
+ const [_ns, importedName, ...nestedPath] = symbols.symbolNames;
19579
+ const moduleName = extractModuleName(firstDecl.parent.parent);
19580
+ return {
19581
+ kind: 1,
19582
+ valueDeclaration: decl.valueDeclaration,
19583
+ moduleName,
19584
+ importedName,
19585
+ nestedPath
19586
+ };
19587
+ }
19588
+ }
19589
+ const expression = typeNodeToValueExpr(typeNode);
19590
+ if (expression !== null) {
19591
+ return {
19592
+ kind: 0,
19593
+ expression,
19594
+ defaultImportStatement: null
19595
+ };
19596
+ } else {
19597
+ return unsupportedType(typeNode);
19598
+ }
19599
+ }
19600
+ function unsupportedType(typeNode) {
19601
+ return {
19602
+ kind: 2,
19603
+ reason: { kind: 5, typeNode }
19604
+ };
19605
+ }
19606
+ function noValueDeclaration(typeNode, decl) {
19607
+ return {
19608
+ kind: 2,
19609
+ reason: { kind: 1, typeNode, decl }
19610
+ };
19611
+ }
19612
+ function typeOnlyImport(typeNode, node) {
19613
+ return {
19614
+ kind: 2,
19615
+ reason: { kind: 2, typeNode, node }
19616
+ };
19617
+ }
19618
+ function unknownReference(typeNode) {
19619
+ return {
19620
+ kind: 2,
19621
+ reason: { kind: 3, typeNode }
19622
+ };
19623
+ }
19624
+ function namespaceImport(typeNode, importClause) {
19625
+ return {
19626
+ kind: 2,
19627
+ reason: { kind: 4, typeNode, importClause }
19628
+ };
19629
+ }
19630
+ function missingType() {
19631
+ return {
19632
+ kind: 2,
19633
+ reason: { kind: 0 }
19634
+ };
19635
+ }
19636
+ function typeNodeToValueExpr(node) {
19637
+ if (import_typescript16.default.isTypeReferenceNode(node)) {
19638
+ return entityNameToValue(node.typeName);
19639
+ } else {
19640
+ return null;
19641
+ }
19642
+ }
19643
+ function resolveTypeSymbols(typeRef, checker) {
19644
+ const typeName = typeRef.typeName;
19645
+ const typeRefSymbol = checker.getSymbolAtLocation(typeName);
19646
+ if (typeRefSymbol === void 0) {
19647
+ return null;
19648
+ }
19649
+ let local = typeRefSymbol;
19650
+ let leftMost = typeName;
19651
+ const symbolNames = [];
19652
+ while (import_typescript16.default.isQualifiedName(leftMost)) {
19653
+ symbolNames.unshift(leftMost.right.text);
19654
+ leftMost = leftMost.left;
19655
+ }
19656
+ symbolNames.unshift(leftMost.text);
19657
+ if (leftMost !== typeName) {
19658
+ const localTmp = checker.getSymbolAtLocation(leftMost);
19659
+ if (localTmp !== void 0) {
19660
+ local = localTmp;
19661
+ }
19662
+ }
19663
+ let decl = typeRefSymbol;
19664
+ if (typeRefSymbol.flags & import_typescript16.default.SymbolFlags.Alias) {
19665
+ decl = checker.getAliasedSymbol(typeRefSymbol);
19666
+ }
19667
+ return { local, decl, symbolNames };
19668
+ }
19669
+ function entityNameToValue(node) {
19670
+ if (import_typescript16.default.isQualifiedName(node)) {
19671
+ const left = entityNameToValue(node.left);
19672
+ return left !== null ? import_typescript16.default.factory.createPropertyAccessExpression(left, node.right) : null;
19673
+ } else if (import_typescript16.default.isIdentifier(node)) {
19674
+ const clone = import_typescript16.default.setOriginalNode(import_typescript16.default.factory.createIdentifier(node.text), node);
19675
+ clone.parent = node.parent;
19676
+ return clone;
19677
+ } else {
19678
+ return null;
19679
+ }
19680
+ }
19681
+ function extractModuleName(node) {
19682
+ if (!import_typescript16.default.isStringLiteral(node.moduleSpecifier)) {
19683
+ throw new Error("not a module specifier");
19684
+ }
19685
+ return node.moduleSpecifier.text;
19686
+ }
19687
+
19688
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
19689
+ var import_typescript18 = __toESM(require("typescript"), 1);
19690
+
19691
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
19692
+ var import_typescript17 = __toESM(require("typescript"), 1);
19693
+ function isNamedClassDeclaration(node) {
19694
+ return import_typescript17.default.isClassDeclaration(node) && isIdentifier(node.name);
19695
+ }
19696
+ function isIdentifier(node) {
19697
+ return node !== void 0 && import_typescript17.default.isIdentifier(node);
19698
+ }
19699
+
19700
+ // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
19701
+ var TypeScriptReflectionHost = class {
19702
+ constructor(checker) {
19703
+ this.checker = checker;
19704
+ }
19705
+ getDecoratorsOfDeclaration(declaration) {
19706
+ const decorators = import_typescript18.default.canHaveDecorators(declaration) ? import_typescript18.default.getDecorators(declaration) : void 0;
19707
+ return decorators !== void 0 && decorators.length ? decorators.map((decorator) => this._reflectDecorator(decorator)).filter((dec) => dec !== null) : null;
19708
+ }
19709
+ getMembersOfClass(clazz) {
19710
+ const tsClazz = castDeclarationToClassOrDie(clazz);
19711
+ return tsClazz.members.map((member) => this._reflectMember(member)).filter((member) => member !== null);
19712
+ }
19713
+ getConstructorParameters(clazz) {
19714
+ const tsClazz = castDeclarationToClassOrDie(clazz);
19715
+ const isDeclaration2 = tsClazz.getSourceFile().isDeclarationFile;
19716
+ const ctor = tsClazz.members.find((member) => import_typescript18.default.isConstructorDeclaration(member) && (isDeclaration2 || member.body !== void 0));
19717
+ if (ctor === void 0) {
19718
+ return null;
19719
+ }
19720
+ return ctor.parameters.map((node) => {
19721
+ const name = parameterName(node.name);
19722
+ const decorators = this.getDecoratorsOfDeclaration(node);
19723
+ let originalTypeNode = node.type || null;
19724
+ let typeNode = originalTypeNode;
19725
+ if (typeNode && import_typescript18.default.isUnionTypeNode(typeNode)) {
19726
+ let childTypeNodes = typeNode.types.filter((childTypeNode) => !(import_typescript18.default.isLiteralTypeNode(childTypeNode) && childTypeNode.literal.kind === import_typescript18.default.SyntaxKind.NullKeyword));
19727
+ if (childTypeNodes.length === 1) {
19728
+ typeNode = childTypeNodes[0];
19729
+ }
19730
+ }
19731
+ const typeValueReference = typeToValue(typeNode, this.checker);
19732
+ return {
19733
+ name,
19734
+ nameNode: node.name,
19735
+ typeValueReference,
19736
+ typeNode: originalTypeNode,
19737
+ decorators
19738
+ };
19739
+ });
19740
+ }
19741
+ getImportOfIdentifier(id) {
19742
+ const directImport = this.getDirectImportOfIdentifier(id);
19743
+ if (directImport !== null) {
19744
+ return directImport;
19745
+ } else if (import_typescript18.default.isQualifiedName(id.parent) && id.parent.right === id) {
19746
+ return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent));
19747
+ } else if (import_typescript18.default.isPropertyAccessExpression(id.parent) && id.parent.name === id) {
19748
+ return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent));
19749
+ } else {
19750
+ return null;
19751
+ }
19752
+ }
19753
+ getExportsOfModule(node) {
19754
+ if (!import_typescript18.default.isSourceFile(node)) {
19755
+ throw new Error(`getExportsOfModule() called on non-SourceFile in TS code`);
19756
+ }
19757
+ const symbol = this.checker.getSymbolAtLocation(node);
19758
+ if (symbol === void 0) {
19759
+ return null;
19760
+ }
19761
+ const map = /* @__PURE__ */ new Map();
19762
+ this.checker.getExportsOfModule(symbol).forEach((exportSymbol) => {
19763
+ const decl = this.getDeclarationOfSymbol(exportSymbol, null);
19764
+ if (decl !== null) {
19765
+ map.set(exportSymbol.name, decl);
19766
+ }
19767
+ });
19768
+ return map;
19769
+ }
19770
+ isClass(node) {
19771
+ return isNamedClassDeclaration(node);
19772
+ }
19773
+ hasBaseClass(clazz) {
19774
+ return this.getBaseClassExpression(clazz) !== null;
19775
+ }
19776
+ getBaseClassExpression(clazz) {
19777
+ if (!(import_typescript18.default.isClassDeclaration(clazz) || import_typescript18.default.isClassExpression(clazz)) || clazz.heritageClauses === void 0) {
19778
+ return null;
19779
+ }
19780
+ const extendsClause = clazz.heritageClauses.find((clause) => clause.token === import_typescript18.default.SyntaxKind.ExtendsKeyword);
19781
+ if (extendsClause === void 0) {
19782
+ return null;
19783
+ }
19784
+ const extendsType = extendsClause.types[0];
19785
+ if (extendsType === void 0) {
19786
+ return null;
19787
+ }
19788
+ return extendsType.expression;
19789
+ }
19790
+ getDeclarationOfIdentifier(id) {
19791
+ let symbol = this.checker.getSymbolAtLocation(id);
19792
+ if (symbol === void 0) {
19793
+ return null;
19794
+ }
19795
+ return this.getDeclarationOfSymbol(symbol, id);
19796
+ }
19797
+ getDefinitionOfFunction(node) {
19798
+ if (!import_typescript18.default.isFunctionDeclaration(node) && !import_typescript18.default.isMethodDeclaration(node) && !import_typescript18.default.isFunctionExpression(node)) {
19799
+ return null;
19800
+ }
19801
+ return {
19802
+ node,
19803
+ body: node.body !== void 0 ? Array.from(node.body.statements) : null,
19804
+ parameters: node.parameters.map((param) => {
19805
+ const name = parameterName(param.name);
19806
+ const initializer = param.initializer || null;
19807
+ return { name, node: param, initializer };
19808
+ })
19809
+ };
19810
+ }
19811
+ getGenericArityOfClass(clazz) {
19812
+ if (!import_typescript18.default.isClassDeclaration(clazz)) {
19813
+ return null;
19814
+ }
19815
+ return clazz.typeParameters !== void 0 ? clazz.typeParameters.length : 0;
19816
+ }
19817
+ getVariableValue(declaration) {
19818
+ return declaration.initializer || null;
19819
+ }
19820
+ isStaticallyExported(decl) {
19821
+ let topLevel = decl;
19822
+ if (import_typescript18.default.isVariableDeclaration(decl) && import_typescript18.default.isVariableDeclarationList(decl.parent)) {
19823
+ topLevel = decl.parent.parent;
19824
+ }
19825
+ const modifiers = import_typescript18.default.canHaveModifiers(topLevel) ? import_typescript18.default.getModifiers(topLevel) : void 0;
19826
+ if (modifiers !== void 0 && modifiers.some((modifier) => modifier.kind === import_typescript18.default.SyntaxKind.ExportKeyword)) {
19827
+ return true;
19828
+ }
19829
+ if (topLevel.parent === void 0 || !import_typescript18.default.isSourceFile(topLevel.parent)) {
19830
+ return false;
19831
+ }
19832
+ const localExports = this.getLocalExportedDeclarationsOfSourceFile(decl.getSourceFile());
19833
+ return localExports.has(decl);
19834
+ }
19835
+ getDirectImportOfIdentifier(id) {
19836
+ const symbol = this.checker.getSymbolAtLocation(id);
19837
+ if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
19838
+ return null;
19839
+ }
19840
+ const decl = symbol.declarations[0];
19841
+ const importDecl = getContainingImportDeclaration(decl);
19842
+ if (importDecl === null) {
19843
+ return null;
19844
+ }
19845
+ if (!import_typescript18.default.isStringLiteral(importDecl.moduleSpecifier)) {
19846
+ return null;
19847
+ }
19848
+ return { from: importDecl.moduleSpecifier.text, name: getExportedName(decl, id) };
19849
+ }
19850
+ getImportOfNamespacedIdentifier(id, namespaceIdentifier) {
19851
+ if (namespaceIdentifier === null) {
19852
+ return null;
19853
+ }
19854
+ const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier);
19855
+ if (!namespaceSymbol || namespaceSymbol.declarations === void 0) {
19856
+ return null;
19857
+ }
19858
+ const declaration = namespaceSymbol.declarations.length === 1 ? namespaceSymbol.declarations[0] : null;
19859
+ if (!declaration) {
19860
+ return null;
19861
+ }
19862
+ const namespaceDeclaration = import_typescript18.default.isNamespaceImport(declaration) ? declaration : null;
19863
+ if (!namespaceDeclaration) {
19864
+ return null;
19865
+ }
19866
+ const importDeclaration = namespaceDeclaration.parent.parent;
19867
+ if (!import_typescript18.default.isStringLiteral(importDeclaration.moduleSpecifier)) {
19868
+ return null;
19869
+ }
19870
+ return {
19871
+ from: importDeclaration.moduleSpecifier.text,
19872
+ name: id.text
19873
+ };
19874
+ }
19875
+ getDeclarationOfSymbol(symbol, originalId) {
19876
+ let valueDeclaration = void 0;
19877
+ if (symbol.valueDeclaration !== void 0) {
19878
+ valueDeclaration = symbol.valueDeclaration;
19879
+ } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
19880
+ valueDeclaration = symbol.declarations[0];
19881
+ }
19882
+ if (valueDeclaration !== void 0 && import_typescript18.default.isShorthandPropertyAssignment(valueDeclaration)) {
19883
+ const shorthandSymbol = this.checker.getShorthandAssignmentValueSymbol(valueDeclaration);
19884
+ if (shorthandSymbol === void 0) {
19885
+ return null;
19886
+ }
19887
+ return this.getDeclarationOfSymbol(shorthandSymbol, originalId);
19888
+ } else if (valueDeclaration !== void 0 && import_typescript18.default.isExportSpecifier(valueDeclaration)) {
19889
+ const targetSymbol = this.checker.getExportSpecifierLocalTargetSymbol(valueDeclaration);
19890
+ if (targetSymbol === void 0) {
19891
+ return null;
19892
+ }
19893
+ return this.getDeclarationOfSymbol(targetSymbol, originalId);
19894
+ }
19895
+ const importInfo = originalId && this.getImportOfIdentifier(originalId);
19896
+ const viaModule = importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
19897
+ while (symbol.flags & import_typescript18.default.SymbolFlags.Alias) {
19898
+ symbol = this.checker.getAliasedSymbol(symbol);
19899
+ }
19900
+ if (symbol.valueDeclaration !== void 0) {
19901
+ return {
19902
+ node: symbol.valueDeclaration,
19903
+ viaModule
19904
+ };
19905
+ } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
19906
+ return {
19907
+ node: symbol.declarations[0],
19908
+ viaModule
19909
+ };
19910
+ } else {
19911
+ return null;
19912
+ }
19913
+ }
19914
+ _reflectDecorator(node) {
19915
+ let decoratorExpr = node.expression;
19916
+ let args = null;
19917
+ if (import_typescript18.default.isCallExpression(decoratorExpr)) {
19918
+ args = Array.from(decoratorExpr.arguments);
19919
+ decoratorExpr = decoratorExpr.expression;
19920
+ }
19921
+ if (!isDecoratorIdentifier(decoratorExpr)) {
19922
+ return null;
19923
+ }
19924
+ const decoratorIdentifier = import_typescript18.default.isIdentifier(decoratorExpr) ? decoratorExpr : decoratorExpr.name;
19925
+ const importDecl = this.getImportOfIdentifier(decoratorIdentifier);
19926
+ return {
19927
+ name: decoratorIdentifier.text,
19928
+ identifier: decoratorExpr,
19929
+ import: importDecl,
19930
+ node,
19931
+ args
19932
+ };
19933
+ }
19934
+ _reflectMember(node) {
19935
+ let kind = null;
19936
+ let value = null;
19937
+ let name = null;
19938
+ let nameNode = null;
19939
+ if (import_typescript18.default.isPropertyDeclaration(node)) {
19940
+ kind = ClassMemberKind.Property;
19941
+ value = node.initializer || null;
19942
+ } else if (import_typescript18.default.isGetAccessorDeclaration(node)) {
19943
+ kind = ClassMemberKind.Getter;
19944
+ } else if (import_typescript18.default.isSetAccessorDeclaration(node)) {
19945
+ kind = ClassMemberKind.Setter;
19946
+ } else if (import_typescript18.default.isMethodDeclaration(node)) {
19947
+ kind = ClassMemberKind.Method;
19948
+ } else if (import_typescript18.default.isConstructorDeclaration(node)) {
19949
+ kind = ClassMemberKind.Constructor;
19950
+ } else {
19951
+ return null;
19952
+ }
19953
+ if (import_typescript18.default.isConstructorDeclaration(node)) {
19954
+ name = "constructor";
19955
+ } else if (import_typescript18.default.isIdentifier(node.name)) {
19956
+ name = node.name.text;
19957
+ nameNode = node.name;
19958
+ } else if (import_typescript18.default.isStringLiteral(node.name)) {
19959
+ name = node.name.text;
19960
+ nameNode = node.name;
19961
+ } else {
19962
+ return null;
19963
+ }
19964
+ const decorators = this.getDecoratorsOfDeclaration(node);
19965
+ const modifiers = import_typescript18.default.getModifiers(node);
19966
+ const isStatic = modifiers !== void 0 && modifiers.some((mod) => mod.kind === import_typescript18.default.SyntaxKind.StaticKeyword);
19967
+ return {
19968
+ node,
19969
+ implementation: node,
19970
+ kind,
19971
+ type: node.type || null,
19972
+ name,
19973
+ nameNode,
19974
+ decorators,
19975
+ value,
19976
+ isStatic
19977
+ };
19978
+ }
19979
+ getLocalExportedDeclarationsOfSourceFile(file) {
19980
+ const cacheSf = file;
19981
+ if (cacheSf[LocalExportedDeclarations] !== void 0) {
19982
+ return cacheSf[LocalExportedDeclarations];
19983
+ }
19984
+ const exportSet = /* @__PURE__ */ new Set();
19985
+ cacheSf[LocalExportedDeclarations] = exportSet;
19986
+ const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
19987
+ if (sfSymbol === void 0 || sfSymbol.exports === void 0) {
19988
+ return exportSet;
19989
+ }
19990
+ const iter = sfSymbol.exports.values();
19991
+ let item = iter.next();
19992
+ while (item.done !== true) {
19993
+ let exportedSymbol = item.value;
19994
+ if (exportedSymbol.flags & import_typescript18.default.SymbolFlags.Alias) {
19995
+ exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
19996
+ }
19997
+ if (exportedSymbol.valueDeclaration !== void 0 && exportedSymbol.valueDeclaration.getSourceFile() === file) {
19998
+ exportSet.add(exportedSymbol.valueDeclaration);
19999
+ }
20000
+ item = iter.next();
20001
+ }
20002
+ return exportSet;
20003
+ }
20004
+ };
20005
+ function reflectTypeEntityToDeclaration(type, checker) {
20006
+ let realSymbol = checker.getSymbolAtLocation(type);
20007
+ if (realSymbol === void 0) {
20008
+ throw new Error(`Cannot resolve type entity ${type.getText()} to symbol`);
20009
+ }
20010
+ while (realSymbol.flags & import_typescript18.default.SymbolFlags.Alias) {
20011
+ realSymbol = checker.getAliasedSymbol(realSymbol);
20012
+ }
20013
+ let node = null;
20014
+ if (realSymbol.valueDeclaration !== void 0) {
20015
+ node = realSymbol.valueDeclaration;
20016
+ } else if (realSymbol.declarations !== void 0 && realSymbol.declarations.length === 1) {
20017
+ node = realSymbol.declarations[0];
20018
+ } else {
20019
+ throw new Error(`Cannot resolve type entity symbol to declaration`);
20020
+ }
20021
+ if (import_typescript18.default.isQualifiedName(type)) {
20022
+ if (!import_typescript18.default.isIdentifier(type.left)) {
20023
+ throw new Error(`Cannot handle qualified name with non-identifier lhs`);
20024
+ }
20025
+ const symbol = checker.getSymbolAtLocation(type.left);
20026
+ if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
20027
+ throw new Error(`Cannot resolve qualified type entity lhs to symbol`);
20028
+ }
20029
+ const decl = symbol.declarations[0];
20030
+ if (import_typescript18.default.isNamespaceImport(decl)) {
20031
+ const clause = decl.parent;
20032
+ const importDecl = clause.parent;
20033
+ if (!import_typescript18.default.isStringLiteral(importDecl.moduleSpecifier)) {
20034
+ throw new Error(`Module specifier is not a string`);
20035
+ }
20036
+ return { node, from: importDecl.moduleSpecifier.text };
20037
+ } else if (import_typescript18.default.isModuleDeclaration(decl)) {
20038
+ return { node, from: null };
20039
+ } else {
20040
+ throw new Error(`Unknown import type?`);
20041
+ }
20042
+ } else {
20043
+ return { node, from: null };
20005
20044
  }
20006
20045
  }
20007
- function isAbstractClassDeclaration(clazz) {
20008
- return import_typescript18.default.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === import_typescript18.default.SyntaxKind.AbstractKeyword) : false;
20009
- }
20010
-
20011
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
20012
- function getConstructorDependencies(clazz, reflector, isCore) {
20013
- const deps = [];
20014
- const errors = [];
20015
- let ctorParams = reflector.getConstructorParameters(clazz);
20016
- if (ctorParams === null) {
20017
- if (reflector.hasBaseClass(clazz)) {
20046
+ function filterToMembersWithDecorator(members, name, module3) {
20047
+ return members.filter((member) => !member.isStatic).map((member) => {
20048
+ if (member.decorators === null) {
20018
20049
  return null;
20019
- } else {
20020
- ctorParams = [];
20021
20050
  }
20022
- }
20023
- ctorParams.forEach((param, idx) => {
20024
- let token = valueReferenceToExpression(param.typeValueReference);
20025
- let attributeNameType = null;
20026
- let optional = false, self2 = false, skipSelf = false, host = false;
20027
- (param.decorators || []).filter((dec) => isCore || isAngularCore(dec)).forEach((dec) => {
20028
- const name = isCore || dec.import === null ? dec.name : dec.import.name;
20029
- if (name === "Inject") {
20030
- if (dec.args === null || dec.args.length !== 1) {
20031
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(dec), `Unexpected number of arguments to @Inject().`);
20032
- }
20033
- token = new WrappedNodeExpr(dec.args[0]);
20034
- } else if (name === "Optional") {
20035
- optional = true;
20036
- } else if (name === "SkipSelf") {
20037
- skipSelf = true;
20038
- } else if (name === "Self") {
20039
- self2 = true;
20040
- } else if (name === "Host") {
20041
- host = true;
20042
- } else if (name === "Attribute") {
20043
- if (dec.args === null || dec.args.length !== 1) {
20044
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(dec), `Unexpected number of arguments to @Attribute().`);
20045
- }
20046
- const attributeName = dec.args[0];
20047
- token = new WrappedNodeExpr(attributeName);
20048
- if (import_typescript19.default.isStringLiteralLike(attributeName)) {
20049
- attributeNameType = new LiteralExpr(attributeName.text);
20050
- } else {
20051
- attributeNameType = new WrappedNodeExpr(import_typescript19.default.factory.createKeywordTypeNode(import_typescript19.default.SyntaxKind.UnknownKeyword));
20052
- }
20051
+ const decorators = member.decorators.filter((dec) => {
20052
+ if (dec.import !== null) {
20053
+ return dec.import.name === name && (module3 === void 0 || dec.import.from === module3);
20053
20054
  } else {
20054
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, Decorator.nodeForError(dec), `Unexpected decorator ${name} on parameter.`);
20055
+ return dec.name === name && module3 === void 0;
20055
20056
  }
20056
20057
  });
20057
- if (token === null) {
20058
- if (param.typeValueReference.kind !== 2) {
20059
- throw new Error("Illegal state: expected value reference to be unavailable if no token is present");
20058
+ if (decorators.length === 0) {
20059
+ return null;
20060
+ }
20061
+ return { member, decorators };
20062
+ }).filter((value) => value !== null);
20063
+ }
20064
+ function reflectObjectLiteral(node) {
20065
+ const map = /* @__PURE__ */ new Map();
20066
+ node.properties.forEach((prop) => {
20067
+ if (import_typescript18.default.isPropertyAssignment(prop)) {
20068
+ const name = propertyNameToString(prop.name);
20069
+ if (name === null) {
20070
+ return;
20060
20071
  }
20061
- errors.push({
20062
- index: idx,
20063
- param,
20064
- reason: param.typeValueReference.reason
20065
- });
20072
+ map.set(name, prop.initializer);
20073
+ } else if (import_typescript18.default.isShorthandPropertyAssignment(prop)) {
20074
+ map.set(prop.name.text, prop.name);
20066
20075
  } else {
20067
- deps.push({ token, attributeNameType, optional, self: self2, skipSelf, host });
20076
+ return;
20068
20077
  }
20069
20078
  });
20070
- if (errors.length === 0) {
20071
- return { deps };
20072
- } else {
20073
- return { deps: null, errors };
20079
+ return map;
20080
+ }
20081
+ function castDeclarationToClassOrDie(declaration) {
20082
+ if (!import_typescript18.default.isClassDeclaration(declaration)) {
20083
+ throw new Error(`Reflecting on a ${import_typescript18.default.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`);
20074
20084
  }
20085
+ return declaration;
20075
20086
  }
20076
- function unwrapConstructorDependencies(deps) {
20077
- if (deps === null) {
20078
- return null;
20079
- } else if (deps.deps !== null) {
20080
- return deps.deps;
20087
+ function parameterName(name) {
20088
+ if (import_typescript18.default.isIdentifier(name)) {
20089
+ return name.text;
20081
20090
  } else {
20082
- return "invalid";
20091
+ return null;
20083
20092
  }
20084
20093
  }
20085
- function getValidConstructorDependencies(clazz, reflector, isCore) {
20086
- return validateConstructorDependencies(clazz, getConstructorDependencies(clazz, reflector, isCore));
20087
- }
20088
- function validateConstructorDependencies(clazz, deps) {
20089
- if (deps === null) {
20090
- return null;
20091
- } else if (deps.deps !== null) {
20092
- return deps.deps;
20094
+ function propertyNameToString(node) {
20095
+ if (import_typescript18.default.isIdentifier(node) || import_typescript18.default.isStringLiteral(node) || import_typescript18.default.isNumericLiteral(node)) {
20096
+ return node.text;
20093
20097
  } else {
20094
- const error2 = deps.errors[0];
20095
- throw createUnsuitableInjectionTokenError(clazz, error2);
20098
+ return null;
20096
20099
  }
20097
20100
  }
20098
- function createUnsuitableInjectionTokenError(clazz, error2) {
20099
- const { param, index, reason } = error2;
20100
- let chainMessage = void 0;
20101
- let hints = void 0;
20102
- switch (reason.kind) {
20103
- case 5:
20104
- chainMessage = "Consider using the @Inject decorator to specify an injection token.";
20105
- hints = [
20106
- makeRelatedInformation(reason.typeNode, "This type is not supported as injection token.")
20107
- ];
20108
- break;
20109
- case 1:
20110
- chainMessage = "Consider using the @Inject decorator to specify an injection token.";
20111
- hints = [
20112
- makeRelatedInformation(reason.typeNode, "This type does not have a value, so it cannot be used as injection token.")
20113
- ];
20114
- if (reason.decl !== null) {
20115
- hints.push(makeRelatedInformation(reason.decl, "The type is declared here."));
20116
- }
20117
- break;
20118
- case 2:
20119
- chainMessage = "Consider changing the type-only import to a regular import, or use the @Inject decorator to specify an injection token.";
20120
- hints = [
20121
- makeRelatedInformation(reason.typeNode, "This type is imported using a type-only import, which prevents it from being usable as an injection token."),
20122
- makeRelatedInformation(reason.node, "The type-only import occurs here.")
20123
- ];
20124
- break;
20125
- case 4:
20126
- chainMessage = "Consider using the @Inject decorator to specify an injection token.";
20127
- hints = [
20128
- makeRelatedInformation(reason.typeNode, "This type corresponds with a namespace, which cannot be used as injection token."),
20129
- makeRelatedInformation(reason.importClause, "The namespace import occurs here.")
20130
- ];
20131
- break;
20132
- case 3:
20133
- chainMessage = "The type should reference a known declaration.";
20134
- hints = [makeRelatedInformation(reason.typeNode, "This type could not be resolved.")];
20135
- break;
20136
- case 0:
20137
- chainMessage = "Consider adding a type to the parameter or use the @Inject decorator to specify an injection token.";
20138
- break;
20101
+ function getQualifiedNameRoot(qualifiedName) {
20102
+ while (import_typescript18.default.isQualifiedName(qualifiedName.left)) {
20103
+ qualifiedName = qualifiedName.left;
20139
20104
  }
20140
- const chain = {
20141
- messageText: `No suitable injection token for parameter '${param.name || index}' of class '${clazz.name.text}'.`,
20142
- category: import_typescript19.default.DiagnosticCategory.Error,
20143
- code: 0,
20144
- next: [{
20145
- messageText: chainMessage,
20146
- category: import_typescript19.default.DiagnosticCategory.Message,
20147
- code: 0
20148
- }]
20149
- };
20150
- return new FatalDiagnosticError(ErrorCode.PARAM_MISSING_TOKEN, param.nameNode, chain, hints);
20105
+ return import_typescript18.default.isIdentifier(qualifiedName.left) ? qualifiedName.left : null;
20151
20106
  }
20152
-
20153
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/diagnostics.mjs
20154
- var import_typescript27 = __toESM(require("typescript"), 1);
20155
-
20156
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
20157
- var MetaKind;
20158
- (function(MetaKind2) {
20159
- MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
20160
- MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
20161
- MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
20162
- })(MetaKind || (MetaKind = {}));
20163
- var MatchSource;
20164
- (function(MatchSource2) {
20165
- MatchSource2[MatchSource2["Selector"] = 0] = "Selector";
20166
- MatchSource2[MatchSource2["HostDirective"] = 1] = "HostDirective";
20167
- })(MatchSource || (MatchSource = {}));
20168
-
20169
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
20170
- var import_typescript22 = __toESM(require("typescript"), 1);
20107
+ function getFarLeftIdentifier(propertyAccess) {
20108
+ while (import_typescript18.default.isPropertyAccessExpression(propertyAccess.expression)) {
20109
+ propertyAccess = propertyAccess.expression;
20110
+ }
20111
+ return import_typescript18.default.isIdentifier(propertyAccess.expression) ? propertyAccess.expression : null;
20112
+ }
20113
+ function getContainingImportDeclaration(node) {
20114
+ return import_typescript18.default.isImportSpecifier(node) ? node.parent.parent.parent : import_typescript18.default.isNamespaceImport(node) ? node.parent.parent : null;
20115
+ }
20116
+ function getExportedName(decl, originalId) {
20117
+ return import_typescript18.default.isImportSpecifier(decl) ? (decl.propertyName !== void 0 ? decl.propertyName : decl.name).text : originalId.text;
20118
+ }
20119
+ var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
20171
20120
 
20172
20121
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/property_mapping.mjs
20173
20122
  var ClassPropertyMapping = class {
@@ -21142,102 +21091,6 @@ var StringConcatBuiltinFn = class extends KnownFn {
21142
21091
  return result;
21143
21092
  }
21144
21093
  };
21145
- var ObjectAssignBuiltinFn = class extends KnownFn {
21146
- evaluate(node, args) {
21147
- if (args.length === 0) {
21148
- return DynamicValue.fromUnsupportedSyntax(node);
21149
- }
21150
- for (const arg of args) {
21151
- if (arg instanceof DynamicValue) {
21152
- return DynamicValue.fromDynamicInput(node, arg);
21153
- } else if (!(arg instanceof Map)) {
21154
- return DynamicValue.fromUnsupportedSyntax(node);
21155
- }
21156
- }
21157
- const [target, ...sources] = args;
21158
- for (const source of sources) {
21159
- source.forEach((value, key) => target.set(key, value));
21160
- }
21161
- return target;
21162
- }
21163
- };
21164
-
21165
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/ts_helpers.mjs
21166
- var AssignHelperFn = class extends ObjectAssignBuiltinFn {
21167
- };
21168
- var SpreadHelperFn = class extends KnownFn {
21169
- evaluate(node, args) {
21170
- const result = [];
21171
- for (const arg of args) {
21172
- if (arg instanceof DynamicValue) {
21173
- result.push(DynamicValue.fromDynamicInput(node, arg));
21174
- } else if (Array.isArray(arg)) {
21175
- result.push(...arg);
21176
- } else {
21177
- result.push(arg);
21178
- }
21179
- }
21180
- return result;
21181
- }
21182
- };
21183
- var SpreadArrayHelperFn = class extends KnownFn {
21184
- evaluate(node, args) {
21185
- if (args.length !== 2 && args.length !== 3) {
21186
- return DynamicValue.fromUnknown(node);
21187
- }
21188
- const [to, from] = args;
21189
- if (to instanceof DynamicValue) {
21190
- return DynamicValue.fromDynamicInput(node, to);
21191
- } else if (from instanceof DynamicValue) {
21192
- return DynamicValue.fromDynamicInput(node, from);
21193
- }
21194
- if (!Array.isArray(to)) {
21195
- return DynamicValue.fromInvalidExpressionType(node, to);
21196
- } else if (!Array.isArray(from)) {
21197
- return DynamicValue.fromInvalidExpressionType(node, from);
21198
- }
21199
- return to.concat(from);
21200
- }
21201
- };
21202
- var ReadHelperFn = class extends KnownFn {
21203
- evaluate(node, args) {
21204
- if (args.length !== 1) {
21205
- return DynamicValue.fromUnknown(node);
21206
- }
21207
- const [value] = args;
21208
- if (value instanceof DynamicValue) {
21209
- return DynamicValue.fromDynamicInput(node, value);
21210
- }
21211
- if (!Array.isArray(value)) {
21212
- return DynamicValue.fromInvalidExpressionType(node, value);
21213
- }
21214
- return value;
21215
- }
21216
- };
21217
-
21218
- // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/known_declaration.mjs
21219
- var jsGlobalObjectValue = /* @__PURE__ */ new Map([["assign", new ObjectAssignBuiltinFn()]]);
21220
- var assignTsHelperFn = new AssignHelperFn();
21221
- var spreadTsHelperFn = new SpreadHelperFn();
21222
- var spreadArrayTsHelperFn = new SpreadArrayHelperFn();
21223
- var readTsHelperFn = new ReadHelperFn();
21224
- function resolveKnownDeclaration(decl) {
21225
- switch (decl) {
21226
- case KnownDeclaration.JsGlobalObject:
21227
- return jsGlobalObjectValue;
21228
- case KnownDeclaration.TsHelperAssign:
21229
- return assignTsHelperFn;
21230
- case KnownDeclaration.TsHelperSpread:
21231
- case KnownDeclaration.TsHelperSpreadArrays:
21232
- return spreadTsHelperFn;
21233
- case KnownDeclaration.TsHelperSpreadArray:
21234
- return spreadArrayTsHelperFn;
21235
- case KnownDeclaration.TsHelperRead:
21236
- return readTsHelperFn;
21237
- default:
21238
- throw new Error(`Cannot resolve known declaration. Received: ${KnownDeclaration[decl]}.`);
21239
- }
21240
- }
21241
21094
 
21242
21095
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/synthetic.mjs
21243
21096
  var SyntheticValue = class {
@@ -21412,13 +21265,8 @@ var StaticInterpreter = class {
21412
21265
  return DynamicValue.fromUnknownIdentifier(node);
21413
21266
  }
21414
21267
  }
21415
- if (decl.known !== null) {
21416
- return resolveKnownDeclaration(decl.known);
21417
- } else if (isConcreteDeclaration(decl) && decl.identity !== null && decl.identity.kind === 0) {
21418
- return this.getResolvedEnum(decl.node, decl.identity.enumMembers, context);
21419
- }
21420
21268
  const declContext = __spreadValues(__spreadValues({}, context), joinModuleContext(context, node, decl));
21421
- const result = this.visitAmbiguousDeclaration(decl, declContext);
21269
+ const result = this.visitDeclaration(decl.node, declContext);
21422
21270
  if (result instanceof Reference2) {
21423
21271
  if (!result.synthetic) {
21424
21272
  result.addIdentifier(node);
@@ -21506,16 +21354,10 @@ var StaticInterpreter = class {
21506
21354
  return DynamicValue.fromUnknown(node);
21507
21355
  }
21508
21356
  return new ResolvedModule(declarations, (decl) => {
21509
- if (decl.known !== null) {
21510
- return resolveKnownDeclaration(decl.known);
21511
- }
21512
21357
  const declContext = __spreadValues(__spreadValues({}, context), joinModuleContext(context, node, decl));
21513
- return this.visitAmbiguousDeclaration(decl, declContext);
21358
+ return this.visitDeclaration(decl.node, declContext);
21514
21359
  });
21515
21360
  }
21516
- visitAmbiguousDeclaration(decl, declContext) {
21517
- return decl.kind === 1 && decl.implementation !== void 0 && !isDeclaration(decl.implementation) ? this.visitExpression(decl.implementation, declContext) : this.visitDeclaration(decl.node, declContext);
21518
- }
21519
21361
  accessHelper(node, lhs, rhs, context) {
21520
21362
  const strIndex = `${rhs}`;
21521
21363
  if (lhs instanceof Map) {
@@ -21746,18 +21588,6 @@ var StaticInterpreter = class {
21746
21588
  return void 0;
21747
21589
  }
21748
21590
  }
21749
- getResolvedEnum(node, enumMembers, context) {
21750
- const enumRef = this.getReference(node, context);
21751
- const map = /* @__PURE__ */ new Map();
21752
- enumMembers.forEach((member) => {
21753
- const name = this.stringNameFromPropertyName(member.name, context);
21754
- if (name !== void 0) {
21755
- const resolved = this.visit(member.initializer, context);
21756
- map.set(name, new EnumValue(enumRef, name, resolved));
21757
- }
21758
- });
21759
- return map;
21760
- }
21761
21591
  getReference(node, context) {
21762
21592
  return new Reference2(node, owningModule(context));
21763
21593
  }
@@ -21791,7 +21621,7 @@ var StaticInterpreter = class {
21791
21621
  return DynamicValue.fromUnknownIdentifier(node.exprName);
21792
21622
  }
21793
21623
  const declContext = __spreadValues(__spreadValues({}, context), joinModuleContext(context, node, decl));
21794
- return this.visitAmbiguousDeclaration(decl, declContext);
21624
+ return this.visitDeclaration(decl.node, declContext);
21795
21625
  }
21796
21626
  };
21797
21627
  function isFunctionOrMethodReference(ref) {
@@ -22083,7 +21913,7 @@ function resolveLiteral(decorator, literalCache) {
22083
21913
  return literalCache.get(decorator);
22084
21914
  }
22085
21915
  if (decorator.args === null || decorator.args.length !== 1) {
22086
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
21916
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
22087
21917
  }
22088
21918
  const meta = unwrapExpression(decorator.args[0]);
22089
21919
  if (!import_typescript29.default.isObjectLiteralExpression(meta)) {
@@ -22135,7 +21965,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
22135
21965
  if (!reflection.isClass(clazz)) {
22136
21966
  return null;
22137
21967
  }
22138
- const id = reflection.getAdjacentNameOfClass(clazz);
21968
+ const id = clazz.name;
22139
21969
  const classDecorators = reflection.getDecoratorsOfDeclaration(clazz);
22140
21970
  if (classDecorators === null) {
22141
21971
  return null;
@@ -23108,9 +22938,9 @@ function invalidRef(decl, rawExpr, type) {
23108
22938
  const annotationType = type === "import" ? "@NgModule" : "Angular";
23109
22939
  relatedMessage = `Is it missing an ${annotationType} annotation?`;
23110
22940
  } else if (sf.fileName.indexOf("node_modules") !== -1) {
23111
- 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.`;
22941
+ relatedMessage = `This likely means that the library${library} which declares ${decl.debugName} 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.`;
23112
22942
  } else {
23113
- relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName} has not been processed correctly by ngcc.`;
22943
+ relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName} is not compatible with Angular Ivy.`;
23114
22944
  }
23115
22945
  return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), message, [makeRelatedInformation(decl.node.name, relatedMessage)]);
23116
22946
  }
@@ -23378,16 +23208,6 @@ var TraitCompiler = class {
23378
23208
  return null;
23379
23209
  }
23380
23210
  }
23381
- recordsFor(sf) {
23382
- if (!this.fileToClasses.has(sf)) {
23383
- return null;
23384
- }
23385
- const records = [];
23386
- for (const clazz of this.fileToClasses.get(sf)) {
23387
- records.push(this.classes.get(clazz));
23388
- }
23389
- return records;
23390
- }
23391
23211
  getAnalyzedRecords() {
23392
23212
  const result = /* @__PURE__ */ new Map();
23393
23213
  for (const [sf, classes] of this.fileToClasses) {
@@ -24870,7 +24690,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
24870
24690
  if (decorator === null || decorator.args === null || decorator.args.length === 0) {
24871
24691
  directive = /* @__PURE__ */ new Map();
24872
24692
  } else if (decorator.args.length !== 1) {
24873
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
24693
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
24874
24694
  } else {
24875
24695
  const meta = unwrapExpression(decorator.args[0]);
24876
24696
  if (!import_typescript46.default.isObjectLiteralExpression(meta)) {
@@ -24940,7 +24760,6 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
24940
24760
  const usesInheritance = reflector.hasBaseClass(clazz);
24941
24761
  const sourceFile = clazz.getSourceFile();
24942
24762
  const type = wrapTypeReference(reflector, clazz);
24943
- const internalType = new WrappedNodeExpr(reflector.getInternalNameOfClass(clazz));
24944
24763
  const rawHostDirectives = directive.get("hostDirectives") || null;
24945
24764
  const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator);
24946
24765
  const metadata = {
@@ -24957,7 +24776,6 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
24957
24776
  selector,
24958
24777
  fullInheritance: !!(flags & HandlerFlags.FULL_INHERITANCE),
24959
24778
  type,
24960
- internalType,
24961
24779
  typeArgumentCount: reflector.getGenericArityOfClass(clazz) || 0,
24962
24780
  typeSourceSpan: createSourceSpan(clazz.name),
24963
24781
  usesInheritance,
@@ -25055,11 +24873,11 @@ function extractHostBindings2(members, evaluator, coreModule, metadata) {
25055
24873
  let hostPropertyName = member.name;
25056
24874
  if (decorator.args !== null && decorator.args.length > 0) {
25057
24875
  if (decorator.args.length !== 1) {
25058
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `@HostBinding can have at most one argument, got ${decorator.args.length} argument(s)`);
24876
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `@HostBinding can have at most one argument, got ${decorator.args.length} argument(s)`);
25059
24877
  }
25060
24878
  const resolved = evaluator.evaluate(decorator.args[0]);
25061
24879
  if (typeof resolved !== "string") {
25062
- throw createValueHasWrongTypeError(Decorator.nodeForError(decorator), resolved, `@HostBinding's argument must be a string`);
24880
+ throw createValueHasWrongTypeError(decorator.node, resolved, `@HostBinding's argument must be a string`);
25063
24881
  }
25064
24882
  hostPropertyName = resolved;
25065
24883
  }
@@ -25145,7 +24963,7 @@ function isStringArrayOrDie(value, name, node) {
25145
24963
  function queriesFromFields(fields, reflector, evaluator) {
25146
24964
  return fields.map(({ member, decorators }) => {
25147
24965
  const decorator = decorators[0];
25148
- const node = member.node || Decorator.nodeForError(decorator);
24966
+ const node = member.node || decorator.node;
25149
24967
  if (member.decorators.some((v) => v.name === "Input")) {
25150
24968
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
25151
24969
  }
@@ -25179,7 +24997,7 @@ function parseDecoratedFields(fields, evaluator, callback) {
25179
24997
  const fieldName = field.member.name;
25180
24998
  for (const decorator of field.decorators) {
25181
24999
  if (decorator.args != null && decorator.args.length > 1) {
25182
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `@${decorator.name} can have at most one argument, got ${decorator.args.length} argument(s)`);
25000
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `@${decorator.name} can have at most one argument, got ${decorator.args.length} argument(s)`);
25183
25001
  }
25184
25002
  const value = decorator.args != null && decorator.args.length > 0 ? evaluator.evaluate(decorator.args[0]) : null;
25185
25003
  callback(fieldName, value, decorator);
@@ -25233,7 +25051,7 @@ function parseInputFields(inputMembers, evaluator) {
25233
25051
  bindingPropertyName = typeof aliasInConfig === "string" ? aliasInConfig : classPropertyName;
25234
25052
  required = options.get("required") === true;
25235
25053
  } else {
25236
- throw createValueHasWrongTypeError(Decorator.nodeForError(decorator), options, `@${decorator.name} decorator argument must resolve to a string or an object literal`);
25054
+ throw createValueHasWrongTypeError(decorator.node, options, `@${decorator.name} decorator argument must resolve to a string or an object literal`);
25237
25055
  }
25238
25056
  inputs[classPropertyName] = { bindingPropertyName, classPropertyName, required };
25239
25057
  });
@@ -25247,7 +25065,7 @@ function parseOutputFields(outputMembers, evaluator) {
25247
25065
  const outputs = {};
25248
25066
  parseDecoratedFields(outputMembers, evaluator, (fieldName, bindingPropertyName, decorator) => {
25249
25067
  if (bindingPropertyName != null && typeof bindingPropertyName !== "string") {
25250
- throw createValueHasWrongTypeError(Decorator.nodeForError(decorator), bindingPropertyName, `@${decorator.name} decorator argument must resolve to a string`);
25068
+ throw createValueHasWrongTypeError(decorator.node, bindingPropertyName, `@${decorator.name} decorator argument must resolve to a string`);
25251
25069
  }
25252
25070
  outputs[fieldName] = bindingPropertyName != null ? bindingPropertyName : fieldName;
25253
25071
  });
@@ -25319,7 +25137,7 @@ function parseHostDirectivesMapping(field, resolvedValue, classReference, source
25319
25137
  }
25320
25138
  function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
25321
25139
  return {
25322
- directive: toR3Reference(hostDirective.directive.node, hostDirective.directive, hostDirective.directive, context, context, refEmitter),
25140
+ directive: toR3Reference(hostDirective.directive.node, hostDirective.directive, context, refEmitter),
25323
25141
  isForwardReference: hostDirective.isForwardReference,
25324
25142
  inputs: hostDirective.inputs || null,
25325
25143
  outputs: hostDirective.outputs || null
@@ -25428,7 +25246,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
25428
25246
  "ngAfterContentChecked"
25429
25247
  ]);
25430
25248
  var DirectiveDecoratorHandler = class {
25431
- constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
25249
+ constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
25432
25250
  this.reflector = reflector;
25433
25251
  this.evaluator = evaluator;
25434
25252
  this.metaRegistry = metaRegistry;
@@ -25440,7 +25258,6 @@ var DirectiveDecoratorHandler = class {
25440
25258
  this.strictCtorDeps = strictCtorDeps;
25441
25259
  this.semanticDepGraphUpdater = semanticDepGraphUpdater;
25442
25260
  this.annotateForClosureCompiler = annotateForClosureCompiler;
25443
- this.compileUndecoratedClassesWithAngularFeatures = compileUndecoratedClassesWithAngularFeatures;
25444
25261
  this.perf = perf;
25445
25262
  this.precedence = HandlerPrecedence.PRIMARY;
25446
25263
  this.name = DirectiveDecoratorHandler.name;
@@ -25456,7 +25273,7 @@ var DirectiveDecoratorHandler = class {
25456
25273
  }
25457
25274
  analyze(node, decorator, flags = HandlerFlags.NONE) {
25458
25275
  var _a;
25459
- if (this.compileUndecoratedClassesWithAngularFeatures === false && decorator === null) {
25276
+ if (decorator === null) {
25460
25277
  if (this.isCore) {
25461
25278
  return {};
25462
25279
  }
@@ -25717,7 +25534,7 @@ var NgModuleDecoratorHandler = class {
25717
25534
  this.perf.eventCount(PerfEvent.AnalyzeNgModule);
25718
25535
  const name = node.name.text;
25719
25536
  if (decorator.args === null || decorator.args.length > 1) {
25720
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @NgModule decorator`);
25537
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
25721
25538
  }
25722
25539
  const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : import_typescript48.default.factory.createObjectLiteralExpression([]);
25723
25540
  if (!import_typescript48.default.isObjectLiteralExpression(meta)) {
@@ -25788,33 +25605,24 @@ var NgModuleDecoratorHandler = class {
25788
25605
  }
25789
25606
  }
25790
25607
  const valueContext = node.getSourceFile();
25791
- let typeContext = valueContext;
25792
- const typeNode = this.reflector.getDtsDeclaration(node);
25793
- if (typeNode !== null) {
25794
- typeContext = typeNode.getSourceFile();
25795
- }
25796
25608
  const exportedNodes = new Set(exportRefs.map((ref) => ref.node));
25797
25609
  const declarations = [];
25798
25610
  const exportedDeclarations = [];
25799
- const bootstrap = bootstrapRefs.map((bootstrap2) => this._toR3Reference(bootstrap2.getOriginForDiagnostics(meta, node.name), bootstrap2, valueContext, typeContext));
25611
+ const bootstrap = bootstrapRefs.map((bootstrap2) => this._toR3Reference(bootstrap2.getOriginForDiagnostics(meta, node.name), bootstrap2, valueContext));
25800
25612
  for (const ref of declarationRefs) {
25801
- const decl = this._toR3Reference(ref.getOriginForDiagnostics(meta, node.name), ref, valueContext, typeContext);
25613
+ const decl = this._toR3Reference(ref.getOriginForDiagnostics(meta, node.name), ref, valueContext);
25802
25614
  declarations.push(decl);
25803
25615
  if (exportedNodes.has(ref.node)) {
25804
25616
  exportedDeclarations.push(decl.type);
25805
25617
  }
25806
25618
  }
25807
- const imports = importRefs.map((imp) => this._toR3Reference(imp.getOriginForDiagnostics(meta, node.name), imp, valueContext, typeContext));
25808
- const exports = exportRefs.map((exp) => this._toR3Reference(exp.getOriginForDiagnostics(meta, node.name), exp, valueContext, typeContext));
25619
+ const imports = importRefs.map((imp) => this._toR3Reference(imp.getOriginForDiagnostics(meta, node.name), imp, valueContext));
25620
+ const exports = exportRefs.map((exp) => this._toR3Reference(exp.getOriginForDiagnostics(meta, node.name), exp, valueContext));
25809
25621
  const isForwardReference = (ref) => isExpressionForwardReference(ref.value, node.name, valueContext);
25810
25622
  const containsForwardDecls = bootstrap.some(isForwardReference) || declarations.some(isForwardReference) || imports.some(isForwardReference) || exports.some(isForwardReference);
25811
25623
  const type = wrapTypeReference(this.reflector, node);
25812
- const internalType = new WrappedNodeExpr(this.reflector.getInternalNameOfClass(node));
25813
- const adjacentType = new WrappedNodeExpr(this.reflector.getAdjacentNameOfClass(node));
25814
25624
  const ngModuleMetadata = {
25815
25625
  type,
25816
- internalType,
25817
- adjacentType,
25818
25626
  bootstrap,
25819
25627
  declarations,
25820
25628
  publicDeclarationTypes: this.onlyPublishPublicTypings ? exportedDeclarations : null,
@@ -25861,13 +25669,11 @@ var NgModuleDecoratorHandler = class {
25861
25669
  const injectorMetadata = {
25862
25670
  name,
25863
25671
  type,
25864
- internalType,
25865
25672
  providers: wrappedProviders
25866
25673
  };
25867
25674
  const factoryMetadata = {
25868
25675
  name,
25869
25676
  type,
25870
- internalType,
25871
25677
  typeArgumentCount: 0,
25872
25678
  deps: getValidConstructorDependencies(node, this.reflector, this.isCore),
25873
25679
  target: FactoryTarget.NgModule
@@ -26064,16 +25870,11 @@ var NgModuleDecoratorHandler = class {
26064
25870
  ];
26065
25871
  return res;
26066
25872
  }
26067
- _toR3Reference(origin, valueRef, valueContext, typeContext) {
25873
+ _toR3Reference(origin, valueRef, valueContext) {
26068
25874
  if (valueRef.hasOwningModuleGuess) {
26069
- return toR3Reference(origin, valueRef, valueRef, valueContext, valueContext, this.refEmitter);
25875
+ return toR3Reference(origin, valueRef, valueContext, this.refEmitter);
26070
25876
  } else {
26071
- let typeRef = valueRef;
26072
- let typeNode = this.reflector.getDtsDeclaration(typeRef.node);
26073
- if (typeNode !== null && isNamedClassDeclaration(typeNode)) {
26074
- typeRef = new Reference2(typeNode);
26075
- }
26076
- return toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, this.refEmitter);
25877
+ return toR3Reference(origin, valueRef, valueContext, this.refEmitter);
26077
25878
  }
26078
25879
  }
26079
25880
  isClassDeclarationReference(ref) {
@@ -26305,7 +26106,7 @@ function parseTemplateDeclaration(node, decorator, component, containingFile, ev
26305
26106
  resolvedTemplateUrl: containingFile
26306
26107
  };
26307
26108
  } else {
26308
- throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE, Decorator.nodeForError(decorator), "component is missing a template");
26109
+ throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE, decorator.node, "component is missing a template");
26309
26110
  }
26310
26111
  }
26311
26112
  function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanalyzeTemplateCache, node, decorator, component, containingFile, defaultPreserveWhitespaces, options) {
@@ -27317,17 +27118,15 @@ var InjectableDecoratorHandler = class {
27317
27118
  function extractInjectableMetadata(clazz, decorator, reflector) {
27318
27119
  const name = clazz.name.text;
27319
27120
  const type = wrapTypeReference(reflector, clazz);
27320
- const internalType = new WrappedNodeExpr(reflector.getInternalNameOfClass(clazz));
27321
27121
  const typeArgumentCount = reflector.getGenericArityOfClass(clazz) || 0;
27322
27122
  if (decorator.args === null) {
27323
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, Decorator.nodeForError(decorator), "@Injectable must be called");
27123
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, "@Injectable must be called");
27324
27124
  }
27325
27125
  if (decorator.args.length === 0) {
27326
27126
  return {
27327
27127
  name,
27328
27128
  type,
27329
27129
  typeArgumentCount,
27330
- internalType,
27331
27130
  providedIn: createMayBeForwardRefExpression(new LiteralExpr(null), 0)
27332
27131
  };
27333
27132
  } else if (decorator.args.length === 1) {
@@ -27345,7 +27144,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
27345
27144
  }
27346
27145
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
27347
27146
  }
27348
- const result = { name, type, typeArgumentCount, internalType, providedIn };
27147
+ const result = { name, type, typeArgumentCount, providedIn };
27349
27148
  if (meta.has("useValue")) {
27350
27149
  result.useValue = getProviderExpression(meta.get("useValue"), reflector);
27351
27150
  } else if (meta.has("useExisting")) {
@@ -27368,7 +27167,7 @@ function getProviderExpression(expression, reflector) {
27368
27167
  }
27369
27168
  function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, strictCtorDeps) {
27370
27169
  if (decorator.args === null) {
27371
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, Decorator.nodeForError(decorator), "@Injectable must be called");
27170
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, "@Injectable must be called");
27372
27171
  }
27373
27172
  let ctorDeps = null;
27374
27173
  if (decorator.args.length === 0) {
@@ -27491,12 +27290,11 @@ var PipeDecoratorHandler = class {
27491
27290
  this.perf.eventCount(PerfEvent.AnalyzePipe);
27492
27291
  const name = clazz.name.text;
27493
27292
  const type = wrapTypeReference(this.reflector, clazz);
27494
- const internalType = new WrappedNodeExpr(this.reflector.getInternalNameOfClass(clazz));
27495
27293
  if (decorator.args === null) {
27496
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, Decorator.nodeForError(decorator), `@Pipe must be called`);
27294
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, `@Pipe must be called`);
27497
27295
  }
27498
27296
  if (decorator.args.length !== 1) {
27499
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
27297
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
27500
27298
  }
27501
27299
  const meta = unwrapExpression(decorator.args[0]);
27502
27300
  if (!import_typescript54.default.isObjectLiteralExpression(meta)) {
@@ -27534,7 +27332,6 @@ var PipeDecoratorHandler = class {
27534
27332
  meta: {
27535
27333
  name,
27536
27334
  type,
27537
- internalType,
27538
27335
  typeArgumentCount: this.reflector.getGenericArityOfClass(clazz) || 0,
27539
27336
  pipeName,
27540
27337
  deps: getValidConstructorDependencies(clazz, this.reflector, this.isCore),
@@ -34296,7 +34093,7 @@ var NgCompiler = class {
34296
34093
  const strictCtorDeps = this.options.strictInjectionParameters || false;
34297
34094
  const handlers = [
34298
34095
  new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver),
34299
- new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, false, this.delegatingPerfRecorder),
34096
+ new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder),
34300
34097
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder),
34301
34098
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder),
34302
34099
  new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, isCore, refEmitter, this.closureCompilerEnabled, (_a = this.options.onlyPublishPublicTypingsForNgModules) != null ? _a : false, injectableRegistry, this.delegatingPerfRecorder)