nodejs / abi-stable-node

Repository used by the Node-API team to manage work related to Node-API and node-addon-api
239 stars 47 forks source link

hermes/jsi/N-API #379

Closed mhdawson closed 5 years ago

mhdawson commented 5 years ago

Wondering if there is any scope for interop for native modules. Maybe that does not make sense in the context of hermes but worth thinking about.

mhdawson commented 5 years ago

@willholen I seen you committed the first version of jsi.

I was wondering if you'd looked at N-API (and more specifically the JavaScript generic part (https://github.com/nodejs/node/blob/master/src/js_native_api.h) and the corresponding C++ wrapper https://github.com/nodejs/node-addon-api

Just wondering in the context of a path to re-use of existing native modules, but have not read enough about hermes to know if that makes any sense.

mhorowitz commented 5 years ago

Hi. @willholen asked me to comment on this issue.

We began work on the precursor to JSI in 2017. I vaguely recall N-API coming up, but at the time it was either not yet announced, or still very new. We also didn't expect at the time that JSI would become a public API like it is today.

For context, Hermes is designed for mobile use cases, such as React Native. This involves a different set of tradeoffs and requirements than running in server environments, so I don't expect to see demand for reuse of native modules between Node.js and React Native or other consumers of Hermes.

That said, it could happen. If someone should want to do this, I don't think it would be difficult to implement a wrapper to use N-API modules with Hermes, or to use JSI with Node. I'd be happy to discuss more if the need arises.

mhdawson commented 5 years ago

Thanks for the context, if native modules are not going to be re-used in Hermes then seems less important. Will close this issue for now and we can see if it would make sense at some point in the future.