Skip to content

Commit 48a44c3

Browse files
author
Gabriel Schulhof
committed
all: update --napi-modules flag to not have a yes/no
This updates the documentation, the error message upon module load failure, the command line option parsing of the flag, and the way the N-API addon tests pass the flag to node. Re nodejs/node#11975 (comment) Re nodejs/node#11975 (comment) Fixes nodejs#184
1 parent b3d806c commit 48a44c3

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

doc/api/cli.md

+7
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ added: v6.0.0
144144

145145
Silence all process warnings (including deprecations).
146146

147+
### `--napi-modules`
148+
<!-- YAML
149+
added: v8.0.0
150+
-->
151+
152+
Load N-API modules.
153+
147154
### `--trace-warnings`
148155
<!-- YAML
149156
added: v6.0.0

doc/node.1

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ Throw errors for deprecations.
119119
.BR \-\-no\-warnings
120120
Silence all process warnings (including deprecations).
121121

122+
.TP
123+
.BR \-\-napi\-modules
124+
Load N-API modules.
125+
122126
.TP
123127
.BR \-\-trace\-warnings
124128
Print stack traces for process warnings (including deprecations).

src/node.cc

+3-6
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,8 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
24712471
sizeof(errmsg),
24722472
"The module '%s'"
24732473
"\nwas compiled against the Node.js API. This feature is "
2474-
"\nexperimental and must be enabled on the command-line.",
2474+
"\nexperimental and must be enabled on the command-line by "
2475+
"\nadding --napi-modules.",
24752476
*filename);
24762477
} else {
24772478
snprintf(errmsg,
@@ -3548,7 +3549,7 @@ static void PrintHelp() {
35483549
" --trace-deprecation show stack traces on deprecations\n"
35493550
" --throw-deprecation throw an exception on deprecations\n"
35503551
" --no-warnings silence all process warnings\n"
3551-
" --napi-modules[=yes|no] load N-API modules (default no)\n"
3552+
" --napi-modules load N-API modules\n"
35523553
" --trace-warnings show stack traces on process warnings\n"
35533554
" --redirect-warnings=path\n"
35543555
" write warnings to path instead of\n"
@@ -3721,10 +3722,6 @@ static void ParseArgs(int* argc,
37213722
no_deprecation = true;
37223723
} else if (strcmp(arg, "--napi-modules") == 0) {
37233724
load_napi_modules = true;
3724-
} else if (strcmp(arg, "--napi-modules=yes") == 0) {
3725-
load_napi_modules = true;
3726-
} else if (strcmp(arg, "--napi-modules=no") == 0) {
3727-
load_napi_modules = false;
37283725
} else if (strcmp(arg, "--no-warnings") == 0) {
37293726
no_process_warnings = true;
37303727
} else if (strcmp(arg, "--trace-warnings") == 0) {

test/addons-napi/testcfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
import testpy
44

55
def GetConfiguration(context, root):
6-
return testpy.AddonTestConfiguration(context, root, 'addons-napi', ['--napi-modules=yes'])
6+
return testpy.AddonTestConfiguration(context, root, 'addons-napi', ['--napi-modules'])

0 commit comments

Comments
 (0)