( language: string, moduleUrl: string )
| 60 | * @returns `{ wasmFile, wasmPath }` or throws if the language is not curated. |
| 61 | */ |
| 62 | export function resolveGrammarPath( |
| 63 | language: string, |
| 64 | moduleUrl: string |
| 65 | ): { wasmFile: string; wasmPath: string } { |
| 66 | const wasmFile = CURATED_LANGUAGE_TO_WASM[language]; |
| 67 | if (!wasmFile) { |
| 68 | throw new Error(`No curated grammar for language '${language}'.`); |
| 69 | } |
| 70 | |
| 71 | const grammarDir = resolveGrammarDir(moduleUrl); |
| 72 | return { wasmFile, wasmPath: path.join(grammarDir, wasmFile) }; |
| 73 | } |
no test coverage detected