Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms).
(lang: GrammarLanguage)
| 342 | |
| 343 | /** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */ |
| 344 | function resolveWasmPath(lang: GrammarLanguage): string { |
| 345 | const wasmFile = WASM_GRAMMAR_FILES[lang]; |
| 346 | return VENDORED_WASM_LANGS.has(lang) |
| 347 | ? path.join(__dirname, 'wasm', wasmFile) |
| 348 | : require.resolve(`tree-sitter-wasms/out/${wasmFile}`); |
| 349 | } |
| 350 | |
| 351 | /** |
| 352 | * Expand an index set's languages to the grammars actually needed to parse it. |
no test coverage detected