Skip to main content

render_v3

Function render_v3 

Source
pub fn render_v3(
    root_name: &str,
    root_version: &str,
    direct: &[(String, String)],
    entries: &[LockEntry],
) -> String
Expand description

Render a lockfileVersion-3 package-lock.json for a flat dependency tree: a root "" entry (the project name/version and its direct dependency ranges) plus one node_modules/<name> entry per resolved package. Keys are emitted in npm’s order (name, version, lockfileVersion, requires, packages) thanks to serde_json’s preserve_order.

Scope (documented, intentional): this is an npm-compatible v3 lock for the registry/prod tree that round-trips through Lockfile::parse and installs via crate::install::from_lockfile — it is not a byte-for-byte npm reproduction. The flat set from crate::registry::Registry::resolve_tree carries no dev/optional classification, so no dev/optional flags are emitted, and peerDependencies/bundleDependencies and per-package dependencies back-references are omitted.