You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a stop-gap for compatibility, I wanted to try and create a module that converts v8/NaN tree-sitter language object (Which is a v8::Object with an internal pointer) to a napi language object (A type tagged Napi::External).
Such a module is technically a classic Node ABI dependent module, so should use the NODE_MODULE way of init so that Node.js will properly block it from loading if built agains't the wrong version, as it is going to use v8/NaN API to access the v8/Nan language object, but then since I don't have a napi_env, I can't create the napi external or use napi at all from such a module.
On the other hand, if I use the NAPI_MODULE, then Node.js will likely agree to load such module across different ABI versions even if it technically depends on a specific Node.js ABI version, but I will have a napi_env and can technically use v8 API from a Node-API module by way of v8::Isolate::GetCurrent and friends.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As a stop-gap for compatibility, I wanted to try and create a module that converts v8/NaN tree-sitter language object (Which is a
v8::Object
with an internal pointer) to a napi language object (A type taggedNapi::External
).Such a module is technically a classic Node ABI dependent module, so should use the
NODE_MODULE
way of init so that Node.js will properly block it from loading if built agains't the wrong version, as it is going to use v8/NaN API to access the v8/Nan language object, but then since I don't have anapi_env
, I can't create the napi external or use napi at all from such a module.On the other hand, if I use the
NAPI_MODULE
, then Node.js will likely agree to load such module across different ABI versions even if it technically depends on a specific Node.js ABI version, but I will have anapi_env
and can technically use v8 API from a Node-API module by way ofv8::Isolate::GetCurrent
and friends.Is there a supported way to create such a module?
Beta Was this translation helpful? Give feedback.
All reactions