@@ -237,6 +237,11 @@ bool trace_warnings = false;
237237// that is used by lib/module.js
238238bool config_preserve_symlinks = false ;
239239
240+ // Set in node.cc by ParseArgs when --preserve-symlinks-main is used.
241+ // Used in node_config.cc to set a constant on process.binding('config')
242+ // that is used by lib/module.js
243+ bool config_preserve_symlinks_main = false ;
244+
240245// Set in node.cc by ParseArgs when --experimental-modules is used.
241246// Used in node_config.cc to set a constant on process.binding('config')
242247// that is used by lib/module.js
@@ -3529,6 +3534,8 @@ static void PrintHelp() {
35293534 " --pending-deprecation emit pending deprecation warnings\n "
35303535#if defined(NODE_HAVE_I18N_SUPPORT)
35313536 " --preserve-symlinks preserve symbolic links when resolving\n "
3537+ " --preserve-symlinks-main preserve symbolic links when resolving\n "
3538+ " the main module\n "
35323539#endif
35333540 " --prof-process process v8 profiler output generated\n "
35343541 " using --prof\n "
@@ -3579,7 +3586,6 @@ static void PrintHelp() {
35793586 " -r, --require module to preload (option can be "
35803587 " repeated)\n "
35813588 " -v, --version print Node.js version\n "
3582-
35833589 " \n "
35843590 " Environment variables:\n "
35853591 " NODE_DEBUG ','-separated list of core modules\n "
@@ -3842,6 +3848,8 @@ static void ParseArgs(int* argc,
38423848 Revert (cve);
38433849 } else if (strcmp (arg, " --preserve-symlinks" ) == 0 ) {
38443850 config_preserve_symlinks = true ;
3851+ } else if (strcmp (arg, " --preserve-symlinks-main" ) == 0 ) {
3852+ config_preserve_symlinks_main = true ;
38453853 } else if (strcmp (arg, " --experimental-modules" ) == 0 ) {
38463854 config_experimental_modules = true ;
38473855 new_v8_argv[new_v8_argc] = " --harmony-dynamic-import" ;
@@ -4286,6 +4294,12 @@ void Init(int* argc,
42864294 SafeGetenv (" NODE_PRESERVE_SYMLINKS" , &text) && text[0 ] == ' 1' ;
42874295 }
42884296
4297+ {
4298+ std::string text;
4299+ config_preserve_symlinks_main =
4300+ SafeGetenv (" NODE_PRESERVE_SYMLINKS_MAIN" , &text) && text[0 ] == ' 1' ;
4301+ }
4302+
42894303 if (config_warning_file.empty ())
42904304 SafeGetenv (" NODE_REDIRECT_WARNINGS" , &config_warning_file);
42914305
0 commit comments