diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2022-03-03 21:01:07 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2022-03-11 20:15:12 +0300 |
commit | de163d5db671fcad4ff6f98029c4de90ab4ff873 (patch) | |
tree | d557928bdc0613fb4a0ec25736a93e0d89a170cd /src/node_options.cc | |
parent | d8c4e375f21b8475d3b717d1d1120ad4eabf8f63 (diff) |
src: include internal/options in the snapshot
This patch enables internal/options to be included in the snapshot,
so that when lazy loading the run time options, the modules only
need to make sure that the options are queried lazily and do not
have to lazy load the internal/options module together. We can
still guarantee that no run time options are serialized into the
state-independent bootstrap snapshot with the assertion inside
GetCLIOptions().
PR-URL: https://github.com/nodejs/node/pull/42203
Refs: https://github.com/nodejs/node/issues/37476
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r-- | src/node_options.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index b8b6d85f39e..35ee54d2231 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -3,6 +3,7 @@ #include "env-inl.h" #include "node_binding.h" +#include "node_external_reference.h" #include "node_internals.h" #if HAVE_OPENSSL #include "openssl/opensslv.h" @@ -1133,6 +1134,10 @@ void Initialize(Local<Object> target, .Check(); } +void RegisterExternalReferences(ExternalReferenceRegistry* registry) { + registry->Register(GetCLIOptions); + registry->Register(GetEmbedderOptions); +} } // namespace options_parser void HandleEnvOptions(std::shared_ptr<EnvironmentOptions> env_options) { @@ -1199,3 +1204,5 @@ std::vector<std::string> ParseNodeOptionsEnvVar( } // namespace node NODE_MODULE_CONTEXT_AWARE_INTERNAL(options, node::options_parser::Initialize) +NODE_MODULE_EXTERNAL_REFERENCE(options, + node::options_parser::RegisterExternalReferences) |