aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ModuleLoader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/ModuleLoader.h')
-rw-r--r--src/bun.js/bindings/ModuleLoader.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/bun.js/bindings/ModuleLoader.h b/src/bun.js/bindings/ModuleLoader.h
index 9090abcdc..f24a8fdb1 100644
--- a/src/bun.js/bindings/ModuleLoader.h
+++ b/src/bun.js/bindings/ModuleLoader.h
@@ -37,6 +37,7 @@ union OnLoadResultValue {
struct OnLoadResult {
OnLoadResultValue value;
OnLoadResultType type;
+ void* bundlerPluginContext { nullptr };
};
class PendingVirtualModuleResult : public JSC::JSInternalFieldObjectImpl<3> {
@@ -55,12 +56,13 @@ public:
[](auto& spaces, auto&& space) { spaces.m_subspaceForPendingVirtualModuleResult = std::forward<decltype(space)>(space); });
}
- JS_EXPORT_PRIVATE static PendingVirtualModuleResult* create(VM&, Structure*);
- static PendingVirtualModuleResult* create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer);
+ JS_EXPORT_PRIVATE static PendingVirtualModuleResult* create(VM&, Structure*, void* bundlerPluginContext = nullptr);
+ static PendingVirtualModuleResult* create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer, void* bundlerPluginContext = nullptr);
static PendingVirtualModuleResult* createWithInitialValues(VM&, Structure*);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
JSC::JSInternalPromise* internalPromise();
+ JSC::JSPromise* promise();
static std::array<JSValue, numberOfInternalFields> initialValues()
{
@@ -74,21 +76,32 @@ public:
DECLARE_EXPORT_INFO;
DECLARE_VISIT_CHILDREN;
- PendingVirtualModuleResult(JSC::VM&, JSC::Structure*);
+ void* m_bundlerPluginContext { nullptr };
+
+ PendingVirtualModuleResult(JSC::VM&, JSC::Structure*, void* bundlerPluginContext = nullptr);
void finishCreation(JSC::VM&, const WTF::String& specifier, const WTF::String& referrer);
};
-OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC::JSValue objectValue);
+OnLoadResult handleOnLoadResult(Zig::GlobalObject* globalObject, JSC::JSValue objectValue, ZigString* specifier, void* bunPluginContext = nullptr);
+OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC::JSValue objectValue, void* bunPluginContext = nullptr);
+
+JSValue handleVirtualModuleResultForJSBundlerPlugin(
+ Zig::GlobalObject* globalObject,
+ JSValue virtualModuleResult,
+ const ZigString* specifier,
+ const ZigString* referrer,
+ void* bundlerPluginContext);
+
JSValue fetchSourceCodeSync(
Zig::GlobalObject* globalObject,
ErrorableResolvedSource* res,
- ZigString* specifier,
- ZigString* referrer);
+ const ZigString* specifier,
+ const ZigString* referrer);
JSValue fetchSourceCodeAsync(
Zig::GlobalObject* globalObject,
ErrorableResolvedSource* res,
- ZigString* specifier,
- ZigString* referrer);
+ const ZigString* specifier,
+ const ZigString* referrer);
} // namespace Bun \ No newline at end of file