MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readGrammarWasmBytes

Function readGrammarWasmBytes

src/extraction/grammars.ts:380–393  ·  view source on GitHub ↗
(languages: Language[])

Source from the content-addressed store, hash-verified

378 * disk load (which surfaces the real error/warning path).
379 */
380export async function readGrammarWasmBytes(languages: Language[]): Promise<Record<string, Uint8Array>> {
381 const out: Record<string, Uint8Array> = {};
382 const toRead = [...new Set(expandGrammarLanguages(languages))].filter(
383 (lang): lang is GrammarLanguage => lang in WASM_GRAMMAR_FILES
384 );
385 for (const lang of toRead) {
386 try {
387 out[lang] = await fsp.readFile(resolveWasmPath(lang));
388 } catch {
389 // fall through — the worker's own load reports the failure
390 }
391 }
392 return out;
393}
394
395/**
396 * Load grammar WASM files for specific languages only.

Callers 2

indexAllMethod · 0.90

Calls 3

expandGrammarLanguagesFunction · 0.85
resolveWasmPathFunction · 0.85
readFileMethod · 0.80

Tested by

no test coverage detected