#ifndef SRC_NODE_NATIVE_MODULE_ENV_H_ #define SRC_NODE_NATIVE_MODULE_ENV_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node_native_module.h" namespace node { class Environment; namespace native_module { extern const bool has_code_cache; class NativeModuleEnv { public: static void Initialize(v8::Local target, v8::Local unused, v8::Local context, void* priv); static v8::MaybeLocal LookupAndCompile( v8::Local context, const char* id, std::vector>* parameters, Environment* optional_env); static v8::Local GetSourceObject(v8::Local context); // Returns config.gypi as a JSON string static v8::Local GetConfigString(v8::Isolate* isolate); static bool Exists(const char* id); // Loads data into NativeModuleLoader::.instance.code_cache_ // Generated by mkcodecache as node_code_cache.cc when // the build is configured with --code-cache-path=.... They are noops // in node_code_cache_stub.cc static void InitializeCodeCache(); private: static void RecordResult(const char* id, NativeModuleLoader::Result result, Environment* env); static void GetModuleCategories( v8::Local property, const v8::PropertyCallbackInfo& info); static void GetCacheUsage(const v8::FunctionCallbackInfo& args); // Passing ids of builtin module source code into JS land as // internalBinding('native_module').moduleIds static void ModuleIdsGetter(v8::Local property, const v8::PropertyCallbackInfo& info); // Passing config.gypi into JS land as internalBinding('native_module').config static void ConfigStringGetter( v8::Local property, const v8::PropertyCallbackInfo& info); // Compile a specific native module as a function static void CompileFunction(const v8::FunctionCallbackInfo& args); }; } // namespace native_module } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_NATIVE_MODULE_ENV_H_