MCPcopy Create free account
hub / github.com/observablehq/framework / getSourceFileHash

Method getSourceFileHash

src/loader.ts:292–298  ·  view source on GitHub ↗

* Returns the hash of the file with the given name within the source root, or * if the name refers to a file generated by a data loader, the hash of the * corresponding data loader source and its modification time. The latter * ensures that if the data loader is “touched” (even without chan

(name: string)

Source from the content-addressed store, hash-verified

290 * contents) that the data loader will be re-run.
291 */
292 getSourceFileHash(name: string): string {
293 const path = this.getSourceFilePath(name);
294 const info = getFileInfo(this.root, path);
295 if (!info) return createHash("sha256").digest("hex");
296 const {hash} = info;
297 return path === name ? hash : createHash("sha256").update(hash).update(String(info.mtimeMs)).digest("hex");
298 }
299
300 getOutputFileHash(name: string): string {
301 const info = this.getOutputInfo(name);

Callers 6

getModuleHashMethod · 0.95
getModuleResolverMethod · 0.95
resolveImportPathMethod · 0.95
resolveFilePathMethod · 0.95
loader-test.tsFile · 0.80
getResolversFunction · 0.80

Calls 2

getSourceFilePathMethod · 0.95
getFileInfoFunction · 0.85

Tested by

no test coverage detected