tree-sitter/lib/binding_web/test/helper.js
Amaan Qureshi 99b93d83a1 feat(cli)!: add a separate build command to compile parsers
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.
2024-03-17 05:36:30 -04:00

15 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')),
}));