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

Function findAotViaRequire

ark/type/cli.ts:378–395  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

376}
377
378const findAotViaRequire = (cwd: string): FoundAotPackage | undefined => {
379 const req = createRequire(join(resolve(cwd), "package.json"))
380 try {
381 const found = findAotManifest(dirname(req.resolve("@ark/aot")))
382 if (found) return found
383 } catch {
384 // fall back to resolving package.json directly when root entry isn't available
385 }
386 try {
387 const pkgPath = req.resolve("@ark/aot/package.json")
388 const pkgDir = dirname(pkgPath)
389 const manifest = readManifest(pkgDir)
390 if (manifest) return { pkgDir, manifest }
391 } catch {
392 return undefined
393 }
394 return undefined
395}
396
397const resolveAotCli = (cwd: string): string | undefined => {
398 // Yarn PnP has no node_modules on disk; resolve through Node's module hooks

Callers 1

resolveAotCliFunction · 0.85

Calls 5

joinFunction · 0.85
findAotManifestFunction · 0.85
readManifestFunction · 0.85
resolveFunction · 0.70
resolveMethod · 0.65

Tested by

no test coverage detected