diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-02 01:04:05 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-04 06:16:10 +0300 |
commit | e1d55a0cbc9cd921f8403a550cbfae8497d70d1d (patch) | |
tree | 5cb588cb3323ce97cd5b599f408d558d28390631 /src/node_native_module.h | |
parent | f59ec2abee82f22822b7b3231ca2056fc028a279 (diff) |
src: port bootstrap/cache.js to C++
This allows us to query the categories of modules in C++
so we can implement the code cache generator in C++ that
does not depend on a Node.js binary.
PR-URL: https://github.com/nodejs/node/pull/27046
Refs: https://github.com/nodejs/node/issues/21563
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'src/node_native_module.h')
-rw-r--r-- | src/node_native_module.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/node_native_module.h b/src/node_native_module.h index be1fc92a767..587c59022af 100644 --- a/src/node_native_module.h +++ b/src/node_native_module.h @@ -54,6 +54,9 @@ class NativeModuleLoader { Environment* optional_env); private: + static void GetModuleCategories( + v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info); static void GetCacheUsage(const v8::FunctionCallbackInfo<v8::Value>& args); // Passing ids of builtin module source code into JS land as // internalBinding('native_module').moduleIds @@ -84,6 +87,15 @@ class NativeModuleLoader { static v8::MaybeLocal<v8::Function> CompileAsModule(Environment* env, const char* id); + void InitializeModuleCategories(); + struct ModuleCategories { + bool is_initialized = false; + std::set<std::string> can_be_required; + std::set<std::string> cannot_be_required; + }; + + ModuleCategories module_categories_; + NativeModuleRecordMap source_; NativeModuleCacheMap code_cache_; UnionBytes config_; |