pub struct Resolver { /* private fields */ }Expand description
BFS dependency resolver.
Implementations§
Source§impl Resolver
impl Resolver
pub fn new(client: Arc<RegistryClient>) -> Self
Sourcepub fn with_stream(
client: Arc<RegistryClient>,
) -> (Self, Receiver<ResolvedPackage>)
pub fn with_stream( client: Arc<RegistryClient>, ) -> (Self, Receiver<ResolvedPackage>)
Create a resolver that streams resolved packages through a channel.
Returns (resolver, receiver). The receiver yields packages as they’re
discovered, allowing tarball fetches to start during resolution.
Sourcepub fn with_stream_capacity(
client: Arc<RegistryClient>,
capacity: usize,
) -> (Self, Receiver<ResolvedPackage>)
pub fn with_stream_capacity( client: Arc<RegistryClient>, capacity: usize, ) -> (Self, Receiver<ResolvedPackage>)
Create a streaming resolver with a bounded resolved-package buffer.
pub fn with_packument_network_concurrency(self, n: Option<usize>) -> Self
Sourcepub fn with_packument_cache(self, cache_dir: PathBuf) -> Self
pub fn with_packument_cache(self, cache_dir: PathBuf) -> Self
Enable disk-backed packument caching with ETag/Last-Modified revalidation.
Sourcepub fn with_packument_full_cache(self, cache_dir: PathBuf) -> Self
pub fn with_packument_full_cache(self, cache_dir: PathBuf) -> Self
Disk cache for full (non-corgi) packuments, used in
ResolutionMode::TimeBased so we can read the time: map.
Sourcepub fn with_resolution_mode(self, mode: ResolutionMode) -> Self
pub fn with_resolution_mode(self, mode: ResolutionMode) -> Self
Set the resolution mode. Defaults to Highest (pnpm’s classic
behavior). TimeBased switches direct deps to lowest-satisfying
and constrains transitives by a publish-date cutoff.
Sourcepub fn with_minimum_release_age(self, mra: Option<MinimumReleaseAge>) -> Self
pub fn with_minimum_release_age(self, mra: Option<MinimumReleaseAge>) -> Self
Configure pnpm v11’s minimumReleaseAge family of settings.
Pass None (or a config with minutes == 0) to disable.
Sourcepub fn with_auto_install_peers(self, auto_install_peers: bool) -> Self
pub fn with_auto_install_peers(self, auto_install_peers: bool) -> Self
Override the default auto-install-peers=true behavior. pnpm reads
this from .npmrc or pnpm-workspace.yaml; aube’s install command
plumbs the resolved value through here before running resolution.
Sourcepub fn with_peers_suffix_max_length(self, max_length: usize) -> Self
pub fn with_peers_suffix_max_length(self, max_length: usize) -> Self
Configure pnpm’s peersSuffixMaxLength. When the peer suffix body
on a dep_path would exceed this many bytes, the post-pass
replaces the whole suffix with a parenthesized short hash
(<short-hash>) (pnpm’s createPeerDepGraphHash). Default 1000
(pnpm’s default).
Sourcepub fn with_dedupe_peer_dependents(self, value: bool) -> Self
pub fn with_dedupe_peer_dependents(self, value: bool) -> Self
Override the default dedupe-peer-dependents=true behavior. When
false, the peer-context pass keeps every distinct ancestor-scope
variant of a package instead of collapsing peer-equivalent ones
into a single dep_path. Plumbed from .npmrc /
pnpm-workspace.yaml via the install command.
Sourcepub fn with_dedupe_peers(self, value: bool) -> Self
pub fn with_dedupe_peers(self, value: bool) -> Self
Override the default dedupe-peers=false behavior. When true,
peer suffixes in the lockfile drop the peer name and emit only
the resolved version — (18.2.0) instead of (react@18.2.0).
Plumbed from .npmrc / pnpm-workspace.yaml via the install
command.
Sourcepub fn with_resolve_peers_from_workspace_root(self, value: bool) -> Self
pub fn with_resolve_peers_from_workspace_root(self, value: bool) -> Self
Override the default resolve-peers-from-workspace-root=true
behavior. When false, peer resolution stops at the importer’s
own scope + BFS-auto-installed transitives instead of consulting
the workspace root’s direct deps as a fallback tier. Plumbed
from .npmrc / pnpm-workspace.yaml via the install command.
Sourcepub fn with_registry_supports_time_field(self, value: bool) -> Self
pub fn with_registry_supports_time_field(self, value: bool) -> Self
Configure pnpm’s registry-supports-time-field. When true,
the resolver keeps using the abbreviated (corgi) packument
path even when time: is needed, saving one full-packument
fetch per distinct package. Safe for registries that embed
time in their abbreviated responses (Verdaccio 5.15.1+, JSR,
most in-house mirrors); leave at the default false for
npmjs.org.
Sourcepub fn with_force_metadata_primer(self, value: bool) -> Self
pub fn with_force_metadata_primer(self, value: bool) -> Self
Force the bundled metadata primer on for npm-compatible mirrors. Normally the primer only seeds npmjs.org cache entries because it was generated from npmjs metadata.
Sourcepub fn with_exclude_links_from_lockfile(self, value: bool) -> Self
pub fn with_exclude_links_from_lockfile(self, value: bool) -> Self
Configure pnpm’s exclude-links-from-lockfile setting. Only
affects lockfile serialization — the resolver still builds the
same graph either way, but the value is stamped into
LockfileGraph::settings so the pnpm writer can filter link:
importer entries on write.
Sourcepub fn with_supported_architectures(self, value: SupportedArchitectures) -> Self
pub fn with_supported_architectures(self, value: SupportedArchitectures) -> Self
Override the host platform triple used when filtering optional
dependencies. See [platform::SupportedArchitectures].
Sourcepub fn with_overrides(self, overrides: BTreeMap<String, String>) -> Self
pub fn with_overrides(self, overrides: BTreeMap<String, String>) -> Self
Provide dependency overrides. The map’s keys are selector
strings — bare name, parent>child, foo@<2, **/foo, or any
combination thereof — and values are version specifiers (or
npm: aliases). Keys are compiled into override_rule
structures; unparseable keys are dropped. Whenever the resolver
encounters a task matching a rule (by name + ancestor chain +
optional version constraints), the requested range is replaced
with the rule’s replacement before any packument fetch or
version pick. Workspace + manifest sources are merged by the
caller.
Sourcepub fn with_catalogs(
self,
catalogs: BTreeMap<String, BTreeMap<String, String>>,
) -> Self
pub fn with_catalogs( self, catalogs: BTreeMap<String, BTreeMap<String, String>>, ) -> Self
Provide workspace catalog ranges. Outer key is the catalog name
(default for the unnamed catalog: field in
pnpm-workspace.yaml); inner key is the package name. The
resolver rewrites catalog: and catalog:<name> task ranges
against this map before the override / npm-alias passes, and
records the picks in the output graph’s catalogs field.
Sourcepub fn with_project_root(self, project_root: PathBuf) -> Self
pub fn with_project_root(self, project_root: PathBuf) -> Self
Set the project root used to resolve file: / link: paths.
file:./vendor/foo resolves against this directory, and a
matching directory / tarball is read to drive resolution of the
local package’s transitive deps.
pub fn with_ignore_scripts(self, ignore_scripts: bool) -> Self
Sourcepub fn with_ignored_optional_dependencies(
self,
ignored: BTreeSet<String>,
) -> Self
pub fn with_ignored_optional_dependencies( self, ignored: BTreeSet<String>, ) -> Self
Names to strip from every optionalDependencies map before
enqueueing (pnpm’s pnpm.ignoredOptionalDependencies). Applied
to both root and transitive optional deps. Empty by default.
Sourcepub fn with_read_package_hook(self, hook: Box<dyn ReadPackageHook>) -> Self
pub fn with_read_package_hook(self, hook: Box<dyn ReadPackageHook>) -> Self
Install a readPackage hook. The resolver calls it once per
version-picked packument before enqueueing transitives; see
ReadPackageHook for what mutations are honored.
Sourcepub fn with_dependency_policy(self, policy: DependencyPolicy) -> Self
pub fn with_dependency_policy(self, policy: DependencyPolicy) -> Self
Configure dependency resolution policy settings such as
packageExtensions, allowedDeprecatedVersions, trustPolicy*,
and blockExoticSubdeps.
Sourcepub fn with_vulnerable_ranges(
self,
ranges: BTreeMap<String, Vec<String>>,
) -> Self
pub fn with_vulnerable_ranges( self, ranges: BTreeMap<String, Vec<String>>, ) -> Self
Prefer non-vulnerable versions for the supplied audit ranges.
Used by audit --fix=update to reuse the normal resolver while
steering only vulnerable packages away from affected versions.
Sourcepub fn with_git_shallow_hosts(self, hosts: Vec<String>) -> Self
pub fn with_git_shallow_hosts(self, hosts: Vec<String>) -> Self
Set the git-shallow-hosts list used when cloning git deps.
When a git URL’s host matches an entry here (exact match,
same as pnpm), aube attempts a shallow fetch by SHA; other
hosts get a plain git fetch origin. An empty list forces
every git dep through the full-fetch path.
Source§impl Resolver
impl Resolver
Sourcepub fn direct_dep_info(
&self,
graph: &LockfileGraph,
) -> HashMap<String, DirectDepInfo>
pub fn direct_dep_info( &self, graph: &LockfileGraph, ) -> HashMap<String, DirectDepInfo>
Snapshot per-direct-dep packument facts so the install summary
printer can render them inline after the resolver — and its
packument cache — is dropped. Keys are DirectDep::dep_path;
importer direct deps don’t carry peer-context suffixes, so the
key matches the LockfileGraph.packages entry 1:1.
Skips deps whose packument wasn’t fetched (frozen-lockfile reuse,
non-registry sources) and deps whose registry didn’t publish a
latest dist-tag. Returns only entries where at least one signal
is set so the caller’s printer can use get(dep_path) as the
“should I render badges?” check.
Source§impl Resolver
impl Resolver
Sourcepub async fn resolve(
&mut self,
manifest: &PackageJson,
existing: Option<&LockfileGraph>,
) -> Result<LockfileGraph, Error>
pub async fn resolve( &mut self, manifest: &PackageJson, existing: Option<&LockfileGraph>, ) -> Result<LockfileGraph, Error>
Resolve all dependencies from a package.json.
Uses batch-parallel BFS: each “wave” drains the queue, identifies uncached package names, fetches their packuments concurrently, then processes the entire batch before starting the next wave.
Sourcepub async fn resolve_workspace(
&mut self,
manifests: &[(String, PackageJson)],
existing: Option<&LockfileGraph>,
workspace_packages: &HashMap<String, String>,
) -> Result<LockfileGraph, Error>
pub async fn resolve_workspace( &mut self, manifests: &[(String, PackageJson)], existing: Option<&LockfileGraph>, workspace_packages: &HashMap<String, String>, ) -> Result<LockfileGraph, Error>
Resolve all dependencies for a workspace (multiple importers).
manifests is a list of (importer_path, PackageJson) — e.g. (“.”, root), (“packages/app”, app).
workspace_packages maps package name → version. Used both for
explicit workspace: protocol resolution and for yarn/npm/bun
style linkage where a bare semver range on a workspace-package
name resolves to the local copy when its version satisfies the
range.
Auto Trait Implementations§
impl !RefUnwindSafe for Resolver
impl !Sync for Resolver
impl !UnwindSafe for Resolver
impl Freeze for Resolver
impl Send for Resolver
impl Unpin for Resolver
impl UnsafeUnpin for Resolver
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more