(t)
| 29 | |
| 30 | const SPECIAL = { csharp: 'c_sharp', 'c#': 'c_sharp' }; |
| 31 | function resolveWasm(t) { |
| 32 | if (t.endsWith('.wasm')) return existsSync(t) ? t : fail(2, `wasm not found: ${t}`); |
| 33 | const base = SPECIAL[t.toLowerCase()] ?? t.toLowerCase(); |
| 34 | try { return require.resolve(`tree-sitter-wasms/out/tree-sitter-${base}.wasm`); } catch { /* try vendored */ } |
| 35 | const vendored = `src/extraction/wasm/tree-sitter-${base}.wasm`; |
| 36 | if (existsSync(vendored)) return vendored; |
| 37 | return fail(2, `no grammar for "${t}" — not in tree-sitter-wasms and not vendored`); |
| 38 | } |
| 39 | |
| 40 | const wasmPath = resolveWasm(token); |
| 41 | const source = readFileSync(sample, 'utf8'); |
no test coverage detected