Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ecb016

Browse files
committedJun 4, 2025
Tweak pnpm dep sniff for older lockfile
1 parent 0ffef8d commit 8ecb016

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎src/commands/optimize/lockfile-includes-by-agent.mts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ function includesBun(lockSrc: string, name: string, lockName?: string) {
3232
function includesPnpm(lockSrc: string, name: string) {
3333
const escapedName = escapeRegExp(name)
3434
return new RegExp(
35-
// Detects the package name in the following cases:
36-
// /name/
35+
// Detects the package name.
36+
// v9.0 and v6.0 lockfile patterns:
3737
// 'name'
3838
// name:
3939
// name@
40-
`(?<=^\\s*)(?:(['/])${escapedName}\\1|${escapedName}(?=[:@]))`,
40+
// v6.0 lockfile patterns:
41+
// /name@
42+
`(?<=^\\s*)(?:'${escapedName}'|/?${escapedName}(?=[:@]))`,
4143
'm',
4244
).test(lockSrc)
4345
}

0 commit comments

Comments
 (0)
Please sign in to comment.