MCPcopy Index your code
hub / github.com/angular/angular / transitiveScopesFor

Function transitiveScopesFor

packages/core/src/render3/jit/module.ts:553–595  ·  view source on GitHub ↗
(type: Type<T>)

Source from the content-addressed store, hash-verified

551 * (either a NgModule or a standalone component / directive / pipe).
552 */
553export function transitiveScopesFor<T>(type: Type<T>): NgModuleTransitiveScopes {
554 if (isNgModule(type)) {
555 const scope = depsTracker.getNgModuleScope(type);
556 const def = getNgModuleDefOrThrow(type);
557 return {
558 schemas: def.schemas || null,
559 ...scope,
560 };
561 } else if (isStandalone(type)) {
562 const directiveDef = getComponentDef(type) || getDirectiveDef(type);
563 if (directiveDef !== null) {
564 return {
565 schemas: null,
566 compilation: {
567 directives: new Set<any>(),
568 pipes: new Set<any>(),
569 },
570 exported: {
571 directives: new Set<any>([type]),
572 pipes: new Set<any>(),
573 },
574 };
575 }
576
577 const pipeDef = getPipeDef(type);
578 if (pipeDef !== null) {
579 return {
580 schemas: null,
581 compilation: {
582 directives: new Set<any>(),
583 pipes: new Set<any>(),
584 },
585 exported: {
586 directives: new Set<any>(),
587 pipes: new Set<any>([type]),
588 },
589 };
590 }
591 }
592
593 // TODO: change the error message to be more user-facing and take standalone into account
594 throw new Error(`${type.name} does not have a module def (ɵmod property)`);
595}
596
597/**
598 * Compute the pair of transitive scopes (compilation scope and exported scope) for a given module.

Callers 4

compileComponentFunction · 0.90
getScopeOfModuleMethod · 0.85

Calls 7

isNgModuleFunction · 0.90
getNgModuleDefOrThrowFunction · 0.90
isStandaloneFunction · 0.90
getComponentDefFunction · 0.90
getDirectiveDefFunction · 0.90
getPipeDefFunction · 0.90
getNgModuleScopeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…