mafintosh / mafintosh/napi-macros

Context-aware addons

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
65
Forks
7
PR merge metrics
No merged PRs in 30d

Description

With the `worker_threads` experimental flag being [removed](https://github.com/nodejs/node/commit/63d4cae009e114127e1a80644e4bffc019e2f4a7), I figure context-aware addons will become more necessary soon. Would a simple macro like:

``` c
#define NAPI_INIT_CONTEXT_AWARE() \
static void napi_macros_init(napi_env env, napi_value exports); \
NAPI_MODULE_INIT() { \
napi_macros_init(env, exports); \
return exports; \
} \
static void napi_macros_init (napi_env env, napi_value exports)
```

be reasonable to add? [source](https://nodejs.org/api/n-api.html#n_api_module_registration)

I suppose it seems needless since the NAPI_MODULE_INIT macro is already pretty handy by itself, but maybe adding it for consistency with NAPI_INIT is worth it?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the N-API module registration documentation and compare the existing NAPI_MODULE_INIT and NAPI_INIT macros. Determine whether a context-aware macro is needed and what its supported API shape should be; the work is done when the project has agreed on a clear macro design and implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, node.js
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.