@@ -1151,34 +1151,29 @@ function isSingleDefaultExport(exports: readonly string[]) {
11511151
11521152const lockfileFormats = [
11531153 {
1154- name : '.package-lock.json' ,
11551154 path : 'node_modules/.package-lock.json' ,
11561155 checkPatches : true ,
11571156 manager : 'npm' ,
11581157 } ,
11591158 {
11601159 // Yarn non-PnP
1161- name : '.yarn-state.yml' ,
11621160 path : 'node_modules/.yarn-state.yml' ,
11631161 checkPatches : false ,
11641162 manager : 'yarn' ,
11651163 } ,
11661164 {
11671165 // Yarn PnP
1168- name : 'install-state' ,
11691166 path : '.yarn/install-state' ,
11701167 checkPatches : false ,
11711168 manager : 'yarn' ,
11721169 } ,
11731170 {
11741171 // yarn 1
1175- name : '.yarn-integrity' ,
11761172 path : 'node_modules/.yarn-integrity' ,
11771173 checkPatches : true ,
11781174 manager : 'yarn' ,
11791175 } ,
11801176 {
1181- name : 'lock.yaml' ,
11821177 path : 'node_modules/.pnpm/lock.yaml' ,
11831178 // Included in lockfile
11841179 checkPatches : false ,
@@ -1229,13 +1224,14 @@ function getLockfileHash(environment: Environment): string {
12291224 const lockfilePath = lookupFile ( environment . config . root , lockfilePaths )
12301225 let content = lockfilePath ? fs . readFileSync ( lockfilePath , 'utf-8' ) : ''
12311226 if ( lockfilePath ) {
1232- const lockfileName = path . basename ( lockfilePath )
1233- const { checkPatches } = lockfileFormats . find (
1234- ( f ) => f . name === lockfileName ,
1227+ const normalizedLockfilePath = lockfilePath . replaceAll ( '\\' , '/' )
1228+ const lockfileFormat = lockfileFormats . find ( ( f ) =>
1229+ normalizedLockfilePath . endsWith ( f . path ) ,
12351230 ) !
1236- if ( checkPatches ) {
1231+ if ( lockfileFormat . checkPatches ) {
12371232 // Default of https://github.com/ds300/patch-package
1238- const fullPath = path . join ( path . dirname ( lockfilePath ) , 'patches' )
1233+ const baseDir = lockfilePath . slice ( 0 , - lockfileFormat . path . length )
1234+ const fullPath = path . join ( baseDir , 'patches' )
12391235 const stat = tryStatSync ( fullPath )
12401236 if ( stat ?. isDirectory ( ) ) {
12411237 content += stat . mtimeMs . toString ( )
0 commit comments