forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_wrap.h
58 lines (46 loc) · 1.83 KB
/
module_wrap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SRC_MODULE_WRAP_H_
#define SRC_MODULE_WRAP_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include <map>
#include <string>
#include <vector>
#include "node_url.h"
#include "base-object.h"
#include "base-object-inl.h"
namespace node {
namespace loader {
node::url::URL Resolve(std::string specifier, node::url::URL* base,
bool read_pkg_json = false);
class ModuleWrap : public BaseObject {
public:
static const std::string EXTENSIONS[];
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
private:
ModuleWrap(node::Environment* env,
v8::Local<v8::Object> object,
v8::Local<v8::Module> module,
v8::Local<v8::String> url);
~ModuleWrap();
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Instantiate(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Evaluate(const v8::FunctionCallbackInfo<v8::Value>& args);
static void GetUrl(v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info);
static void Resolve(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::MaybeLocal<v8::Module> ResolveCallback(
v8::Local<v8::Context> context,
v8::Local<v8::String> specifier,
v8::Local<v8::Module> referrer);
v8::Persistent<v8::Module> module_;
v8::Persistent<v8::String> url_;
bool linked_ = false;
std::map<std::string, v8::Persistent<v8::Promise>*> resolve_cache_;
static std::map<int, std::vector<ModuleWrap*>*> module_map_;
};
} // namespace loader
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_MODULE_WRAP_H_