-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): ensure correct package name matching when parsing pnpm lock file #17613
fix(core): ensure correct package name matching when parsing pnpm lock file #17613
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -18,7 +18,7 @@ import { | |||
ProjectGraph, | |||
ProjectGraphExternalNode, | |||
} from '../../../config/project-graph'; | |||
import { fileHasher, hashArray } from '../../../hasher/file-hasher'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import
@@ -43,39 +43,40 @@ function addNodes( | |||
const nodes: Map<string, Map<string, ProjectGraphExternalNode>> = new Map(); | |||
|
|||
Object.entries(data.packages).forEach(([key, snapshot]) => { | |||
const packageName = findPackageName(key, snapshot, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of single value we return an array
} | ||
} | ||
return extractNameFromKey(key); | ||
if (packageNames.size === 0) { | ||
packageNames.add(originalPackageName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package can be overridden in the version meta which we don't parse at the moment (version 5.x has this info hashed) so we add this explicitly if not found otherwise:
The following line says that despite dependency is [email protected] we will use 4.8.4 so that would end up being the only installed version:
/@phenomnomnominal/[email protected]([email protected]):
resolution: {integrity: sha512-jjMmK1tnZbm1Jq5a7fBliM4gQwjxMU7TFoRNwIyzwlO+eHPRCFv/Nv+H/Gi1jc3WR7QURG8D5d0Tn12YGrUqBQ==}
peerDependencies:
typescript: ^3 || ^4
dependencies:
esquery: 1.5.0
typescript: 4.8.2
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Package name matcher in the
pnpm-parser
will match key to alias name if found, and ignore the potential full name match.The above yaml would match 2 packages:
While skipping the:
Expected Behavior
If same package version is used in the original form and as an alias, both variants should be saved to graph, so that we can track them when finding dependency subgraph and pruning.
Related Issue(s)
Fixes #17492