@@ -1172,34 +1172,45 @@ function isSingleDefaultExport(exports: readonly string[]) {
1172
1172
const lockfileFormats = [
1173
1173
{
1174
1174
path : 'node_modules/.package-lock.json' ,
1175
- checkPatches : true ,
1175
+ checkPatchesDir : 'patches' ,
1176
1176
manager : 'npm' ,
1177
1177
} ,
1178
1178
{
1179
1179
// Yarn non-PnP
1180
1180
path : 'node_modules/.yarn-state.yml' ,
1181
- checkPatches : false ,
1181
+ checkPatchesDir : false ,
1182
1182
manager : 'yarn' ,
1183
1183
} ,
1184
1184
{
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' ,
1188
1194
manager : 'yarn' ,
1189
1195
} ,
1190
1196
{
1191
1197
// yarn 1
1192
1198
path : 'node_modules/.yarn-integrity' ,
1193
- checkPatches : true ,
1199
+ checkPatchesDir : 'patches' ,
1194
1200
manager : 'yarn' ,
1195
1201
} ,
1196
1202
{
1197
1203
path : 'node_modules/.pnpm/lock.yaml' ,
1198
1204
// Included in lockfile
1199
- checkPatches : false ,
1205
+ checkPatchesDir : false ,
1200
1206
manager : 'pnpm' ,
1201
1207
} ,
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
+ } ,
1203
1214
] . sort ( ( _ , { manager } ) => {
1204
1215
return process . env . npm_config_user_agent ?. startsWith ( manager ) ? 1 : - 1
1205
1216
} )
@@ -1250,10 +1261,13 @@ function getLockfileHash(environment: Environment): string {
1250
1261
const lockfileFormat = lockfileFormats . find ( ( f ) =>
1251
1262
normalizedLockfilePath . endsWith ( f . path ) ,
1252
1263
) !
1253
- if ( lockfileFormat . checkPatches ) {
1264
+ if ( lockfileFormat . checkPatchesDir ) {
1254
1265
// Default of https://github.com/ds300/patch-package
1255
1266
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
+ )
1257
1271
const stat = tryStatSync ( fullPath )
1258
1272
if ( stat ?. isDirectory ( ) ) {
1259
1273
content += stat . mtimeMs . toString ( )
0 commit comments