mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
bun:error.js into separate module, ensure we don't include fast refresh in Bun.js, log build errors to browser console, don't warn for node_modules,
This commit is contained in:
@@ -260,6 +260,27 @@ pub const Bun = struct {
|
||||
}
|
||||
}
|
||||
|
||||
var public_path_temp_str: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
|
||||
pub fn getPublicPathJS(
|
||||
this: void,
|
||||
ctx: js.JSContextRef,
|
||||
function: js.JSObjectRef,
|
||||
thisObject: js.JSObjectRef,
|
||||
arguments: []const js.JSValueRef,
|
||||
exception: js.ExceptionRef,
|
||||
) js.JSValueRef {
|
||||
var zig_str: ZigString = ZigString.Empty;
|
||||
JSValue.toZigString(JSValue.fromRef(arguments[0]), &zig_str, VirtualMachine.vm.global);
|
||||
|
||||
const to = zig_str.slice();
|
||||
|
||||
var stream = std.io.fixedBufferStream(&public_path_temp_str);
|
||||
var writer = stream.writer();
|
||||
getPublicPath(to, @TypeOf(&writer), &writer);
|
||||
return ZigString.init(stream.buffer[0..stream.pos]).toValueGC(VirtualMachine.vm.global).asRef();
|
||||
}
|
||||
|
||||
pub const Class = NewClass(
|
||||
void,
|
||||
.{
|
||||
@@ -302,6 +323,13 @@ pub const Bun = struct {
|
||||
.@"return" = "string",
|
||||
},
|
||||
},
|
||||
.getPublicPath = .{
|
||||
.rfn = Bun.getPublicPathJS,
|
||||
.ts = d.ts{
|
||||
.name = "getPublicPath",
|
||||
.@"return" = "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
.{
|
||||
.main = .{
|
||||
|
||||
Reference in New Issue
Block a user