MCPcopy Create free account
hub / github.com/Effect-TS/effect / load

Function load

packages/tools/doctest/src/Plugin.ts:91–110  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

89 return this.resolve(source, parent.file, { ...options, skipSelf: true })
90 },
91 load(id) {
92 const loaded = Protocol.resolvedRequest(id)
93 if (loaded === undefined) {
94 return null
95 }
96
97 this.addWatchFile(loaded.file)
98 return loadExamples(loaded.file, loaded.version).then((snippets) => {
99 if (loaded.kind === "collector") {
100 return collectorModule(loaded.file, snippets, loaded.version)
101 }
102
103 const snippet = loaded.index === undefined ? undefined : snippets[loaded.index]
104 if (snippet === undefined) {
105 throw new Error(`Unknown documentation snippet module '${id}'`)
106 }
107
108 return transform(snippet.source, loaded.file, snippet.line)
109 })
110 },
111 watchChange(id) {
112 const normalized = normalizePath(id)
113 for (const file of store.keys()) {

Callers

nothing calls this directly

Calls 3

transformFunction · 0.90
loadExamplesFunction · 0.85
collectorModuleFunction · 0.85

Tested by

no test coverage detected