| 37 | } |
| 38 | |
| 39 | const hasChanged = (fromNode: PackageFileTree, toNode: PackageFileTree): boolean => { |
| 40 | // Prefer strong hash comparison when both hashes are available |
| 41 | if (fromNode.hash && toNode.hash) return fromNode.hash !== toNode.hash |
| 42 | // Fallback to size comparison if hashes are missing |
| 43 | if (typeof fromNode.size === 'number' && typeof toNode.size === 'number') { |
| 44 | return fromNode.size !== toNode.size |
| 45 | } |
| 46 | // If we lack comparable signals, assume unchanged |
| 47 | return false |
| 48 | } |
| 49 | |
| 50 | /** Compare two file trees and return changes */ |
| 51 | export function compareFileTrees( |