mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-12 08:26:20 -04:00
This allows users to build parsers without having to run `test` or `parse` to invoke the compilation process, and allows them to output the object file to wherever they like. The `build-wasm` command was merged into this by just specifying the `--wasm` flag.
16 lines
548 B
JavaScript
16 lines
548 B
JavaScript
const Parser = require(`..`);
|
|
|
|
function languageURL(name) {
|
|
return require.resolve(`../../../target/release/tree-sitter-${name}.wasm`);
|
|
}
|
|
|
|
module.exports = Parser.init().then(async () => ({
|
|
Parser,
|
|
languageURL,
|
|
EmbeddedTemplate: await Parser.Language.load(languageURL('embedded-template')),
|
|
HTML: await Parser.Language.load(languageURL('html')),
|
|
JavaScript: await Parser.Language.load(languageURL('javascript')),
|
|
JSON: await Parser.Language.load(languageURL('json')),
|
|
Python: await Parser.Language.load(languageURL('python')),
|
|
}));
|