aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-02 02:07:17 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-02 02:07:17 -0700
commitdf2738ac824e46499b2f046a4eba165c19466e0e (patch)
tree94fc225123b83d2b82f9a7a7084131c07691b182 /src/bun.js/bindings/ZigGlobalObject.cpp
parent4c6245b2e5788ac46e31bf67beefab8cdadebedb (diff)
downloadbun-jarred/redo-evaluation-order.tar.gz
bun-jarred/redo-evaluation-order.tar.zst
bun-jarred/redo-evaluation-order.zip
Align CommonJS evaluation order closer to Node.jsjarred/redo-evaluation-order
Diffstat (limited to '')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 0a453a9c8..5810b25fb 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -178,6 +178,7 @@ namespace JSCastingHelpers = JSC::JSCastingHelpers;
#include "CallSitePrototype.h"
#include "DOMWrapperWorld-class.h"
#include "CommonJSModuleRecord.h"
+#include "JavaScriptCore/SyntheticModuleRecord.h"
constexpr size_t DEFAULT_ERROR_STACK_TRACE_LIMIT = 10;
@@ -4113,6 +4114,16 @@ JSC::JSValue GlobalObject::moduleLoaderEvaluate(JSGlobalObject* globalObject,
return scriptFetcher;
}
+ if (JSC::SyntheticModuleRecord* record = jsDynamicCast<JSC::SyntheticModuleRecord*>(moduleRecordValue)) {
+ if (JSValue userValue = record->userValue()) {
+ auto* evalExecutable = jsDynamicCast<JSC::EvalExecutable*>(userValue);
+ return Bun::evaluateCommonJSModule(
+ reinterpret_cast<Zig::GlobalObject*>(globalObject),
+ record,
+ evalExecutable);
+ }
+ }
+
JSC::JSValue result = moduleLoader->evaluateNonVirtual(globalObject, key, moduleRecordValue,
scriptFetcher, sentValue, resumeMode);