@angular/compiler-cli 17.1.2 → 17.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/bundles/{chunk-24NMPW5I.js → chunk-6TQPEEA2.js} +12 -7
  2. package/bundles/chunk-6TQPEEA2.js.map +6 -0
  3. package/bundles/{chunk-TFBB265K.js → chunk-7HZQIUTO.js} +208 -154
  4. package/bundles/chunk-7HZQIUTO.js.map +6 -0
  5. package/bundles/{chunk-TKJ4KX5N.js → chunk-D6QFM4YJ.js} +4 -4
  6. package/bundles/{chunk-TKJ4KX5N.js.map → chunk-D6QFM4YJ.js.map} +1 -1
  7. package/bundles/{chunk-5YHUYFQ5.js → chunk-GJ7EAXBI.js} +107 -30
  8. package/bundles/chunk-GJ7EAXBI.js.map +6 -0
  9. package/bundles/{chunk-GKQNBAG5.js → chunk-IWZ4MO7Q.js} +529 -250
  10. package/bundles/chunk-IWZ4MO7Q.js.map +6 -0
  11. package/bundles/{chunk-MIB7EGOT.js → chunk-J2NE3BNR.js} +2 -2
  12. package/bundles/index.js +5 -5
  13. package/bundles/linker/babel/index.js +2 -2
  14. package/bundles/linker/index.js +2 -2
  15. package/bundles/private/migrations.js +2 -2
  16. package/bundles/private/tooling.js +3 -3
  17. package/bundles/src/bin/ng_xi18n.js +4 -4
  18. package/bundles/src/bin/ngc.js +4 -4
  19. package/bundles_metadata.json +1 -1
  20. package/linker/src/file_linker/partial_linkers/util.d.ts +2 -1
  21. package/package.json +3 -3
  22. package/src/bin/ng_xi18n.d.ts +0 -1
  23. package/src/bin/ngc.d.ts +0 -1
  24. package/src/ngtsc/annotations/common/src/util.d.ts +5 -2
  25. package/src/ngtsc/annotations/component/src/handler.d.ts +4 -2
  26. package/src/ngtsc/annotations/directive/src/handler.d.ts +3 -1
  27. package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +44 -0
  28. package/src/ngtsc/annotations/directive/src/input_function.d.ts +1 -1
  29. package/src/ngtsc/annotations/directive/src/query_functions.d.ts +26 -0
  30. package/src/ngtsc/annotations/directive/src/shared.d.ts +2 -2
  31. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +3 -2
  32. package/src/ngtsc/annotations/src/pipe.d.ts +2 -1
  33. package/src/ngtsc/core/api/src/public_options.d.ts +10 -0
  34. package/src/ngtsc/diagnostics/src/error_code.d.ts +24 -7
  35. package/src/ngtsc/docs/src/entities.d.ts +1 -0
  36. package/src/ngtsc/docs/src/function_extractor.d.ts +3 -2
  37. package/src/ngtsc/imports/index.d.ts +1 -0
  38. package/src/ngtsc/imports/src/local_compilation_extra_imports_tracker.d.ts +56 -0
  39. package/src/ngtsc/metadata/index.d.ts +1 -1
  40. package/src/ngtsc/metadata/src/api.d.ts +23 -3
  41. package/src/ngtsc/metadata/src/util.d.ts +2 -1
  42. package/src/ngtsc/transform/src/transform.d.ts +2 -2
  43. package/src/ngtsc/translator/index.d.ts +1 -1
  44. package/src/ngtsc/translator/src/import_manager.d.ts +19 -2
  45. package/src/ngtsc/typecheck/src/ts_util.d.ts +2 -0
  46. package/bundles/chunk-24NMPW5I.js.map +0 -6
  47. package/bundles/chunk-5YHUYFQ5.js.map +0 -6
  48. package/bundles/chunk-GKQNBAG5.js.map +0 -6
  49. package/bundles/chunk-TFBB265K.js.map +0 -6
  50. /package/bundles/{chunk-MIB7EGOT.js.map → chunk-J2NE3BNR.js.map} +0 -0
@@ -29,7 +29,7 @@ import {
29
29
  translateStatement,
30
30
  translateType,
31
31
  typeNodeToValueExpr
32
- } from "./chunk-TFBB265K.js";
32
+ } from "./chunk-7HZQIUTO.js";
33
33
  import {
34
34
  PerfEvent,
35
35
  PerfPhase
@@ -43,6 +43,7 @@ import {
43
43
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
44
44
  import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
45
45
  import ts from "typescript";
46
+ var CORE_MODULE = "@angular/core";
46
47
  function valueReferenceToExpression(valueRef) {
47
48
  if (valueRef.kind === 2) {
48
49
  return null;
@@ -73,10 +74,10 @@ function toR3Reference(origin, ref, context, refEmitter) {
73
74
  };
74
75
  }
75
76
  function isAngularCore(decorator) {
76
- return decorator.import !== null && decorator.import.from === "@angular/core";
77
+ return decorator.import !== null && decorator.import.from === CORE_MODULE;
77
78
  }
78
79
  function isAngularCoreReference(reference, symbolName) {
79
- return reference.ownedByModuleGuess === "@angular/core" && reference.debugName === symbolName;
80
+ return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
80
81
  }
81
82
  function findAngularDecorator(decorators, name, isCore) {
82
83
  return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
@@ -89,6 +90,16 @@ function isAngularDecorator(decorator, name, isCore) {
89
90
  }
90
91
  return false;
91
92
  }
93
+ function getAngularDecorators(decorators, names, isCore) {
94
+ return decorators.filter((decorator) => {
95
+ var _a;
96
+ const name = isCore ? decorator.name : (_a = decorator.import) == null ? void 0 : _a.name;
97
+ if (name === void 0 || !names.includes(name)) {
98
+ return false;
99
+ }
100
+ return isCore || isAngularCore(decorator);
101
+ });
102
+ }
92
103
  function unwrapExpression(node) {
93
104
  while (ts.isAsExpression(node) || ts.isParenthesizedExpression(node)) {
94
105
  node = node.expression;
@@ -1627,6 +1638,9 @@ function hasInjectableFields(clazz, host) {
1627
1638
  const members = host.getMembersOfClass(clazz);
1628
1639
  return members.some(({ isStatic, name }) => isStatic && (name === "\u0275prov" || name === "\u0275fac"));
1629
1640
  }
1641
+ function isHostDirectiveMetaForGlobalMode(hostDirectiveMeta) {
1642
+ return hostDirectiveMeta.directive instanceof Reference;
1643
+ }
1630
1644
 
1631
1645
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
1632
1646
  var DtsMetadataReader = class {
@@ -2058,6 +2072,9 @@ var HostDirectivesResolver = class {
2058
2072
  }
2059
2073
  walkHostDirectives(directives, results) {
2060
2074
  for (const current of directives) {
2075
+ if (!isHostDirectiveMetaForGlobalMode(current)) {
2076
+ throw new Error("Impossible state: resolving code path in local compilation mode");
2077
+ }
2061
2078
  const hostMeta = flattenInheritedDirectiveMetadata(this.metaReader, current.directive);
2062
2079
  if (hostMeta === null) {
2063
2080
  continue;
@@ -2181,6 +2198,9 @@ function getDirectiveDiagnostics(node, injectableRegistry, evaluator, reflector,
2181
2198
  function validateHostDirectives(origin, hostDirectives, metaReader) {
2182
2199
  const diagnostics = [];
2183
2200
  for (const current of hostDirectives) {
2201
+ if (!isHostDirectiveMetaForGlobalMode(current)) {
2202
+ throw new Error("Impossible state: diagnostics code path for local compilation");
2203
+ }
2184
2204
  const hostMeta = flattenInheritedDirectiveMetadata(metaReader, current.directive);
2185
2205
  if (hostMeta === null) {
2186
2206
  diagnostics.push(makeDiagnostic(ErrorCode.HOST_DIRECTIVE_INVALID, current.directive.getOriginForDiagnostics(origin), `${current.directive.debugName} must be a standalone directive to be used as a host directive`));
@@ -2199,6 +2219,9 @@ function validateHostDirectives(origin, hostDirectives, metaReader) {
2199
2219
  return diagnostics;
2200
2220
  }
2201
2221
  function validateHostDirectiveMappings(bindingType, hostDirectiveMeta, meta, origin, diagnostics, requiredBindings) {
2222
+ if (!isHostDirectiveMetaForGlobalMode(hostDirectiveMeta)) {
2223
+ throw new Error("Impossible state: diagnostics code path for local compilation");
2224
+ }
2202
2225
  const className = meta.name;
2203
2226
  const hostDirectiveMappings = bindingType === "input" ? hostDirectiveMeta.inputs : hostDirectiveMeta.outputs;
2204
2227
  const existingBindings = bindingType === "input" ? meta.inputs : meta.outputs;
@@ -2567,8 +2590,8 @@ function compileInputTransformFields(inputs) {
2567
2590
  }
2568
2591
 
2569
2592
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
2570
- import { compileClassDebugInfo, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation as ViewEncapsulation2, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
2571
- import ts25 from "typescript";
2593
+ import { compileClassDebugInfo, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, ExternalExpr as ExternalExpr6, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation as ViewEncapsulation2, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
2594
+ import ts27 from "typescript";
2572
2595
 
2573
2596
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
2574
2597
  import ts10 from "typescript";
@@ -3575,11 +3598,15 @@ var TraitCompiler = class {
3575
3598
  detectTraits(clazz, decorators) {
3576
3599
  let record = this.recordFor(clazz);
3577
3600
  let foundTraits = [];
3601
+ const nonNgDecoratorsInLocalMode = this.compilationMode === CompilationMode.LOCAL ? new Set(decorators) : null;
3578
3602
  for (const handler of this.handlers) {
3579
3603
  const result = handler.detect(clazz, decorators);
3580
3604
  if (result === void 0) {
3581
3605
  continue;
3582
3606
  }
3607
+ if (nonNgDecoratorsInLocalMode !== null && result.decorator !== null) {
3608
+ nonNgDecoratorsInLocalMode.delete(result.decorator);
3609
+ }
3583
3610
  const isPrimaryHandler = handler.precedence === HandlerPrecedence.PRIMARY;
3584
3611
  const isWeakHandler = handler.precedence === HandlerPrecedence.WEAK;
3585
3612
  const trait = Trait.pending(handler, result);
@@ -3621,6 +3648,17 @@ var TraitCompiler = class {
3621
3648
  record.hasPrimaryHandler = record.hasPrimaryHandler || isPrimaryHandler;
3622
3649
  }
3623
3650
  }
3651
+ if (nonNgDecoratorsInLocalMode !== null && nonNgDecoratorsInLocalMode.size > 0 && record !== null && record.metaDiagnostics === null) {
3652
+ record.metaDiagnostics = [...nonNgDecoratorsInLocalMode].map((decorator) => ({
3653
+ category: ts15.DiagnosticCategory.Error,
3654
+ code: Number("-99" + ErrorCode.DECORATOR_UNEXPECTED),
3655
+ file: getSourceFile(clazz),
3656
+ start: decorator.node.getStart(),
3657
+ length: decorator.node.getWidth(),
3658
+ messageText: "In local compilation mode, Angular does not support custom decorators. Ensure all class decorators are from Angular."
3659
+ }));
3660
+ record.traits = foundTraits = [];
3661
+ }
3624
3662
  return foundTraits.length > 0 ? foundTraits : null;
3625
3663
  }
3626
3664
  makeSymbolForTrait(handler, decl, analysis) {
@@ -3902,21 +3940,7 @@ import ts17 from "typescript";
3902
3940
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
3903
3941
  import ts16 from "typescript";
3904
3942
  function addImports(factory = ts16.factory, importManager, sf, extraStatements = []) {
3905
- const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
3906
- const qualifier = factory.createIdentifier(i.qualifier.text);
3907
- const importClause = factory.createImportClause(
3908
- false,
3909
- void 0,
3910
- factory.createNamespaceImport(qualifier)
3911
- );
3912
- const decl = factory.createImportDeclaration(
3913
- void 0,
3914
- importClause,
3915
- factory.createStringLiteral(i.specifier)
3916
- );
3917
- ts16.setOriginalNode(i.qualifier, decl);
3918
- return decl;
3919
- });
3943
+ const addedImports = importManager.getAllImports(sf.fileName).map((i) => i.qualifier !== null ? createNamespaceImportDecl(i, factory) : createSideEffectImportDecl(i, factory));
3920
3944
  const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
3921
3945
  const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
3922
3946
  if (addedImports.length > 0) {
@@ -3931,6 +3955,28 @@ function addImports(factory = ts16.factory, importManager, sf, extraStatements =
3931
3955
  }
3932
3956
  return sf;
3933
3957
  }
3958
+ function createNamespaceImportDecl(i, factory) {
3959
+ const qualifier = factory.createIdentifier(i.qualifier.text);
3960
+ const importClause = factory.createImportClause(
3961
+ false,
3962
+ void 0,
3963
+ factory.createNamespaceImport(qualifier)
3964
+ );
3965
+ const decl = factory.createImportDeclaration(
3966
+ void 0,
3967
+ importClause,
3968
+ factory.createStringLiteral(i.specifier)
3969
+ );
3970
+ ts16.setOriginalNode(i.qualifier, decl);
3971
+ return decl;
3972
+ }
3973
+ function createSideEffectImportDecl(i, factory) {
3974
+ return factory.createImportDeclaration(
3975
+ void 0,
3976
+ void 0,
3977
+ ts16.factory.createStringLiteral(i.specifier)
3978
+ );
3979
+ }
3934
3980
  function isImportStatement(stmt) {
3935
3981
  return ts16.isImportDeclaration(stmt) || ts16.isImportEqualsDeclaration(stmt) || ts16.isNamespaceImport(stmt);
3936
3982
  }
@@ -4150,11 +4196,11 @@ var Visitor = class {
4150
4196
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
4151
4197
  var NO_DECORATORS = /* @__PURE__ */ new Set();
4152
4198
  var CLOSURE_FILE_OVERVIEW_REGEXP = /\s+@fileoverview\s+/i;
4153
- function ivyTransformFactory(compilation, reflector, importRewriter, defaultImportTracker, perf, isCore, isClosureCompilerEnabled) {
4199
+ function ivyTransformFactory(compilation, reflector, importRewriter, defaultImportTracker, localCompilationExtraImportsTracker, perf, isCore, isClosureCompilerEnabled) {
4154
4200
  const recordWrappedNode = createRecorderFn(defaultImportTracker);
4155
4201
  return (context) => {
4156
4202
  return (file) => {
4157
- return perf.inPhase(PerfPhase.Compile, () => transformIvySourceFile(compilation, context, reflector, importRewriter, file, isCore, isClosureCompilerEnabled, recordWrappedNode));
4203
+ return perf.inPhase(PerfPhase.Compile, () => transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, recordWrappedNode));
4158
4204
  };
4159
4205
  };
4160
4206
  }
@@ -4290,7 +4336,7 @@ var IvyTransformationVisitor = class extends Visitor {
4290
4336
  return node;
4291
4337
  }
4292
4338
  };
4293
- function transformIvySourceFile(compilation, context, reflector, importRewriter, file, isCore, isClosureCompilerEnabled, recordWrappedNode) {
4339
+ function transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, recordWrappedNode) {
4294
4340
  const constantPool = new ConstantPool(isClosureCompilerEnabled);
4295
4341
  const importManager = new ImportManager(importRewriter);
4296
4342
  const compilationVisitor = new IvyCompilationVisitor(compilation, constantPool);
@@ -4305,6 +4351,11 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
4305
4351
  annotateForClosureCompiler: isClosureCompilerEnabled
4306
4352
  }));
4307
4353
  const fileOverviewMeta = isClosureCompilerEnabled ? getFileOverviewComment(sf.statements) : null;
4354
+ if (localCompilationExtraImportsTracker !== null) {
4355
+ for (const moduleName of localCompilationExtraImportsTracker.getImportsForFile(sf)) {
4356
+ importManager.generateSideEffectImport(moduleName);
4357
+ }
4358
+ }
4308
4359
  sf = addImports(context.factory, importManager, sf, constants);
4309
4360
  if (fileOverviewMeta !== null) {
4310
4361
  setFileOverviewComment(sf, fileOverviewMeta);
@@ -4375,12 +4426,15 @@ function nodeArrayFromDecoratorsArray(decorators) {
4375
4426
  import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
4376
4427
 
4377
4428
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
4378
- import { createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr4, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
4379
- import ts21 from "typescript";
4429
+ import { createMayBeForwardRefExpression as createMayBeForwardRefExpression2, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr4, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
4430
+ import ts23 from "typescript";
4380
4431
 
4381
4432
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_function.mjs
4433
+ import ts21 from "typescript";
4434
+
4435
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/initializer_functions.mjs
4382
4436
  import ts20 from "typescript";
4383
- function tryParseInputInitializerAndOptions(member, reflector, coreModule) {
4437
+ function tryParseInitializerApiMember(fnNames, member, reflector, isCore) {
4384
4438
  if (member.value === null || !ts20.isCallExpression(member.value)) {
4385
4439
  return null;
4386
4440
  }
@@ -4389,25 +4443,28 @@ function tryParseInputInitializerAndOptions(member, reflector, coreModule) {
4389
4443
  if (target === null) {
4390
4444
  return null;
4391
4445
  }
4392
- if (target.text === "input") {
4393
- if (!isReferenceToInputFunction(target, coreModule, reflector)) {
4446
+ let apiName = fnNames.find((n) => n === target.text);
4447
+ if (apiName !== void 0) {
4448
+ if (!isReferenceToInitializerApiFunction(apiName, target, isCore, reflector)) {
4394
4449
  return null;
4395
4450
  }
4396
- const optionsNode2 = call.arguments[1];
4397
- return { inputCall: call, optionsNode: optionsNode2, isRequired: false };
4451
+ return { apiName, call, isRequired: false };
4398
4452
  }
4399
4453
  if (target.text !== "required" || !ts20.isPropertyAccessExpression(call.expression)) {
4400
4454
  return null;
4401
4455
  }
4402
- const inputCall = call.expression;
4403
- target = extractPropertyTarget(inputCall.expression);
4404
- if (target === null || !isReferenceToInputFunction(target, coreModule, reflector)) {
4456
+ const apiPropertyAccess = call.expression;
4457
+ target = extractPropertyTarget(apiPropertyAccess.expression);
4458
+ if (target === null) {
4459
+ return null;
4460
+ }
4461
+ apiName = fnNames.find((n) => n === target.text);
4462
+ if (apiName === void 0 || !isReferenceToInitializerApiFunction(apiName, target, isCore, reflector)) {
4405
4463
  return null;
4406
4464
  }
4407
- const optionsNode = call.arguments[0];
4408
4465
  return {
4409
- inputCall: call,
4410
- optionsNode,
4466
+ apiName,
4467
+ call,
4411
4468
  isRequired: true
4412
4469
  };
4413
4470
  }
@@ -4419,38 +4476,40 @@ function extractPropertyTarget(node) {
4419
4476
  }
4420
4477
  return null;
4421
4478
  }
4422
- function isReferenceToInputFunction(target, coreModule, reflector) {
4479
+ function isReferenceToInitializerApiFunction(functionName, target, isCore, reflector) {
4423
4480
  let targetImport = reflector.getImportOfIdentifier(target);
4424
4481
  if (targetImport === null) {
4425
- if (coreModule !== void 0) {
4482
+ if (!isCore) {
4426
4483
  return false;
4427
4484
  }
4428
- targetImport = { name: target.text };
4485
+ targetImport = { name: target.text, from: CORE_MODULE };
4429
4486
  }
4430
- return targetImport.name === "input";
4487
+ return targetImport.name === functionName && targetImport.from === CORE_MODULE;
4431
4488
  }
4489
+
4490
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_function.mjs
4432
4491
  function parseAndValidateOptions(optionsNode) {
4433
- if (!ts20.isObjectLiteralExpression(optionsNode)) {
4492
+ if (!ts21.isObjectLiteralExpression(optionsNode)) {
4434
4493
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, optionsNode, "Argument needs to be an object literal that is statically analyzable.");
4435
4494
  }
4436
4495
  const options = reflectObjectLiteral(optionsNode);
4437
4496
  let alias = void 0;
4438
4497
  if (options.has("alias")) {
4439
4498
  const aliasExpr = options.get("alias");
4440
- if (!ts20.isStringLiteralLike(aliasExpr)) {
4499
+ if (!ts21.isStringLiteralLike(aliasExpr)) {
4441
4500
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, aliasExpr, "Alias needs to be a string that is statically analyzable.");
4442
4501
  }
4443
4502
  alias = aliasExpr.text;
4444
4503
  }
4445
4504
  return { alias };
4446
4505
  }
4447
- function tryParseSignalInputMapping(member, reflector, coreModule) {
4506
+ function tryParseSignalInputMapping(member, reflector, isCore) {
4448
4507
  var _a;
4449
- const signalInput = tryParseInputInitializerAndOptions(member, reflector, coreModule);
4508
+ const signalInput = tryParseInitializerApiMember(["input"], member, reflector, isCore);
4450
4509
  if (signalInput === null) {
4451
4510
  return null;
4452
4511
  }
4453
- const optionsNode = signalInput.optionsNode;
4512
+ const optionsNode = signalInput.isRequired ? signalInput.call.arguments[0] : signalInput.call.arguments[1];
4454
4513
  const options = optionsNode !== void 0 ? parseAndValidateOptions(optionsNode) : null;
4455
4514
  const classPropertyName = member.name;
4456
4515
  return {
@@ -4462,15 +4521,70 @@ function tryParseSignalInputMapping(member, reflector, coreModule) {
4462
4521
  };
4463
4522
  }
4464
4523
 
4524
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/query_functions.mjs
4525
+ import { createMayBeForwardRefExpression, outputAst as o } from "@angular/compiler";
4526
+ import ts22 from "typescript";
4527
+ var queryFunctionNames = ["viewChild", "viewChildren", "contentChild", "contentChildren"];
4528
+ var defaultDescendantsValue = (type) => type !== "contentChildren";
4529
+ function tryParseSignalQueryFromInitializer(member, reflector, isCore) {
4530
+ const query = tryParseInitializerApiMember(queryFunctionNames, member, reflector, isCore);
4531
+ if (query === null) {
4532
+ return null;
4533
+ }
4534
+ const isSingleQuery = query.apiName === "viewChild" || query.apiName === "contentChild";
4535
+ const predicateNode = query.call.arguments[0];
4536
+ if (predicateNode === void 0) {
4537
+ throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, query.call, "No locator specified.");
4538
+ }
4539
+ const optionsNode = query.call.arguments[1];
4540
+ if (optionsNode !== void 0 && !ts22.isObjectLiteralExpression(optionsNode)) {
4541
+ throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, optionsNode, "Argument needs to be an object literal.");
4542
+ }
4543
+ const options = optionsNode && reflectObjectLiteral(optionsNode);
4544
+ const read = (options == null ? void 0 : options.has("read")) ? parseReadOption(options.get("read")) : null;
4545
+ const descendants = (options == null ? void 0 : options.has("descendants")) ? parseDescendantsOption(options.get("descendants")) : defaultDescendantsValue(query.apiName);
4546
+ return {
4547
+ name: query.apiName,
4548
+ call: query.call,
4549
+ metadata: {
4550
+ isSignal: true,
4551
+ propertyName: member.name,
4552
+ static: false,
4553
+ emitDistinctChangesOnly: true,
4554
+ predicate: parseLocator(predicateNode, reflector),
4555
+ first: isSingleQuery,
4556
+ read,
4557
+ descendants
4558
+ }
4559
+ };
4560
+ }
4561
+ function parseLocator(expression, reflector) {
4562
+ const unwrappedExpression = tryUnwrapForwardRef(expression, reflector);
4563
+ if (unwrappedExpression !== null) {
4564
+ expression = unwrappedExpression;
4565
+ }
4566
+ if (ts22.isStringLiteralLike(expression)) {
4567
+ return [expression.text];
4568
+ }
4569
+ return createMayBeForwardRefExpression(new o.WrappedNodeExpr(expression), unwrappedExpression !== null ? 2 : 0);
4570
+ }
4571
+ function parseReadOption(value) {
4572
+ return new o.WrappedNodeExpr(value);
4573
+ }
4574
+ function parseDescendantsOption(value) {
4575
+ if (value.kind === ts22.SyntaxKind.TrueKeyword) {
4576
+ return true;
4577
+ } else if (value.kind === ts22.SyntaxKind.FalseKeyword) {
4578
+ return false;
4579
+ }
4580
+ throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, value, `Expected "descendants" option to be a boolean literal.`);
4581
+ }
4582
+
4465
4583
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
4466
4584
  var EMPTY_OBJECT = {};
4467
- var QUERY_TYPES = /* @__PURE__ */ new Set([
4468
- "ContentChild",
4469
- "ContentChildren",
4470
- "ViewChild",
4471
- "ViewChildren"
4472
- ]);
4473
- function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector = null) {
4585
+ var queryDecoratorNames = ["ViewChild", "ViewChildren", "ContentChild", "ContentChildren"];
4586
+ var QUERY_TYPES = new Set(queryDecoratorNames);
4587
+ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, useTemplatePipeline) {
4474
4588
  let directive;
4475
4589
  if (decorator.args === null || decorator.args.length === 0) {
4476
4590
  directive = /* @__PURE__ */ new Map();
@@ -4478,7 +4592,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
4478
4592
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
4479
4593
  } else {
4480
4594
  const meta = unwrapExpression(decorator.args[0]);
4481
- if (!ts21.isObjectLiteralExpression(meta)) {
4595
+ if (!ts23.isObjectLiteralExpression(meta)) {
4482
4596
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
4483
4597
  }
4484
4598
  directive = reflectObjectLiteral(meta);
@@ -4490,21 +4604,23 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
4490
4604
  const decoratedElements = members.filter((member) => !member.isStatic && member.decorators !== null);
4491
4605
  const coreModule = isCore ? void 0 : "@angular/core";
4492
4606
  const inputsFromMeta = parseInputsArray(clazz, directive, evaluator, reflector, refEmitter, compilationMode);
4493
- const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule, compilationMode, inputsFromMeta, decorator);
4607
+ const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
4494
4608
  const inputs = ClassPropertyMapping.fromMappedObject({ ...inputsFromMeta, ...inputsFromFields });
4495
4609
  const outputsFromMeta = parseOutputsArray(directive, evaluator);
4496
4610
  const outputsFromFields = parseOutputFields(filterToMembersWithDecorator(decoratedElements, "Output", coreModule), evaluator);
4497
4611
  const outputs = ClassPropertyMapping.fromMappedObject({ ...outputsFromMeta, ...outputsFromFields });
4498
- const contentChildFromFields = queriesFromFields(filterToMembersWithDecorator(decoratedElements, "ContentChild", coreModule), reflector, evaluator);
4499
- const contentChildrenFromFields = queriesFromFields(filterToMembersWithDecorator(decoratedElements, "ContentChildren", coreModule), reflector, evaluator);
4500
- const queries = [...contentChildFromFields, ...contentChildrenFromFields];
4501
- const viewChildFromFields = queriesFromFields(filterToMembersWithDecorator(decoratedElements, "ViewChild", coreModule), reflector, evaluator);
4502
- const viewChildrenFromFields = queriesFromFields(filterToMembersWithDecorator(decoratedElements, "ViewChildren", coreModule), reflector, evaluator);
4503
- const viewQueries = [...viewChildFromFields, ...viewChildrenFromFields];
4612
+ const { viewQueries, contentQueries } = parseQueriesOfClassFields(members, reflector, evaluator, isCore);
4504
4613
  if (directive.has("queries")) {
4614
+ const signalQueryFields = new Set([...viewQueries, ...contentQueries].filter((q) => q.isSignal).map((q) => q.propertyName));
4505
4615
  const queriesFromDecorator = extractQueriesFromDecorator(directive.get("queries"), reflector, evaluator, isCore);
4506
- queries.push(...queriesFromDecorator.content);
4507
- viewQueries.push(...queriesFromDecorator.view);
4616
+ const checkAndUnwrapQuery = (q) => {
4617
+ if (signalQueryFields.has(q.metadata.propertyName)) {
4618
+ throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_DECORATOR_METADATA_COLLISION, q.expr, `Query is declared multiple times. "@${decorator.name}" declares a query for the same property.`);
4619
+ }
4620
+ return q.metadata;
4621
+ };
4622
+ contentQueries.push(...queriesFromDecorator.content.map((q) => checkAndUnwrapQuery(q)));
4623
+ viewQueries.push(...queriesFromDecorator.view.map((q) => checkAndUnwrapQuery(q)));
4508
4624
  }
4509
4625
  let selector = defaultSelector;
4510
4626
  if (directive.has("selector")) {
@@ -4555,20 +4671,28 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
4555
4671
  const sourceFile = clazz.getSourceFile();
4556
4672
  const type = wrapTypeReference(reflector, clazz);
4557
4673
  const rawHostDirectives = directive.get("hostDirectives") || null;
4558
- const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator);
4559
- if (hostDirectives !== null) {
4560
- referencesRegistry.add(clazz, ...hostDirectives.map((hostDir) => hostDir.directive));
4674
+ const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, compilationMode);
4675
+ if (compilationMode !== CompilationMode.LOCAL && hostDirectives !== null) {
4676
+ referencesRegistry.add(clazz, ...hostDirectives.map((hostDir) => {
4677
+ if (!isHostDirectiveMetaForGlobalMode(hostDir)) {
4678
+ throw new Error("Impossible state");
4679
+ }
4680
+ return hostDir.directive;
4681
+ }));
4561
4682
  }
4562
4683
  const metadata = {
4563
4684
  name: clazz.name.text,
4564
4685
  deps: ctorDeps,
4565
- host,
4686
+ host: {
4687
+ ...host,
4688
+ useTemplatePipeline
4689
+ },
4566
4690
  lifecycle: {
4567
4691
  usesOnChanges
4568
4692
  },
4569
4693
  inputs: inputs.toJointMappedObject(toR3InputMetadata),
4570
4694
  outputs: outputs.toDirectMappedObject(),
4571
- queries,
4695
+ queries: contentQueries,
4572
4696
  viewQueries,
4573
4697
  selector,
4574
4698
  fullInheritance: false,
@@ -4592,7 +4716,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
4592
4716
  rawHostDirectives
4593
4717
  };
4594
4718
  }
4595
- function extractQueryMetadata(exprNode, name, args, propertyName, reflector, evaluator) {
4719
+ function extractDecoratorQueryMetadata(exprNode, name, args, propertyName, reflector, evaluator) {
4596
4720
  if (args.length === 0) {
4597
4721
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, exprNode, `@${name} must have arguments`);
4598
4722
  }
@@ -4603,7 +4727,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4603
4727
  let isStatic = false;
4604
4728
  let predicate = null;
4605
4729
  if (arg instanceof Reference || arg instanceof DynamicValue) {
4606
- predicate = createMayBeForwardRefExpression(new WrappedNodeExpr5(node), forwardReferenceTarget !== null ? 2 : 0);
4730
+ predicate = createMayBeForwardRefExpression2(new WrappedNodeExpr5(node), forwardReferenceTarget !== null ? 2 : 0);
4607
4731
  } else if (typeof arg === "string") {
4608
4732
  predicate = [arg];
4609
4733
  } else if (isStringArrayOrDie(arg, `@${name} predicate`, node)) {
@@ -4616,7 +4740,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4616
4740
  let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
4617
4741
  if (args.length === 2) {
4618
4742
  const optionsExpr = unwrapExpression(args[1]);
4619
- if (!ts21.isObjectLiteralExpression(optionsExpr)) {
4743
+ if (!ts23.isObjectLiteralExpression(optionsExpr)) {
4620
4744
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
4621
4745
  }
4622
4746
  const options = reflectObjectLiteral(optionsExpr);
@@ -4650,6 +4774,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
4650
4774
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, node, `@${name} has too many arguments`);
4651
4775
  }
4652
4776
  return {
4777
+ isSignal: false,
4653
4778
  propertyName,
4654
4779
  predicate,
4655
4780
  first,
@@ -4710,28 +4835,29 @@ function extractHostBindings(members, evaluator, coreModule, metadata) {
4710
4835
  return bindings;
4711
4836
  }
4712
4837
  function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
4713
- const content = [], view = [];
4714
- if (!ts21.isObjectLiteralExpression(queryData)) {
4838
+ const content = [];
4839
+ const view = [];
4840
+ if (!ts23.isObjectLiteralExpression(queryData)) {
4715
4841
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
4716
4842
  }
4717
4843
  reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
4718
4844
  queryExpr = unwrapExpression(queryExpr);
4719
- if (!ts21.isNewExpression(queryExpr)) {
4845
+ if (!ts23.isNewExpression(queryExpr)) {
4720
4846
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4721
4847
  }
4722
- const queryType = ts21.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4723
- if (!ts21.isIdentifier(queryType)) {
4848
+ const queryType = ts23.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
4849
+ if (!ts23.isIdentifier(queryType)) {
4724
4850
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4725
4851
  }
4726
4852
  const type = reflector.getImportOfIdentifier(queryType);
4727
4853
  if (type === null || !isCore && type.from !== "@angular/core" || !QUERY_TYPES.has(type.name)) {
4728
4854
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
4729
4855
  }
4730
- const query = extractQueryMetadata(queryExpr, type.name, queryExpr.arguments || [], propertyName, reflector, evaluator);
4856
+ const query = extractDecoratorQueryMetadata(queryExpr, type.name, queryExpr.arguments || [], propertyName, reflector, evaluator);
4731
4857
  if (type.name.startsWith("Content")) {
4732
- content.push(query);
4858
+ content.push({ expr: queryExpr, metadata: query });
4733
4859
  } else {
4734
- view.push(query);
4860
+ view.push({ expr: queryExpr, metadata: query });
4735
4861
  }
4736
4862
  });
4737
4863
  return { content, view };
@@ -4749,7 +4875,7 @@ function parseDirectiveStyles(directive, evaluator, compilationMode) {
4749
4875
  const relatedInformation = traceDynamicValue(expression, entry);
4750
4876
  const chain = {
4751
4877
  messageText: `Unknown identifier used as styles string: ${entry.node.getText()} (did you import this string from another file? This is not allowed in local compilation mode. Please either inline it or move it to a separate file and include it using 'styleUrl')`,
4752
- category: ts21.DiagnosticCategory.Error,
4878
+ category: ts23.DiagnosticCategory.Error,
4753
4879
  code: 0
4754
4880
  };
4755
4881
  throw new FatalDiagnosticError(ErrorCode.LOCAL_COMPILATION_IMPORTED_STYLES_STRING, expression, chain, relatedInformation);
@@ -4783,20 +4909,33 @@ function isStringArrayOrDie(value, name, node) {
4783
4909
  }
4784
4910
  return true;
4785
4911
  }
4786
- function queriesFromFields(fields, reflector, evaluator) {
4787
- return fields.map(({ member, decorators }) => {
4788
- const decorator = decorators[0];
4789
- const node = member.node || decorator.node;
4790
- if (member.decorators.some((v) => v.name === "Input")) {
4791
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
4792
- }
4793
- if (decorators.length !== 1) {
4794
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot have multiple query decorators on the same class member");
4795
- } else if (!isPropertyTypeMember(member)) {
4796
- throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, node, "Query decorator must go on a property-type member");
4797
- }
4798
- return extractQueryMetadata(node, decorator.name, decorator.args || [], member.name, reflector, evaluator);
4799
- });
4912
+ function tryGetQueryFromFieldDecorator(member, reflector, evaluator, isCore) {
4913
+ var _a, _b, _c;
4914
+ const decorators = member.decorators;
4915
+ if (decorators === null) {
4916
+ return null;
4917
+ }
4918
+ const queryDecorators = getAngularDecorators(decorators, queryDecoratorNames, isCore);
4919
+ if (queryDecorators.length === 0) {
4920
+ return null;
4921
+ }
4922
+ if (queryDecorators.length !== 1) {
4923
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, (_a = member.node) != null ? _a : queryDecorators[0].node, "Cannot combine multiple query decorators.");
4924
+ }
4925
+ const decorator = queryDecorators[0];
4926
+ const node = member.node || decorator.node;
4927
+ if (decorators.some((v) => v.name === "Input")) {
4928
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
4929
+ }
4930
+ if (!isPropertyTypeMember(member)) {
4931
+ throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, node, "Query decorator must go on a property-type member");
4932
+ }
4933
+ const name = (_c = (_b = decorator.import) == null ? void 0 : _b.name) != null ? _c : decorator.name;
4934
+ return {
4935
+ name,
4936
+ decorator,
4937
+ metadata: extractDecoratorQueryMetadata(node, name, decorator.args || [], member.name, reflector, evaluator)
4938
+ };
4800
4939
  }
4801
4940
  function isPropertyTypeMember(member) {
4802
4941
  return member.kind === ClassMemberKind.Getter || member.kind === ClassMemberKind.Setter || member.kind === ClassMemberKind.Property;
@@ -4876,27 +5015,23 @@ function parseInputsArray(clazz, decoratorMetadata, evaluator, reflector, refEmi
4876
5015
  }
4877
5016
  return inputs;
4878
5017
  }
4879
- function tryGetDecoratorOnMember(member, decoratorName, coreModule) {
5018
+ function tryGetDecoratorOnMember(member, decoratorName, isCore) {
4880
5019
  if (member.decorators === null) {
4881
5020
  return null;
4882
5021
  }
4883
5022
  for (const decorator of member.decorators) {
4884
- if (decorator.import === null || decorator.import.name !== decoratorName) {
4885
- continue;
5023
+ if (isAngularDecorator(decorator, decoratorName, isCore)) {
5024
+ return decorator;
4886
5025
  }
4887
- if (coreModule !== void 0 && decorator.import.from !== coreModule) {
4888
- continue;
4889
- }
4890
- return decorator;
4891
5026
  }
4892
5027
  return null;
4893
5028
  }
4894
- function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModule, refEmitter, compilationMode) {
5029
+ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode) {
4895
5030
  const classPropertyName = member.name;
4896
- const decorator = tryGetDecoratorOnMember(member, "Input", coreModule);
4897
- const signalInputMapping = tryParseSignalInputMapping(member, reflector, coreModule);
5031
+ const decorator = tryGetDecoratorOnMember(member, "Input", isCore);
5032
+ const signalInputMapping = tryParseSignalInputMapping(member, reflector, isCore);
4898
5033
  if (decorator !== null && signalInputMapping !== null) {
4899
- throw new FatalDiagnosticError(ErrorCode.SIGNAL_INPUT_AND_DISALLOWED_DECORATOR, decorator.node, `Using @Input with a signal input is not allowed.`);
5034
+ throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decorator.node, `Using @Input with a signal input is not allowed.`);
4900
5035
  }
4901
5036
  if (decorator !== null) {
4902
5037
  if (decorator.args !== null && decorator.args.length > 1) {
@@ -4936,20 +5071,20 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModu
4936
5071
  }
4937
5072
  return null;
4938
5073
  }
4939
- function parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule, compilationMode, inputsFromClassDecorator, classDecorator) {
5074
+ function parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
4940
5075
  var _a, _b;
4941
5076
  const inputs = {};
4942
5077
  for (const member of members) {
4943
5078
  const classPropertyName = member.name;
4944
- const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModule, refEmitter, compilationMode);
5079
+ const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode);
4945
5080
  if (inputMapping === null) {
4946
5081
  continue;
4947
5082
  }
4948
5083
  if (member.isStatic) {
4949
- throw new FatalDiagnosticError(ErrorCode.INPUT_DECLARED_ON_STATIC_MEMBER, (_a = member.node) != null ? _a : clazz, `Input "${member.name}" is incorrectly declared as static member of "${clazz.name.text}".`);
5084
+ throw new FatalDiagnosticError(ErrorCode.INCORRECTLY_DECLARED_ON_STATIC_MEMBER, (_a = member.node) != null ? _a : clazz, `Input "${member.name}" is incorrectly declared as static member of "${clazz.name.text}".`);
4950
5085
  }
4951
5086
  if (inputMapping.isSignal && inputsFromClassDecorator.hasOwnProperty(classPropertyName)) {
4952
- throw new FatalDiagnosticError(ErrorCode.SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION, (_b = member.node) != null ? _b : clazz, `Input "${member.name}" is also declared as non-signal in @${classDecorator.name}.`);
5087
+ throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_DECORATOR_METADATA_COLLISION, (_b = member.node) != null ? _b : clazz, `Input "${member.name}" is also declared as non-signal in @${classDecorator.name}.`);
4953
5088
  }
4954
5089
  inputs[classPropertyName] = inputMapping;
4955
5090
  }
@@ -4964,7 +5099,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
4964
5099
  }
4965
5100
  return {
4966
5101
  node: node2,
4967
- type: new Reference(ts21.factory.createKeywordTypeNode(ts21.SyntaxKind.UnknownKeyword))
5102
+ type: new Reference(ts23.factory.createKeywordTypeNode(ts23.SyntaxKind.UnknownKeyword))
4968
5103
  };
4969
5104
  }
4970
5105
  const definition = reflector.getDefinitionOfFunction(value.node);
@@ -4992,7 +5127,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
4992
5127
  if (!firstParam) {
4993
5128
  return {
4994
5129
  node,
4995
- type: new Reference(ts21.factory.createKeywordTypeNode(ts21.SyntaxKind.UnknownKeyword))
5130
+ type: new Reference(ts23.factory.createKeywordTypeNode(ts23.SyntaxKind.UnknownKeyword))
4996
5131
  };
4997
5132
  }
4998
5133
  if (!firstParam.type) {
@@ -5007,7 +5142,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
5007
5142
  }
5008
5143
  function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
5009
5144
  (function walk(node) {
5010
- if (ts21.isTypeReferenceNode(node) && ts21.isIdentifier(node.typeName)) {
5145
+ if (ts23.isTypeReferenceNode(node) && ts23.isIdentifier(node.typeName)) {
5011
5146
  const declaration = reflector.getDeclarationOfIdentifier(node.typeName);
5012
5147
  if (declaration !== null) {
5013
5148
  if (declaration.node.getSourceFile() !== contextFile) {
@@ -5021,6 +5156,57 @@ function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
5021
5156
  node.forEachChild(walk);
5022
5157
  })(type);
5023
5158
  }
5159
+ function parseQueriesOfClassFields(members, reflector, evaluator, isCore) {
5160
+ var _a;
5161
+ const viewQueries = [];
5162
+ const contentQueries = [];
5163
+ const decoratorViewChild = [];
5164
+ const decoratorViewChildren = [];
5165
+ const decoratorContentChild = [];
5166
+ const decoratorContentChildren = [];
5167
+ for (const member of members) {
5168
+ const decoratorQuery = tryGetQueryFromFieldDecorator(member, reflector, evaluator, isCore);
5169
+ const signalQuery = tryParseSignalQueryFromInitializer(member, reflector, isCore);
5170
+ if (decoratorQuery !== null && signalQuery !== null) {
5171
+ throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decoratorQuery.decorator.node, `Using @${decoratorQuery.name} with a signal-based query is not allowed.`);
5172
+ }
5173
+ const queryNode = (_a = decoratorQuery == null ? void 0 : decoratorQuery.decorator.node) != null ? _a : signalQuery == null ? void 0 : signalQuery.call;
5174
+ if (queryNode !== void 0 && member.isStatic) {
5175
+ throw new FatalDiagnosticError(ErrorCode.INCORRECTLY_DECLARED_ON_STATIC_MEMBER, queryNode, `Query is incorrectly declared on a static class member.`);
5176
+ }
5177
+ if (decoratorQuery !== null) {
5178
+ switch (decoratorQuery.name) {
5179
+ case "ViewChild":
5180
+ decoratorViewChild.push(decoratorQuery.metadata);
5181
+ break;
5182
+ case "ViewChildren":
5183
+ decoratorViewChildren.push(decoratorQuery.metadata);
5184
+ break;
5185
+ case "ContentChild":
5186
+ decoratorContentChild.push(decoratorQuery.metadata);
5187
+ break;
5188
+ case "ContentChildren":
5189
+ decoratorContentChildren.push(decoratorQuery.metadata);
5190
+ break;
5191
+ }
5192
+ } else if (signalQuery !== null) {
5193
+ switch (signalQuery.name) {
5194
+ case "viewChild":
5195
+ case "viewChildren":
5196
+ viewQueries.push(signalQuery.metadata);
5197
+ break;
5198
+ case "contentChild":
5199
+ case "contentChildren":
5200
+ contentQueries.push(signalQuery.metadata);
5201
+ break;
5202
+ }
5203
+ }
5204
+ }
5205
+ return {
5206
+ viewQueries: [...viewQueries, ...decoratorViewChild, ...decoratorViewChildren],
5207
+ contentQueries: [...contentQueries, ...decoratorContentChild, ...decoratorContentChildren]
5208
+ };
5209
+ }
5024
5210
  function parseOutputsArray(directive, evaluator) {
5025
5211
  const metaValues = parseFieldStringArrayValue(directive, "outputs", evaluator);
5026
5212
  return metaValues ? parseMappingStringArray(metaValues) : EMPTY_OBJECT;
@@ -5067,31 +5253,45 @@ function evaluateHostExpressionBindings(hostExpr, evaluator) {
5067
5253
  }
5068
5254
  return bindings;
5069
5255
  }
5070
- function extractHostDirectives(rawHostDirectives, evaluator) {
5256
+ function extractHostDirectives(rawHostDirectives, evaluator, compilationMode) {
5071
5257
  const resolved = evaluator.evaluate(rawHostDirectives, forwardRefResolver);
5072
5258
  if (!Array.isArray(resolved)) {
5073
5259
  throw createValueHasWrongTypeError(rawHostDirectives, resolved, "hostDirectives must be an array");
5074
5260
  }
5075
5261
  return resolved.map((value) => {
5076
5262
  const hostReference = value instanceof Map ? value.get("directive") : value;
5077
- if (!(hostReference instanceof Reference)) {
5078
- throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive must be a reference");
5263
+ if (compilationMode !== CompilationMode.LOCAL) {
5264
+ if (!(hostReference instanceof Reference)) {
5265
+ throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive must be a reference");
5266
+ }
5267
+ if (!isNamedClassDeclaration(hostReference.node)) {
5268
+ throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive reference must be a class");
5269
+ }
5079
5270
  }
5080
- if (!isNamedClassDeclaration(hostReference.node)) {
5081
- throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive reference must be a class");
5271
+ let directive;
5272
+ let nameForErrors = (fieldName) => "@Directive.hostDirectives";
5273
+ if (compilationMode === CompilationMode.LOCAL && hostReference instanceof DynamicValue) {
5274
+ if (!ts23.isIdentifier(hostReference.node) && !ts23.isPropertyAccessExpression(hostReference.node)) {
5275
+ throw new FatalDiagnosticError(ErrorCode.LOCAL_COMPILATION_HOST_DIRECTIVE_INVALID, hostReference.node, `In local compilation mode, host directive cannot be an expression`);
5276
+ }
5277
+ directive = new WrappedNodeExpr5(hostReference.node);
5278
+ } else if (hostReference instanceof Reference) {
5279
+ directive = hostReference;
5280
+ nameForErrors = (fieldName) => `@Directive.hostDirectives.${directive.node.name.text}.${fieldName}`;
5281
+ } else {
5282
+ throw new Error("Impossible state");
5082
5283
  }
5083
5284
  const meta = {
5084
- directive: hostReference,
5085
- isForwardReference: hostReference.synthetic,
5086
- inputs: parseHostDirectivesMapping("inputs", value, hostReference.node, rawHostDirectives),
5087
- outputs: parseHostDirectivesMapping("outputs", value, hostReference.node, rawHostDirectives)
5285
+ directive,
5286
+ isForwardReference: hostReference instanceof Reference && hostReference.synthetic,
5287
+ inputs: parseHostDirectivesMapping("inputs", value, nameForErrors("input"), rawHostDirectives),
5288
+ outputs: parseHostDirectivesMapping("outputs", value, nameForErrors("output"), rawHostDirectives)
5088
5289
  };
5089
5290
  return meta;
5090
5291
  });
5091
5292
  }
5092
- function parseHostDirectivesMapping(field, resolvedValue, classReference, sourceExpression) {
5293
+ function parseHostDirectivesMapping(field, resolvedValue, nameForErrors, sourceExpression) {
5093
5294
  if (resolvedValue instanceof Map && resolvedValue.has(field)) {
5094
- const nameForErrors = `@Directive.hostDirectives.${classReference.name.text}.${field}`;
5095
5295
  const rawInputs = resolvedValue.get(field);
5096
5296
  if (isStringArrayOrDie(rawInputs, nameForErrors, sourceExpression)) {
5097
5297
  return parseMappingStringArray(rawInputs);
@@ -5100,8 +5300,17 @@ function parseHostDirectivesMapping(field, resolvedValue, classReference, source
5100
5300
  return null;
5101
5301
  }
5102
5302
  function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
5303
+ let directive;
5304
+ if (hostDirective.directive instanceof Reference) {
5305
+ directive = toR3Reference(hostDirective.directive.node, hostDirective.directive, context, refEmitter);
5306
+ } else {
5307
+ directive = {
5308
+ value: hostDirective.directive,
5309
+ type: hostDirective.directive
5310
+ };
5311
+ }
5103
5312
  return {
5104
- directive: toR3Reference(hostDirective.directive.node, hostDirective.directive, context, refEmitter),
5313
+ directive,
5105
5314
  isForwardReference: hostDirective.isForwardReference,
5106
5315
  inputs: hostDirective.inputs || null,
5107
5316
  outputs: hostDirective.outputs || null
@@ -5219,7 +5428,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
5219
5428
  "ngAfterContentChecked"
5220
5429
  ]);
5221
5430
  var DirectiveDecoratorHandler = class {
5222
- constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, includeClassMetadata, compilationMode) {
5431
+ constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, includeClassMetadata, compilationMode, useTemplatePipeline, generateExtraImportsInLocalMode) {
5223
5432
  this.reflector = reflector;
5224
5433
  this.evaluator = evaluator;
5225
5434
  this.metaRegistry = metaRegistry;
@@ -5235,6 +5444,8 @@ var DirectiveDecoratorHandler = class {
5235
5444
  this.perf = perf;
5236
5445
  this.includeClassMetadata = includeClassMetadata;
5237
5446
  this.compilationMode = compilationMode;
5447
+ this.useTemplatePipeline = useTemplatePipeline;
5448
+ this.generateExtraImportsInLocalMode = generateExtraImportsInLocalMode;
5238
5449
  this.precedence = HandlerPrecedence.PRIMARY;
5239
5450
  this.name = "DirectiveDecoratorHandler";
5240
5451
  }
@@ -5256,7 +5467,19 @@ var DirectiveDecoratorHandler = class {
5256
5467
  return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
5257
5468
  }
5258
5469
  this.perf.eventCount(PerfEvent.AnalyzeDirective);
5259
- const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode);
5470
+ const directiveResult = extractDirectiveMetadata(
5471
+ node,
5472
+ decorator,
5473
+ this.reflector,
5474
+ this.evaluator,
5475
+ this.refEmitter,
5476
+ this.referencesRegistry,
5477
+ this.isCore,
5478
+ this.annotateForClosureCompiler,
5479
+ this.compilationMode,
5480
+ null,
5481
+ this.useTemplatePipeline
5482
+ );
5260
5483
  if (directiveResult === void 0) {
5261
5484
  return {};
5262
5485
  }
@@ -5287,9 +5510,6 @@ var DirectiveDecoratorHandler = class {
5287
5510
  return new DirectiveSymbol(node, analysis.meta.selector, analysis.inputs, analysis.outputs, analysis.meta.exportAs, analysis.typeCheckMeta, typeParameters);
5288
5511
  }
5289
5512
  register(node, analysis) {
5290
- if (this.compilationMode === CompilationMode.LOCAL) {
5291
- return;
5292
- }
5293
5513
  const ref = new Reference(node);
5294
5514
  this.metaRegistry.registerDirectiveMetadata({
5295
5515
  kind: MetaKind.Directive,
@@ -5381,16 +5601,16 @@ var DirectiveDecoratorHandler = class {
5381
5601
 
5382
5602
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
5383
5603
  import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
5384
- import ts23 from "typescript";
5604
+ import ts25 from "typescript";
5385
5605
 
5386
5606
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
5387
- import ts22 from "typescript";
5607
+ import ts24 from "typescript";
5388
5608
  function createModuleWithProvidersResolver(reflector, isCore) {
5389
5609
  function _reflectModuleFromTypeParam(type, node) {
5390
- if (!ts22.isTypeReferenceNode(type)) {
5610
+ if (!ts24.isTypeReferenceNode(type)) {
5391
5611
  return null;
5392
5612
  }
5393
- const typeName = type && (ts22.isIdentifier(type.typeName) && type.typeName || ts22.isQualifiedName(type.typeName) && type.typeName.right) || null;
5613
+ const typeName = type && (ts24.isIdentifier(type.typeName) && type.typeName || ts24.isQualifiedName(type.typeName) && type.typeName.right) || null;
5394
5614
  if (typeName === null) {
5395
5615
  return null;
5396
5616
  }
@@ -5402,7 +5622,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
5402
5622
  return null;
5403
5623
  }
5404
5624
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
5405
- const parent = ts22.isMethodDeclaration(node) && ts22.isClassDeclaration(node.parent) ? node.parent : null;
5625
+ const parent = ts24.isMethodDeclaration(node) && ts24.isClassDeclaration(node.parent) ? node.parent : null;
5406
5626
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
5407
5627
  throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
5408
5628
  }
@@ -5410,13 +5630,13 @@ function createModuleWithProvidersResolver(reflector, isCore) {
5410
5630
  return typeNodeToValueExpr(arg);
5411
5631
  }
5412
5632
  function _reflectModuleFromLiteralType(type) {
5413
- if (!ts22.isIntersectionTypeNode(type)) {
5633
+ if (!ts24.isIntersectionTypeNode(type)) {
5414
5634
  return null;
5415
5635
  }
5416
5636
  for (const t of type.types) {
5417
- if (ts22.isTypeLiteralNode(t)) {
5637
+ if (ts24.isTypeLiteralNode(t)) {
5418
5638
  for (const m of t.members) {
5419
- const ngModuleType = ts22.isPropertySignature(m) && ts22.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
5639
+ const ngModuleType = ts24.isPropertySignature(m) && ts24.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
5420
5640
  const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
5421
5641
  if (ngModuleExpression) {
5422
5642
  return ngModuleExpression;
@@ -5517,7 +5737,7 @@ var NgModuleSymbol = class extends SemanticSymbol {
5517
5737
  }
5518
5738
  };
5519
5739
  var NgModuleDecoratorHandler = class {
5520
- constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf, includeClassMetadata, includeSelectorScope, compilationMode) {
5740
+ constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf, includeClassMetadata, includeSelectorScope, compilationMode, localCompilationExtraImportsTracker) {
5521
5741
  this.reflector = reflector;
5522
5742
  this.evaluator = evaluator;
5523
5743
  this.metaReader = metaReader;
@@ -5535,6 +5755,7 @@ var NgModuleDecoratorHandler = class {
5535
5755
  this.includeClassMetadata = includeClassMetadata;
5536
5756
  this.includeSelectorScope = includeSelectorScope;
5537
5757
  this.compilationMode = compilationMode;
5758
+ this.localCompilationExtraImportsTracker = localCompilationExtraImportsTracker;
5538
5759
  this.precedence = HandlerPrecedence.PRIMARY;
5539
5760
  this.name = "NgModuleDecoratorHandler";
5540
5761
  }
@@ -5560,8 +5781,8 @@ var NgModuleDecoratorHandler = class {
5560
5781
  if (decorator.args === null || decorator.args.length > 1) {
5561
5782
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
5562
5783
  }
5563
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts23.factory.createObjectLiteralExpression([]);
5564
- if (!ts23.isObjectLiteralExpression(meta)) {
5784
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts25.factory.createObjectLiteralExpression([]);
5785
+ if (!ts25.isObjectLiteralExpression(meta)) {
5565
5786
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
5566
5787
  }
5567
5788
  const ngModule = reflectObjectLiteral(meta);
@@ -5575,9 +5796,9 @@ var NgModuleDecoratorHandler = class {
5575
5796
  const diagnostics = [];
5576
5797
  let declarationRefs = [];
5577
5798
  const rawDeclarations = (_a = ngModule.get("declarations")) != null ? _a : null;
5578
- if (this.compilationMode !== CompilationMode.LOCAL && rawDeclarations !== null) {
5799
+ if (rawDeclarations !== null) {
5579
5800
  const declarationMeta = this.evaluator.evaluate(rawDeclarations, forwardRefResolver);
5580
- declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations", 0).references;
5801
+ declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations", 0, this.compilationMode === CompilationMode.LOCAL).references;
5581
5802
  for (const ref of declarationRefs) {
5582
5803
  if (ref.node.getSourceFile().isDeclarationFile) {
5583
5804
  const errorNode = ref.getOriginForDiagnostics(rawDeclarations);
@@ -5590,22 +5811,35 @@ var NgModuleDecoratorHandler = class {
5590
5811
  }
5591
5812
  let importRefs = [];
5592
5813
  let rawImports = (_b = ngModule.get("imports")) != null ? _b : null;
5593
- if (this.compilationMode !== CompilationMode.LOCAL && rawImports !== null) {
5814
+ if (rawImports !== null) {
5594
5815
  const importsMeta = this.evaluator.evaluate(rawImports, moduleResolvers);
5595
- importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports", 0).references;
5816
+ const result = this.resolveTypeList(rawImports, importsMeta, name, "imports", 0, this.compilationMode === CompilationMode.LOCAL);
5817
+ if (this.compilationMode === CompilationMode.LOCAL && this.localCompilationExtraImportsTracker !== null) {
5818
+ for (const d of result.dynamicValues) {
5819
+ this.localCompilationExtraImportsTracker.addGlobalImportFromIdentifier(d.node);
5820
+ }
5821
+ }
5822
+ importRefs = result.references;
5596
5823
  }
5597
5824
  let exportRefs = [];
5598
5825
  const rawExports = (_c = ngModule.get("exports")) != null ? _c : null;
5599
- if (this.compilationMode !== CompilationMode.LOCAL && rawExports !== null) {
5826
+ if (rawExports !== null) {
5600
5827
  const exportsMeta = this.evaluator.evaluate(rawExports, moduleResolvers);
5601
- exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports", 0).references;
5828
+ exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports", 0, this.compilationMode === CompilationMode.LOCAL).references;
5602
5829
  this.referencesRegistry.add(node, ...exportRefs);
5603
5830
  }
5604
5831
  let bootstrapRefs = [];
5605
5832
  const rawBootstrap = (_d = ngModule.get("bootstrap")) != null ? _d : null;
5606
5833
  if (this.compilationMode !== CompilationMode.LOCAL && rawBootstrap !== null) {
5607
5834
  const bootstrapMeta = this.evaluator.evaluate(rawBootstrap, forwardRefResolver);
5608
- bootstrapRefs = this.resolveTypeList(rawBootstrap, bootstrapMeta, name, "bootstrap", 0).references;
5835
+ bootstrapRefs = this.resolveTypeList(
5836
+ rawBootstrap,
5837
+ bootstrapMeta,
5838
+ name,
5839
+ "bootstrap",
5840
+ 0,
5841
+ false
5842
+ ).references;
5609
5843
  for (const ref of bootstrapRefs) {
5610
5844
  const dirMeta = this.metaReader.getDirectiveMetadata(ref);
5611
5845
  if (dirMeta == null ? void 0 : dirMeta.isStandalone) {
@@ -5621,7 +5855,7 @@ var NgModuleDecoratorHandler = class {
5621
5855
  id = new WrappedNodeExpr7(idExpr);
5622
5856
  } else {
5623
5857
  const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
5624
- diag.category = ts23.DiagnosticCategory.Warning;
5858
+ diag.category = ts25.DiagnosticCategory.Warning;
5625
5859
  diagnostics.push(diag);
5626
5860
  }
5627
5861
  }
@@ -5673,16 +5907,16 @@ var NgModuleDecoratorHandler = class {
5673
5907
  }
5674
5908
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
5675
5909
  let wrappedProviders = null;
5676
- if (rawProviders !== null && (!ts23.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
5910
+ if (rawProviders !== null && (!ts25.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
5677
5911
  wrappedProviders = new WrappedNodeExpr7(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
5678
5912
  }
5679
5913
  const topLevelImports = [];
5680
5914
  if (this.compilationMode !== CompilationMode.LOCAL && ngModule.has("imports")) {
5681
5915
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
5682
5916
  let topLevelExpressions = [];
5683
- if (ts23.isArrayLiteralExpression(rawImports2)) {
5917
+ if (ts25.isArrayLiteralExpression(rawImports2)) {
5684
5918
  for (const element of rawImports2.elements) {
5685
- if (ts23.isSpreadElement(element)) {
5919
+ if (ts25.isSpreadElement(element)) {
5686
5920
  topLevelExpressions.push(element.expression);
5687
5921
  continue;
5688
5922
  }
@@ -5694,7 +5928,14 @@ var NgModuleDecoratorHandler = class {
5694
5928
  let absoluteIndex = 0;
5695
5929
  for (const importExpr of topLevelExpressions) {
5696
5930
  const resolved = this.evaluator.evaluate(importExpr, moduleResolvers);
5697
- const { references, hasModuleWithProviders } = this.resolveTypeList(importExpr, [resolved], node.name.text, "imports", absoluteIndex);
5931
+ const { references, hasModuleWithProviders } = this.resolveTypeList(
5932
+ importExpr,
5933
+ [resolved],
5934
+ node.name.text,
5935
+ "imports",
5936
+ absoluteIndex,
5937
+ false
5938
+ );
5698
5939
  absoluteIndex += references.length;
5699
5940
  topLevelImports.push({
5700
5941
  expression: importExpr,
@@ -5714,7 +5955,7 @@ var NgModuleDecoratorHandler = class {
5714
5955
  if (exp === null) {
5715
5956
  continue;
5716
5957
  }
5717
- if (ts23.isArrayLiteralExpression(exp)) {
5958
+ if (ts25.isArrayLiteralExpression(exp)) {
5718
5959
  if (exp.elements) {
5719
5960
  injectorMetadata.imports.push(...exp.elements.map((n) => new WrappedNodeExpr7(n)));
5720
5961
  }
@@ -5759,9 +6000,6 @@ var NgModuleDecoratorHandler = class {
5759
6000
  return new NgModuleSymbol(node, analysis.providers !== null);
5760
6001
  }
5761
6002
  register(node, analysis) {
5762
- if (this.compilationMode === CompilationMode.LOCAL) {
5763
- return;
5764
- }
5765
6003
  this.metaRegistry.registerNgModuleMetadata({
5766
6004
  kind: MetaKind.NgModule,
5767
6005
  ref: new Reference(node),
@@ -5916,6 +6154,9 @@ var NgModuleDecoratorHandler = class {
5916
6154
  }
5917
6155
  }
5918
6156
  appendRemoteScopingStatements(ngModuleStatements, node, declarations, remoteScopesMayRequireCycleProtection) {
6157
+ if (this.compilationMode === CompilationMode.LOCAL) {
6158
+ return;
6159
+ }
5919
6160
  const context = getSourceFile(node);
5920
6161
  for (const decl of declarations) {
5921
6162
  const remoteScope = this.scopeRegistry.getRemoteScope(decl.node);
@@ -5973,10 +6214,18 @@ var NgModuleDecoratorHandler = class {
5973
6214
  isClassDeclarationReference(ref) {
5974
6215
  return this.reflector.isClass(ref.node);
5975
6216
  }
5976
- resolveTypeList(expr, resolvedList, className, arrayName, absoluteIndex) {
6217
+ resolveTypeList(expr, resolvedList, className, arrayName, absoluteIndex, allowUnresolvedReferences) {
5977
6218
  let hasModuleWithProviders = false;
5978
6219
  const refList = [];
6220
+ const dynamicValueSet = /* @__PURE__ */ new Set();
5979
6221
  if (!Array.isArray(resolvedList)) {
6222
+ if (allowUnresolvedReferences) {
6223
+ return {
6224
+ references: [],
6225
+ hasModuleWithProviders: false,
6226
+ dynamicValues: []
6227
+ };
6228
+ }
5980
6229
  throw createValueHasWrongTypeError(expr, resolvedList, `Expected array when reading the NgModule.${arrayName} of ${className}`);
5981
6230
  }
5982
6231
  for (let idx = 0; idx < resolvedList.length; idx++) {
@@ -5989,8 +6238,11 @@ var NgModuleDecoratorHandler = class {
5989
6238
  hasModuleWithProviders = true;
5990
6239
  }
5991
6240
  if (Array.isArray(entry)) {
5992
- const recursiveResult = this.resolveTypeList(expr, entry, className, arrayName, absoluteIndex);
6241
+ const recursiveResult = this.resolveTypeList(expr, entry, className, arrayName, absoluteIndex, allowUnresolvedReferences);
5993
6242
  refList.push(...recursiveResult.references);
6243
+ for (const d of recursiveResult.dynamicValues) {
6244
+ dynamicValueSet.add(d);
6245
+ }
5994
6246
  absoluteIndex += recursiveResult.references.length;
5995
6247
  hasModuleWithProviders = hasModuleWithProviders || recursiveResult.hasModuleWithProviders;
5996
6248
  } else if (entry instanceof Reference) {
@@ -5999,13 +6251,17 @@ var NgModuleDecoratorHandler = class {
5999
6251
  }
6000
6252
  refList.push(entry);
6001
6253
  absoluteIndex += 1;
6254
+ } else if (entry instanceof DynamicValue && allowUnresolvedReferences) {
6255
+ dynamicValueSet.add(entry);
6256
+ continue;
6002
6257
  } else {
6003
6258
  throw createValueHasWrongTypeError(expr, entry, `Value at position ${absoluteIndex} in the NgModule.${arrayName} of ${className} is not a reference`);
6004
6259
  }
6005
6260
  }
6006
6261
  return {
6007
6262
  references: refList,
6008
- hasModuleWithProviders
6263
+ hasModuleWithProviders,
6264
+ dynamicValues: [...dynamicValueSet]
6009
6265
  };
6010
6266
  }
6011
6267
  };
@@ -6013,7 +6269,7 @@ function isNgModule(node, compilation) {
6013
6269
  return !compilation.dependencies.some((dep) => dep.ref.node === node);
6014
6270
  }
6015
6271
  function isModuleIdExpression(expr) {
6016
- return ts23.isPropertyAccessExpression(expr) && ts23.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
6272
+ return ts25.isPropertyAccessExpression(expr) && ts25.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
6017
6273
  }
6018
6274
  function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
6019
6275
  const componentClassName = bootstrappedClassRef.node.name.text;
@@ -6050,7 +6306,7 @@ function checkCustomElementSelectorForErrors(selector) {
6050
6306
 
6051
6307
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
6052
6308
  import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
6053
- import ts24 from "typescript";
6309
+ import ts26 from "typescript";
6054
6310
  function getTemplateDeclarationNodeForError(declaration) {
6055
6311
  return declaration.isInline ? declaration.expression : declaration.templateUrlExpression;
6056
6312
  }
@@ -6062,7 +6318,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
6062
6318
  let sourceMapping;
6063
6319
  let escapedString = false;
6064
6320
  let sourceMapUrl;
6065
- if (ts24.isStringLiteral(template.expression) || ts24.isNoSubstitutionTemplateLiteral(template.expression)) {
6321
+ if (ts26.isStringLiteral(template.expression) || ts26.isNoSubstitutionTemplateLiteral(template.expression)) {
6066
6322
  sourceParseRange = getTemplateRange(template.expression);
6067
6323
  sourceStr = template.expression.getSourceFile().text;
6068
6324
  templateContent = template.expression.text;
@@ -6078,7 +6334,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
6078
6334
  const relatedInformation = traceDynamicValue(template.expression, resolvedTemplate);
6079
6335
  const chain = {
6080
6336
  messageText: `Unknown identifier used as template string: ${template.expression.getText()} (did you import this string from another file? This is not allowed in local compilation mode. Please either inline it or move it to a separate file and include it using 'templateUrl')`,
6081
- category: ts24.DiagnosticCategory.Error,
6337
+ category: ts26.DiagnosticCategory.Error,
6082
6338
  code: 0
6083
6339
  };
6084
6340
  throw new FatalDiagnosticError(ErrorCode.LOCAL_COMPILATION_IMPORTED_TEMPLATE_STRING, template.expression, chain, relatedInformation);
@@ -6247,7 +6503,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
6247
6503
  }
6248
6504
  function getTemplateRange(templateExpr) {
6249
6505
  const startPos = templateExpr.getStart() + 1;
6250
- const { line, character } = ts24.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
6506
+ const { line, character } = ts26.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
6251
6507
  return {
6252
6508
  startPos,
6253
6509
  startLine: line,
@@ -6280,7 +6536,7 @@ function transformDecoratorResources(dec, component, styles, template) {
6280
6536
  const metadata = new Map(component);
6281
6537
  if (metadata.has("templateUrl")) {
6282
6538
  metadata.delete("templateUrl");
6283
- metadata.set("template", ts24.factory.createStringLiteral(template.content));
6539
+ metadata.set("template", ts26.factory.createStringLiteral(template.content));
6284
6540
  }
6285
6541
  if (metadata.has("styleUrls") || metadata.has("styleUrl") || metadata.has("styles")) {
6286
6542
  metadata.delete("styles");
@@ -6289,20 +6545,20 @@ function transformDecoratorResources(dec, component, styles, template) {
6289
6545
  if (styles.length > 0) {
6290
6546
  const styleNodes = styles.reduce((result, style) => {
6291
6547
  if (style.trim().length > 0) {
6292
- result.push(ts24.factory.createStringLiteral(style));
6548
+ result.push(ts26.factory.createStringLiteral(style));
6293
6549
  }
6294
6550
  return result;
6295
6551
  }, []);
6296
6552
  if (styleNodes.length > 0) {
6297
- metadata.set("styles", ts24.factory.createArrayLiteralExpression(styleNodes));
6553
+ metadata.set("styles", ts26.factory.createArrayLiteralExpression(styleNodes));
6298
6554
  }
6299
6555
  }
6300
6556
  }
6301
6557
  const newMetadataFields = [];
6302
6558
  for (const [name, value] of metadata.entries()) {
6303
- newMetadataFields.push(ts24.factory.createPropertyAssignment(name, value));
6559
+ newMetadataFields.push(ts26.factory.createPropertyAssignment(name, value));
6304
6560
  }
6305
- return { ...dec, args: [ts24.factory.createObjectLiteralExpression(newMetadataFields)] };
6561
+ return { ...dec, args: [ts26.factory.createObjectLiteralExpression(newMetadataFields)] };
6306
6562
  }
6307
6563
  function extractComponentStyleUrls(evaluator, component) {
6308
6564
  const styleUrlsExpr = component.get("styleUrls");
@@ -6328,9 +6584,9 @@ function extractComponentStyleUrls(evaluator, component) {
6328
6584
  }
6329
6585
  function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
6330
6586
  const styleUrls = [];
6331
- if (ts24.isArrayLiteralExpression(styleUrlsExpr)) {
6587
+ if (ts26.isArrayLiteralExpression(styleUrlsExpr)) {
6332
6588
  for (const styleUrlExpr of styleUrlsExpr.elements) {
6333
- if (ts24.isSpreadElement(styleUrlExpr)) {
6589
+ if (ts26.isSpreadElement(styleUrlExpr)) {
6334
6590
  styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
6335
6591
  } else {
6336
6592
  const styleUrl = evaluator.evaluate(styleUrlExpr);
@@ -6362,18 +6618,18 @@ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
6362
6618
  function extractStyleResources(resourceLoader, component, containingFile) {
6363
6619
  const styles = /* @__PURE__ */ new Set();
6364
6620
  function stringLiteralElements(array) {
6365
- return array.elements.filter((e) => ts24.isStringLiteralLike(e));
6621
+ return array.elements.filter((e) => ts26.isStringLiteralLike(e));
6366
6622
  }
6367
6623
  const styleUrlExpr = component.get("styleUrl");
6368
6624
  const styleUrlsExpr = component.get("styleUrls");
6369
- if (styleUrlsExpr !== void 0 && ts24.isArrayLiteralExpression(styleUrlsExpr)) {
6625
+ if (styleUrlsExpr !== void 0 && ts26.isArrayLiteralExpression(styleUrlsExpr)) {
6370
6626
  for (const expression of stringLiteralElements(styleUrlsExpr)) {
6371
6627
  const resource = stringLiteralUrlToResource(resourceLoader, expression, containingFile);
6372
6628
  if (resource !== null) {
6373
6629
  styles.add(resource);
6374
6630
  }
6375
6631
  }
6376
- } else if (styleUrlExpr !== void 0 && ts24.isStringLiteralLike(styleUrlExpr)) {
6632
+ } else if (styleUrlExpr !== void 0 && ts26.isStringLiteralLike(styleUrlExpr)) {
6377
6633
  const resource = stringLiteralUrlToResource(resourceLoader, styleUrlExpr, containingFile);
6378
6634
  if (resource !== null) {
6379
6635
  styles.add(resource);
@@ -6381,11 +6637,11 @@ function extractStyleResources(resourceLoader, component, containingFile) {
6381
6637
  }
6382
6638
  const stylesExpr = component.get("styles");
6383
6639
  if (stylesExpr !== void 0) {
6384
- if (ts24.isArrayLiteralExpression(stylesExpr)) {
6640
+ if (ts26.isArrayLiteralExpression(stylesExpr)) {
6385
6641
  for (const expression of stringLiteralElements(stylesExpr)) {
6386
6642
  styles.add({ path: null, expression });
6387
6643
  }
6388
- } else if (ts24.isStringLiteralLike(stylesExpr)) {
6644
+ } else if (ts26.isStringLiteralLike(stylesExpr)) {
6389
6645
  styles.add({ path: null, expression: stylesExpr });
6390
6646
  }
6391
6647
  }
@@ -6524,7 +6780,7 @@ var EMPTY_ARRAY2 = [];
6524
6780
  var isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
6525
6781
  var isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
6526
6782
  var ComponentDecoratorHandler = class {
6527
- constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax) {
6783
+ constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, useTemplatePipeline, localCompilationExtraImportsTracker) {
6528
6784
  this.reflector = reflector;
6529
6785
  this.evaluator = evaluator;
6530
6786
  this.metaRegistry = metaRegistry;
@@ -6559,6 +6815,8 @@ var ComponentDecoratorHandler = class {
6559
6815
  this.deferredSymbolTracker = deferredSymbolTracker;
6560
6816
  this.forbidOrphanRendering = forbidOrphanRendering;
6561
6817
  this.enableBlockSyntax = enableBlockSyntax;
6818
+ this.useTemplatePipeline = useTemplatePipeline;
6819
+ this.localCompilationExtraImportsTracker = localCompilationExtraImportsTracker;
6562
6820
  this.literalCache = /* @__PURE__ */ new Map();
6563
6821
  this.elementSchemaRegistry = new DomElementSchemaRegistry();
6564
6822
  this.preanalyzeTemplateCache = /* @__PURE__ */ new Map();
@@ -6635,7 +6893,7 @@ var ComponentDecoratorHandler = class {
6635
6893
  this.literalCache.delete(decorator);
6636
6894
  let diagnostics;
6637
6895
  let isPoisoned = false;
6638
- const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName());
6896
+ const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName(), this.useTemplatePipeline);
6639
6897
  if (directiveResult === void 0) {
6640
6898
  return {};
6641
6899
  }
@@ -6828,7 +7086,8 @@ var ComponentDecoratorHandler = class {
6828
7086
  viewProviders: wrappedViewProviders,
6829
7087
  i18nUseExternalIds: this.i18nUseExternalIds,
6830
7088
  relativeContextFilePath,
6831
- rawImports: rawImports !== null ? new WrappedNodeExpr8(rawImports) : void 0
7089
+ rawImports: rawImports !== null ? new WrappedNodeExpr8(rawImports) : void 0,
7090
+ useTemplatePipeline: this.useTemplatePipeline
6832
7091
  },
6833
7092
  typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
6834
7093
  classMetadata: this.includeClassMetadata ? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template)) : null,
@@ -6867,9 +7126,6 @@ var ComponentDecoratorHandler = class {
6867
7126
  }
6868
7127
  register(node, analysis) {
6869
7128
  var _a;
6870
- if (this.compilationMode === CompilationMode.LOCAL) {
6871
- return;
6872
- }
6873
7129
  const ref = new Reference(node);
6874
7130
  this.metaRegistry.registerDirectiveMetadata({
6875
7131
  kind: MetaKind.Directive,
@@ -6937,7 +7193,7 @@ var ComponentDecoratorHandler = class {
6937
7193
  }
6938
7194
  typeCheck(ctx, node, meta) {
6939
7195
  var _a;
6940
- if (this.typeCheckScopeRegistry === null || !ts25.isClassDeclaration(node)) {
7196
+ if (this.typeCheckScopeRegistry === null || !ts27.isClassDeclaration(node)) {
6941
7197
  return;
6942
7198
  }
6943
7199
  if (meta.isPoisoned && !this.usePoisonedData) {
@@ -6960,21 +7216,32 @@ var ComponentDecoratorHandler = class {
6960
7216
  const nonRemovableImports = this.deferredSymbolTracker.getNonRemovableDeferredImports(context, node);
6961
7217
  if (nonRemovableImports.length > 0) {
6962
7218
  for (const importDecl of nonRemovableImports) {
6963
- const diagnostic = makeDiagnostic(ErrorCode.DEFERRED_DEPENDENCY_IMPORTED_EAGERLY, importDecl, `This import contains symbols used in the \`@Component.deferredImports\` array of the \`${node.name.getText()}\` component, but also some other symbols that are not in any \`@Component.deferredImports\` array. This renders all these defer imports useless as this import remains and its module is eagerly loaded. To fix this, make sure that this import contains *only* symbols that are used within \`@Component.deferredImports\` arrays.`);
7219
+ const diagnostic = makeDiagnostic(ErrorCode.DEFERRED_DEPENDENCY_IMPORTED_EAGERLY, importDecl, `This import contains symbols that are used both inside and outside of the \`@Component.deferredImports\` fields in the file. This renders all these defer imports useless as this import remains and its module is eagerly loaded. To fix this, make sure that all symbols from the import are *only* used within \`@Component.deferredImports\` arrays and there are no other references to those symbols present in this file.`);
6964
7220
  diagnostics.push(diagnostic);
6965
7221
  }
6966
7222
  return { diagnostics };
6967
7223
  }
7224
+ let data;
6968
7225
  if (this.compilationMode === CompilationMode.LOCAL) {
6969
- return {
6970
- data: {
6971
- declarationListEmitMode: !analysis.meta.isStandalone || analysis.rawImports !== null ? 3 : 0,
6972
- declarations: EMPTY_ARRAY2,
6973
- deferBlocks: this.locateDeferBlocksWithoutScope(analysis.template),
6974
- deferBlockDepsEmitMode: 1,
6975
- deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
6976
- deferrableTypes: /* @__PURE__ */ new Map()
6977
- }
7226
+ data = {
7227
+ declarations: EMPTY_ARRAY2,
7228
+ declarationListEmitMode: !analysis.meta.isStandalone || analysis.rawImports !== null ? 3 : 0,
7229
+ deferBlocks: this.locateDeferBlocksWithoutScope(analysis.template),
7230
+ deferBlockDepsEmitMode: 1,
7231
+ deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
7232
+ deferrableTypes: /* @__PURE__ */ new Map()
7233
+ };
7234
+ if (this.localCompilationExtraImportsTracker === null) {
7235
+ return { data };
7236
+ }
7237
+ } else {
7238
+ data = {
7239
+ declarations: EMPTY_ARRAY2,
7240
+ declarationListEmitMode: 0,
7241
+ deferBlocks: /* @__PURE__ */ new Map(),
7242
+ deferBlockDepsEmitMode: 0,
7243
+ deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
7244
+ deferrableTypes: /* @__PURE__ */ new Map()
6978
7245
  };
6979
7246
  }
6980
7247
  if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference) {
@@ -6983,14 +7250,6 @@ var ComponentDecoratorHandler = class {
6983
7250
  if (analysis.isPoisoned && !this.usePoisonedData) {
6984
7251
  return {};
6985
7252
  }
6986
- const data = {
6987
- declarations: EMPTY_ARRAY2,
6988
- declarationListEmitMode: 0,
6989
- deferBlocks: /* @__PURE__ */ new Map(),
6990
- deferBlockDepsEmitMode: 0,
6991
- deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
6992
- deferrableTypes: /* @__PURE__ */ new Map()
6993
- };
6994
7253
  const scope = this.scopeReader.getScopeForComponent(node);
6995
7254
  if (scope !== null) {
6996
7255
  const isModuleScope = scope.kind === ComponentScopeKind.NgModule;
@@ -7092,7 +7351,9 @@ var ComponentDecoratorHandler = class {
7092
7351
  symbol.usedPipes = Array.from(declarations.values()).filter(isUsedPipe).map(getSemanticReference);
7093
7352
  }
7094
7353
  const eagerDeclarations = Array.from(declarations.values()).filter((decl) => decl.kind === R3TemplateDependencyKind.NgModule || eagerlyUsed.has(decl.ref.node));
7095
- this.resolveDeferBlocks(node, deferBlocks, declarations, data, analysis, eagerlyUsed, bound);
7354
+ if (this.compilationMode !== CompilationMode.LOCAL) {
7355
+ this.resolveDeferBlocks(node, deferBlocks, declarations, data, analysis, eagerlyUsed, bound);
7356
+ }
7096
7357
  const cyclesFromDirectives = /* @__PURE__ */ new Map();
7097
7358
  const cyclesFromPipes = /* @__PURE__ */ new Map();
7098
7359
  if (!metadata.isStandalone) {
@@ -7117,9 +7378,17 @@ var ComponentDecoratorHandler = class {
7117
7378
  this.maybeRecordSyntheticImport(importedFile, type, context);
7118
7379
  }
7119
7380
  const declarationIsForwardDeclared = eagerDeclarations.some((decl) => isExpressionForwardReference(decl.type, node.name, context));
7120
- const wrapDirectivesAndPipesInClosure = declarationIsForwardDeclared || standaloneImportMayBeForwardDeclared;
7381
+ if (this.compilationMode !== CompilationMode.LOCAL && (declarationIsForwardDeclared || standaloneImportMayBeForwardDeclared)) {
7382
+ data.declarationListEmitMode = 1;
7383
+ }
7121
7384
  data.declarations = eagerDeclarations;
7122
- data.declarationListEmitMode = wrapDirectivesAndPipesInClosure ? 1 : 0;
7385
+ if (this.compilationMode === CompilationMode.LOCAL && this.localCompilationExtraImportsTracker !== null) {
7386
+ for (const { type } of eagerDeclarations) {
7387
+ if (type instanceof ExternalExpr6 && type.value.moduleName) {
7388
+ this.localCompilationExtraImportsTracker.addImportForFile(context, type.value.moduleName);
7389
+ }
7390
+ }
7391
+ }
7123
7392
  } else {
7124
7393
  if (this.cycleHandlingStrategy === 0) {
7125
7394
  this.scopeRegistry.setComponentRemoteScope(node, eagerDeclarations.filter(isUsedDirective).map((dir) => dir.ref), eagerDeclarations.filter(isUsedPipe).map((pipe) => pipe.ref));
@@ -7145,29 +7414,31 @@ var ComponentDecoratorHandler = class {
7145
7414
  } else {
7146
7415
  data.deferBlocks = this.locateDeferBlocksWithoutScope(metadata.template);
7147
7416
  }
7148
- if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
7149
- const importDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader, false);
7150
- diagnostics.push(...importDiagnostics);
7151
- }
7152
- if (analysis.resolvedDeferredImports !== null && analysis.rawDeferredImports !== null) {
7153
- const importDiagnostics = validateStandaloneImports(analysis.resolvedDeferredImports, analysis.rawDeferredImports, this.metaReader, this.scopeReader, true);
7154
- diagnostics.push(...importDiagnostics);
7155
- }
7156
- if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr8) {
7157
- const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
7158
- diagnostics.push(...providerDiagnostics);
7159
- }
7160
- if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof WrappedNodeExpr8) {
7161
- const viewProviderDiagnostics = getProviderDiagnostics(analysis.viewProvidersRequiringFactory, analysis.meta.viewProviders.node, this.injectableRegistry);
7162
- diagnostics.push(...viewProviderDiagnostics);
7163
- }
7164
- const directiveDiagnostics = getDirectiveDiagnostics(node, this.injectableRegistry, this.evaluator, this.reflector, this.scopeRegistry, this.strictCtorDeps, "Component");
7165
- if (directiveDiagnostics !== null) {
7166
- diagnostics.push(...directiveDiagnostics);
7167
- }
7168
- const hostDirectivesDiagnostics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
7169
- if (hostDirectivesDiagnostics !== null) {
7170
- diagnostics.push(...hostDirectivesDiagnostics);
7417
+ if (this.compilationMode !== CompilationMode.LOCAL) {
7418
+ if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
7419
+ const importDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader, false);
7420
+ diagnostics.push(...importDiagnostics);
7421
+ }
7422
+ if (analysis.resolvedDeferredImports !== null && analysis.rawDeferredImports !== null) {
7423
+ const importDiagnostics = validateStandaloneImports(analysis.resolvedDeferredImports, analysis.rawDeferredImports, this.metaReader, this.scopeReader, true);
7424
+ diagnostics.push(...importDiagnostics);
7425
+ }
7426
+ if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr8) {
7427
+ const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
7428
+ diagnostics.push(...providerDiagnostics);
7429
+ }
7430
+ if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof WrappedNodeExpr8) {
7431
+ const viewProviderDiagnostics = getProviderDiagnostics(analysis.viewProvidersRequiringFactory, analysis.meta.viewProviders.node, this.injectableRegistry);
7432
+ diagnostics.push(...viewProviderDiagnostics);
7433
+ }
7434
+ const directiveDiagnostics = getDirectiveDiagnostics(node, this.injectableRegistry, this.evaluator, this.reflector, this.scopeRegistry, this.strictCtorDeps, "Component");
7435
+ if (directiveDiagnostics !== null) {
7436
+ diagnostics.push(...directiveDiagnostics);
7437
+ }
7438
+ const hostDirectivesDiagnostics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
7439
+ if (hostDirectivesDiagnostics !== null) {
7440
+ diagnostics.push(...hostDirectivesDiagnostics);
7441
+ }
7171
7442
  }
7172
7443
  if (diagnostics.length > 0) {
7173
7444
  return { diagnostics };
@@ -7210,10 +7481,12 @@ var ComponentDecoratorHandler = class {
7210
7481
  return [];
7211
7482
  }
7212
7483
  const deferrableTypes = this.collectDeferredSymbols(resolution);
7484
+ const useTemplatePipeline = this.useTemplatePipeline;
7213
7485
  const meta = {
7214
7486
  ...analysis.meta,
7215
7487
  ...resolution,
7216
- deferrableTypes
7488
+ deferrableTypes,
7489
+ useTemplatePipeline
7217
7490
  };
7218
7491
  const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget3.Component));
7219
7492
  removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes);
@@ -7234,7 +7507,12 @@ var ComponentDecoratorHandler = class {
7234
7507
  isInline: analysis.template.declaration.isInline,
7235
7508
  inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new WrappedNodeExpr8(analysis.template.sourceMapping.node) : null
7236
7509
  };
7237
- const meta = { ...analysis.meta, ...resolution };
7510
+ const useTemplatePipeline = this.useTemplatePipeline;
7511
+ const meta = {
7512
+ ...analysis.meta,
7513
+ ...resolution,
7514
+ useTemplatePipeline
7515
+ };
7238
7516
  const fac = compileDeclareFactory(toFactoryMetadata(meta, FactoryTarget3.Component));
7239
7517
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
7240
7518
  const def = compileDeclareComponentFromMetadata(meta, analysis.template, templateInfo);
@@ -7246,10 +7524,12 @@ var ComponentDecoratorHandler = class {
7246
7524
  return [];
7247
7525
  }
7248
7526
  const deferrableTypes = analysis.explicitlyDeferredTypes;
7527
+ const useTemplatePipeline = this.useTemplatePipeline;
7249
7528
  const meta = {
7250
7529
  ...analysis.meta,
7251
7530
  ...resolution,
7252
- deferrableTypes: deferrableTypes != null ? deferrableTypes : /* @__PURE__ */ new Map()
7531
+ deferrableTypes: deferrableTypes != null ? deferrableTypes : /* @__PURE__ */ new Map(),
7532
+ useTemplatePipeline
7253
7533
  };
7254
7534
  if (analysis.explicitlyDeferredTypes !== null) {
7255
7535
  removeDeferrableTypesFromComponentDecorator(analysis, analysis.explicitlyDeferredTypes);
@@ -7294,12 +7574,12 @@ var ComponentDecoratorHandler = class {
7294
7574
  }
7295
7575
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
7296
7576
  const deferredTypes = /* @__PURE__ */ new Map();
7297
- if (!ts25.isArrayLiteralExpression(rawDeferredImports)) {
7577
+ if (!ts27.isArrayLiteralExpression(rawDeferredImports)) {
7298
7578
  return deferredTypes;
7299
7579
  }
7300
7580
  for (const element of rawDeferredImports.elements) {
7301
7581
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
7302
- if (!ts25.isIdentifier(node)) {
7582
+ if (!ts27.isIdentifier(node)) {
7303
7583
  continue;
7304
7584
  }
7305
7585
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -7363,12 +7643,12 @@ var ComponentDecoratorHandler = class {
7363
7643
  }
7364
7644
  }
7365
7645
  registerDeferrableCandidates(componentClassDecl, importsExpr, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
7366
- if (!ts25.isArrayLiteralExpression(importsExpr)) {
7646
+ if (!ts27.isArrayLiteralExpression(importsExpr)) {
7367
7647
  return;
7368
7648
  }
7369
7649
  for (const element of importsExpr.elements) {
7370
7650
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
7371
- if (!ts25.isIdentifier(node)) {
7651
+ if (!ts27.isIdentifier(node)) {
7372
7652
  continue;
7373
7653
  }
7374
7654
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -7481,8 +7761,8 @@ function validateStandaloneImports(importRefs, importExpr, metaReader, scopeRead
7481
7761
  }
7482
7762
 
7483
7763
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
7484
- import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
7485
- import ts26 from "typescript";
7764
+ import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
7765
+ import ts28 from "typescript";
7486
7766
  var InjectableDecoratorHandler = class {
7487
7767
  constructor(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, perf, includeClassMetadata, compilationMode, errorOnDuplicateProv = true) {
7488
7768
  this.reflector = reflector;
@@ -7598,19 +7878,19 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
7598
7878
  name,
7599
7879
  type,
7600
7880
  typeArgumentCount,
7601
- providedIn: createMayBeForwardRefExpression2(new LiteralExpr3(null), 0)
7881
+ providedIn: createMayBeForwardRefExpression3(new LiteralExpr3(null), 0)
7602
7882
  };
7603
7883
  } else if (decorator.args.length === 1) {
7604
7884
  const metaNode = decorator.args[0];
7605
- if (!ts26.isObjectLiteralExpression(metaNode)) {
7885
+ if (!ts28.isObjectLiteralExpression(metaNode)) {
7606
7886
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
7607
7887
  }
7608
7888
  const meta = reflectObjectLiteral(metaNode);
7609
- const providedIn = meta.has("providedIn") ? getProviderExpression(meta.get("providedIn"), reflector) : createMayBeForwardRefExpression2(new LiteralExpr3(null), 0);
7889
+ const providedIn = meta.has("providedIn") ? getProviderExpression(meta.get("providedIn"), reflector) : createMayBeForwardRefExpression3(new LiteralExpr3(null), 0);
7610
7890
  let deps = void 0;
7611
7891
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
7612
7892
  const depsExpr = meta.get("deps");
7613
- if (!ts26.isArrayLiteralExpression(depsExpr)) {
7893
+ if (!ts28.isArrayLiteralExpression(depsExpr)) {
7614
7894
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
7615
7895
  }
7616
7896
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -7634,7 +7914,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
7634
7914
  }
7635
7915
  function getProviderExpression(expression, reflector) {
7636
7916
  const forwardRefValue = tryUnwrapForwardRef(expression, reflector);
7637
- return createMayBeForwardRefExpression2(new WrappedNodeExpr9(forwardRefValue != null ? forwardRefValue : expression), forwardRefValue !== null ? 2 : 0);
7917
+ return createMayBeForwardRefExpression3(new WrappedNodeExpr9(forwardRefValue != null ? forwardRefValue : expression), forwardRefValue !== null ? 2 : 0);
7638
7918
  }
7639
7919
  function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, strictCtorDeps) {
7640
7920
  if (decorator.args === null) {
@@ -7695,12 +7975,12 @@ function getDep(dep, reflector) {
7695
7975
  }
7696
7976
  return true;
7697
7977
  }
7698
- if (ts26.isArrayLiteralExpression(dep)) {
7978
+ if (ts28.isArrayLiteralExpression(dep)) {
7699
7979
  dep.elements.forEach((el) => {
7700
7980
  let isDecorator = false;
7701
- if (ts26.isIdentifier(el)) {
7981
+ if (ts28.isIdentifier(el)) {
7702
7982
  isDecorator = maybeUpdateDecorator(el, reflector);
7703
- } else if (ts26.isNewExpression(el) && ts26.isIdentifier(el.expression)) {
7983
+ } else if (ts28.isNewExpression(el) && ts28.isIdentifier(el.expression)) {
7704
7984
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
7705
7985
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
7706
7986
  }
@@ -7714,7 +7994,7 @@ function getDep(dep, reflector) {
7714
7994
 
7715
7995
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
7716
7996
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
7717
- import ts27 from "typescript";
7997
+ import ts29 from "typescript";
7718
7998
  var PipeSymbol = class extends SemanticSymbol {
7719
7999
  constructor(decl, name) {
7720
8000
  super(decl);
@@ -7731,7 +8011,7 @@ var PipeSymbol = class extends SemanticSymbol {
7731
8011
  }
7732
8012
  };
7733
8013
  var PipeDecoratorHandler = class {
7734
- constructor(reflector, evaluator, metaRegistry, scopeRegistry, injectableRegistry, isCore, perf, includeClassMetadata, compilationMode) {
8014
+ constructor(reflector, evaluator, metaRegistry, scopeRegistry, injectableRegistry, isCore, perf, includeClassMetadata, compilationMode, generateExtraImportsInLocalMode) {
7735
8015
  this.reflector = reflector;
7736
8016
  this.evaluator = evaluator;
7737
8017
  this.metaRegistry = metaRegistry;
@@ -7741,6 +8021,7 @@ var PipeDecoratorHandler = class {
7741
8021
  this.perf = perf;
7742
8022
  this.includeClassMetadata = includeClassMetadata;
7743
8023
  this.compilationMode = compilationMode;
8024
+ this.generateExtraImportsInLocalMode = generateExtraImportsInLocalMode;
7744
8025
  this.precedence = HandlerPrecedence.PRIMARY;
7745
8026
  this.name = "PipeDecoratorHandler";
7746
8027
  }
@@ -7771,7 +8052,7 @@ var PipeDecoratorHandler = class {
7771
8052
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
7772
8053
  }
7773
8054
  const meta = unwrapExpression(decorator.args[0]);
7774
- if (!ts27.isObjectLiteralExpression(meta)) {
8055
+ if (!ts29.isObjectLiteralExpression(meta)) {
7775
8056
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
7776
8057
  }
7777
8058
  const pipe = reflectObjectLiteral(meta);
@@ -7822,9 +8103,6 @@ var PipeDecoratorHandler = class {
7822
8103
  return new PipeSymbol(node, analysis.meta.pipeName);
7823
8104
  }
7824
8105
  register(node, analysis) {
7825
- if (this.compilationMode === CompilationMode.LOCAL) {
7826
- return;
7827
- }
7828
8106
  const ref = new Reference(node);
7829
8107
  this.metaRegistry.registerPipeMetadata({
7830
8108
  kind: MetaKind.Pipe,
@@ -7876,6 +8154,7 @@ export {
7876
8154
  forwardRefResolver,
7877
8155
  MetaKind,
7878
8156
  CompoundMetadataReader,
8157
+ isHostDirectiveMetaForGlobalMode,
7879
8158
  DtsMetadataReader,
7880
8159
  LocalMetadataRegistry,
7881
8160
  CompoundMetadataRegistry,
@@ -7921,4 +8200,4 @@ export {
7921
8200
  * Use of this source code is governed by an MIT-style license that can be
7922
8201
  * found in the LICENSE file at https://angular.io/license
7923
8202
  */
7924
- //# sourceMappingURL=chunk-GKQNBAG5.js.map
8203
+ //# sourceMappingURL=chunk-IWZ4MO7Q.js.map