Comments (14)
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
from node-re2.
I am open to suggestions, and working pull requests.
from node-re2.
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.
from node-re2.
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.
from node-re2.
What the state here now, since node v10 is out of lts?
from node-re2.
Not started yet.
from node-re2.
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!
from node-re2.
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.
from node-re2.
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.
from node-re2.
@uhop Rust WASM supports those things and C++ simultaneously.
from node-re2.
What things exactly? Component bindings? I would love to see how.
from node-re2.
@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
from node-re2.
It is nice to know that somebody took care of things for me. I will be cheering for that projects on sidelines.
from node-re2.
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.
from node-re2.
Related Issues (20)
- getting ERR_DLOPEN_FAILED after running re2 on alpine docker HOT 15
- Replace provide different results for node-re2 / re2j / re2js / golang HOT 1
- 1.20.1 verification has failed HOT 3
- Bug in var RE2 = require("re2"); HOT 4
- Node unable to import re2 HOT 4
- Flags passed as a separate argument will be lost if pattern is a regexp literal HOT 1
- Error compiling on Node.js HOT 6
- arm64 Linux prebuilts HOT 20
- matchAll and replaceAll scale nonlinearly HOT 10
- Fails to import re2.node with when installing in node:20.9 arm alpine HOT 7
- Much slower install time on node v20 HOT 3
- New nonbacktracking algorithm for lookbehinds and lookarounds HOT 5
- exec() on a Buffer returns incorrect index
- Can't install package with bun HOT 4
- Some Occurance operators seem to error HOT 2
- Ship prebuilt binaries using optionalDependencies instead of install script HOT 3
- Memory usage regression in 1.21 HOT 6
- Make internal data garbage-collectable HOT 9
- Regression in 1.21.2 HOT 1
- Release arm64 linux-musl prebuilts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-re2.