()
| 32 | let initialized = false; |
| 33 | |
| 34 | async function ensureInit(): Promise<void> { |
| 35 | if (initialized) return; |
| 36 | const wasmBuf = await readFile(join(PUBLIC_DIR, 'web-tree-sitter.wasm')); |
| 37 | await Parser.init({ |
| 38 | locateFile: () => join(PUBLIC_DIR, 'web-tree-sitter.wasm'), |
| 39 | wasmBinary: wasmBuf, |
| 40 | }); |
| 41 | initialized = true; |
| 42 | } |
| 43 | |
| 44 | async function loadLanguage(wasmFile: string): Promise<Language> { |
| 45 | const buf = await readFile(join(PUBLIC_DIR, wasmFile)); |
no test coverage detected