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

Function isArkFile

ark/aot/nextProgram.ts:626–637  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

624// arktype's own, which a linked install resolves out of node_modules, and the
625// read doesn't follow as its modules never import a program's
626export const isArkFile = (id: string): boolean => {
627 for (let dir = dirname(id); ; dir = dirname(dir)) {
628 const manifest = join(dir, "package.json")
629 if (existsSync(manifest)) {
630 return arkPackageName.test(
631 parsePackageManifest(readFileSync(manifest, "utf8"), manifest).name ??
632 ""
633 )
634 }
635 if (dir === dirname(dir)) return false
636 }
637}
638
639export const isSourceRead = (answer: ProgramAnswer, source: string): boolean =>
640 answer.sourceHash === hashOf(source)

Callers 1

answerFromProgramFunction · 0.90

Calls 3

parsePackageManifestFunction · 0.90
joinFunction · 0.85
testMethod · 0.80

Tested by

no test coverage detected