@@ -197,9 +197,6 @@ unsigned int reverted = 0;
197197std::string icu_data_dir; // NOLINT(runtime/string)
198198#endif
199199
200- // N-API is in experimental state, disabled by default.
201- bool load_napi_modules = false ;
202-
203200// used by C++ modules as well
204201bool no_deprecation = false ;
205202
@@ -2703,27 +2700,22 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
27032700 env->ThrowError (" Module did not self-register." );
27042701 return ;
27052702 }
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." );
27262707 }
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);
27272719
27282720 // NOTE: `mp` is allocated inside of the shared library's memory, calling
27292721 // `dlclose` will deallocate it
@@ -3822,7 +3814,8 @@ static void PrintHelp() {
38223814 " --throw-deprecation throw an exception on deprecations\n "
38233815 " --pending-deprecation emit pending deprecation warnings\n "
38243816 " --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 "
38263819 " --abort-on-uncaught-exception\n "
38273820 " aborting instead of exiting causes a\n "
38283821 " core file to be generated for analysis\n "
@@ -4080,7 +4073,7 @@ static void ParseArgs(int* argc,
40804073 } else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
40814074 no_deprecation = true ;
40824075 } else if (strcmp (arg, " --napi-modules" ) == 0 ) {
4083- load_napi_modules = true ;
4076+ // no-op
40844077 } else if (strcmp (arg, " --no-warnings" ) == 0 ) {
40854078 no_process_warnings = true ;
40864079 } else if (strcmp (arg, " --trace-warnings" ) == 0 ) {
@@ -4735,11 +4728,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
47354728
47364729 env.set_trace_sync_io (trace_sync_io);
47374730
4738- if (load_napi_modules) {
4739- ProcessEmitWarning (&env, " N-API is an experimental feature "
4740- " and could change at any time." );
4741- }
4742-
47434731 {
47444732 SealHandleScope seal (isolate);
47454733 bool more;
0 commit comments