diff options
author | 2023-09-04 16:26:49 -0300 | |
---|---|---|
committer | 2023-09-04 12:26:49 -0700 | |
commit | 2d80f94edafe09329b027424b32908632694553d (patch) | |
tree | e7de3a4fa31096a26d4dda37eedf18cb51a902a1 /src/bun.js | |
parent | 18767906db0dd29b2d898f84a023d403c3084d6e (diff) | |
download | bun-2d80f94edafe09329b027424b32908632694553d.tar.gz bun-2d80f94edafe09329b027424b32908632694553d.tar.zst bun-2d80f94edafe09329b027424b32908632694553d.zip |
fix(HTMLRewriter) buffer response before transform (#4418)
* html rewriter response buffering
* pipe the data when marked as used
* fix empty response
* add some fetch tests
* deinit parent stream
* fix decompression
* keep byte_reader alive
* update builds
* remove nonsense
* was not nonsense after all
* protect tmp ret value from GC, fix readable strong ref deinit/init
* fmt
* if we detach the stream we cannot update the fetch stream
* detach checking source
* more tests, progress with javascript and Direct sink
* drop support for pure readable stream for now
* more fixes
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/api/html_rewriter.zig | 138 | ||||
-rw-r--r-- | src/bun.js/api/server.zig | 30 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 4 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.h | 5 | ||||
-rw-r--r-- | src/bun.js/bindings/exports.zig | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/header-gen.zig | 342 | ||||
-rw-r--r-- | src/bun.js/bindings/headers-cpp.h | 8 | ||||
-rw-r--r-- | src/bun.js/bindings/headers.h | 10 | ||||
-rw-r--r-- | src/bun.js/bindings/headers.zig | 600 | ||||
-rw-r--r-- | src/bun.js/webcore/body.zig | 353 | ||||
-rw-r--r-- | src/bun.js/webcore/response.zig | 37 | ||||
-rw-r--r-- | src/bun.js/webcore/streams.zig | 110 |
12 files changed, 1094 insertions, 545 deletions
diff --git a/src/bun.js/api/html_rewriter.zig b/src/bun.js/api/html_rewriter.zig index 86c2c4b53..1bda47512 100644 --- a/src/bun.js/api/html_rewriter.zig +++ b/src/bun.js/api/html_rewriter.zig @@ -170,10 +170,6 @@ pub const HTMLRewriter = struct { } pub fn transform_(this: *HTMLRewriter, global: *JSGlobalObject, response: *Response) JSValue { - if (response.body.len() == 0 and !(response.body.value == .Blob and response.body.value.Blob.needsToReadFile())) { - return this.returnEmptyResponse(global, response); - } - return this.beginTransform(global, response); } @@ -344,7 +340,9 @@ pub const HTMLRewriter = struct { rewriter: *LOLHTML.HTMLRewriter, context: LOLHTMLContext, response: *Response, - input: JSC.WebCore.AnyBlob = undefined, + bodyValueBufferer: ?JSC.WebCore.BodyValueBufferer = null, + tmp_sync_error: ?JSC.JSValue = null, + // const log = bun.Output.scoped(.BufferOutputSink, false); pub fn init(context: LOLHTMLContext, global: *JSGlobalObject, original: *Response, builder: *LOLHTML.HTMLRewriter.Builder) JSValue { var result = bun.default_allocator.create(Response) catch unreachable; var sink = bun.default_allocator.create(BufferOutputSink) catch unreachable; @@ -409,47 +407,77 @@ pub const HTMLRewriter = struct { result.url = original.url.clone(); result.status_text = original.status_text.clone(); - - var input = original.body.value.useAsAnyBlob(); - sink.input = input; - - const is_pending = input.needsToReadFile(); - defer if (!is_pending) input.detach(); - - if (is_pending) { - sink.input.Blob.doReadFileInternal(*BufferOutputSink, sink, onFinishedLoading, global); - } else if (sink.runOutputSink(input.slice(), false, false)) |error_value| { - return error_value; + var value = original.getBodyValue(); + sink.bodyValueBufferer = JSC.WebCore.BodyValueBufferer.init(sink, onFinishedBuffering, sink.global, bun.default_allocator); + sink.bodyValueBufferer.?.run(value) catch |buffering_error| { + return switch (buffering_error) { + error.StreamAlreadyUsed => { + var err = JSC.SystemError{ + .code = bun.String.static(@as(string, @tagName(JSC.Node.ErrorCode.ERR_STREAM_CANNOT_PIPE))), + .message = bun.String.static("Stream already used, please create a new one"), + }; + return err.toErrorInstance(sink.global); + }, + error.InvalidStream => { + var err = JSC.SystemError{ + .code = bun.String.static(@as(string, @tagName(JSC.Node.ErrorCode.ERR_STREAM_CANNOT_PIPE))), + .message = bun.String.static("Invalid stream"), + }; + return err.toErrorInstance(sink.global); + }, + else => { + var err = JSC.SystemError{ + .code = bun.String.static(@as(string, @tagName(JSC.Node.ErrorCode.ERR_STREAM_CANNOT_PIPE))), + .message = bun.String.static("Failed to pipe stream"), + }; + return err.toErrorInstance(sink.global); + }, + }; + }; + // sync error occurs + if (sink.tmp_sync_error) |err| { + err.ensureStillAlive(); + err.unprotect(); + sink.tmp_sync_error = null; + return err; } // Hold off on cloning until we're actually done. return sink.response.toJS(sink.global); } - pub fn onFinishedLoading(sink: *BufferOutputSink, bytes: JSC.WebCore.Blob.Store.ReadFile.ResultType) void { - switch (bytes) { - .err => |err| { - if (sink.response.body.value == .Locked and @intFromPtr(sink.response.body.value.Locked.task) == @intFromPtr(sink) and - sink.response.body.value.Locked.promise == null) - { - sink.response.body.value = .{ .Empty = {} }; - // is there a pending promise? - // we will need to reject it - } else if (sink.response.body.value == .Locked and @intFromPtr(sink.response.body.value.Locked.task) == @intFromPtr(sink) and - sink.response.body.value.Locked.promise != null) - { - sink.response.body.value.Locked.onReceiveValue = null; - sink.response.body.value.Locked.task = null; - } + pub fn onFinishedBuffering(ctx: *anyopaque, bytes: []const u8, js_err: ?JSC.JSValue, is_async: bool) void { + const sink = bun.cast(*BufferOutputSink, ctx); + if (js_err) |err| { + if (sink.response.body.value == .Locked and @intFromPtr(sink.response.body.value.Locked.task) == @intFromPtr(sink) and + sink.response.body.value.Locked.promise == null) + { + sink.response.body.value = .{ .Empty = {} }; + // is there a pending promise? + // we will need to reject it + } else if (sink.response.body.value == .Locked and @intFromPtr(sink.response.body.value.Locked.task) == @intFromPtr(sink) and + sink.response.body.value.Locked.promise != null) + { + sink.response.body.value.Locked.onReceiveValue = null; + sink.response.body.value.Locked.task = null; + } + if (is_async) { + sink.response.body.value.toErrorInstance(err, sink.global); + } else { + var ret_err = throwLOLHTMLError(sink.global); + ret_err.ensureStillAlive(); + ret_err.protect(); + sink.tmp_sync_error = ret_err; + } + sink.rewriter.end() catch {}; + sink.deinit(); + return; + } - sink.response.body.value.toErrorInstance(err.toErrorInstance(sink.global), sink.global); - sink.rewriter.end() catch {}; - sink.deinit(); - return; - }, - .result => |data| { - _ = sink.runOutputSink(data.buf, true, data.is_temporary); - }, + if (sink.runOutputSink(bytes, is_async)) |ret_err| { + ret_err.ensureStillAlive(); + ret_err.protect(); + sink.tmp_sync_error = ret_err; } } @@ -457,11 +485,7 @@ pub const HTMLRewriter = struct { sink: *BufferOutputSink, bytes: []const u8, is_async: bool, - free_bytes_on_end: bool, ) ?JSValue { - defer if (free_bytes_on_end) - bun.default_allocator.free(bun.constStrToU8(bytes)); - sink.bytes.growBy(bytes.len) catch unreachable; var global = sink.global; var response = sink.response; @@ -499,13 +523,19 @@ pub const HTMLRewriter = struct { pub fn done(this: *BufferOutputSink) void { var prev_value = this.response.body.value; - var bytes = this.bytes.toOwnedSliceLeaky(); - this.response.body.value = JSC.WebCore.Body.Value.createBlobValue( - bytes, - bun.default_allocator, + this.response.body.value = JSC.WebCore.Body.Value{ + .InternalBlob = .{ + .bytes = this.bytes.list.toManaged(bun.default_allocator), + }, + }; - true, - ); + this.bytes = .{ + .allocator = bun.default_allocator, + .list = .{ + .items = &.{}, + .capacity = 0, + }, + }; prev_value.resolve( &this.response.body.value, this.global, @@ -518,6 +548,16 @@ pub const HTMLRewriter = struct { pub fn deinit(this: *BufferOutputSink) void { this.bytes.deinit(); + if (this.bodyValueBufferer != null) { + var bufferer = this.bodyValueBufferer.?; + bufferer.deinit(); + } + + if (this.tmp_sync_error) |ret_err| { + // this should never happens, but still we avoid future leaks + ret_err.unprotect(); + this.tmp_sync_error = null; + } this.context.deinit(bun.default_allocator); } diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 5bbf159d2..85d4dadb5 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -1170,6 +1170,8 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp sink: ?*ResponseStream.JSSink = null, byte_stream: ?*JSC.WebCore.ByteStream = null, + // reference to the readable stream / byte_stream alive + readable_stream_ref: JSC.WebCore.ReadableStream.Strong = .{}, /// Used in errors pathname: bun.String = bun.String.empty, @@ -1666,6 +1668,8 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp stream.unpipe(); } + this.readable_stream_ref.deinit(); + if (!this.pathname.isEmpty()) { this.pathname.deref(); this.pathname = bun.String.empty; @@ -2594,24 +2598,31 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp std.debug.assert(byte_stream.pipe.ctx == null); std.debug.assert(this.byte_stream == null); - stream.detach(this.server.globalThis); - if (this.resp == null) { - byte_stream.parent().deinit(); + // we don't have a response, so we can discard the stream + stream.detachIfPossible(this.server.globalThis); return; } const resp = this.resp.?; - // If we've received the complete body by the time this function is called // we can avoid streaming it and just send it all at once. if (byte_stream.has_received_last_chunk) { this.blob.from(byte_stream.buffer); - byte_stream.parent().deinit(); this.doRenderBlob(); + // is safe to detach here because we're not going to receive any more data + stream.detachIfPossible(this.server.globalThis); return; } byte_stream.pipe = JSC.WebCore.Pipe.New(@This(), onPipe).init(this); + this.readable_stream_ref = JSC.WebCore.ReadableStream.Strong.init(stream, this.server.globalThis) catch { + // Invalid Stream + this.renderMissing(); + return; + }; + // we now hold a reference so we can safely ask to detach and will be detached when the last ref is dropped + stream.detachIfPossible(this.server.globalThis); + this.byte_stream = byte_stream; this.response_buf_owned = byte_stream.buffer.moveToUnmanaged(); @@ -2632,6 +2643,15 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp } } + if (lock.onReceiveValue != null or lock.task != null) { + // someone else is waiting for the stream or waiting for `onStartStreaming` + const readable = value.toReadableStream(this.server.globalThis); + readable.ensureStillAlive(); + readable.protect(); + this.doRenderWithBody(value); + return; + } + // when there's no stream, we need to lock.onReceiveValue = doRenderWithBodyLocked; lock.task = this; diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 467667953..7edbd42e6 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -4419,6 +4419,10 @@ GlobalObject::PromiseFunctions GlobalObject::promiseHandlerID(EncodedJSValue (*h return GlobalObject::PromiseFunctions::CallbackJob__onResolve; } else if (handler == CallbackJob__onReject) { return GlobalObject::PromiseFunctions::CallbackJob__onReject; + } else if (handler == Bun__BodyValueBufferer__onResolveStream) { + return GlobalObject::PromiseFunctions::Bun__BodyValueBufferer__onResolveStream; + } else if (handler == Bun__BodyValueBufferer__onRejectStream) { + return GlobalObject::PromiseFunctions::Bun__BodyValueBufferer__onRejectStream; } else { RELEASE_ASSERT_NOT_REACHED(); } diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h index 5ba155c99..029f90132 100644 --- a/src/bun.js/bindings/ZigGlobalObject.h +++ b/src/bun.js/bindings/ZigGlobalObject.h @@ -341,8 +341,11 @@ public: CallbackJob__onResolve, CallbackJob__onReject, + + Bun__BodyValueBufferer__onRejectStream, + Bun__BodyValueBufferer__onResolveStream, }; - static constexpr size_t promiseFunctionsSize = 22; + static constexpr size_t promiseFunctionsSize = 24; static PromiseFunctions promiseHandlerID(EncodedJSValue (*handler)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)); diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index 08d897590..18b7c8bce 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -3430,6 +3430,7 @@ pub const HTTPServerRequestContext = JSC.API.HTTPServer.RequestContext; pub const HTTPSSLServerRequestContext = JSC.API.HTTPSServer.RequestContext; pub const HTTPDebugServerRequestContext = JSC.API.DebugHTTPServer.RequestContext; pub const HTTPDebugSSLServerRequestContext = JSC.API.DebugHTTPSServer.RequestContext; +pub const BodyValueBuffererContext = JSC.WebCore.BodyValueBufferer; pub const TestScope = @import("../test/jest.zig").TestScope; comptime { if (!is_bindgen) { @@ -3458,5 +3459,6 @@ comptime { _ = ZigString__free_global; TestScope.shim.ref(); + BodyValueBuffererContext.shim.ref(); } } diff --git a/src/bun.js/bindings/header-gen.zig b/src/bun.js/bindings/header-gen.zig index e27bd286f..6f671e271 100644 --- a/src/bun.js/bindings/header-gen.zig +++ b/src/bun.js/bindings/header-gen.zig @@ -762,191 +762,191 @@ pub fn HeaderGen(comptime first_import: type, comptime second_import: type, comp inline for (TypesToCheck) |BaseType| { const all_decls = comptime std.meta.declarations(BaseType); inline for (all_decls) |_decls| { - if (comptime _decls.is_pub) { - @setEvalBranchQuota(99999); - const Type = @field(BaseType, _decls.name); - if (@TypeOf(Type) == type) { - const TypeTypeInfo: std.builtin.Type = @typeInfo(@field(BaseType, _decls.name)); - const is_container_type = switch (TypeTypeInfo) { - .Opaque, .Struct, .Enum => true, - else => false, - }; - - if (is_container_type and (@hasDecl(Type, "Extern") or @hasDecl(Type, "Export") or @hasDecl(Type, "lazy_static_functions"))) { - const identifier = comptime std.fmt.comptimePrint("{s}_{s}", .{ Type.shim.name, Type.shim.namespace }); - if (!bufset.contains(identifier)) { - self.startFile( - Type, - Type.shim.name, - writer, - impl, - ); - - bufset.insert(identifier) catch unreachable; - - var gen = C_Generator.init(Type.name, @TypeOf(writer), writer); - defer gen.deinit(); - - if (@hasDecl(Type, "Extern")) { - if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) { - if (to_get_sizes > 0) { - impl_second_writer.writeAll(", ") catch unreachable; - impl_third_writer.writeAll(", ") catch unreachable; - impl_fourth_writer.writeAll(", ") catch unreachable; - } + // if (comptime _decls.is_pub) { + @setEvalBranchQuota(99999); + const Type = @field(BaseType, _decls.name); + if (@TypeOf(Type) == type) { + const TypeTypeInfo: std.builtin.Type = @typeInfo(@field(BaseType, _decls.name)); + const is_container_type = switch (TypeTypeInfo) { + .Opaque, .Struct, .Enum => true, + else => false, + }; + + if (is_container_type and (@hasDecl(Type, "Extern") or @hasDecl(Type, "Export") or @hasDecl(Type, "lazy_static_functions"))) { + const identifier = comptime std.fmt.comptimePrint("{s}_{s}", .{ Type.shim.name, Type.shim.namespace }); + if (!bufset.contains(identifier)) { + self.startFile( + Type, + Type.shim.name, + writer, + impl, + ); + + bufset.insert(identifier) catch unreachable; + + var gen = C_Generator.init(Type.name, @TypeOf(writer), writer); + defer gen.deinit(); + + if (@hasDecl(Type, "Extern")) { + if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) { + if (to_get_sizes > 0) { + impl_second_writer.writeAll(", ") catch unreachable; + impl_third_writer.writeAll(", ") catch unreachable; + impl_fourth_writer.writeAll(", ") catch unreachable; } + } - const formatted_name = comptime brk: { - var original: [Type.name.len]u8 = undefined; - _ = std.mem.replace(u8, Type.name, ":", "_", &original); - break :brk original; + const formatted_name = comptime brk: { + var original: [Type.name.len]u8 = undefined; + _ = std.mem.replace(u8, Type.name, ":", "_", &original); + break :brk original; + }; + + if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) { + impl_third_writer.print("sizeof({s})", .{comptime Type.name}) catch unreachable; + impl_fourth_writer.print("alignof({s})", .{comptime Type.name}) catch unreachable; + impl_second_writer.print("\"{s}\"", .{formatted_name}) catch unreachable; + to_get_sizes += 1; + } + const ExternList = comptime brk: { + const Sorder = struct { + pub fn lessThan(_: @This(), lhs: []const u8, rhs: []const u8) bool { + return std.ascii.orderIgnoreCase(lhs, rhs) == std.math.Order.lt; + } }; - - if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) { - impl_third_writer.print("sizeof({s})", .{comptime Type.name}) catch unreachable; - impl_fourth_writer.print("alignof({s})", .{comptime Type.name}) catch unreachable; - impl_second_writer.print("\"{s}\"", .{formatted_name}) catch unreachable; - to_get_sizes += 1; - } - const ExternList = comptime brk: { - const Sorder = struct { - pub fn lessThan(_: @This(), lhs: []const u8, rhs: []const u8) bool { - return std.ascii.orderIgnoreCase(lhs, rhs) == std.math.Order.lt; - } + var extern_list = Type.Extern; + std.sort.block([]const u8, &extern_list, Sorder{}, Sorder.lessThan); + break :brk extern_list; + }; + // impl_writer.print(" #include {s}\n", .{Type.include}) catch unreachable; + inline for (&ExternList) |extern_decl| { + if (@hasDecl(Type, extern_decl)) { + const normalized_name = comptime brk: { + var _normalized_name: [Type.name.len]u8 = undefined; + _ = std.mem.replace(u8, Type.name, ":", "_", &_normalized_name); + break :brk _normalized_name; }; - var extern_list = Type.Extern; - std.sort.block([]const u8, &extern_list, Sorder{}, Sorder.lessThan); - break :brk extern_list; - }; - // impl_writer.print(" #include {s}\n", .{Type.include}) catch unreachable; - inline for (&ExternList) |extern_decl| { - if (@hasDecl(Type, extern_decl)) { - const normalized_name = comptime brk: { - var _normalized_name: [Type.name.len]u8 = undefined; - _ = std.mem.replace(u8, Type.name, ":", "_", &_normalized_name); - break :brk _normalized_name; - }; - - processDecl( - self, - writer, - &gen, - Type, - comptime std.meta.declarationInfo(Type, extern_decl), - comptime extern_decl, - &normalized_name, - ); - } + + processDecl( + self, + writer, + &gen, + Type, + comptime std.meta.declarationInfo(Type, extern_decl), + comptime extern_decl, + &normalized_name, + ); } } + } - if (@hasDecl(Type, "Export")) { - const ExportList = comptime brk: { - const SortContext = struct { - data: []StaticExport, - pub fn lessThan(comptime ctx: @This(), comptime lhs: usize, comptime rhs: usize) bool { - return std.ascii.orderIgnoreCase(ctx.data[lhs].symbol_name, ctx.data[rhs].symbol_name) == std.math.Order.lt; - } - pub fn swap(comptime ctx: @This(), comptime lhs: usize, comptime rhs: usize) void { - const tmp = ctx.data[lhs]; - ctx.data[lhs] = ctx.data[rhs]; - ctx.data[rhs] = tmp; - } - }; - var extern_list = Type.Export; - std.sort.insertionContext(0, extern_list.len, SortContext{ - .data = &extern_list, - }); - break :brk extern_list; - }; - - gen.direction = C_Generator.Direction.export_zig; - if (ExportList.len > 0) { - gen.write("\n#ifdef __cplusplus\n\n"); - inline for (ExportList) |static_export| { - processStaticExport( - self, - file, - &gen, - comptime static_export, - ); + if (@hasDecl(Type, "Export")) { + const ExportList = comptime brk: { + const SortContext = struct { + data: []StaticExport, + pub fn lessThan(comptime ctx: @This(), comptime lhs: usize, comptime rhs: usize) bool { + return std.ascii.orderIgnoreCase(ctx.data[lhs].symbol_name, ctx.data[rhs].symbol_name) == std.math.Order.lt; + } + pub fn swap(comptime ctx: @This(), comptime lhs: usize, comptime rhs: usize) void { + const tmp = ctx.data[lhs]; + ctx.data[lhs] = ctx.data[rhs]; + ctx.data[rhs] = tmp; } - gen.write("\n#endif\n"); + }; + var extern_list = Type.Export; + std.sort.insertionContext(0, extern_list.len, SortContext{ + .data = &extern_list, + }); + break :brk extern_list; + }; + + gen.direction = C_Generator.Direction.export_zig; + if (ExportList.len > 0) { + gen.write("\n#ifdef __cplusplus\n\n"); + inline for (ExportList) |static_export| { + processStaticExport( + self, + file, + &gen, + comptime static_export, + ); } + gen.write("\n#endif\n"); } - - // if (@hasDecl(Type, "lazy_static_functions")) { - // const ExportLIst = comptime brk: { - // const Sorder = struct { - // pub fn lessThan(_: @This(), comptime lhs: StaticExport, comptime rhs: StaticExport) bool { - // return std.ascii.orderIgnoreCase(lhs.symbol_name, rhs.symbol_name) == std.math.Order.lt; - // } - // }; - // var extern_list = Type.lazy_static_functions; - // std.sort.block(StaticExport, &extern_list, Sorder{}, Sorder.lessThan); - // break :brk extern_list; - // }; - - // gen.direction = C_Generator.Direction.export_zig; - // if (ExportLIst.len > 0) { - // lazy_function_definitions_writer.writeAll("\n#pragma mark ") catch unreachable; - // lazy_function_definitions_writer.writeAll(Type.shim.name) catch unreachable; - // lazy_function_definitions_writer.writeAll("\n\n") catch unreachable; - - // inline for (ExportLIst) |static_export| { - // const exp: StaticExport = static_export; - // lazy_function_definitions_writer.print(" JSC::LazyProperty<Zig::GlobalObject, Zig::JSFFIFunction> m_{s};", .{exp.symbol_name}) catch unreachable; - // lazy_function_definitions_writer.writeAll("\n") catch unreachable; - - // lazy_function_definitions_writer.print( - // " Zig::JSFFIFunction* get__{s}(Zig::GlobalObject *globalObject) {{ return m_{s}.getInitializedOnMainThread(globalObject); }}", - // .{ exp.symbol_name, exp.symbol_name }, - // ) catch unreachable; - // lazy_function_definitions_writer.writeAll("\n") catch unreachable; - - // const impl_format = - // \\ - // \\ m_{s}.initLater( - // \\ [](const JSC::LazyProperty<Zig::GlobalObject, Zig::JSFFIFunction>::Initializer& init) {{ - // \\ WTF::String functionName = WTF::String("{s}"_s); - // \\ Zig::JSFFIFunction* function = Zig::JSFFIFunction::create( - // \\ init.vm, - // \\ init.owner, - // \\ 1, - // \\ functionName, - // \\ {s}, - // \\ JSC::NoIntrinsic, - // \\ {s} - // \\ ); - // \\ init.set(function); - // \\ }}); - // \\ - // ; - - // lazy_functions_buffer_writer.print( - // impl_format, - // .{ - // exp.symbol_name, - // exp.local_name, - // exp.symbol_name, - // exp.symbol_name, - // }, - // ) catch unreachable; - - // lazy_function_visitor_writer.print( - // \\ this->m_{s}.visit(visitor); - // \\ - // , - // .{exp.symbol_name}, - // ) catch unreachable; - // } - // gen.write("\n"); - // } - // } } + + // if (@hasDecl(Type, "lazy_static_functions")) { + // const ExportLIst = comptime brk: { + // const Sorder = struct { + // pub fn lessThan(_: @This(), comptime lhs: StaticExport, comptime rhs: StaticExport) bool { + // return std.ascii.orderIgnoreCase(lhs.symbol_name, rhs.symbol_name) == std.math.Order.lt; + // } + // }; + // var extern_list = Type.lazy_static_functions; + // std.sort.block(StaticExport, &extern_list, Sorder{}, Sorder.lessThan); + // break :brk extern_list; + // }; + + // gen.direction = C_Generator.Direction.export_zig; + // if (ExportLIst.len > 0) { + // lazy_function_definitions_writer.writeAll("\n#pragma mark ") catch unreachable; + // lazy_function_definitions_writer.writeAll(Type.shim.name) catch unreachable; + // lazy_function_definitions_writer.writeAll("\n\n") catch unreachable; + + // inline for (ExportLIst) |static_export| { + // const exp: StaticExport = static_export; + // lazy_function_definitions_writer.print(" JSC::LazyProperty<Zig::GlobalObject, Zig::JSFFIFunction> m_{s};", .{exp.symbol_name}) catch unreachable; + // lazy_function_definitions_writer.writeAll("\n") catch unreachable; + + // lazy_function_definitions_writer.print( + // " Zig::JSFFIFunction* get__{s}(Zig::GlobalObject *globalObject) {{ return m_{s}.getInitializedOnMainThread(globalObject); }}", + // .{ exp.symbol_name, exp.symbol_name }, + // ) catch unreachable; + // lazy_function_definitions_writer.writeAll("\n") catch unreachable; + + // const impl_format = + // \\ + // \\ m_{s}.initLater( + // \\ [](const JSC::LazyProperty<Zig::GlobalObject, Zig::JSFFIFunction>::Initializer& init) {{ + // \\ WTF::String functionName = WTF::String("{s}"_s); + // \\ Zig::JSFFIFunction* function = Zig::JSFFIFunction::create( + // \\ init.vm, + // \\ init.owner, + // \\ 1, + // \\ functionName, + // \\ {s}, + // \\ JSC::NoIntrinsic, + // \\ {s} + // \\ ); + // \\ init.set(function); + // \\ }}); + // \\ + // ; + + // lazy_functions_buffer_writer.print( + // impl_format, + // .{ + // exp.symbol_name, + // exp.local_name, + // exp.symbol_name, + // exp.symbol_name, + // }, + // ) catch unreachable; + + // lazy_function_visitor_writer.print( + // \\ this->m_{s}.visit(visitor); + // \\ + // , + // .{exp.symbol_name}, + // ) catch unreachable; + // } + // gen.write("\n"); + // } + // } } } } + // } } } diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h index 1ed495dad..9620a21e8 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/bun.js/bindings/headers-cpp.h @@ -182,6 +182,14 @@ extern "C" const size_t Zig__ConsoleClient_object_align_ = alignof(Zig::ConsoleC extern "C" const size_t Bun__Timer_object_size_ = sizeof(Bun__Timer); extern "C" const size_t Bun__Timer_object_align_ = alignof(Bun__Timer); +#ifndef INCLUDED_ +#define INCLUDED_ +#include "" +#endif + +extern "C" const size_t Bun__BodyValueBufferer_object_size_ = sizeof(Bun__BodyValueBufferer); +extern "C" const size_t Bun__BodyValueBufferer_object_align_ = alignof(Bun__BodyValueBufferer); + const size_t sizes[38] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::DOMFormData), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(JSC::JSModuleLoader), sizeof(WebCore::AbortSignal), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(JSC::JSMap), sizeof(JSC::JSValue), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(FFI__ptr), sizeof(Reader__u8), sizeof(Reader__u16), sizeof(Reader__u32), sizeof(Reader__ptr), sizeof(Reader__i8), sizeof(Reader__i16), sizeof(Reader__i32), sizeof(Reader__f32), sizeof(Reader__f64), sizeof(Reader__i64), sizeof(Reader__u64), sizeof(Reader__intptr), sizeof(Zig::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink), sizeof(FileSink)}; const char* names[38] = {"JSC__JSObject", "WebCore__DOMURL", "WebCore__DOMFormData", "WebCore__FetchHeaders", "SystemError", "JSC__JSCell", "JSC__JSString", "JSC__JSModuleLoader", "WebCore__AbortSignal", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__JSFunction", "JSC__JSGlobalObject", "JSC__JSMap", "JSC__JSValue", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "FFI__ptr", "Reader__u8", "Reader__u16", "Reader__u32", "Reader__ptr", "Reader__i8", "Reader__i16", "Reader__i32", "Reader__f32", "Reader__f64", "Reader__i64", "Reader__u64", "Reader__intptr", "Zig__GlobalObject", "Bun__Path", "ArrayBufferSink", "HTTPSResponseSink", "HTTPResponseSink", "FileSink"}; diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 96087b5ff..cffb9f0c9 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -814,6 +814,16 @@ ZIG_DECL JSC__JSValue Bun__HTTPRequestContextDebugTLS__onResolveStream(JSC__JSGl #endif +#pragma mark - Bun__BodyValueBufferer + + +#ifdef __cplusplus + +ZIG_DECL JSC__JSValue Bun__BodyValueBufferer__onRejectStream(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); +ZIG_DECL JSC__JSValue Bun__BodyValueBufferer__onResolveStream(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); + +#endif + #ifdef __cplusplus ZIG_DECL JSC__JSValue Bun__TestScope__onReject(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1); diff --git a/src/bun.js/bindings/headers.zig b/src/bun.js/bindings/headers.zig index 6d8f0e774..a696e86b1 100644 --- a/src/bun.js/bindings/headers.zig +++ b/src/bun.js/bindings/headers.zig @@ -81,303 +81,303 @@ pub const JSC__JSObject = bJSC__JSObject; pub const JSC__JSCell = bJSC__JSCell; pub const JSC__JSGlobalObject = bJSC__JSGlobalObject; pub const JSC__JSInternalPromise = bJSC__JSInternalPromise; -pub extern "C" fn JSC__JSObject__create(arg0: *bindings.JSGlobalObject, arg1: usize, arg2: ?*anyopaque, ArgFn3: ?*const fn (?*anyopaque, [*c]bindings.JSObject, *bindings.JSGlobalObject) callconv(.C) void) JSC__JSValue; -pub extern "C" fn JSC__JSObject__getArrayLength(arg0: [*c]bindings.JSObject) usize; -pub extern "C" fn JSC__JSObject__getDirect(arg0: [*c]bindings.JSObject, arg1: *bindings.JSGlobalObject, arg2: [*c]const ZigString) JSC__JSValue; -pub extern "C" fn JSC__JSObject__getIndex(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32) JSC__JSValue; -pub extern "C" fn JSC__JSObject__putRecord(arg0: [*c]bindings.JSObject, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; -pub extern "C" fn ZigString__external(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; -pub extern "C" fn ZigString__to16BitValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toAtomicValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toExternalU16(arg0: [*c]const u16, arg1: usize, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toExternalValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toExternalValueWithCallback(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject, ArgFn2: ?*const fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; -pub extern "C" fn ZigString__toRangeErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toSyntaxErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toTypeErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn ZigString__toValueGC(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__DOMURL__cast_(JSValue0: JSC__JSValue, arg1: *bindings.VM) ?*bindings.DOMURL; -pub extern "C" fn WebCore__DOMURL__fileSystemPath(arg0: ?*bindings.DOMURL) BunString; -pub extern "C" fn WebCore__DOMURL__href_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; -pub extern "C" fn WebCore__DOMURL__pathname_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; -pub extern "C" fn WebCore__DOMFormData__append(arg0: ?*bindings.DOMFormData, arg1: [*c]ZigString, arg2: [*c]ZigString) void; -pub extern "C" fn WebCore__DOMFormData__appendBlob(arg0: ?*bindings.DOMFormData, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: ?*anyopaque, arg4: [*c]ZigString) void; -pub extern "C" fn WebCore__DOMFormData__count(arg0: ?*bindings.DOMFormData) usize; -pub extern "C" fn WebCore__DOMFormData__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__DOMFormData__createFromURLQuery(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; -pub extern "C" fn WebCore__DOMFormData__fromJS(JSValue0: JSC__JSValue) ?*bindings.DOMFormData; -pub extern "C" fn WebCore__FetchHeaders__append(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString, arg3: *bindings.JSGlobalObject) void; -pub extern "C" fn WebCore__FetchHeaders__cast_(JSValue0: JSC__JSValue, arg1: *bindings.VM) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__clone(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__FetchHeaders__cloneThis(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__copyTo(arg0: ?*bindings.FetchHeaders, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]u8) void; -pub extern "C" fn WebCore__FetchHeaders__count(arg0: ?*bindings.FetchHeaders, arg1: [*c]u32, arg2: [*c]u32) void; -pub extern "C" fn WebCore__FetchHeaders__createEmpty(...) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__createFromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: ?*const anyopaque) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__createFromUWS(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) ?*bindings.FetchHeaders; -pub extern "C" fn WebCore__FetchHeaders__createValue(arg0: *bindings.JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) JSC__JSValue; -pub extern "C" fn WebCore__FetchHeaders__deref(arg0: ?*bindings.FetchHeaders) void; -pub extern "C" fn WebCore__FetchHeaders__fastGet_(arg0: ?*bindings.FetchHeaders, arg1: u8, arg2: [*c]ZigString) void; -pub extern "C" fn WebCore__FetchHeaders__fastHas_(arg0: ?*bindings.FetchHeaders, arg1: u8) bool; -pub extern "C" fn WebCore__FetchHeaders__fastRemove_(arg0: ?*bindings.FetchHeaders, arg1: u8) void; -pub extern "C" fn WebCore__FetchHeaders__get_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]ZigString, arg3: *bindings.JSGlobalObject) void; -pub extern "C" fn WebCore__FetchHeaders__has(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn WebCore__FetchHeaders__isEmpty(arg0: ?*bindings.FetchHeaders) bool; -pub extern "C" fn WebCore__FetchHeaders__put_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString, arg3: *bindings.JSGlobalObject) void; -pub extern "C" fn WebCore__FetchHeaders__remove(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) void; -pub extern "C" fn WebCore__FetchHeaders__toJS(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__FetchHeaders__toUWSResponse(arg0: ?*bindings.FetchHeaders, arg1: bool, arg2: ?*anyopaque) void; -pub extern "C" fn SystemError__toErrorInstance(arg0: [*c]const SystemError, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSCell__getObject(arg0: [*c]bindings.JSCell) [*c]bindings.JSObject; -pub extern "C" fn JSC__JSCell__getType(arg0: [*c]bindings.JSCell) u8; -pub extern "C" fn JSC__JSString__eql(arg0: [*c]const JSC__JSString, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.JSString) bool; -pub extern "C" fn JSC__JSString__is8Bit(arg0: [*c]const JSC__JSString) bool; -pub extern "C" fn JSC__JSString__iterator(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque) void; -pub extern "C" fn JSC__JSString__length(arg0: [*c]const JSC__JSString) usize; -pub extern "C" fn JSC__JSString__toObject(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject) [*c]bindings.JSObject; -pub extern "C" fn JSC__JSString__toZigString(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; -pub extern "C" fn JSC__JSModuleLoader__evaluate(arg0: *bindings.JSGlobalObject, arg1: [*c]const u8, arg2: usize, arg3: [*c]const u8, arg4: usize, arg5: [*c]const u8, arg6: usize, JSValue7: JSC__JSValue, arg8: [*c]bindings.JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSModuleLoader__loadAndEvaluateModule(arg0: *bindings.JSGlobalObject, arg1: [*c]const BunString) [*c]bindings.JSInternalPromise; -pub extern "C" fn WebCore__AbortSignal__aborted(arg0: ?*bindings.AbortSignal) bool; -pub extern "C" fn WebCore__AbortSignal__abortReason(arg0: ?*bindings.AbortSignal) JSC__JSValue; -pub extern "C" fn WebCore__AbortSignal__addListener(arg0: ?*bindings.AbortSignal, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque, JSC__JSValue) callconv(.C) void) ?*bindings.AbortSignal; -pub extern "C" fn WebCore__AbortSignal__cleanNativeBindings(arg0: ?*bindings.AbortSignal, arg1: ?*anyopaque) void; -pub extern "C" fn WebCore__AbortSignal__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__AbortSignal__createAbortError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__AbortSignal__createTimeoutError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__AbortSignal__fromJS(JSValue0: JSC__JSValue) ?*bindings.AbortSignal; -pub extern "C" fn WebCore__AbortSignal__ref(arg0: ?*bindings.AbortSignal) ?*bindings.AbortSignal; -pub extern "C" fn WebCore__AbortSignal__signal(arg0: ?*bindings.AbortSignal, JSValue1: JSC__JSValue) ?*bindings.AbortSignal; -pub extern "C" fn WebCore__AbortSignal__toJS(arg0: ?*bindings.AbortSignal, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn WebCore__AbortSignal__unref(arg0: ?*bindings.AbortSignal) ?*bindings.AbortSignal; -pub extern "C" fn JSC__JSPromise__asValue(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSPromise__create(arg0: *bindings.JSGlobalObject) ?*bindings.JSPromise; -pub extern "C" fn JSC__JSPromise__isHandled(arg0: [*c]const JSC__JSPromise, arg1: *bindings.VM) bool; -pub extern "C" fn JSC__JSPromise__reject(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSPromise__rejectAsHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSPromise__rejectAsHandledException(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.Exception) void; -pub extern "C" fn JSC__JSPromise__rejectedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.JSPromise; -pub extern "C" fn JSC__JSPromise__rejectedPromiseValue(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSPromise__rejectOnNextTickWithHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, arg3: bool) void; -pub extern "C" fn JSC__JSPromise__rejectWithCaughtException(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, arg2: bJSC__ThrowScope) void; -pub extern "C" fn JSC__JSPromise__resolve(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSPromise__resolvedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.JSPromise; -pub extern "C" fn JSC__JSPromise__resolvedPromiseValue(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSPromise__resolveOnNextTick(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSPromise__result(arg0: ?*bindings.JSPromise, arg1: *bindings.VM) JSC__JSValue; -pub extern "C" fn JSC__JSPromise__setHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.VM) void; -pub extern "C" fn JSC__JSPromise__status(arg0: [*c]const JSC__JSPromise, arg1: *bindings.VM) u32; -pub extern "C" fn JSC__JSInternalPromise__create(arg0: *bindings.JSGlobalObject) [*c]bindings.JSInternalPromise; -pub extern "C" fn JSC__JSInternalPromise__isHandled(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) bool; -pub extern "C" fn JSC__JSInternalPromise__reject(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSInternalPromise__rejectAsHandled(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSInternalPromise__rejectAsHandledException(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.Exception) void; -pub extern "C" fn JSC__JSInternalPromise__rejectedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) [*c]bindings.JSInternalPromise; -pub extern "C" fn JSC__JSInternalPromise__rejectWithCaughtException(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, arg2: bJSC__ThrowScope) void; -pub extern "C" fn JSC__JSInternalPromise__resolve(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSInternalPromise__resolvedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) [*c]bindings.JSInternalPromise; -pub extern "C" fn JSC__JSInternalPromise__result(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) JSC__JSValue; -pub extern "C" fn JSC__JSInternalPromise__setHandled(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.VM) void; -pub extern "C" fn JSC__JSInternalPromise__status(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) u32; -pub extern "C" fn JSC__JSFunction__optimizeSoon(JSValue0: JSC__JSValue) void; -pub extern "C" fn JSC__JSGlobalObject__bunVM(arg0: *bindings.JSGlobalObject) ?*bindings.VirtualMachine; -pub extern "C" fn JSC__JSGlobalObject__createAggregateError(arg0: *bindings.JSGlobalObject, arg1: [*c]*anyopaque, arg2: u16, arg3: [*c]const ZigString) JSC__JSValue; -pub extern "C" fn JSC__JSGlobalObject__createSyntheticModule_(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString, arg2: usize, arg3: [*c]bindings.JSValue, arg4: usize) void; -pub extern "C" fn JSC__JSGlobalObject__deleteModuleRegistryEntry(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) void; -pub extern "C" fn JSC__JSGlobalObject__generateHeapSnapshot(arg0: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSGlobalObject__getCachedObject(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString) JSC__JSValue; -pub extern "C" fn JSC__JSGlobalObject__handleRejectedPromises(arg0: *bindings.JSGlobalObject) void; -pub extern "C" fn JSC__JSGlobalObject__putCachedObject(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, JSValue2: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSGlobalObject__queueMicrotaskJob(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void; -pub extern "C" fn JSC__JSGlobalObject__reload(arg0: *bindings.JSGlobalObject) void; -pub extern "C" fn JSC__JSGlobalObject__startRemoteInspector(arg0: *bindings.JSGlobalObject, arg1: [*c]u8, arg2: u16) bool; -pub extern "C" fn JSC__JSGlobalObject__vm(arg0: *bindings.JSGlobalObject) *bindings.VM; -pub extern "C" fn JSC__JSMap__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSMap__get_(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSMap__has(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; -pub extern "C" fn JSC__JSMap__remove(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; -pub extern "C" fn JSC__JSMap__set(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void; -pub extern "C" fn JSC__JSValue___then(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, ArgFn3: ?*const fn (*bindings.JSGlobalObject, *bindings.CallFrame) callconv(.C) JSC__JSValue, ArgFn4: ?*const fn (*bindings.JSGlobalObject, *bindings.CallFrame) callconv(.C) JSC__JSValue) void; -pub extern "C" fn JSC__JSValue__asArrayBuffer_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*Bun__ArrayBuffer) bool; -pub extern "C" fn JSC__JSValue__asBigIntCompare(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) u8; -pub extern "C" fn JSC__JSValue__asCell(JSValue0: JSC__JSValue) [*c]bindings.JSCell; -pub extern "C" fn JSC__JSValue__asInternalPromise(JSValue0: JSC__JSValue) [*c]bindings.JSInternalPromise; -pub extern "C" fn JSC__JSValue__asNumber(JSValue0: JSC__JSValue) f64; -pub extern "C" fn JSC__JSValue__asObject(JSValue0: JSC__JSValue) bJSC__JSObject; -pub extern "C" fn JSC__JSValue__asPromise(JSValue0: JSC__JSValue) ?*bindings.JSPromise; -pub extern "C" fn JSC__JSValue__asString(JSValue0: JSC__JSValue) [*c]bindings.JSString; -pub extern "C" fn JSC__JSValue__coerceToDouble(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) f64; -pub extern "C" fn JSC__JSValue__coerceToInt32(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) i32; -pub extern "C" fn JSC__JSValue__coerceToInt64(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) i64; -pub extern "C" fn JSC__JSValue__createEmptyArray(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createEmptyObject(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createInternalPromise(arg0: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createObject2(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, arg2: [*c]const ZigString, JSValue3: JSC__JSValue, JSValue4: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createRangeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createRopeString(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createStringArray(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, arg2: usize, arg3: bool) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createTypeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__createUninitializedUint8Array(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; -pub extern "C" fn JSC__JSValue__deepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__deepMatch(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject, arg3: bool) bool; -pub extern "C" fn JSC__JSValue__eqlCell(JSValue0: JSC__JSValue, arg1: [*c]bindings.JSCell) bool; -pub extern "C" fn JSC__JSValue__eqlValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__fastGet_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u8) JSC__JSValue; -pub extern "C" fn JSC__JSValue__fastGetDirect_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u8) JSC__JSValue; -pub extern "C" fn JSC__JSValue__forEach(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.VM, *bindings.JSGlobalObject, ?*anyopaque, JSC__JSValue) callconv(.C) void) void; -pub extern "C" fn JSC__JSValue__forEachProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.JSGlobalObject, ?*anyopaque, [*c]ZigString, JSC__JSValue, bool) callconv(.C) void) void; -pub extern "C" fn JSC__JSValue__forEachPropertyOrdered(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.JSGlobalObject, ?*anyopaque, [*c]ZigString, JSC__JSValue, bool) callconv(.C) void) void; -pub extern "C" fn JSC__JSValue__fromEntries(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString, arg2: [*c]ZigString, arg3: usize, arg4: bool) JSC__JSValue; -pub extern "C" fn JSC__JSValue__fromInt64NoTruncate(arg0: *bindings.JSGlobalObject, arg1: i64) JSC__JSValue; -pub extern "C" fn JSC__JSValue__fromUInt64NoTruncate(arg0: *bindings.JSGlobalObject, arg1: u64) JSC__JSValue; -pub extern "C" fn JSC__JSValue__getClassName(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; -pub extern "C" fn JSC__JSValue__getErrorsProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__getIfPropertyExistsFromPath(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSValue__getIfPropertyExistsImpl(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]const u8, arg3: u32) JSC__JSValue; -pub extern "C" fn JSC__JSValue__getLengthIfPropertyExistsInternal(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) f64; -pub extern "C" fn JSC__JSValue__getNameProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; -pub extern "C" fn JSC__JSValue__getPrototype(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__getSymbolDescription(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; -pub extern "C" fn JSC__JSValue__getUnixTimestamp(JSValue0: JSC__JSValue) f64; -pub extern "C" fn JSC__JSValue__isAggregateError(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__isAnyError(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isAnyInt(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isBigInt(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isBigInt32(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isBoolean(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isCallable(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; -pub extern "C" fn JSC__JSValue__isClass(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__isConstructor(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isCustomGetterSetter(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isError(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isException(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; -pub extern "C" fn JSC__JSValue__isGetterSetter(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isHeapBigInt(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isInstanceOf(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isInt32(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isInt32AsAnyInt(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isIterable(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__isNumber(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isObject(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isPrimitive(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isSameValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__isSymbol(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__isTerminationException(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; -pub extern "C" fn JSC__JSValue__isUInt32AsAnyInt(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__jestDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__jestDeepMatch(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject, arg3: bool) bool; -pub extern "C" fn JSC__JSValue__jestStrictDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__jsBoolean(arg0: bool) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsDoubleNumber(arg0: f64) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsNull(...) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsNumberFromChar(arg0: u8) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsNumberFromDouble(arg0: f64) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsNumberFromInt64(arg0: i64) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsNumberFromU16(arg0: u16) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsonStringify(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32, arg3: [*c]BunString) void; -pub extern "C" fn JSC__JSValue__jsTDZValue(...) JSC__JSValue; -pub extern "C" fn JSC__JSValue__jsType(JSValue0: JSC__JSValue) u8; -pub extern "C" fn JSC__JSValue__jsUndefined(...) JSC__JSValue; -pub extern "C" fn JSC__JSValue__makeWithNameAndPrototype(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque, arg2: ?*anyopaque, arg3: [*c]const ZigString) JSC__JSValue; -pub extern "C" fn JSC__JSValue__parseJSON(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; -pub extern "C" fn JSC__JSValue__push(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__JSValue__put(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]const ZigString, JSValue3: JSC__JSValue) void; -pub extern "C" fn JSC__JSValue__putIndex(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32, JSValue3: JSC__JSValue) void; -pub extern "C" fn JSC__JSValue__putRecord(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; -pub extern "C" fn JSC__JSValue__strictDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__stringIncludes(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__symbolFor(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; -pub extern "C" fn JSC__JSValue__symbolKeyFor(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) bool; -pub extern "C" fn JSC__JSValue__toBoolean(JSValue0: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__toBooleanSlow(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; -pub extern "C" fn JSC__JSValue__toError_(JSValue0: JSC__JSValue) JSC__JSValue; -pub extern "C" fn JSC__JSValue__toInt32(JSValue0: JSC__JSValue) i32; -pub extern "C" fn JSC__JSValue__toInt64(JSValue0: JSC__JSValue) i64; -pub extern "C" fn JSC__JSValue__toMatch(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; -pub extern "C" fn JSC__JSValue__toObject(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSObject; -pub extern "C" fn JSC__JSValue__toString(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSString; -pub extern "C" fn JSC__JSValue__toStringOrNull(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSString; -pub extern "C" fn JSC__JSValue__toUInt64NoTruncate(JSValue0: JSC__JSValue) u64; -pub extern "C" fn JSC__JSValue__toZigException(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigException) void; -pub extern "C" fn JSC__JSValue__toZigString(JSValue0: JSC__JSValue, arg1: [*c]ZigString, arg2: *bindings.JSGlobalObject) void; -pub extern "C" fn JSC__Exception__create(arg0: *bindings.JSGlobalObject, arg1: [*c]bindings.JSObject, StackCaptureAction2: u8) [*c]bindings.Exception; -pub extern "C" fn JSC__Exception__getStackTrace(arg0: [*c]bindings.Exception, arg1: [*c]ZigStackTrace) void; -pub extern "C" fn JSC__Exception__value(arg0: [*c]bindings.Exception) JSC__JSValue; -pub extern "C" fn JSC__VM__blockBytesAllocated(arg0: *bindings.VM) usize; -pub extern "C" fn JSC__VM__clearExecutionTimeLimit(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__collectAsync(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__create(HeapType0: u8) *bindings.VM; -pub extern "C" fn JSC__VM__deferGC(arg0: *bindings.VM, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque) callconv(.C) void) void; -pub extern "C" fn JSC__VM__deinit(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject) void; -pub extern "C" fn JSC__VM__deleteAllCode(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject) void; -pub extern "C" fn JSC__VM__drainMicrotasks(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__executionForbidden(arg0: *bindings.VM) bool; -pub extern "C" fn JSC__VM__externalMemorySize(arg0: *bindings.VM) usize; -pub extern "C" fn JSC__VM__heapSize(arg0: *bindings.VM) usize; -pub extern "C" fn JSC__VM__holdAPILock(arg0: *bindings.VM, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque) callconv(.C) void) void; -pub extern "C" fn JSC__VM__isEntered(arg0: *bindings.VM) bool; -pub extern "C" fn JSC__VM__isJITEnabled(...) bool; -pub extern "C" fn JSC__VM__notifyNeedDebuggerBreak(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__notifyNeedShellTimeoutCheck(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__notifyNeedTermination(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__notifyNeedWatchdogCheck(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__releaseWeakRefs(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__runGC(arg0: *bindings.VM, arg1: bool) JSC__JSValue; -pub extern "C" fn JSC__VM__setControlFlowProfiler(arg0: *bindings.VM, arg1: bool) void; -pub extern "C" fn JSC__VM__setExecutionForbidden(arg0: *bindings.VM, arg1: bool) void; -pub extern "C" fn JSC__VM__setExecutionTimeLimit(arg0: *bindings.VM, arg1: f64) void; -pub extern "C" fn JSC__VM__shrinkFootprint(arg0: *bindings.VM) void; -pub extern "C" fn JSC__VM__throwError(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; -pub extern "C" fn JSC__VM__whenIdle(arg0: *bindings.VM, ArgFn1: ?*const fn (...) callconv(.C) void) void; -pub extern "C" fn JSC__ThrowScope__clearException(arg0: [*c]bindings.ThrowScope) void; -pub extern "C" fn JSC__ThrowScope__declare(arg0: *bindings.VM, arg1: [*c]u8, arg2: [*c]u8, arg3: usize) bJSC__ThrowScope; -pub extern "C" fn JSC__ThrowScope__exception(arg0: [*c]bindings.ThrowScope) [*c]bindings.Exception; -pub extern "C" fn JSC__ThrowScope__release(arg0: [*c]bindings.ThrowScope) void; -pub extern "C" fn JSC__CatchScope__clearException(arg0: [*c]bindings.CatchScope) void; -pub extern "C" fn JSC__CatchScope__declare(arg0: *bindings.VM, arg1: [*c]u8, arg2: [*c]u8, arg3: usize) bJSC__CatchScope; -pub extern "C" fn JSC__CatchScope__exception(arg0: [*c]bindings.CatchScope) [*c]bindings.Exception; -pub extern "C" fn FFI__ptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__u8__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__u16__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__u32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__ptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__i8__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__i16__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__i32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__f32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__f64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__i64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__u64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Reader__intptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; -pub extern "C" fn Zig__GlobalObject__create(arg0: ?*anyopaque, arg1: i32, arg2: bool, arg3: ?*anyopaque) *bindings.JSGlobalObject; -pub extern "C" fn Zig__GlobalObject__getModuleRegistryMap(arg0: *bindings.JSGlobalObject) ?*anyopaque; -pub extern "C" fn Zig__GlobalObject__resetModuleRegistryMap(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) bool; -pub extern "C" fn Bun__Path__create(arg0: *bindings.JSGlobalObject, arg1: bool) JSC__JSValue; -pub extern "C" fn ArrayBufferSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern "C" fn ArrayBufferSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; -pub extern "C" fn ArrayBufferSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern "C" fn ArrayBufferSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; -pub extern "C" fn ArrayBufferSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; -pub extern "C" fn ArrayBufferSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern "C" fn HTTPSResponseSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern "C" fn HTTPSResponseSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; -pub extern "C" fn HTTPSResponseSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern "C" fn HTTPSResponseSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; -pub extern "C" fn HTTPSResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; -pub extern "C" fn HTTPSResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern "C" fn HTTPResponseSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern "C" fn HTTPResponseSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; -pub extern "C" fn HTTPResponseSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern "C" fn HTTPResponseSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; -pub extern "C" fn HTTPResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; -pub extern "C" fn HTTPResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern "C" fn FileSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; -pub extern "C" fn FileSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; -pub extern "C" fn FileSink__detachPtr(JSValue0: JSC__JSValue) void; -pub extern "C" fn FileSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; -pub extern "C" fn FileSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; -pub extern "C" fn FileSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; -pub extern "C" fn ZigException__fromException(arg0: [*c]bindings.Exception) ZigException; +pub extern fn JSC__JSObject__create(arg0: *bindings.JSGlobalObject, arg1: usize, arg2: ?*anyopaque, ArgFn3: ?*const fn (?*anyopaque, [*c]bindings.JSObject, *bindings.JSGlobalObject) callconv(.C) void) JSC__JSValue; +pub extern fn JSC__JSObject__getArrayLength(arg0: [*c]bindings.JSObject) usize; +pub extern fn JSC__JSObject__getDirect(arg0: [*c]bindings.JSObject, arg1: *bindings.JSGlobalObject, arg2: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSObject__getIndex(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32) JSC__JSValue; +pub extern fn JSC__JSObject__putRecord(arg0: [*c]bindings.JSObject, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; +pub extern fn ZigString__external(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; +pub extern fn ZigString__to16BitValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toAtomicValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalU16(arg0: [*c]const u16, arg1: usize, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toExternalValueWithCallback(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject, ArgFn2: ?*const fn (?*anyopaque, ?*anyopaque, usize) callconv(.C) void) JSC__JSValue; +pub extern fn ZigString__toRangeErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toSyntaxErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toTypeErrorInstance(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toValue(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn ZigString__toValueGC(arg0: [*c]const ZigString, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__DOMURL__cast_(JSValue0: JSC__JSValue, arg1: *bindings.VM) ?*bindings.DOMURL; +pub extern fn WebCore__DOMURL__fileSystemPath(arg0: ?*bindings.DOMURL) BunString; +pub extern fn WebCore__DOMURL__href_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; +pub extern fn WebCore__DOMURL__pathname_(arg0: ?*bindings.DOMURL, arg1: [*c]ZigString) void; +pub extern fn WebCore__DOMFormData__append(arg0: ?*bindings.DOMFormData, arg1: [*c]ZigString, arg2: [*c]ZigString) void; +pub extern fn WebCore__DOMFormData__appendBlob(arg0: ?*bindings.DOMFormData, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: ?*anyopaque, arg4: [*c]ZigString) void; +pub extern fn WebCore__DOMFormData__count(arg0: ?*bindings.DOMFormData) usize; +pub extern fn WebCore__DOMFormData__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__DOMFormData__createFromURLQuery(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; +pub extern fn WebCore__DOMFormData__fromJS(JSValue0: JSC__JSValue) ?*bindings.DOMFormData; +pub extern fn WebCore__FetchHeaders__append(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString, arg3: *bindings.JSGlobalObject) void; +pub extern fn WebCore__FetchHeaders__cast_(JSValue0: JSC__JSValue, arg1: *bindings.VM) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__clone(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__cloneThis(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__copyTo(arg0: ?*bindings.FetchHeaders, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]u8) void; +pub extern fn WebCore__FetchHeaders__count(arg0: ?*bindings.FetchHeaders, arg1: [*c]u32, arg2: [*c]u32) void; +pub extern fn WebCore__FetchHeaders__createEmpty(...) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: ?*const anyopaque) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createFromUWS(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) ?*bindings.FetchHeaders; +pub extern fn WebCore__FetchHeaders__createValue(arg0: *bindings.JSGlobalObject, arg1: [*c]StringPointer, arg2: [*c]StringPointer, arg3: [*c]const ZigString, arg4: u32) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__deref(arg0: ?*bindings.FetchHeaders) void; +pub extern fn WebCore__FetchHeaders__fastGet_(arg0: ?*bindings.FetchHeaders, arg1: u8, arg2: [*c]ZigString) void; +pub extern fn WebCore__FetchHeaders__fastHas_(arg0: ?*bindings.FetchHeaders, arg1: u8) bool; +pub extern fn WebCore__FetchHeaders__fastRemove_(arg0: ?*bindings.FetchHeaders, arg1: u8) void; +pub extern fn WebCore__FetchHeaders__get_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]ZigString, arg3: *bindings.JSGlobalObject) void; +pub extern fn WebCore__FetchHeaders__has(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) bool; +pub extern fn WebCore__FetchHeaders__isEmpty(arg0: ?*bindings.FetchHeaders) bool; +pub extern fn WebCore__FetchHeaders__put_(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: [*c]const ZigString, arg3: *bindings.JSGlobalObject) void; +pub extern fn WebCore__FetchHeaders__remove(arg0: ?*bindings.FetchHeaders, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) void; +pub extern fn WebCore__FetchHeaders__toJS(arg0: ?*bindings.FetchHeaders, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__FetchHeaders__toUWSResponse(arg0: ?*bindings.FetchHeaders, arg1: bool, arg2: ?*anyopaque) void; +pub extern fn SystemError__toErrorInstance(arg0: [*c]const SystemError, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSCell__getObject(arg0: [*c]bindings.JSCell) [*c]bindings.JSObject; +pub extern fn JSC__JSCell__getType(arg0: [*c]bindings.JSCell) u8; +pub extern fn JSC__JSString__eql(arg0: [*c]const JSC__JSString, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.JSString) bool; +pub extern fn JSC__JSString__is8Bit(arg0: [*c]const JSC__JSString) bool; +pub extern fn JSC__JSString__iterator(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque) void; +pub extern fn JSC__JSString__length(arg0: [*c]const JSC__JSString) usize; +pub extern fn JSC__JSString__toObject(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject) [*c]bindings.JSObject; +pub extern fn JSC__JSString__toZigString(arg0: [*c]bindings.JSString, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSModuleLoader__evaluate(arg0: *bindings.JSGlobalObject, arg1: [*c]const u8, arg2: usize, arg3: [*c]const u8, arg4: usize, arg5: [*c]const u8, arg6: usize, JSValue7: JSC__JSValue, arg8: [*c]bindings.JSValue) JSC__JSValue; +pub extern fn JSC__JSModuleLoader__loadAndEvaluateModule(arg0: *bindings.JSGlobalObject, arg1: [*c]const BunString) [*c]bindings.JSInternalPromise; +pub extern fn WebCore__AbortSignal__aborted(arg0: ?*bindings.AbortSignal) bool; +pub extern fn WebCore__AbortSignal__abortReason(arg0: ?*bindings.AbortSignal) JSC__JSValue; +pub extern fn WebCore__AbortSignal__addListener(arg0: ?*bindings.AbortSignal, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque, JSC__JSValue) callconv(.C) void) ?*bindings.AbortSignal; +pub extern fn WebCore__AbortSignal__cleanNativeBindings(arg0: ?*bindings.AbortSignal, arg1: ?*anyopaque) void; +pub extern fn WebCore__AbortSignal__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__AbortSignal__createAbortError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__AbortSignal__createTimeoutError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__AbortSignal__fromJS(JSValue0: JSC__JSValue) ?*bindings.AbortSignal; +pub extern fn WebCore__AbortSignal__ref(arg0: ?*bindings.AbortSignal) ?*bindings.AbortSignal; +pub extern fn WebCore__AbortSignal__signal(arg0: ?*bindings.AbortSignal, JSValue1: JSC__JSValue) ?*bindings.AbortSignal; +pub extern fn WebCore__AbortSignal__toJS(arg0: ?*bindings.AbortSignal, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn WebCore__AbortSignal__unref(arg0: ?*bindings.AbortSignal) ?*bindings.AbortSignal; +pub extern fn JSC__JSPromise__asValue(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSPromise__create(arg0: *bindings.JSGlobalObject) ?*bindings.JSPromise; +pub extern fn JSC__JSPromise__isHandled(arg0: [*c]const JSC__JSPromise, arg1: *bindings.VM) bool; +pub extern fn JSC__JSPromise__reject(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__rejectAsHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__rejectAsHandledException(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.Exception) void; +pub extern fn JSC__JSPromise__rejectedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.JSPromise; +pub extern fn JSC__JSPromise__rejectedPromiseValue(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSPromise__rejectOnNextTickWithHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, arg3: bool) void; +pub extern fn JSC__JSPromise__rejectWithCaughtException(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, arg2: bJSC__ThrowScope) void; +pub extern fn JSC__JSPromise__resolve(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__resolvedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*bindings.JSPromise; +pub extern fn JSC__JSPromise__resolvedPromiseValue(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSPromise__resolveOnNextTick(arg0: ?*bindings.JSPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSPromise__result(arg0: ?*bindings.JSPromise, arg1: *bindings.VM) JSC__JSValue; +pub extern fn JSC__JSPromise__setHandled(arg0: ?*bindings.JSPromise, arg1: *bindings.VM) void; +pub extern fn JSC__JSPromise__status(arg0: [*c]const JSC__JSPromise, arg1: *bindings.VM) u32; +pub extern fn JSC__JSInternalPromise__create(arg0: *bindings.JSGlobalObject) [*c]bindings.JSInternalPromise; +pub extern fn JSC__JSInternalPromise__isHandled(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) bool; +pub extern fn JSC__JSInternalPromise__reject(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__rejectAsHandled(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__rejectAsHandledException(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, arg2: [*c]bindings.Exception) void; +pub extern fn JSC__JSInternalPromise__rejectedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) [*c]bindings.JSInternalPromise; +pub extern fn JSC__JSInternalPromise__rejectWithCaughtException(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, arg2: bJSC__ThrowScope) void; +pub extern fn JSC__JSInternalPromise__resolve(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSInternalPromise__resolvedPromise(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) [*c]bindings.JSInternalPromise; +pub extern fn JSC__JSInternalPromise__result(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) JSC__JSValue; +pub extern fn JSC__JSInternalPromise__setHandled(arg0: [*c]bindings.JSInternalPromise, arg1: *bindings.VM) void; +pub extern fn JSC__JSInternalPromise__status(arg0: [*c]const JSC__JSInternalPromise, arg1: *bindings.VM) u32; +pub extern fn JSC__JSFunction__optimizeSoon(JSValue0: JSC__JSValue) void; +pub extern fn JSC__JSGlobalObject__bunVM(arg0: *bindings.JSGlobalObject) ?*bindings.VirtualMachine; +pub extern fn JSC__JSGlobalObject__createAggregateError(arg0: *bindings.JSGlobalObject, arg1: [*c]*anyopaque, arg2: u16, arg3: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__createSyntheticModule_(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString, arg2: usize, arg3: [*c]bindings.JSValue, arg4: usize) void; +pub extern fn JSC__JSGlobalObject__deleteModuleRegistryEntry(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) void; +pub extern fn JSC__JSGlobalObject__generateHeapSnapshot(arg0: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__getCachedObject(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__handleRejectedPromises(arg0: *bindings.JSGlobalObject) void; +pub extern fn JSC__JSGlobalObject__putCachedObject(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, JSValue2: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSGlobalObject__queueMicrotaskJob(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void; +pub extern fn JSC__JSGlobalObject__reload(arg0: *bindings.JSGlobalObject) void; +pub extern fn JSC__JSGlobalObject__startRemoteInspector(arg0: *bindings.JSGlobalObject, arg1: [*c]u8, arg2: u16) bool; +pub extern fn JSC__JSGlobalObject__vm(arg0: *bindings.JSGlobalObject) *bindings.VM; +pub extern fn JSC__JSMap__create(arg0: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSMap__get_(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSMap__has(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; +pub extern fn JSC__JSMap__remove(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; +pub extern fn JSC__JSMap__set(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void; +pub extern fn JSC__JSValue___then(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, ArgFn3: ?*const fn (*bindings.JSGlobalObject, *bindings.CallFrame) callconv(.C) JSC__JSValue, ArgFn4: ?*const fn (*bindings.JSGlobalObject, *bindings.CallFrame) callconv(.C) JSC__JSValue) void; +pub extern fn JSC__JSValue__asArrayBuffer_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*Bun__ArrayBuffer) bool; +pub extern fn JSC__JSValue__asBigIntCompare(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) u8; +pub extern fn JSC__JSValue__asCell(JSValue0: JSC__JSValue) [*c]bindings.JSCell; +pub extern fn JSC__JSValue__asInternalPromise(JSValue0: JSC__JSValue) [*c]bindings.JSInternalPromise; +pub extern fn JSC__JSValue__asNumber(JSValue0: JSC__JSValue) f64; +pub extern fn JSC__JSValue__asObject(JSValue0: JSC__JSValue) bJSC__JSObject; +pub extern fn JSC__JSValue__asPromise(JSValue0: JSC__JSValue) ?*bindings.JSPromise; +pub extern fn JSC__JSValue__asString(JSValue0: JSC__JSValue) [*c]bindings.JSString; +pub extern fn JSC__JSValue__coerceToDouble(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) f64; +pub extern fn JSC__JSValue__coerceToInt32(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) i32; +pub extern fn JSC__JSValue__coerceToInt64(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) i64; +pub extern fn JSC__JSValue__createEmptyArray(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; +pub extern fn JSC__JSValue__createEmptyObject(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; +pub extern fn JSC__JSValue__createInternalPromise(arg0: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createObject2(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, arg2: [*c]const ZigString, JSValue3: JSC__JSValue, JSValue4: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSValue__createRangeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createRopeString(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createStringArray(arg0: *bindings.JSGlobalObject, arg1: [*c]const ZigString, arg2: usize, arg3: bool) JSC__JSValue; +pub extern fn JSC__JSValue__createTypeError(arg0: [*c]const ZigString, arg1: [*c]const ZigString, arg2: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__createUninitializedUint8Array(arg0: *bindings.JSGlobalObject, arg1: usize) JSC__JSValue; +pub extern fn JSC__JSValue__deepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__deepMatch(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject, arg3: bool) bool; +pub extern fn JSC__JSValue__eqlCell(JSValue0: JSC__JSValue, arg1: [*c]bindings.JSCell) bool; +pub extern fn JSC__JSValue__eqlValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) bool; +pub extern fn JSC__JSValue__fastGet_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u8) JSC__JSValue; +pub extern fn JSC__JSValue__fastGetDirect_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u8) JSC__JSValue; +pub extern fn JSC__JSValue__forEach(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.VM, *bindings.JSGlobalObject, ?*anyopaque, JSC__JSValue) callconv(.C) void) void; +pub extern fn JSC__JSValue__forEachProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.JSGlobalObject, ?*anyopaque, [*c]ZigString, JSC__JSValue, bool) callconv(.C) void) void; +pub extern fn JSC__JSValue__forEachPropertyOrdered(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*anyopaque, ArgFn3: ?*const fn (*bindings.JSGlobalObject, ?*anyopaque, [*c]ZigString, JSC__JSValue, bool) callconv(.C) void) void; +pub extern fn JSC__JSValue__fromEntries(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString, arg2: [*c]ZigString, arg3: usize, arg4: bool) JSC__JSValue; +pub extern fn JSC__JSValue__fromInt64NoTruncate(arg0: *bindings.JSGlobalObject, arg1: i64) JSC__JSValue; +pub extern fn JSC__JSValue__fromUInt64NoTruncate(arg0: *bindings.JSGlobalObject, arg1: u64) JSC__JSValue; +pub extern fn JSC__JSValue__getClassName(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__getErrorsProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__getIfPropertyExistsFromPath(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSValue__getIfPropertyExistsImpl(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]const u8, arg3: u32) JSC__JSValue; +pub extern fn JSC__JSValue__getLengthIfPropertyExistsInternal(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) f64; +pub extern fn JSC__JSValue__getNameProperty(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__getPrototype(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__getSymbolDescription(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) void; +pub extern fn JSC__JSValue__getUnixTimestamp(JSValue0: JSC__JSValue) f64; +pub extern fn JSC__JSValue__isAggregateError(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__isAnyError(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isAnyInt(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isBigInt(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isBigInt32(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isBoolean(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isCallable(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; +pub extern fn JSC__JSValue__isClass(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__isConstructor(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isCustomGetterSetter(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isError(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isException(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; +pub extern fn JSC__JSValue__isGetterSetter(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isHeapBigInt(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isInstanceOf(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isInt32(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isInt32AsAnyInt(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isIterable(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__isNumber(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isObject(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isPrimitive(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isSameValue(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__isSymbol(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__isTerminationException(JSValue0: JSC__JSValue, arg1: *bindings.VM) bool; +pub extern fn JSC__JSValue__isUInt32AsAnyInt(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__jestDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__jestDeepMatch(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject, arg3: bool) bool; +pub extern fn JSC__JSValue__jestStrictDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__jsBoolean(arg0: bool) JSC__JSValue; +pub extern fn JSC__JSValue__jsDoubleNumber(arg0: f64) JSC__JSValue; +pub extern fn JSC__JSValue__jsNull(...) JSC__JSValue; +pub extern fn JSC__JSValue__jsNumberFromChar(arg0: u8) JSC__JSValue; +pub extern fn JSC__JSValue__jsNumberFromDouble(arg0: f64) JSC__JSValue; +pub extern fn JSC__JSValue__jsNumberFromInt64(arg0: i64) JSC__JSValue; +pub extern fn JSC__JSValue__jsNumberFromU16(arg0: u16) JSC__JSValue; +pub extern fn JSC__JSValue__jsonStringify(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32, arg3: [*c]BunString) void; +pub extern fn JSC__JSValue__jsTDZValue(...) JSC__JSValue; +pub extern fn JSC__JSValue__jsType(JSValue0: JSC__JSValue) u8; +pub extern fn JSC__JSValue__jsUndefined(...) JSC__JSValue; +pub extern fn JSC__JSValue__makeWithNameAndPrototype(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque, arg2: ?*anyopaque, arg3: [*c]const ZigString) JSC__JSValue; +pub extern fn JSC__JSValue__parseJSON(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) JSC__JSValue; +pub extern fn JSC__JSValue__push(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__JSValue__put(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]const ZigString, JSValue3: JSC__JSValue) void; +pub extern fn JSC__JSValue__putIndex(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: u32, JSValue3: JSC__JSValue) void; +pub extern fn JSC__JSValue__putRecord(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString, arg3: [*c]ZigString, arg4: usize) void; +pub extern fn JSC__JSValue__strictDeepEquals(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, arg2: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__stringIncludes(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; +pub extern fn JSC__JSValue__symbolFor(arg0: *bindings.JSGlobalObject, arg1: [*c]ZigString) JSC__JSValue; +pub extern fn JSC__JSValue__symbolKeyFor(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigString) bool; +pub extern fn JSC__JSValue__toBoolean(JSValue0: JSC__JSValue) bool; +pub extern fn JSC__JSValue__toBooleanSlow(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) bool; +pub extern fn JSC__JSValue__toError_(JSValue0: JSC__JSValue) JSC__JSValue; +pub extern fn JSC__JSValue__toInt32(JSValue0: JSC__JSValue) i32; +pub extern fn JSC__JSValue__toInt64(JSValue0: JSC__JSValue) i64; +pub extern fn JSC__JSValue__toMatch(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool; +pub extern fn JSC__JSValue__toObject(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSObject; +pub extern fn JSC__JSValue__toString(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSString; +pub extern fn JSC__JSValue__toStringOrNull(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject) [*c]bindings.JSString; +pub extern fn JSC__JSValue__toUInt64NoTruncate(JSValue0: JSC__JSValue) u64; +pub extern fn JSC__JSValue__toZigException(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: [*c]ZigException) void; +pub extern fn JSC__JSValue__toZigString(JSValue0: JSC__JSValue, arg1: [*c]ZigString, arg2: *bindings.JSGlobalObject) void; +pub extern fn JSC__Exception__create(arg0: *bindings.JSGlobalObject, arg1: [*c]bindings.JSObject, StackCaptureAction2: u8) [*c]bindings.Exception; +pub extern fn JSC__Exception__getStackTrace(arg0: [*c]bindings.Exception, arg1: [*c]ZigStackTrace) void; +pub extern fn JSC__Exception__value(arg0: [*c]bindings.Exception) JSC__JSValue; +pub extern fn JSC__VM__blockBytesAllocated(arg0: *bindings.VM) usize; +pub extern fn JSC__VM__clearExecutionTimeLimit(arg0: *bindings.VM) void; +pub extern fn JSC__VM__collectAsync(arg0: *bindings.VM) void; +pub extern fn JSC__VM__create(HeapType0: u8) *bindings.VM; +pub extern fn JSC__VM__deferGC(arg0: *bindings.VM, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque) callconv(.C) void) void; +pub extern fn JSC__VM__deinit(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject) void; +pub extern fn JSC__VM__deleteAllCode(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject) void; +pub extern fn JSC__VM__drainMicrotasks(arg0: *bindings.VM) void; +pub extern fn JSC__VM__executionForbidden(arg0: *bindings.VM) bool; +pub extern fn JSC__VM__externalMemorySize(arg0: *bindings.VM) usize; +pub extern fn JSC__VM__heapSize(arg0: *bindings.VM) usize; +pub extern fn JSC__VM__holdAPILock(arg0: *bindings.VM, arg1: ?*anyopaque, ArgFn2: ?*const fn (?*anyopaque) callconv(.C) void) void; +pub extern fn JSC__VM__isEntered(arg0: *bindings.VM) bool; +pub extern fn JSC__VM__isJITEnabled(...) bool; +pub extern fn JSC__VM__notifyNeedDebuggerBreak(arg0: *bindings.VM) void; +pub extern fn JSC__VM__notifyNeedShellTimeoutCheck(arg0: *bindings.VM) void; +pub extern fn JSC__VM__notifyNeedTermination(arg0: *bindings.VM) void; +pub extern fn JSC__VM__notifyNeedWatchdogCheck(arg0: *bindings.VM) void; +pub extern fn JSC__VM__releaseWeakRefs(arg0: *bindings.VM) void; +pub extern fn JSC__VM__runGC(arg0: *bindings.VM, arg1: bool) JSC__JSValue; +pub extern fn JSC__VM__setControlFlowProfiler(arg0: *bindings.VM, arg1: bool) void; +pub extern fn JSC__VM__setExecutionForbidden(arg0: *bindings.VM, arg1: bool) void; +pub extern fn JSC__VM__setExecutionTimeLimit(arg0: *bindings.VM, arg1: f64) void; +pub extern fn JSC__VM__shrinkFootprint(arg0: *bindings.VM) void; +pub extern fn JSC__VM__throwError(arg0: *bindings.VM, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) void; +pub extern fn JSC__VM__whenIdle(arg0: *bindings.VM, ArgFn1: ?*const fn (...) callconv(.C) void) void; +pub extern fn JSC__ThrowScope__clearException(arg0: [*c]bindings.ThrowScope) void; +pub extern fn JSC__ThrowScope__declare(arg0: *bindings.VM, arg1: [*c]u8, arg2: [*c]u8, arg3: usize) bJSC__ThrowScope; +pub extern fn JSC__ThrowScope__exception(arg0: [*c]bindings.ThrowScope) [*c]bindings.Exception; +pub extern fn JSC__ThrowScope__release(arg0: [*c]bindings.ThrowScope) void; +pub extern fn JSC__CatchScope__clearException(arg0: [*c]bindings.CatchScope) void; +pub extern fn JSC__CatchScope__declare(arg0: *bindings.VM, arg1: [*c]u8, arg2: [*c]u8, arg3: usize) bJSC__CatchScope; +pub extern fn JSC__CatchScope__exception(arg0: [*c]bindings.CatchScope) [*c]bindings.Exception; +pub extern fn FFI__ptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__u8__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__u16__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__u32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__ptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__i8__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__i16__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__i32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__f32__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__f64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__i64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__u64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Reader__intptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void; +pub extern fn Zig__GlobalObject__create(arg0: ?*anyopaque, arg1: i32, arg2: bool, arg3: ?*anyopaque) *bindings.JSGlobalObject; +pub extern fn Zig__GlobalObject__getModuleRegistryMap(arg0: *bindings.JSGlobalObject) ?*anyopaque; +pub extern fn Zig__GlobalObject__resetModuleRegistryMap(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) bool; +pub extern fn Bun__Path__create(arg0: *bindings.JSGlobalObject, arg1: bool) JSC__JSValue; +pub extern fn ArrayBufferSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn ArrayBufferSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn ArrayBufferSink__detachPtr(JSValue0: JSC__JSValue) void; +pub extern fn ArrayBufferSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn ArrayBufferSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; +pub extern fn ArrayBufferSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; +pub extern fn HTTPSResponseSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn HTTPSResponseSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn HTTPSResponseSink__detachPtr(JSValue0: JSC__JSValue) void; +pub extern fn HTTPSResponseSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn HTTPSResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; +pub extern fn HTTPSResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; +pub extern fn HTTPResponseSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn HTTPResponseSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn HTTPResponseSink__detachPtr(JSValue0: JSC__JSValue) void; +pub extern fn HTTPResponseSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn HTTPResponseSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; +pub extern fn HTTPResponseSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; +pub extern fn FileSink__assignToStream(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue, arg2: ?*anyopaque, arg3: [*c]*anyopaque) JSC__JSValue; +pub extern fn FileSink__createObject(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) JSC__JSValue; +pub extern fn FileSink__detachPtr(JSValue0: JSC__JSValue) void; +pub extern fn FileSink__fromJS(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) ?*anyopaque; +pub extern fn FileSink__onClose(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue) void; +pub extern fn FileSink__onReady(JSValue0: JSC__JSValue, JSValue1: JSC__JSValue, JSValue2: JSC__JSValue) void; +pub extern fn ZigException__fromException(arg0: [*c]bindings.Exception) ZigException; diff --git a/src/bun.js/webcore/body.zig b/src/bun.js/webcore/body.zig index 1519ef148..621acc0b3 100644 --- a/src/bun.js/webcore/body.zig +++ b/src/bun.js/webcore/body.zig @@ -209,6 +209,7 @@ pub const Body = struct { /// used in HTTP server to ignore request bodies unless asked for it onStartBuffering: ?*const fn (ctx: *anyopaque) void = null, onStartStreaming: ?*const fn (ctx: *anyopaque) JSC.WebCore.DrainResult = null, + onReadableStreamAvailable: ?*const fn (ctx: *anyopaque, readable: JSC.WebCore.ReadableStream) void = null, size_hint: Blob.SizeType = 0, deinit: bool = false, @@ -265,7 +266,7 @@ pub const Body = struct { value.action = .{ .none = {} }; return JSC.JSPromise.rejectedPromiseValue(globalThis, globalThis.createErrorInstance("ReadableStream is already used", .{})); } else { - readable.detach(globalThis); + readable.detachIfPossible(globalThis); value.readable = null; } @@ -526,8 +527,12 @@ pub const Body = struct { .ptr = .{ .Bytes = &reader.context }, .value = reader.toJS(globalThis), }; - locked.readable.?.value.protect(); + + if (locked.onReadableStreamAvailable) |onReadableStreamAvailable| { + onReadableStreamAvailable(locked.task.?, locked.readable.?); + } + return locked.readable.?.value; }, .Error => { @@ -1258,3 +1263,347 @@ pub fn BodyMixin(comptime Type: type) type { } }; } + +pub const BodyValueBufferer = struct { + const log = bun.Output.scoped(.BodyValueBufferer, false); + + const ArrayBufferSink = JSC.WebCore.ArrayBufferSink; + const Callback = *const fn (ctx: *anyopaque, bytes: []const u8, err: ?JSC.JSValue, is_async: bool) void; + + ctx: *anyopaque, + onFinishedBuffering: Callback, + + js_sink: ?*ArrayBufferSink.JSSink = null, + byte_stream: ?*JSC.WebCore.ByteStream = null, + // readable stream strong ref to keep byte stream alive + readable_stream_ref: JSC.WebCore.ReadableStream.Strong = .{}, + stream_buffer: bun.MutableString, + allocator: std.mem.Allocator, + global: *JSGlobalObject, + + pub fn deinit(this: *@This()) void { + this.stream_buffer.deinit(); + if (this.byte_stream) |byte_stream| { + byte_stream.unpipe(); + } + this.readable_stream_ref.deinit(); + + if (this.js_sink) |buffer_stream| { + buffer_stream.detach(); + buffer_stream.sink.destroy(); + this.js_sink = null; + } + } + + pub fn init( + ctx: *anyopaque, + onFinish: Callback, + global: *JSGlobalObject, + allocator: std.mem.Allocator, + ) @This() { + const this = .{ + .ctx = ctx, + .onFinishedBuffering = onFinish, + .allocator = allocator, + .global = global, + .stream_buffer = .{ + .allocator = allocator, + .list = .{ + .items = &.{}, + .capacity = 0, + }, + }, + }; + return this; + } + + pub fn run(sink: *@This(), value: *JSC.WebCore.Body.Value) !void { + value.toBlobIfPossible(); + + switch (value.*) { + .Used => { + log("Used", .{}); + return error.StreamAlreadyUsed; + }, + .Empty, .Null => { + log("Empty", .{}); + return sink.onFinishedBuffering(sink.ctx, "", null, false); + }, + + .Error => |err| { + log("Error", .{}); + return sink.onFinishedBuffering(sink.ctx, "", err, false); + }, + // .InlineBlob, + .WTFStringImpl, + .InternalBlob, + .Blob, + => { + // toBlobIfPossible checks for WTFString needing a conversion. + var input = value.useAsAnyBlobAllowNonUTF8String(); + const is_pending = input.needsToReadFile(); + defer if (!is_pending) input.detach(); + + if (is_pending) { + input.Blob.doReadFileInternal(*@This(), sink, onFinishedLoadingFile, sink.global); + } else { + const bytes = input.slice(); + log("Blob {}", .{bytes.len}); + sink.onFinishedBuffering(sink.ctx, bytes, null, false); + } + return; + }, + .Locked => { + try sink.bufferLockedBodyValue(value); + }, + } + } + + fn onFinishedLoadingFile(sink: *@This(), bytes: JSC.WebCore.Blob.Store.ReadFile.ResultType) void { + switch (bytes) { + .err => |err| { + log("onFinishedLoadingFile Error", .{}); + sink.onFinishedBuffering(sink.ctx, "", err.toErrorInstance(sink.global), true); + return; + }, + .result => |data| { + log("onFinishedLoadingFile Data {}", .{data.buf.len}); + sink.onFinishedBuffering(sink.ctx, data.buf, null, true); + if (data.is_temporary) { + bun.default_allocator.free(bun.constStrToU8(data.buf)); + } + }, + } + } + fn onStreamPipe(sink: *@This(), stream: JSC.WebCore.StreamResult, allocator: std.mem.Allocator) void { + var stream_needs_deinit = stream == .owned or stream == .owned_and_done; + + defer { + if (stream_needs_deinit) { + if (stream == .owned_and_done) { + stream.owned_and_done.listManaged(allocator).deinit(); + } else { + stream.owned.listManaged(allocator).deinit(); + } + } + } + + const chunk = stream.slice(); + log("onStreamPipe chunk {}", .{chunk.len}); + _ = sink.stream_buffer.write(chunk) catch @panic("OOM"); + if (stream.isDone()) { + const bytes = sink.stream_buffer.list.items; + log("onStreamPipe done {}", .{bytes.len}); + sink.onFinishedBuffering(sink.ctx, bytes, null, true); + return; + } + } + + pub fn onResolveStream(_: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { + var args = callframe.arguments(2); + var sink: *@This() = args.ptr[args.len - 1].asPromisePtr(@This()); + sink.handleResolveStream(true); + return JSValue.jsUndefined(); + } + + pub fn onRejectStream(_: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { + const args = callframe.arguments(2); + var sink = args.ptr[args.len - 1].asPromisePtr(@This()); + var err = args.ptr[0]; + sink.handleRejectStream(err, true); + return JSValue.jsUndefined(); + } + + fn handleRejectStream(sink: *@This(), err: JSValue, is_async: bool) void { + if (sink.js_sink) |wrapper| { + wrapper.detach(); + sink.js_sink = null; + wrapper.sink.destroy(); + } + sink.onFinishedBuffering(sink.ctx, "", err, is_async); + } + + fn handleResolveStream(sink: *@This(), is_async: bool) void { + if (sink.js_sink) |wrapper| { + const bytes = wrapper.sink.bytes.slice(); + log("handleResolveStream {}", .{bytes.len}); + sink.onFinishedBuffering(sink.ctx, bytes, null, is_async); + } else { + log("handleResolveStream no sink", .{}); + sink.onFinishedBuffering(sink.ctx, "", null, is_async); + } + } + + fn createJSSink(sink: *@This(), stream: JSC.WebCore.ReadableStream) !void { + stream.value.ensureStillAlive(); + var allocator = sink.allocator; + var buffer_stream = try allocator.create(ArrayBufferSink.JSSink); + var globalThis = sink.global; + buffer_stream.* = ArrayBufferSink.JSSink{ + .sink = ArrayBufferSink{ + .bytes = bun.ByteList.init(&.{}), + .allocator = allocator, + .next = null, + }, + }; + var signal = &buffer_stream.sink.signal; + sink.js_sink = buffer_stream; + + signal.* = ArrayBufferSink.JSSink.SinkSignal.init(JSValue.zero); + + // explicitly set it to a dead pointer + // we use this memory address to disable signals being sent + signal.clear(); + std.debug.assert(signal.isDead()); + + const assignment_result: JSValue = ArrayBufferSink.JSSink.assignToStream( + globalThis, + stream.value, + buffer_stream, + @as(**anyopaque, @ptrCast(&signal.ptr)), + ); + + assignment_result.ensureStillAlive(); + + // assert that it was updated + std.debug.assert(!signal.isDead()); + + if (assignment_result.isError()) { + return error.PipeFailed; + } + + if (!assignment_result.isEmptyOrUndefinedOrNull()) { + assignment_result.ensureStillAlive(); + // it returns a Promise when it goes through ReadableStreamDefaultReader + if (assignment_result.asAnyPromise()) |promise| { + switch (promise.status(globalThis.vm())) { + .Pending => { + assignment_result.then( + globalThis, + sink, + onResolveStream, + onRejectStream, + ); + }, + .Fulfilled => { + defer stream.value.unprotect(); + + sink.handleResolveStream(false); + }, + .Rejected => { + defer stream.value.unprotect(); + + sink.handleRejectStream(promise.result(globalThis.vm()), false); + }, + } + return; + } + } + + return error.PipeFailed; + } + + fn bufferLockedBodyValue(sink: *@This(), value: *JSC.WebCore.Body.Value) !void { + std.debug.assert(value.* == .Locked); + const locked = &value.Locked; + if (locked.readable) |stream_| { + const stream: JSC.WebCore.ReadableStream = stream_; + stream.value.ensureStillAlive(); + + value.* = .{ .Used = {} }; + + if (stream.isLocked(sink.global)) { + return error.StreamAlreadyUsed; + } + + switch (stream.ptr) { + .Invalid => { + return error.InvalidStream; + }, + // toBlobIfPossible should've caught this + .Blob, .File => unreachable, + .JavaScript, .Direct => { + // this is broken right now + // return sink.createJSSink(stream); + return error.UnsupportedStreamType; + }, + .Bytes => |byte_stream| { + std.debug.assert(byte_stream.pipe.ctx == null); + std.debug.assert(sink.byte_stream == null); + + const bytes = byte_stream.buffer.items; + // If we've received the complete body by the time this function is called + // we can avoid streaming it and just send it all at once. + if (byte_stream.has_received_last_chunk) { + log("byte stream has_received_last_chunk {}", .{bytes.len}); + sink.onFinishedBuffering(sink.ctx, bytes, null, false); + // is safe to detach here because we're not going to receive any more data + stream.detachIfPossible(sink.global); + return; + } + // keep the stream alive until we're done with it + sink.readable_stream_ref = try JSC.WebCore.ReadableStream.Strong.init(stream, sink.global); + // we now hold a reference so we can safely ask to detach and will be detached when the last ref is dropped + stream.detachIfPossible(sink.global); + + byte_stream.pipe = JSC.WebCore.Pipe.New(@This(), onStreamPipe).init(sink); + sink.byte_stream = byte_stream; + log("byte stream pre-buffered {}", .{bytes.len}); + + _ = sink.stream_buffer.write(bytes) catch @panic("OOM"); + return; + }, + } + } + + if (locked.onReceiveValue != null or locked.task != null) { + // someone else is waiting for the stream or waiting for `onStartStreaming` + const readable = value.toReadableStream(sink.global); + readable.ensureStillAlive(); + readable.protect(); + return try sink.bufferLockedBodyValue(value); + } + // is safe to wait it buffer + locked.task = @ptrCast(sink); + locked.onReceiveValue = @This().onReceiveValue; + } + + fn onReceiveValue(ctx: *anyopaque, value: *JSC.WebCore.Body.Value) void { + const sink = bun.cast(*@This(), ctx); + switch (value.*) { + .Error => { + log("onReceiveValue Error", .{}); + sink.onFinishedBuffering(sink.ctx, "", value.Error, true); + return; + }, + else => { + value.toBlobIfPossible(); + var input = value.useAsAnyBlobAllowNonUTF8String(); + const bytes = input.slice(); + log("onReceiveValue {}", .{bytes.len}); + sink.onFinishedBuffering(sink.ctx, bytes, value.Error, true); + }, + } + } + + pub const shim = JSC.Shimmer("Bun", "BodyValueBufferer", @This()); + pub const name = "Bun__BodyValueBufferer"; + pub const include = ""; + pub const namespace = shim.namespace; + + pub const Export = shim.exportFunctions(.{ + .onResolveStream = onResolveStream, + .onRejectStream = onRejectStream, + }); + + comptime { + if (!JSC.is_bindgen) { + @export(onResolveStream, .{ + .name = Export[0].symbol_name, + }); + @export(onRejectStream, .{ + .name = Export[1].symbol_name, + }); + } + } +}; diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index 9b428ae69..8fc282cf0 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -630,6 +630,8 @@ pub const Fetch = struct { scheduled_response_buffer: MutableString = undefined, /// response strong ref response: JSC.Strong = .{}, + /// stream strong ref if any is available + readable_stream_ref: JSC.WebCore.ReadableStream.Strong = .{}, request_headers: Headers = Headers{ .allocator = undefined }, promise: JSC.JSPromise.Strong, concurrent_task: JSC.ConcurrentTask = .{}, @@ -722,6 +724,7 @@ pub const Fetch = struct { this.response_buffer.deinit(); this.response.deinit(); + this.readable_stream_ref.deinit(); this.scheduled_response_buffer.deinit(); this.request_body.detach(); @@ -851,6 +854,33 @@ pub const Fetch = struct { old.resolve(&response.body.value, this.global_this); } } + } else if (this.readable_stream_ref.get()) |readable| { + if (readable.ptr == .Bytes) { + readable.ptr.Bytes.size_hint = this.getSizeHint(); + // body can be marked as used but we still need to pipe the data + var scheduled_response_buffer = this.scheduled_response_buffer.list; + + const chunk = scheduled_response_buffer.items; + + if (this.result.has_more) { + readable.ptr.Bytes.onData( + .{ + .temporary = bun.ByteList.initConst(chunk), + }, + bun.default_allocator, + ); + + // clean for reuse later + this.scheduled_response_buffer.reset(); + } else { + readable.ptr.Bytes.onData( + .{ + .temporary_and_done = bun.ByteList.initConst(chunk), + }, + bun.default_allocator, + ); + } + } } } } @@ -964,6 +994,11 @@ pub const Fetch = struct { return fetch_error.toErrorInstance(this.global_this); } + pub fn onReadableStreamAvailable(ctx: *anyopaque, readable: JSC.WebCore.ReadableStream) void { + const this = bun.cast(*FetchTasklet, ctx); + this.readable_stream_ref = JSC.WebCore.ReadableStream.Strong.init(readable, this.global_this) catch .{}; + } + pub fn onStartStreamingRequestBodyCallback(ctx: *anyopaque) JSC.WebCore.DrainResult { const this = bun.cast(*FetchTasklet, ctx); if (this.http) |http| { @@ -1020,6 +1055,7 @@ pub const Fetch = struct { .task = this, .global = this.global_this, .onStartStreaming = FetchTasklet.onStartStreamingRequestBodyCallback, + .onReadableStreamAvailable = FetchTasklet.onReadableStreamAvailable, }, }; return response; @@ -1239,6 +1275,7 @@ pub const Fetch = struct { pub fn callback(task: *FetchTasklet, result: HTTPClient.HTTPClientResult) void { task.mutex.lock(); defer task.mutex.unlock(); + log("callback success {} has_more {} bytes {}", .{ result.isSuccess(), result.has_more, result.body.?.list.items.len }); task.result = result; // metadata should be provided only once so we preserve it until we consume it diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 9688ef8ba..f40548eb8 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -52,6 +52,48 @@ pub const ReadableStream = struct { value: JSValue, ptr: Source, + pub const Strong = struct { + held: JSC.Strong = .{}, + globalThis: ?*JSGlobalObject = null, + + pub fn init(this: ReadableStream, globalThis: *JSGlobalObject) !Strong { + switch (this.ptr) { + .Blob => |stream| { + try stream.parent().incrementCount(); + }, + .File => |stream| { + try stream.parent().incrementCount(); + }, + .Bytes => |stream| { + try stream.parent().incrementCount(); + }, + else => {}, + } + return .{ + .globalThis = globalThis, + .held = JSC.Strong.create(this.value, globalThis), + }; + } + + pub fn get(this: *Strong) ?ReadableStream { + if (this.globalThis) |globalThis| { + if (this.held.get()) |value| { + return ReadableStream.fromJS(value, globalThis); + } + } + return null; + } + + pub fn deinit(this: *Strong) void { + if (this.get()) |readable| { + // decrement the ref count and if it's zero we auto detach + readable.detachIfPossible(this.globalThis.?); + this.globalThis = null; + } + this.held.deinit(); + } + }; + pub fn toJS(this: *const ReadableStream) JSValue { return this.value; } @@ -66,8 +108,7 @@ pub const ReadableStream = struct { blob.offset = blobby.offset; blob.size = blobby.remain; blob.store.?.ref(); - stream.detach(globalThis); - stream.done(); + stream.detachIfPossible(globalThis); blobby.deinit(); return AnyBlob{ .Blob = blob }; @@ -76,13 +117,10 @@ pub const ReadableStream = struct { if (blobby.lazy_readable == .blob) { var blob = JSC.WebCore.Blob.initWithStore(blobby.lazy_readable.blob, globalThis); blob.store.?.ref(); - // it should be lazy, file shouldn't have opened yet. std.debug.assert(!blobby.started); - - stream.detach(globalThis); + stream.detachIfPossible(globalThis); blobby.deinit(); - stream.done(); return AnyBlob{ .Blob = blob }; } }, @@ -91,10 +129,9 @@ pub const ReadableStream = struct { // If we've received the complete body by the time this function is called // we can avoid streaming it and convert it to a Blob if (bytes.has_received_last_chunk) { - stream.detach(globalThis); var blob: JSC.WebCore.AnyBlob = undefined; blob.from(bytes.buffer); - bytes.parent().deinit(); + stream.detachIfPossible(globalThis); return blob; } @@ -122,10 +159,23 @@ pub const ReadableStream = struct { ReadableStream__cancel(this.value, globalThis); } - pub fn detach(this: *const ReadableStream, globalThis: *JSGlobalObject) void { + /// Decrement Source ref count and detach the underlying stream if ref count is zero + /// be careful, this can invalidate the stream do not call this multiple times + /// this is meant to be called only once when we are done consuming the stream or from the ReadableStream.Strong.deinit + pub fn detachIfPossible(this: *const ReadableStream, globalThis: *JSGlobalObject) void { JSC.markBinding(@src()); - this.value.unprotect(); - ReadableStream__detach(this.value, globalThis); + + const ref_count = switch (this.ptr) { + .Blob => |blob| blob.parent().decrementCount(), + .File => |file| file.parent().decrementCount(), + .Bytes => |bytes| bytes.parent().decrementCount(), + else => 0, + }; + + if (ref_count == 0) { + this.value.unprotect(); + ReadableStream__detach(this.value, globalThis); + } } pub const Tag = enum(i32) { @@ -1888,7 +1938,10 @@ pub const ArrayBufferSink = struct { this.signal.close(err); return .{ .result = {} }; } - + pub fn destroy(this: *ArrayBufferSink) void { + this.bytes.deinitWithAllocator(this.allocator); + this.allocator.destroy(this); + } pub fn toJS(this: *ArrayBufferSink, globalThis: *JSGlobalObject, as_uint8array: bool) JSValue { if (this.streaming) { const value: JSValue = switch (as_uint8array) { @@ -3003,6 +3056,7 @@ pub fn ReadableStreamSource( context: Context, cancelled: bool = false, deinited: bool = false, + ref_count: u32 = 1, pending_err: ?Syscall.Error = null, close_handler: ?*const fn (*anyopaque) void = null, close_ctx: ?*anyopaque = null, @@ -3068,12 +3122,26 @@ pub fn ReadableStreamSource( } } - pub fn deinit(this: *This) void { + pub fn incrementCount(this: *This) !void { if (this.deinited) { - return; + return error.InvalidStream; + } + this.ref_count += 1; + } + + pub fn decrementCount(this: *This) u32 { + if (this.ref_count == 0 or this.deinited) { + return 0; + } + + this.ref_count -= 1; + if (this.ref_count == 0) { + this.deinited = true; + deinit_fn(&this.context); + return 0; } - this.deinited = true; - deinit_fn(&this.context); + + return this.ref_count; } pub fn getError(this: *This) ?Syscall.Error { @@ -3187,7 +3255,7 @@ pub fn ReadableStreamSource( pub fn deinit(_: *JSGlobalObject, callFrame: *JSC.CallFrame) callconv(.C) JSC.JSValue { JSC.markBinding(@src()); var this = callFrame.argument(0).asPtr(ReadableStreamSourceType); - this.deinit(); + _ = this.decrementCount(); return JSValue.jsUndefined(); } @@ -3243,6 +3311,10 @@ pub const ByteBlobLoader = struct { pub const tag = ReadableStream.Tag.Blob; + pub fn parent(this: *@This()) *Source { + return @fieldParentPtr(Source, "context", this); + } + pub fn setup( this: *ByteBlobLoader, blob: *const Blob, @@ -4465,6 +4537,10 @@ pub const FileReader = struct { user_chunk_size: Blob.SizeType = 0, lazy_readable: Readable.Lazy = undefined, + pub fn parent(this: *@This()) *Source { + return @fieldParentPtr(Source, "context", this); + } + pub fn setSignal(this: *FileReader, signal: Signal) void { switch (this.lazy_readable) { .readable => { |