@@ -167,9 +167,6 @@ static node_module* modlist_addon;
167
167
static std::string icu_data_dir; // NOLINT(runtime/string)
168
168
#endif
169
169
170
- // N-API is in experimental state, disabled by default.
171
- bool load_napi_modules = false ;
172
-
173
170
// used by C++ modules as well
174
171
bool no_deprecation = false ;
175
172
@@ -2503,22 +2500,17 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
2503
2500
env->ThrowError (" Module did not self-register." );
2504
2501
return ;
2505
2502
}
2506
- if (mp->nm_version != NODE_MODULE_VERSION) {
2507
- char errmsg[1024 ];
2508
- if (mp->nm_version == -1 ) {
2509
- snprintf (errmsg,
2510
- sizeof (errmsg),
2511
- " The module '%s'"
2512
- " \n was compiled against the ABI-stable Node.js API (N-API)."
2513
- " \n This feature is experimental and must be enabled on the "
2514
- " \n command-line by adding --napi-modules." ,
2515
- *filename);
2516
- } else {
2517
- snprintf (errmsg,
2518
- sizeof (errmsg),
2519
- " Module version mismatch. Expected %d, got %d." ,
2520
- NODE_MODULE_VERSION, mp->nm_version );
2503
+ if (mp->nm_version == -1 ) {
2504
+ if (env->EmitNapiWarning ()) {
2505
+ ProcessEmitWarning (env, " N-API is an experimental feature and could "
2506
+ " change at any time." );
2521
2507
}
2508
+ } else if (mp->nm_version != NODE_MODULE_VERSION) {
2509
+ char errmsg[1024 ];
2510
+ snprintf (errmsg,
2511
+ sizeof (errmsg),
2512
+ " Module version mismatch. Expected %d, got %d." ,
2513
+ NODE_MODULE_VERSION, mp->nm_version );
2522
2514
2523
2515
// NOTE: `mp` is allocated inside of the shared library's memory, calling
2524
2516
// `uv_dlclose` will deallocate it
@@ -3733,7 +3725,8 @@ static void PrintHelp() {
3733
3725
" --throw-deprecation throw an exception anytime a deprecated "
3734
3726
" function is used\n "
3735
3727
" --no-warnings silence all process warnings\n "
3736
- " --napi-modules load N-API modules\n "
3728
+ " --napi-modules load N-API modules (no-op - option kept for "
3729
+ " compatibility)\n "
3737
3730
" --trace-warnings show stack traces on process warnings\n "
3738
3731
" --redirect-warnings=path\n "
3739
3732
" write warnings to path instead of stderr\n "
@@ -3980,7 +3973,7 @@ static void ParseArgs(int* argc,
3980
3973
} else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
3981
3974
no_deprecation = true ;
3982
3975
} else if (strcmp (arg, " --napi-modules" ) == 0 ) {
3983
- load_napi_modules = true ;
3976
+ // no-op
3984
3977
} else if (strcmp (arg, " --no-warnings" ) == 0 ) {
3985
3978
no_process_warnings = true ;
3986
3979
} else if (strcmp (arg, " --trace-warnings" ) == 0 ) {
@@ -4879,11 +4872,6 @@ static void StartNodeInstance(void* arg) {
4879
4872
if (instance_data->use_debug_agent ())
4880
4873
EnableDebug (env);
4881
4874
4882
- if (load_napi_modules) {
4883
- ProcessEmitWarning (env, " N-API is an experimental feature "
4884
- " and could change at any time." );
4885
- }
4886
-
4887
4875
{
4888
4876
SealHandleScope seal (isolate);
4889
4877
bool more;
0 commit comments