-
Notifications
You must be signed in to change notification settings - Fork 30k
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
node-api: remove deprecated attribute from napi_module_register #56162
node-api: remove deprecated attribute from napi_module_register #56162
Conversation
Review requested:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56162 +/- ##
==========================================
- Coverage 88.00% 88.00% -0.01%
==========================================
Files 656 656
Lines 189103 189103
Branches 35999 36004 +5
==========================================
- Hits 166421 166413 -8
+ Misses 15860 15856 -4
- Partials 6822 6834 +12 |
IMO, the comments should also be removed, as they might create confusion. @vmoroz
|
No, the method is deprecated. We do not recommend to use it in future for any new Node-API modules. In the referenced issue #56153 it is used for embedded scenarios and we cannot offer any alternative to its behaviour in such case until the new C-based embedding API is completed. After that we may try to add the The main reason to remove the |
Thanks for the clarification! @vmoroz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I would like to go back to review the Considering that we want to discuss the future of the |
Please keep backwards compatibility. You must consider having a C unstable API is a huge headache for embedders. Normally C APIs like CPython or CRuby.. remain stable during years. Even multiple libraries are ABI stable during a lot of years. Also keep backwards compatibility for APIs like This kind of behavior is acceptable in JavaScript but it is not in C/C++. At least keep them for backward compatibility. It won't hurt anybody, and deprecation will. |
The As for the ABI-stable Node-APIs, when the API evolves, we can deprecate some old APIs as long as any previously compiled modules continue to work without issues. The newly compiled code will produce a warning for the deprecated functions and supposed to be changed to use the new recommended APIs. It is a normal process that you often find in other big systems. Why did we deprecate the It also coincided with adding ability to specify Node-API version used by modules. All modules that do not provide a well defined functions to return Node-API version are going to use the Node-API version 8 - the version we had when we implemented the change. The change went painless for all developers who used the recommended module registration macros. Unfortunately or fortunately, the The only difference between the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The original intention is not removing this method for ABI stability guarantees. It was just that encoraging using the new napi_register_module_vX
symbols based approach to register the module.
This method will not be removed in the original intention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Landed in ca69d0a |
This PR targets to addresses the issue #56153 by removing the
[[deprecated]]
attribute from thenapi_module_register
function.The code described in the issue does not use the
napi_module_register
function as it was intended from a module shared library. Instead, it uses it to register modules for embedding scenarios. While it was never the intended use, we currently do not have a better approach to register modules beforeEnvironment
is created until we complete the new embedding API - PR #54660.We discussed the issue in the Node-API meeting on Dec 6th 2024, and decided that the quickest and the least intrusive way to address it is to remove the
[[deprecated]]
attribute from thenapi_module_register
function for now.