@@ -1043,10 +1043,10 @@ function isSingleDefaultExport(exports: readonly string[]) {
1043
1043
}
1044
1044
1045
1045
const lockfileFormats = [
1046
- { name : 'package-lock.json' , patchesDirs : [ 'patches' ] } , // Default of https://github.com/ds300/patch-package
1047
- { name : 'yarn.lock' , patchesDirs : [ 'patches' , '.yarn/patches' ] } , // .yarn/patches for v2+
1048
- { name : 'pnpm-lock.yaml' , patchesDirs : [ ] } , // Included in lockfile
1049
- { name : 'bun.lockb' , patchesDirs : [ 'patches' ] } ,
1046
+ { name : 'package-lock.json' , checkPatches : true } ,
1047
+ { name : 'yarn.lock' , checkPatches : true } , // Included in lockfile for v2+
1048
+ { name : 'pnpm-lock.yaml' , checkPatches : false } , // Included in lockfile
1049
+ { name : 'bun.lockb' , checkPatches : true } ,
1050
1050
]
1051
1051
1052
1052
export function getDepHash ( config : ResolvedConfig , ssr : boolean ) : string {
@@ -1058,17 +1058,16 @@ export function getDepHash(config: ResolvedConfig, ssr: boolean): string {
1058
1058
let content = lockfilePath ? fs . readFileSync ( lockfilePath , 'utf-8' ) : ''
1059
1059
if ( lockfilePath ) {
1060
1060
const lockfileName = path . basename ( lockfilePath )
1061
- const { patchesDirs } = lockfileFormats . find (
1061
+ const { checkPatches } = lockfileFormats . find (
1062
1062
( f ) => f . name === lockfileName ,
1063
1063
) !
1064
- const dependenciesRoot = path . dirname ( lockfilePath )
1065
- for ( const patchesDir of patchesDirs ) {
1066
- const fullPath = path . join ( dependenciesRoot , patchesDir )
1064
+ if ( checkPatches ) {
1065
+ // Default of https://github.com/ds300/patch-package
1066
+ const fullPath = path . join ( path . dirname ( lockfilePath ) , 'patches' )
1067
1067
if ( fs . existsSync ( fullPath ) ) {
1068
1068
const stats = fs . statSync ( fullPath )
1069
1069
if ( stats . isDirectory ( ) ) {
1070
1070
content += stats . mtimeMs . toString ( )
1071
- break
1072
1071
}
1073
1072
}
1074
1073
}
0 commit comments