diff options
author | 2023-07-07 21:20:30 -0700 | |
---|---|---|
committer | 2023-07-07 21:20:30 -0700 | |
commit | 52b7962dae593ef45c2cef20bfb2eafad0d50518 (patch) | |
tree | 223a1db1d67f3dbc243bdd2212e5aad13fd91eec /src/bun.js/bindings/JSBundlerPlugin.h | |
parent | 386d8b78369edf235c5cd92e52b94126f406a0fd (diff) | |
download | bun-52b7962dae593ef45c2cef20bfb2eafad0d50518.tar.gz bun-52b7962dae593ef45c2cef20bfb2eafad0d50518.tar.zst bun-52b7962dae593ef45c2cef20bfb2eafad0d50518.zip |
Use BunString in JSBundlerPlugin (#3557)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/JSBundlerPlugin.h')
-rw-r--r-- | src/bun.js/bindings/JSBundlerPlugin.h | 15 |
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 }; }; |