aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings')
-rw-r--r--src/bun.js/bindings/FFI.zig58
-rw-r--r--src/bun.js/bindings/JSSink.cpp2
-rw-r--r--src/bun.js/bindings/JSSink.h2
-rw-r--r--src/bun.js/bindings/Process.cpp77
-rw-r--r--src/bun.js/bindings/ZigGeneratedClasses.cpp806
-rw-r--r--src/bun.js/bindings/bindings.cpp8
-rw-r--r--src/bun.js/bindings/bindings.zig199
-rw-r--r--src/bun.js/bindings/exports.zig60
-rw-r--r--src/bun.js/bindings/generated_classes.zig78
-rw-r--r--src/bun.js/bindings/headers.h1
-rw-r--r--src/bun.js/bindings/headers.zig1
-rw-r--r--src/bun.js/bindings/napi.cpp20
-rw-r--r--src/bun.js/bindings/shimmer.zig2
13 files changed, 1143 insertions, 171 deletions
diff --git a/src/bun.js/bindings/FFI.zig b/src/bun.js/bindings/FFI.zig
index fde4a8d30..9d16bd78e 100644
--- a/src/bun.js/bindings/FFI.zig
+++ b/src/bun.js/bindings/FFI.zig
@@ -18,41 +18,41 @@ pub const union_EncodedJSValue = extern union {
};
pub const EncodedJSValue = union_EncodedJSValue;
pub export var ValueUndefined: EncodedJSValue = EncodedJSValue{
- .asInt64 = @bitCast(i64, @as(c_longlong, @as(c_int, 2) | @as(c_int, 8))),
+ .asInt64 = @as(i64, @bitCast(@as(c_longlong, @as(c_int, 2) | @as(c_int, 8)))),
};
pub export var ValueTrue: EncodedJSValue = EncodedJSValue{
- .asInt64 = @bitCast(i64, @as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1))),
+ .asInt64 = @as(i64, @bitCast(@as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1)))),
};
pub const JSContext = ?*anyopaque;
pub inline fn JSVALUE_IS_CELL(arg_val: EncodedJSValue) bool {
const val = arg_val;
- return !(((@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) | @bitCast(c_ulonglong, @as(c_longlong, @as(c_int, 2)))) != 0);
+ return !(((@as(c_ulonglong, @bitCast(val.asInt64)) & @as(c_ulonglong, 18446181123756130304)) | @as(c_ulonglong, @bitCast(@as(c_longlong, @as(c_int, 2))))) != 0);
}
pub inline fn JSVALUE_IS_INT32(arg_val: EncodedJSValue) @"bool" {
const val = arg_val;
- return (@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) == @as(c_ulonglong, 18446181123756130304);
+ return (@as(c_ulonglong, @bitCast(val.asInt64)) & @as(c_ulonglong, 18446181123756130304)) == @as(c_ulonglong, 18446181123756130304);
}
pub inline fn JSVALUE_IS_NUMBER(arg_val: EncodedJSValue) @"bool" {
const val = arg_val;
- return (@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) != 0;
+ return (@as(c_ulonglong, @bitCast(val.asInt64)) & @as(c_ulonglong, 18446181123756130304)) != 0;
}
pub inline fn JSVALUE_TO_UINT64(arg_value: EncodedJSValue) u64 {
var value = arg_value;
if (JSVALUE_IS_INT32(value)) {
- return @bitCast(u64, @as(c_longlong, JSVALUE_TO_INT32(value)));
+ return @as(u64, @bitCast(@as(c_longlong, JSVALUE_TO_INT32(value))));
}
if (JSVALUE_IS_NUMBER(value)) {
- return @intFromFloat(u64, JSVALUE_TO_DOUBLE(value));
+ return @as(u64, @intFromFloat(JSVALUE_TO_DOUBLE(value)));
}
return JSVALUE_TO_UINT64_SLOW(value);
}
pub inline fn JSVALUE_TO_INT64(arg_value: EncodedJSValue) i64 {
const value = arg_value;
if (JSVALUE_IS_INT32(value)) {
- return @bitCast(i64, @as(c_longlong, JSVALUE_TO_INT32(value)));
+ return @as(i64, @bitCast(@as(c_longlong, JSVALUE_TO_INT32(value))));
}
if (JSVALUE_IS_NUMBER(value)) {
- return @intFromFloat(i64, JSVALUE_TO_DOUBLE(value));
+ return @as(i64, @intFromFloat(JSVALUE_TO_DOUBLE(value)));
}
return JSVALUE_TO_INT64_SLOW(value);
}
@@ -63,69 +63,69 @@ pub const INT64_TO_JSVALUE_SLOW = @import("./bindings.zig").JSValue.fromInt64NoT
pub inline fn UINT64_TO_JSVALUE(arg_globalObject: ?*anyopaque, arg_val: u64) EncodedJSValue {
var globalObject = arg_globalObject;
const val = arg_val;
- if (val < @bitCast(c_ulonglong, @as(c_longlong, @as(c_long, 2147483648)))) {
- return INT32_TO_JSVALUE(@bitCast(i32, @truncate(c_uint, val)));
+ if (val < @as(c_ulonglong, @bitCast(@as(c_longlong, @as(c_long, 2147483648))))) {
+ return INT32_TO_JSVALUE(@as(i32, @bitCast(@as(c_uint, @truncate(val)))));
}
- if (val < @bitCast(c_ulonglong, @as(c_longlong, @as(c_long, 9007199254740991)))) {
- return DOUBLE_TO_JSVALUE(@floatFromInt(f64, val));
+ if (val < @as(c_ulonglong, @bitCast(@as(c_longlong, @as(c_long, 9007199254740991))))) {
+ return DOUBLE_TO_JSVALUE(@as(f64, @floatFromInt(val)));
}
- return UINT64_TO_JSVALUE_SLOW(@ptrCast(*@import("./bindings.zig").JSGlobalObject, globalObject.?), val).asEncoded();
+ return UINT64_TO_JSVALUE_SLOW(@as(*@import("./bindings.zig").JSGlobalObject, @ptrCast(globalObject.?)), val).asEncoded();
}
pub inline fn INT64_TO_JSVALUE(arg_globalObject: ?*anyopaque, arg_val: i64) EncodedJSValue {
var globalObject = arg_globalObject;
var val = arg_val;
- if ((val >= @bitCast(c_longlong, @as(c_longlong, -@as(c_long, 2147483648)))) and (val <= @bitCast(c_longlong, @as(c_longlong, @as(c_long, 2147483648))))) {
- return INT32_TO_JSVALUE(@bitCast(i32, @truncate(c_int, val)));
+ if ((val >= @as(c_longlong, @bitCast(@as(c_longlong, -@as(c_long, 2147483648))))) and (val <= @as(c_longlong, @bitCast(@as(c_longlong, @as(c_long, 2147483648)))))) {
+ return INT32_TO_JSVALUE(@as(i32, @bitCast(@as(c_int, @truncate(val)))));
}
- if ((val >= @bitCast(c_longlong, @as(c_longlong, -@as(c_long, 9007199254740991)))) and (val <= @bitCast(c_longlong, @as(c_longlong, @as(c_long, 9007199254740991))))) {
- return DOUBLE_TO_JSVALUE(@floatFromInt(f64, val));
+ if ((val >= @as(c_longlong, @bitCast(@as(c_longlong, -@as(c_long, 9007199254740991))))) and (val <= @as(c_longlong, @bitCast(@as(c_longlong, @as(c_long, 9007199254740991)))))) {
+ return DOUBLE_TO_JSVALUE(@as(f64, @floatFromInt(val)));
}
- return INT64_TO_JSVALUE_SLOW(@ptrCast(*@import("./bindings.zig").JSGlobalObject, globalObject.?), val).asEncoded();
+ return INT64_TO_JSVALUE_SLOW(@as(*@import("./bindings.zig").JSGlobalObject, @ptrCast(globalObject.?)), val).asEncoded();
}
pub inline fn INT32_TO_JSVALUE(arg_val: i32) EncodedJSValue {
- return .{ .asInt64 = @bitCast(i64, @as(c_ulonglong, 18446181123756130304) | @bitCast(c_ulonglong, @as(c_ulonglong, @bitCast(u32, arg_val)))) };
+ return .{ .asInt64 = @as(i64, @bitCast(@as(c_ulonglong, 18446181123756130304) | @as(c_ulonglong, @bitCast(@as(c_ulonglong, @as(u32, @bitCast(arg_val))))))) };
}
pub inline fn DOUBLE_TO_JSVALUE(arg_val: f64) EncodedJSValue {
var res: EncodedJSValue = .{ .asDouble = arg_val };
- res.asInt64 += @as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49);
+ res.asInt64 += @as(c_longlong, 1) << @as(@import("std").math.Log2Int(c_longlong), @intCast(49));
return res;
}
pub inline fn FLOAT_TO_JSVALUE(arg_val: f32) EncodedJSValue {
var val = arg_val;
- return DOUBLE_TO_JSVALUE(@floatCast(f64, val));
+ return DOUBLE_TO_JSVALUE(@as(f64, @floatCast(val)));
}
pub inline fn BOOLEAN_TO_JSVALUE(arg_val: @"bool") EncodedJSValue {
var val = arg_val;
var res: EncodedJSValue = undefined;
- res.asInt64 = @bitCast(i64, @as(c_longlong, if (@as(c_int, @intFromBool(val)) != 0) (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1) else (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 0)));
+ res.asInt64 = @as(i64, @bitCast(@as(c_longlong, if (@as(c_int, @intFromBool(val)) != 0) (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1) else (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 0))));
return res;
}
pub inline fn PTR_TO_JSVALUE(arg_ptr: ?*anyopaque) EncodedJSValue {
var ptr = arg_ptr;
var val: EncodedJSValue = undefined;
- val.asInt64 = @intCast(i64, @intFromPtr(ptr)) + (@as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49));
+ val.asInt64 = @as(i64, @intCast(@intFromPtr(ptr))) + (@as(c_longlong, 1) << @as(@import("std").math.Log2Int(c_longlong), @intCast(49)));
return val;
}
pub inline fn JSVALUE_TO_PTR(arg_val: EncodedJSValue) ?*anyopaque {
var val = arg_val;
- return @ptrFromInt(?*anyopaque, val.asInt64 - (@as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49)));
+ return @as(?*anyopaque, @ptrFromInt(val.asInt64 - (@as(c_longlong, 1) << @as(@import("std").math.Log2Int(c_longlong), @intCast(49)))));
}
pub inline fn JSVALUE_TO_INT32(arg_val: EncodedJSValue) i32 {
var val = arg_val;
- return @bitCast(i32, @truncate(c_int, val.asInt64));
+ return @as(i32, @bitCast(@as(c_int, @truncate(val.asInt64))));
}
pub inline fn JSVALUE_TO_FLOAT(arg_val: EncodedJSValue) f32 {
var val = arg_val;
- return @floatCast(f32, JSVALUE_TO_DOUBLE(val));
+ return @as(f32, @floatCast(JSVALUE_TO_DOUBLE(val)));
}
pub inline fn JSVALUE_TO_DOUBLE(arg_val: EncodedJSValue) f64 {
var val = arg_val;
- val.asInt64 -= comptime @as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49);
+ val.asInt64 -= comptime @as(c_longlong, 1) << @as(@import("std").math.Log2Int(c_longlong), @intCast(49));
return val.asDouble;
}
pub inline fn JSVALUE_TO_BOOL(arg_val: EncodedJSValue) @"bool" {
var val = arg_val;
- return val.asInt64 == @bitCast(c_longlong, @as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1)));
+ return val.asInt64 == @as(c_longlong, @bitCast(@as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1))));
}
pub extern fn JSFunctionCall(globalObject: ?*anyopaque, callFrame: ?*anyopaque) ?*anyopaque;
pub const __block = @compileError("unable to translate macro: undefined identifier `__attribute__`"); // (no file):27:9
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp
index b360d429b..6da2cbdd2 100644
--- a/src/bun.js/bindings/JSSink.cpp
+++ b/src/bun.js/bindings/JSSink.cpp
@@ -1,6 +1,6 @@
// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by 'make generate-sink' at 2023-07-18T03:21:16.951Z
+// Generated by 'make generate-sink' at 2023-07-18T09:07:30.319Z
// To regenerate this file, run:
//
// make generate-sink
diff --git a/src/bun.js/bindings/JSSink.h b/src/bun.js/bindings/JSSink.h
index 09cea950c..7e95b886a 100644
--- a/src/bun.js/bindings/JSSink.h
+++ b/src/bun.js/bindings/JSSink.h
@@ -1,6 +1,6 @@
// AUTO-GENERATED FILE. DO NOT EDIT.
-// Generated by 'make generate-sink' at 2023-07-18T03:21:16.950Z
+// Generated by 'make generate-sink' at 2023-07-18T09:07:30.318Z
//
#pragma once
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp
index dd5c41c44..6c58c94dd 100644
--- a/src/bun.js/bindings/Process.cpp
+++ b/src/bun.js/bindings/Process.cpp
@@ -15,6 +15,9 @@
#include <JavaScriptCore/LazyProperty.h>
#include <JavaScriptCore/LazyPropertyInlines.h>
#include <JavaScriptCore/VMTrapsInlines.h>
+#include <termios.h>
+#include <errno.h>
+#include <sys/ioctl.h>
#pragma mark - Node.js Process
@@ -109,7 +112,53 @@ JSC_DEFINE_CUSTOM_SETTER(Process_defaultSetter,
return true;
}
-JSC_DECLARE_HOST_FUNCTION(Process_functionNextTick);
+static bool getWindowSize(int fd, size_t* width, size_t* height)
+{
+ struct winsize ws;
+ int err;
+ do
+ err = ioctl(fd, TIOCGWINSZ, &ws);
+ while (err == -1 && errno == EINTR);
+
+ if (err == -1)
+ return false;
+
+ *width = ws.ws_col;
+ *height = ws.ws_row;
+
+ return true;
+}
+
+JSC_DEFINE_HOST_FUNCTION(Process_functionInternalGetWindowSize,
+ (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
+{
+ JSC::VM& vm = globalObject->vm();
+ auto argCount = callFrame->argumentCount();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ if (argCount == 0) {
+ JSC::throwTypeError(globalObject, throwScope, "getWindowSize requires 2 argument (a file descriptor)"_s);
+ return JSC::JSValue::encode(JSC::JSValue {});
+ }
+
+ int fd = callFrame->uncheckedArgument(0).toInt32(globalObject);
+ RETURN_IF_EXCEPTION(throwScope, {});
+ JSC::JSArray* array = jsDynamicCast<JSC::JSArray*>(callFrame->uncheckedArgument(1));
+ if (!array || array->length() < 2) {
+ JSC::throwTypeError(globalObject, throwScope, "getWindowSize requires 2 argument (an array)"_s);
+ return JSC::JSValue::encode(JSC::JSValue {});
+ }
+
+ size_t width, height;
+ if (!getWindowSize(fd, &width, &height)) {
+ return JSC::JSValue::encode(jsBoolean(false));
+ }
+
+ array->putDirectIndex(globalObject, 0, jsNumber(width));
+ array->putDirectIndex(globalObject, 1, jsNumber(height));
+
+ return JSC::JSValue::encode(jsBoolean(true));
+}
+
JSC_DEFINE_HOST_FUNCTION(Process_functionNextTick,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
@@ -181,23 +230,35 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen,
auto argCount = callFrame->argumentCount();
if (argCount < 2) {
-
JSC::throwTypeError(globalObject, scope, "dlopen requires 2 arguments"_s);
return JSC::JSValue::encode(JSC::JSValue {});
}
JSC::JSValue moduleValue = callFrame->uncheckedArgument(0);
- if (!moduleValue.isObject()) {
+ JSC::JSObject* moduleObject = jsDynamicCast<JSC::JSObject*>(moduleValue);
+ if (UNLIKELY(!moduleObject)) {
JSC::throwTypeError(globalObject, scope, "dlopen requires an object as first argument"_s);
return JSC::JSValue::encode(JSC::JSValue {});
}
- JSC::Identifier exportsSymbol = JSC::Identifier::fromString(vm, "exports"_s);
- JSC::JSObject* exports = moduleValue.getObject()->getIfPropertyExists(globalObject, exportsSymbol).getObject();
+
+ JSValue exports = moduleObject->getIfPropertyExists(globalObject, builtinNames(vm).exportsPublicName());
+ RETURN_IF_EXCEPTION(scope, {});
+
+ if (UNLIKELY(!exports)) {
+ JSC::throwTypeError(globalObject, scope, "dlopen requires an object with an exports property"_s);
+ return JSC::JSValue::encode(JSC::JSValue {});
+ }
+
+ globalObject->pendingNapiModule = exports;
+ if (exports.isCell()) {
+ vm.writeBarrier(globalObject, exports.asCell());
+ }
WTF::String filename = callFrame->uncheckedArgument(1).toWTFString(globalObject);
+ RETURN_IF_EXCEPTION(scope, {});
+
CString utf8 = filename.utf8();
- globalObject->pendingNapiModule = exports;
void* handle = dlopen(utf8.data(), RTLD_LAZY);
if (!handle) {
@@ -855,9 +916,13 @@ static JSValue constructStdioWriteStream(JSC::JSGlobalObject* globalObject, int
{
auto& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
+ JSC::JSFunction* getWindowSizeFunction = JSC::JSFunction::create(vm, globalObject, 2,
+ String("getWindowSize"_s), Process_functionInternalGetWindowSize, ImplementationVisibility::Public);
+
JSC::JSFunction* getStdioWriteStream = JSC::JSFunction::create(vm, processObjectInternalsGetStdioWriteStreamCodeGenerator(vm), globalObject);
JSC::MarkedArgumentBuffer args;
args.append(JSC::jsNumber(fd));
+ args.append(getWindowSizeFunction);
auto clientData = WebCore::clientData(vm);
JSC::CallData callData = JSC::getCallData(getStdioWriteStream);
diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp
index c11766926..245010158 100644
--- a/src/bun.js/bindings/ZigGeneratedClasses.cpp
+++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp
@@ -17008,12 +17008,45 @@ JSC_DECLARE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap);
extern "C" EncodedJSValue TCPSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__endCallback);
+extern "C" EncodedJSValue TCPSocketPrototype__exportKeyingMaterial(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__exportKeyingMaterialCallback);
+
extern "C" EncodedJSValue TCPSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__flushCallback);
extern "C" EncodedJSValue TCPSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback);
+extern "C" EncodedJSValue TCPSocketPrototype__getCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getCertificateCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getCipher(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getCipherCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getEphemeralKeyInfo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getEphemeralKeyInfoCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getPeerCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getPeerCertificateCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getSessionCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getSharedSigalgs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getSharedSigalgsCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getTLSFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSFinishedMessageCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getTLSPeerFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSPeerFinishedMessageCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getTLSTicket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSTicketCallback);
+
+extern "C" EncodedJSValue TCPSocketPrototype__getTLSVersion(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getTLSVersionCallback);
+
extern "C" JSC::EncodedJSValue TCPSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject);
JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap);
@@ -17032,9 +17065,15 @@ JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback);
extern "C" JSC::EncodedJSValue TCPSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject);
JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap);
+extern "C" EncodedJSValue TCPSocketPrototype__setMaxSendFragment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setMaxSendFragmentCallback);
+
extern "C" EncodedJSValue TCPSocketPrototype__setServername(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setServernameCallback);
+extern "C" EncodedJSValue TCPSocketPrototype__setSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__setSessionCallback);
+
extern "C" EncodedJSValue TCPSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback);
@@ -17057,15 +17096,28 @@ static const HashTableValue JSTCPSocketPrototypeTableValues[] = {
{ "authorized"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__authorizedGetterWrap, 0 } },
{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } },
{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } },
+ { "exportKeyingMaterial"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__exportKeyingMaterialCallback, 3 } },
{ "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } },
{ "getAuthorizationError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getAuthorizationErrorCallback, 0 } },
+ { "getCertificate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getCertificateCallback, 0 } },
+ { "getCipher"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getCipherCallback, 0 } },
+ { "getEphemeralKeyInfo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getEphemeralKeyInfoCallback, 0 } },
+ { "getPeerCertificate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getPeerCertificateCallback, 1 } },
+ { "getSession"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getSessionCallback, 0 } },
+ { "getSharedSigalgs"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getSharedSigalgsCallback, 0 } },
+ { "getTLSFinishedMessage"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSFinishedMessageCallback, 0 } },
+ { "getTLSPeerFinishedMessage"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSPeerFinishedMessageCallback, 0 } },
+ { "getTLSTicket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSTicketCallback, 0 } },
+ { "getTLSVersion"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getTLSVersionCallback, 0 } },
{ "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } },
{ "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } },
{ "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } },
{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } },
{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } },
{ "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } },
+ { "setMaxSendFragment"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setMaxSendFragmentCallback, 1 } },
{ "setServername"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setServernameCallback, 1 } },
+ { "setSession"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__setSessionCallback, 0 } },
{ "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } },
{ "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } },
{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } },
@@ -17180,6 +17232,33 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexi
return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__exportKeyingMaterialCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__exportKeyingMaterial(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -17234,6 +17313,276 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback, (JSG
return TCPSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getCipherCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getCipher(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getEphemeralKeyInfoCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getEphemeralKeyInfo(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getPeerCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getPeerCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getSession(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getSharedSigalgsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getSharedSigalgs(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getTLSFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSPeerFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getTLSPeerFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSTicketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getTLSTicket(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getTLSVersionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__getTLSVersion(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
{
auto& vm = lexicalGlobalObject->vm();
@@ -17355,6 +17704,33 @@ extern "C" EncodedJSValue TCPSocketPrototype__remoteAddressGetCachedValue(JSC::E
return JSValue::encode(thisObject->m_remoteAddress.get());
}
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setMaxSendFragmentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__setMaxSendFragment(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setServernameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -17382,6 +17758,33 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setServernameCallback, (JSGlobalObj
return TCPSocketPrototype__setServername(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__setSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TCPSocketPrototype__setSession(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -17694,12 +18097,45 @@ JSC_DECLARE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap);
extern "C" EncodedJSValue TLSSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__endCallback);
+extern "C" EncodedJSValue TLSSocketPrototype__exportKeyingMaterial(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__exportKeyingMaterialCallback);
+
extern "C" EncodedJSValue TLSSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__flushCallback);
extern "C" EncodedJSValue TLSSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback);
+extern "C" EncodedJSValue TLSSocketPrototype__getCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getCertificateCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getCipher(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getCipherCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getEphemeralKeyInfo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getEphemeralKeyInfoCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getPeerCertificate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getPeerCertificateCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getSessionCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getSharedSigalgs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getSharedSigalgsCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getTLSFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSFinishedMessageCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getTLSPeerFinishedMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSPeerFinishedMessageCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getTLSTicket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSTicketCallback);
+
+extern "C" EncodedJSValue TLSSocketPrototype__getTLSVersion(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getTLSVersionCallback);
+
extern "C" JSC::EncodedJSValue TLSSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject);
JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap);
@@ -17718,9 +18154,15 @@ JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback);
extern "C" JSC::EncodedJSValue TLSSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject);
JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap);
+extern "C" EncodedJSValue TLSSocketPrototype__setMaxSendFragment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setMaxSendFragmentCallback);
+
extern "C" EncodedJSValue TLSSocketPrototype__setServername(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setServernameCallback);
+extern "C" EncodedJSValue TLSSocketPrototype__setSession(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
+JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__setSessionCallback);
+
extern "C" EncodedJSValue TLSSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame);
JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback);
@@ -17743,15 +18185,28 @@ static const HashTableValue JSTLSSocketPrototypeTableValues[] = {
{ "authorized"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__authorizedGetterWrap, 0 } },
{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } },
{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } },
+ { "exportKeyingMaterial"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__exportKeyingMaterialCallback, 3 } },
{ "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } },
{ "getAuthorizationError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getAuthorizationErrorCallback, 0 } },
+ { "getCertificate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getCertificateCallback, 0 } },
+ { "getCipher"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getCipherCallback, 0 } },
+ { "getEphemeralKeyInfo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getEphemeralKeyInfoCallback, 0 } },
+ { "getPeerCertificate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getPeerCertificateCallback, 1 } },
+ { "getSession"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getSessionCallback, 0 } },
+ { "getSharedSigalgs"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getSharedSigalgsCallback, 0 } },
+ { "getTLSFinishedMessage"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSFinishedMessageCallback, 0 } },
+ { "getTLSPeerFinishedMessage"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSPeerFinishedMessageCallback, 0 } },
+ { "getTLSTicket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSTicketCallback, 0 } },
+ { "getTLSVersion"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getTLSVersionCallback, 0 } },
{ "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } },
{ "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } },
{ "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } },
{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } },
{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } },
{ "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } },
+ { "setMaxSendFragment"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setMaxSendFragmentCallback, 1 } },
{ "setServername"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setServernameCallback, 1 } },
+ { "setSession"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__setSessionCallback, 0 } },
{ "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } },
{ "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } },
{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } },
@@ -17866,6 +18321,33 @@ JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__endCallback, (JSGlobalObject * lexi
return TLSSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__exportKeyingMaterialCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__exportKeyingMaterial(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -17920,6 +18402,276 @@ JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback, (JSG
return TLSSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getCipherCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getCipher(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getEphemeralKeyInfoCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getEphemeralKeyInfo(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getPeerCertificateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getPeerCertificate(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getSession(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getSharedSigalgsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getSharedSigalgs(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getTLSFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSPeerFinishedMessageCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getTLSPeerFinishedMessage(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSTicketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getTLSTicket(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getTLSVersionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__getTLSVersion(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
{
auto& vm = lexicalGlobalObject->vm();
@@ -18041,6 +18793,33 @@ extern "C" EncodedJSValue TLSSocketPrototype__remoteAddressGetCachedValue(JSC::E
return JSValue::encode(thisObject->m_remoteAddress.get());
}
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setMaxSendFragmentCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__setMaxSendFragment(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setServernameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -18068,6 +18847,33 @@ JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setServernameCallback, (JSGlobalObj
return TLSSocketPrototype__setServername(thisObject->wrapped(), lexicalGlobalObject, callFrame);
}
+JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__setSessionCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = lexicalGlobalObject->vm();
+
+ JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue());
+
+ if (UNLIKELY(!thisObject)) {
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ return throwVMTypeError(lexicalGlobalObject, throwScope);
+ }
+
+ JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject);
+
+#ifdef BUN_DEBUG
+ /** View the file name of the JS file that called this function
+ * from a debugger */
+ SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm);
+ const char* fileName = sourceOrigin.string().utf8().data();
+ static const char* lastFileName = nullptr;
+ if (lastFileName != fileName) {
+ lastFileName = fileName;
+ }
+#endif
+
+ return TLSSocketPrototype__setSession(thisObject->wrapped(), lexicalGlobalObject, callFrame);
+}
+
JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 552da4009..1c97a57a4 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -2190,6 +2190,14 @@ CPP_DECL void JSC__JSValue__putIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject*
array->putDirectIndex(arg1, arg2, value2);
}
+CPP_DECL void JSC__JSValue__push(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue3)
+{
+ JSC::JSValue value = JSC::JSValue::decode(JSValue0);
+ JSC::JSValue value2 = JSC::JSValue::decode(JSValue3);
+ JSC::JSArray* array = JSC::jsCast<JSC::JSArray*>(value);
+ array->push(arg1, value2);
+}
+
JSC__JSValue JSC__JSValue__createStringArray(JSC__JSGlobalObject* globalObject, const ZigString* arg1,
size_t arg2, bool clone)
{
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig
index 670c44808..3386de9b2 100644
--- a/src/bun.js/bindings/bindings.zig
+++ b/src/bun.js/bindings/bindings.zig
@@ -48,7 +48,7 @@ pub const JSObject = extern struct {
pub fn Initializer(comptime Ctx: type, comptime func: fn (*Ctx, obj: *JSObject, global: *JSGlobalObject) void) type {
return struct {
pub fn call(this: ?*anyopaque, obj: [*c]JSObject, global: [*c]JSGlobalObject) callconv(.C) void {
- @call(.always_inline, func, .{ @ptrCast(*Ctx, @alignCast(@alignOf(*Ctx), this.?)), obj.?, global.? });
+ @call(.always_inline, func, .{ @as(*Ctx, @ptrCast(@alignCast(this.?))), obj.?, global.? });
}
};
}
@@ -166,7 +166,7 @@ pub const ZigString = extern struct {
return Slice{
.allocator = NullableAllocator.init(allocator),
.ptr = out.ptr,
- .len = @truncate(u32, out.len),
+ .len = @as(u32, @truncate(out.len)),
};
}
@@ -180,9 +180,9 @@ pub const ZigString = extern struct {
pub fn charAt(this: ZigString, offset: usize) u8 {
if (this.is16Bit()) {
- return @truncate(u8, this.utf16SliceAligned()[offset]);
+ return @as(u8, @truncate(this.utf16SliceAligned()[offset]));
} else {
- return @truncate(u8, this.slice()[offset]);
+ return @as(u8, @truncate(this.slice()[offset]));
}
}
@@ -390,7 +390,7 @@ pub const ZigString = extern struct {
}
pub fn markStatic(this: *ZigString) void {
- this.ptr = @ptrFromInt([*]const u8, @intFromPtr(this.ptr) | (1 << 60));
+ this.ptr = @as([*]const u8, @ptrFromInt(@intFromPtr(this.ptr) | (1 << 60)));
}
pub fn isStatic(this: *const ZigString) bool {
@@ -405,7 +405,7 @@ pub const ZigString = extern struct {
pub fn init(allocator: std.mem.Allocator, input: []const u8) Slice {
return .{
.ptr = input.ptr,
- .len = @truncate(u32, input.len),
+ .len = @as(u32, @truncate(input.len)),
.allocator = NullableAllocator.init(allocator),
};
}
@@ -425,7 +425,7 @@ pub const ZigString = extern struct {
pub fn from(input: []u8, allocator: std.mem.Allocator) Slice {
return .{
.ptr = input.ptr,
- .len = @truncate(u32, input.len),
+ .len = @as(u32, @truncate(input.len)),
.allocator = NullableAllocator.init(allocator),
};
}
@@ -433,7 +433,7 @@ pub const ZigString = extern struct {
pub fn fromUTF8NeverFree(input: []const u8) Slice {
return .{
.ptr = input.ptr,
- .len = @truncate(u32, input.len),
+ .len = @as(u32, @truncate(input.len)),
.allocator = .{},
};
}
@@ -464,7 +464,7 @@ pub const ZigString = extern struct {
pub fn cloneWithTrailingSlash(this: Slice, allocator: std.mem.Allocator) !Slice {
var buf = try strings.cloneNormalizingSeparators(allocator, this.slice());
- return Slice{ .allocator = NullableAllocator.init(allocator), .ptr = buf.ptr, .len = @truncate(u32, buf.len) };
+ return Slice{ .allocator = NullableAllocator.init(allocator), .ptr = buf.ptr, .len = @as(u32, @truncate(buf.len)) };
}
pub fn cloneZ(this: Slice, allocator: std.mem.Allocator) !Slice {
@@ -503,7 +503,7 @@ pub const ZigString = extern struct {
}
pub fn mut(this: Slice) []u8 {
- return @ptrFromInt([*]u8, @intFromPtr(this.ptr))[0..this.len];
+ return @as([*]u8, @ptrFromInt(@intFromPtr(this.ptr)))[0..this.len];
}
/// Does nothing if the slice is not allocated
@@ -534,7 +534,7 @@ pub const ZigString = extern struct {
}
}
- return @ptrCast([*]align(1) const u16, untagged(this._unsafe_ptr_do_not_use))[0..this.len];
+ return @as([*]align(1) const u16, @ptrCast(untagged(this._unsafe_ptr_do_not_use)))[0..this.len];
}
pub inline fn utf16SliceAligned(this: *const ZigString) []const u16 {
@@ -544,7 +544,7 @@ pub const ZigString = extern struct {
}
}
- return @ptrCast([*]const u16, @alignCast(@alignOf(u16), untagged(this._unsafe_ptr_do_not_use)))[0..this.len];
+ return @as([*]const u16, @ptrCast(@alignCast(untagged(this._unsafe_ptr_do_not_use))))[0..this.len];
}
pub inline fn isEmpty(this: *const ZigString) bool {
@@ -634,7 +634,7 @@ pub const ZigString = extern struct {
/// Globally-allocated memory only
pub fn from16(slice_: [*]const u16, len: usize) ZigString {
- var str = init(@ptrCast([*]const u8, slice_)[0..len]);
+ var str = init(@as([*]const u8, @ptrCast(slice_))[0..len]);
str.markUTF16();
str.mark();
str.assertGlobal();
@@ -665,11 +665,11 @@ pub const ZigString = extern struct {
}
pub fn markUTF8(this: *ZigString) void {
- this._unsafe_ptr_do_not_use = @ptrFromInt([*]const u8, @intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 61));
+ this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 61)));
}
pub fn markUTF16(this: *ZigString) void {
- this._unsafe_ptr_do_not_use = @ptrFromInt([*]const u8, @intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 63));
+ this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 63)));
}
pub fn setOutputEncoding(this: *ZigString) void {
@@ -688,7 +688,7 @@ pub const ZigString = extern struct {
pub const mark = markGlobal;
pub inline fn markGlobal(this: *ZigString) void {
- this._unsafe_ptr_do_not_use = @ptrFromInt([*]const u8, @intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 62));
+ this._unsafe_ptr_do_not_use = @as([*]const u8, @ptrFromInt(@intFromPtr(this._unsafe_ptr_do_not_use) | (1 << 62)));
}
pub fn format(self: ZigString, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
@@ -714,7 +714,7 @@ pub const ZigString = extern struct {
inline fn untagged(ptr: [*]const u8) [*]const u8 {
// this can be null ptr, so long as it's also a 0 length string
@setRuntimeSafety(false);
- return @ptrFromInt([*]const u8, @truncate(u53, @intFromPtr(ptr)));
+ return @as([*]const u8, @ptrFromInt(@as(u53, @truncate(@intFromPtr(ptr)))));
}
pub fn slice(this: *const ZigString) []const u8 {
@@ -738,14 +738,14 @@ pub const ZigString = extern struct {
var buffer = this.toOwnedSlice(allocator) catch unreachable;
return Slice{
.ptr = buffer.ptr,
- .len = @truncate(u32, buffer.len),
+ .len = @as(u32, @truncate(buffer.len)),
.allocator = NullableAllocator.init(allocator),
};
}
return Slice{
.ptr = untagged(this._unsafe_ptr_do_not_use),
- .len = @truncate(u32, this.len),
+ .len = @as(u32, @truncate(this.len)),
};
}
@@ -759,7 +759,7 @@ pub const ZigString = extern struct {
return Slice{
.allocator = NullableAllocator.init(allocator),
.ptr = buffer.ptr,
- .len = @truncate(u32, buffer.len),
+ .len = @as(u32, @truncate(buffer.len)),
};
}
@@ -768,13 +768,13 @@ pub const ZigString = extern struct {
return Slice{
.allocator = NullableAllocator.init(allocator),
.ptr = buffer.ptr,
- .len = @truncate(u32, buffer.len),
+ .len = @as(u32, @truncate(buffer.len)),
};
}
return Slice{
.ptr = untagged(this._unsafe_ptr_do_not_use),
- .len = @truncate(u32, this.len),
+ .len = @as(u32, @truncate(this.len)),
};
}
@@ -785,7 +785,7 @@ pub const ZigString = extern struct {
return Slice{
.allocator = NullableAllocator.init(allocator),
.ptr = buffer.ptr,
- .len = @truncate(u32, buffer.len),
+ .len = @as(u32, @truncate(buffer.len)),
};
}
@@ -797,14 +797,14 @@ pub const ZigString = extern struct {
var buffer = this.toOwnedSliceZ(allocator) catch unreachable;
return Slice{
.ptr = buffer.ptr,
- .len = @truncate(u32, buffer.len),
+ .len = @as(u32, @truncate(buffer.len)),
.allocator = NullableAllocator.init(allocator),
};
}
return Slice{
.ptr = untagged(this._unsafe_ptr_do_not_use),
- .len = @truncate(u32, this.len),
+ .len = @as(u32, @truncate(this.len)),
};
}
@@ -892,7 +892,7 @@ pub const ZigString = extern struct {
}
return if (this.is16Bit())
- C_API.JSStringCreateWithCharactersNoCopy(@ptrCast([*]const u16, @alignCast(@alignOf([*]const u16), untagged(this._unsafe_ptr_do_not_use))), this.len)
+ C_API.JSStringCreateWithCharactersNoCopy(@as([*]const u16, @ptrCast(@alignCast(untagged(this._unsafe_ptr_do_not_use)))), this.len)
else
C_API.JSStringCreateStatic(untagged(this._unsafe_ptr_do_not_use), this.len);
}
@@ -1019,7 +1019,7 @@ pub const DOMFormData = opaque {
const Wrapper = struct {
const cb = callback;
pub fn run(c: *anyopaque, str: *ZigString) callconv(.C) void {
- cb(@ptrCast(Ctx, c), str.*);
+ cb(@as(Ctx, @ptrCast(c)), str.*);
}
};
@@ -1631,11 +1631,11 @@ pub const Sizes = @import("../bindings/sizes.zig");
pub const JSUint8Array = opaque {
pub const name = "Uint8Array_alias";
pub fn ptr(this: *JSUint8Array) [*]u8 {
- return @ptrFromInt(*[*]u8, @intFromPtr(this) + Sizes.Bun_FFI_PointerOffsetToTypedArrayVector).*;
+ return @as(*[*]u8, @ptrFromInt(@intFromPtr(this) + Sizes.Bun_FFI_PointerOffsetToTypedArrayVector)).*;
}
pub fn len(this: *JSUint8Array) usize {
- return @ptrFromInt(*usize, @intFromPtr(this) + Sizes.Bun_FFI_PointerOffsetToTypedArrayLength).*;
+ return @as(*usize, @ptrFromInt(@intFromPtr(this) + Sizes.Bun_FFI_PointerOffsetToTypedArrayLength)).*;
}
pub fn slice(this: *JSUint8Array) []u8 {
@@ -1876,7 +1876,7 @@ pub fn PromiseCallback(comptime Type: type, comptime CallbackFunction: fn (*Type
arguments: [*]const JSValue,
arguments_len: usize,
) callconv(.C) JSValue {
- return CallbackFunction(@ptrCast(*Type, @alignCast(@alignOf(*Type), ctx.?)), globalThis, arguments[0..arguments_len]) catch |err| brk: {
+ return CallbackFunction(@as(*Type, @ptrCast(@alignCast(ctx.?))), globalThis, arguments[0..arguments_len]) catch |err| brk: {
break :brk ZigString.init(bun.asByteSlice(@errorName(err))).toErrorInstance(globalThis);
};
}
@@ -1907,7 +1907,7 @@ pub const AbortSignal = extern opaque {
}
};
- return this.addListener(@ptrCast(?*anyopaque, ctx), Wrapper.callback);
+ return this.addListener(@as(?*anyopaque, @ptrCast(ctx)), Wrapper.callback);
}
pub fn addListener(
@@ -2824,7 +2824,7 @@ pub const JSGlobalObject = extern struct {
const cppFn = shim.cppFn;
pub fn ref(this: *JSGlobalObject) C_API.JSContextRef {
- return @ptrCast(C_API.JSContextRef, this);
+ return @as(C_API.JSContextRef, @ptrCast(this));
}
pub const ctx = ref;
@@ -2866,16 +2866,16 @@ pub const JSGlobalObject = extern struct {
// you most likely need to run
// make clean-jsc-bindings
// make bindings -j10
- const assertion = this.bunVM_() == @ptrCast(*anyopaque, JSC.VirtualMachine.get());
+ const assertion = this.bunVM_() == @as(*anyopaque, @ptrCast(JSC.VirtualMachine.get()));
if (!assertion) @breakpoint();
std.debug.assert(assertion);
}
- return @ptrCast(*JSC.VirtualMachine, @alignCast(std.meta.alignment(JSC.VirtualMachine), this.bunVM_()));
+ return @as(*JSC.VirtualMachine, @ptrCast(@alignCast(this.bunVM_())));
}
/// We can't do the threadlocal check when queued from another thread
pub fn bunVMConcurrently(this: *JSGlobalObject) *JSC.VirtualMachine {
- return @ptrCast(*JSC.VirtualMachine, @alignCast(@alignOf(JSC.VirtualMachine), this.bunVM_()));
+ return @as(*JSC.VirtualMachine, @ptrCast(@alignCast(this.bunVM_())));
}
pub fn handleRejectedPromises(this: *JSGlobalObject) void {
@@ -2943,7 +2943,7 @@ pub const JSArrayIterator = struct {
return .{
.array = value,
.global = global,
- .len = @truncate(u32, value.getLength(global)),
+ .len = @as(u32, @truncate(value.getLength(global))),
};
}
@@ -3014,10 +3014,10 @@ pub const JSMap = opaque {
pub const JSValueReprInt = i64;
pub const JSValue = enum(JSValueReprInt) {
zero = 0,
- undefined = @bitCast(JSValueReprInt, @as(i64, 0xa)),
- null = @bitCast(JSValueReprInt, @as(i64, 0x2)),
- true = @bitCast(JSValueReprInt, @as(i64, 0x4)),
- false = @bitCast(JSValueReprInt, @as(i64, 0x6)),
+ undefined = @as(JSValueReprInt, @bitCast(@as(i64, 0xa))),
+ null = @as(JSValueReprInt, @bitCast(@as(i64, 0x2))),
+ true = @as(JSValueReprInt, @bitCast(@as(i64, 0x4))),
+ false = @as(JSValueReprInt, @bitCast(@as(i64, 0x6))),
_,
pub const Type = JSValueReprInt;
@@ -3361,7 +3361,7 @@ pub const JSValue = enum(JSValueReprInt) {
};
pub inline fn cast(ptr: anytype) JSValue {
- return @enumFromInt(JSValue, @bitCast(i64, @intFromPtr(ptr)));
+ return @as(JSValue, @enumFromInt(@as(i64, @bitCast(@intFromPtr(ptr)))));
}
pub fn coerceToInt32(this: JSValue, globalThis: *JSC.JSGlobalObject) i32 {
@@ -3426,7 +3426,7 @@ pub const JSValue = enum(JSValueReprInt) {
}
if (this.isNumber()) {
- return @truncate(i32, this.coerceDoubleTruncatingIntoInt64());
+ return @as(i32, @truncate(this.coerceDoubleTruncatingIntoInt64()));
}
return this.coerceToInt32(globalThis);
@@ -3441,16 +3441,16 @@ pub const JSValue = enum(JSValueReprInt) {
return switch (comptime T) {
u32 => toU32(this),
u16 => toU16(this),
- c_uint => @intCast(c_uint, toU32(this)),
- c_int => @intCast(c_int, toInt32(this)),
+ c_uint => @as(c_uint, @intCast(toU32(this))),
+ c_int => @as(c_int, @intCast(toInt32(this))),
?AnyPromise => asAnyPromise(this),
- u52 => @truncate(u52, @intCast(u64, @max(this.toInt64(), 0))),
- i52 => @truncate(i52, @intCast(i52, this.toInt64())),
+ u52 => @as(u52, @truncate(@as(u64, @intCast(@max(this.toInt64(), 0))))),
+ i52 => @as(i52, @truncate(@as(i52, @intCast(this.toInt64())))),
u64 => toUInt64NoTruncate(this),
- u8 => @truncate(u8, toU32(this)),
- i16 => @truncate(i16, toInt32(this)),
- i8 => @truncate(i8, toInt32(this)),
- i32 => @truncate(i32, toInt32(this)),
+ u8 => @as(u8, @truncate(toU32(this))),
+ i16 => @as(i16, @truncate(toInt32(this))),
+ i8 => @as(i8, @truncate(toInt32(this))),
+ i32 => @as(i32, @truncate(toInt32(this))),
i64 => this.toInt64(),
bool => this.toBoolean(),
else => @compileError("Not implemented yet"),
@@ -3473,9 +3473,9 @@ pub const JSValue = enum(JSValueReprInt) {
return JSC.C.JSObjectCallAsFunctionReturnValue(
globalThis,
this.asObjectRef(),
- @ptrCast(JSC.C.JSValueRef, globalThis),
+ @as(JSC.C.JSValueRef, @ptrCast(globalThis)),
args.len,
- @ptrCast(?[*]const JSC.C.JSValueRef, args.ptr),
+ @as(?[*]const JSC.C.JSValueRef, @ptrCast(args.ptr)),
);
}
@@ -3484,9 +3484,9 @@ pub const JSValue = enum(JSValueReprInt) {
return JSC.C.JSObjectCallAsFunctionReturnValue(
globalThis,
this.asObjectRef(),
- @ptrCast(JSC.C.JSValueRef, thisValue.asNullableVoid()),
+ @as(JSC.C.JSValueRef, @ptrCast(thisValue.asNullableVoid())),
args.len,
- @ptrCast(?[*]const JSC.C.JSValueRef, args.ptr),
+ @as(?[*]const JSC.C.JSValueRef, @ptrCast(args.ptr)),
);
}
@@ -3527,6 +3527,10 @@ pub const JSValue = enum(JSValueReprInt) {
cppFn("putIndex", .{ value, globalObject, i, out });
}
+ pub fn push(value: JSValue, globalObject: *JSGlobalObject, out: JSValue) void {
+ cppFn("push", .{ value, globalObject, out });
+ }
+
pub fn as(value: JSValue, comptime ZigType: type) ?*ZigType {
if (value.isEmptyOrUndefinedOrNull())
return null;
@@ -3621,7 +3625,7 @@ pub const JSValue = enum(JSValueReprInt) {
pub fn createBufferFromLength(globalObject: *JSGlobalObject, len: usize) JSValue {
JSC.markBinding(@src());
- return JSBuffer__bufferFromLength(globalObject, @intCast(i64, len));
+ return JSBuffer__bufferFromLength(globalObject, @as(i64, @intCast(len)));
}
pub fn jestSnapshotPrettyFormat(this: JSValue, out: *MutableString, globalObject: *JSGlobalObject) !void {
@@ -3639,7 +3643,7 @@ pub const JSValue = enum(JSValueReprInt) {
JestPrettyFormat.format(
.Debug,
globalObject,
- @ptrCast([*]const JSValue, &this),
+ @as([*]const JSValue, @ptrCast(&this)),
1,
Writer,
Writer,
@@ -3700,7 +3704,7 @@ pub const JSValue = enum(JSValueReprInt) {
JSC.ZigConsoleClient.format(
.Debug,
globalObject,
- @ptrCast([*]const JSValue, &this),
+ @as([*]const JSValue, @ptrCast(&this)),
1,
Writer,
Writer,
@@ -3741,12 +3745,12 @@ pub const JSValue = enum(JSValueReprInt) {
return switch (comptime Number) {
JSValue => number,
f32, f64 => jsNumberFromDouble(@as(f64, number)),
- c_ushort, u8, i16, i32, c_int, i8, u16 => jsNumberFromInt32(@intCast(i32, number)),
- u32, u52, c_uint, i64 => jsNumberFromInt64(@intCast(i64, number)),
- usize, u64 => jsNumberFromUint64(@intCast(u64, number)),
+ c_ushort, u8, i16, i32, c_int, i8, u16 => jsNumberFromInt32(@as(i32, @intCast(number))),
+ u32, u52, c_uint, i64 => jsNumberFromInt64(@as(i64, @intCast(number))),
+ usize, u64 => jsNumberFromUint64(@as(u64, @intCast(number))),
comptime_int => switch (number) {
- 0...std.math.maxInt(i32) => jsNumberFromInt32(@intCast(i32, number)),
- else => jsNumberFromInt64(@intCast(i64, number)),
+ 0...std.math.maxInt(i32) => jsNumberFromInt32(@as(i32, @intCast(number))),
+ else => jsNumberFromInt64(@as(i64, @intCast(number))),
},
else => @compileError("Type transformation missing for number of type: " ++ @typeName(Number)),
};
@@ -3856,10 +3860,10 @@ pub const JSValue = enum(JSValueReprInt) {
pub fn jsNumberFromInt64(i: i64) JSValue {
if (i <= std.math.maxInt(i32)) {
- return jsNumberFromInt32(@intCast(i32, i));
+ return jsNumberFromInt32(@as(i32, @intCast(i)));
}
- return jsNumberFromDouble(@floatFromInt(f64, @truncate(i52, i)));
+ return jsNumberFromDouble(@as(f64, @floatFromInt(@as(i52, @truncate(i)))));
}
pub inline fn toJS(this: JSValue, _: *const JSGlobalObject) JSValue {
@@ -3868,10 +3872,10 @@ pub const JSValue = enum(JSValueReprInt) {
pub fn jsNumberFromUint64(i: u64) JSValue {
if (i <= std.math.maxInt(i32)) {
- return jsNumberFromInt32(@intCast(i32, i));
+ return jsNumberFromInt32(@as(i32, @intCast(i)));
}
- return jsNumberFromDouble(@floatFromInt(f64, @intCast(i52, @truncate(u51, i))));
+ return jsNumberFromDouble(@as(f64, @floatFromInt(@as(i52, @intCast(@as(u51, @truncate(i)))))));
}
pub fn coerceDoubleTruncatingIntoInt64(this: JSValue) i64 {
@@ -3885,9 +3889,9 @@ pub const JSValue = enum(JSValueReprInt) {
return if (double_value < 0) @as(i64, std.math.minInt(i64)) else @as(i64, std.math.maxInt(i64));
}
- return @intFromFloat(
+ return @as(
i64,
- double_value,
+ @intFromFloat(double_value),
);
}
@@ -4067,7 +4071,7 @@ pub const JSValue = enum(JSValueReprInt) {
pub inline fn isCell(this: JSValue) bool {
return switch (this) {
.zero, .undefined, .null, .true, .false => false,
- else => (@bitCast(u64, @intFromEnum(this)) & FFI.NotCellMask) == 0,
+ else => (@as(u64, @bitCast(@intFromEnum(this))) & FFI.NotCellMask) == 0,
};
}
@@ -4293,7 +4297,7 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub fn get(this: JSValue, global: *JSGlobalObject, property: []const u8) ?JSValue {
- const value = getIfPropertyExistsImpl(this, global, property.ptr, @intCast(u32, property.len));
+ const value = getIfPropertyExistsImpl(this, global, property.ptr, @as(u32, @intCast(property.len)));
return if (@intFromEnum(value) != 0) value else return null;
}
@@ -4551,7 +4555,7 @@ pub const JSValue = enum(JSValueReprInt) {
pub fn asNumber(this: JSValue) f64 {
if (this.isInt32()) {
- return @floatFromInt(f64, this.asInt32());
+ return @as(f64, @floatFromInt(this.asInt32()));
}
if (isNumber(this)) {
@@ -4574,15 +4578,15 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub fn asPtr(this: JSValue, comptime Pointer: type) *Pointer {
- return @ptrFromInt(*Pointer, this.asPtrAddress());
+ return @as(*Pointer, @ptrFromInt(this.asPtrAddress()));
}
pub fn fromPtrAddress(addr: anytype) JSValue {
- return jsNumber(@floatFromInt(f64, @bitCast(usize, @as(usize, addr))));
+ return jsNumber(@as(f64, @floatFromInt(@as(usize, @bitCast(@as(usize, addr))))));
}
pub fn asPtrAddress(this: JSValue) usize {
- return @bitCast(usize, @intFromFloat(usize, this.asDouble()));
+ return @as(usize, @bitCast(@as(usize, @intFromFloat(this.asDouble()))));
}
pub fn fromPtr(addr: anytype) JSValue {
@@ -4609,7 +4613,7 @@ pub const JSValue = enum(JSValueReprInt) {
if (comptime bun.Environment.allow_assert) {
std.debug.assert(this.isNumber());
}
- return @intFromFloat(i64, @max(@min(this.asDouble(), std.math.maxInt(i52)), std.math.minInt(i52)));
+ return @as(i64, @intFromFloat(@max(@min(this.asDouble(), std.math.maxInt(i52)), std.math.minInt(i52))));
}
pub fn toInt32(this: JSValue) i32 {
@@ -4618,7 +4622,7 @@ pub const JSValue = enum(JSValueReprInt) {
}
if (this.isNumber()) {
- return @truncate(i32, this.asInt52());
+ return @as(i32, @truncate(this.asInt52()));
}
if (comptime bun.Environment.allow_assert) {
@@ -4636,11 +4640,11 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub inline fn toU16(this: JSValue) u16 {
- return @truncate(u16, @max(this.toInt32(), 0));
+ return @as(u16, @truncate(@max(this.toInt32(), 0)));
}
pub inline fn toU32(this: JSValue) u32 {
- return @intCast(u32, @min(@max(this.toInt64(), 0), std.math.maxInt(u32)));
+ return @as(u32, @intCast(@min(@max(this.toInt64(), 0), std.math.maxInt(u32))));
}
/// This function supports:
@@ -4661,7 +4665,7 @@ pub const JSValue = enum(JSValueReprInt) {
return 0;
}
- return @intFromFloat(u64, @max(@min(len, std.math.maxInt(i52)), 0));
+ return @as(u64, @intFromFloat(@max(@min(len, std.math.maxInt(i52)), 0)));
}
/// This function supports:
@@ -4682,7 +4686,7 @@ pub const JSValue = enum(JSValueReprInt) {
return null;
}
- return @intFromFloat(u64, @max(@min(len, std.math.maxInt(i52)), 0));
+ return @as(u64, @intFromFloat(@max(@min(len, std.math.maxInt(i52)), 0)));
}
/// Do not use this directly!
@@ -4727,19 +4731,19 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub inline fn asRef(this: JSValue) C_API.JSValueRef {
- return @ptrFromInt(C_API.JSValueRef, @bitCast(usize, @intFromEnum(this)));
+ return @as(C_API.JSValueRef, @ptrFromInt(@as(usize, @bitCast(@intFromEnum(this)))));
}
pub inline fn c(this: C_API.JSValueRef) JSValue {
- return @enumFromInt(JSValue, @bitCast(JSValue.Type, @intFromPtr(this)));
+ return @as(JSValue, @enumFromInt(@as(JSValue.Type, @bitCast(@intFromPtr(this)))));
}
pub inline fn fromRef(this: C_API.JSValueRef) JSValue {
- return @enumFromInt(JSValue, @bitCast(JSValue.Type, @intFromPtr(this)));
+ return @as(JSValue, @enumFromInt(@as(JSValue.Type, @bitCast(@intFromPtr(this)))));
}
pub inline fn asObjectRef(this: JSValue) C_API.JSObjectRef {
- return @ptrCast(C_API.JSObjectRef, this.asVoid());
+ return @as(C_API.JSObjectRef, @ptrCast(this.asVoid()));
}
/// When the GC sees a JSValue referenced in the stack
@@ -4747,11 +4751,11 @@ pub const JSValue = enum(JSValueReprInt) {
/// This mimicks the implementation in JavaScriptCore's C++
pub inline fn ensureStillAlive(this: JSValue) void {
if (this.isEmpty() or this.isNumber() or this.isBoolean() or this.isUndefinedOrNull()) return;
- std.mem.doNotOptimizeAway(@ptrCast(C_API.JSObjectRef, this.asVoid()));
+ std.mem.doNotOptimizeAway(@as(C_API.JSObjectRef, @ptrCast(this.asVoid())));
}
pub inline fn asNullableVoid(this: JSValue) ?*anyopaque {
- return @ptrFromInt(?*anyopaque, @bitCast(usize, @intFromEnum(this)));
+ return @as(?*anyopaque, @ptrFromInt(@as(usize, @bitCast(@intFromEnum(this)))));
}
pub inline fn asVoid(this: JSValue) *anyopaque {
@@ -4851,6 +4855,7 @@ pub const JSValue = enum(JSValueReprInt) {
"put",
"putDirect",
"putIndex",
+ "push",
"putRecord",
"strictDeepEquals",
"symbolFor",
@@ -4995,7 +5000,7 @@ pub const VM = extern struct {
const callback_ = callback;
const Wrapper = struct {
pub fn run(ptr_: *anyopaque) callconv(.C) void {
- var ptr__ = @ptrCast(*Ptr, @alignCast(@alignOf(Ptr), ptr_));
+ var ptr__ = @as(*Ptr, @ptrCast(@alignCast(ptr_)));
callback_(ptr__);
}
};
@@ -5193,11 +5198,11 @@ pub const CallFrame = opaque {
pub const name = "JSC::CallFrame";
pub fn argumentsPtr(self: *const CallFrame) [*]const JSC.JSValue {
- return @ptrCast([*]const JSC.JSValue, @alignCast(alignment, self)) + Sizes.Bun_CallFrame__firstArgument;
+ return @as([*]align(alignment) const JSC.JSValue, @ptrCast(@alignCast(self))) + Sizes.Bun_CallFrame__firstArgument;
}
pub fn callee(self: *const CallFrame) JSC.JSValue {
- return (@ptrCast([*]const JSC.JSValue, @alignCast(alignment, self)) + Sizes.Bun_CallFrame__callee)[0];
+ return (@as([*]align(alignment) const JSC.JSValue, @ptrCast(@alignCast(self))) + Sizes.Bun_CallFrame__callee)[0];
}
fn Arguments(comptime max: usize) type {
@@ -5242,11 +5247,11 @@ pub const CallFrame = opaque {
}
pub fn this(self: *const CallFrame) JSC.JSValue {
- return (@ptrCast([*]const JSC.JSValue, @alignCast(alignment, self)) + Sizes.Bun_CallFrame__thisArgument)[0];
+ return (@as([*]align(alignment) const JSC.JSValue, @ptrCast(@alignCast(self))) + Sizes.Bun_CallFrame__thisArgument)[0];
}
pub fn argumentsCount(self: *const CallFrame) usize {
- return @intCast(usize, (@ptrCast([*]const JSC.JSValue, @alignCast(alignment, self)) + Sizes.Bun_CallFrame__argumentCountIncludingThis)[0].asInt32() - 1);
+ return @as(usize, @intCast((@as([*]align(alignment) const JSC.JSValue, @ptrCast(@alignCast(self))) + Sizes.Bun_CallFrame__argumentCountIncludingThis)[0].asInt32() - 1));
}
};
@@ -5289,7 +5294,7 @@ const DeinitFunction = *const fn (ctx: *anyopaque, buffer: [*]u8, len: usize) ca
pub const JSArray = struct {
pub fn from(globalThis: *JSGlobalObject, arguments: []const JSC.JSValue) JSValue {
- return JSC.JSValue.c(JSC.C.JSObjectMakeArray(globalThis, arguments.len, @ptrCast(?[*]const JSC.C.JSObjectRef, arguments.ptr), null));
+ return JSC.JSValue.c(JSC.C.JSObjectMakeArray(globalThis, arguments.len, @as(?[*]const JSC.C.JSObjectRef, @ptrCast(arguments.ptr)), null));
}
};
@@ -5329,7 +5334,7 @@ const private = struct {
pub fn NewFunctionPtr(globalObject: *JSGlobalObject, symbolName: ?*const ZigString, argCount: u32, comptime functionPointer: anytype, strong: bool) *anyopaque {
JSC.markBinding(@src());
- return private.Bun__CreateFFIFunction(globalObject, symbolName, argCount, @ptrCast(*const anyopaque, &functionPointer), strong);
+ return private.Bun__CreateFFIFunction(globalObject, symbolName, argCount, @as(*const anyopaque, @ptrCast(&functionPointer)), strong);
}
pub fn NewFunction(
@@ -5376,7 +5381,7 @@ pub fn NewFunctionWithData(
globalObject,
symbolName,
argCount,
- @ptrCast(*const anyopaque, &functionPointer),
+ @as(*const anyopaque, @ptrCast(&functionPointer)),
strong,
data,
);
@@ -5479,7 +5484,7 @@ pub fn Thenable(comptime name: []const u8, comptime Then: type, comptime onResol
) callconv(.C) void {
@setRuntimeSafety(false);
const args_list = callframe.?.arguments(8);
- onResolve(@ptrCast(*Then, @alignCast(std.meta.alignment(Then), args_list.ptr[args_list.len - 1].asEncoded().asPtr)), globalThis, args_list.ptr[0]);
+ onResolve(@as(*Then, @ptrCast(@alignCast(args_list.ptr[args_list.len - 1].asEncoded().asPtr))), globalThis, args_list.ptr[0]);
}
pub fn reject(
@@ -5488,7 +5493,7 @@ pub fn Thenable(comptime name: []const u8, comptime Then: type, comptime onResol
) callconv(.C) void {
@setRuntimeSafety(false);
const args_list = callframe.?.arguments(8);
- onReject(@ptrCast(*Then, @alignCast(std.meta.alignment(Then), args_list.ptr[args_list.len - 1].asEncoded().asPtr)), globalThis, args_list.ptr[0]);
+ onReject(@as(*Then, @ptrCast(@alignCast(args_list.ptr[args_list.len - 1].asEncoded().asPtr))), globalThis, args_list.ptr[0]);
}
pub fn then(ctx: *Then, this: JSValue, globalThis: *JSGlobalObject) void {
@@ -5535,7 +5540,7 @@ pub fn JSPropertyIterator(comptime options: JSPropertyIteratorOptions) type {
const array_ref = JSC.C.JSObjectCopyPropertyNames(global, object);
return .{
.array_ref = array_ref,
- .len = @truncate(u32, JSC.C.JSPropertyNameArrayGetCount(array_ref)),
+ .len = @as(u32, @truncate(JSC.C.JSPropertyNameArrayGetCount(array_ref))),
.object = if (comptime options.include_value) object else .{},
.global = if (comptime options.include_value) global else .{},
.value = undefined,
diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig
index 40ee4ff57..b569fe68c 100644
--- a/src/bun.js/bindings/exports.zig
+++ b/src/bun.js/bindings/exports.zig
@@ -119,7 +119,7 @@ pub const ErrorCode = enum(ErrorCodeInt) {
_,
pub inline fn from(code: anyerror) ErrorCode {
- return @enumFromInt(ErrorCode, @intFromError(code));
+ return @as(ErrorCode, @enumFromInt(@intFromError(code)));
}
pub const ParserError = @intFromEnum(ErrorCode.from(error.ParserError));
@@ -243,7 +243,7 @@ pub const ResolvedSource = extern struct {
const Mimalloc = @import("../../allocators/mimalloc.zig");
export fn ZigString__free(raw: [*]const u8, len: usize, allocator_: ?*anyopaque) void {
- var allocator: std.mem.Allocator = @ptrCast(*std.mem.Allocator, @alignCast(@alignOf(*std.mem.Allocator), allocator_ orelse return)).*;
+ var allocator: std.mem.Allocator = @as(*std.mem.Allocator, @ptrCast(@alignCast(allocator_ orelse return))).*;
var ptr = ZigString.init(raw[0..len]).slice().ptr;
if (comptime Environment.allow_assert) {
std.debug.assert(Mimalloc.mi_is_in_heap_region(ptr));
@@ -254,7 +254,7 @@ export fn ZigString__free(raw: [*]const u8, len: usize, allocator_: ?*anyopaque)
}
export fn ZigString__free_global(ptr: [*]const u8, len: usize) void {
- var untagged = @ptrFromInt(*anyopaque, @intFromPtr(ZigString.init(ptr[0..len]).slice().ptr));
+ var untagged = @as(*anyopaque, @ptrFromInt(@intFromPtr(ZigString.init(ptr[0..len]).slice().ptr)));
if (comptime Environment.allow_assert) {
std.debug.assert(Mimalloc.mi_is_in_heap_region(ptr));
}
@@ -468,7 +468,7 @@ pub const ZigStackTrace = extern struct {
var source_line_len = source_lines_iter.getLength();
if (source_line_len > 0) {
- var source_lines = try allocator.alloc(Api.SourceLine, @intCast(usize, @max(source_lines_iter.i + 1, 0)));
+ var source_lines = try allocator.alloc(Api.SourceLine, @as(usize, @intCast(@max(source_lines_iter.i + 1, 0))));
var source_line_buf = try allocator.alloc(u8, source_line_len);
source_lines_iter = this.sourceLineIterator();
var remain_buf = source_line_buf[0..];
@@ -523,7 +523,7 @@ pub const ZigStackTrace = extern struct {
pub fn getLength(this: *SourceLineIterator) usize {
var count: usize = 0;
- for (this.trace.source_lines_ptr[0..@intCast(usize, this.i + 1)]) |*line| {
+ for (this.trace.source_lines_ptr[0..@as(usize, @intCast(this.i + 1))]) |*line| {
count += line.length();
}
@@ -538,9 +538,9 @@ pub const ZigStackTrace = extern struct {
pub fn next(this: *SourceLineIterator) ?SourceLine {
if (this.i < 0) return null;
- const source_line = this.trace.source_lines_ptr[@intCast(usize, this.i)];
+ const source_line = this.trace.source_lines_ptr[@as(usize, @intCast(this.i))];
const result = SourceLine{
- .line = this.trace.source_lines_numbers[@intCast(usize, this.i)],
+ .line = this.trace.source_lines_numbers[@as(usize, @intCast(this.i))],
.text = source_line.toUTF8(bun.default_allocator),
};
this.i -= 1;
@@ -555,7 +555,7 @@ pub const ZigStackTrace = extern struct {
i = j;
}
}
- return SourceLineIterator{ .trace = this, .i = @intCast(i16, i) };
+ return SourceLineIterator{ .trace = this, .i = @as(i16, @intCast(i)) };
}
};
@@ -596,7 +596,7 @@ pub const ZigStackFrame = extern struct {
frame.position.column_stop = this.position.column_stop;
frame.position.expression_start = this.position.expression_start;
frame.position.expression_stop = this.position.expression_stop;
- frame.scope = @enumFromInt(Api.StackFrameScope, @intFromEnum(this.code_type));
+ frame.scope = @as(Api.StackFrameScope, @enumFromInt(@intFromEnum(this.code_type)));
return frame;
}
@@ -846,7 +846,7 @@ pub const ZigException = extern struct {
pub fn zigException(this: *Holder) *ZigException {
if (!this.loaded) {
this.zig_exception = ZigException{
- .code = @enumFromInt(JSErrorCode, 255),
+ .code = @as(JSErrorCode, @enumFromInt(255)),
.runtime_type = JSRuntimeType.Nothing,
.name = String.empty,
.message = String.empty,
@@ -1581,7 +1581,7 @@ pub const ZigConsoleClient = struct {
var writer = WrappedWriter(Writer){ .ctx = writer_ };
var slice = slice_;
var i: u32 = 0;
- var len: u32 = @truncate(u32, slice.len);
+ var len: u32 = @as(u32, @truncate(slice.len));
var any_non_ascii = false;
while (i < len) : (i += 1) {
switch (slice[i]) {
@@ -1608,7 +1608,7 @@ pub const ZigConsoleClient = struct {
any_non_ascii = false;
slice = slice[@min(slice.len, i + 1)..];
i = 0;
- len = @truncate(u32, slice.len);
+ len = @as(u32, @truncate(slice.len));
const next_value = this.remaining_values[0];
this.remaining_values = this.remaining_values[1..];
switch (token) {
@@ -2025,7 +2025,7 @@ pub const ZigConsoleClient = struct {
i = -i;
}
const digits = if (i != 0)
- bun.fmt.fastDigitCount(@intCast(usize, i)) + @as(usize, @intFromBool(is_negative))
+ bun.fmt.fastDigitCount(@as(usize, @intCast(i))) + @as(usize, @intFromBool(is_negative))
else
1;
this.addForNewLine(digits);
@@ -2136,7 +2136,7 @@ pub const ZigConsoleClient = struct {
writer.print(comptime Output.prettyFmt("<cyan>[Getter]<r>", enable_ansi_colors), .{});
},
.Array => {
- const len = @truncate(u32, value.getLength(this.globalThis));
+ const len = @as(u32, @truncate(value.getLength(this.globalThis)));
if (len == 0) {
writer.writeAll("[]");
this.addForNewLine(2);
@@ -2267,9 +2267,9 @@ pub const ZigConsoleClient = struct {
// this case should never happen
return this.printAs(.Undefined, Writer, writer_, .undefined, .Cell, enable_ansi_colors);
} else if (value.as(JSC.API.Bun.Timer.TimerObject)) |timer| {
- this.addForNewLine("Timeout(# ) ".len + bun.fmt.fastDigitCount(@intCast(u64, @max(timer.id, 0))));
+ this.addForNewLine("Timeout(# ) ".len + bun.fmt.fastDigitCount(@as(u64, @intCast(@max(timer.id, 0)))));
if (timer.kind == .setInterval) {
- this.addForNewLine("repeats ".len + bun.fmt.fastDigitCount(@intCast(u64, @max(timer.id, 0))));
+ this.addForNewLine("repeats ".len + bun.fmt.fastDigitCount(@as(u64, @intCast(@max(timer.id, 0)))));
writer.print(comptime Output.prettyFmt("<r><blue>Timeout<r> <d>(#<yellow>{d}<r><d>, repeats)<r>", enable_ansi_colors), .{
timer.id,
});
@@ -2344,7 +2344,7 @@ pub const ZigConsoleClient = struct {
writer.writeAll("Promise { " ++ comptime Output.prettyFmt("<r><cyan>", enable_ansi_colors));
- switch (JSPromise.status(@ptrCast(*JSPromise, value.asObjectRef().?), this.globalThis.vm())) {
+ switch (JSPromise.status(@as(*JSPromise, @ptrCast(value.asObjectRef().?)), this.globalThis.vm())) {
JSPromise.Status.Pending => {
writer.writeAll("<pending>");
},
@@ -2753,7 +2753,7 @@ pub const ZigConsoleClient = struct {
var j: usize = 0;
while (j < length) : (j += 1) {
- const child = JSC.JSObject.getIndex(children, this.globalThis, @intCast(u32, j));
+ const child = JSC.JSObject.getIndex(children, this.globalThis, @as(u32, @intCast(j)));
this.format(Tag.getAdvanced(child, this.globalThis, .{ .hide_global = true }), Writer, writer_, child, this.globalThis, enable_ansi_colors);
if (j + 1 < length) {
writer.writeAll("\n");
@@ -2883,56 +2883,56 @@ pub const ZigConsoleClient = struct {
*@TypeOf(writer),
&writer,
i8,
- @alignCast(std.meta.alignment([]i8), std.mem.bytesAsSlice(i8, slice)),
+ @as([]align(std.meta.alignment([]i8)) i8, @alignCast(std.mem.bytesAsSlice(i8, slice))),
enable_ansi_colors,
),
.Int16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i16,
- @alignCast(std.meta.alignment([]i16), std.mem.bytesAsSlice(i16, slice)),
+ @as([]align(std.meta.alignment([]i16)) i16, @alignCast(std.mem.bytesAsSlice(i16, slice))),
enable_ansi_colors,
),
.Uint16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u16,
- @alignCast(std.meta.alignment([]u16), std.mem.bytesAsSlice(u16, slice)),
+ @as([]align(std.meta.alignment([]u16)) u16, @alignCast(std.mem.bytesAsSlice(u16, slice))),
enable_ansi_colors,
),
.Int32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i32,
- @alignCast(std.meta.alignment([]i32), std.mem.bytesAsSlice(i32, slice)),
+ @as([]align(std.meta.alignment([]i32)) i32, @alignCast(std.mem.bytesAsSlice(i32, slice))),
enable_ansi_colors,
),
.Uint32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u32,
- @alignCast(std.meta.alignment([]u32), std.mem.bytesAsSlice(u32, slice)),
+ @as([]align(std.meta.alignment([]u32)) u32, @alignCast(std.mem.bytesAsSlice(u32, slice))),
enable_ansi_colors,
),
.Float32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f32,
- @alignCast(std.meta.alignment([]f32), std.mem.bytesAsSlice(f32, slice)),
+ @as([]align(std.meta.alignment([]f32)) f32, @alignCast(std.mem.bytesAsSlice(f32, slice))),
enable_ansi_colors,
),
.Float64Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f64,
- @alignCast(std.meta.alignment([]f64), std.mem.bytesAsSlice(f64, slice)),
+ @as([]align(std.meta.alignment([]f64)) f64, @alignCast(std.mem.bytesAsSlice(f64, slice))),
enable_ansi_colors,
),
.BigInt64Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i64,
- @alignCast(std.meta.alignment([]i64), std.mem.bytesAsSlice(i64, slice)),
+ @as([]align(std.meta.alignment([]i64)) i64, @alignCast(std.mem.bytesAsSlice(i64, slice))),
enable_ansi_colors,
),
.BigUint64Array => {
@@ -2940,7 +2940,7 @@ pub const ZigConsoleClient = struct {
*@TypeOf(writer),
&writer,
u64,
- @alignCast(std.meta.alignment([]u64), std.mem.bytesAsSlice(u64, slice)),
+ @as([]align(std.meta.alignment([]u64)) u64, @alignCast(std.mem.bytesAsSlice(u64, slice))),
enable_ansi_colors,
);
},
@@ -3115,7 +3115,7 @@ pub const ZigConsoleClient = struct {
var value: std.time.Timer = result.value orelse return;
// get the duration in microseconds
// then display it in milliseconds
- Output.printElapsed(@floatFromInt(f64, value.read() / std.time.ns_per_us) / std.time.us_per_ms);
+ Output.printElapsed(@as(f64, @floatFromInt(value.read() / std.time.ns_per_us)) / std.time.us_per_ms);
switch (len) {
0 => Output.printErrorln("\n", .{}),
else => Output.printErrorln(" {s}", .{chars[0..len]}),
@@ -3144,7 +3144,7 @@ pub const ZigConsoleClient = struct {
var value: std.time.Timer = (pending_time_logs.get(id) orelse return) orelse return;
// get the duration in microseconds
// then display it in milliseconds
- Output.printElapsed(@floatFromInt(f64, value.read() / std.time.ns_per_us) / std.time.us_per_ms);
+ Output.printElapsed(@as(f64, @floatFromInt(value.read() / std.time.ns_per_us)) / std.time.us_per_ms);
switch (len) {
0 => Output.printErrorln("\n", .{}),
else => Output.printErrorln(" {s}", .{chars[0..len]}),
@@ -3369,7 +3369,7 @@ pub const ZigConsoleClient = struct {
// };
pub inline fn toGlobalContextRef(ptr: *JSGlobalObject) CAPI.JSGlobalContextRef {
- return @ptrCast(CAPI.JSGlobalContextRef, ptr);
+ return @as(CAPI.JSGlobalContextRef, @ptrCast(ptr));
}
comptime {
diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig
index 10aec1865..947be7a51 100644
--- a/src/bun.js/bindings/generated_classes.zig
+++ b/src/bun.js/bindings/generated_classes.zig
@@ -4458,10 +4458,32 @@ pub const JSTCPSocket = struct {
@compileLog("Expected TCPSocket.setData to be a setter");
if (@TypeOf(TCPSocket.end) != CallbackType)
@compileLog("Expected TCPSocket.end to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.end)));
+ if (@TypeOf(TCPSocket.exportKeyingMaterial) != CallbackType)
+ @compileLog("Expected TCPSocket.exportKeyingMaterial to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.exportKeyingMaterial)));
if (@TypeOf(TCPSocket.flush) != CallbackType)
@compileLog("Expected TCPSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.flush)));
if (@TypeOf(TCPSocket.getAuthorizationError) != CallbackType)
@compileLog("Expected TCPSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getAuthorizationError)));
+ if (@TypeOf(TCPSocket.getCertificate) != CallbackType)
+ @compileLog("Expected TCPSocket.getCertificate to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getCertificate)));
+ if (@TypeOf(TCPSocket.getCipher) != CallbackType)
+ @compileLog("Expected TCPSocket.getCipher to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getCipher)));
+ if (@TypeOf(TCPSocket.getEphemeralKeyInfo) != CallbackType)
+ @compileLog("Expected TCPSocket.getEphemeralKeyInfo to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getEphemeralKeyInfo)));
+ if (@TypeOf(TCPSocket.getPeerCertificate) != CallbackType)
+ @compileLog("Expected TCPSocket.getPeerCertificate to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getPeerCertificate)));
+ if (@TypeOf(TCPSocket.getSession) != CallbackType)
+ @compileLog("Expected TCPSocket.getSession to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getSession)));
+ if (@TypeOf(TCPSocket.getSharedSigalgs) != CallbackType)
+ @compileLog("Expected TCPSocket.getSharedSigalgs to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getSharedSigalgs)));
+ if (@TypeOf(TCPSocket.getTLSFinishedMessage) != CallbackType)
+ @compileLog("Expected TCPSocket.getTLSFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSFinishedMessage)));
+ if (@TypeOf(TCPSocket.getTLSPeerFinishedMessage) != CallbackType)
+ @compileLog("Expected TCPSocket.getTLSPeerFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSPeerFinishedMessage)));
+ if (@TypeOf(TCPSocket.getTLSTicket) != CallbackType)
+ @compileLog("Expected TCPSocket.getTLSTicket to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSTicket)));
+ if (@TypeOf(TCPSocket.getTLSVersion) != CallbackType)
+ @compileLog("Expected TCPSocket.getTLSVersion to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getTLSVersion)));
if (@TypeOf(TCPSocket.getListener) != GetterType)
@compileLog("Expected TCPSocket.getListener to be a getter");
@@ -4478,8 +4500,12 @@ pub const JSTCPSocket = struct {
if (@TypeOf(TCPSocket.getRemoteAddress) != GetterType)
@compileLog("Expected TCPSocket.getRemoteAddress to be a getter");
+ if (@TypeOf(TCPSocket.setMaxSendFragment) != CallbackType)
+ @compileLog("Expected TCPSocket.setMaxSendFragment to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setMaxSendFragment)));
if (@TypeOf(TCPSocket.setServername) != CallbackType)
@compileLog("Expected TCPSocket.setServername to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setServername)));
+ if (@TypeOf(TCPSocket.setSession) != CallbackType)
+ @compileLog("Expected TCPSocket.setSession to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.setSession)));
if (@TypeOf(TCPSocket.shutdown) != CallbackType)
@compileLog("Expected TCPSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.shutdown)));
if (@TypeOf(TCPSocket.timeout) != CallbackType)
@@ -4492,21 +4518,34 @@ pub const JSTCPSocket = struct {
@compileLog("Expected TCPSocket.write to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.write)));
if (!JSC.is_bindgen) {
@export(TCPSocket.end, .{ .name = "TCPSocketPrototype__end" });
+ @export(TCPSocket.exportKeyingMaterial, .{ .name = "TCPSocketPrototype__exportKeyingMaterial" });
@export(TCPSocket.finalize, .{ .name = "TCPSocketClass__finalize" });
@export(TCPSocket.flush, .{ .name = "TCPSocketPrototype__flush" });
@export(TCPSocket.getALPNProtocol, .{ .name = "TCPSocketPrototype__getALPNProtocol" });
@export(TCPSocket.getAuthorizationError, .{ .name = "TCPSocketPrototype__getAuthorizationError" });
@export(TCPSocket.getAuthorized, .{ .name = "TCPSocketPrototype__getAuthorized" });
+ @export(TCPSocket.getCertificate, .{ .name = "TCPSocketPrototype__getCertificate" });
+ @export(TCPSocket.getCipher, .{ .name = "TCPSocketPrototype__getCipher" });
@export(TCPSocket.getData, .{ .name = "TCPSocketPrototype__getData" });
+ @export(TCPSocket.getEphemeralKeyInfo, .{ .name = "TCPSocketPrototype__getEphemeralKeyInfo" });
@export(TCPSocket.getListener, .{ .name = "TCPSocketPrototype__getListener" });
@export(TCPSocket.getLocalPort, .{ .name = "TCPSocketPrototype__getLocalPort" });
+ @export(TCPSocket.getPeerCertificate, .{ .name = "TCPSocketPrototype__getPeerCertificate" });
@export(TCPSocket.getReadyState, .{ .name = "TCPSocketPrototype__getReadyState" });
@export(TCPSocket.getRemoteAddress, .{ .name = "TCPSocketPrototype__getRemoteAddress" });
+ @export(TCPSocket.getSession, .{ .name = "TCPSocketPrototype__getSession" });
+ @export(TCPSocket.getSharedSigalgs, .{ .name = "TCPSocketPrototype__getSharedSigalgs" });
+ @export(TCPSocket.getTLSFinishedMessage, .{ .name = "TCPSocketPrototype__getTLSFinishedMessage" });
+ @export(TCPSocket.getTLSPeerFinishedMessage, .{ .name = "TCPSocketPrototype__getTLSPeerFinishedMessage" });
+ @export(TCPSocket.getTLSTicket, .{ .name = "TCPSocketPrototype__getTLSTicket" });
+ @export(TCPSocket.getTLSVersion, .{ .name = "TCPSocketPrototype__getTLSVersion" });
@export(TCPSocket.hasPendingActivity, .{ .name = "TCPSocket__hasPendingActivity" });
@export(TCPSocket.ref, .{ .name = "TCPSocketPrototype__ref" });
@export(TCPSocket.reload, .{ .name = "TCPSocketPrototype__reload" });
@export(TCPSocket.setData, .{ .name = "TCPSocketPrototype__setData" });
+ @export(TCPSocket.setMaxSendFragment, .{ .name = "TCPSocketPrototype__setMaxSendFragment" });
@export(TCPSocket.setServername, .{ .name = "TCPSocketPrototype__setServername" });
+ @export(TCPSocket.setSession, .{ .name = "TCPSocketPrototype__setSession" });
@export(TCPSocket.shutdown, .{ .name = "TCPSocketPrototype__shutdown" });
@export(TCPSocket.timeout, .{ .name = "TCPSocketPrototype__timeout" });
@export(TCPSocket.unref, .{ .name = "TCPSocketPrototype__unref" });
@@ -4623,10 +4662,32 @@ pub const JSTLSSocket = struct {
@compileLog("Expected TLSSocket.setData to be a setter");
if (@TypeOf(TLSSocket.end) != CallbackType)
@compileLog("Expected TLSSocket.end to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.end)));
+ if (@TypeOf(TLSSocket.exportKeyingMaterial) != CallbackType)
+ @compileLog("Expected TLSSocket.exportKeyingMaterial to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.exportKeyingMaterial)));
if (@TypeOf(TLSSocket.flush) != CallbackType)
@compileLog("Expected TLSSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.flush)));
if (@TypeOf(TLSSocket.getAuthorizationError) != CallbackType)
@compileLog("Expected TLSSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getAuthorizationError)));
+ if (@TypeOf(TLSSocket.getCertificate) != CallbackType)
+ @compileLog("Expected TLSSocket.getCertificate to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getCertificate)));
+ if (@TypeOf(TLSSocket.getCipher) != CallbackType)
+ @compileLog("Expected TLSSocket.getCipher to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getCipher)));
+ if (@TypeOf(TLSSocket.getEphemeralKeyInfo) != CallbackType)
+ @compileLog("Expected TLSSocket.getEphemeralKeyInfo to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getEphemeralKeyInfo)));
+ if (@TypeOf(TLSSocket.getPeerCertificate) != CallbackType)
+ @compileLog("Expected TLSSocket.getPeerCertificate to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getPeerCertificate)));
+ if (@TypeOf(TLSSocket.getSession) != CallbackType)
+ @compileLog("Expected TLSSocket.getSession to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getSession)));
+ if (@TypeOf(TLSSocket.getSharedSigalgs) != CallbackType)
+ @compileLog("Expected TLSSocket.getSharedSigalgs to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getSharedSigalgs)));
+ if (@TypeOf(TLSSocket.getTLSFinishedMessage) != CallbackType)
+ @compileLog("Expected TLSSocket.getTLSFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSFinishedMessage)));
+ if (@TypeOf(TLSSocket.getTLSPeerFinishedMessage) != CallbackType)
+ @compileLog("Expected TLSSocket.getTLSPeerFinishedMessage to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSPeerFinishedMessage)));
+ if (@TypeOf(TLSSocket.getTLSTicket) != CallbackType)
+ @compileLog("Expected TLSSocket.getTLSTicket to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSTicket)));
+ if (@TypeOf(TLSSocket.getTLSVersion) != CallbackType)
+ @compileLog("Expected TLSSocket.getTLSVersion to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getTLSVersion)));
if (@TypeOf(TLSSocket.getListener) != GetterType)
@compileLog("Expected TLSSocket.getListener to be a getter");
@@ -4643,8 +4704,12 @@ pub const JSTLSSocket = struct {
if (@TypeOf(TLSSocket.getRemoteAddress) != GetterType)
@compileLog("Expected TLSSocket.getRemoteAddress to be a getter");
+ if (@TypeOf(TLSSocket.setMaxSendFragment) != CallbackType)
+ @compileLog("Expected TLSSocket.setMaxSendFragment to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setMaxSendFragment)));
if (@TypeOf(TLSSocket.setServername) != CallbackType)
@compileLog("Expected TLSSocket.setServername to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setServername)));
+ if (@TypeOf(TLSSocket.setSession) != CallbackType)
+ @compileLog("Expected TLSSocket.setSession to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.setSession)));
if (@TypeOf(TLSSocket.shutdown) != CallbackType)
@compileLog("Expected TLSSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.shutdown)));
if (@TypeOf(TLSSocket.timeout) != CallbackType)
@@ -4657,21 +4722,34 @@ pub const JSTLSSocket = struct {
@compileLog("Expected TLSSocket.write to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.write)));
if (!JSC.is_bindgen) {
@export(TLSSocket.end, .{ .name = "TLSSocketPrototype__end" });
+ @export(TLSSocket.exportKeyingMaterial, .{ .name = "TLSSocketPrototype__exportKeyingMaterial" });
@export(TLSSocket.finalize, .{ .name = "TLSSocketClass__finalize" });
@export(TLSSocket.flush, .{ .name = "TLSSocketPrototype__flush" });
@export(TLSSocket.getALPNProtocol, .{ .name = "TLSSocketPrototype__getALPNProtocol" });
@export(TLSSocket.getAuthorizationError, .{ .name = "TLSSocketPrototype__getAuthorizationError" });
@export(TLSSocket.getAuthorized, .{ .name = "TLSSocketPrototype__getAuthorized" });
+ @export(TLSSocket.getCertificate, .{ .name = "TLSSocketPrototype__getCertificate" });
+ @export(TLSSocket.getCipher, .{ .name = "TLSSocketPrototype__getCipher" });
@export(TLSSocket.getData, .{ .name = "TLSSocketPrototype__getData" });
+ @export(TLSSocket.getEphemeralKeyInfo, .{ .name = "TLSSocketPrototype__getEphemeralKeyInfo" });
@export(TLSSocket.getListener, .{ .name = "TLSSocketPrototype__getListener" });
@export(TLSSocket.getLocalPort, .{ .name = "TLSSocketPrototype__getLocalPort" });
+ @export(TLSSocket.getPeerCertificate, .{ .name = "TLSSocketPrototype__getPeerCertificate" });
@export(TLSSocket.getReadyState, .{ .name = "TLSSocketPrototype__getReadyState" });
@export(TLSSocket.getRemoteAddress, .{ .name = "TLSSocketPrototype__getRemoteAddress" });
+ @export(TLSSocket.getSession, .{ .name = "TLSSocketPrototype__getSession" });
+ @export(TLSSocket.getSharedSigalgs, .{ .name = "TLSSocketPrototype__getSharedSigalgs" });
+ @export(TLSSocket.getTLSFinishedMessage, .{ .name = "TLSSocketPrototype__getTLSFinishedMessage" });
+ @export(TLSSocket.getTLSPeerFinishedMessage, .{ .name = "TLSSocketPrototype__getTLSPeerFinishedMessage" });
+ @export(TLSSocket.getTLSTicket, .{ .name = "TLSSocketPrototype__getTLSTicket" });
+ @export(TLSSocket.getTLSVersion, .{ .name = "TLSSocketPrototype__getTLSVersion" });
@export(TLSSocket.hasPendingActivity, .{ .name = "TLSSocket__hasPendingActivity" });
@export(TLSSocket.ref, .{ .name = "TLSSocketPrototype__ref" });
@export(TLSSocket.reload, .{ .name = "TLSSocketPrototype__reload" });
@export(TLSSocket.setData, .{ .name = "TLSSocketPrototype__setData" });
+ @export(TLSSocket.setMaxSendFragment, .{ .name = "TLSSocketPrototype__setMaxSendFragment" });
@export(TLSSocket.setServername, .{ .name = "TLSSocketPrototype__setServername" });
+ @export(TLSSocket.setSession, .{ .name = "TLSSocketPrototype__setSession" });
@export(TLSSocket.shutdown, .{ .name = "TLSSocketPrototype__shutdown" });
@export(TLSSocket.timeout, .{ .name = "TLSSocketPrototype__timeout" });
@export(TLSSocket.unref, .{ .name = "TLSSocketPrototype__unref" });
diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h
index 02631d749..c03b621c1 100644
--- a/src/bun.js/bindings/headers.h
+++ b/src/bun.js/bindings/headers.h
@@ -383,6 +383,7 @@ CPP_DECL unsigned char JSC__JSValue__jsType(JSC__JSValue JSValue0);
CPP_DECL JSC__JSValue JSC__JSValue__jsUndefined();
CPP_DECL JSC__JSValue JSC__JSValue__makeWithNameAndPrototype(JSC__JSGlobalObject* arg0, void* arg1, void* arg2, const ZigString* arg3);
CPP_DECL JSC__JSValue JSC__JSValue__parseJSON(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1);
+CPP_DECL void JSC__JSValue__push(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2);
CPP_DECL void JSC__JSValue__put(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, const ZigString* arg2, JSC__JSValue JSValue3);
CPP_DECL void JSC__JSValue__putIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2, JSC__JSValue JSValue3);
CPP_DECL void JSC__JSValue__putRecord(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4);
diff --git a/src/bun.js/bindings/headers.zig b/src/bun.js/bindings/headers.zig
index 0b71d6918..b1e19557c 100644
--- a/src/bun.js/bindings/headers.zig
+++ b/src/bun.js/bindings/headers.zig
@@ -283,6 +283,7 @@ 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;
diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp
index c4bf7fc32..6e47db8c4 100644
--- a/src/bun.js/bindings/napi.cpp
+++ b/src/bun.js/bindings/napi.cpp
@@ -496,7 +496,10 @@ extern "C" void napi_module_register(napi_module* mod)
auto* globalObject = Bun__getDefaultGlobal();
JSC::VM& vm = globalObject->vm();
globalObject->napiModuleRegisterCallCount++;
- JSC::JSObject* object = globalObject->pendingNapiModule.getObject();
+ JSValue pendingNapiModule = globalObject->pendingNapiModule;
+ JSObject* object = (pendingNapiModule && pendingNapiModule.isObject()) ? pendingNapiModule.getObject()
+ : nullptr;
+
if (!object) {
object = JSC::constructEmptyObject(globalObject);
} else {
@@ -504,20 +507,23 @@ extern "C" void napi_module_register(napi_module* mod)
}
EnsureStillAliveScope ensureAlive(object);
- auto result = reinterpret_cast<JSC::EncodedJSValue>(
- mod->nm_register_func(reinterpret_cast<napi_env>(globalObject), reinterpret_cast<napi_value>(JSC::JSValue::encode(JSC::JSValue(object)))));
+ auto resultValue = toJS(
+ mod->nm_register_func(toNapi(globalObject), toNapi(object)));
auto keyStr = WTF::String::fromUTF8(mod->nm_modname);
- JSC::JSValue resultValue = JSC::JSValue::decode(result);
EnsureStillAliveScope ensureAlive2(resultValue);
if (resultValue.isEmpty()) {
- globalObject->pendingNapiModule = createError(globalObject, makeString("Node-API module \""_s, keyStr, "\" returned an error"_s));
+ JSValue errorInstance = createError(globalObject, makeString("Node-API module \""_s, keyStr, "\" returned an error"_s));
+ globalObject->pendingNapiModule = errorInstance;
+ vm.writeBarrier(globalObject, errorInstance);
EnsureStillAliveScope ensureAlive(globalObject->pendingNapiModule);
return;
}
if (!resultValue.isObject()) {
- globalObject->pendingNapiModule = createError(globalObject, makeString("Expected Node-API module \""_s, keyStr, "\" to return an exports object"_s));
+ JSValue errorInstance = createError(globalObject, makeString("Expected Node-API module \""_s, keyStr, "\" to return an exports object"_s));
+ globalObject->pendingNapiModule = errorInstance;
+ vm.writeBarrier(globalObject, errorInstance);
EnsureStillAliveScope ensureAlive(globalObject->pendingNapiModule);
return;
}
@@ -532,7 +538,9 @@ extern "C" void napi_module_register(napi_module* mod)
// Add it to the ESM registry
globalObject->moduleLoader()->provideFetch(globalObject, JSC::jsString(vm, WTFMove(keyStr)), WTFMove(source));
+
globalObject->pendingNapiModule = object;
+ vm.writeBarrier(globalObject, object);
}
extern "C" napi_status napi_wrap(napi_env env,
diff --git a/src/bun.js/bindings/shimmer.zig b/src/bun.js/bindings/shimmer.zig
index 3a6242000..29d12c1db 100644
--- a/src/bun.js/bindings/shimmer.zig
+++ b/src/bun.js/bindings/shimmer.zig
@@ -163,7 +163,7 @@ pub fn Shimmer(comptime _namespace: []const u8, comptime _name: []const u8, comp
if (comptime isNullableType(ExpectedReturnType) != isNullableType(ExternReturnType)) {
return value.?;
} else if (comptime (@typeInfo(ExpectedReturnType) == .Enum) and (@typeInfo(ExternReturnType) != .Enum)) {
- return @enumFromInt(ExpectedReturnType, value);
+ return @as(ExpectedReturnType, @enumFromInt(value));
} else {
return value;
}