Skip to content

Commit a723fe8

Browse files
committed
log cache status
1 parent 9cbde4f commit a723fe8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dataloader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export class Loader {
8989
const cachePath = join(this.sourceRoot, outputPath);
9090
const loaderStat = await maybeStat(this.path);
9191
const cacheStat = await maybeStat(cachePath);
92-
if (cacheStat && cacheStat.mtimeMs > loaderStat!.mtimeMs) return outputPath;
92+
if (!cacheStat) verbose && process.stdout.write(faint("[missing] "));
93+
else if (cacheStat.mtimeMs < loaderStat!.mtimeMs) verbose && process.stdout.write(faint("[stale] "));
94+
else return verbose && process.stdout.write(faint("[fresh] ")), outputPath;
9395
const tempPath = join(this.sourceRoot, ".observablehq", "cache", `${this.targetPath}.${process.pid}`);
9496
await prepareOutput(tempPath);
9597
const tempFd = await open(tempPath, "w");
@@ -131,6 +133,7 @@ export class Loader {
131133
}
132134
}
133135

136+
const faint = color(2);
134137
const red = color(31);
135138
const green = color(32);
136139
const yellow = color(33);

0 commit comments

Comments
 (0)