aboutsummaryrefslogtreecommitdiff
path: root/src/logger.zig
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/logger.zig
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/logger.zig')
-rw-r--r--src/logger.zig19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/logger.zig b/src/logger.zig
index bee10ff31..a9555c952 100644
--- a/src/logger.zig
+++ b/src/logger.zig
@@ -403,7 +403,12 @@ pub const Msg = struct {
pub fn fromJS(allocator: std.mem.Allocator, globalObject: *bun.JSC.JSGlobalObject, file: string, err: bun.JSC.JSValue) !Msg {
var zig_exception_holder: bun.JSC.ZigException.Holder = bun.JSC.ZigException.Holder.init();
- err.toZigException(globalObject, zig_exception_holder.zigException());
+ if (err.toError()) |value| {
+ value.toZigException(globalObject, zig_exception_holder.zigException());
+ } else {
+ zig_exception_holder.zig_exception.message = JSC.ZigString.fromUTF8(err.toSlice(globalObject, allocator).slice());
+ }
+
return Msg{
.data = .{
.text = zig_exception_holder.zigException().message.toSliceClone(allocator).slice(),
@@ -813,7 +818,7 @@ pub const Log = struct {
inline fn _addResolveErrorWithLevel(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,
@@ -865,7 +870,7 @@ pub const Log = struct {
inline fn _addResolveError(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,
@@ -879,7 +884,7 @@ pub const Log = struct {
inline fn _addResolveWarn(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,
@@ -893,7 +898,7 @@ pub const Log = struct {
pub fn addResolveError(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,
@@ -907,7 +912,7 @@ pub const Log = struct {
pub fn addResolveErrorWithTextDupe(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,
@@ -920,7 +925,7 @@ pub const Log = struct {
pub fn addResolveErrorWithTextDupeMaybeWarn(
log: *Log,
- source: *const Source,
+ source: ?*const Source,
r: Range,
allocator: std.mem.Allocator,
comptime fmt: string,