-
Notifications
You must be signed in to change notification settings - Fork 501
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
Add module initializer with context corresponding to NODE_MODULE_INITIALIZER #844
Comments
Hi @murgatroid99, |
That does look relevant, but it looks like it just ignores the |
@NickNaso are there any plans to resolve this issue or is there anything I could contribute? This one is currently blocking grpc/grpc-node#778 which in turn is causing other trouble further down stream (vercel/next.js#7894) so I would be interested in getting this resolved. |
According to electron/electron#18397, as of Electron 11 this will be required to load all native addons in Electron. Therefore, changing this should be a priority. |
What should that shim/fallback do in your opinion? Add-ons can already obtain the context in their initializer with |
Look, you have this definition: #if NODE_MAJOR_VERSION >= 10 || \
NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3
#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \
extern "C" NODE_MODULE_EXPORT void \
NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \
v8::Local<v8::Object> exports, v8::Local<v8::Value> module, \
v8::Local<v8::Context> context) \
{ \
registration(exports); \
}
That applies to the version range we are interested in, and it discards the Honestly, I was unaware of |
@murgatroid99 Do you want to update the API or the docs? In both cases a pull request is the best way forward. :-) |
I don't know what the right change here is. I'm just a user of this library; that doesn't mean I'm knowledgeable about the nuances of the Node API or its changes across versions. In particular, you say that |
As the one who introduced the original multi-context support in Node: because it seemed like a good idea at the time. :-) |
Node 10 added Context-aware addons, using the
NODE_MODULE_INITIALIZER
. To be able to make such an addon with compatibility with older versions we need a corresponding macro in nan.The text was updated successfully, but these errors were encountered: