( componentDef: ComponentDef<C>, transitiveScopes: NgModuleTransitiveScopes, )
| 541 | * a given module. |
| 542 | */ |
| 543 | export function patchComponentDefWithScope<C>( |
| 544 | componentDef: ComponentDef<C>, |
| 545 | transitiveScopes: NgModuleTransitiveScopes, |
| 546 | ) { |
| 547 | componentDef.directiveDefs = () => |
| 548 | Array.from(transitiveScopes.compilation.directives) |
| 549 | .map((dir) => |
| 550 | Object.hasOwn(dir, NG_COMP_DEF) ? getComponentDef(dir)! : getDirectiveDef(dir)!, |
| 551 | ) |
| 552 | .filter((def) => !!def); |
| 553 | componentDef.pipeDefs = () => |
| 554 | Array.from(transitiveScopes.compilation.pipes).map((pipe) => getPipeDef(pipe)!); |
| 555 | componentDef.schemas = transitiveScopes.schemas; |
| 556 | |
| 557 | // Since we avoid Components/Directives/Pipes recompiling in case there are no overrides, we |
| 558 | // may face a problem where previously compiled defs available to a given Component/Directive |
| 559 | // are cached in TView and may become stale (in case any of these defs gets recompiled). In |
| 560 | // order to avoid this problem, we force fresh TView to be created. |
| 561 | componentDef.tView = null; |
| 562 | } |
| 563 | |
| 564 | /** |
| 565 | * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type |
no test coverage detected