Expand description
Pure-Rust npm manifest + lockfile schemas, modeled on the npm specs:
- https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json
- https://docs.npmjs.com/cli/v8/using-npm/package-spec
A module of npm-utils (npm_utils::package_json). It parses, resolves, and renders —
manifests and lockfiles as pure Value/string transforms — but never writes files, hits the
network, or resolves untrusted paths, which keeps its strict spec-conformance tests pure and
self-contained (the CLI does the file IO).
Four pieces:
- this module root:
package.json— itsdependenciesspecs and a browser-favoring conditional-exportsresolver (enough of Node’s algorithm to build an ES-module import map). spec— the npm “package spec” dependency grammar (spec::Spec) andspec::version_req.lock—package-lock.json(v2/v3) parsing into a faithfullock::Lockfile, andlock::render_v3for emitting one.manifest— pure write-sidepackage.jsontransforms (scaffold / upsert a dependency) for the CLI’sinit/add.
Modules§
- lock
package-lock.json(lockfileVersion 2 or 3) parsing, per https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json.- manifest
- Pure
package.jsonwrite-side transforms — the counterpart to this module’s readers. - spec
- The npm “package spec” — the dependency-specifier grammar, per https://docs.npmjs.com/cli/v8/using-npm/package-spec.
Structs§
- Dependency
- A dependency parsed from a
package.jsondependenciesmap. - Package
Json - Browser-favoring conditional-
exportsresolver over a parsedpackage.json.
Enums§
- Entry
- An import-map-worthy entry derived from a package’s
package.json. - Package
Type - The
"type"field of apackage.json(Node defaults to CommonJS).
Functions§
- parse_
dependencies - Parse the
dependenciessection of apackage.json.