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.
15 lines
548 B
JavaScript
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')),
|
|
}));
|