Skip to content

feat(arborist): add lockfileString() for in-memory lockfile generation - #9282

Merged
owlstronaut merged 1 commit into
npm:latestfrom
ljharb:expose-lockfile-string
May 5, 2026
Merged

feat(arborist): add lockfileString() for in-memory lockfile generation#9282
owlstronaut merged 1 commit into
npm:latestfrom
ljharb:expose-lockfile-string

Conversation

@ljharb

Copy link
Copy Markdown
Contributor

Exposes a public method on the Arborist class that builds (or reuses) an ideal tree, commits the shrinkwrap metadata, and returns the lockfile contents as a string without writing to disk.

This makes a previously-undocumented sequence (buildIdealTree() -> tree.meta.commit() -> String(tree.meta)) a discoverable, supported API, enabling callers to inspect, diff, or store generated lockfiles without mutating the project's package-lock.json.

(specifically, this is the only thing i need to be able to completely EOL https://npmjs.com/npm-lockfile)

@ljharb
ljharb requested a review from a team as a code ownerApril 25, 2026 03:06
Comment threadworkspaces/arborist/lib/arborist/index.js Outdated
Comment threadworkspaces/arborist/lib/arborist/index.js Outdated
Comment threadworkspaces/arborist/test/arborist/index.js Outdated
@ljharb
ljharbforce-pushed the expose-lockfile-string branch from 998444f to b683513CompareMay 4, 2026 23:43
Exposes a public method on the Arborist class that builds (or reuses) an ideal tree, commits the shrinkwrap metadata, and returns the lockfile contents as a string without writing to disk.
This makes a previously-undocumented sequence (`buildIdealTree()` -> `tree.meta.commit()` -> `String(tree.meta)`) a discoverable, supported API, enabling callers to inspect, diff, or store generated lockfiles without mutating the project's package-lock.json.
@owlstronaut
owlstronaut merged commit b8655c7 into npm:latestMay 5, 2026
18 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9312

@jdalton

Copy link
Copy Markdown
Contributor

Noice! Thank you @ljharb!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ljharb@jdalton@owlstronaut