Skip to main content

sdivi_graph/
lib.rs

1//! Dependency graph construction for sdivi-rust.
2//!
3//! Builds a `petgraph`-backed directed dependency graph.  Two entry points:
4//! - [`build_dependency_graph`] (feature `pipeline-records`, ON by default) — takes
5//!   [`sdivi_parsing::feature_record::FeatureRecord`] slices from the parsing stage.
6//! - [`build_dependency_graph_from_edges`] (always available) — takes raw node paths
7//!   and `(from, to)` edge pairs for WASM / pure-compute consumers.
8//!
9//! # Quick Start
10//!
11//! ```rust
12//! use sdivi_graph::dependency_graph::build_dependency_graph_from_edges;
13//! use sdivi_graph::metrics::compute_metrics;
14//!
15//! let dg = build_dependency_graph_from_edges(&[], &[]);
16//! let m = compute_metrics(&dg);
17//! assert_eq!(m.node_count, 0);
18//! ```
19
20pub mod dependency_graph;
21pub mod metrics;
22#[cfg(feature = "pipeline-records")]
23pub(crate) mod resolve;
24#[cfg(feature = "pipeline-records")]
25pub(crate) mod resolve_lang;
26#[cfg(feature = "pipeline-records")]
27pub(crate) mod tsconfig;
28
29pub use dependency_graph::{build_dependency_graph_from_edges, DependencyGraph, GraphError};
30pub use metrics::{compute_metrics, GraphMetrics};
31
32#[cfg(feature = "pipeline-records")]
33pub use dependency_graph::{
34    build_dependency_graph, build_dependency_graph_with_go_module,
35    build_dependency_graph_with_tsconfig,
36};
37#[cfg(feature = "pipeline-records")]
38pub use tsconfig::{parse_tsconfig_content, TsConfigPaths};