@@ -12,24 +12,24 @@ export type AgentLockIncludesFn = (
1212
1313const { BUN , LOCK_EXT , NPM , PNPM , VLT , YARN_BERRY , YARN_CLASSIC } = constants
1414
15- function lockIncludesNpm ( lockSrc : string , name : string ) {
15+ function includesNpm ( lockSrc : string , name : string ) {
1616 // Detects the package name in the following cases:
1717 // "name":
1818 return lockSrc . includes ( `"${ name } ":` )
1919}
2020
21- function lockIncludesBun ( lockSrc : string , name : string , lockName ?: string ) {
21+ function includesBun ( lockSrc : string , name : string , lockName ?: string ) {
2222 // This is a bit counterintuitive. When lockName ends with a .lockb
2323 // we treat it as a yarn.lock. When lockName ends with a .lock we
2424 // treat it as a package-lock.json. The bun.lock format is not identical
2525 // 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 )
3030}
3131
32- function lockIncludesPnpm ( lockSrc : string , name : string ) {
32+ function includesPnpm ( lockSrc : string , name : string ) {
3333 const escapedName = escapeRegExp ( name )
3434 return new RegExp (
3535 // Detects the package name in the following cases:
@@ -42,13 +42,13 @@ function lockIncludesPnpm(lockSrc: string, name: string) {
4242 ) . test ( lockSrc )
4343}
4444
45- function lockIncludesVlt ( lockSrc : string , name : string ) {
45+ function includesVlt ( lockSrc : string , name : string ) {
4646 // Detects the package name in the following cases:
4747 // "name"
4848 return lockSrc . includes ( `"${ name } "` )
4949}
5050
51- function lockIncludesYarn ( lockSrc : string , name : string ) {
51+ function includesYarn ( lockSrc : string , name : string ) {
5252 const escapedName = escapeRegExp ( name )
5353 return new RegExp (
5454 // Detects the package name in the following cases:
@@ -61,11 +61,11 @@ function lockIncludesYarn(lockSrc: string, name: string) {
6161 ) . test ( lockSrc )
6262}
6363
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 ]
7171] )
0 commit comments