#ifndef SRC_MODULE_WRAP_H_ #define SRC_MODULE_WRAP_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include #include #include #include "node_url.h" #include "base_object-inl.h" namespace node { namespace loader { enum PackageMainCheck : bool { CheckMain = true, IgnoreMain = false }; v8::Maybe Resolve(Environment* env, const std::string& specifier, const url::URL& base, PackageMainCheck read_pkg_json = CheckMain); class ModuleWrap : public BaseObject { public: static const std::string EXTENSIONS[]; static void Initialize(v8::Local target, v8::Local unused, v8::Local context); static void HostInitializeImportMetaObjectCallback( v8::Local context, v8::Local module, v8::Local meta); private: ModuleWrap(Environment* env, v8::Local object, v8::Local module, v8::Local url); ~ModuleWrap(); static void New(const v8::FunctionCallbackInfo& args); static void Link(const v8::FunctionCallbackInfo& args); static void Instantiate(const v8::FunctionCallbackInfo& args); static void Evaluate(const v8::FunctionCallbackInfo& args); static void Namespace(const v8::FunctionCallbackInfo& args); static void GetStatus(const v8::FunctionCallbackInfo& args); static void GetError(const v8::FunctionCallbackInfo& args); static void GetStaticDependencySpecifiers( const v8::FunctionCallbackInfo& args); static void Resolve(const v8::FunctionCallbackInfo& args); static void SetImportModuleDynamicallyCallback( const v8::FunctionCallbackInfo& args); static void SetInitializeImportMetaObjectCallback( const v8::FunctionCallbackInfo& args); static v8::MaybeLocal ResolveCallback( v8::Local context, v8::Local specifier, v8::Local referrer); static ModuleWrap* GetFromModule(node::Environment*, v8::Local); Persistent module_; Persistent url_; bool linked_ = false; std::unordered_map> resolve_cache_; Persistent context_; }; } // namespace loader } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_MODULE_WRAP_H_