N-API version of bindings
N-API is a new, more portable way of creating Nodejs bindings : https://nodejs.org/api/n-api.html
Does it make sense porting node-tree-sitter from NAN to NAPI ?
The main benefit of NAPI is no need for parser recompilation when running on node 6, 8, 10, 11+ I have to use Node 8 everywhere because Atom using Node 8, and I want to use parser inside and outside of the Atom.
I have the same problems in Visual Studio Code. It's really tedious use it in vscode :(
there is apparently a napi branch in this repo which I was able to build but I am using the query API which seems to have been added after. I will reply again if I add NAPI bindings for the query API in a fork
EDIT: it's not done but here in case it helps anyone: https://github.com/michaelBelousov/node-tree-sitter/tree/napi-with-query-api
can confirm my fork works for my parser and query API usage, and I've made a format for NAPI-compiled languages to be unwrapped and tested with a tiny alternate NAPI-bindings for tree-sitter-sql.
This works very well for me when developing a visual studio code extension. I use prebuildify to build against electron and (I haven't tried cross-compiling yet) for multiple platforms. If someone else needs this, I can put the work into a pull request targeting the napi branch in this repository. My fork merged the tip of master as well so it is a more up-to-date version of the napi branch here.