-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Do NOT deprecate napi_module_register
or explain better the current way to do it (embedding API)
#56153
Comments
cc / @nodejs/node-api |
We discussed in the team meeting today, and the consensus was that the intent of the deprecation was to encourage people to use the new approach versus actually removing the old way. We agreed we'll remove the deprecation flag and then add more examples of using the new approach. @vmoroz volunteered do the first PR to remove the deprecation flag and then explore what added documentation. |
Ok, thank you so much. But you plan to deprecate it in the long term? Same for |
The |
What is the problem this feature will solve?
I have been embedding NodeJS since version 8.x and it has been a nightmare. We have achieved recently a pretty solid and consistent version, which takes advantage of
napi_module_register
for embedding it. In the newest versions (at least 18.x) I realized you are planning to deprecate it:node/src/node_api.h
Line 91 in 7904bc0
Please do not do it, or at least explain how to do it from now. Also, I have seen you plan to deprecate
node::Start
, don't do it neither. I have spent years in order to fully support NodeJS embedding without bugs and in a robust way and you continuously change the API, making it more difficult and forcing me to refactor the whole project. I explained long time ago the methodology I used to embed and I gave some hints here in order to improve it. Right now the only thing I am asking for is to provide backward compatibility with those APIs so I do not have to re-implement it again and again.Here's my first post: #23265 (comment)
We are one of the few solutions to fully embed NodeJS in a production ready environment and commercially, in order to show numbers to see the difficulty of this, this is the difference of lines of code that took me to embed NodeJS, against Python:
NodeJS:
Python:
If we want to be fair, removing NodeJS dependencies:
And support for objects and classes in NodeJS is still incomplete, so it means it even will take more lines of code (around 1k more) to fully implement it. Also, I am not considering other nightmares like packaging
libnode
properly or finding and compiling it for CMake: https://github.com/metacall/core/blob/develop/cmake/FindNodeJS.cmakeWe are using NodeJS right now in a commercial FaaS/BaaS, and this would help a lot in order to keep up to date with latest versions of NodeJS.
What is the feature you are proposing to solve the problem?
Remove the
[[deprecated]]
flag ofnapi_module_register
and mantain backward compatibility for other APIs likenode::Start
, please.Otherwise, give a better solution of how to use it with the current API. I have started to implement it but it's highly incompatible with the old embedding API, here is my attempt:
https://github.com/metacall/core/blob/55a8553a6396f7f0791f8ec3921a2da9ccc05ea6/source/loaders/node_loader/source/node_loader_impl.cpp#L912
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: