pub struct Workspace {
pub root: PathBuf,
pub root_package_json: PackageJson,
pub patterns: Vec<String>,
pub members: HashMap<String, WorkspaceMember>,
pub topo_order: Vec<String>,
}Expand description
Represents a discovered workspace (monorepo).
Fields§
§root: PathBufAbsolute path to the workspace root directory.
root_package_json: PackageJsonRoot-level package.json.
patterns: Vec<String>Glob patterns that define workspace members.
members: HashMap<String, WorkspaceMember>Discovered members keyed by package name.
topo_order: Vec<String>Topologically sorted member names (dependencies before dependents).
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn discover(root: &Path) -> Result<Option<Self>>
pub fn discover(root: &Path) -> Result<Option<Self>>
Discover workspace members starting from the given root directory.
Returns Ok(None) if this is a plain (non-workspace) project.
Sourcepub fn all_external_deps(&self) -> HashMap<String, String>
pub fn all_external_deps(&self) -> HashMap<String, String>
Return all external dependencies across all workspace members,
filtering out workspace: and catalog: references.
Deduplicates by keeping the first seen version range for each package.
Sourcepub fn all_external_deps_with_catalog(
&self,
catalog: Option<&CatalogConfig>,
) -> Result<HashMap<String, String>>
pub fn all_external_deps_with_catalog( &self, catalog: Option<&CatalogConfig>, ) -> Result<HashMap<String, String>>
Return all external dependencies for all members, resolving
catalog: references using the provided catalog config.
Sourcepub fn internal_dep_graph(&self) -> HashMap<String, Vec<String>>
pub fn internal_dep_graph(&self) -> HashMap<String, Vec<String>>
Build the internal dependency graph: adjacency list of workspace member name → list of workspace member names it depends on.
Sourcepub fn filter(&self, pattern: &str) -> Result<Vec<String>>
pub fn filter(&self, pattern: &str) -> Result<Vec<String>>
Filter workspace members by a glob pattern matched against their relative path from the root.
Sourcepub fn member_external_deps(
&self,
member_name: &str,
catalog: Option<&CatalogConfig>,
) -> Result<HashMap<String, String>>
pub fn member_external_deps( &self, member_name: &str, catalog: Option<&CatalogConfig>, ) -> Result<HashMap<String, String>>
Return resolved external deps for a single member. Workspace refs are resolved to the member’s version, catalog refs are resolved via the catalog config.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl UnwindSafe for Workspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more