@@ -193,9 +193,6 @@ unsigned int reverted = 0;
193
193
std::string icu_data_dir; // NOLINT(runtime/string)
194
194
#endif
195
195
196
- // N-API is in experimental state, disabled by default.
197
- bool load_napi_modules = false ;
198
-
199
196
// used by C++ modules as well
200
197
bool no_deprecation = false ;
201
198
@@ -2650,27 +2647,22 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
2650
2647
env->ThrowError (" Module did not self-register." );
2651
2648
return ;
2652
2649
}
2653
- if (mp->nm_version != NODE_MODULE_VERSION) {
2654
- char errmsg[1024 ];
2655
- if (mp->nm_version == -1 ) {
2656
- snprintf (errmsg,
2657
- sizeof (errmsg),
2658
- " The module '%s'"
2659
- " \n was compiled against the ABI-stable Node.js API (N-API)."
2660
- " \n This feature is experimental and must be enabled on the "
2661
- " \n command-line by adding --napi-modules." ,
2662
- *filename);
2663
- } else {
2664
- snprintf (errmsg,
2665
- sizeof (errmsg),
2666
- " The module '%s'"
2667
- " \n was compiled against a different Node.js version using"
2668
- " \n NODE_MODULE_VERSION %d. This version of Node.js requires"
2669
- " \n NODE_MODULE_VERSION %d. Please try re-compiling or "
2670
- " re-installing\n the module (for instance, using `npm rebuild` "
2671
- " or `npm install`)." ,
2672
- *filename, mp->nm_version , NODE_MODULE_VERSION);
2650
+ if (mp->nm_version == -1 ) {
2651
+ if (env->EmitNapiWarning ()) {
2652
+ ProcessEmitWarning (env, " N-API is an experimental feature and could "
2653
+ " change at any time." );
2673
2654
}
2655
+ } else if (mp->nm_version != NODE_MODULE_VERSION) {
2656
+ char errmsg[1024 ];
2657
+ snprintf (errmsg,
2658
+ sizeof (errmsg),
2659
+ " The module '%s'"
2660
+ " \n was compiled against a different Node.js version using"
2661
+ " \n NODE_MODULE_VERSION %d. This version of Node.js requires"
2662
+ " \n NODE_MODULE_VERSION %d. Please try re-compiling or "
2663
+ " re-installing\n the module (for instance, using `npm rebuild` "
2664
+ " or `npm install`)." ,
2665
+ *filename, mp->nm_version , NODE_MODULE_VERSION);
2674
2666
2675
2667
// NOTE: `mp` is allocated inside of the shared library's memory, calling
2676
2668
// `uv_dlclose` will deallocate it
@@ -3769,7 +3761,8 @@ static void PrintHelp() {
3769
3761
" --throw-deprecation throw an exception on deprecations\n "
3770
3762
" --pending-deprecation emit pending deprecation warnings\n "
3771
3763
" --no-warnings silence all process warnings\n "
3772
- " --napi-modules load N-API modules\n "
3764
+ " --napi-modules load N-API modules (no-op - option\n "
3765
+ " kept for compatibility)\n "
3773
3766
" --abort-on-uncaught-exception\n "
3774
3767
" aborting instead of exiting causes a\n "
3775
3768
" core file to be generated for analysis\n "
@@ -4027,7 +4020,7 @@ static void ParseArgs(int* argc,
4027
4020
} else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
4028
4021
no_deprecation = true ;
4029
4022
} else if (strcmp (arg, " --napi-modules" ) == 0 ) {
4030
- load_napi_modules = true ;
4023
+ // no-op
4031
4024
} else if (strcmp (arg, " --no-warnings" ) == 0 ) {
4032
4025
no_process_warnings = true ;
4033
4026
} else if (strcmp (arg, " --trace-warnings" ) == 0 ) {
@@ -4665,11 +4658,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
4665
4658
4666
4659
env.set_trace_sync_io (trace_sync_io);
4667
4660
4668
- if (load_napi_modules) {
4669
- ProcessEmitWarning (&env, " N-API is an experimental feature "
4670
- " and could change at any time." );
4671
- }
4672
-
4673
4661
{
4674
4662
SealHandleScope seal (isolate);
4675
4663
bool more;
0 commit comments