summaryrefslogtreecommitdiff
path: root/src/node_native_module.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_native_module.h')
-rw-r--r--src/node_native_module.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/node_native_module.h b/src/node_native_module.h
index fc0e33c735..02c769ef02 100644
--- a/src/node_native_module.h
+++ b/src/node_native_module.h
@@ -40,6 +40,9 @@ class NativeModuleLoader {
v8::Local<v8::Context> context,
void* priv);
v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context) const;
+ // Returns config.gypi as a JSON string
+ v8::Local<v8::String> GetConfigString(v8::Isolate* isolate) const;
+
v8::Local<v8::String> GetSource(v8::Isolate* isolate, const char* id) const;
// Run a script with JS source bundled inside the binary as if it's wrapped
@@ -56,9 +59,15 @@ class NativeModuleLoader {
private:
static void GetCacheUsage(const v8::FunctionCallbackInfo<v8::Value>& args);
- // For legacy process.binding('natives') which is mutable, and for
- // internalBinding('native_module').source for internal use
- static void GetSourceObject(const v8::FunctionCallbackInfo<v8::Value>& args);
+ // Passing map of builtin module source code into JS land as
+ // internalBinding('native_module').source
+ static void SourceObjectGetter(
+ v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info);
+ // Passing config.gypi into JS land as internalBinding('native_module').config
+ static void ConfigStringGetter(
+ v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info);
// Compile code cache for a specific native module
static void CompileCodeCache(const v8::FunctionCallbackInfo<v8::Value>& args);
// Compile a specific native module as a function
@@ -67,6 +76,7 @@ class NativeModuleLoader {
// Generated by tools/js2c.py as node_javascript.cc
void LoadJavaScriptSource(); // Loads data into source_
void LoadJavaScriptHash(); // Loads data into source_hash_
+ UnionBytes GetConfig(); // Return data for config.gypi
// Generated by tools/generate_code_cache.js as node_code_cache.cc when
// the build is configured with --code-cache-path=.... They are noops
@@ -94,6 +104,8 @@ class NativeModuleLoader {
bool has_code_cache_ = false;
NativeModuleRecordMap source_;
NativeModuleRecordMap code_cache_;
+ UnionBytes config_;
+
NativeModuleHashMap source_hash_;
NativeModuleHashMap code_cache_hash_;
};