From e9b589cd5f9ac2a2a327c249d9159888a2e75d14 Mon Sep 17 00:00:00 2001 From: Brandon Cheng Date: Wed, 30 Jul 2025 05:35:14 -0400 Subject: [PATCH] chore: document how `lockfileToDepGraph` returns a partial graph (#9806) --- .changeset/icy-shoes-rest.md | 5 +++++ deps/graph-builder/src/lockfileToDepGraph.ts | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 .changeset/icy-shoes-rest.md diff --git a/.changeset/icy-shoes-rest.md b/.changeset/icy-shoes-rest.md new file mode 100644 index 0000000000..12e43e135d --- /dev/null +++ b/.changeset/icy-shoes-rest.md @@ -0,0 +1,5 @@ +--- +"@pnpm/deps.graph-builder": patch +--- + +Add a JSDoc for the `lockfileToDepGraph` function. diff --git a/deps/graph-builder/src/lockfileToDepGraph.ts b/deps/graph-builder/src/lockfileToDepGraph.ts index 96a59d3dc1..4d4713d313 100644 --- a/deps/graph-builder/src/lockfileToDepGraph.ts +++ b/deps/graph-builder/src/lockfileToDepGraph.ts @@ -93,6 +93,15 @@ export interface LockfileToDepGraphResult { pkgLocationsByDepPath?: Record } +/** + * Generate a dependency graph from lockfiles. + * + * If a current lockfile is provided, this function only includes new or changed + * packages in the graph. In other words, the graph returned will be a set + * subtraction of the packages in the wanted lockfile minus the current + * lockfile. This behavior can be configured with the `includeUnchangedDeps` + * option. + */ export async function lockfileToDepGraph ( lockfile: LockfileObject, currentLockfile: LockfileObject | null,