@@ -1172,34 +1172,45 @@ function isSingleDefaultExport(exports: readonly string[]) {
11721172const lockfileFormats = [
11731173 {
11741174 path : 'node_modules/.package-lock.json' ,
1175- checkPatches : true ,
1175+ checkPatchesDir : 'patches' ,
11761176 manager : 'npm' ,
11771177 } ,
11781178 {
11791179 // Yarn non-PnP
11801180 path : 'node_modules/.yarn-state.yml' ,
1181- checkPatches : false ,
1181+ checkPatchesDir : false ,
11821182 manager : 'yarn' ,
11831183 } ,
11841184 {
1185- // Yarn PnP
1186- path : '.yarn/install-state' ,
1187- checkPatches : false ,
1185+ // Yarn v3+ PnP
1186+ path : '.pnp.cjs' ,
1187+ checkPatchesDir : '.yarn/patches' ,
1188+ manager : 'yarn' ,
1189+ } ,
1190+ {
1191+ // Yarn v2 PnP
1192+ path : '.pnp.js' ,
1193+ checkPatchesDir : '.yarn/patches' ,
11881194 manager : 'yarn' ,
11891195 } ,
11901196 {
11911197 // yarn 1
11921198 path : 'node_modules/.yarn-integrity' ,
1193- checkPatches : true ,
1199+ checkPatchesDir : 'patches' ,
11941200 manager : 'yarn' ,
11951201 } ,
11961202 {
11971203 path : 'node_modules/.pnpm/lock.yaml' ,
11981204 // Included in lockfile
1199- checkPatches : false ,
1205+ checkPatchesDir : false ,
12001206 manager : 'pnpm' ,
12011207 } ,
1202- { name : 'bun.lockb' , path : 'bun.lockb' , checkPatches : true , manager : 'bun' } ,
1208+ {
1209+ name : 'bun.lockb' ,
1210+ path : 'bun.lockb' ,
1211+ checkPatchesDir : 'patches' ,
1212+ manager : 'bun' ,
1213+ } ,
12031214] . sort ( ( _ , { manager } ) => {
12041215 return process . env . npm_config_user_agent ?. startsWith ( manager ) ? 1 : - 1
12051216} )
@@ -1250,10 +1261,13 @@ function getLockfileHash(environment: Environment): string {
12501261 const lockfileFormat = lockfileFormats . find ( ( f ) =>
12511262 normalizedLockfilePath . endsWith ( f . path ) ,
12521263 ) !
1253- if ( lockfileFormat . checkPatches ) {
1264+ if ( lockfileFormat . checkPatchesDir ) {
12541265 // Default of https://github.com/ds300/patch-package
12551266 const baseDir = lockfilePath . slice ( 0 , - lockfileFormat . path . length )
1256- const fullPath = path . join ( baseDir , 'patches' )
1267+ const fullPath = path . join (
1268+ baseDir ,
1269+ lockfileFormat . checkPatchesDir as string ,
1270+ )
12571271 const stat = tryStatSync ( fullPath )
12581272 if ( stat ?. isDirectory ( ) ) {
12591273 content += stat . mtimeMs . toString ( )
0 commit comments