Skip to content

Commit 2aec43f

Browse files
authored
feat: support for pnpm lockfile v9 (#12)
1 parent 208c485 commit 2aec43f

31 files changed

Lines changed: 837 additions & 2 deletions

File tree

lib/lock-parser/build-dep-graph.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export async function buildDepGraph(
3636
switch (lockfileVersion) {
3737
case NodeLockfileVersion.PnpmLockV5:
3838
case NodeLockfileVersion.PnpmLockV6:
39+
case NodeLockfileVersion.PnpmLockV9:
3940
return await lockFileParser.parsePnpmProject(
4041
manifestFileContents,
4142
lockFileContents,

lib/lock-parser/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export async function parse(
4747
lockfileVersion === NodeLockfileVersion.NpmLockV2 ||
4848
lockfileVersion === NodeLockfileVersion.NpmLockV3 ||
4949
lockfileVersion === NodeLockfileVersion.PnpmLockV5 ||
50-
lockfileVersion === NodeLockfileVersion.PnpmLockV6
50+
lockfileVersion === NodeLockfileVersion.PnpmLockV6 ||
51+
lockfileVersion === NodeLockfileVersion.PnpmLockV9
5152
) {
5253
return await buildDepGraph(
5354
root,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"lodash.isempty": "^4.4.0",
4343
"lodash.sortby": "^4.7.0",
4444
"micromatch": "4.0.2",
45-
"snyk-nodejs-lockfile-parser": "^1.53.3",
45+
"snyk-nodejs-lockfile-parser": "^1.56.0",
4646
"snyk-resolve-deps": "4.8.0"
4747
},
4848
"devDependencies": {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "one-dep",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"accepts": "1.3.7"
8+
}
9+
}

test/fixtures/pnpm/lock-v9/simple-app/pnpm-lock.yaml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "pnpm-shallow-goof",
3+
"version": "0.0.1",
4+
"description": "A vulnerable demo application",
5+
"homepage": "https://snyk.io/",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/snyk-fixtures/pnpm-shallow-goof"
9+
},
10+
"dependencies": {
11+
"a": "workspace:*"
12+
}
13+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "a",
3+
"description": "",
4+
"main": "index.js",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1"
7+
},
8+
"keywords": [],
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"node-uuid": "1.4.0",
13+
"qs": "0.0.6"
14+
}
15+
}
16+

test/fixtures/pnpm/lock-v9/undefined-package-version/pnpm-lock.yaml

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/pnpm/lock-v9/undefined-package-version/pnpm-workspace.yaml

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "yarn-1-workspace-with-isolated-pkgs",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"react": "18.0.0"
8+
},
9+
"private": true
10+
}

0 commit comments

Comments
 (0)