Section 4.4Source:
server/src/analytics/dependency/DependencyAnalyzer.tsDependency Analysis (Downstream)
Discovers the complete transitive downstream dependency closure of a file or symbol by walking outgoing edges forward.
Source:
server/src/analytics/dependency/DependencyAnalyzer.tsDownstream Reachability Semantics
The DependencyAnalyzer is the forward mirror of the ImpactAnalyzer. It answers:"What does this function or file depend on, directly or transitively, to compile and run?"
server/src/analytics/dependency/DependencyAnalyzer.ts
1234567891011121314151617181920212223export class DependencyAnalyzer { constructor(private readonly traversal: GraphTraversal) {} analyze(sourceNodeId: string, options: DependencyAnalysisOptions = {}): DependencyAnalysisResult { const traversalResult = this.traversal.traverse(sourceNodeId, { direction: "outgoing", relationshipKinds: [ "calls", "imports", "extends", "implements", "instantiates", ], maxDepth: options.maxDepth, }); return { sourceNodeId, dependencyNodeIds: traversalResult.nodes, depthByNode: traversalResult.depthByNode, }; } }
Primary Use Cases
- Test Mocking Isolation: Identify all depth 1 dependencies that must be mocked to test a symbol in isolation.
- Bundle Splitting: Evaluate the full closure size pulled into client bundles when importing a given component.