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

Function loadModule

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

Source from the content-addressed store, hash-verified

623 setEnvironment(environmentOf(compiler))
624 }
625 const loadModule = (id: string) => {
626 if (id in modules) return modules[id]
627 const dir = storeDirOf()
628 if (!dir) return throwBuildError(writeUnwrittenModuleMessage(id.slice(1)))
629 let stored: [importer: string, code: string]
630 try {
631 stored = JSON.parse(readFileSync(join(dir, storedNameOf(id)), "utf8"))
632 } catch {
633 return throwBuildError(writeUncachedModuleMessage(id.slice(1), dir))
634 }
635 importersById[id] = stored[0]
636 return (modules[id] = stored[1])
637 }
638 // a pruned build's issue features, once its scan has read every validator
639 const issueFeaturesOf = async (context: unknown) => {
640 const built = builtReadOf(context)

Callers 2

handlerFunction · 0.85
unplugin.tsFile · 0.85

Calls 5

throwBuildErrorFunction · 0.90
storeDirOfFunction · 0.85
joinFunction · 0.85
storedNameOfFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected