* Traverses the Angular internal tree from the root to discover element and environment injectors.
(roots: HTMLElement[])
| 66 | * Traverses the Angular internal tree from the root to discover element and environment injectors. |
| 67 | */ |
| 68 | function discoverDiGraph(roots: HTMLElement[]): DiGraph { |
| 69 | const rootLViews = roots.map((root) => { |
| 70 | const lContext = getLContext(root); |
| 71 | if (!lContext?.lView) { |
| 72 | throw new Error( |
| 73 | `Could not find an \`LView\` for root \`<${root.tagName.toLowerCase()}>\`, is it an Angular component?`, |
| 74 | ); |
| 75 | } |
| 76 | return lContext.lView; |
| 77 | }); |
| 78 | |
| 79 | return { |
| 80 | elementInjectorRoots: rootLViews.map((rootLView) => walkElementInjectors(rootLView)), |
| 81 | environmentInjectorRoot: collectEnvInjectors(rootLViews), |
| 82 | }; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Traverses all directive-hosting nodes in the `rootLView` hierarchy and builds a tree of |
no test coverage detected
searching dependent graphs…