Skip to content

Commit

Permalink
module: detect ESM syntax by trying to recompile as SourceTextModule
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 29, 2024
1 parent 9ffbdb8 commit 5c5cb2b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions patches/node/chore_expose_importmoduledynamically_and.patch
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c35797

MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
diff --git a/src/module_wrap.h b/src/module_wrap.h
index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42818fe3d1 100644
index 83b5793013cbc453cf92c0a006fc7be3c06ad276..6fca3d666735b91653699830fdd24d482501953a 100644
--- a/src/module_wrap.h
+++ b/src/module_wrap.h
@@ -7,6 +7,7 @@
#include <string>
@@ -8,6 +8,7 @@
#include <unordered_map>
#include <vector>
#include "base_object.h"
+#include "node.h"
#include "v8-script.h"

namespace node {

@@ -31,7 +32,14 @@ enum HostDefinedOptions : int {
kLength = 9,
};
Expand All @@ -114,20 +114,20 @@ index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42
public:
enum InternalFields {
kModuleSlot = BaseObject::kInternalFieldCount,
@@ -68,6 +76,8 @@ class ModuleWrap : public BaseObject {
return true;
}
@@ -90,6 +91,8 @@ class ModuleWrap : public BaseObject {

+ static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
static void CreateRequiredModuleFacade(
const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);

private:
ModuleWrap(Realm* realm,
v8::Local<v8::Object> object,
@@ -110,7 +120,6 @@ class ModuleWrap : public BaseObject {
@@ -129,7 +132,6 @@ class ModuleWrap : public BaseObject {
v8::Local<v8::String> specifier,
v8::Local<v8::FixedArray> import_attributes,
v8::Local<v8::Module> referrer);
- static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);

v8::Global<v8::Module> module_;
std::unordered_map<std::string, v8::Global<v8::Promise>> resolve_cache_;
std::unordered_map<std::string, v8::Global<v8::Object>> resolve_cache_;

0 comments on commit 5c5cb2b

Please sign in to comment.