diff options
Diffstat (limited to 'src/bun.js/bindings')
-rw-r--r-- | src/bun.js/bindings/JSSink.cpp | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSink.h | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/JSSinkLookupTable.h | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h | 6 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h | 6 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h | 12 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h | 14 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 1000 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 119 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 21 | ||||
-rw-r--r-- | src/bun.js/bindings/exports.zig | 23 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 390 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes_list.zig | 2 |
13 files changed, 1575 insertions, 24 deletions
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp index 2fb03963e..84f69aa31 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-05-14T13:28:43.914Z +// Generated by 'make generate-sink' at 2023-05-18T01:04:00.447Z // 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 9726f68e9..5bbfab777 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-05-14T13:28:43.910Z +// Generated by 'make generate-sink' at 2023-05-18T01:04:00.446Z // #pragma once diff --git a/src/bun.js/bindings/JSSinkLookupTable.h b/src/bun.js/bindings/JSSinkLookupTable.h index e4ed81629..a4ace6dc3 100644 --- a/src/bun.js/bindings/JSSinkLookupTable.h +++ b/src/bun.js/bindings/JSSinkLookupTable.h @@ -1,4 +1,4 @@ -// Automatically generated from src/bun.js/bindings/JSSink.cpp using /home/cirospaciari/Repos/bun/src/bun.js/WebKit/Source/JavaScriptCore/create_hash_table. DO NOT EDIT! +// Automatically generated from src/bun.js/bindings/JSSink.cpp using /Users/jarred/Code/bun/src/bun.js/WebKit/Source/JavaScriptCore/create_hash_table. DO NOT EDIT! diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h index 120a135f8..f59e0e855 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h @@ -1,6 +1,7 @@ std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlob; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildArtifact; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasher; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildMessage; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBuildMessageConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasher; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasherConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirent; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirentConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpect; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectAny; @@ -11,7 +12,8 @@ std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4Constructor;std::un std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFS; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFSConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequest; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessage; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResolveMessageConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponseConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h index d298b8db4..3e80b933b 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h @@ -1,6 +1,7 @@ std::unique_ptr<IsoSubspace> m_subspaceForBlob; std::unique_ptr<IsoSubspace> m_subspaceForBlobConstructor;std::unique_ptr<IsoSubspace> m_subspaceForBuildArtifact; -std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasher; +std::unique_ptr<IsoSubspace> m_subspaceForBuildMessage; +std::unique_ptr<IsoSubspace> m_subspaceForBuildMessageConstructor;std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasher; std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasherConstructor;std::unique_ptr<IsoSubspace> m_subspaceForDirent; std::unique_ptr<IsoSubspace> m_subspaceForDirentConstructor;std::unique_ptr<IsoSubspace> m_subspaceForExpect; std::unique_ptr<IsoSubspace> m_subspaceForExpectConstructor;std::unique_ptr<IsoSubspace> m_subspaceForExpectAny; @@ -11,7 +12,8 @@ std::unique_ptr<IsoSubspace> m_subspaceForMD4Constructor;std::unique_ptr<IsoSubs std::unique_ptr<IsoSubspace> m_subspaceForMD5Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFS; std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFSConstructor;std::unique_ptr<IsoSubspace> m_subspaceForRequest; -std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResponse; +std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResolveMessage; +std::unique_ptr<IsoSubspace> m_subspaceForResolveMessageConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResponse; std::unique_ptr<IsoSubspace> m_subspaceForResponseConstructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA1; std::unique_ptr<IsoSubspace> m_subspaceForSHA1Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA224; std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA256; diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h index 2b01818b9..95a787f5e 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h @@ -10,6 +10,12 @@ JSC::Structure* JSBuildArtifactStructure() { return m_JSBuildArtifact.getInitial JSC::LazyClassStructure m_JSBuildArtifact; bool hasJSBuildArtifactSetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildArtifactSetterValue; +JSC::Structure* JSBuildMessageStructure() { return m_JSBuildMessage.getInitializedOnMainThread(this); } + JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); } + JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSBuildMessage; + bool hasJSBuildMessageSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildMessageSetterValue; JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); } JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } @@ -76,6 +82,12 @@ JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainTh JSC::LazyClassStructure m_JSRequest; bool hasJSRequestSetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue; +JSC::Structure* JSResolveMessageStructure() { return m_JSResolveMessage.getInitializedOnMainThread(this); } + JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); } + JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSResolveMessage; + bool hasJSResolveMessageSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSResolveMessageSetterValue; JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); } JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h index dc2cbb2cd..8756ed660 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h @@ -11,6 +11,12 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSBuildArtifact::createStructure(init.vm, init.global, init.prototype)); }); + m_JSBuildMessage.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSBuildMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSBuildMessage::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSBuildMessage::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSCryptoHasher.initLater( [](LazyClassStructure::Initializer& init) { init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); @@ -77,6 +83,12 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); }); + m_JSResolveMessage.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSResolveMessage::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSResolveMessage::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSResolveMessage::createConstructor(init.vm, init.global, init.prototype)); + }); m_JSResponse.initLater( [](LazyClassStructure::Initializer& init) { init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); @@ -173,6 +185,7 @@ void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& { thisObject->m_JSBlob.visit(visitor); visitor.append(thisObject->m_JSBlobSetterValue); thisObject->m_JSBuildArtifact.visit(visitor); visitor.append(thisObject->m_JSBuildArtifactSetterValue); + thisObject->m_JSBuildMessage.visit(visitor); visitor.append(thisObject->m_JSBuildMessageSetterValue); thisObject->m_JSCryptoHasher.visit(visitor); visitor.append(thisObject->m_JSCryptoHasherSetterValue); thisObject->m_JSDirent.visit(visitor); visitor.append(thisObject->m_JSDirentSetterValue); thisObject->m_JSExpect.visit(visitor); visitor.append(thisObject->m_JSExpectSetterValue); @@ -184,6 +197,7 @@ void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue); thisObject->m_JSNodeJSFS.visit(visitor); visitor.append(thisObject->m_JSNodeJSFSSetterValue); thisObject->m_JSRequest.visit(visitor); visitor.append(thisObject->m_JSRequestSetterValue); + thisObject->m_JSResolveMessage.visit(visitor); visitor.append(thisObject->m_JSResolveMessageSetterValue); thisObject->m_JSResponse.visit(visitor); visitor.append(thisObject->m_JSResponseSetterValue); thisObject->m_JSSHA1.visit(visitor); visitor.append(thisObject->m_JSSHA1SetterValue); thisObject->m_JSSHA224.visit(visitor); visitor.append(thisObject->m_JSSHA224SetterValue); diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index a8ec4c6b5..c8a1b9b2b 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -1017,6 +1017,450 @@ void JSBuildArtifact::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBuildArtifact); +class JSBuildMessagePrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSBuildMessagePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSBuildMessagePrototype* ptr = new (NotNull, JSC::allocateCell<JSBuildMessagePrototype>(vm)) JSBuildMessagePrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSBuildMessagePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +class JSBuildMessageConstructor final : public JSC::InternalFunction { +public: + using Base = JSC::InternalFunction; + static JSBuildMessageConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBuildMessagePrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSBuildMessageConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForBuildMessageConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBuildMessageConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForBuildMessageConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBuildMessageConstructor = std::forward<decltype(space)>(space); }); + } + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + +private: + JSBuildMessageConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype); +}; + +extern "C" void* BuildMessageClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsBuildMessageConstructor); +extern "C" void BuildMessageClass__finalize(void*); + +extern "C" EncodedJSValue BuildMessagePrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toPrimitiveCallback); + +extern "C" JSC::EncodedJSValue BuildMessagePrototype__getLevel(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__levelGetterWrap); + +extern "C" JSC::EncodedJSValue BuildMessagePrototype__getMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__messageGetterWrap); + +extern "C" JSC::EncodedJSValue BuildMessagePrototype__getPosition(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(BuildMessagePrototype__positionGetterWrap); + +extern "C" EncodedJSValue BuildMessagePrototype__toJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toJSONCallback); + +extern "C" EncodedJSValue BuildMessagePrototype__toString(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BuildMessagePrototype__toStringCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBuildMessagePrototype, JSBuildMessagePrototype::Base); + +static const HashTableValue JSBuildMessagePrototypeTableValues[] = { + { "level"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__levelGetterWrap, 0 } }, + { "message"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__messageGetterWrap, 0 } }, + { "position"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BuildMessagePrototype__positionGetterWrap, 0 } }, + { "toJSON"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildMessagePrototype__toJSONCallback, 0 } }, + { "toString"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BuildMessagePrototype__toStringCallback, 0 } } +}; + +const ClassInfo JSBuildMessagePrototype::s_info = { "BuildMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessagePrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsBuildMessageConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSBuildMessagePrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSBuildMessageConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSBuildMessage* thisObject = jsDynamicCast<JSBuildMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return BuildMessagePrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__levelGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSBuildMessage* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_level.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + BuildMessagePrototype__getLevel(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_level.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void BuildMessagePrototype__levelSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + thisObject->m_level.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue BuildMessagePrototype__levelGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_level.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__messageGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSBuildMessage* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_message.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + BuildMessagePrototype__getMessage(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_message.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void BuildMessagePrototype__messageSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + thisObject->m_message.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue BuildMessagePrototype__messageGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_message.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(BuildMessagePrototype__positionGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSBuildMessage* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_position.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + BuildMessagePrototype__getPosition(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_position.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void BuildMessagePrototype__positionSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + thisObject->m_position.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue BuildMessagePrototype__positionGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSBuildMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_position.get()); +} + +JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toJSONCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSBuildMessage* thisObject = jsDynamicCast<JSBuildMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return BuildMessagePrototype__toJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(BuildMessagePrototype__toStringCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSBuildMessage* thisObject = jsDynamicCast<JSBuildMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return BuildMessagePrototype__toString(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSBuildMessagePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSBuildMessage::info(), JSBuildMessagePrototypeTableValues, *this); + this->putDirect(vm, vm.propertyNames->toPrimitiveSymbol, JSFunction::create(vm, globalObject, 1, String("toPrimitive"_s), BuildMessagePrototype__toPrimitiveCallback, ImplementationVisibility::Public), PropertyAttribute::Function | PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); + this->putDirect(vm, vm.propertyNames->name, jsString(vm, String("BuildMessage"_s)), PropertyAttribute::ReadOnly | 0); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +void JSBuildMessageConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype) +{ + Base::finishCreation(vm, 0, "BuildMessage"_s, PropertyAdditionMode::WithoutStructureTransition); + + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +JSBuildMessageConstructor::JSBuildMessageConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} + +JSBuildMessageConstructor* JSBuildMessageConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBuildMessagePrototype* prototype) +{ + JSBuildMessageConstructor* ptr = new (NotNull, JSC::allocateCell<JSBuildMessageConstructor>(vm)) JSBuildMessageConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} + +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBuildMessageConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +{ + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM& vm = globalObject->vm(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSBuildMessageConstructor(); + Structure* structure = globalObject->JSBuildMessageStructure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); + + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget)); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSBuildMessageStructure()); + } + + void* ptr = BuildMessageClass__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSBuildMessage* instance = JSBuildMessage::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +void JSBuildMessageConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBuildMessagePrototype* prototype) +{ +} + +const ClassInfo JSBuildMessageConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessageConstructor) }; + +extern "C" EncodedJSValue BuildMessage__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSBuildMessageConstructor()); +} + +JSBuildMessage::~JSBuildMessage() +{ + if (m_ctx) { + BuildMessageClass__finalize(m_ctx); + } +} +void JSBuildMessage::destroy(JSCell* cell) +{ + static_cast<JSBuildMessage*>(cell)->JSBuildMessage::~JSBuildMessage(); +} + +const ClassInfo JSBuildMessage::s_info = { "BuildMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBuildMessage) }; + +void JSBuildMessage::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSBuildMessage* JSBuildMessage::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSBuildMessage* ptr = new (NotNull, JSC::allocateCell<JSBuildMessage>(vm)) JSBuildMessage(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* BuildMessage__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSBuildMessage* object = JSC::jsDynamicCast<JSBuildMessage*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool BuildMessage__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSBuildMessage* object = JSC::jsDynamicCast<JSBuildMessage*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t BuildMessage__ptrOffset = JSBuildMessage::offsetOfWrapped(); + +void JSBuildMessage::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSBuildMessage*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSBuildMessage::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +{ + return WebCore::JSBuildMessageConstructor::create(vm, globalObject, WebCore::JSBuildMessageConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSBuildMessagePrototype*>(prototype)); +} + +JSObject* JSBuildMessage::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSBuildMessagePrototype::create(vm, globalObject, JSBuildMessagePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue BuildMessage__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSBuildMessageStructure(); + JSBuildMessage* instance = JSBuildMessage::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +template<typename Visitor> +void JSBuildMessage::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSBuildMessage* thisObject = jsCast<JSBuildMessage*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + + visitor.append(thisObject->m_level); + visitor.append(thisObject->m_message); + visitor.append(thisObject->m_position); +} + +DEFINE_VISIT_CHILDREN(JSBuildMessage); + +template<typename Visitor> +void JSBuildMessage::visitAdditionalChildren(Visitor& visitor) +{ + JSBuildMessage* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_level); + visitor.append(thisObject->m_message); + visitor.append(thisObject->m_position); +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSBuildMessage); + +template<typename Visitor> +void JSBuildMessage::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSBuildMessage* thisObject = jsCast<JSBuildMessage*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBuildMessage); class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -7566,6 +8010,562 @@ void JSRequest::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSRequest); +class JSResolveMessagePrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + + static JSResolveMessagePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSResolveMessagePrototype* ptr = new (NotNull, JSC::allocateCell<JSResolveMessagePrototype>(vm)) JSResolveMessagePrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSResolveMessagePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; + +class JSResolveMessageConstructor final : public JSC::InternalFunction { +public: + using Base = JSC::InternalFunction; + static JSResolveMessageConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResolveMessagePrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSResolveMessageConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForResolveMessageConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResolveMessageConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForResolveMessageConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForResolveMessageConstructor = std::forward<decltype(space)>(space); }); + } + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + +private: + JSResolveMessageConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype); +}; + +extern "C" void* ResolveMessageClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsResolveMessageConstructor); +extern "C" void ResolveMessageClass__finalize(void*); + +extern "C" EncodedJSValue ResolveMessagePrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toPrimitiveCallback); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getImportKind(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__importKindGetterWrap); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getLevel(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__levelGetterWrap); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getMessage(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__messageGetterWrap); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getPosition(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__positionGetterWrap); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getReferrer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__referrerGetterWrap); + +extern "C" JSC::EncodedJSValue ResolveMessagePrototype__getSpecifier(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ResolveMessagePrototype__specifierGetterWrap); + +extern "C" EncodedJSValue ResolveMessagePrototype__toJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toJSONCallback); + +extern "C" EncodedJSValue ResolveMessagePrototype__toString(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ResolveMessagePrototype__toStringCallback); + +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResolveMessagePrototype, JSResolveMessagePrototype::Base); + +static const HashTableValue JSResolveMessagePrototypeTableValues[] = { + { "importKind"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__importKindGetterWrap, 0 } }, + { "level"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__levelGetterWrap, 0 } }, + { "message"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__messageGetterWrap, 0 } }, + { "position"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__positionGetterWrap, 0 } }, + { "referrer"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__referrerGetterWrap, 0 } }, + { "specifier"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResolveMessagePrototype__specifierGetterWrap, 0 } }, + { "toJSON"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResolveMessagePrototype__toJSONCallback, 0 } }, + { "toString"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResolveMessagePrototype__toStringCallback, 0 } } +}; + +const ClassInfo JSResolveMessagePrototype::s_info = { "ResolveMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessagePrototype) }; + +JSC_DEFINE_CUSTOM_GETTER(jsResolveMessageConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSResolveMessagePrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSResolveMessageConstructor()); +} + +JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSResolveMessage* thisObject = jsDynamicCast<JSResolveMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ResolveMessagePrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__importKindGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_importKind.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getImportKind(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_importKind.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__importKindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_importKind.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__importKindGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_importKind.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__levelGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_level.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getLevel(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_level.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__levelSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_level.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__levelGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_level.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__messageGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_message.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getMessage(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_message.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__messageSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_message.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__messageGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_message.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__positionGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_position.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getPosition(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_position.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__positionSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_position.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__positionGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_position.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__referrerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_referrer.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getReferrer(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_referrer.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__referrerSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_referrer.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__referrerGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_referrer.get()); +} + +JSC_DEFINE_CUSTOM_GETTER(ResolveMessagePrototype__specifierGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_specifier.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ResolveMessagePrototype__getSpecifier(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_specifier.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} + +extern "C" void ResolveMessagePrototype__specifierSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +{ + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + thisObject->m_specifier.set(vm, thisObject, JSValue::decode(value)); +} + +extern "C" EncodedJSValue ResolveMessagePrototype__specifierGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSResolveMessage*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_specifier.get()); +} + +JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toJSONCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSResolveMessage* thisObject = jsDynamicCast<JSResolveMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ResolveMessagePrototype__toJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(ResolveMessagePrototype__toStringCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSResolveMessage* thisObject = jsDynamicCast<JSResolveMessage*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ResolveMessagePrototype__toString(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +void JSResolveMessagePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSResolveMessage::info(), JSResolveMessagePrototypeTableValues, *this); + this->putDirect(vm, vm.propertyNames->toPrimitiveSymbol, JSFunction::create(vm, globalObject, 1, String("toPrimitive"_s), ResolveMessagePrototype__toPrimitiveCallback, ImplementationVisibility::Public), PropertyAttribute::Function | PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | 0); + this->putDirect(vm, Identifier::fromString(vm, "code"_s), jsString(vm, String("ERR_MODULE_NOT_FOUND"_s)), PropertyAttribute::ReadOnly | 0); + this->putDirect(vm, vm.propertyNames->name, jsString(vm, String("ResolveMessage"_s)), PropertyAttribute::ReadOnly | 0); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +void JSResolveMessageConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype) +{ + Base::finishCreation(vm, 0, "ResolveMessage"_s, PropertyAdditionMode::WithoutStructureTransition); + + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +JSResolveMessageConstructor::JSResolveMessageConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} + +JSResolveMessageConstructor* JSResolveMessageConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResolveMessagePrototype* prototype) +{ + JSResolveMessageConstructor* ptr = new (NotNull, JSC::allocateCell<JSResolveMessageConstructor>(vm)) JSResolveMessageConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} + +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResolveMessageConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +{ + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM& vm = globalObject->vm(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSResolveMessageConstructor(); + Structure* structure = globalObject->JSResolveMessageStructure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); + + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget)); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSResolveMessageStructure()); + } + + void* ptr = ResolveMessageClass__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSResolveMessage* instance = JSResolveMessage::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +void JSResolveMessageConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSResolveMessagePrototype* prototype) +{ +} + +const ClassInfo JSResolveMessageConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessageConstructor) }; + +extern "C" EncodedJSValue ResolveMessage__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSResolveMessageConstructor()); +} + +JSResolveMessage::~JSResolveMessage() +{ + if (m_ctx) { + ResolveMessageClass__finalize(m_ctx); + } +} +void JSResolveMessage::destroy(JSCell* cell) +{ + static_cast<JSResolveMessage*>(cell)->JSResolveMessage::~JSResolveMessage(); +} + +const ClassInfo JSResolveMessage::s_info = { "ResolveMessage"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResolveMessage) }; + +void JSResolveMessage::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} + +JSResolveMessage* JSResolveMessage::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +{ + JSResolveMessage* ptr = new (NotNull, JSC::allocateCell<JSResolveMessage>(vm)) JSResolveMessage(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} + +extern "C" void* ResolveMessage__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; + + JSC::JSCell* cell = decodedValue.asCell(); + JSResolveMessage* object = JSC::jsDynamicCast<JSResolveMessage*>(cell); + + if (!object) + return nullptr; + + return object->wrapped(); +} + +extern "C" bool ResolveMessage__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +{ + JSResolveMessage* object = JSC::jsDynamicCast<JSResolveMessage*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; +} + +extern "C" const size_t ResolveMessage__ptrOffset = JSResolveMessage::offsetOfWrapped(); + +void JSResolveMessage::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSResolveMessage*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} + +JSObject* JSResolveMessage::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +{ + return WebCore::JSResolveMessageConstructor::create(vm, globalObject, WebCore::JSResolveMessageConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSResolveMessagePrototype*>(prototype)); +} + +JSObject* JSResolveMessage::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSResolveMessagePrototype::create(vm, globalObject, JSResolveMessagePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} + +extern "C" EncodedJSValue ResolveMessage__create(Zig::GlobalObject* globalObject, void* ptr) +{ + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSResolveMessageStructure(); + JSResolveMessage* instance = JSResolveMessage::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + +template<typename Visitor> +void JSResolveMessage::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + + visitor.append(thisObject->m_importKind); + visitor.append(thisObject->m_level); + visitor.append(thisObject->m_message); + visitor.append(thisObject->m_position); + visitor.append(thisObject->m_referrer); + visitor.append(thisObject->m_specifier); +} + +DEFINE_VISIT_CHILDREN(JSResolveMessage); + +template<typename Visitor> +void JSResolveMessage::visitAdditionalChildren(Visitor& visitor) +{ + JSResolveMessage* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_importKind); + visitor.append(thisObject->m_level); + visitor.append(thisObject->m_message); + visitor.append(thisObject->m_position); + visitor.append(thisObject->m_referrer); + visitor.append(thisObject->m_specifier); +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSResolveMessage); + +template<typename Visitor> +void JSResolveMessage::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSResolveMessage* thisObject = jsCast<JSResolveMessage*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSResolveMessage); class JSResponsePrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index 02fef6d3c..cf5446a1a 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -132,6 +132,64 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_type; }; +class JSBuildMessage final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSBuildMessage* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSBuildMessage, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForBuildMessage.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBuildMessage = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForBuildMessage.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBuildMessage = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSBuildMessage(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBuildMessage, m_ctx); } + + void* m_ctx { nullptr }; + + JSBuildMessage(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_level; + mutable JSC::WriteBarrier<JSC::Unknown> m_message; + mutable JSC::WriteBarrier<JSC::Unknown> m_position; +}; + class JSCryptoHasher final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; @@ -744,6 +802,67 @@ public: mutable JSC::WriteBarrier<JSC::Unknown> m_url; }; +class JSResolveMessage final : public JSC::JSDestructibleObject { +public: + using Base = JSC::JSDestructibleObject; + static JSResolveMessage* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSResolveMessage, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForResolveMessage.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResolveMessage = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForResolveMessage.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForResolveMessage = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSResolveMessage(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResolveMessage, m_ctx); } + + void* m_ctx { nullptr }; + + JSResolveMessage(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + } + + void finishCreation(JSC::VM&); + + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + mutable JSC::WriteBarrier<JSC::Unknown> m_importKind; + mutable JSC::WriteBarrier<JSC::Unknown> m_level; + mutable JSC::WriteBarrier<JSC::Unknown> m_message; + mutable JSC::WriteBarrier<JSC::Unknown> m_position; + mutable JSC::WriteBarrier<JSC::Unknown> m_referrer; + mutable JSC::WriteBarrier<JSC::Unknown> m_specifier; +}; + class JSResponse final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index d35132c8b..eeccb6650 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -3021,6 +3021,15 @@ JSC_DEFINE_CUSTOM_GETTER(bunDns_getter, (JSGlobalObject * globalObject, EncodedJ return JSValue::encode(reinterpret_cast<Zig::GlobalObject*>(globalObject)->dnsObject()); } +JSC_DEFINE_CUSTOM_GETTER(functionResolveMessageGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName)) +{ + return JSValue::encode(reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSResolveMessageConstructor()); +} +JSC_DEFINE_CUSTOM_GETTER(functionBuildMessageGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName)) +{ + return JSValue::encode(reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSBuildMessageConstructor()); +} + EncodedJSValue GlobalObject::assignToStream(JSValue stream, JSValue controller) { JSC::VM& vm = this->vm(); @@ -3264,6 +3273,18 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm) putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "navigator"_s), JSC::CustomGetterSetter::create(vm, functionLazyNavigatorGetter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ResolveError"_s), JSC::CustomGetterSetter::create(vm, functionResolveMessageGetter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ResolveMessage"_s), JSC::CustomGetterSetter::create(vm, functionResolveMessageGetter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "BuildError"_s), JSC::CustomGetterSetter::create(vm, functionBuildMessageGetter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "BuildMessage"_s), JSC::CustomGetterSetter::create(vm, functionBuildMessageGetter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); + putDirect(vm, builtinNames.requireMapPrivateName(), this->requireMap(), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0); diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index 1fb5a1029..acbf7944a 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -2159,24 +2159,13 @@ pub const ZigConsoleClient = struct { } return; + } else if (value.as(JSC.BuildMessage)) |build_log| { + build_log.msg.writeFormat(writer_, enable_ansi_colors) catch {}; + return; + } else if (value.as(JSC.ResolveMessage)) |resolve_log| { + resolve_log.msg.writeFormat(writer_, enable_ansi_colors) catch {}; + return; } else if (jsType != .DOMWrapper) { - if (CAPI.JSObjectGetPrivate(value.asRef())) |private_data_ptr| { - const priv_data = JSPrivateDataPtr.from(private_data_ptr); - switch (priv_data.tag()) { - .BuildMessage => { - const build_log = priv_data.as(JS.BuildMessage); - build_log.msg.writeFormat(writer_, enable_ansi_colors) catch {}; - return; - }, - .ResolveMessage => { - const resolve_log = priv_data.as(JS.ResolveMessage); - resolve_log.msg.writeFormat(writer_, enable_ansi_colors) catch {}; - return; - }, - else => {}, - } - } - if (value.isCallable(this.globalThis.vm())) { return this.printAs(.Function, Writer, writer_, value, jsType, enable_ansi_colors); } diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index 841e65b21..43acdc98b 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -380,6 +380,161 @@ pub const JSBuildArtifact = struct { } } }; +pub const JSBuildMessage = struct { + const BuildMessage = Classes.BuildMessage; + const GetterType = fn (*BuildMessage, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*BuildMessage, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*BuildMessage, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*BuildMessage, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*BuildMessage, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*BuildMessage { + JSC.markBinding(@src()); + return BuildMessage__fromJS(value); + } + + extern fn BuildMessagePrototype__levelSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn BuildMessagePrototype__levelGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `BuildMessage.level` setter + /// This value will be visited by the garbage collector. + pub fn levelSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + BuildMessagePrototype__levelSetCachedValue(thisValue, globalObject, value); + } + + /// `BuildMessage.level` getter + /// This value will be visited by the garbage collector. + pub fn levelGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = BuildMessagePrototype__levelGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn BuildMessagePrototype__messageSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn BuildMessagePrototype__messageGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `BuildMessage.message` setter + /// This value will be visited by the garbage collector. + pub fn messageSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + BuildMessagePrototype__messageSetCachedValue(thisValue, globalObject, value); + } + + /// `BuildMessage.message` getter + /// This value will be visited by the garbage collector. + pub fn messageGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = BuildMessagePrototype__messageGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn BuildMessagePrototype__positionSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn BuildMessagePrototype__positionGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `BuildMessage.position` setter + /// This value will be visited by the garbage collector. + pub fn positionSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + BuildMessagePrototype__positionSetCachedValue(thisValue, globalObject, value); + } + + /// `BuildMessage.position` getter + /// This value will be visited by the garbage collector. + pub fn positionGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = BuildMessagePrototype__positionGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Get the BuildMessage constructor value. + /// This loads lazily from the global object. + pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + return BuildMessage__getConstructor(globalObject); + } + + /// Create a new instance of BuildMessage + pub fn toJS(this: *BuildMessage, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = BuildMessage__create(globalObject, this); + std.debug.assert(value__.as(BuildMessage).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return BuildMessage__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of BuildMessage. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*BuildMessage) bool { + JSC.markBinding(@src()); + return BuildMessage__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *BuildMessage, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(BuildMessage__dangerouslySetPtr(value, null)); + } + + extern fn BuildMessage__fromJS(JSC.JSValue) ?*BuildMessage; + extern fn BuildMessage__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn BuildMessage__create(globalObject: *JSC.JSGlobalObject, ptr: ?*BuildMessage) JSC.JSValue; + + extern fn BuildMessage__dangerouslySetPtr(JSC.JSValue, ?*BuildMessage) bool; + + comptime { + if (@TypeOf(BuildMessage.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*BuildMessage)) { + @compileLog("BuildMessage.constructor is not a constructor"); + } + + if (@TypeOf(BuildMessage.finalize) != (fn (*BuildMessage) callconv(.C) void)) { + @compileLog("BuildMessage.finalize is not a finalizer"); + } + + if (@TypeOf(BuildMessage.toPrimitive) != CallbackType) + @compileLog("Expected BuildMessage.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toPrimitive))); + if (@TypeOf(BuildMessage.getLevel) != GetterType) + @compileLog("Expected BuildMessage.getLevel to be a getter"); + + if (@TypeOf(BuildMessage.getMessage) != GetterType) + @compileLog("Expected BuildMessage.getMessage to be a getter"); + + if (@TypeOf(BuildMessage.getPosition) != GetterType) + @compileLog("Expected BuildMessage.getPosition to be a getter"); + + if (@TypeOf(BuildMessage.toJSON) != CallbackType) + @compileLog("Expected BuildMessage.toJSON to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toJSON))); + if (@TypeOf(BuildMessage.toString) != CallbackType) + @compileLog("Expected BuildMessage.toString to be a callback but received " ++ @typeName(@TypeOf(BuildMessage.toString))); + if (!JSC.is_bindgen) { + @export(BuildMessage.constructor, .{ .name = "BuildMessageClass__construct" }); + @export(BuildMessage.finalize, .{ .name = "BuildMessageClass__finalize" }); + @export(BuildMessage.getLevel, .{ .name = "BuildMessagePrototype__getLevel" }); + @export(BuildMessage.getMessage, .{ .name = "BuildMessagePrototype__getMessage" }); + @export(BuildMessage.getPosition, .{ .name = "BuildMessagePrototype__getPosition" }); + @export(BuildMessage.toJSON, .{ .name = "BuildMessagePrototype__toJSON" }); + @export(BuildMessage.toPrimitive, .{ .name = "BuildMessagePrototype__toPrimitive" }); + @export(BuildMessage.toString, .{ .name = "BuildMessagePrototype__toString" }); + } + } +}; pub const JSCryptoHasher = struct { const CryptoHasher = Classes.CryptoHasher; const GetterType = fn (*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -2204,6 +2359,239 @@ pub const JSRequest = struct { } } }; +pub const JSResolveMessage = struct { + const ResolveMessage = Classes.ResolveMessage; + const GetterType = fn (*ResolveMessage, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*ResolveMessage, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*ResolveMessage, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*ResolveMessage, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*ResolveMessage, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*ResolveMessage { + JSC.markBinding(@src()); + return ResolveMessage__fromJS(value); + } + + extern fn ResolveMessagePrototype__importKindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__importKindGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.importKind` setter + /// This value will be visited by the garbage collector. + pub fn importKindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__importKindSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.importKind` getter + /// This value will be visited by the garbage collector. + pub fn importKindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__importKindGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn ResolveMessagePrototype__levelSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__levelGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.level` setter + /// This value will be visited by the garbage collector. + pub fn levelSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__levelSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.level` getter + /// This value will be visited by the garbage collector. + pub fn levelGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__levelGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn ResolveMessagePrototype__messageSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__messageGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.message` setter + /// This value will be visited by the garbage collector. + pub fn messageSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__messageSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.message` getter + /// This value will be visited by the garbage collector. + pub fn messageGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__messageGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn ResolveMessagePrototype__positionSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__positionGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.position` setter + /// This value will be visited by the garbage collector. + pub fn positionSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__positionSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.position` getter + /// This value will be visited by the garbage collector. + pub fn positionGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__positionGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn ResolveMessagePrototype__referrerSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__referrerGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.referrer` setter + /// This value will be visited by the garbage collector. + pub fn referrerSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__referrerSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.referrer` getter + /// This value will be visited by the garbage collector. + pub fn referrerGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__referrerGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + extern fn ResolveMessagePrototype__specifierSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn ResolveMessagePrototype__specifierGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ResolveMessage.specifier` setter + /// This value will be visited by the garbage collector. + pub fn specifierSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResolveMessagePrototype__specifierSetCachedValue(thisValue, globalObject, value); + } + + /// `ResolveMessage.specifier` getter + /// This value will be visited by the garbage collector. + pub fn specifierGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResolveMessagePrototype__specifierGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Get the ResolveMessage constructor value. + /// This loads lazily from the global object. + pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + return ResolveMessage__getConstructor(globalObject); + } + + /// Create a new instance of ResolveMessage + pub fn toJS(this: *ResolveMessage, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = ResolveMessage__create(globalObject, this); + std.debug.assert(value__.as(ResolveMessage).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return ResolveMessage__create(globalObject, this); + } + } + + /// Modify the internal ptr to point to a new instance of ResolveMessage. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ResolveMessage) bool { + JSC.markBinding(@src()); + return ResolveMessage__dangerouslySetPtr(value, ptr); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *ResolveMessage, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(ResolveMessage__dangerouslySetPtr(value, null)); + } + + extern fn ResolveMessage__fromJS(JSC.JSValue) ?*ResolveMessage; + extern fn ResolveMessage__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn ResolveMessage__create(globalObject: *JSC.JSGlobalObject, ptr: ?*ResolveMessage) JSC.JSValue; + + extern fn ResolveMessage__dangerouslySetPtr(JSC.JSValue, ?*ResolveMessage) bool; + + comptime { + if (@TypeOf(ResolveMessage.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*ResolveMessage)) { + @compileLog("ResolveMessage.constructor is not a constructor"); + } + + if (@TypeOf(ResolveMessage.finalize) != (fn (*ResolveMessage) callconv(.C) void)) { + @compileLog("ResolveMessage.finalize is not a finalizer"); + } + + if (@TypeOf(ResolveMessage.toPrimitive) != CallbackType) + @compileLog("Expected ResolveMessage.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toPrimitive))); + if (@TypeOf(ResolveMessage.getImportKind) != GetterType) + @compileLog("Expected ResolveMessage.getImportKind to be a getter"); + + if (@TypeOf(ResolveMessage.getLevel) != GetterType) + @compileLog("Expected ResolveMessage.getLevel to be a getter"); + + if (@TypeOf(ResolveMessage.getMessage) != GetterType) + @compileLog("Expected ResolveMessage.getMessage to be a getter"); + + if (@TypeOf(ResolveMessage.getPosition) != GetterType) + @compileLog("Expected ResolveMessage.getPosition to be a getter"); + + if (@TypeOf(ResolveMessage.getReferrer) != GetterType) + @compileLog("Expected ResolveMessage.getReferrer to be a getter"); + + if (@TypeOf(ResolveMessage.getSpecifier) != GetterType) + @compileLog("Expected ResolveMessage.getSpecifier to be a getter"); + + if (@TypeOf(ResolveMessage.toJSON) != CallbackType) + @compileLog("Expected ResolveMessage.toJSON to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toJSON))); + if (@TypeOf(ResolveMessage.toString) != CallbackType) + @compileLog("Expected ResolveMessage.toString to be a callback but received " ++ @typeName(@TypeOf(ResolveMessage.toString))); + if (!JSC.is_bindgen) { + @export(ResolveMessage.constructor, .{ .name = "ResolveMessageClass__construct" }); + @export(ResolveMessage.finalize, .{ .name = "ResolveMessageClass__finalize" }); + @export(ResolveMessage.getImportKind, .{ .name = "ResolveMessagePrototype__getImportKind" }); + @export(ResolveMessage.getLevel, .{ .name = "ResolveMessagePrototype__getLevel" }); + @export(ResolveMessage.getMessage, .{ .name = "ResolveMessagePrototype__getMessage" }); + @export(ResolveMessage.getPosition, .{ .name = "ResolveMessagePrototype__getPosition" }); + @export(ResolveMessage.getReferrer, .{ .name = "ResolveMessagePrototype__getReferrer" }); + @export(ResolveMessage.getSpecifier, .{ .name = "ResolveMessagePrototype__getSpecifier" }); + @export(ResolveMessage.toJSON, .{ .name = "ResolveMessagePrototype__toJSON" }); + @export(ResolveMessage.toPrimitive, .{ .name = "ResolveMessagePrototype__toPrimitive" }); + @export(ResolveMessage.toString, .{ .name = "ResolveMessagePrototype__toString" }); + } + } +}; pub const JSResponse = struct { const Response = Classes.Response; const GetterType = fn (*Response, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -4172,6 +4560,7 @@ pub const JSTranspiler = struct { comptime { _ = JSBlob; _ = JSBuildArtifact; + _ = JSBuildMessage; _ = JSCryptoHasher; _ = JSDirent; _ = JSExpect; @@ -4183,6 +4572,7 @@ comptime { _ = JSMatchedRoute; _ = JSNodeJSFS; _ = JSRequest; + _ = JSResolveMessage; _ = JSResponse; _ = JSSHA1; _ = JSSHA224; diff --git a/src/bun.js/bindings/generated_classes_list.zig b/src/bun.js/bindings/generated_classes_list.zig index 4e180154b..4acde31e8 100644 --- a/src/bun.js/bindings/generated_classes_list.zig +++ b/src/bun.js/bindings/generated_classes_list.zig @@ -32,4 +32,6 @@ pub const Classes = struct { pub const TextDecoder = JSC.WebCore.TextDecoder; pub const Timeout = JSC.API.Bun.Timer.TimerObject; pub const BuildArtifact = JSC.API.BuildArtifact; + pub const BuildMessage = JSC.BuildMessage; + pub const ResolveMessage = JSC.ResolveMessage; }; |