Skip to main content

LockedPackage

Struct LockedPackage 

Source
pub struct LockedPackage {
Show 25 fields pub name: String, pub version: String, pub integrity: Option<String>, pub dependencies: BTreeMap<String, String>, pub optional_dependencies: BTreeMap<String, String>, pub peer_dependencies: BTreeMap<String, String>, pub peer_dependencies_meta: BTreeMap<String, PeerDepMeta>, pub dep_path: String, pub local_source: Option<LocalSource>, pub os: PlatformList, pub cpu: PlatformList, pub libc: PlatformList, pub bundled_dependencies: Vec<String>, pub tarball_url: Option<String>, pub registry_git_hosted: bool, pub alias_of: Option<String>, pub yarn_checksum: Option<String>, pub engines: BTreeMap<String, String>, pub bin: BTreeMap<String, String>, pub declared_dependencies: BTreeMap<String, String>, pub license: Option<String>, pub funding_url: Option<String>, pub optional: bool, pub transitive_peer_dependencies: Vec<String>, pub extra_meta: BTreeMap<String, Value>,
}
Expand description

A single resolved package in the lockfile.

The dependencies map keys are dep names and values are the dependency’s dep_path tail — i.e. the string that follows <name>@. For a plain package this is just the version ("4.17.21"); for a package with its own peer context it includes the suffix ("18.2.0(prop-types@15.8.1)"). Combining the key with its value reproduces the full dep_path (which is also the key in LockfileGraph.packages).

Fields§

§name: String

Package name (e.g., “lodash”)

§version: String

Exact resolved version (e.g., “4.17.21”)

§integrity: Option<String>

Integrity hash (e.g., “sha512-…”)

§dependencies: BTreeMap<String, String>

Dependencies of this package (name -> dep_path tail, see struct docs)

§optional_dependencies: BTreeMap<String, String>

Optional dependency edges for this package. Active optional edges are also mirrored in dependencies so graph walks and the linker continue to see them; this separate map lets platform filtering prune optional edges without touching regular dependencies.

§peer_dependencies: BTreeMap<String, String>

Peer dependency ranges as declared by the package (from its package.json / packument). These are the constraints; the resolved versions live in dependencies after the peer-context pass runs.

§peer_dependencies_meta: BTreeMap<String, PeerDepMeta>

peerDependenciesMeta entries, keyed by peer name.

§dep_path: String

The dep_path key used in the lockfile. For packages with resolved peer contexts this includes the suffix, e.g. "styled-components@6.1.0(react@18.2.0)".

§local_source: Option<LocalSource>

Set for non-registry packages (those installed via file: or link: specifiers). None for the common case of a package resolved from an npm registry, where integrity is the full record of where the bits came from.

§os: PlatformList

os / cpu / libc arrays from the package’s manifest. Used by the resolver to filter optional deps that can’t run on the current (or user-overridden) platform. Empty arrays mean no constraint.

§cpu: PlatformList§libc: PlatformList§bundled_dependencies: Vec<String>

Names declared in the package’s own bundledDependencies. These ship inside the parent tarball’s node_modules/, so the resolver neither fetches nor recurses into them, and the linker avoids creating sibling symlinks that would shadow the bundled tree. An empty Vec means “no bundled deps”; None is kept as a distinct value only inside the resolver and collapsed to empty here because the lockfile round-trip doesn’t need to preserve the “unset” vs “empty list” distinction.

§tarball_url: Option<String>

Full registry tarball URL for registry-sourced packages. Only populated when LockfileSettings::lockfile_include_tarball_url is active on this graph; otherwise None and the lockfile writer derives the URL at fetch time from the configured registry. local_source-backed packages (file:, link:, git:, remote tarball) already carry their own URL via LocalSource and don’t populate this field.

§registry_git_hosted: bool

pnpm resolution.gitHosted for registry-keyed packages. Remote tarball sources carry the same flag on RemoteTarballSource, but registry entries keep local_source: None, so this field preserves third-party pnpm lockfiles that mark registry-shaped tarballs as hosted git.

§alias_of: Option<String>

For npm-alias deps ("h3-v2": "npm:h3@2.0.1-rc.20"): the real package name on the registry ("h3"). None means the entry is not aliased and name already holds the registry name.

Install semantics when Some(real):

  • name is the alias — that’s the folder under node_modules/, the symlink name for transitive deps, and the key every package that declares this dep refers to.
  • alias_of is the real package name used for tarball URL lookup, store index keying, and packument fetches.
  • version is the real resolved version.

registry_name() returns the right name for registry IO; every call site that talks to the registry or the CAS uses that helper.

§yarn_checksum: Option<String>

Yarn berry’s checksum: field, preserved verbatim when parsing a yarn 2+ lockfile (e.g. "10c0/<blake2b-hex>"). The format is yarn-specific — it uses a yarn-chosen hash family prefixed with the cacheKey that produced it — and doesn’t share a hash algorithm with integrity (sha-512). When re-emitting a yarn berry lockfile we write this field back as-is; packages that didn’t come through a berry parse (e.g. freshly-resolved entries in a new install) leave this None and the writer omits the checksum: field, which berry tolerates at the default checksumBehavior: throw when the cache is fresh.

§engines: BTreeMap<String, String>

engines: from the package’s manifest, round-tripped through the lockfile so pnpm-style writers can emit the same flow-form engines: {node: '>=8'} line pnpm writes. Empty map means “no engines declared” — the writer skips the field entirely.

§bin: BTreeMap<String, String>

bin: map from the package’s manifest, normalized to name → path. An empty map means “no bins declared”.

pnpm-style writers derive hasBin: true from !bin.is_empty() (they don’t preserve the names/paths); bun’s format emits the full map on the package’s meta block. Keeping the map here lets both writers render byte-identical output without an extra tarball-level re-parse.

§declared_dependencies: BTreeMap<String, String>

Dependency ranges as declared in this package’s own package.json — keyed by dep name, values are the raw specifiers ("^4.1.0", "~1.1.4", "workspace:*", …).

Distinct from Self::dependencies, which stores the resolved dep_path tail ("4.3.0"). npm / yarn / bun lockfiles preserve the declared ranges on every nested package entry — rewriting them to the resolved pins is the biggest source of round-trip churn against those formats. This map lets writers emit the declared range when available and fall back to the resolved pin otherwise (e.g. when the source lockfile was pnpm, whose snapshots: only carries pins).

Empty means “unknown” — writers should fall back to pins. Covers production and optional dependencies in one map since a package can’t declare the same name twice across those sections.

§license: Option<String>

Package’s license field, collapsed to the simple string form. Round-tripped so npm’s lockfile keeps its per-entry "license": "MIT" line; pnpm / yarn / bun don’t record licenses and leave this None on parse.

§funding_url: Option<String>

Package’s funding URL, extracted from whatever shape the manifest’s funding: field took (string / object / array). Round-tripped so npm’s lockfile keeps its per-entry "funding": {"url": "…"} block.

§optional: bool

pnpm snapshots: optional: true flag, marking a package reachable only through optional edges (typically platform- specific binaries like @reflink/reflink-darwin-arm64). pnpm uses this on the next install to decide whether the entry should be skipped on a non-matching platform; dropping it on round-trip would let pnpm treat the package as required. Always false outside the pnpm parse/write path.

§transitive_peer_dependencies: Vec<String>

pnpm snapshots: transitivePeerDependencies: list — peer names that bubble up transitively through this package. pnpm reads it during hoisting and as a resolver staleness signal (resolveDependencies.ts’s non-zero-length check); a missing list looks like a graph change and triggers needless re- resolution on the next pnpm install. Empty outside the pnpm parse/write path. Fresh resolves leave this empty too — pnpm recomputes it from the graph during resolvePeers when needed.

§extra_meta: BTreeMap<String, Value>

Per-package-meta extras preserved verbatim from the source lockfile. Captures fields the typed model doesn’t yet cover (deprecated, hasInstallScript, bun’s optionalPeers, and anything a future lockfile bump adds) so a parse/write cycle doesn’t drop them. Each format’s writer re-emits what makes sense there — bun inlines the extras back on the package-entry meta object, pnpm / yarn / npm currently ignore them.

Implementations§

Source§

impl LockedPackage

Source

pub fn registry_name(&self) -> &str

The package name to use for registry / store operations — the real name behind an npm-alias when aliased, otherwise just name. Used at every site that derives a tarball URL, a packument URL, or an aube-store cache key so aliased entries hit the actual package instead of the alias-qualified name.

Source

pub fn spec_key(&self) -> String

Canonical "name@version" key used as a handle in patches, approve-builds prompts, lockfile canonical maps, and display paths. Not the dep-path — that includes peer-context suffixes.

Source

pub fn source_approval_key(&self) -> Option<String>

Exact approval key for non-registry package sources.

Name-wide build approvals are only trustworthy for packages fetched from a registry. Source-backed entries need to be approved by their source identity as pnpm records it in lockfile keys / allowBuilds placeholders.

Source

pub fn peer_dependencies_with_meta_defaults(&self) -> BTreeMap<String, String>

Declared peer ranges with pnpm’s meta-only peers folded in as *.

pnpm records a peerDependencies: { x: '*' } entry for every peerDependenciesMeta key a package ships without an explicit range (debug’s optional supports-color, typescript-eslint’s optional typescript, …). This returns peer_dependencies with those meta-only keys added as * — both what the pnpm writer emits in packages: and the “declared peers” set the transitive-peer pass subtracts resolved deps from. Centralizing the rule keeps the writer and the resolver’s transitive-peer pass from drifting.

Trait Implementations§

Source§

impl Clone for LockedPackage

Source§

fn clone(&self) -> LockedPackage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LockedPackage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LockedPackage

Source§

fn default() -> LockedPackage

Returns the “default value” for a type. Read more

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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