Documentation
¶
Index ¶
- func AdjacencyList(g DependencyGraph) (map[string][]string, error)
- func ContainsNode(g DependencyGraph, node string) bool
- func DependenciesOf(g DependencyGraph, node string) ([]string, bool, error)
- type DependencyGraph
- func BuildDependencyGraph(filePaths []string, contentReader vcs.ContentReader) (DependencyGraph, error)
- func BuildDependencyGraphWithResolver(filePaths []string, dependencyResolver DependencyResolver) (DependencyGraph, error)
- func FindPathNodes(graph DependencyGraph, targetFiles []string) DependencyGraph
- func MustDependencyGraph(adjacency map[string][]string) DependencyGraph
- func NewDependencyGraph() DependencyGraph
- func NewDependencyGraphFromAdjacency(adjacency map[string][]string) (DependencyGraph, error)
- type DependencyResolver
- type EdgeMetadata
- type FileCycle
- type FileDependencyGraph
- type FileEdge
- type FileGraphMetadata
- type FileMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjacencyList ¶
func AdjacencyList(g DependencyGraph) (map[string][]string, error)
AdjacencyList returns a plain adjacency list for the given graph.
func ContainsNode ¶
func ContainsNode(g DependencyGraph, node string) bool
ContainsNode reports whether node exists in the graph.
func DependenciesOf ¶
func DependenciesOf(g DependencyGraph, node string) ([]string, bool, error)
DependenciesOf returns outgoing dependencies for a node.
Types ¶
type DependencyGraph ¶
DependencyGraph is the shared graph type used across the codebase.
func BuildDependencyGraph ¶
func BuildDependencyGraph(filePaths []string, contentReader vcs.ContentReader) (DependencyGraph, error)
BuildDependencyGraph analyzes a list of files and builds a dependency graph containing only project imports (excluding package:/dart: imports for Dart, and standard library/external imports for Go). Only dependencies that are in the supplied file list are included in the graph. The contentReader function is used to read file contents (from filesystem, git commit, etc.)
func BuildDependencyGraphWithResolver ¶
func BuildDependencyGraphWithResolver( filePaths []string, dependencyResolver DependencyResolver, ) (DependencyGraph, error)
BuildDependencyGraphWithResolver builds a graph using the provided DependencyResolver implementation.
func FindPathNodes ¶
func FindPathNodes(graph DependencyGraph, targetFiles []string) DependencyGraph
FindPathNodes returns all nodes on any path between specified files. Treats the graph bidirectionally (paths from A to B OR from B to A). A node X is included if it lies on any directed path between any pair of target files. If a file isn't in the graph, it's skipped.
func MustDependencyGraph ¶
func MustDependencyGraph(adjacency map[string][]string) DependencyGraph
MustDependencyGraph builds a graph from adjacency data and panics on errors. Intended for tests.
func NewDependencyGraph ¶
func NewDependencyGraph() DependencyGraph
NewDependencyGraph creates an empty directed dependency graph.
func NewDependencyGraphFromAdjacency ¶
func NewDependencyGraphFromAdjacency(adjacency map[string][]string) (DependencyGraph, error)
NewDependencyGraphFromAdjacency builds a graph from adjacency data.
type DependencyResolver ¶
type DependencyResolver interface {
SupportsFileExtension(ext string) bool
ResolveProjectImports(absPath, filePath, ext string) ([]string, error)
FinalizeGraph(graph DependencyGraph) error
}
DependencyResolver resolves project imports per file and can finalize graph-wide dependencies.
func NewDefaultDependencyResolver ¶
func NewDefaultDependencyResolver(ctx *dependencyGraphContext, contentReader vcs.ContentReader) DependencyResolver
NewDefaultDependencyResolver creates the built-in language-aware dependency resolver.
type EdgeMetadata ¶
type EdgeMetadata struct {
InCycle bool
}
EdgeMetadata holds metadata for a graph edge.
type FileCycle ¶
type FileCycle struct {
Path []string
}
FileCycle describes a representative cycle path for a cyclic SCC.
type FileDependencyGraph ¶
type FileDependencyGraph struct {
Graph DependencyGraph
Meta FileGraphMetadata
}
FileDependencyGraph wraps a dependency graph with file-level metadata.
func NewFileDependencyGraph ¶
func NewFileDependencyGraph(g DependencyGraph, fileStats map[string]vcs.FileStats, contentReader vcs.ContentReader) (FileDependencyGraph, error)
NewFileDependencyGraph creates a file-annotated graph from a dependency graph, optional file stats, and an optional content reader used for richer test detection.
type FileGraphMetadata ¶
type FileGraphMetadata struct {
Files map[string]FileMetadata
Edges map[FileEdge]EdgeMetadata
Cycles []FileCycle
}
FileGraphMetadata contains metadata keyed by file and edge.