Skip to content

feat(lockfiles): parse npm, pnpm, yarn, bun, Go and Cargo lockfiles - #2041

Open
Makisuo wants to merge 5 commits into
mainfrom
feat/depscan-1-lockfiles
Open

Makisuo wants to merge 5 commits into
mainfrom
feat/depscan-1-lockfiles

fix(lockfiles): pnpm 11 multi-document lockfiles, crates.io-only Carg…

1739974
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 1, 2026 in 1m 15s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. Held at 8 because the earlier review found defects: the only code read here is the five files changed since, and both fixes hold with tests.
no findings · tests covered · risk low

Adds @maple/lockfiles, a lib/ package that turns npm, pnpm, yarn, bun, Go and Cargo lockfiles into a flat locked-package list with relations, plus ecosystem-aware version ordering. It is a pure parser library with no caller yet; the delta since the 8a97f93 review (pnpm multi-document reads, crates.io-only Cargo sources) is correct and pinned by tests, so it is safe to merge.

  • parseYamlDocuments reads every document of a pnpm YAML stream, not only the first
  • parsePnpmLock joins importers and packages across all pnpm documents
  • parseCargoLock keeps only crates.io crates, from the git or sparse index
  • parsePnpmLock skips alternate-registry and non-registry packages with a warning count

Production impact

Telemetry this change adds and removes (9)
  • ➕ span name lockfiles.readPackageJsons · lib/lockfiles/src/internal/manifests.ts:34
  • ➕ span name lockfiles.parseLockfile · lib/lockfiles/src/parse.ts:25
  • ➕ span name lockfiles.parseBunLock · lib/lockfiles/src/parsers/bun.ts:50
  • ➕ span name lockfiles.parseCargoLock · lib/lockfiles/src/parsers/cargo.ts:30
  • ➕ span name lockfiles.parseGoMod · lib/lockfiles/src/parsers/go.ts:108
  • ➕ span name lockfiles.parseGoSum · lib/lockfiles/src/parsers/go.ts:126
  • ➕ span name lockfiles.parsePackageLock · lib/lockfiles/src/parsers/packageLock.ts:92
  • ➕ span name lockfiles.parsePnpmLock · lib/lockfiles/src/parsers/pnpm.ts:72
  • ➕ span name lockfiles.parseYarnLock · lib/lockfiles/src/parsers/yarn.ts:133
What was checked
  • parseYamlDocuments fails the read on a document with errors and keeps YAML alias expansion capped (internal/decode.ts:47)
  • v9 packages and snapshots overlap collapses through dedupePackages, which keeps the strongest relation (parse.ts:46, test at parse.test.ts:135)
  • Cargo skipped arithmetic all - members - packages matches the warning text (parsers/cargo.ts:45)

1739974 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.