Skip to main content

Resolver

Struct Resolver 

Source
pub struct Resolver { /* private fields */ }
Expand description

BFS dependency resolver.

Implementations§

Source§

impl Resolver

Source

pub fn new(client: Arc<RegistryClient>) -> Self

Source

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.

Source

pub fn with_stream_capacity( client: Arc<RegistryClient>, capacity: usize, ) -> (Self, Receiver<ResolvedPackage>)

Create a streaming resolver with a bounded resolved-package buffer.

Source

pub fn with_packument_network_concurrency(self, n: Option<usize>) -> Self

Source

pub fn with_packument_cache(self, cache_dir: PathBuf) -> Self

Enable disk-backed packument caching with ETag/Last-Modified revalidation.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_peers_suffix_max_length(self, max_length: usize) -> Self

Configure pnpm’s peersSuffixMaxLength. When the peer suffix on a dep_path would exceed this many bytes, the post-pass replaces it with _<10-char-sha256-hex>. Default 1000 (pnpm’s default).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

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.

Source

pub fn with_supported_architectures(self, value: SupportedArchitectures) -> Self

Override the host platform triple used when filtering optional dependencies. See [platform::SupportedArchitectures].

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_dependency_policy(self, policy: DependencyPolicy) -> Self

Configure dependency resolution policy settings such as packageExtensions, allowedDeprecatedVersions, trustPolicy*, and blockExoticSubdeps.

Source

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.

Source

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

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more