From 89e04209c9fa699bfeda532c214c6cd165e43ea5 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 10 Nov 2024 16:48:39 -0800 Subject: [PATCH] feat(node): support single-file executables via `bun build --compile` --- bindings/node/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bindings/node/index.js b/bindings/node/index.js index 45f72986..0ef5f809 100644 --- a/bindings/node/index.js +++ b/bindings/node/index.js @@ -1,6 +1,10 @@ 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-typescript.node`) + : require("node-gyp-build")(root); try { module.exports.typescript.nodeTypeInfo = require("../../typescript/src/node-types.json");