Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 0 additions & 131 deletions src/js/builtins/Ipc.ts
Original file line number Diff line number Diff line change
@@ -1,134 +1,3 @@
// for net.Server, get ._handle

// const handleConversion = {
// "net.Server": {
// simultaneousAccepts: true,

// send(message, server, options) {
// return server._handle;
// },

// got(message, handle, emit) {
// const server = new net.Server();
// server.listen(handle, () => {
// emit(server);
// });
// },
// },

// "net.Socket": {
// send(message, socket, options) {
// if (!socket._handle) return;

// // If the socket was created by net.Server
// if (socket.server) {
// // The worker should keep track of the socket
// message.key = socket.server._connectionKey;

// const firstTime = !this[kChannelHandle].sockets.send[message.key];
// const socketList = getSocketList("send", this, message.key);

// // The server should no longer expose a .connection property
// // and when asked to close it should query the socket status from
// // the workers
// if (firstTime) socket.server._setupWorker(socketList);

// // Act like socket is detached
// if (!options.keepOpen) socket.server._connections--;
// }

// const handle = socket._handle;

// // Remove handle from socket object, it will be closed when the socket
// // will be sent
// if (!options.keepOpen) {
// handle.onread = nop;
// socket._handle = null;
// socket.setTimeout(0);

// if (freeParser === undefined) freeParser = require("_http_common").freeParser;
// if (HTTPParser === undefined) HTTPParser = require("_http_common").HTTPParser;

// // In case of an HTTP connection socket, release the associated
// // resources
// if (socket.parser && socket.parser instanceof HTTPParser) {
// freeParser(socket.parser, null, socket);
// if (socket._httpMessage) socket._httpMessage.detachSocket(socket);
// }
// }

// return handle;
// },

// postSend(message, handle, options, callback, target) {
// // Store the handle after successfully sending it, so it can be closed
// // when the NODE_HANDLE_ACK is received. If the handle could not be sent,
// // just close it.
// if (handle && !options.keepOpen) {
// if (target) {
// // There can only be one _pendingMessage as passing handles are
// // processed one at a time: handles are stored in _handleQueue while
// // waiting for the NODE_HANDLE_ACK of the current passing handle.
// assert(!target._pendingMessage);
// target._pendingMessage = { callback, message, handle, options, retransmissions: 0 };
// } else {
// handle.close();
// }
// }
// // NOTE that another function will call _pendingMessage.handle.close() and set _pendingMessage to null
// },

// got(message, handle, emit) {
// const socket = new net.Socket({
// handle: handle,
// readable: true,
// writable: true,
// });

// // If the socket was created by net.Server we will track the socket
// if (message.key) {
// // Add socket to connections list
// const socketList = getSocketList("got", this, message.key);
// socketList.add({
// socket: socket,
// });
// }

// emit(socket);
// },
// },

// "dgram.Native": {
// simultaneousAccepts: false,

// send(message, handle, options) {
// return handle;
// },

// got(message, handle, emit) {
// emit(handle);
// },
// },

// "dgram.Socket": {
// simultaneousAccepts: false,

// send(message, socket, options) {
// message.dgramType = socket.type;

// return socket[kStateSymbol].handle;
// },

// got(message, handle, emit) {
// const socket = new dgram.Socket(message.dgramType);

// socket.bind(handle, () => {
// emit(socket);
// });
// },
// },
// };

// have to use jsdoc type definitions because bundle-functions is based on regex
/**
* @typedef {Object} Serialized
Expand Down
13 changes: 0 additions & 13 deletions src/js/internal/fs/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,6 @@ function streamConstruct(this: FSStream, callback: (e?: any) => void) {
this.open();
} else {
if (fastPath) {
// // there is a chance that this fd is not actually correct but it will be a number
// if (fastPath !== true) {
// // @ts-expect-error undocumented. to make this public please make it a
// // getter. couldn't figure that out sorry
// this.fd = fastPath._getFd();
// } else {
// if (fs.open !== open || fs.write !== write || fs.fsync !== fsync || fs.close !== close) {
// this[kWriteStreamFastPath] = undefined;
// break fast;
// }
// // @ts-expect-error
// this.fd = (this[kWriteStreamFastPath] = Bun.file(this.path).writer())._getFd();
// }
callback();
this.emit("open", this.fd);
this.emit("ready");
Expand Down
2 changes: 0 additions & 2 deletions src/js/node/worker_threads.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import type { Readable, Writable } from "node:stream";
// import type { WorkerOptions } from "node:worker_threads";
declare const self: typeof globalThis;
type WebWorker = InstanceType<typeof globalThis.Worker>;

Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/DOMWrapperWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

#include "DOMWrapperWorld.h"

// #include "JSDOMWindow.h"
#include "WebCoreJSClientData.h"
// #include "WindowProxy.h"
#include "ZigGlobalObject.h"
#include <wtf/MainThread.h>

Expand Down
28 changes: 0 additions & 28 deletions src/jsc/bindings/InspectorBunFrontendDevServerAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ WTF_MAKE_TZONE_ALLOCATED_IMPL(InspectorBunFrontendDevServerAgent);

InspectorBunFrontendDevServerAgent::InspectorBunFrontendDevServerAgent(JSC::JSGlobalObject& globalObject)
: InspectorAgentBase("BunFrontendDevServer"_s)
// , m_globalobject(globalObject)
, m_backendDispatcher(BunFrontendDevServerBackendDispatcher::create(globalObject.inspectorController().backendDispatcher(), this))
, m_frontendDispatcher(makeUnique<BunFrontendDevServerFrontendDispatcher>(const_cast<FrontendRouter&>(globalObject.inspectorController().frontendRouter())))
, m_enabled(false)
{
UNUSED_PARAM(globalObject);
}

InspectorBunFrontendDevServerAgent::~InspectorBunFrontendDevServerAgent() = default;
Expand Down Expand Up @@ -109,22 +107,6 @@ void InspectorBunFrontendDevServerAgent::clientNavigated(int devServerId, int co
m_frontendDispatcher->clientNavigated(devServerId, connectionId, url, WTF::move(routeBundleId));
}

void InspectorBunFrontendDevServerAgent::clientErrorReported(int devServerId, const String& clientErrorPayloadBase64)
{
if (!m_enabled || !m_frontendDispatcher)
return;

m_frontendDispatcher->clientErrorReported(devServerId, clientErrorPayloadBase64);
}

void InspectorBunFrontendDevServerAgent::graphUpdate(int devServerId, const String& visualizerPayloadBase64)
{
if (!m_enabled || !m_frontendDispatcher)
return;

// m_frontendDispatcher->graphUpdate(devServerId, visualizerPayloadBase64);
}

void InspectorBunFrontendDevServerAgent::consoleLog(int devServerId, char kind, const String& data)
{
if (!m_enabled || !m_frontendDispatcher)
Expand Down Expand Up @@ -177,16 +159,6 @@ void InspectorBunFrontendDevServerAgent__notifyClientNavigated(InspectorBunFront
agent->clientNavigated(devServerId, connectionId, url->toWTFString(), optionalRouteBundleId);
}

void InspectorBunFrontendDevServerAgent__notifyClientErrorReported(InspectorBunFrontendDevServerAgent* agent, int devServerId, BunString* clientErrorPayloadBase64)
{
agent->clientErrorReported(devServerId, clientErrorPayloadBase64->toWTFString());
}

void InspectorBunFrontendDevServerAgent__notifyGraphUpdate(InspectorBunFrontendDevServerAgent* agent, int devServerId, BunString* visualizerPayloadBase64)
{
agent->graphUpdate(devServerId, visualizerPayloadBase64->toWTFString());
}

void InspectorBunFrontendDevServerAgent__notifyConsoleLog(InspectorBunFrontendDevServerAgent* agent, int devServerId, char kind, BunString* data)
{
agent->consoleLog(devServerId, kind, data->toWTFString());
Expand Down
16 changes: 0 additions & 16 deletions src/jsc/bindings/InspectorBunFrontendDevServerAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,12 @@ class InspectorBunFrontendDevServerAgent final : public InspectorAgentBase, publ
void bundleComplete(int devServerId, double durationMs);
void bundleFailed(int devServerId, const String& buildErrorsPayloadBase64);
void clientNavigated(int devServerId, int connectionId, const String& url, std::optional<int> routeBundleId);
void clientErrorReported(int devServerId, const String& clientErrorPayloadBase64);
void graphUpdate(int devServerId, const String& visualizerPayloadBase64);
void consoleLog(int devServerId, char kind, const String& data);

private:
// JSC::JSGlobalObject& m_globalobject;
std::unique_ptr<BunFrontendDevServerFrontendDispatcher> m_frontendDispatcher;
Comment thread
robobun marked this conversation as resolved.
Ref<BunFrontendDevServerBackendDispatcher> m_backendDispatcher;
bool m_enabled { false };
};

// C API for the Rust side to call
extern "C" {
void BunFrontendDevServerAgent__notifyClientConnected(InspectorBunFrontendDevServerAgent* agent, int connectionId);
void BunFrontendDevServerAgent__notifyClientDisconnected(InspectorBunFrontendDevServerAgent* agent, int connectionId);
void BunFrontendDevServerAgent__notifyBundleStart(InspectorBunFrontendDevServerAgent* agent, const BunString* triggerFiles, size_t triggerFilesLen, int buildId);
void BunFrontendDevServerAgent__notifyBundleComplete(InspectorBunFrontendDevServerAgent* agent, double durationMs, int buildId);
void BunFrontendDevServerAgent__notifyBundleFailed(InspectorBunFrontendDevServerAgent* agent, const BunString* buildErrorsPayloadBase64, int buildId);
void BunFrontendDevServerAgent__notifyClientNavigated(InspectorBunFrontendDevServerAgent* agent, int connectionId, const BunString* url, int routeBundleId);
void BunFrontendDevServerAgent__notifyClientErrorReported(InspectorBunFrontendDevServerAgent* agent, const BunString* clientErrorPayloadBase64);
void BunFrontendDevServerAgent__notifyGraphUpdate(InspectorBunFrontendDevServerAgent* agent, const BunString* visualizerPayloadBase64);
void BunFrontendDevServerAgent__notifyConsoleLog(InspectorBunFrontendDevServerAgent* agent, int devServerId, char kind, const BunString* data);
}

} // namespace Inspector
13 changes: 0 additions & 13 deletions src/jsc/bindings/InspectorLifecycleAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ extern "C" {
void Bun__LifecycleAgentEnable(Inspector::InspectorLifecycleAgent* agent);
void Bun__LifecycleAgentDisable(Inspector::InspectorLifecycleAgent* agent);

void Bun__LifecycleAgentReportReload(Inspector::InspectorLifecycleAgent* agent)
{
agent->reportReload();
}

void Bun__LifecycleAgentReportError(Inspector::InspectorLifecycleAgent* agent, ZigException* exception)
{
ASSERT(exception);
Expand Down Expand Up @@ -89,14 +84,6 @@ Protocol::ErrorStringOr<void> InspectorLifecycleAgent::disable()
return {};
}

void InspectorLifecycleAgent::reportReload()
{
if (!m_enabled)
return;

m_frontendDispatcher->reload();
}

void InspectorLifecycleAgent::reportError(ZigException& exception)
{
if (!m_enabled)
Comment thread
robobun marked this conversation as resolved.
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/InspectorLifecycleAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class InspectorLifecycleAgent final : public InspectorAgentBase, public Inspecto
virtual CommandResultOf<Ref<JSON::ArrayOf<String>> /* esm */, Ref<JSON::ArrayOf<String>> /* cjs */, String /* cwd */, String /* main */, Ref<JSON::ArrayOf<String>> /* argv */> getModuleGraph() final;

// Public API
void reportReload();
void reportError(ZigException&);
Protocol::ErrorStringOr<void> preventExit();
Protocol::ErrorStringOr<void> stopPreventingExit();
Expand Down
7 changes: 0 additions & 7 deletions src/jsc/bindings/JSDOMWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@

#include "BunBuiltinNames.h"

// #include "DOMWindow.h"
// #include "DOMWrapperWorld.h"
// #include "JSDOMWindow.h"
// #include "JSRemoteDOMWindow.h"
// #include "SerializedScriptValue.h"
// #include <JavaScriptCore/Error.h>

namespace WebCore {

STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSDOMObject);
Expand Down
26 changes: 0 additions & 26 deletions src/jsc/bindings/JSS3File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ using namespace WebCore;

// External C functions declarations
extern "C" {
SYSV_ABI void* JSS3File__construct(JSC::JSGlobalObject*, JSC::CallFrame* callframe);
SYSV_ABI EncodedJSValue JSS3File__presign(void* ptr, JSC::JSGlobalObject*, JSC::CallFrame* callframe);
SYSV_ABI EncodedJSValue JSS3File__stat(void* ptr, JSC::JSGlobalObject*, JSC::CallFrame* callframe);
SYSV_ABI EncodedJSValue JSS3File__bucket(void* ptr, JSC::JSGlobalObject*);
SYSV_ABI bool JSS3File__hasInstance(EncodedJSValue, JSC::JSGlobalObject*, EncodedJSValue);
}

// Forward declarations
Expand Down Expand Up @@ -129,17 +127,6 @@ JSValue constructS3FileInternal(JSC::JSGlobalObject* lexicalGlobalObject, void*
return JSS3File::create(vm, globalObject, structure, ptr);
}

JSValue constructS3File(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe)
{
auto& vm = JSC::getVM(globalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
void* ptr = JSS3File__construct(globalObject, callframe);
RETURN_IF_EXCEPTION(scope, {});
ASSERT(ptr);

return constructS3FileInternal(globalObject, ptr);
}

JSC::Structure* JSS3File::createStructure(JSC::JSGlobalObject* globalObject)
{
auto& vm = JSC::getVM(globalObject);
Expand All @@ -150,14 +137,6 @@ JSC::Structure* JSS3File::createStructure(JSC::JSGlobalObject* globalObject)
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info(), NonArray);
}

static bool customHasInstance(JSObject* object, JSGlobalObject* globalObject, JSValue value)
{
if (!value.isObject())
return false;

return JSS3File__hasInstance(JSValue::encode(object), globalObject, JSValue::encode(value));
}

Structure* createJSS3FileStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
Comment thread
robobun marked this conversation as resolved.
{
return JSS3File::createStructure(globalObject);
Expand Down Expand Up @@ -192,11 +171,6 @@ const JSC::ClassInfo JSS3FilePrototype::s_info = { "S3File"_s, &Base::s_info, nu
const JSC::ClassInfo JSS3File::s_info = { "S3File"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSS3File) };

extern "C" {
SYSV_ABI EncodedJSValue BUN__createJSS3File(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe)
{
return JSValue::encode(constructS3File(globalObject, callframe));
};

SYSV_ABI EncodedJSValue BUN__createJSS3FileUnsafely(JSC::JSGlobalObject* globalObject, void* ptr)
{
return JSValue::encode(constructS3FileInternal(globalObject, ptr));
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/JSS3File.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class JSS3File : public WebCore::JSBlob {
static JSC::Structure* createStructure(JSC::JSGlobalObject* globalObject);
};

// Constructor helper
JSValue constructS3File(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe);
Structure* createJSS3FileStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject);

} // namespace Bun
10 changes: 0 additions & 10 deletions src/jsc/bindings/StrongRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,11 @@ extern "C" StrongRefImpl* Bun__StrongRef__new(JSC::JSGlobalObject* globalObject,
return encodeStrongRef(block, index);
}

extern "C" JSC::EncodedJSValue Bun__StrongRef__get(StrongRefImpl* _Nonnull ref)
{
return JSC::JSValue::encode(decodeStrongRefBlock(ref)->read(decodeStrongRefIndex(ref)));
}

extern "C" void Bun__StrongRef__set(StrongRefImpl* _Nonnull ref, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue)
{
decodeStrongRefBlock(ref)->write(JSC::getVM(globalObject), decodeStrongRefIndex(ref), JSC::JSValue::decode(encodedValue));
}

extern "C" void Bun__StrongRef__clear(StrongRefImpl* _Nonnull ref)
{
decodeStrongRefBlock(ref)->clearValue(decodeStrongRefIndex(ref));
}

// The Rust caller (Strong.rs Impl::destroy) skips this call once
// VirtualMachine.is_shutting_down is true, so the block cell is guaranteed
// live here: destructOnExit / WebWorker__teardownJSCVM set that flag before
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/StrongRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ struct StrongRefImpl;

extern "C" void Bun__StrongRef__delete(Bun::StrongRefImpl* _Nonnull ref);
extern "C" Bun::StrongRefImpl* Bun__StrongRef__new(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue);
extern "C" JSC::EncodedJSValue Bun__StrongRef__get(Bun::StrongRefImpl* _Nonnull ref);
extern "C" void Bun__StrongRef__set(Bun::StrongRefImpl* _Nonnull ref, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue);
extern "C" void Bun__StrongRef__clear(Bun::StrongRefImpl* _Nonnull ref);

namespace Bun {

Expand Down
Loading
Loading