MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / loadCompiler

Function loadCompiler

graph-ui/tools/lib/compiler-bundle.mjs:42–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40 * which Node has had since 18.
41 */
42export async function loadCompiler() {
43 const esbuild = await import('esbuild');
44 await rm(BUNDLE_DIR, { recursive: true, force: true });
45 await mkdir(BUNDLE_DIR, { recursive: true });
46 const result = await esbuild.build({
47 entryPoints: [join(ROOT, 'src', 'compiler', 'eval-entry.ts')],
48 outfile: BUNDLE_FILE,
49 bundle: true,
50 format: 'esm',
51 platform: 'neutral',
52 target: 'node20',
53 mainFields: ['module', 'main'],
54 conditions: ['node', 'import'],
55 logLevel: 'silent',
56 metafile: true,
57 });
58 const inputs = Object.keys(result.metafile?.inputs ?? {}).length;
59 /*
60 * esbuild keeps a helper process alive after a build and Node will not exit
61 * while it is there. Measured, not guessed: without this line the eval sits
62 * at 100 percent done with an idle `esbuild --service --ping` beside it and
63 * never returns. A tool that has finished must end.
64 */
65 await esbuild.stop();
66 const module = await import(pathToFileURL(BUNDLE_FILE).href);
67 return { module, inputs };
68}

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 2

keysMethod · 0.80
stopMethod · 0.65

Tested by

no test coverage detected