pub struct Lockfile {
pub version: u64,
pub packages: Vec<LockedPackage>,
}Expand description
A parsed package-lock.json.
Fields§
§version: u64The lockfileVersion (always ≥ 2 here).
packages: Vec<LockedPackage>Every entry of the packages map, sorted by key — so install order, and thus
.bin name-collision resolution, is deterministic. Includes the root "" entry.
Implementations§
Source§impl Lockfile
impl Lockfile
Sourcepub fn parse(s: &str) -> Result<Lockfile, Box<dyn Error>>
pub fn parse(s: &str) -> Result<Lockfile, Box<dyn Error>>
Parse a package-lock.json document (lockfileVersion 2 or 3).
Sourcepub fn installable(&self, host_os: &str, host_arch: &str) -> Vec<&LockedPackage>
pub fn installable(&self, host_os: &str, host_arch: &str) -> Vec<&LockedPackage>
The entries an npm-tarball installer fetches on the given host: real (non-root)
node_modules/… packages that aren’t links and whose os/cpu match. host_os and
host_arch are Rust’s std::env::consts::{OS, ARCH} spellings. Whether each entry’s
resolved is actually an http(s) registry tarball is left to the caller — see
LockedPackage::is_registry_tarball.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lockfile
impl RefUnwindSafe for Lockfile
impl Send for Lockfile
impl Sync for Lockfile
impl Unpin for Lockfile
impl UnsafeUnpin for Lockfile
impl UnwindSafe for Lockfile
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
Mutably borrows from an owned value. Read more