Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nodejs): add v9 pnpm lock file support #6617

Merged
merged 15 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add test for v9
  • Loading branch information
DmitriyLewen committed May 3, 2024
commit deb58807c3b7e0c7dc4a0e220e56eb32a1c6679d
6 changes: 6 additions & 0 deletions pkg/dependency/parser/nodejs/pnpm/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ func TestParse(t *testing.T) {
want: pnpmV6WithDev,
wantDeps: pnpmV6WithDevDeps,
},
{
name: "v9",
file: "testdata/pnpm-lock_v9.yaml",
want: pnpmV9,
wantDeps: pnpmV9Deps,
},
}

for _, tt := range tests {
Expand Down
107 changes: 107 additions & 0 deletions pkg/dependency/parser/nodejs/pnpm/parse_testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,111 @@ var (
DependsOn: []string{"@babel/runtime@7.22.3"},
},
}

pnpmV9 = []types.Library{
{
ID: "asap@2.0.6",
Name: "asap",
Version: "2.0.6",
Relationship: types.RelationshipIndirect,
},
{
ID: "debug@4.3.4",
Name: "debug",
Version: "4.3.4",
Relationship: types.RelationshipIndirect,
},
{
ID: "ee-first@1.1.1",
Name: "ee-first",
Version: "1.1.1",
Relationship: types.RelationshipIndirect,
},
{
ID: "encodeurl@1.0.2",
Name: "encodeurl",
Version: "1.0.2",
Relationship: types.RelationshipIndirect,
},
{
ID: "escape-html@1.0.3",
Name: "escape-html",
Version: "1.0.3",
Relationship: types.RelationshipIndirect,
},
{
ID: "finalhandler@1.1.1",
Name: "finalhandler",
Version: "1.1.1",
Relationship: types.RelationshipDirect,
},
{
ID: "ms@2.0.0",
Name: "ms",
Version: "2.0.0",
Relationship: types.RelationshipIndirect,
},
{
ID: "on-finished@2.3.0",
Name: "on-finished",
Version: "2.3.0",
Relationship: types.RelationshipDirect,
},
{
ID: "parseurl@1.3.3",
Name: "parseurl",
Version: "1.3.3",
Relationship: types.RelationshipIndirect,
},
{
ID: "promise@8.1.0",
Name: "promise",
Version: "8.1.0",
Relationship: types.RelationshipDirect,
},
{
ID: "statuses@1.4.0",
Name: "statuses",
Version: "1.4.0",
Relationship: types.RelationshipIndirect,
},
{
ID: "unpipe@1.0.0",
Name: "unpipe",
Version: "1.0.0",
Relationship: types.RelationshipIndirect,
},
}
pnpmV9Deps = []types.Dependency{
{
ID: "debug@4.3.4",
DependsOn: []string{
"ms@2.0.0",
},
},
{
ID: "finalhandler@1.1.1",
DependsOn: []string{
"debug@4.3.4",
"encodeurl@1.0.2",
"escape-html@1.0.3",
"on-finished@2.3.0",
"parseurl@1.3.3",
"statuses@1.4.0",
"unpipe@1.0.0",
},
},
{
ID: "on-finished@2.3.0",
DependsOn: []string{
"ee-first@1.1.1",
},
},
{
ID: "promise@8.1.0",
DependsOn: []string{
"asap@2.0.6",
},
},
}
)
126 changes: 126 additions & 0 deletions pkg/dependency/parser/nodejs/pnpm/testdata/pnpm-lock_v9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
lockfileVersion: '9.0'

settings:
autoInstallPeers: true
excludeLinksFromLockfile: false

importers:

.:
dependencies:
finalhandler:
specifier: 1.1.1
version: 1.1.1
on-finished:
specifier: 2.3.0
version: 2.3.0
promise:
specifier: 8.1.0
version: 8.1.0
devDependencies:
jquery:
specifier: 3.6.0
version: 3.6.0
ms:
specifier: 2.0.0
version: 2.0.0

packages:

asap@2.0.6:
resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==}

debug@4.3.4:
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true

ee-first@1.1.1:
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}

encodeurl@1.0.2:
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
engines: {node: '>= 0.8'}

escape-html@1.0.3:
resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}

finalhandler@1.1.1:
resolution: {integrity: sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==}
engines: {node: '>= 0.8'}

jquery@3.6.0:
resolution: {integrity: sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==}

ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}

on-finished@2.3.0:
resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==}
engines: {node: '>= 0.8'}

parseurl@1.3.3:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}

promise@8.1.0:
resolution: {integrity: sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==}

statuses@1.4.0:
resolution: {integrity: sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==}
engines: {node: '>= 0.6'}

unpipe@1.0.0:
resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
engines: {node: '>= 0.8'}

snapshots:

asap@2.0.6:
optional: true

debug@4.3.4(supports-color@8.1.1):
dependencies:
ms: 2.0.0
optionalDependencies:
supports-color: 8.1.1

ee-first@1.1.1: {}

encodeurl@1.0.2: {}

escape-html@1.0.3: {}

finalhandler@1.1.1:
dependencies:
debug: 4.3.4(supports-color@8.1.1)
encodeurl: 1.0.2
escape-html: 1.0.3
on-finished: 2.3.0
parseurl: 1.3.3
statuses: 1.4.0
unpipe: 1.0.0
transitivePeerDependencies:
- supports-color

jquery@3.6.0: {}

ms@2.0.0: {}

on-finished@2.3.0:
dependencies:
ee-first: 1.1.1

parseurl@1.3.3: {}

promise@8.1.0:
optionalDependencies:
asap: 2.0.6

statuses@1.4.0: {}

unpipe@1.0.0: {}