Skip to main content

cabin_workspace/
lib.rs

1//! Local workspace and package-graph loader for Cabin.
2//!
3//! Given a path to a `cabin.toml`, this crate discovers workspace members
4//! (if any), follows local `path = "..."` dependencies, deduplicates by
5//! canonical manifest path, detects duplicate `[package].name` and package
6//! cycles, and returns a topologically-sorted [`PackageGraph`].
7//!
8//! Versioned dependencies are not resolved here. The CLI resolves them,
9//! fetches artifacts, and passes registry package sources back into this
10//! crate through the registry-aware loading entry points. Git sources are
11//! not supported.
12
13// `WorkspaceError` aggregates a wide set of typed leaf errors
14// (manifest parse, registry / patch validation, dependency-edge
15// resolution). Each variant is small on its own; the union
16// crosses clippy's default `result_large_err` threshold with
17// patch and source-replacement variants included. Boxing the enum
18// at every call site would be churny and hide the variant on
19// the happy path; we accept the larger `Result` here instead.
20#![allow(clippy::too_many_lines)]
21
22pub mod discovery;
23pub mod error;
24pub mod graph;
25pub mod loader;
26pub mod patch;
27pub mod selection;
28
29pub use discovery::{DiscoveredManifest, discover_workspace_root};
30pub use error::WorkspaceError;
31pub use graph::{
32    DependencyEdge, PackageGraph, PackageKind, RootSettings, WorkspacePackage,
33    synthetic_root_identity,
34};
35pub use loader::{
36    PatchedPackageSource, PortPackageSource, PortPolicy, RegistryPackageSource, RegistryPolicy,
37    WorkspaceLoadOptions, load_workspace, load_workspace_skip_ports, load_workspace_with_options,
38};
39pub use patch::{
40    ActivePatch, ActivePatchSet, ConfigPatchInput, PatchResolutionError, PatchResolutionInputs,
41    collect_patched_versioned_deps, resolve_active_patches,
42};
43pub use selection::{
44    PackageSelection, ResolvedSelection, SelectionMode,
45    closure_has_versioned_deps_excluding_with_dev,
46    collect_closure_versioned_deps_excluding_with_dev, combine_version_reqs,
47    resolve_package_selection,
48};