(key: string)
| 108 | * @throws If the language key is not recognized. |
| 109 | */ |
| 110 | export function getWasmPath(key: string): string { |
| 111 | if (key === 'runtime') { |
| 112 | return join(getWasmDir(), 'web-tree-sitter.wasm'); |
| 113 | } |
| 114 | const file = WASM_FILES[key]; |
| 115 | if (!file) { |
| 116 | throw new Error( |
| 117 | `Unknown language "${key}". Supported: ${SUPPORTED_LANGUAGES.join(', ')}, runtime`, |
| 118 | ); |
| 119 | } |
| 120 | return join(getWasmDir(), file); |
| 121 | } |