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
I stumbled upon this by accident, while in the middle of overhauling some of the internals of cmake-js. This is a much nicer method than having to download the headers for some arbitrary version of nodejs.
With a bit of work, I even managed to avoid needing to source a copy of node.lib. Using the symbols information it is possible to generate a compatible version without much difficulty.
This removes all the downloads that cmake-js used to perform during a build targetting node-api. It also makes me happier about the safety of using node-api as the non node-api headers are no longer available to be included accidentally.
Hi @Julusian,
I like to hear your feedback. We created node-api-headers to allow the build of native addon without download all the headers for a specific version of Node.js. This is possible because Node-API is an ABI stable API and it's independent from any Node.js version what matters is the version of Node-API.
Node-API has some experimental API that are not part of any version because they are not considered stable. We removed from the headers the features e / o functions that are under NAPI_EXPERIMENTAL so this means that if a developer set the NAPI_EXPERIMENTAL flag he will obtain a compilation error.
I don't know if this could be a problem, but I want to discuss at the next Node-API meeting https://github.com/nodejs/abi-stable-node#meeting. If you have time and want to join us it will be a pleasure to discuss about this together.
My idea is to use the original Node-API's headers (without removing the experimental feature) and add a new section named EXPERIMENTAL in the symbol.js like reported below:
EXPERIMENTAL: {js_native_api_symbols: [// List of symbols in js_native_api.h considered experimental.],node_api_symbols: [// List of symbols in node_api.h considered experimental.]}
Activity
mhdawson commentedon Jul 30, 2021
+1
Julusian commentedon Jun 5, 2022
@NickNaso Thank you for creating this!
I stumbled upon this by accident, while in the middle of overhauling some of the internals of cmake-js. This is a much nicer method than having to download the headers for some arbitrary version of nodejs.
With a bit of work, I even managed to avoid needing to source a copy of
node.lib. Using the symbols information it is possible to generate a compatible version without much difficulty.This removes all the downloads that cmake-js used to perform during a build targetting node-api. It also makes me happier about the safety of using node-api as the non node-api headers are no longer available to be included accidentally.
NickNaso commentedon Jun 6, 2022
Hi @Julusian,
I like to hear your feedback. We created
node-api-headersto allow the build of native addon without download all the headers for a specific version of Node.js. This is possible because Node-API is an ABI stable API and it's independent from any Node.js version what matters is the version of Node-API.Node-API has some experimental API that are not part of any version because they are not considered stable. We removed from the headers the features e / o functions that are under
NAPI_EXPERIMENTALso this means that if a developer set theNAPI_EXPERIMENTALflag he will obtain a compilation error.I don't know if this could be a problem, but I want to discuss at the next Node-API meeting https://github.com/nodejs/abi-stable-node#meeting. If you have time and want to join us it will be a pleasure to discuss about this together.
My idea is to use the original Node-API's headers (without removing the experimental feature) and add a new section named
EXPERIMENTALin thesymbol.jslike reported below: