aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSBundlerPlugin.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-11 19:14:34 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-11 19:14:34 -0700
commitcbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch)
tree43a00501f3cde495967e116f0b660777051551f8 /src/bun.js/bindings/JSBundlerPlugin.h
parent1f900cff453700b19bca2acadfe26da4468c1282 (diff)
parent34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff)
downloadbun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.gz
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.zst
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.zip
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/bun.js/bindings/JSBundlerPlugin.h')
-rw-r--r--src/bun.js/bindings/JSBundlerPlugin.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bun.js/bindings/JSBundlerPlugin.h b/src/bun.js/bindings/JSBundlerPlugin.h
index 08aa1d140..4d82cdc1b 100644
--- a/src/bun.js/bindings/JSBundlerPlugin.h
+++ b/src/bun.js/bindings/JSBundlerPlugin.h
@@ -9,6 +9,10 @@
#include <JavaScriptCore/Yarr.h>
#include <JavaScriptCore/Strong.h>
+typedef void (*JSBundlerPluginAddErrorCallback)(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+typedef void (*JSBundlerPluginOnLoadAsyncCallback)(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+typedef void (*JSBundlerPluginOnResolveAsyncCallback)(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
namespace Bun {
using namespace JSC;
@@ -42,10 +46,13 @@ public:
};
public:
- bool anyMatchesCrossThread(JSC::VM&, const ZigString* namespaceStr, const ZigString* path, bool isOnLoad);
+ bool anyMatchesCrossThread(JSC::VM&, const BunString* namespaceStr, const BunString* path, bool isOnLoad);
void tombstone() { tombstoned = true; }
- BundlerPlugin(void* config, BunPluginTarget target)
+ BundlerPlugin(void* config, BunPluginTarget target, JSBundlerPluginAddErrorCallback addError, JSBundlerPluginOnLoadAsyncCallback onLoadAsync, JSBundlerPluginOnResolveAsyncCallback onResolveAsync)
+ : addError(addError)
+ , onLoadAsync(onLoadAsync)
+ , onResolveAsync(onResolveAsync)
{
this->target = target;
this->config = config;
@@ -54,6 +61,10 @@ public:
NamespaceList onLoad = {};
NamespaceList onResolve = {};
BunPluginTarget target { BunPluginTargetBrowser };
+
+ JSBundlerPluginAddErrorCallback addError;
+ JSBundlerPluginOnLoadAsyncCallback onLoadAsync;
+ JSBundlerPluginOnResolveAsyncCallback onResolveAsync;
void* config { nullptr };
bool tombstoned { false };
};