aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ModuleLoader.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-04-25 07:27:18 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-25 07:27:18 -0700
commit126885e1fe509b69be947d79aacb3ed6efdf666a (patch)
treebef407938525d69132824ffd3b0b54796035009d /src/bun.js/bindings/ModuleLoader.h
parent5353d4101493632cb25d0cdddfef94f62bc5902d (diff)
downloadbun-126885e1fe509b69be947d79aacb3ed6efdf666a.tar.gz
bun-126885e1fe509b69be947d79aacb3ed6efdf666a.tar.zst
bun-126885e1fe509b69be947d79aacb3ed6efdf666a.zip
Implement `onResolve` plugins in `Bun.build()`, support multiple onLoad and onResolve plugins (#2739)
* its 2023 * WIP `onResolve` plugins * more progress * it compiles * Lots of small fixes * Seems to work excluding entry points * Update BundlerPluginBuiltins.cpp --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/ModuleLoader.h')
-rw-r--r--src/bun.js/bindings/ModuleLoader.h29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/bun.js/bindings/ModuleLoader.h b/src/bun.js/bindings/ModuleLoader.h
index f24a8fdb1..9090abcdc 100644
--- a/src/bun.js/bindings/ModuleLoader.h
+++ b/src/bun.js/bindings/ModuleLoader.h
@@ -37,7 +37,6 @@ union OnLoadResultValue {
struct OnLoadResult {
OnLoadResultValue value;
OnLoadResultType type;
- void* bundlerPluginContext { nullptr };
};
class PendingVirtualModuleResult : public JSC::JSInternalFieldObjectImpl<3> {
@@ -56,13 +55,12 @@ public:
[](auto& spaces, auto&& space) { spaces.m_subspaceForPendingVirtualModuleResult = std::forward<decltype(space)>(space); });
}
- 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);
+ JS_EXPORT_PRIVATE static PendingVirtualModuleResult* create(VM&, Structure*);
+ static PendingVirtualModuleResult* create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer);
static PendingVirtualModuleResult* createWithInitialValues(VM&, Structure*);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
JSC::JSInternalPromise* internalPromise();
- JSC::JSPromise* promise();
static std::array<JSValue, numberOfInternalFields> initialValues()
{
@@ -76,32 +74,21 @@ public:
DECLARE_EXPORT_INFO;
DECLARE_VISIT_CHILDREN;
- void* m_bundlerPluginContext { nullptr };
-
- PendingVirtualModuleResult(JSC::VM&, JSC::Structure*, void* bundlerPluginContext = nullptr);
+ PendingVirtualModuleResult(JSC::VM&, JSC::Structure*);
void finishCreation(JSC::VM&, const WTF::String& specifier, const WTF::String& referrer);
};
-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);
-
+OnLoadResult handleOnLoadResultNotPromise(Zig::GlobalObject* globalObject, JSC::JSValue objectValue);
JSValue fetchSourceCodeSync(
Zig::GlobalObject* globalObject,
ErrorableResolvedSource* res,
- const ZigString* specifier,
- const ZigString* referrer);
+ ZigString* specifier,
+ ZigString* referrer);
JSValue fetchSourceCodeAsync(
Zig::GlobalObject* globalObject,
ErrorableResolvedSource* res,
- const ZigString* specifier,
- const ZigString* referrer);
+ ZigString* specifier,
+ ZigString* referrer);
} // namespace Bun \ No newline at end of file