mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
committed by
Node.js GitHub Bot
parent
d8c4e375f2
commit
de163d5db6
@@ -338,6 +338,7 @@ require('fs');
|
||||
require('v8');
|
||||
require('vm');
|
||||
require('url');
|
||||
require('internal/options');
|
||||
|
||||
function setupPrepareStackTrace() {
|
||||
const {
|
||||
|
||||
@@ -67,6 +67,7 @@ class ExternalReferenceRegistry {
|
||||
V(heap_utils) \
|
||||
V(messaging) \
|
||||
V(native_module) \
|
||||
V(options) \
|
||||
V(os) \
|
||||
V(performance) \
|
||||
V(process_methods) \
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user