mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): more accurate types for standalone component imports in deps tracker (#51309)
The standalone components import as passed to the deps tracker will be the raw import, i.e., it is either a Type or a module with providers or a factory of these. So we use the existing type `RawScopeInfoFromDecorator` for these imports instead of the current one to be more realistic. PR Close #51309
This commit is contained in:
parent
8156128863
commit
e7ea016e00
1 changed files with 5 additions and 6 deletions
|
|
@ -11,7 +11,7 @@ import {RuntimeError, RuntimeErrorCode} from '../../errors';
|
|||
import {Type} from '../../interface/type';
|
||||
import {NgModuleType} from '../../metadata/ng_module_def';
|
||||
import {getComponentDef, getNgModuleDef, isStandalone} from '../definition';
|
||||
import {ComponentType, NgModuleScopeInfoFromDecorator} from '../interfaces/definition';
|
||||
import {ComponentType, NgModuleScopeInfoFromDecorator, RawScopeInfoFromDecorator} from '../interfaces/definition';
|
||||
import {isComponent, isDirective, isNgModule, isPipe, verifyStandaloneImport} from '../jit/util';
|
||||
import {maybeUnwrapFn} from '../util/misc_utils';
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ class DepsTracker implements DepsTrackerApi {
|
|||
}
|
||||
|
||||
/** @override */
|
||||
getComponentDependencies(type: ComponentType<any>, rawImports?: (Type<any>|(() => Type<any>))[]):
|
||||
getComponentDependencies(type: ComponentType<any>, rawImports?: RawScopeInfoFromDecorator[]):
|
||||
ComponentDependencies {
|
||||
this.resolveNgModulesDecls();
|
||||
|
||||
|
|
@ -213,9 +213,8 @@ class DepsTracker implements DepsTrackerApi {
|
|||
}
|
||||
|
||||
/** @override */
|
||||
getStandaloneComponentScope(
|
||||
type: ComponentType<any>,
|
||||
rawImports?: (Type<any>|(() => Type<any>))[]): StandaloneComponentScope {
|
||||
getStandaloneComponentScope(type: ComponentType<any>, rawImports?: RawScopeInfoFromDecorator[]):
|
||||
StandaloneComponentScope {
|
||||
if (this.standaloneComponentsScopeCache.has(type)) {
|
||||
return this.standaloneComponentsScopeCache.get(type)!;
|
||||
}
|
||||
|
|
@ -228,7 +227,7 @@ class DepsTracker implements DepsTrackerApi {
|
|||
|
||||
private computeStandaloneComponentScope(
|
||||
type: ComponentType<any>,
|
||||
rawImports?: (Type<any>|(() => Type<any>))[]): StandaloneComponentScope {
|
||||
rawImports?: RawScopeInfoFromDecorator[]): StandaloneComponentScope {
|
||||
const ans: StandaloneComponentScope = {
|
||||
compilation: {
|
||||
// Standalone components are always able to self-reference.
|
||||
|
|
|
|||
Loading…
Reference in a new issue