Skip to content

Commit

Permalink
fix(core): pnpm parser should handle aliased deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Apr 26, 2024
1 parent 242ce3d commit fd0e351
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ publicHoistPattern:
registries:
default: https://registry.npmjs.org/
skipped: []
storeDir: /Users/columferry/Library/pnpm/store/v3
storeDir: /Users/jdoe/Library/pnpm/store/v3
virtualStoreDir: .pnpm`;
24 changes: 12 additions & 12 deletions packages/nx/src/plugins/js/lock-file/pnpm-parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ describe('pnpm LockFile utility', () => {
"data": {
"hash": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"packageName": "string-width-cjs",
"version": "npm:string-width@^4.2.0",
"version": "npm:[email protected].3",
},
"name": "npm:string-width-cjs",
"type": "npm",
Expand All @@ -1081,20 +1081,11 @@ describe('pnpm LockFile utility', () => {
"name": "npm:[email protected]",
"type": "npm",
},
"npm:strip-ansi": {
"data": {
"hash": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==",
"packageName": "strip-ansi",
"version": "7.0.1",
},
"name": "npm:strip-ansi",
"type": "npm",
},
"npm:strip-ansi-cjs": {
"data": {
"hash": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"packageName": "strip-ansi-cjs",
"version": "npm:strip-ansi@^6.0.1",
"version": "npm:[email protected]",
},
"name": "npm:strip-ansi-cjs",
"type": "npm",
Expand All @@ -1108,6 +1099,15 @@ describe('pnpm LockFile utility', () => {
"name": "npm:[email protected]",
"type": "npm",
},
"npm:[email protected]": {
"data": {
"hash": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
"packageName": "strip-ansi",
"version": "7.1.0",
},
"name": "npm:[email protected]",
"type": "npm",
},
"npm:wrap-ansi": {
"data": {
"hash": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
Expand All @@ -1121,7 +1121,7 @@ describe('pnpm LockFile utility', () => {
"data": {
"hash": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"packageName": "wrap-ansi-cjs",
"version": "npm:wrap-ansi@^7.0.0",
"version": "npm:[email protected]",
},
"name": "npm:wrap-ansi-cjs",
"type": "npm",
Expand Down
12 changes: 12 additions & 0 deletions packages/nx/src/plugins/js/lock-file/pnpm-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ function getNodes(
packageNames.add(originalPackageName);
}

const snapshots = Object.values(data.packages);
for (const snapshot of snapshots) {
const dependencyName = matchedDependencyName(
snapshot,
key,
originalPackageName
);
if (dependencyName) {
packageNames.add(dependencyName);
}
}

for (const packageName of packageNames) {
const rawVersion = findVersion(key, packageName);
if (!rawVersion) {
Expand Down

0 comments on commit fd0e351

Please sign in to comment.