MCPcopy Create free account
hub / github.com/dailydotdev/apps / loadModule

Function loadModule

packages/world-cli/src/load.js:14–26  ·  view source on GitHub ↗
(file, suppliedSource)

Source from the content-addressed store, hash-verified

12let revision = 0;
13
14export async function loadModule(file, suppliedSource) {
15 const source = suppliedSource ?? (await readFile(file, 'utf8'));
16 revision += 1;
17 const url = `${pathToFileURL(file).href}?v=${revision}`;
18 try {
19 const mod = await import(url);
20 return { source, module: mod, error: null };
21 } catch (error) {
22 /* A syntax error here is the author's, not ours, and the stack is the only
23 thing that says which line. Passed through rather than summarised. */
24 return { source, module: null, error };
25 }
26}

Callers 2

rebuildFileFunction · 0.90
runCheckFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected