feat!: update bindings
This commit is contained in:
committed by
Michael Hoffmann
parent
41a2e70241
commit
8b209bbb95
2
bindings/node/binding.cc
generated
2
bindings/node/binding.cc
generated
@@ -16,4 +16,4 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
return exports;
|
||||
}
|
||||
|
||||
NODE_API_MODULE(tree_sitter_PARSER_NAME_binding, Init)
|
||||
NODE_API_MODULE(tree_sitter_hcl_binding, Init)
|
||||
|
||||
8
bindings/node/binding_test.js
generated
8
bindings/node/binding_test.js
generated
@@ -1,9 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
const assert = require("node:assert");
|
||||
const { test } = require("node:test");
|
||||
|
||||
const Parser = require("tree-sitter");
|
||||
|
||||
test("can load grammar", () => {
|
||||
const parser = new (require("tree-sitter"))();
|
||||
const parser = new Parser();
|
||||
assert.doesNotThrow(() => parser.setLanguage(require(".")));
|
||||
});
|
||||
});
|
||||
|
||||
8
bindings/node/index.js
generated
8
bindings/node/index.js
generated
@@ -1,7 +1,11 @@
|
||||
const root = require("path").join(__dirname, "..", "..");
|
||||
|
||||
module.exports = require("node-gyp-build")(root);
|
||||
module.exports =
|
||||
typeof process.versions.bun === "string"
|
||||
// Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time
|
||||
? require(`../../prebuilds/${process.platform}-${process.arch}/tree-sitter-hcl.node`)
|
||||
: require("node-gyp-build")(root);
|
||||
|
||||
try {
|
||||
module.exports.nodeTypeInfo = require("../../src/node-types.json");
|
||||
} catch (_) {}
|
||||
} catch (_) {}
|
||||
|
||||
Reference in New Issue
Block a user