-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What should go into N-API 5? #374
Comments
@devsnek we would like to remove the experimental flag from around all the bigint N-APIs. Can you please give us some real-world usage examples? |
@josephg can you please share with us real-world examples of where it is useful to have the JS function for thread-safe function be optional? We need such use cases to support the argument that this modification be considered stable and released with N-API 5. |
Hey @gabrielschulhof , My real-world example of TSFN with no function callback may be kind of specific, but hopefully generalizable. I'm working on embedding node into a native C++ application. I'm compiled nodejs statically, and linking it to my own executable. I call
My real-world is using the C++ node-addon-api wip ThreadSafeFunction wrapper, but... I do something like:
So, my "embedding node" case is pretty specific, but I can imagine there are other scenarios where people do all the logic in the |
@gabrielschulhof I am not sure what uses it out in the wild but yesterday I wrote this and it worked like a charm https://github.com/devsnek/node/blob/f0e4e469e45bfa5398a881ecb2671529e1a2036b/src/node_wasi.cc I'll try to find more usage around the interweb but it might take a day or two. |
@gabrielschulhof I'm using napi threadsafe function in the foundationdb bindings. Foundationdb queries resolve by calling a registered callback function on a thread owned by FDB. When this happens I need to:
This is fine - I use the |
I added the JS Date-related N-APIs for a couple of reasons. There were a number of threads on the port of node-sqlite to napi talking about Date and Regex functions being missing and workarounds for them being missing. TryGhost/node-sqlite3#830 (comment) I still intend to add support for Rexex, the other missing Object type in napi. Another reasons is a commercial product I work on that would benefit from using these functions for a couple of native add-ons used internally. Also I believe rounding out support for these two basic Object types would be a great addition to the napi. Thanks! |
It appears there is a good amount of ecosystem usage for bigint using this search: https://github.com/search?p=2&q=napi+bigint+-filename%3Atest_bigint.c+-filename%3Abigint.md&type=Code |
Unrelated but @devsnek would you have some time to talk about WASI/N-API? From your example looks like you might have thought about this and I'm looking for some pointer for better understanding the potential longer term overlap or synergy. |
they don't have any specific overlap, I just needed to expose |
@mhdawson if you haven't seen it yet, nodejs/node#27850 has @devsnek's WASI implementation. WASI defines a bunch of system calls that platforms provide to WebAssembly modules. Most of the system calls were able to be implemented using JavaScript and Node's public APIs. |
It’s a bit of an aside but, I’ve long wanted this. If we could combine n-api and wasi, native modules could be put in NPM with prebuilt binaries for all platforms. There’s some solutions at the moment with prebuildify and various CI systems but (hopefully) with wasi + napi we shouldn’t need any extra infrastructure to allow me to build a native module from my Mac laptop and have it work everywhere that nodejs works. |
@nodejs/n-api I think we should also mark |
Initial PR's landed, backports in progress. One backports land, will be one final round of PRs/backports to add add version 5 making the functions stable. |
PR on
We have to land this PR only after we end the backport. |
Everything is landed, just waiting on at SemVer minor release of 10.x to go out. |
I want report that the new the version 10.17.0 is out see: https://nodejs.org/en/blog/release/v10.17.0/ |
@gabrielschulhof given the 10.17.0 release can this be closed? |
N-API 5 has landed in all versions in which it will be supported. Closing. |
@jarrodconnolly we are considering making the JS
Date
-related N-APIs part of the N-API 5 stable release. That is, we are considering moving them out of experimental. Can you please share with us examples of their real-world usage? We do not necessarily need pointers to actual code if it's not open source, but please list any real-world use cases you are aware of!The text was updated successfully, but these errors were encountered: