Fix incremental build fingerprint invalidation
This commit is contained in:
@@ -32,12 +32,15 @@ export function inputFiles() {
|
||||
export function fingerprint() {
|
||||
const hash = crypto.createHash("sha256");
|
||||
for (const file of inputFiles()) {
|
||||
const stat = fs.statSync(file);
|
||||
// Read nanosecond metadata as bigint. Without the explicit option
|
||||
// `mtimeNs` is undefined in Node, so same-sized edits can reuse stale
|
||||
// bundles indefinitely.
|
||||
const stat = fs.statSync(file, { bigint: true });
|
||||
hash.update(path.relative(root, file));
|
||||
hash.update("\0");
|
||||
hash.update(String(stat.size));
|
||||
hash.update(stat.size.toString());
|
||||
hash.update("\0");
|
||||
hash.update(String(stat.mtimeNs));
|
||||
hash.update(stat.mtimeNs.toString());
|
||||
hash.update("\n");
|
||||
}
|
||||
return hash.digest("hex");
|
||||
|
||||
Reference in New Issue
Block a user