@angular/core 17.1.0-rc.0 → 17.1.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 (34) hide show
  1. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  2. package/esm2022/src/defer/interfaces.mjs +3 -2
  3. package/esm2022/src/linker/compiler.mjs +1 -1
  4. package/esm2022/src/metadata/directives.mjs +1 -1
  5. package/esm2022/src/render3/component_ref.mjs +1 -1
  6. package/esm2022/src/render3/index.mjs +2 -3
  7. package/esm2022/src/render3/instructions/all.mjs +3 -2
  8. package/esm2022/src/render3/instructions/queries.mjs +98 -0
  9. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  10. package/esm2022/src/render3/node_manipulation.mjs +2 -5
  11. package/esm2022/src/render3/query.mjs +11 -98
  12. package/esm2022/src/render3/reactivity/effect.mjs +15 -37
  13. package/esm2022/src/render3/util/global_utils.mjs +3 -1
  14. package/esm2022/src/version.mjs +1 -1
  15. package/esm2022/testing/src/component_fixture.mjs +5 -5
  16. package/esm2022/testing/src/logger.mjs +3 -3
  17. package/esm2022/testing/src/test_bed.mjs +7 -6
  18. package/fesm2022/core.mjs +8006 -8028
  19. package/fesm2022/core.mjs.map +1 -1
  20. package/fesm2022/primitives/signals.mjs +1 -1
  21. package/fesm2022/rxjs-interop.mjs +1 -1
  22. package/fesm2022/testing.mjs +10 -9
  23. package/fesm2022/testing.mjs.map +1 -1
  24. package/index.d.ts +9 -36
  25. package/package.json +1 -1
  26. package/primitives/signals/index.d.ts +1 -1
  27. package/rxjs-interop/index.d.ts +1 -1
  28. package/schematics/migrations/block-template-entities/bundle.js +42 -8
  29. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  30. package/schematics/ng-generate/control-flow-migration/bundle.js +42 -8
  31. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  32. package/schematics/ng-generate/standalone-migration/bundle.js +481 -186
  33. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  34. package/testing/index.d.ts +1 -1
@@ -10537,7 +10537,7 @@ function createI18nContexts(job) {
10537
10537
  throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
10538
10538
  }
10539
10539
  if (op.message.id !== currentI18nOp.message.id) {
10540
- const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
10540
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.root, op.message, null);
10541
10541
  unit.create.push(contextOp);
10542
10542
  op.context = contextOp.xref;
10543
10543
  } else {
@@ -23050,7 +23050,7 @@ var TemplateData = class {
23050
23050
  }
23051
23051
  };
23052
23052
  var TemplateDefinitionBuilder = class {
23053
- constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, deferBlocks, elementLocations, _constants = createComponentDefConsts()) {
23053
+ constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, deferBlocks, elementLocations, allDeferrableDepsFn, _constants = createComponentDefConsts()) {
23054
23054
  this.constantPool = constantPool;
23055
23055
  this.level = level;
23056
23056
  this.contextName = contextName;
@@ -23061,6 +23061,7 @@ var TemplateDefinitionBuilder = class {
23061
23061
  this.i18nUseExternalIds = i18nUseExternalIds;
23062
23062
  this.deferBlocks = deferBlocks;
23063
23063
  this.elementLocations = elementLocations;
23064
+ this.allDeferrableDepsFn = allDeferrableDepsFn;
23064
23065
  this._constants = _constants;
23065
23066
  this._dataIndex = 0;
23066
23067
  this._bindingContext = 0;
@@ -23536,7 +23537,7 @@ var TemplateDefinitionBuilder = class {
23536
23537
  }
23537
23538
  const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
23538
23539
  const name = `${contextName}_Template`;
23539
- const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this._constants);
23540
+ const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this.allDeferrableDepsFn, this._constants);
23540
23541
  this._nestedTemplateFns.push(() => {
23541
23542
  const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
23542
23543
  this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
@@ -23708,6 +23709,7 @@ var TemplateDefinitionBuilder = class {
23708
23709
  });
23709
23710
  }
23710
23711
  visitDeferredBlock(deferred) {
23712
+ var _a2;
23711
23713
  const { loading, placeholder, error: error2, triggers, prefetchTriggers } = deferred;
23712
23714
  const metadata = this.deferBlocks.get(deferred);
23713
23715
  if (!metadata) {
@@ -23724,7 +23726,7 @@ var TemplateDefinitionBuilder = class {
23724
23726
  this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
23725
23727
  literal(deferredIndex),
23726
23728
  literal(primaryTemplateIndex),
23727
- this.createDeferredDepsFunction(depsFnName, metadata),
23729
+ (_a2 = this.allDeferrableDepsFn) != null ? _a2 : this.createDeferredDepsFunction(depsFnName, metadata),
23728
23730
  literal(loadingIndex),
23729
23731
  literal(placeholderIndex),
23730
23732
  literal(errorIndex),
@@ -24738,6 +24740,17 @@ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
24738
24740
  const type = createDirectiveType(meta);
24739
24741
  return { expression, type, statements: [] };
24740
24742
  }
24743
+ function createDeferredDepsFunction(constantPool, name, deps) {
24744
+ const dependencyExp = [];
24745
+ for (const [symbolName, importPath] of deps) {
24746
+ const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(symbolName));
24747
+ const importExpr2 = new DynamicImportExpr(importPath).prop("then").callFn([innerFn]);
24748
+ dependencyExp.push(importExpr2);
24749
+ }
24750
+ const depsFnExpr = arrowFn([], literalArr(dependencyExp));
24751
+ constantPool.statements.push(depsFnExpr.toDeclStmt(name, StmtModifier.Final));
24752
+ return variable(name);
24753
+ }
24741
24754
  function compileComponentFromMetadata(meta, constantPool, bindingParser) {
24742
24755
  const definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
24743
24756
  addFeatures(definitionMap, meta);
@@ -24755,8 +24768,13 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
24755
24768
  const templateTypeName = meta.name;
24756
24769
  const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
24757
24770
  if (!USE_TEMPLATE_PIPELINE) {
24771
+ let allDeferrableDepsFn = null;
24772
+ if (meta.deferBlocks.size > 0 && meta.deferrableTypes.size > 0 && meta.deferBlockDepsEmitMode === 1) {
24773
+ const fnName = `${templateTypeName}_DeferFn`;
24774
+ allDeferrableDepsFn = createDeferredDepsFunction(constantPool, fnName, meta.deferrableTypes);
24775
+ }
24758
24776
  const template2 = meta.template;
24759
- const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks, /* @__PURE__ */ new Map());
24777
+ const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks, /* @__PURE__ */ new Map(), allDeferrableDepsFn);
24760
24778
  const templateFunctionExpression = templateBuilder.buildTemplateFunction(template2.nodes, []);
24761
24779
  const ngContentSelectors = templateBuilder.getNgContentSelectors();
24762
24780
  if (ngContentSelectors) {
@@ -25289,7 +25307,7 @@ var R3TargetBinder = class {
25289
25307
  const scopedNodeEntities = extractScopedNodeEntities(scope);
25290
25308
  const { directives, eagerDirectives, bindings, references } = DirectiveBinder.apply(target.template, this.directiveMatcher);
25291
25309
  const { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks } = TemplateBinder.applyWithScope(target.template, scope);
25292
- return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
25310
+ return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks, scope);
25293
25311
  }
25294
25312
  };
25295
25313
  var Scope2 = class {
@@ -25297,6 +25315,7 @@ var Scope2 = class {
25297
25315
  this.parentScope = parentScope;
25298
25316
  this.rootNode = rootNode;
25299
25317
  this.namedEntities = /* @__PURE__ */ new Map();
25318
+ this.elementsInScope = /* @__PURE__ */ new Set();
25300
25319
  this.childScopes = /* @__PURE__ */ new Map();
25301
25320
  this.isDeferred = parentScope !== null && parentScope.isDeferred ? true : rootNode instanceof DeferredBlock;
25302
25321
  }
@@ -25330,6 +25349,7 @@ var Scope2 = class {
25330
25349
  visitElement(element2) {
25331
25350
  element2.references.forEach((node) => this.visitReference(node));
25332
25351
  element2.children.forEach((node) => node.visit(this));
25352
+ this.elementsInScope.add(element2);
25333
25353
  }
25334
25354
  visitTemplate(template2) {
25335
25355
  template2.references.forEach((node) => this.visitReference(node));
@@ -25739,7 +25759,7 @@ var TemplateBinder = class extends RecursiveAstVisitor2 {
25739
25759
  }
25740
25760
  };
25741
25761
  var R3BoundTarget = class {
25742
- constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferredBlocks) {
25762
+ constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferredBlocks, rootScope) {
25743
25763
  this.target = target;
25744
25764
  this.directives = directives;
25745
25765
  this.eagerDirectives = eagerDirectives;
@@ -25752,6 +25772,7 @@ var R3BoundTarget = class {
25752
25772
  this.usedPipes = usedPipes;
25753
25773
  this.eagerPipes = eagerPipes;
25754
25774
  this.deferredBlocks = deferredBlocks;
25775
+ this.rootScope = rootScope;
25755
25776
  }
25756
25777
  getEntitiesInScope(node) {
25757
25778
  var _a2;
@@ -25831,6 +25852,15 @@ var R3BoundTarget = class {
25831
25852
  }
25832
25853
  return null;
25833
25854
  }
25855
+ isDeferred(element2) {
25856
+ for (const deferBlock of this.deferredBlocks) {
25857
+ const scope = this.rootScope.childScopes.get(deferBlock);
25858
+ if (scope && scope.elementsInScope.has(element2)) {
25859
+ return true;
25860
+ }
25861
+ }
25862
+ return false;
25863
+ }
25834
25864
  findEntityInScope(rootNode, name) {
25835
25865
  const entities = this.getEntitiesInScope(rootNode);
25836
25866
  for (const entitity of entities) {
@@ -26008,7 +26038,9 @@ var CompilerFacadeImpl = class {
26008
26038
  declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
26009
26039
  declarationListEmitMode: 0,
26010
26040
  deferBlocks,
26041
+ deferrableTypes: /* @__PURE__ */ new Map(),
26011
26042
  deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
26043
+ deferBlockDepsEmitMode: 0,
26012
26044
  styles: [...facade.styles, ...template2.styles],
26013
26045
  encapsulation: facade.encapsulation,
26014
26046
  interpolation,
@@ -26215,7 +26247,9 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
26215
26247
  viewProviders: decl.viewProviders !== void 0 ? new WrappedNodeExpr(decl.viewProviders) : null,
26216
26248
  animations: decl.animations !== void 0 ? new WrappedNodeExpr(decl.animations) : null,
26217
26249
  deferBlocks,
26250
+ deferrableTypes: /* @__PURE__ */ new Map(),
26218
26251
  deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
26252
+ deferBlockDepsEmitMode: 0,
26219
26253
  changeDetection: (_c2 = decl.changeDetection) != null ? _c2 : ChangeDetectionStrategy.Default,
26220
26254
  encapsulation: (_d2 = decl.encapsulation) != null ? _d2 : ViewEncapsulation.Emulated,
26221
26255
  interpolation,
@@ -26455,7 +26489,7 @@ function publishFacade(global) {
26455
26489
  }
26456
26490
 
26457
26491
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
26458
- var VERSION2 = new Version("17.1.0-rc.0");
26492
+ var VERSION2 = new Version("17.1.1");
26459
26493
 
26460
26494
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
26461
26495
  var _I18N_ATTR = "i18n";
@@ -27468,7 +27502,7 @@ function compileClassMetadata(metadata) {
27468
27502
  }
27469
27503
  function compileComponentClassMetadata(metadata, deferrableTypes) {
27470
27504
  var _a2, _b2;
27471
- if (deferrableTypes.size === 0) {
27505
+ if (deferrableTypes === null || deferrableTypes.size === 0) {
27472
27506
  return compileClassMetadata(metadata);
27473
27507
  }
27474
27508
  const dynamicImports = [];
@@ -27521,7 +27555,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
27521
27555
  function compileDeclareClassMetadata(metadata) {
27522
27556
  const definitionMap = new DefinitionMap();
27523
27557
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
27524
- definitionMap.set("version", literal("17.1.0-rc.0"));
27558
+ definitionMap.set("version", literal("17.1.1"));
27525
27559
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27526
27560
  definitionMap.set("type", metadata.type);
27527
27561
  definitionMap.set("decorators", metadata.decorators);
@@ -27590,7 +27624,7 @@ function createDirectiveDefinitionMap(meta) {
27590
27624
  const definitionMap = new DefinitionMap();
27591
27625
  const minVersion = getMinimumVersionForPartialOutput(meta);
27592
27626
  definitionMap.set("minVersion", literal(minVersion));
27593
- definitionMap.set("version", literal("17.1.0-rc.0"));
27627
+ definitionMap.set("version", literal("17.1.1"));
27594
27628
  definitionMap.set("type", meta.type.value);
27595
27629
  if (meta.isStandalone) {
27596
27630
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -27883,7 +27917,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION2 = "12.0.0";
27883
27917
  function compileDeclareFactoryFunction(meta) {
27884
27918
  const definitionMap = new DefinitionMap();
27885
27919
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
27886
- definitionMap.set("version", literal("17.1.0-rc.0"));
27920
+ definitionMap.set("version", literal("17.1.1"));
27887
27921
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27888
27922
  definitionMap.set("type", meta.type.value);
27889
27923
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -27906,7 +27940,7 @@ function compileDeclareInjectableFromMetadata(meta) {
27906
27940
  function createInjectableDefinitionMap(meta) {
27907
27941
  const definitionMap = new DefinitionMap();
27908
27942
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
27909
- definitionMap.set("version", literal("17.1.0-rc.0"));
27943
+ definitionMap.set("version", literal("17.1.1"));
27910
27944
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27911
27945
  definitionMap.set("type", meta.type.value);
27912
27946
  if (meta.providedIn !== void 0) {
@@ -27944,7 +27978,7 @@ function compileDeclareInjectorFromMetadata(meta) {
27944
27978
  function createInjectorDefinitionMap(meta) {
27945
27979
  const definitionMap = new DefinitionMap();
27946
27980
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
27947
- definitionMap.set("version", literal("17.1.0-rc.0"));
27981
+ definitionMap.set("version", literal("17.1.1"));
27948
27982
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27949
27983
  definitionMap.set("type", meta.type.value);
27950
27984
  definitionMap.set("providers", meta.providers);
@@ -27968,7 +28002,7 @@ function createNgModuleDefinitionMap(meta) {
27968
28002
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
27969
28003
  }
27970
28004
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
27971
- definitionMap.set("version", literal("17.1.0-rc.0"));
28005
+ definitionMap.set("version", literal("17.1.1"));
27972
28006
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27973
28007
  definitionMap.set("type", meta.type.value);
27974
28008
  if (meta.bootstrap.length > 0) {
@@ -28003,7 +28037,7 @@ function compileDeclarePipeFromMetadata(meta) {
28003
28037
  function createPipeDefinitionMap(meta) {
28004
28038
  const definitionMap = new DefinitionMap();
28005
28039
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
28006
- definitionMap.set("version", literal("17.1.0-rc.0"));
28040
+ definitionMap.set("version", literal("17.1.1"));
28007
28041
  definitionMap.set("ngImport", importExpr(Identifiers.core));
28008
28042
  definitionMap.set("type", meta.type.value);
28009
28043
  if (meta.isStandalone) {
@@ -28020,7 +28054,7 @@ function createPipeDefinitionMap(meta) {
28020
28054
  publishFacade(_global);
28021
28055
 
28022
28056
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
28023
- var VERSION3 = new Version("17.1.0-rc.0");
28057
+ var VERSION3 = new Version("17.1.1");
28024
28058
 
28025
28059
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
28026
28060
  var EmitFlags;
@@ -28181,6 +28215,7 @@ var ErrorCode;
28181
28215
  ErrorCode2[ErrorCode2["HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"] = 2019] = "HOST_DIRECTIVE_MISSING_REQUIRED_BINDING";
28182
28216
  ErrorCode2[ErrorCode2["CONFLICTING_INPUT_TRANSFORM"] = 2020] = "CONFLICTING_INPUT_TRANSFORM";
28183
28217
  ErrorCode2[ErrorCode2["COMPONENT_INVALID_STYLE_URLS"] = 2021] = "COMPONENT_INVALID_STYLE_URLS";
28218
+ ErrorCode2[ErrorCode2["COMPONENT_UNKNOWN_DEFERRED_IMPORT"] = 2022] = "COMPONENT_UNKNOWN_DEFERRED_IMPORT";
28184
28219
  ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
28185
28220
  ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED";
28186
28221
  ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE";
@@ -28212,6 +28247,9 @@ var ErrorCode;
28212
28247
  ErrorCode2[ErrorCode2["ILLEGAL_FOR_LOOP_TRACK_ACCESS"] = 8009] = "ILLEGAL_FOR_LOOP_TRACK_ACCESS";
28213
28248
  ErrorCode2[ErrorCode2["INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT"] = 8010] = "INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT";
28214
28249
  ErrorCode2[ErrorCode2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = 8011] = "CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION";
28250
+ ErrorCode2[ErrorCode2["DEFERRED_PIPE_USED_EAGERLY"] = 8012] = "DEFERRED_PIPE_USED_EAGERLY";
28251
+ ErrorCode2[ErrorCode2["DEFERRED_DIRECTIVE_USED_EAGERLY"] = 8013] = "DEFERRED_DIRECTIVE_USED_EAGERLY";
28252
+ ErrorCode2[ErrorCode2["DEFERRED_DEPENDENCY_IMPORTED_EAGERLY"] = 8014] = "DEFERRED_DEPENDENCY_IMPORTED_EAGERLY";
28215
28253
  ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
28216
28254
  ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
28217
28255
  ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
@@ -29537,9 +29575,11 @@ var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
29537
29575
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/deferred_symbol_tracker.mjs
29538
29576
  var AssumeEager = "AssumeEager";
29539
29577
  var DeferredSymbolTracker = class {
29540
- constructor(typeChecker) {
29578
+ constructor(typeChecker, onlyExplicitDeferDependencyImports) {
29541
29579
  this.typeChecker = typeChecker;
29580
+ this.onlyExplicitDeferDependencyImports = onlyExplicitDeferDependencyImports;
29542
29581
  this.imports = /* @__PURE__ */ new Map();
29582
+ this.explicitlyDeferredImports = /* @__PURE__ */ new Map();
29543
29583
  }
29544
29584
  extractImportedSymbols(importDecl) {
29545
29585
  const symbolMap = /* @__PURE__ */ new Map();
@@ -29567,12 +29607,33 @@ var DeferredSymbolTracker = class {
29567
29607
  }
29568
29608
  return symbolMap;
29569
29609
  }
29570
- markAsDeferrableCandidate(identifier, importDecl) {
29571
- if (!this.imports.has(importDecl)) {
29572
- const symbolMap2 = this.extractImportedSymbols(importDecl);
29573
- this.imports.set(importDecl, symbolMap2);
29610
+ getNonRemovableDeferredImports(sourceFile, classDecl) {
29611
+ var _a2;
29612
+ const affectedImports = [];
29613
+ const importDecls = (_a2 = this.explicitlyDeferredImports.get(classDecl)) != null ? _a2 : [];
29614
+ for (const importDecl of importDecls) {
29615
+ if (importDecl.getSourceFile() === sourceFile && !this.canDefer(importDecl)) {
29616
+ affectedImports.push(importDecl);
29617
+ }
29618
+ }
29619
+ return affectedImports;
29620
+ }
29621
+ markAsDeferrableCandidate(identifier, importDecl, componentClassDecl, isExplicitlyDeferred) {
29622
+ if (this.onlyExplicitDeferDependencyImports && !isExplicitlyDeferred) {
29623
+ return;
29624
+ }
29625
+ if (isExplicitlyDeferred) {
29626
+ if (this.explicitlyDeferredImports.has(componentClassDecl)) {
29627
+ this.explicitlyDeferredImports.get(componentClassDecl).push(importDecl);
29628
+ } else {
29629
+ this.explicitlyDeferredImports.set(componentClassDecl, [importDecl]);
29630
+ }
29631
+ }
29632
+ let symbolMap = this.imports.get(importDecl);
29633
+ if (!symbolMap) {
29634
+ symbolMap = this.extractImportedSymbols(importDecl);
29635
+ this.imports.set(importDecl, symbolMap);
29574
29636
  }
29575
- const symbolMap = this.imports.get(importDecl);
29576
29637
  if (!symbolMap.has(identifier.text)) {
29577
29638
  throw new Error(`The '${identifier.text}' identifier doesn't belong to the provided import declaration.`);
29578
29639
  }
@@ -30461,10 +30522,12 @@ var DtsMetadataReader = class {
30461
30522
  isStandalone,
30462
30523
  isSignal: isSignal2,
30463
30524
  imports: null,
30525
+ deferredImports: null,
30464
30526
  schemas: null,
30465
30527
  decorator: null,
30466
30528
  assumedToExportProviders: isComponent && isStandalone,
30467
- preserveWhitespaces: false
30529
+ preserveWhitespaces: false,
30530
+ isExplicitlyDeferred: false
30468
30531
  });
30469
30532
  }
30470
30533
  getPipeMetadata(ref) {
@@ -30487,7 +30550,8 @@ var DtsMetadataReader = class {
30487
30550
  name,
30488
30551
  nameExpr: null,
30489
30552
  isStandalone,
30490
- decorator: null
30553
+ decorator: null,
30554
+ isExplicitlyDeferred: false
30491
30555
  };
30492
30556
  }
30493
30557
  };
@@ -32781,6 +32845,9 @@ function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
32781
32845
  function makeUnknownComponentImportDiagnostic(ref, rawExpr) {
32782
32846
  return makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, getDiagnosticNode(ref, rawExpr), `Component imports must be standalone components, directives, pipes, or must be NgModules.`);
32783
32847
  }
32848
+ function makeUnknownComponentDeferredImportDiagnostic(ref, rawExpr) {
32849
+ return makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_DEFERRED_IMPORT, getDiagnosticNode(ref, rawExpr), `Component deferred imports must be standalone components, directives or pipes.`);
32850
+ }
32784
32851
 
32785
32852
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
32786
32853
  var LocalModuleScopeRegistry = class {
@@ -33145,24 +33212,30 @@ var TypeCheckScopeRegistry = class {
33145
33212
  isPoisoned: false
33146
33213
  };
33147
33214
  }
33148
- const cacheKey = scope.kind === ComponentScopeKind.NgModule ? scope.ngModule : scope.component;
33149
- const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
33215
+ const isNgModuleScope = scope.kind === ComponentScopeKind.NgModule;
33216
+ const cacheKey = isNgModuleScope ? scope.ngModule : scope.component;
33217
+ const dependencies = isNgModuleScope ? scope.compilation.dependencies : scope.dependencies;
33150
33218
  if (this.scopeCache.has(cacheKey)) {
33151
33219
  return this.scopeCache.get(cacheKey);
33152
33220
  }
33153
- for (const meta of dependencies) {
33221
+ let allDependencies = dependencies;
33222
+ if (!isNgModuleScope && Array.isArray(scope.deferredDependencies) && scope.deferredDependencies.length > 0) {
33223
+ allDependencies = [...allDependencies, ...scope.deferredDependencies];
33224
+ }
33225
+ for (const meta of allDependencies) {
33154
33226
  if (meta.kind === MetaKind.Directive && meta.selector !== null) {
33155
33227
  const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
33156
33228
  if (extMeta === null) {
33157
33229
  continue;
33158
33230
  }
33159
- matcher.addSelectables(CssSelector.parse(meta.selector), [...this.hostDirectivesResolver.resolve(extMeta), extMeta]);
33160
- directives.push(extMeta);
33231
+ const directiveMeta = this.applyExplicitlyDeferredFlag(extMeta, meta.isExplicitlyDeferred);
33232
+ matcher.addSelectables(CssSelector.parse(meta.selector), [...this.hostDirectivesResolver.resolve(directiveMeta), directiveMeta]);
33233
+ directives.push(directiveMeta);
33161
33234
  } else if (meta.kind === MetaKind.Pipe) {
33162
33235
  if (!import_typescript37.default.isClassDeclaration(meta.ref.node)) {
33163
33236
  throw new Error(`Unexpected non-class declaration ${import_typescript37.default.SyntaxKind[meta.ref.node.kind]} for pipe ${meta.ref.debugName}`);
33164
33237
  }
33165
- pipes.set(meta.name, meta.ref);
33238
+ pipes.set(meta.name, meta);
33166
33239
  }
33167
33240
  }
33168
33241
  const typeCheckScope = {
@@ -33187,6 +33260,9 @@ var TypeCheckScopeRegistry = class {
33187
33260
  this.flattenedDirectiveMetaCache.set(clazz, meta);
33188
33261
  return meta;
33189
33262
  }
33263
+ applyExplicitlyDeferredFlag(meta, isExplicitlyDeferred) {
33264
+ return isExplicitlyDeferred === true ? __spreadProps(__spreadValues({}, meta), { isExplicitlyDeferred }) : meta;
33265
+ }
33190
33266
  };
33191
33267
 
33192
33268
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/api.mjs
@@ -33514,16 +33590,13 @@ var TraitCompiler = class {
33514
33590
  }
33515
33591
  }
33516
33592
  const symbol = this.makeSymbolForTrait(trait.handler, clazz, (_a2 = result.analysis) != null ? _a2 : null);
33517
- if (this.compilationMode !== CompilationMode.LOCAL && result.analysis !== void 0 && trait.handler.register !== void 0) {
33593
+ if (result.analysis !== void 0 && trait.handler.register !== void 0) {
33518
33594
  trait.handler.register(clazz, result.analysis);
33519
33595
  }
33520
33596
  trait = trait.toAnalyzed((_b2 = result.analysis) != null ? _b2 : null, (_c2 = result.diagnostics) != null ? _c2 : null, symbol);
33521
33597
  }
33522
33598
  resolve() {
33523
33599
  var _a2, _b2;
33524
- if (this.compilationMode === CompilationMode.LOCAL) {
33525
- return;
33526
- }
33527
33600
  const classes = this.classes.keys();
33528
33601
  for (const clazz of classes) {
33529
33602
  const record = this.classes.get(clazz);
@@ -33570,7 +33643,7 @@ var TraitCompiler = class {
33570
33643
  }
33571
33644
  }
33572
33645
  typeCheck(sf, ctx) {
33573
- if (!this.fileToClasses.has(sf)) {
33646
+ if (!this.fileToClasses.has(sf) || this.compilationMode === CompilationMode.LOCAL) {
33574
33647
  return;
33575
33648
  }
33576
33649
  for (const clazz of this.fileToClasses.get(sf)) {
@@ -33661,15 +33734,12 @@ var TraitCompiler = class {
33661
33734
  let res = [];
33662
33735
  for (const trait of record.traits) {
33663
33736
  let compileRes;
33737
+ if (trait.state !== TraitState.Resolved || containsErrors(trait.analysisDiagnostics) || containsErrors(trait.resolveDiagnostics)) {
33738
+ continue;
33739
+ }
33664
33740
  if (this.compilationMode === CompilationMode.LOCAL) {
33665
- if (trait.state !== TraitState.Analyzed || trait.analysis === null || containsErrors(trait.analysisDiagnostics)) {
33666
- continue;
33667
- }
33668
- compileRes = trait.handler.compileLocal(clazz, trait.analysis, constantPool);
33741
+ compileRes = trait.handler.compileLocal(clazz, trait.analysis, trait.resolution, constantPool);
33669
33742
  } else {
33670
- if (trait.state !== TraitState.Resolved || containsErrors(trait.analysisDiagnostics) || containsErrors(trait.resolveDiagnostics)) {
33671
- continue;
33672
- }
33673
33743
  if (this.compilationMode === CompilationMode.PARTIAL && trait.handler.compilePartial !== void 0) {
33674
33744
  compileRes = trait.handler.compilePartial(clazz, trait.analysis, trait.resolution);
33675
33745
  } else {
@@ -35915,6 +35985,9 @@ var DirectiveDecoratorHandler = class {
35915
35985
  return new DirectiveSymbol(node, analysis.meta.selector, analysis.inputs, analysis.outputs, analysis.meta.exportAs, analysis.typeCheckMeta, typeParameters);
35916
35986
  }
35917
35987
  register(node, analysis) {
35988
+ if (this.compilationMode === CompilationMode.LOCAL) {
35989
+ return;
35990
+ }
35918
35991
  const ref = new Reference2(node);
35919
35992
  this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
35920
35993
  kind: MetaKind.Directive,
@@ -35936,17 +36009,22 @@ var DirectiveDecoratorHandler = class {
35936
36009
  isStandalone: analysis.meta.isStandalone,
35937
36010
  isSignal: analysis.meta.isSignal,
35938
36011
  imports: null,
36012
+ deferredImports: null,
35939
36013
  schemas: null,
35940
36014
  ngContentSelectors: null,
35941
36015
  decorator: analysis.decorator,
35942
36016
  preserveWhitespaces: false,
35943
- assumedToExportProviders: false
36017
+ assumedToExportProviders: false,
36018
+ isExplicitlyDeferred: false
35944
36019
  }));
35945
36020
  this.injectableRegistry.registerInjectable(node, {
35946
36021
  ctorDeps: analysis.meta.deps
35947
36022
  });
35948
36023
  }
35949
36024
  resolve(node, analysis, symbol) {
36025
+ if (this.compilationMode === CompilationMode.LOCAL) {
36026
+ return {};
36027
+ }
35950
36028
  if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference2) {
35951
36029
  symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
35952
36030
  }
@@ -35979,7 +36057,7 @@ var DirectiveDecoratorHandler = class {
35979
36057
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
35980
36058
  return compileResults(fac, def, classMetadata, "\u0275dir", inputTransformFields, null);
35981
36059
  }
35982
- compileLocal(node, analysis, pool) {
36060
+ compileLocal(node, analysis, resolution, pool) {
35983
36061
  const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
35984
36062
  const def = compileDirectiveFromMetadata(analysis.meta, pool, makeBindingParser());
35985
36063
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
@@ -36378,6 +36456,9 @@ var NgModuleDecoratorHandler = class {
36378
36456
  return new NgModuleSymbol(node, analysis.providers !== null);
36379
36457
  }
36380
36458
  register(node, analysis) {
36459
+ if (this.compilationMode === CompilationMode.LOCAL) {
36460
+ return;
36461
+ }
36381
36462
  this.metaRegistry.registerNgModuleMetadata({
36382
36463
  kind: MetaKind.NgModule,
36383
36464
  ref: new Reference2(node),
@@ -36396,6 +36477,9 @@ var NgModuleDecoratorHandler = class {
36396
36477
  });
36397
36478
  }
36398
36479
  resolve(node, analysis) {
36480
+ if (this.compilationMode === CompilationMode.LOCAL) {
36481
+ return {};
36482
+ }
36399
36483
  const scope = this.scopeRegistry.getScopeOfModule(node);
36400
36484
  const diagnostics = [];
36401
36485
  const scopeDiagnostics = this.scopeRegistry.getDiagnosticsOfModule(node);
@@ -37080,10 +37164,11 @@ var animationTriggerResolver = (fn2, node, resolve6, unresolvable) => {
37080
37164
  res.set("name", resolve6(triggerNameExpression));
37081
37165
  return res;
37082
37166
  };
37083
- function validateAndFlattenComponentImports(imports, expr) {
37167
+ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
37084
37168
  const flattened = [];
37169
+ const errorMessage = isDeferred ? `'deferredImports' must be an array of components, directives, or pipes.` : `'imports' must be an array of components, directives, pipes, or NgModules.`;
37085
37170
  if (!Array.isArray(imports)) {
37086
- const error2 = createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic();
37171
+ const error2 = createValueHasWrongTypeError(expr, imports, errorMessage).toDiagnostic();
37087
37172
  return {
37088
37173
  imports: [],
37089
37174
  diagnostics: [error2]
@@ -37092,23 +37177,23 @@ function validateAndFlattenComponentImports(imports, expr) {
37092
37177
  const diagnostics = [];
37093
37178
  for (const ref of imports) {
37094
37179
  if (Array.isArray(ref)) {
37095
- const { imports: childImports, diagnostics: childDiagnostics } = validateAndFlattenComponentImports(ref, expr);
37180
+ const { imports: childImports, diagnostics: childDiagnostics } = validateAndFlattenComponentImports(ref, expr, isDeferred);
37096
37181
  flattened.push(...childImports);
37097
37182
  diagnostics.push(...childDiagnostics);
37098
37183
  } else if (ref instanceof Reference2) {
37099
37184
  if (isNamedClassDeclaration(ref.node)) {
37100
37185
  flattened.push(ref);
37101
37186
  } else {
37102
- diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic());
37187
+ diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, errorMessage).toDiagnostic());
37103
37188
  }
37104
37189
  } else if (isLikelyModuleWithProviders(ref)) {
37105
37190
  let origin = expr;
37106
37191
  if (ref instanceof SyntheticValue) {
37107
37192
  origin = getOriginNodeForDiagnostics(ref.value.mwpCall, expr);
37108
37193
  }
37109
- diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, origin, `'imports' contains a ModuleWithProviders value, likely the result of a 'Module.forRoot()'-style call. These calls are not used to configure components and are not valid in standalone component imports - consider importing them in the application bootstrap instead.`));
37194
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, origin, `Component imports contains a ModuleWithProviders value, likely the result of a 'Module.forRoot()'-style call. These calls are not used to configure components and are not valid in standalone component imports - consider importing them in the application bootstrap instead.`));
37110
37195
  } else {
37111
- diagnostics.push(createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic());
37196
+ diagnostics.push(createValueHasWrongTypeError(expr, imports, errorMessage).toDiagnostic());
37112
37197
  }
37113
37198
  }
37114
37199
  return { imports: flattened, diagnostics };
@@ -37233,7 +37318,7 @@ var ComponentDecoratorHandler = class {
37233
37318
  ]).then(() => void 0);
37234
37319
  }
37235
37320
  analyze(node, decorator) {
37236
- var _a2, _b2, _c2, _d2;
37321
+ var _a2, _b2, _c2, _d2, _e2;
37237
37322
  this.perf.eventCount(PerfEvent.AnalyzeComponent);
37238
37323
  const containingFile = node.getSourceFile().fileName;
37239
37324
  this.literalCache.delete(decorator);
@@ -37280,23 +37365,38 @@ var ComponentDecoratorHandler = class {
37280
37365
  providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
37281
37366
  }
37282
37367
  let resolvedImports = null;
37368
+ let resolvedDeferredImports = null;
37283
37369
  let rawImports = (_b2 = component.get("imports")) != null ? _b2 : null;
37284
- if (rawImports && !metadata.isStandalone) {
37370
+ let rawDeferredImports = (_c2 = component.get("deferredImports")) != null ? _c2 : null;
37371
+ if ((rawImports || rawDeferredImports) && !metadata.isStandalone) {
37285
37372
  if (diagnostics === void 0) {
37286
37373
  diagnostics = [];
37287
37374
  }
37288
- diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
37375
+ const importsField = rawImports ? "imports" : "deferredImports";
37376
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get(importsField), `'${importsField}' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
37289
37377
  isPoisoned = true;
37290
- } else if (this.compilationMode !== CompilationMode.LOCAL && rawImports) {
37291
- const expr = rawImports;
37378
+ } else if (this.compilationMode !== CompilationMode.LOCAL && (rawImports || rawDeferredImports)) {
37292
37379
  const importResolvers = combineResolvers([
37293
37380
  createModuleWithProvidersResolver(this.reflector, this.isCore),
37294
37381
  forwardRefResolver
37295
37382
  ]);
37296
- const imported = this.evaluator.evaluate(expr, importResolvers);
37297
- const { imports: flattened, diagnostics: importDiagnostics } = validateAndFlattenComponentImports(imported, expr);
37298
- resolvedImports = flattened;
37299
- rawImports = expr;
37383
+ const importDiagnostics = [];
37384
+ if (rawImports) {
37385
+ const expr = rawImports;
37386
+ const imported = this.evaluator.evaluate(expr, importResolvers);
37387
+ const { imports: flattened, diagnostics: diagnostics2 } = validateAndFlattenComponentImports(imported, expr, false);
37388
+ importDiagnostics.push(...diagnostics2);
37389
+ resolvedImports = flattened;
37390
+ rawImports = expr;
37391
+ }
37392
+ if (rawDeferredImports) {
37393
+ const expr = rawDeferredImports;
37394
+ const imported = this.evaluator.evaluate(expr, importResolvers);
37395
+ const { imports: flattened, diagnostics: diagnostics2 } = validateAndFlattenComponentImports(imported, expr, true);
37396
+ importDiagnostics.push(...diagnostics2);
37397
+ resolvedDeferredImports = flattened;
37398
+ rawDeferredImports = expr;
37399
+ }
37300
37400
  if (importDiagnostics.length > 0) {
37301
37401
  isPoisoned = true;
37302
37402
  if (diagnostics === void 0) {
@@ -37390,6 +37490,15 @@ var ComponentDecoratorHandler = class {
37390
37490
  if (template2.styles.length > 0) {
37391
37491
  styles.push(...template2.styles);
37392
37492
  }
37493
+ let explicitlyDeferredTypes = null;
37494
+ if (metadata.isStandalone && rawDeferredImports !== null) {
37495
+ const deferredTypes = this.collectExplicitlyDeferredSymbols(rawDeferredImports);
37496
+ for (const [deferredType, importDetails] of deferredTypes) {
37497
+ explicitlyDeferredTypes != null ? explicitlyDeferredTypes : explicitlyDeferredTypes = /* @__PURE__ */ new Map();
37498
+ explicitlyDeferredTypes.set(importDetails.name, importDetails.from);
37499
+ this.deferredSymbolTracker.markAsDeferrableCandidate(deferredType, importDetails.node, node, true);
37500
+ }
37501
+ }
37393
37502
  const output = {
37394
37503
  analysis: {
37395
37504
  baseClass: readBaseClass(node, this.reflector, this.evaluator),
@@ -37401,7 +37510,7 @@ var ComponentDecoratorHandler = class {
37401
37510
  template: template2,
37402
37511
  encapsulation,
37403
37512
  changeDetection,
37404
- interpolation: (_c2 = template2.interpolationConfig) != null ? _c2 : DEFAULT_INTERPOLATION_CONFIG,
37513
+ interpolation: (_d2 = template2.interpolationConfig) != null ? _d2 : DEFAULT_INTERPOLATION_CONFIG,
37405
37514
  styles,
37406
37515
  animations,
37407
37516
  viewProviders: wrappedViewProviders,
@@ -37430,8 +37539,11 @@ var ComponentDecoratorHandler = class {
37430
37539
  animationTriggerNames,
37431
37540
  rawImports,
37432
37541
  resolvedImports,
37542
+ rawDeferredImports,
37543
+ resolvedDeferredImports,
37544
+ explicitlyDeferredTypes,
37433
37545
  schemas,
37434
- decorator: (_d2 = decorator == null ? void 0 : decorator.node) != null ? _d2 : null
37546
+ decorator: (_e2 = decorator == null ? void 0 : decorator.node) != null ? _e2 : null
37435
37547
  },
37436
37548
  diagnostics
37437
37549
  };
@@ -37443,6 +37555,9 @@ var ComponentDecoratorHandler = class {
37443
37555
  }
37444
37556
  register(node, analysis) {
37445
37557
  var _a2;
37558
+ if (this.compilationMode === CompilationMode.LOCAL) {
37559
+ return;
37560
+ }
37446
37561
  const ref = new Reference2(node);
37447
37562
  this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
37448
37563
  kind: MetaKind.Directive,
@@ -37463,12 +37578,14 @@ var ComponentDecoratorHandler = class {
37463
37578
  isStandalone: analysis.meta.isStandalone,
37464
37579
  isSignal: analysis.meta.isSignal,
37465
37580
  imports: analysis.resolvedImports,
37581
+ deferredImports: analysis.resolvedDeferredImports,
37466
37582
  animationTriggerNames: analysis.animationTriggerNames,
37467
37583
  schemas: analysis.schemas,
37468
37584
  decorator: analysis.decorator,
37469
37585
  assumedToExportProviders: false,
37470
37586
  ngContentSelectors: analysis.template.ngContentSelectors,
37471
- preserveWhitespaces: (_a2 = analysis.template.preserveWhitespaces) != null ? _a2 : false
37587
+ preserveWhitespaces: (_a2 = analysis.template.preserveWhitespaces) != null ? _a2 : false,
37588
+ isExplicitlyDeferred: false
37472
37589
  }));
37473
37590
  this.resourceRegistry.registerResources(analysis.resources, node);
37474
37591
  this.injectableRegistry.registerInjectable(node, {
@@ -37525,38 +37642,66 @@ var ComponentDecoratorHandler = class {
37525
37642
  return extendedTemplateChecker.getDiagnosticsForComponent(component);
37526
37643
  }
37527
37644
  resolve(node, analysis, symbol) {
37645
+ const metadata = analysis.meta;
37646
+ const diagnostics = [];
37647
+ const context = getSourceFile(node);
37648
+ const nonRemovableImports = this.deferredSymbolTracker.getNonRemovableDeferredImports(context, node);
37649
+ if (nonRemovableImports.length > 0) {
37650
+ for (const importDecl of nonRemovableImports) {
37651
+ 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.`);
37652
+ diagnostics.push(diagnostic);
37653
+ }
37654
+ return { diagnostics };
37655
+ }
37656
+ if (this.compilationMode === CompilationMode.LOCAL) {
37657
+ return {
37658
+ data: {
37659
+ declarationListEmitMode: !analysis.meta.isStandalone || analysis.rawImports !== null ? 3 : 0,
37660
+ declarations: EMPTY_ARRAY2,
37661
+ deferBlocks: this.locateDeferBlocksWithoutScope(analysis.template),
37662
+ deferBlockDepsEmitMode: 1,
37663
+ deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
37664
+ deferrableTypes: /* @__PURE__ */ new Map()
37665
+ }
37666
+ };
37667
+ }
37528
37668
  if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference2) {
37529
37669
  symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
37530
37670
  }
37531
37671
  if (analysis.isPoisoned && !this.usePoisonedData) {
37532
37672
  return {};
37533
37673
  }
37534
- const context = getSourceFile(node);
37535
- const metadata = analysis.meta;
37536
37674
  const data = {
37537
37675
  declarations: EMPTY_ARRAY2,
37538
37676
  declarationListEmitMode: 0,
37539
37677
  deferBlocks: /* @__PURE__ */ new Map(),
37540
- deferrableDeclToImportDecl: /* @__PURE__ */ new Map()
37678
+ deferBlockDepsEmitMode: 0,
37679
+ deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
37680
+ deferrableTypes: /* @__PURE__ */ new Map()
37541
37681
  };
37542
- const diagnostics = [];
37543
37682
  const scope = this.scopeReader.getScopeForComponent(node);
37544
37683
  if (scope !== null) {
37545
- const matcher = new SelectorMatcher();
37546
- const pipes = /* @__PURE__ */ new Map();
37547
- const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
37548
- for (const dep of dependencies) {
37549
- if (dep.kind === MetaKind.Directive && dep.selector !== null) {
37550
- matcher.addSelectables(CssSelector.parse(dep.selector), [dep]);
37551
- } else if (dep.kind === MetaKind.Pipe) {
37552
- pipes.set(dep.name, dep);
37553
- }
37684
+ const isModuleScope = scope.kind === ComponentScopeKind.NgModule;
37685
+ const dependencies = isModuleScope ? scope.compilation.dependencies : scope.dependencies;
37686
+ const explicitlyDeferredDependencies = getExplicitlyDeferredDeps(scope);
37687
+ if (metadata.isStandalone && analysis.rawDeferredImports !== null && explicitlyDeferredDependencies.length > 0) {
37688
+ const diagnostic = validateNoImportOverlap(dependencies, explicitlyDeferredDependencies, analysis.rawDeferredImports);
37689
+ if (diagnostic !== null) {
37690
+ diagnostics.push(diagnostic);
37691
+ }
37692
+ }
37693
+ const binder = createTargetBinder(dependencies);
37694
+ const pipes = extractPipes(dependencies);
37695
+ let allDependencies = dependencies;
37696
+ let deferBlockBinder = binder;
37697
+ if (explicitlyDeferredDependencies.length > 0) {
37698
+ allDependencies = [...explicitlyDeferredDependencies, ...dependencies];
37699
+ deferBlockBinder = createTargetBinder(allDependencies);
37554
37700
  }
37555
- const binder = new R3TargetBinder(matcher);
37556
37701
  const bound = binder.bind({ template: metadata.template.nodes });
37557
37702
  const deferBlocks = /* @__PURE__ */ new Map();
37558
37703
  for (const deferBlock of bound.getDeferBlocks()) {
37559
- deferBlocks.set(deferBlock, binder.bind({ template: deferBlock.children }));
37704
+ deferBlocks.set(deferBlock, deferBlockBinder.bind({ template: deferBlock.children }));
37560
37705
  }
37561
37706
  const eagerlyUsed = /* @__PURE__ */ new Set();
37562
37707
  for (const dir of bound.getEagerlyUsedDirectives()) {
@@ -37581,7 +37726,7 @@ var ComponentDecoratorHandler = class {
37581
37726
  }
37582
37727
  }
37583
37728
  const declarations = /* @__PURE__ */ new Map();
37584
- for (const dep of dependencies) {
37729
+ for (const dep of allDependencies) {
37585
37730
  if (declarations.has(dep.ref.node)) {
37586
37731
  continue;
37587
37732
  }
@@ -37635,7 +37780,7 @@ var ComponentDecoratorHandler = class {
37635
37780
  symbol.usedPipes = Array.from(declarations.values()).filter(isUsedPipe).map(getSemanticReference);
37636
37781
  }
37637
37782
  const eagerDeclarations = Array.from(declarations.values()).filter((decl) => decl.kind === R3TemplateDependencyKind.NgModule || eagerlyUsed.has(decl.ref.node));
37638
- this.resolveDeferBlocks(deferBlocks, declarations, data, analysis, eagerlyUsed, bound);
37783
+ this.resolveDeferBlocks(node, deferBlocks, declarations, data, analysis, eagerlyUsed, bound);
37639
37784
  const cyclesFromDirectives = /* @__PURE__ */ new Map();
37640
37785
  const cyclesFromPipes = /* @__PURE__ */ new Map();
37641
37786
  if (!metadata.isStandalone) {
@@ -37686,19 +37831,15 @@ var ComponentDecoratorHandler = class {
37686
37831
  }
37687
37832
  }
37688
37833
  } else {
37689
- const directivelessBinder = new R3TargetBinder(new SelectorMatcher());
37690
- const bound = directivelessBinder.bind({ template: metadata.template.nodes });
37691
- const deferredBlocks = bound.getDeferBlocks();
37692
- const triggerElements = /* @__PURE__ */ new Map();
37693
- for (const block of deferredBlocks) {
37694
- this.resolveDeferTriggers(block, block.triggers, bound, triggerElements);
37695
- this.resolveDeferTriggers(block, block.prefetchTriggers, bound, triggerElements);
37696
- data.deferBlocks.set(block, { deps: [], triggerElements });
37697
- }
37834
+ data.deferBlocks = this.locateDeferBlocksWithoutScope(metadata.template);
37698
37835
  }
37699
37836
  if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
37700
- const standaloneDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader);
37701
- diagnostics.push(...standaloneDiagnostics);
37837
+ const importDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader, false);
37838
+ diagnostics.push(...importDiagnostics);
37839
+ }
37840
+ if (analysis.resolvedDeferredImports !== null && analysis.rawDeferredImports !== null) {
37841
+ const importDiagnostics = validateStandaloneImports(analysis.resolvedDeferredImports, analysis.rawDeferredImports, this.metaReader, this.scopeReader, true);
37842
+ diagnostics.push(...importDiagnostics);
37702
37843
  }
37703
37844
  if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr) {
37704
37845
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
@@ -37712,9 +37853,9 @@ var ComponentDecoratorHandler = class {
37712
37853
  if (directiveDiagnostics !== null) {
37713
37854
  diagnostics.push(...directiveDiagnostics);
37714
37855
  }
37715
- const hostDirectivesDiagnotics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
37716
- if (hostDirectivesDiagnotics !== null) {
37717
- diagnostics.push(...hostDirectivesDiagnotics);
37856
+ const hostDirectivesDiagnostics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
37857
+ if (hostDirectivesDiagnostics !== null) {
37858
+ diagnostics.push(...hostDirectivesDiagnostics);
37718
37859
  }
37719
37860
  if (diagnostics.length > 0) {
37720
37861
  return { diagnostics };
@@ -37753,30 +37894,15 @@ var ComponentDecoratorHandler = class {
37753
37894
  analysis.meta.styles = styles.filter((s) => s.trim().length > 0);
37754
37895
  }
37755
37896
  compileFull(node, analysis, resolution, pool) {
37756
- var _a2;
37757
37897
  if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
37758
37898
  return [];
37759
37899
  }
37760
- const deferrableTypes = /* @__PURE__ */ new Map();
37761
- for (const [_, metadata] of resolution.deferBlocks) {
37762
- for (const deferBlockDep of metadata.deps) {
37763
- const dep = deferBlockDep;
37764
- const classDecl = dep.classDeclaration;
37765
- const importDecl = (_a2 = resolution.deferrableDeclToImportDecl.get(classDecl)) != null ? _a2 : null;
37766
- if (importDecl && this.deferredSymbolTracker.canDefer(importDecl)) {
37767
- deferBlockDep.isDeferrable = true;
37768
- deferBlockDep.importPath = importDecl.moduleSpecifier.text;
37769
- deferrableTypes.set(deferBlockDep.symbolName, deferBlockDep.importPath);
37770
- }
37771
- }
37772
- }
37773
- const meta = __spreadValues(__spreadValues({}, analysis.meta), resolution);
37900
+ const deferrableTypes = this.collectDeferredSymbols(resolution);
37901
+ const meta = __spreadProps(__spreadValues(__spreadValues({}, analysis.meta), resolution), {
37902
+ deferrableTypes
37903
+ });
37774
37904
  const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget.Component));
37775
- if (analysis.classMetadata) {
37776
- const deferrableSymbols = new Set(deferrableTypes.keys());
37777
- const rewrittenDecoratorsNode = removeIdentifierReferences(analysis.classMetadata.decorators.node, deferrableSymbols);
37778
- analysis.classMetadata.decorators = new WrappedNodeExpr(rewrittenDecoratorsNode);
37779
- }
37905
+ removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes);
37780
37906
  const def = compileComponentFromMetadata(meta, pool, makeBindingParser());
37781
37907
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
37782
37908
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, deferrableTypes).toStmt() : null;
@@ -37801,22 +37927,71 @@ var ComponentDecoratorHandler = class {
37801
37927
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
37802
37928
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, null);
37803
37929
  }
37804
- compileLocal(node, analysis, pool) {
37930
+ compileLocal(node, analysis, resolution, pool) {
37805
37931
  if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
37806
37932
  return [];
37807
37933
  }
37808
- const meta = __spreadProps(__spreadValues({}, analysis.meta), {
37809
- declarationListEmitMode: !analysis.meta.isStandalone || analysis.rawImports !== null ? 3 : 0,
37810
- declarations: EMPTY_ARRAY2,
37811
- deferBlocks: /* @__PURE__ */ new Map(),
37812
- deferrableDeclToImportDecl: /* @__PURE__ */ new Map()
37934
+ const deferrableTypes = analysis.explicitlyDeferredTypes;
37935
+ const meta = __spreadProps(__spreadValues(__spreadValues({}, analysis.meta), resolution), {
37936
+ deferrableTypes: deferrableTypes != null ? deferrableTypes : /* @__PURE__ */ new Map()
37813
37937
  });
37938
+ if (analysis.explicitlyDeferredTypes !== null) {
37939
+ removeDeferrableTypesFromComponentDecorator(analysis, analysis.explicitlyDeferredTypes);
37940
+ }
37814
37941
  const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget.Component));
37815
37942
  const def = compileComponentFromMetadata(meta, pool, makeBindingParser());
37816
37943
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
37817
- const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
37944
+ const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, deferrableTypes).toStmt() : null;
37818
37945
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
37819
- return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, null, debugInfo);
37946
+ const deferrableImports = this.deferredSymbolTracker.getDeferrableImportDecls();
37947
+ return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo);
37948
+ }
37949
+ locateDeferBlocksWithoutScope(template2) {
37950
+ const deferBlocks = /* @__PURE__ */ new Map();
37951
+ const directivelessBinder = new R3TargetBinder(new SelectorMatcher());
37952
+ const bound = directivelessBinder.bind({ template: template2.nodes });
37953
+ const deferredBlocks = bound.getDeferBlocks();
37954
+ const triggerElements = /* @__PURE__ */ new Map();
37955
+ for (const block of deferredBlocks) {
37956
+ this.resolveDeferTriggers(block, block.triggers, bound, triggerElements);
37957
+ this.resolveDeferTriggers(block, block.prefetchTriggers, bound, triggerElements);
37958
+ deferBlocks.set(block, { deps: [], triggerElements });
37959
+ }
37960
+ return deferBlocks;
37961
+ }
37962
+ collectDeferredSymbols(resolution) {
37963
+ var _a2;
37964
+ const deferrableTypes = /* @__PURE__ */ new Map();
37965
+ for (const [_, metadata] of resolution.deferBlocks) {
37966
+ for (const deferBlockDep of metadata.deps) {
37967
+ const dep = deferBlockDep;
37968
+ const classDecl = dep.classDeclaration;
37969
+ const importDecl = (_a2 = resolution.deferrableDeclToImportDecl.get(classDecl)) != null ? _a2 : null;
37970
+ if (importDecl !== null && this.deferredSymbolTracker.canDefer(importDecl)) {
37971
+ deferBlockDep.isDeferrable = true;
37972
+ deferBlockDep.importPath = importDecl.moduleSpecifier.text;
37973
+ deferrableTypes.set(deferBlockDep.symbolName, deferBlockDep.importPath);
37974
+ }
37975
+ }
37976
+ }
37977
+ return deferrableTypes;
37978
+ }
37979
+ collectExplicitlyDeferredSymbols(rawDeferredImports) {
37980
+ const deferredTypes = /* @__PURE__ */ new Map();
37981
+ if (!import_typescript56.default.isArrayLiteralExpression(rawDeferredImports)) {
37982
+ return deferredTypes;
37983
+ }
37984
+ for (const element2 of rawDeferredImports.elements) {
37985
+ const node = tryUnwrapForwardRef(element2, this.reflector) || element2;
37986
+ if (!import_typescript56.default.isIdentifier(node)) {
37987
+ continue;
37988
+ }
37989
+ const imp = this.reflector.getImportOfIdentifier(node);
37990
+ if (imp !== null) {
37991
+ deferredTypes.set(node, imp);
37992
+ }
37993
+ }
37994
+ return deferredTypes;
37820
37995
  }
37821
37996
  _checkForCyclicImport(importedFile, expr, origin) {
37822
37997
  const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
@@ -37832,7 +38007,7 @@ var ComponentDecoratorHandler = class {
37832
38007
  }
37833
38008
  this.cycleAnalyzer.recordSyntheticImport(origin, imported);
37834
38009
  }
37835
- resolveDeferBlocks(deferBlocks, deferrableDecls, resolutionData, analysisData, eagerlyUsedDecls, componentBoundTarget) {
38010
+ resolveDeferBlocks(componentClassDecl, deferBlocks, deferrableDecls, resolutionData, analysisData, eagerlyUsedDecls, componentBoundTarget) {
37836
38011
  const allDeferredDecls = /* @__PURE__ */ new Set();
37837
38012
  for (const [deferBlock, bound] of deferBlocks) {
37838
38013
  const usedDirectives = new Set(bound.getEagerlyUsedDirectives().map((d) => d.ref.node));
@@ -37862,45 +38037,56 @@ var ComponentDecoratorHandler = class {
37862
38037
  this.resolveDeferTriggers(deferBlock, deferBlock.prefetchTriggers, componentBoundTarget, triggerElements);
37863
38038
  resolutionData.deferBlocks.set(deferBlock, { deps, triggerElements });
37864
38039
  }
37865
- if (analysisData.meta.isStandalone && analysisData.rawImports !== null && import_typescript56.default.isArrayLiteralExpression(analysisData.rawImports)) {
37866
- for (const element2 of analysisData.rawImports.elements) {
37867
- const node = tryUnwrapForwardRef(element2, this.reflector) || element2;
37868
- if (!import_typescript56.default.isIdentifier(node)) {
37869
- continue;
37870
- }
37871
- const imp = this.reflector.getImportOfIdentifier(node);
37872
- if (imp === null) {
37873
- continue;
37874
- }
37875
- const decl = this.reflector.getDeclarationOfIdentifier(node);
37876
- if (decl === null) {
37877
- continue;
37878
- }
37879
- if (!isNamedClassDeclaration(decl.node)) {
37880
- continue;
37881
- }
37882
- if (!allDeferredDecls.has(decl.node)) {
37883
- continue;
37884
- }
37885
- if (eagerlyUsedDecls.has(decl.node)) {
37886
- continue;
37887
- }
37888
- const dirMeta = this.metaReader.getDirectiveMetadata(new Reference2(decl.node));
37889
- if (dirMeta !== null && !dirMeta.isStandalone) {
37890
- continue;
37891
- }
37892
- const pipeMeta = this.metaReader.getPipeMetadata(new Reference2(decl.node));
37893
- if (pipeMeta !== null && !pipeMeta.isStandalone) {
37894
- continue;
37895
- }
37896
- if (dirMeta === null && pipeMeta === null) {
37897
- continue;
37898
- }
37899
- resolutionData.deferrableDeclToImportDecl.set(decl.node, imp.node);
37900
- this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node);
38040
+ if (analysisData.meta.isStandalone) {
38041
+ if (analysisData.rawImports !== null) {
38042
+ this.registerDeferrableCandidates(componentClassDecl, analysisData.rawImports, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
38043
+ }
38044
+ if (analysisData.rawDeferredImports !== null) {
38045
+ this.registerDeferrableCandidates(componentClassDecl, analysisData.rawDeferredImports, true, allDeferredDecls, eagerlyUsedDecls, resolutionData);
37901
38046
  }
37902
38047
  }
37903
38048
  }
38049
+ registerDeferrableCandidates(componentClassDecl, importsExpr, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
38050
+ if (!import_typescript56.default.isArrayLiteralExpression(importsExpr)) {
38051
+ return;
38052
+ }
38053
+ for (const element2 of importsExpr.elements) {
38054
+ const node = tryUnwrapForwardRef(element2, this.reflector) || element2;
38055
+ if (!import_typescript56.default.isIdentifier(node)) {
38056
+ continue;
38057
+ }
38058
+ const imp = this.reflector.getImportOfIdentifier(node);
38059
+ if (imp === null) {
38060
+ continue;
38061
+ }
38062
+ const decl = this.reflector.getDeclarationOfIdentifier(node);
38063
+ if (decl === null) {
38064
+ continue;
38065
+ }
38066
+ if (!isNamedClassDeclaration(decl.node)) {
38067
+ continue;
38068
+ }
38069
+ if (!allDeferredDecls.has(decl.node)) {
38070
+ continue;
38071
+ }
38072
+ if (eagerlyUsedDecls.has(decl.node)) {
38073
+ continue;
38074
+ }
38075
+ const dirMeta = this.metaReader.getDirectiveMetadata(new Reference2(decl.node));
38076
+ if (dirMeta !== null && !dirMeta.isStandalone) {
38077
+ continue;
38078
+ }
38079
+ const pipeMeta = this.metaReader.getPipeMetadata(new Reference2(decl.node));
38080
+ if (pipeMeta !== null && !pipeMeta.isStandalone) {
38081
+ continue;
38082
+ }
38083
+ if (dirMeta === null && pipeMeta === null) {
38084
+ continue;
38085
+ }
38086
+ resolutionData.deferrableDeclToImportDecl.set(decl.node, imp.node);
38087
+ this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
38088
+ }
38089
+ }
37904
38090
  resolveDeferTriggers(block, triggers, componentBoundTarget, triggerElements) {
37905
38091
  Object.keys(triggers).forEach((key) => {
37906
38092
  const trigger = triggers[key];
@@ -37908,7 +38094,50 @@ var ComponentDecoratorHandler = class {
37908
38094
  });
37909
38095
  }
37910
38096
  };
37911
- function validateStandaloneImports(importRefs, importExpr2, metaReader, scopeReader) {
38097
+ function createTargetBinder(dependencies) {
38098
+ const matcher = new SelectorMatcher();
38099
+ for (const dep of dependencies) {
38100
+ if (dep.kind === MetaKind.Directive && dep.selector !== null) {
38101
+ matcher.addSelectables(CssSelector.parse(dep.selector), [dep]);
38102
+ }
38103
+ }
38104
+ return new R3TargetBinder(matcher);
38105
+ }
38106
+ function getExplicitlyDeferredDeps(scope) {
38107
+ return scope.kind === ComponentScopeKind.NgModule ? [] : scope.deferredDependencies;
38108
+ }
38109
+ function extractPipes(dependencies) {
38110
+ const pipes = /* @__PURE__ */ new Map();
38111
+ for (const dep of dependencies) {
38112
+ if (dep.kind === MetaKind.Pipe) {
38113
+ pipes.set(dep.name, dep);
38114
+ }
38115
+ }
38116
+ return pipes;
38117
+ }
38118
+ function removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes) {
38119
+ if (analysis.classMetadata) {
38120
+ const deferrableSymbols = new Set(deferrableTypes.keys());
38121
+ const rewrittenDecoratorsNode = removeIdentifierReferences(analysis.classMetadata.decorators.node, deferrableSymbols);
38122
+ analysis.classMetadata.decorators = new WrappedNodeExpr(rewrittenDecoratorsNode);
38123
+ }
38124
+ }
38125
+ function validateNoImportOverlap(eagerDeps, deferredDeps, rawDeferredImports) {
38126
+ let diagnostic = null;
38127
+ const eagerDepsSet = /* @__PURE__ */ new Set();
38128
+ for (const eagerDep of eagerDeps) {
38129
+ eagerDepsSet.add(eagerDep.ref.node);
38130
+ }
38131
+ for (const deferredDep of deferredDeps) {
38132
+ if (eagerDepsSet.has(deferredDep.ref.node)) {
38133
+ const classInfo = deferredDep.ref.debugName ? `The \`${deferredDep.ref.debugName}\`` : "One of the dependencies";
38134
+ diagnostic = makeDiagnostic(ErrorCode.DEFERRED_DEPENDENCY_IMPORTED_EAGERLY, getDiagnosticNode(deferredDep.ref, rawDeferredImports), `\`${classInfo}\` is imported via both \`@Component.imports\` and \`@Component.deferredImports\`. To fix this, make sure that dependencies are imported only once.`);
38135
+ break;
38136
+ }
38137
+ }
38138
+ return diagnostic;
38139
+ }
38140
+ function validateStandaloneImports(importRefs, importExpr2, metaReader, scopeReader, isDeferredImport) {
37912
38141
  const diagnostics = [];
37913
38142
  for (const ref of importRefs) {
37914
38143
  const dirMeta = metaReader.getDirectiveMetadata(ref);
@@ -37926,10 +38155,11 @@ function validateStandaloneImports(importRefs, importExpr2, metaReader, scopeRea
37926
38155
  continue;
37927
38156
  }
37928
38157
  const ngModuleMeta = metaReader.getNgModuleMetadata(ref);
37929
- if (ngModuleMeta !== null) {
38158
+ if (!isDeferredImport && ngModuleMeta !== null) {
37930
38159
  continue;
37931
38160
  }
37932
- diagnostics.push(makeUnknownComponentImportDiagnostic(ref, importExpr2));
38161
+ const error2 = isDeferredImport ? makeUnknownComponentDeferredImportDiagnostic(ref, importExpr2) : makeUnknownComponentImportDiagnostic(ref, importExpr2);
38162
+ diagnostics.push(error2);
37933
38163
  }
37934
38164
  return diagnostics;
37935
38165
  }
@@ -37982,11 +38212,17 @@ var InjectableDecoratorHandler = class {
37982
38212
  return null;
37983
38213
  }
37984
38214
  register(node, analysis) {
38215
+ if (this.compilationMode === CompilationMode.LOCAL) {
38216
+ return;
38217
+ }
37985
38218
  this.injectableRegistry.registerInjectable(node, {
37986
38219
  ctorDeps: analysis.ctorDeps
37987
38220
  });
37988
38221
  }
37989
- resolve(node, analysis, symbol) {
38222
+ resolve(node, analysis) {
38223
+ if (this.compilationMode === CompilationMode.LOCAL) {
38224
+ return {};
38225
+ }
37990
38226
  if (requiresValidCtor(analysis.meta)) {
37991
38227
  const diagnostic = checkInheritanceOfInjectable(node, this.injectableRegistry, this.reflector, this.evaluator, this.strictCtorDeps, "Injectable");
37992
38228
  if (diagnostic !== null) {
@@ -38268,6 +38504,9 @@ var PipeDecoratorHandler = class {
38268
38504
  return new PipeSymbol(node, analysis.meta.pipeName);
38269
38505
  }
38270
38506
  register(node, analysis) {
38507
+ if (this.compilationMode === CompilationMode.LOCAL) {
38508
+ return;
38509
+ }
38271
38510
  const ref = new Reference2(node);
38272
38511
  this.metaRegistry.registerPipeMetadata({
38273
38512
  kind: MetaKind.Pipe,
@@ -38275,13 +38514,17 @@ var PipeDecoratorHandler = class {
38275
38514
  name: analysis.meta.pipeName,
38276
38515
  nameExpr: analysis.pipeNameExpr,
38277
38516
  isStandalone: analysis.meta.isStandalone,
38278
- decorator: analysis.decorator
38517
+ decorator: analysis.decorator,
38518
+ isExplicitlyDeferred: false
38279
38519
  });
38280
38520
  this.injectableRegistry.registerInjectable(node, {
38281
38521
  ctorDeps: analysis.meta.deps
38282
38522
  });
38283
38523
  }
38284
38524
  resolve(node) {
38525
+ if (this.compilationMode === CompilationMode.LOCAL) {
38526
+ return {};
38527
+ }
38285
38528
  const duplicateDeclData = this.scopeRegistry.getDuplicateDeclarations(node);
38286
38529
  if (duplicateDeclData !== null) {
38287
38530
  return {
@@ -40471,6 +40714,7 @@ var StandaloneComponentScopeReader = class {
40471
40714
  return null;
40472
40715
  }
40473
40716
  const dependencies = /* @__PURE__ */ new Set([clazzMeta]);
40717
+ const deferredDependencies = /* @__PURE__ */ new Set();
40474
40718
  const seen = /* @__PURE__ */ new Set([clazz]);
40475
40719
  let isPoisoned = clazzMeta.isPoisoned;
40476
40720
  if (clazzMeta.imports !== null) {
@@ -40516,10 +40760,27 @@ var StandaloneComponentScopeReader = class {
40516
40760
  isPoisoned = true;
40517
40761
  }
40518
40762
  }
40763
+ if (clazzMeta.deferredImports !== null) {
40764
+ for (const ref of clazzMeta.deferredImports) {
40765
+ const dirMeta = this.metaReader.getDirectiveMetadata(ref);
40766
+ if (dirMeta !== null) {
40767
+ deferredDependencies.add(__spreadProps(__spreadValues({}, dirMeta), { ref, isExplicitlyDeferred: true }));
40768
+ isPoisoned = isPoisoned || dirMeta.isPoisoned || !dirMeta.isStandalone;
40769
+ continue;
40770
+ }
40771
+ const pipeMeta = this.metaReader.getPipeMetadata(ref);
40772
+ if (pipeMeta !== null) {
40773
+ deferredDependencies.add(__spreadProps(__spreadValues({}, pipeMeta), { ref, isExplicitlyDeferred: true }));
40774
+ isPoisoned = isPoisoned || !pipeMeta.isStandalone;
40775
+ continue;
40776
+ }
40777
+ }
40778
+ }
40519
40779
  this.cache.set(clazz, {
40520
40780
  kind: ComponentScopeKind.Standalone,
40521
40781
  component: clazz,
40522
40782
  dependencies: Array.from(dependencies),
40783
+ deferredDependencies: Array.from(deferredDependencies),
40523
40784
  isPoisoned,
40524
40785
  schemas: (_a2 = clazzMeta.schemas) != null ? _a2 : []
40525
40786
  });
@@ -41559,6 +41820,30 @@ var OutOfBandDiagnosticRecorderImpl = class {
41559
41820
  this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript87.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
41560
41821
  this.recordedPipes.add(ast);
41561
41822
  }
41823
+ deferredPipeUsedEagerly(templateId, ast) {
41824
+ if (this.recordedPipes.has(ast)) {
41825
+ return;
41826
+ }
41827
+ const mapping = this.resolver.getSourceMapping(templateId);
41828
+ const errorMsg = `Pipe '${ast.name}' was imported via \`@Component.deferredImports\`, but was used outside of a \`@defer\` block in a template. To fix this, either use the '${ast.name}' pipe inside of a \`@defer\` block or import this dependency using the \`@Component.imports\` field.`;
41829
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, ast.nameSpan);
41830
+ if (sourceSpan === null) {
41831
+ throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
41832
+ }
41833
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript87.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
41834
+ this.recordedPipes.add(ast);
41835
+ }
41836
+ deferredComponentUsedEagerly(templateId, element2) {
41837
+ const mapping = this.resolver.getSourceMapping(templateId);
41838
+ const errorMsg = `Element '${element2.name}' contains a component or a directive that was imported via \`@Component.deferredImports\`, but the element itself is located outside of a \`@defer\` block in a template. To fix this, either use the '${element2.name}' element inside of a \`@defer\` block or import referenced component/directive dependency using the \`@Component.imports\` field.`;
41839
+ const { start, end } = element2.startSourceSpan;
41840
+ const absoluteSourceSpan = new AbsoluteSourceSpan(start.offset, end.offset);
41841
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, absoluteSourceSpan);
41842
+ if (sourceSpan === null) {
41843
+ throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element2.name}'.`);
41844
+ }
41845
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript87.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
41846
+ }
41562
41847
  illegalAssignmentToTemplateVar(templateId, assignment, target) {
41563
41848
  var _a2, _b2;
41564
41849
  const mapping = this.resolver.getSourceMapping(templateId);
@@ -43237,6 +43522,13 @@ var _Scope = class {
43237
43522
  this.opQueue.push(new TcbDomSchemaCheckerOp(this.tcb, node, true, claimedInputs));
43238
43523
  }
43239
43524
  return;
43525
+ } else {
43526
+ if (node instanceof Element) {
43527
+ const isDeferred = this.tcb.boundTarget.isDeferred(node);
43528
+ if (!isDeferred && directives.some((dirMeta) => dirMeta.isExplicitlyDeferred)) {
43529
+ this.tcb.oobRecorder.deferredComponentUsedEagerly(this.tcb.id, node);
43530
+ }
43531
+ }
43240
43532
  }
43241
43533
  const dirMap = /* @__PURE__ */ new Map();
43242
43534
  for (const dir of directives) {
@@ -43414,13 +43706,16 @@ var TcbExpressionTranslator = class {
43414
43706
  return import_typescript91.default.factory.createThis();
43415
43707
  } else if (ast instanceof BindingPipe) {
43416
43708
  const expr = this.translate(ast.exp);
43417
- const pipeRef = this.tcb.getPipeByName(ast.name);
43709
+ const pipeMeta = this.tcb.getPipeByName(ast.name);
43418
43710
  let pipe2;
43419
- if (pipeRef === null) {
43711
+ if (pipeMeta === null) {
43420
43712
  this.tcb.oobRecorder.missingPipe(this.tcb.id, ast);
43421
43713
  pipe2 = NULL_AS_ANY;
43714
+ } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
43715
+ this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
43716
+ pipe2 = NULL_AS_ANY;
43422
43717
  } else {
43423
- pipe2 = this.tcb.env.pipeInst(pipeRef);
43718
+ pipe2 = this.tcb.env.pipeInst(pipeMeta.ref);
43424
43719
  }
43425
43720
  const args = ast.args.map((arg) => this.translate(arg));
43426
43721
  let methodAccess = import_typescript91.default.factory.createPropertyAccessExpression(pipe2, "transform");
@@ -43716,7 +44011,7 @@ var TypeCheckContextImpl = class {
43716
44011
  if (!pipes.has(name)) {
43717
44012
  continue;
43718
44013
  }
43719
- usedPipes.push(pipes.get(name));
44014
+ usedPipes.push(pipes.get(name).ref);
43720
44015
  }
43721
44016
  const inliningRequirement = requiresInlineTypeCheckBlock(ref, shimData.file, usedPipes, this.reflector);
43722
44017
  if (this.inlining === InliningMode.Error && inliningRequirement === TcbInliningRequirement.MustInline) {
@@ -45301,7 +45596,7 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
45301
45596
  }
45302
45597
  };
45303
45598
  function isSignal(symbol) {
45304
- return ((symbol == null ? void 0 : symbol.escapedName) === "WritableSignal" || (symbol == null ? void 0 : symbol.escapedName) === "Signal") && symbol.parent.escapedName.includes("@angular/core");
45599
+ return ((symbol == null ? void 0 : symbol.escapedName) === "WritableSignal" || (symbol == null ? void 0 : symbol.escapedName) === "Signal" || (symbol == null ? void 0 : symbol.escapedName) === "InputSignal") && symbol.parent.escapedName.includes("@angular/core");
45305
45600
  }
45306
45601
  function buildDiagnosticForSignal(ctx, node, component) {
45307
45602
  const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
@@ -45787,10 +46082,17 @@ var NgCompiler = class {
45787
46082
  return this.addMessageTextDetails(diagnostics);
45788
46083
  }
45789
46084
  getDiagnosticsForFile(file, optimizeFor) {
45790
- const diagnostics = [];
45791
- diagnostics.push(...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file), ...this.getTemplateDiagnosticsForFile(file, optimizeFor));
45792
- if (this.options.strictTemplates) {
45793
- diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
46085
+ const diagnostics = [...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file)];
46086
+ try {
46087
+ diagnostics.push(...this.getTemplateDiagnosticsForFile(file, optimizeFor));
46088
+ if (this.options.strictTemplates) {
46089
+ diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
46090
+ }
46091
+ } catch (e) {
46092
+ if (e instanceof FatalDiagnosticError) {
46093
+ diagnostics.push(e.toDiagnostic());
46094
+ }
46095
+ throw e;
45794
46096
  }
45795
46097
  return this.addMessageTextDetails(diagnostics);
45796
46098
  }
@@ -46084,14 +46386,7 @@ var NgCompiler = class {
46084
46386
  const compilation = this.ensureAnalyzed();
46085
46387
  const diagnostics = [];
46086
46388
  if (!sf.isDeclarationFile && !this.adapter.isShim(sf)) {
46087
- try {
46088
- diagnostics.push(...compilation.templateTypeChecker.getDiagnosticsForFile(sf, optimizeFor));
46089
- } catch (err) {
46090
- if (!(err instanceof FatalDiagnosticError)) {
46091
- throw err;
46092
- }
46093
- diagnostics.push(err.toDiagnostic());
46094
- }
46389
+ diagnostics.push(...compilation.templateTypeChecker.getDiagnosticsForFile(sf, optimizeFor));
46095
46390
  }
46096
46391
  const program = this.programDriver.getProgram();
46097
46392
  this.incrementalStrategy.setIncrementalState(this.incrementalCompilation.state, program);
@@ -46124,7 +46419,7 @@ var NgCompiler = class {
46124
46419
  return diagnostics;
46125
46420
  }
46126
46421
  makeCompilation() {
46127
- var _a2, _b2, _c2;
46422
+ var _a2, _b2, _c2, _d2;
46128
46423
  const isCore = isAngularCorePackage(this.inputProgram);
46129
46424
  let compilationMode = CompilationMode.FULL;
46130
46425
  if (!isCore) {
@@ -46193,11 +46488,11 @@ var NgCompiler = class {
46193
46488
  }
46194
46489
  const dtsTransforms = new DtsTransformRegistry();
46195
46490
  const resourceRegistry = new ResourceRegistry();
46196
- const deferredSymbolsTracker = new DeferredSymbolTracker(this.inputProgram.getTypeChecker());
46491
+ const deferredSymbolsTracker = new DeferredSymbolTracker(this.inputProgram.getTypeChecker(), (_a2 = this.options.onlyExplicitDeferDependencyImports) != null ? _a2 : false);
46197
46492
  const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
46198
46493
  const strictCtorDeps = this.options.strictInjectionParameters || false;
46199
- const supportJitMode = (_a2 = this.options["supportJitMode"]) != null ? _a2 : true;
46200
- const supportTestBed = (_b2 = this.options["supportTestBed"]) != null ? _b2 : true;
46494
+ const supportJitMode = (_b2 = this.options["supportJitMode"]) != null ? _b2 : true;
46495
+ const supportTestBed = (_c2 = this.options["supportTestBed"]) != null ? _c2 : true;
46201
46496
  if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
46202
46497
  throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
46203
46498
  }
@@ -46212,7 +46507,7 @@ var NgCompiler = class {
46212
46507
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, supportTestBed, compilationMode),
46213
46508
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode),
46214
46509
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
46215
- new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_c2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _c2 : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode)
46510
+ new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_d2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _d2 : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode)
46216
46511
  ];
46217
46512
  const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
46218
46513
  const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {