Skip to content

feat(javascript): Add dependency parsing#4304

Merged
spiffcs merged 7 commits intoanchore:mainfrom
timols:feat/add-dependencies-js
Nov 6, 2025
Merged

feat(javascript): Add dependency parsing#4304
spiffcs merged 7 commits intoanchore:mainfrom
timols:feat/add-dependencies-js

Conversation

@timols
Copy link
Contributor

@timols timols commented Oct 23, 2025

Description

This PR adds dependency parsing for lockfiles in the javascript ecosystem: npm package-lock.json files (v2 and v3), yarn.lock files and pnpm-lock.yaml files. This tackles part of #572 and #3109 for JS.

I tried to avoid doing any larger re-factors, trying to stick to what seemed to be patterns for both the python dependency parsing and golang so as to keep this small.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
@github-actions github-actions bot added the json-schema Changes the json schema label Oct 23, 2025
Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
jsonNames(pkg.NpmPackage{}, "javascript-npm-package", "NpmPackageJsonMetadata"),
jsonNames(pkg.NpmPackageLockEntry{}, "javascript-npm-package-lock-entry", "NpmPackageLockJsonMetadata"),
jsonNames(pkg.YarnLockEntry{}, "javascript-yarn-lock-entry", "YarnLockJsonMetadata"),
jsonNames(pkg.PnpmLockEntry{}, "javascript-pnpm-lock-entry", "PnpmLockJsonMetadata"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsonNames(pkg.PnpmLockEntry{}, "javascript-pnpm-lock-entry", "PnpmLockJsonMetadata"),
jsonNames(pkg.PnpmLockEntry{}, "javascript-pnpm-lock-entry"),

new entries here don't require mappings to legacy values

Copy link
Contributor

@wagoodman wagoodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one small change needed (+ regen the schema) but other than that this looks great!

Signed-off-by: Tim Olshansky <456103+timols@users.noreply.github.com>
@timols timols force-pushed the feat/add-dependencies-js branch from a61c26c to 3f00a23 Compare October 29, 2025 19:49
@timols
Copy link
Contributor Author

timols commented Oct 29, 2025

@wagoodman I made the changes - thanks! 🙏

@timols timols requested a review from wagoodman October 31, 2025 16:20
@timols
Copy link
Contributor Author

timols commented Nov 3, 2025

@wagoodman anything holding this back from being merged?

@spiffcs spiffcs merged commit 4e06a7a into anchore:main Nov 6, 2025
12 checks passed
@spiffcs
Copy link
Contributor

spiffcs commented Nov 6, 2025

@timols merged TYVM

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

Labels

json-schema Changes the json schema

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants