Giter Club home page Giter Club logo

Comments (14)

Richienb avatar Richienb commented on August 16, 2024 1

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.

uhop avatar uhop commented on August 16, 2024

I am open to suggestions, and working pull requests.

from node-re2.

uhop avatar uhop commented on August 16, 2024

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.

uhop avatar uhop commented on August 16, 2024

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.

viceice avatar viceice commented on August 16, 2024

What the state here now, since node v10 is out of lts?

from node-re2.

uhop avatar uhop commented on August 16, 2024

Not started yet.

from node-re2.

uhop avatar uhop commented on August 16, 2024

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.

uhop avatar uhop commented on August 16, 2024

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.

uhop avatar uhop commented on August 16, 2024

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.

Richienb avatar Richienb commented on August 16, 2024

@uhop Rust WASM supports those things and C++ simultaneously.

from node-re2.

uhop avatar uhop commented on August 16, 2024

What things exactly? Component bindings? I would love to see how.

from node-re2.

Richienb avatar Richienb commented on August 16, 2024

@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.

uhop avatar uhop commented on August 16, 2024

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.

uhop avatar uhop commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.