@@ -21,6 +21,17 @@ export function flattenTree(tree: PackageFileTree[]): Map<string, PackageFileTre
2121 return result
2222}
2323
24+ const hasChanged = ( fromNode : PackageFileTree , toNode : PackageFileTree ) : boolean => {
25+ // Prefer strong hash comparison when both hashes are available
26+ if ( fromNode . hash && toNode . hash ) return fromNode . hash !== toNode . hash
27+ // Fallback to size comparison if hashes are missing
28+ if ( typeof fromNode . size === 'number' && typeof toNode . size === 'number' ) {
29+ return fromNode . size !== toNode . size
30+ }
31+ // If we lack comparable signals, assume unchanged
32+ return false
33+ }
34+
2435/** Compare two file trees and return changes */
2536export function compareFileTrees (
2637 fromTree : PackageFileTree [ ] ,
@@ -29,17 +40,6 @@ export function compareFileTrees(
2940 const fromFiles = flattenTree ( fromTree )
3041 const toFiles = flattenTree ( toTree )
3142
32- const hasChanged = ( fromNode : PackageFileTree , toNode : PackageFileTree ) : boolean => {
33- // Prefer strong hash comparison when both hashes are available
34- if ( fromNode . hash && toNode . hash ) return fromNode . hash !== toNode . hash
35- // Fallback to size comparison if hashes are missing
36- if ( typeof fromNode . size === 'number' && typeof toNode . size === 'number' ) {
37- return fromNode . size !== toNode . size
38- }
39- // If we lack comparable signals, assume unchanged
40- return false
41- }
42-
4343 const added : FileChange [ ] = [ ]
4444 const removed : FileChange [ ] = [ ]
4545 const modified : FileChange [ ] = [ ]
0 commit comments