node-re2
node-re2 copied to clipboard
A port that doesn't rely on node-gyp?
Node-gyp can be quite a pain to use on Windows.
Is it possible to make it node-gyp independent?
I am open to suggestions, and working pull requests.
It looks like this question is more properly addressed to Node developers. There is so-called N-API, which may be better suited for Windows. It is deemed "stable", but only in the latest versions of Node.
Now with Node 6 is out of LTS we are closer to implement re2
with N-API. The doc still has quite a few sections marked "Experimental" (for example, "Life Cycle") yet we can start exploring.
What the state here now, since node v10 is out of lts?
Not started yet.
We can just use Wasm. This way, it will always be supported in Node.js and browsers will support it too. https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
All good ideas. Just keep in mind:
- The existing code uses the only bindings available at the time of creation: C++ with Nan using node-gyp.
- N-API is a C bindings, which requires rewriting the binding code.
- Let me stress: it is not a matter of "recompile and it just works".
- WASM is used to run programs compiled from other languages to a specific target.
-
re2
is a component, a class, not a complete runnable program. - There are no bindings to interface JavaScript objects or impersonate them.
-
I was assured that the proper WASM bindings are coming, but so far I didn't see them even in the alpha stage. Given that the main driving force behind WASM were Mozilla guys, I worry that their efforts will be delayed significantly by the recent Mozilla reorg.
Required reading:
But I love to be proven wrong, and, as always, patches are welcome!
Another thing to throw in the pile of possible ports: deno support. It is supposed to provide a way to add extensions based on Rust (another Mozilla technology) and it should support WebAssembly in some form. So far nothing was made public, but it is clearly coming at some point.
Yet another thought: the original premise ("Node-gyp can be quite a pain to use on Windows") is more-or-less obsolete now. Starting with 1.14 re2
pre-builds binaries for multiple platforms including Mac and Windows. It is conceivable to use re2
on Windows without installing Python and the C++ toolchain.
It makes the Deno support more interesting for a simple reason: it is a completely unsupported platform, while other ways to support Node are largely irrelevant for end users — after setting it up once there is no difference how re2
was compiled.
@uhop Rust WASM supports those things and C++ simultaneously.
What things exactly? Component bindings? I would love to see how.
@uhop Most of the re2 binding logic has already been done in https://github.com/nickdesaulniers/rust-re2. All we need to do is add type declarations. https://rustwasm.github.io/docs/wasm-bindgen/contributing/design/exporting-rust-struct.html?highlight=exporting,struct#exporting-a-struct-to-js
It is nice to know that somebody took care of things for me. I will be cheering for that projects on sidelines.
It looks like alternative ways to build a binary extensions are more mature now. Specifically WASM looks like an interesting option.
Closing this issues for two reasons:
- There are alternative projects based on WASM.
- All chrome code that bridges RE2 with JS should be rewritten, which requires a new project.