Skip to main content

tfparser_core/graph/
mod.rs

1//! Resource graph: flatten module bodies into their callers, expand
2//! `count` / `for_each`, and emit a [`Workspace`](crate::ir::Workspace).
3//!
4//! Phase 5 lands module expansion (closes M2). Dependency-edge collection
5//! and the secondary Parquet tables (`dependencies.parquet`,
6//! `components.parquet`, `modules.parquet`) are Phase 8 / M5 work — they
7//! consume the same `Workspace`, so the contract pinned here does not need
8//! to change when they arrive.
9//!
10//! Per [15-resource-graph.md].
11//!
12//! ## Public surface
13//!
14//! - [`GraphBuilder`] / [`DefaultGraphBuilder`]: the trait + default impl that flattens module
15//!   bodies into their callers.
16//! - [`ModuleRegistry`]: canonical-path-keyed index of local module bodies; the orchestrator (Phase
17//!   5 pipeline wiring) builds this by evaluating every `DirKind::Module` directory the discoverer
18//!   emitted.
19//! - [`GraphContext`]: per-build context (workspace root, recursion / expansion caps).
20//! - [`GraphError`]: errors emitted by the graph phase. Spec § 7 `UnresolvableModuleSource` /
21//!   `DepthExceeded` are recorded as [`crate::Diagnostic`]s in practice (the builder method
22//!   signature reserves `Err` for fatal IR-construction failures).
23//!
24//! [15-resource-graph.md]: ../../../specs/15-resource-graph.md
25
26mod builder;
27mod edges;
28mod error;
29mod expand;
30mod registry;
31
32pub use builder::{DefaultGraphBuilder, GraphBuilder, GraphContext};
33pub use edges::collect_edges_in_place;
34pub use error::GraphError;
35pub use registry::{ExternalModuleRef, ModuleRegistry};
36
37// `expand::expand_resource` and helpers are crate-private — only `builder`
38// drives them. Tests live next to their implementation.