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:
Jarred Sumner
2021-09-11 01:48:23 -07:00
parent 6f2554b13a
commit 125d88bd65
38 changed files with 4093 additions and 3401 deletions

View File

@@ -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 = .{