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
node-api: segregate pure and non-pure APIs via type system
We define a new type called `node_api_pure_env` as the `const` version
of `napi_env` and `node_api_pure_finalize` as a variant of
`napi_finalize` that accepts a `node_api_pure_env` as its first
argument.
We then modify those APIs which do not affect GC state as accepting a
`node_api_pure_env`. APIs accepting finalizer callbacks are modified to
accept `node_api_pure_finalize` callbacks. Thus, the only way to attach
a `napi_finalize` callback, wherein Node-APIs affecting GC state may be
called is to call `node_api_post_finalizer` from a
`node_api_pure_finalize` callback.
In keeping with the process of introducing new Node-APIs, this feature
is guarded by `NAPI_EXPERIMENTAL`. Additionally, and since this feature
modifies APIs already marked as stable, it is additionally guared by
`NODE_API_EXPERIMENTAL_PURE_ENV`, so as to provide a further buffer to
adoption. Nevertheless, both guards must be removed upon releasing a
new version of Node-API.
0 commit comments