@@ -236,6 +236,11 @@ bool trace_warnings = false;
236236// that is used by lib/module.js
237237bool config_preserve_symlinks = false ;
238238
239+ // Set in node.cc by ParseArgs when --preserve-symlinks-main is used.
240+ // Used in node_config.cc to set a constant on process.binding('config')
241+ // that is used by lib/module.js
242+ bool config_preserve_symlinks_main = false ;
243+
239244// Set in node.cc by ParseArgs when --experimental-modules is used.
240245// Used in node_config.cc to set a constant on process.binding('config')
241246// that is used by lib/module.js
@@ -3519,6 +3524,8 @@ static void PrintHelp() {
35193524 " --pending-deprecation emit pending deprecation warnings\n "
35203525#if defined(NODE_HAVE_I18N_SUPPORT)
35213526 " --preserve-symlinks preserve symbolic links when resolving\n "
3527+ " --preserve-symlinks-main preserve symbolic links when resolving\n "
3528+ " the main module\n "
35223529#endif
35233530 " --prof-process process v8 profiler output generated\n "
35243531 " using --prof\n "
@@ -3569,7 +3576,6 @@ static void PrintHelp() {
35693576 " -r, --require module to preload (option can be "
35703577 " repeated)\n "
35713578 " -v, --version print Node.js version\n "
3572-
35733579 " \n "
35743580 " Environment variables:\n "
35753581 " NODE_DEBUG ','-separated list of core modules\n "
@@ -3832,6 +3838,8 @@ static void ParseArgs(int* argc,
38323838 Revert (cve);
38333839 } else if (strcmp (arg, " --preserve-symlinks" ) == 0 ) {
38343840 config_preserve_symlinks = true ;
3841+ } else if (strcmp (arg, " --preserve-symlinks-main" ) == 0 ) {
3842+ config_preserve_symlinks_main = true ;
38353843 } else if (strcmp (arg, " --experimental-modules" ) == 0 ) {
38363844 config_experimental_modules = true ;
38373845 new_v8_argv[new_v8_argc] = " --harmony-dynamic-import" ;
@@ -4276,6 +4284,12 @@ void Init(int* argc,
42764284 SafeGetenv (" NODE_PRESERVE_SYMLINKS" , &text) && text[0 ] == ' 1' ;
42774285 }
42784286
4287+ {
4288+ std::string text;
4289+ config_preserve_symlinks_main =
4290+ SafeGetenv (" NODE_PRESERVE_SYMLINKS_MAIN" , &text) && text[0 ] == ' 1' ;
4291+ }
4292+
42794293 if (config_warning_file.empty ())
42804294 SafeGetenv (" NODE_REDIRECT_WARNINGS" , &config_warning_file);
42814295
0 commit comments