MCPcopy Create free account
hub / github.com/arktypeio/arktype / grammarSourceHash

Function grammarSourceHash

ark/tree-sitter/scripts/stamp.ts:12–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11/** A hash of the grammar's sources, recorded beside the .wasm when it's built. */
12export const grammarSourceHash = (): string => {
13 const hash = createHash("sha256")
14 for (const source of sources) hash.update(readFileSync(new URL(source, root)))
15 return hash.digest("hex")
16}
17
18export const isBuildCurrent = (): boolean =>
19 readFileSync(stampPath, "utf8").trim() === grammarSourceHash()

Callers 2

buildGrammar.tsFile · 0.90
isBuildCurrentFunction · 0.85

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected