node-api: include experimental feature flags in add-on version reported at runtime #52935
Labels
feature request
Issues that request new features to be added to Node.js.
node-api
Issues and PRs related to the Node-API.
This only applies to features that change the behaviour of existing APIs.
We currently have two flags for each experimental behaviour-changing API:
NAPI_EXPERIMENTAL
portion of the API.NAPI_EXPERIMENTAL
it does not wish to use this particular feature of the experimental bundle.In order to avoid going down the experimental code path when running an add-on that chose to opt out of an experimental feature, we need to encode that choice in the version reported to the add-on loader.
If
NAPI_EXPERIMENTAL
is defined, all experimental features are turned on, unless, for any given feature, its opt-out flag is given.We can include experimental flags in the version number reported at runtime as follows:
This value ends up on
napi_env
. At runtime we can check against the bits of this value to decide on the code path. We should probably create a family of macros for making decisions based on the feature flags.At our Node-API meeting we concluded that we should introduce behaviour-changing features extremely sparingly, because, in order to ensure we do not break our users, even those that have opted into
NAPI_EXPERIMENTAL
, the testing complexity doubles with each feature we introduce.The text was updated successfully, but these errors were encountered: