Skip to content

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

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

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

Conversation

@ljharb
Copy link
Copy Markdown
Contributor

@ljharb ljharb commented Apr 25, 2026

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 owner April 25, 2026 03:06
Comment thread workspaces/arborist/lib/arborist/index.js Outdated
Comment thread workspaces/arborist/lib/arborist/index.js Outdated
Comment thread workspaces/arborist/test/arborist/index.js Outdated
@ljharb ljharb force-pushed the expose-lockfile-string branch from 998444f to b683513 Compare May 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.
@ljharb ljharb force-pushed the expose-lockfile-string branch from b683513 to 3ccc030 Compare May 4, 2026 23:49
@owlstronaut owlstronaut merged commit b8655c7 into npm:latest May 5, 2026
18 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🎉 Backport to release/v11 created: #9312

@jdalton
Copy link
Copy Markdown
Contributor

jdalton commented May 5, 2026

Noice! Thank you @ljharb!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants