( componentDef: ComponentDef<C>, transitiveScopes: NgModuleTransitiveScopes, )
| 526 | * a given module. |
| 527 | */ |
| 528 | export function patchComponentDefWithScope<C>( |
| 529 | componentDef: ComponentDef<C>, |
| 530 | transitiveScopes: NgModuleTransitiveScopes, |
| 531 | ) { |
| 532 | componentDef.directiveDefs = () => |
| 533 | Array.from(transitiveScopes.compilation.directives) |
| 534 | .map((dir) => |
| 535 | dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir)! : getDirectiveDef(dir)!, |
| 536 | ) |
| 537 | .filter((def) => !!def); |
| 538 | componentDef.pipeDefs = () => |
| 539 | Array.from(transitiveScopes.compilation.pipes).map((pipe) => getPipeDef(pipe)!); |
| 540 | componentDef.schemas = transitiveScopes.schemas; |
| 541 | |
| 542 | // Since we avoid Components/Directives/Pipes recompiling in case there are no overrides, we |
| 543 | // may face a problem where previously compiled defs available to a given Component/Directive |
| 544 | // are cached in TView and may become stale (in case any of these defs gets recompiled). In |
| 545 | // order to avoid this problem, we force fresh TView to be created. |
| 546 | componentDef.tView = null; |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type |
no test coverage detected
searching dependent graphs…