@@ -12,24 +12,24 @@ export type AgentLockIncludesFn = (
12
12
13
13
const { BUN , LOCK_EXT , NPM , PNPM , VLT , YARN_BERRY , YARN_CLASSIC } = constants
14
14
15
- function lockIncludesNpm ( lockSrc : string , name : string ) {
15
+ function includesNpm ( lockSrc : string , name : string ) {
16
16
// Detects the package name in the following cases:
17
17
// "name":
18
18
return lockSrc . includes ( `"${ name } ":` )
19
19
}
20
20
21
- function lockIncludesBun ( lockSrc : string , name : string , lockName ?: string ) {
21
+ function includesBun ( lockSrc : string , name : string , lockName ?: string ) {
22
22
// This is a bit counterintuitive. When lockName ends with a .lockb
23
23
// we treat it as a yarn.lock. When lockName ends with a .lock we
24
24
// treat it as a package-lock.json. The bun.lock format is not identical
25
25
// package-lock.json, however it close enough for npmLockIncludes to work.
26
- const lockScanner = lockName ?. endsWith ( LOCK_EXT )
27
- ? lockIncludesNpm
28
- : lockIncludesYarn
29
- return lockScanner ( lockSrc , name )
26
+ const lockfileScanner = lockName ?. endsWith ( LOCK_EXT )
27
+ ? includesNpm
28
+ : includesYarn
29
+ return lockfileScanner ( lockSrc , name )
30
30
}
31
31
32
- function lockIncludesPnpm ( lockSrc : string , name : string ) {
32
+ function includesPnpm ( lockSrc : string , name : string ) {
33
33
const escapedName = escapeRegExp ( name )
34
34
return new RegExp (
35
35
// Detects the package name in the following cases:
@@ -42,13 +42,13 @@ function lockIncludesPnpm(lockSrc: string, name: string) {
42
42
) . test ( lockSrc )
43
43
}
44
44
45
- function lockIncludesVlt ( lockSrc : string , name : string ) {
45
+ function includesVlt ( lockSrc : string , name : string ) {
46
46
// Detects the package name in the following cases:
47
47
// "name"
48
48
return lockSrc . includes ( `"${ name } "` )
49
49
}
50
50
51
- function lockIncludesYarn ( lockSrc : string , name : string ) {
51
+ function includesYarn ( lockSrc : string , name : string ) {
52
52
const escapedName = escapeRegExp ( name )
53
53
return new RegExp (
54
54
// Detects the package name in the following cases:
@@ -61,11 +61,11 @@ function lockIncludesYarn(lockSrc: string, name: string) {
61
61
) . test ( lockSrc )
62
62
}
63
63
64
- export const lockIncludesByAgent = new Map < Agent , AgentLockIncludesFn > ( [
65
- [ BUN , lockIncludesBun ] ,
66
- [ NPM , lockIncludesNpm ] ,
67
- [ PNPM , lockIncludesPnpm ] ,
68
- [ VLT , lockIncludesVlt ] ,
69
- [ YARN_BERRY , lockIncludesYarn ] ,
70
- [ YARN_CLASSIC , lockIncludesYarn ]
64
+ export const lockfileIncludesByAgent = new Map < Agent , AgentLockIncludesFn > ( [
65
+ [ BUN , includesBun ] ,
66
+ [ NPM , includesNpm ] ,
67
+ [ PNPM , includesPnpm ] ,
68
+ [ VLT , includesVlt ] ,
69
+ [ YARN_BERRY , includesYarn ] ,
70
+ [ YARN_CLASSIC , includesYarn ]
71
71
] )
0 commit comments