summaryrefslogtreecommitdiff
path: root/src/node_internals.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-08-10 02:45:28 +0200
committerAnna Henningsen <anna@addaleax.net>2018-08-22 23:37:19 +0200
commit29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7 (patch)
tree1d66e5b012218ede32c5219d9918d2e2a897ee7b /src/node_internals.h
parent92880f31da1eca98a42e0f61708b10d9d8d83955 (diff)
downloadandroid-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.tar.gz
android-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.tar.bz2
android-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.zip
src: refactor options parsing
This is a major refactor of our Node’s parser. See `node_options.cc` for how it is used, and `node_options-inl.h` for the bulk of its implementation. Unfortunately, the implementation has come to have some complexity, in order to meet the following goals: - Make it easy to *use* for defining or changing options. - Keep it (mostly) backwards-compatible. - No tests were harmed as part of this commit. - Be as consistent as possible. - In particular, options can now generally accept arguments through both `--foo=bar` notation and `--foo bar` notation. We were previously very inconsistent on this point. - Separate into different levels of scope, namely per-process (global), per-Isolate and per-Environment (+ debug options). - Allow programmatic accessibility in the future. - This includes a possible expansion for `--help` output. This commit also leaves a number of `TODO` comments, mostly for improving consistency even more (possibly with having to modify tests), improving embedder support, as well as removing pieces of exposed configuration variables that should never have become part of the public API but unfortunately are at this point. PR-URL: https://github.com/nodejs/node/pull/22392 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/node_internals.h')
-rw-r--r--src/node_internals.h66
1 files changed, 3 insertions, 63 deletions
diff --git a/src/node_internals.h b/src/node_internals.h
index 968d229f10..60630953c7 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -33,7 +33,6 @@
#include "v8.h"
#include "tracing/trace_event.h"
#include "node_perf_common.h"
-#include "node_debug_options.h"
#include "node_api.h"
#include <stdint.h>
@@ -171,67 +170,10 @@ struct sockaddr;
namespace node {
-// Set in node.cc by ParseArgs with the value of --openssl-config.
-// Used in node_crypto.cc when initializing OpenSSL.
-extern std::string openssl_config;
-
-// Set in node.cc by ParseArgs when --preserve-symlinks is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/module.js
-extern bool config_preserve_symlinks;
-
-// Set in node.cc by ParseArgs when --preserve-symlinks-main is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/module.js
-extern bool config_preserve_symlinks_main;
-
-// Set in node.cc by ParseArgs when --experimental-modules is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/module.js
-extern bool config_experimental_modules;
-
-// Set in node.cc by ParseArgs when --experimental-vm-modules is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/vm.js
-extern bool config_experimental_vm_modules;
-
-// Set in node.cc by ParseArgs when --experimental-worker is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by the module loader.
-extern bool config_experimental_worker;
-
-// Set in node.cc by ParseArgs when --experimental-repl-await is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/repl.js.
-extern bool config_experimental_repl_await;
-
-// Set in node.cc by ParseArgs when --loader is used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/internal/bootstrap/node.js
-extern std::string config_userland_loader;
-
-// Set in node.cc by ParseArgs when --expose-internals or --expose_internals is
-// used.
-// Used in node_config.cc to set a constant on process.binding('config')
-// that is used by lib/internal/bootstrap/node.js
-extern bool config_expose_internals;
-
-// Set in node.cc by ParseArgs when --redirect-warnings= is used.
-// Used to redirect warning output to a file rather than sending
-// it to stderr.
-extern std::string config_warning_file; // NOLINT(runtime/string)
-
-// Set in node.cc by ParseArgs when --pending-deprecation or
-// NODE_PENDING_DEPRECATION is used
-extern bool config_pending_deprecation;
-
// Tells whether it is safe to call v8::Isolate::GetCurrent().
extern bool v8_initialized;
-// Contains initial debug options.
-// Set in node.cc.
-// Used in node_config.cc.
-extern node::DebugOptions debug_options;
+extern std::shared_ptr<PerProcessOptions> per_process_opts;
// Forward declaration
class Environment;
@@ -415,10 +357,8 @@ inline v8::Local<v8::Value> FillGlobalStatsArray(Environment* env,
void SetupBootstrapObject(Environment* env,
v8::Local<v8::Object> bootstrapper);
void SetupProcessObject(Environment* env,
- int argc,
- const char* const* argv,
- int exec_argc,
- const char* const* exec_argv);
+ const std::vector<std::string>& args,
+ const std::vector<std::string>& exec_args);
// Call _register<module_name> functions for all of
// the built-in modules. Because built-in modules don't