aboutsummaryrefslogtreecommitdiff
path: root/src/options.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-04-24 14:11:59 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-24 14:11:59 -0700
commit923ac39c0b718ac5d488f65232f0dcd7161423d4 (patch)
treec4a35c8e7c8f16a5139a4622b8a26ff2331f85b6 /src/options.zig
parent98209b8e101c8c0199f1360f7c1781938f502ed8 (diff)
downloadbun-923ac39c0b718ac5d488f65232f0dcd7161423d4.tar.gz
bun-923ac39c0b718ac5d488f65232f0dcd7161423d4.tar.zst
bun-923ac39c0b718ac5d488f65232f0dcd7161423d4.zip
Support plugins in `Bun.build` (#2720)
* wip * Implement `onLoad` plugins * Support exceptions and async `onLoad` plugins * Fix filtering * Handle empty files * Fix JSON loader --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r--src/options.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/options.zig b/src/options.zig
index 26485eb70..48ef405a0 100644
--- a/src/options.zig
+++ b/src/options.zig
@@ -646,7 +646,7 @@ pub const Platform = enum {
};
};
-pub const Loader = enum {
+pub const Loader = enum(u8) {
jsx,
js,
ts,
@@ -2089,8 +2089,13 @@ pub const OutputFile = struct {
.buffer => |buffer| brk: {
var blob = bun.default_allocator.create(JSC.WebCore.Blob) catch unreachable;
blob.* = JSC.WebCore.Blob.init(@constCast(buffer.bytes), buffer.allocator, globalObject);
- blob.store.?.mime_type = this.loader.toMimeType();
- blob.content_type = blob.store.?.mime_type.value;
+ if (blob.store) |store| {
+ store.mime_type = this.loader.toMimeType();
+ blob.content_type = store.mime_type.value;
+ } else {
+ blob.content_type = this.loader.toMimeType().value;
+ }
+
blob.allocator = bun.default_allocator;
const blob_jsvalue = blob.toJS(globalObject);
blob_jsvalue.ensureStillAlive();