diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/api/server.classes.ts | 4 | ||||
-rw-r--r-- | src/bun.js/api/server.zig | 31 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 144 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 4 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 104 |
5 files changed, 287 insertions, 0 deletions
diff --git a/src/bun.js/api/server.classes.ts b/src/bun.js/api/server.classes.ts index 80449ed27..81ec30988 100644 --- a/src/bun.js/api/server.classes.ts +++ b/src/bun.js/api/server.classes.ts @@ -45,6 +45,10 @@ function generate(name) { getter: "getHostname", cache: true, }, + address: { + getter: "getAddress", + cache: true, + }, protocol: { getter: "getProtocol", }, diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 1df908a0b..edf1d6d69 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -5297,6 +5297,37 @@ pub fn NewServer(comptime NamespaceType: type, comptime ssl_enabled_: bool, comp return JSC.JSValue.jsNumber(@as(i32, @intCast(@as(u31, @truncate(this.activeSocketsCount()))))); } + pub fn getAddress(this: *ThisServer, globalThis: *JSGlobalObject) callconv(.C) JSC.JSValue { + switch (this.config.address) { + .unix => |unix| { + var value = bun.String.create(bun.sliceTo(@constCast(unix), 0)); + defer value.deref(); + return value.toJS(globalThis); + }, + .tcp => { + var port: u16 = this.config.address.tcp.port; + + if (this.listener) |listener| { + port = @intCast(listener.getLocalPort()); + + var buf: [64]u8 = [_]u8{0} ** 64; + var is_ipv6: bool = false; + + if (listener.socket().localAddressText(&buf, &is_ipv6)) |slice| { + var ip = bun.String.create(slice); + return JSSocketAddress__create( + this.globalThis, + ip.toJS(this.globalThis), + port, + is_ipv6, + ); + } + } + return JSValue.jsNull(); + }, + } + } + pub fn getHostname(this: *ThisServer, globalThis: *JSGlobalObject) callconv(.C) JSC.JSValue { if (this.cached_hostname.isEmpty()) { if (this.listener) |listener| { diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index 0517832b0..8d8c98154 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -4176,6 +4176,9 @@ JSC_DECLARE_CUSTOM_GETTER(jsDebugHTTPSServerConstructor); extern "C" void DebugHTTPSServerClass__finalize(void*); +extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__addressGetterWrap); + extern "C" JSC::EncodedJSValue DebugHTTPSServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(DebugHTTPSServerPrototype__developmentGetterWrap); @@ -4218,6 +4221,7 @@ JSC_DECLARE_HOST_FUNCTION(DebugHTTPSServerPrototype__upgradeCallback); STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPSServerPrototype, JSDebugHTTPSServerPrototype::Base); static const HashTableValue JSDebugHTTPSServerPrototypeTableValues[] = { + { "address"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__addressGetterWrap, 0 } }, { "development"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__developmentGetterWrap, 0 } }, { "fetch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPSServerPrototype__fetchCallback, 1 } }, { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPSServerPrototype__hostnameGetterWrap, 0 } }, @@ -4247,6 +4251,37 @@ JSC_DEFINE_CUSTOM_GETTER(jsDebugHTTPSServerConstructor, (JSGlobalObject * lexica return JSValue::encode(globalObject->JSDebugHTTPSServerConstructor()); } +JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSDebugHTTPSServer* thisObject = jsCast<JSDebugHTTPSServer*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_address.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + DebugHTTPSServerPrototype__getAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_address.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void DebugHTTPSServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDebugHTTPSServer*>(JSValue::decode(thisValue)); + thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue DebugHTTPSServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSDebugHTTPSServer*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_address.get()); +} + JSC_DEFINE_CUSTOM_GETTER(DebugHTTPSServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); @@ -4639,6 +4674,7 @@ void JSDebugHTTPSServer::visitAdditionalChildren(Visitor& visitor) JSDebugHTTPSServer* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + visitor.append(thisObject->m_address); visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_id); } @@ -4691,6 +4727,9 @@ JSC_DECLARE_CUSTOM_GETTER(jsDebugHTTPServerConstructor); extern "C" void DebugHTTPServerClass__finalize(void*); +extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__addressGetterWrap); + extern "C" JSC::EncodedJSValue DebugHTTPServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(DebugHTTPServerPrototype__developmentGetterWrap); @@ -4733,6 +4772,7 @@ JSC_DECLARE_HOST_FUNCTION(DebugHTTPServerPrototype__upgradeCallback); STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDebugHTTPServerPrototype, JSDebugHTTPServerPrototype::Base); static const HashTableValue JSDebugHTTPServerPrototypeTableValues[] = { + { "address"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__addressGetterWrap, 0 } }, { "development"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__developmentGetterWrap, 0 } }, { "fetch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DebugHTTPServerPrototype__fetchCallback, 1 } }, { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DebugHTTPServerPrototype__hostnameGetterWrap, 0 } }, @@ -4762,6 +4802,37 @@ JSC_DEFINE_CUSTOM_GETTER(jsDebugHTTPServerConstructor, (JSGlobalObject * lexical return JSValue::encode(globalObject->JSDebugHTTPServerConstructor()); } +JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSDebugHTTPServer* thisObject = jsCast<JSDebugHTTPServer*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_address.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + DebugHTTPServerPrototype__getAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_address.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void DebugHTTPServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDebugHTTPServer*>(JSValue::decode(thisValue)); + thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue DebugHTTPServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSDebugHTTPServer*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_address.get()); +} + JSC_DEFINE_CUSTOM_GETTER(DebugHTTPServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); @@ -5154,6 +5225,7 @@ void JSDebugHTTPServer::visitAdditionalChildren(Visitor& visitor) JSDebugHTTPServer* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + visitor.append(thisObject->m_address); visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_id); } @@ -11712,6 +11784,9 @@ JSC_DECLARE_CUSTOM_GETTER(jsHTTPSServerConstructor); extern "C" void HTTPSServerClass__finalize(void*); +extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__addressGetterWrap); + extern "C" JSC::EncodedJSValue HTTPSServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(HTTPSServerPrototype__developmentGetterWrap); @@ -11754,6 +11829,7 @@ JSC_DECLARE_HOST_FUNCTION(HTTPSServerPrototype__upgradeCallback); STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSServerPrototype, JSHTTPSServerPrototype::Base); static const HashTableValue JSHTTPSServerPrototypeTableValues[] = { + { "address"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__addressGetterWrap, 0 } }, { "development"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__developmentGetterWrap, 0 } }, { "fetch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPSServerPrototype__fetchCallback, 1 } }, { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPSServerPrototype__hostnameGetterWrap, 0 } }, @@ -11783,6 +11859,37 @@ JSC_DEFINE_CUSTOM_GETTER(jsHTTPSServerConstructor, (JSGlobalObject * lexicalGlob return JSValue::encode(globalObject->JSHTTPSServerConstructor()); } +JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSHTTPSServer* thisObject = jsCast<JSHTTPSServer*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_address.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + HTTPSServerPrototype__getAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_address.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void HTTPSServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSHTTPSServer*>(JSValue::decode(thisValue)); + thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue HTTPSServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSHTTPSServer*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_address.get()); +} + JSC_DEFINE_CUSTOM_GETTER(HTTPSServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); @@ -12175,6 +12282,7 @@ void JSHTTPSServer::visitAdditionalChildren(Visitor& visitor) JSHTTPSServer* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + visitor.append(thisObject->m_address); visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_id); } @@ -12227,6 +12335,9 @@ JSC_DECLARE_CUSTOM_GETTER(jsHTTPServerConstructor); extern "C" void HTTPServerClass__finalize(void*); +extern "C" JSC::EncodedJSValue HTTPServerPrototype__getAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__addressGetterWrap); + extern "C" JSC::EncodedJSValue HTTPServerPrototype__getDevelopment(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(HTTPServerPrototype__developmentGetterWrap); @@ -12269,6 +12380,7 @@ JSC_DECLARE_HOST_FUNCTION(HTTPServerPrototype__upgradeCallback); STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPServerPrototype, JSHTTPServerPrototype::Base); static const HashTableValue JSHTTPServerPrototypeTableValues[] = { + { "address"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__addressGetterWrap, 0 } }, { "development"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__developmentGetterWrap, 0 } }, { "fetch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, HTTPServerPrototype__fetchCallback, 1 } }, { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, HTTPServerPrototype__hostnameGetterWrap, 0 } }, @@ -12298,6 +12410,37 @@ JSC_DEFINE_CUSTOM_GETTER(jsHTTPServerConstructor, (JSGlobalObject * lexicalGloba return JSValue::encode(globalObject->JSHTTPServerConstructor()); } +JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__addressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSHTTPServer* thisObject = jsCast<JSHTTPServer*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_address.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + HTTPServerPrototype__getAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_address.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void HTTPServerPrototype__addressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSHTTPServer*>(JSValue::decode(thisValue)); + thisObject->m_address.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue HTTPServerPrototype__addressGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSHTTPServer*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_address.get()); +} + JSC_DEFINE_CUSTOM_GETTER(HTTPServerPrototype__developmentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); @@ -12690,6 +12833,7 @@ void JSHTTPServer::visitAdditionalChildren(Visitor& visitor) JSHTTPServer* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + visitor.append(thisObject->m_address); visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_id); } diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index 33aa58487..c1d7ca99e 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -510,6 +510,7 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; + mutable JSC::WriteBarrier<JSC::Unknown> m_address; mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; mutable JSC::WriteBarrier<JSC::Unknown> m_id; }; @@ -567,6 +568,7 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; + mutable JSC::WriteBarrier<JSC::Unknown> m_address; mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; mutable JSC::WriteBarrier<JSC::Unknown> m_id; }; @@ -1472,6 +1474,7 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; + mutable JSC::WriteBarrier<JSC::Unknown> m_address; mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; mutable JSC::WriteBarrier<JSC::Unknown> m_id; }; @@ -1529,6 +1532,7 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; + mutable JSC::WriteBarrier<JSC::Unknown> m_address; mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; mutable JSC::WriteBarrier<JSC::Unknown> m_id; }; diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index c44d554fc..c4f63084b 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1220,6 +1220,28 @@ pub const JSDebugHTTPSServer = struct { return DebugHTTPSServer__fromJS(value); } + extern fn DebugHTTPSServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn DebugHTTPSServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `DebugHTTPSServer.address` setter + /// This value will be visited by the garbage collector. + pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DebugHTTPSServerPrototype__addressSetCachedValue(thisValue, globalObject, value); + } + + /// `DebugHTTPSServer.address` getter + /// This value will be visited by the garbage collector. + pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DebugHTTPSServerPrototype__addressGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + extern fn DebugHTTPSServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; extern fn DebugHTTPSServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; @@ -1300,6 +1322,9 @@ pub const JSDebugHTTPSServer = struct { @compileLog("DebugHTTPSServer.finalize is not a finalizer"); } + if (@TypeOf(DebugHTTPSServer.getAddress) != GetterType) + @compileLog("Expected DebugHTTPSServer.getAddress to be a getter"); + if (@TypeOf(DebugHTTPSServer.getDevelopment) != GetterType) @compileLog("Expected DebugHTTPSServer.getDevelopment to be a getter"); @@ -1341,6 +1366,7 @@ pub const JSDebugHTTPSServer = struct { @export(DebugHTTPSServer.doStop, .{ .name = "DebugHTTPSServerPrototype__doStop" }); @export(DebugHTTPSServer.doUpgrade, .{ .name = "DebugHTTPSServerPrototype__doUpgrade" }); @export(DebugHTTPSServer.finalize, .{ .name = "DebugHTTPSServerClass__finalize" }); + @export(DebugHTTPSServer.getAddress, .{ .name = "DebugHTTPSServerPrototype__getAddress" }); @export(DebugHTTPSServer.getDevelopment, .{ .name = "DebugHTTPSServerPrototype__getDevelopment" }); @export(DebugHTTPSServer.getHostname, .{ .name = "DebugHTTPSServerPrototype__getHostname" }); @export(DebugHTTPSServer.getId, .{ .name = "DebugHTTPSServerPrototype__getId" }); @@ -1366,6 +1392,28 @@ pub const JSDebugHTTPServer = struct { return DebugHTTPServer__fromJS(value); } + extern fn DebugHTTPServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn DebugHTTPServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `DebugHTTPServer.address` setter + /// This value will be visited by the garbage collector. + pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DebugHTTPServerPrototype__addressSetCachedValue(thisValue, globalObject, value); + } + + /// `DebugHTTPServer.address` getter + /// This value will be visited by the garbage collector. + pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DebugHTTPServerPrototype__addressGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + extern fn DebugHTTPServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; extern fn DebugHTTPServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; @@ -1446,6 +1494,9 @@ pub const JSDebugHTTPServer = struct { @compileLog("DebugHTTPServer.finalize is not a finalizer"); } + if (@TypeOf(DebugHTTPServer.getAddress) != GetterType) + @compileLog("Expected DebugHTTPServer.getAddress to be a getter"); + if (@TypeOf(DebugHTTPServer.getDevelopment) != GetterType) @compileLog("Expected DebugHTTPServer.getDevelopment to be a getter"); @@ -1487,6 +1538,7 @@ pub const JSDebugHTTPServer = struct { @export(DebugHTTPServer.doStop, .{ .name = "DebugHTTPServerPrototype__doStop" }); @export(DebugHTTPServer.doUpgrade, .{ .name = "DebugHTTPServerPrototype__doUpgrade" }); @export(DebugHTTPServer.finalize, .{ .name = "DebugHTTPServerClass__finalize" }); + @export(DebugHTTPServer.getAddress, .{ .name = "DebugHTTPServerPrototype__getAddress" }); @export(DebugHTTPServer.getDevelopment, .{ .name = "DebugHTTPServerPrototype__getDevelopment" }); @export(DebugHTTPServer.getHostname, .{ .name = "DebugHTTPServerPrototype__getHostname" }); @export(DebugHTTPServer.getId, .{ .name = "DebugHTTPServerPrototype__getId" }); @@ -3179,6 +3231,28 @@ pub const JSHTTPSServer = struct { return HTTPSServer__fromJS(value); } + extern fn HTTPSServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn HTTPSServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `HTTPSServer.address` setter + /// This value will be visited by the garbage collector. + pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + HTTPSServerPrototype__addressSetCachedValue(thisValue, globalObject, value); + } + + /// `HTTPSServer.address` getter + /// This value will be visited by the garbage collector. + pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = HTTPSServerPrototype__addressGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + extern fn HTTPSServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; extern fn HTTPSServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; @@ -3259,6 +3333,9 @@ pub const JSHTTPSServer = struct { @compileLog("HTTPSServer.finalize is not a finalizer"); } + if (@TypeOf(HTTPSServer.getAddress) != GetterType) + @compileLog("Expected HTTPSServer.getAddress to be a getter"); + if (@TypeOf(HTTPSServer.getDevelopment) != GetterType) @compileLog("Expected HTTPSServer.getDevelopment to be a getter"); @@ -3300,6 +3377,7 @@ pub const JSHTTPSServer = struct { @export(HTTPSServer.doStop, .{ .name = "HTTPSServerPrototype__doStop" }); @export(HTTPSServer.doUpgrade, .{ .name = "HTTPSServerPrototype__doUpgrade" }); @export(HTTPSServer.finalize, .{ .name = "HTTPSServerClass__finalize" }); + @export(HTTPSServer.getAddress, .{ .name = "HTTPSServerPrototype__getAddress" }); @export(HTTPSServer.getDevelopment, .{ .name = "HTTPSServerPrototype__getDevelopment" }); @export(HTTPSServer.getHostname, .{ .name = "HTTPSServerPrototype__getHostname" }); @export(HTTPSServer.getId, .{ .name = "HTTPSServerPrototype__getId" }); @@ -3325,6 +3403,28 @@ pub const JSHTTPServer = struct { return HTTPServer__fromJS(value); } + extern fn HTTPServerPrototype__addressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn HTTPServerPrototype__addressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `HTTPServer.address` setter + /// This value will be visited by the garbage collector. + pub fn addressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + HTTPServerPrototype__addressSetCachedValue(thisValue, globalObject, value); + } + + /// `HTTPServer.address` getter + /// This value will be visited by the garbage collector. + pub fn addressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = HTTPServerPrototype__addressGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + extern fn HTTPServerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; extern fn HTTPServerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; @@ -3405,6 +3505,9 @@ pub const JSHTTPServer = struct { @compileLog("HTTPServer.finalize is not a finalizer"); } + if (@TypeOf(HTTPServer.getAddress) != GetterType) + @compileLog("Expected HTTPServer.getAddress to be a getter"); + if (@TypeOf(HTTPServer.getDevelopment) != GetterType) @compileLog("Expected HTTPServer.getDevelopment to be a getter"); @@ -3446,6 +3549,7 @@ pub const JSHTTPServer = struct { @export(HTTPServer.doStop, .{ .name = "HTTPServerPrototype__doStop" }); @export(HTTPServer.doUpgrade, .{ .name = "HTTPServerPrototype__doUpgrade" }); @export(HTTPServer.finalize, .{ .name = "HTTPServerClass__finalize" }); + @export(HTTPServer.getAddress, .{ .name = "HTTPServerPrototype__getAddress" }); @export(HTTPServer.getDevelopment, .{ .name = "HTTPServerPrototype__getDevelopment" }); @export(HTTPServer.getHostname, .{ .name = "HTTPServerPrototype__getHostname" }); @export(HTTPServer.getId, .{ .name = "HTTPServerPrototype__getId" }); |