@@ -197,9 +197,6 @@ unsigned int reverted = 0;
197
197
std::string icu_data_dir; // NOLINT(runtime/string)
198
198
#endif
199
199
200
- // N-API is in experimental state, disabled by default.
201
- bool load_napi_modules = false ;
202
-
203
200
// used by C++ modules as well
204
201
bool no_deprecation = false ;
205
202
@@ -2703,27 +2700,22 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
2703
2700
env->ThrowError (" Module did not self-register." );
2704
2701
return ;
2705
2702
}
2706
- if (mp->nm_version != NODE_MODULE_VERSION) {
2707
- char errmsg[1024 ];
2708
- if (mp->nm_version == -1 ) {
2709
- snprintf (errmsg,
2710
- sizeof (errmsg),
2711
- " The module '%s'"
2712
- " \n was compiled against the ABI-stable Node.js API (N-API)."
2713
- " \n This feature is experimental and must be enabled on the "
2714
- " \n command-line by adding --napi-modules." ,
2715
- *filename);
2716
- } else {
2717
- snprintf (errmsg,
2718
- sizeof (errmsg),
2719
- " The module '%s'"
2720
- " \n was compiled against a different Node.js version using"
2721
- " \n NODE_MODULE_VERSION %d. This version of Node.js requires"
2722
- " \n NODE_MODULE_VERSION %d. Please try re-compiling or "
2723
- " re-installing\n the module (for instance, using `npm rebuild` "
2724
- " or `npm install`)." ,
2725
- *filename, mp->nm_version , NODE_MODULE_VERSION);
2703
+ if (mp->nm_version == -1 ) {
2704
+ if (env->EmitNapiWarning ()) {
2705
+ ProcessEmitWarning (env, " N-API is an experimental feature and could "
2706
+ " change at any time." );
2726
2707
}
2708
+ } else if (mp->nm_version != NODE_MODULE_VERSION) {
2709
+ char errmsg[1024 ];
2710
+ snprintf (errmsg,
2711
+ sizeof (errmsg),
2712
+ " The module '%s'"
2713
+ " \n was compiled against a different Node.js version using"
2714
+ " \n NODE_MODULE_VERSION %d. This version of Node.js requires"
2715
+ " \n NODE_MODULE_VERSION %d. Please try re-compiling or "
2716
+ " re-installing\n the module (for instance, using `npm rebuild` "
2717
+ " or `npm install`)." ,
2718
+ *filename, mp->nm_version , NODE_MODULE_VERSION);
2727
2719
2728
2720
// NOTE: `mp` is allocated inside of the shared library's memory, calling
2729
2721
// `dlclose` will deallocate it
@@ -3822,7 +3814,8 @@ static void PrintHelp() {
3822
3814
" --throw-deprecation throw an exception on deprecations\n "
3823
3815
" --pending-deprecation emit pending deprecation warnings\n "
3824
3816
" --no-warnings silence all process warnings\n "
3825
- " --napi-modules load N-API modules\n "
3817
+ " --napi-modules load N-API modules (no-op - option\n "
3818
+ " kept for compatibility)\n "
3826
3819
" --abort-on-uncaught-exception\n "
3827
3820
" aborting instead of exiting causes a\n "
3828
3821
" core file to be generated for analysis\n "
@@ -4080,7 +4073,7 @@ static void ParseArgs(int* argc,
4080
4073
} else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
4081
4074
no_deprecation = true ;
4082
4075
} else if (strcmp (arg, " --napi-modules" ) == 0 ) {
4083
- load_napi_modules = true ;
4076
+ // no-op
4084
4077
} else if (strcmp (arg, " --no-warnings" ) == 0 ) {
4085
4078
no_process_warnings = true ;
4086
4079
} else if (strcmp (arg, " --trace-warnings" ) == 0 ) {
@@ -4735,11 +4728,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
4735
4728
4736
4729
env.set_trace_sync_io (trace_sync_io);
4737
4730
4738
- if (load_napi_modules) {
4739
- ProcessEmitWarning (&env, " N-API is an experimental feature "
4740
- " and could change at any time." );
4741
- }
4742
-
4743
4731
{
4744
4732
SealHandleScope seal (isolate);
4745
4733
bool more;
0 commit comments