Skip to content
Open
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/glob-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface SourcePattern {
* To add a new source list: add an entry here. The `Sources` type and
* `globAllSources()` pick it up automatically.
*/
const patterns = {
export const patterns = {
/** `packages/bun-error/*` — error overlay page */
bunError: {
paths: ["packages/bun-error/*.{json,ts,tsx,css}", "packages/bun-error/img/*"],
Expand Down
10 changes: 0 additions & 10 deletions src/install/PackageInstaller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,16 +1067,6 @@ impl<'a> PackageInstaller<'a> {
let package_id = self.lockfile().buffers.resolutions.as_slice()[dependency_id as usize];
let name = self.names[package_id as usize];

// const resolution = &this.resolutions[package_id];
// const task_id = switch (resolution.tag) {
// .git => Task.Id.forGitCheckout(data.url, data.resolved),
// .github => Task.Id.forTarball(data.url),
// .local_tarball => Task.Id.forTarball(this.lockfile.str(&resolution.value.local_tarball)),
// .remote_tarball => Task.Id.forTarball(this.lockfile.str(&resolution.value.remote_tarball)),
// .npm => Task.Id.forNPMPackage(name.slice(this.lockfile.buffers.string_bytes.items), resolution.value.npm.version),
// else => unreachable,
// };

// If a newly computed integrity hash is available (e.g. for a GitHub
// tarball) and the lockfile doesn't already have one, persist it so
// the lockfile gets re-saved with the hash.
Expand Down
36 changes: 0 additions & 36 deletions src/js/builtins/ConsoleObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ export function createConsoleConstructor(console: typeof globalThis.console) {
const kWriteToConsole = Symbol("kWriteToConsole");
const kBindProperties = Symbol("kBindProperties");
const kBindStreamsEager = Symbol("kBindStreamsEager");
const kBindStreamsLazy = Symbol("kBindStreamsLazy");
const kUseStdout = Symbol("kUseStdout");
const kUseStderr = Symbol("kUseStderr");

Expand Down Expand Up @@ -353,41 +352,6 @@ export function createConsoleConstructor(console: typeof globalThis.console) {
});
},
},
[kBindStreamsLazy]: {
...consolePropAttributes,
// Lazily load the stdout and stderr from an object so we don't
// create the stdio streams when they are not even accessed
value: function (object) {
let stdout;
let stderr;
Object.defineProperties(this, {
"_stdout": {
enumerable: false,
configurable: true,
get() {
if (!stdout) stdout = object.stdout;
return stdout;
},
set(value) {
stdout = value;
},
},
"_stderr": {
enumerable: false,
configurable: true,
get() {
if (!stderr) {
stderr = object.stderr;
}
return stderr;
},
set(value) {
stderr = value;
},
},
});
},
},
[kBindProperties]: {
...consolePropAttributes,
value: function (ignoreErrors, colorMode, groupIndentation = 2) {
Expand Down
24 changes: 0 additions & 24 deletions src/js/node/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1074,30 +1074,6 @@ Url.prototype.parseHost = function parseHost() {
if (host) this.hostname = host;
};

// function fileURLToPath(...args) {
// // Since we use WTF::URL::fileSystemPath directly in Bun.fileURLToPath, we don't get invalid windows
// // path checking. We patch this in to `node:url` for compatibility. Note that
// // this behavior is missing from WATWG URL.
// if (process.platform === "win32") {
// var url: string;
// if ($isObject(args[0]) && args[0] instanceof Url) {
// url = (args[0] as { href: string }).href;
// } else if (typeof args[0] === "string") {
// url = args[0];
// } else {
// throw $ERR_INVALID_ARG_TYPE("url", ["string", "URL"], args[0]);
// }

// for (var i = 0; i < url.length; i++) {
// if (url.charCodeAt(i) === Char.PERCENT && (i + 1) < url.length) {
// switch (url.charCodeAt(i + 1)) {
// break;
// }
// }
// }
// return Bun.fileURLToPath.$call(args);
// }

/**
* Add new characters as needed from
* [here](https://github.com/nodejs/node/blob/main/lib/internal/constants.js).
Expand Down
11 changes: 1 addition & 10 deletions src/jsc/AbortSignal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub enum AbortReason {
// tier). The per-VM timer heap (`Timer::All`) lives in `bun_runtime` (higher
// tier) and is reached through `RuntimeHooks::{timer_insert,timer_remove}` —
// see `VirtualMachine::timer_insert/remove`. C++ only ever sees `*mut Timeout`
// as an opaque token round-tripped through `create`/`run`/`deinit`, so the
// as an opaque token round-tripped through `create`/`deinit`, so the
// concrete layout is private to Rust; `repr(C)` is here so `offset_of!` is
// well-defined for the `container_of` recovery in `bun_runtime::dispatch`.
// ──────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -441,15 +441,6 @@ extern "C" fn AbortSignal__Timeout__create(
Timeout::init(vm, signal_, milliseconds)
}

/// # Safety
/// `this` must be a live boxed `Timeout` returned from `AbortSignal__Timeout__create`;
/// `vm` must be the live per-thread `VirtualMachine`.
#[unsafe(no_mangle)]
unsafe extern "C" fn AbortSignal__Timeout__run(this: *mut Timeout, vm: *mut VirtualMachine) {
// SAFETY: C++ caller passes a live boxed Timeout and the live per-thread VM.
unsafe { Timeout::run(this, vm) }
}

/// # Safety
/// `this` must be a live boxed `Timeout` returned from `AbortSignal__Timeout__create`.
/// Must be called on the owning JS thread — `deinit` resolves the VM via the
Comment thread
robobun marked this conversation as resolved.
Expand Down
4 changes: 2 additions & 2 deletions src/jsc/StringBuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ impl Drop for StringBuilder {
// inline `WTF::StringBuilder` storage. The shims that take only that handle
// plus by-value scalars/`bun.String` are declared `safe fn` — the validity
// proof is in the type signature. `__init` keeps a raw `*mut c_void` (writes
// into a `MaybeUninit`); `__appendLatin1`/`__appendUtf16` keep `unsafe fn`
// because the C++ side dereferences the `(ptr, len)` slice.
// into a `MaybeUninit`); `__appendLatin1` keeps `unsafe fn` because the C++
// side dereferences the `(ptr, len)` slice.
Comment thread
robobun marked this conversation as resolved.
unsafe extern "C" {
fn StringBuilder__init(this: *mut c_void);
safe fn StringBuilder__deinit(this: &mut StringBuilder);
Expand Down
9 changes: 0 additions & 9 deletions src/jsc/VM.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ bun_opaque::opaque_ffi! {
}

impl VM {
// Note: `JSC__VM__create` was removed from bindings.cpp (Bun creates
// its VM via `Zig::GlobalObject::create` → `WebWorker__createVM` instead).

// Note: not `impl Drop` — takes a `global_object` param and `VM` is an opaque FFI handle.

pub fn enable_control_flow_profiler(&self) {
Expand Down Expand Up @@ -121,12 +118,6 @@ impl VM {
JSC__VM__terminationException(self)
}

/// Has termination been requested on this VM (worker.terminate(), or
/// teardown's forbidExecution)? JS thread.
pub fn has_termination_request(&self) -> bool {
crate::cpp::JSC__VM__hasTerminationRequest(self)
}

#[track_caller]
pub fn throw_error(&self, global_object: &JSGlobalObject, value: JSValue) -> JsError {
crate::validation_scope!(scope, global_object);
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/bindings/BakeAdditionsToGlobalObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getEnsureAsyncLocalStorageInstance
return JSValue::encode(zig->bakeAdditions().ensureAsyncLocalStorageInstanceJSFunction(globalObject));
}

extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getSSRResponseConstructor(JSC::JSGlobalObject* globalObject)
{
auto* zig = static_cast<Zig::GlobalObject*>(globalObject);
return JSValue::encode(zig->bakeAdditions().JSBakeResponseConstructor(globalObject));
}

BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
auto* zig = static_cast<Zig::GlobalObject*>(globalObject);
Expand Down
20 changes: 0 additions & 20 deletions src/jsc/bindings/BunPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,26 +240,11 @@ static JSC::EncodedJSValue jsFunctionAppendOnLoadPluginGlobal(JSC::JSGlobalObjec
return jsFunctionAppendOnLoadPluginBody(globalObject, callframe, target, plugins, global->bunVM(), callback);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnLoadPluginNode, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnLoadPluginGlobal(globalObject, callframe, BunPluginTargetNode);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnLoadPluginBun, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnLoadPluginGlobal(globalObject, callframe, BunPluginTargetBun);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnLoadPluginBrowser, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnLoadPluginGlobal(globalObject, callframe, BunPluginTargetBrowser);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnResolvePluginNode, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnResolvePluginGlobal(globalObject, callframe, BunPluginTargetNode);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnResolvePluginBun, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnResolvePluginGlobal(globalObject, callframe, BunPluginTargetBun);
Expand All @@ -270,11 +255,6 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendVirtualModule, (JSC::JSGlobalObject * g
return jsFunctionAppendVirtualModulePluginBody(globalObject, callframe);
}

JSC_DEFINE_HOST_FUNCTION(jsFunctionAppendOnResolvePluginBrowser, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe))
{
return jsFunctionAppendOnResolvePluginGlobal(globalObject, callframe, BunPluginTargetBrowser);
}

/// `Bun.plugin()`
static inline JSC::EncodedJSValue setupBunPlugin(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callframe, BunPluginTarget target)
{
Expand Down
11 changes: 0 additions & 11 deletions src/jsc/bindings/BunProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,6 @@ static void dispatchExitInternal(JSC::JSGlobalObject* globalObject, Process* pro
emitter.emit(event, arguments);
}

JSC_DEFINE_CUSTOM_SETTER(Process_defaultSetter, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, JSC::PropertyName propertyName))
{
auto& vm = JSC::getVM(globalObject);

JSC::JSObject* thisObject = dynamicDowncast<JSC::JSObject>(JSValue::decode(thisValue));
if (value)
thisObject->putDirect(vm, propertyName, JSValue::decode(value), 0);

return true;
}

extern "C" BunString Bun__resolveEmbeddedNodeFile(const BunString*);
#if OS(WINDOWS)
extern "C" HMODULE Bun__LoadLibraryBunString(BunString*);
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/bindings/Cookie.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "Cookie.h"
#include "EncodeURIComponent.h"
#include "JSCookie.h"
#include "helpers.h"
#include <JavaScriptCore/ObjectConstructor.h>
#include <wtf/WallTime.h>
Expand All @@ -10,11 +9,6 @@
#include "HTTPParsers.h"
namespace WebCore {

extern "C" WebCore::Cookie* Cookie__fromJS(JSC::EncodedJSValue value)
{
return WebCoreCast<WebCore::JSCookie, WebCore::Cookie>(value);
}

Cookie::~Cookie() = default;

Cookie::Cookie(const String& name, const String& value,
Expand Down
10 changes: 0 additions & 10 deletions src/jsc/bindings/NodeFSStatFSBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,6 @@ JSC_DEFINE_HOST_FUNCTION(callBigIntStatFS, (JSC::JSGlobalObject * lexicalGlobalO
return JSValue::encode(callJSStatFSFunction<true>(lexicalGlobalObject, callFrame));
}

extern "C" JSC::EncodedJSValue Bun__JSBigIntStatFSObjectConstructor(Zig::GlobalObject* globalobject)
{
return JSValue::encode(globalobject->m_JSStatFSBigIntClassStructure.constructor(globalobject));
}

extern "C" JSC::EncodedJSValue Bun__JSStatFSObjectConstructor(Zig::GlobalObject* globalobject)
{
return JSValue::encode(globalobject->m_JSStatFSClassStructure.constructor(globalobject));
}

void JSStatFSPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
Expand Down
4 changes: 0 additions & 4 deletions src/jsc/bindings/RegularExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ extern "C" bool Yarr__RegularExpression__isValid(RegularExpression* re)
{
return re->isValid();
}
extern "C" int Yarr__RegularExpression__matchedLength(RegularExpression* re)
{
return re->matchedLength();
}
extern "C" int Yarr__RegularExpression__matches(RegularExpression* re, const BunString* string)
{
return re->match(string->toWTFString(BunString::ZeroCopy), 0, 0);
Expand Down
15 changes: 0 additions & 15 deletions src/jsc/bindings/SQLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,21 +492,6 @@ extern "C" EncodedJSValue JSC__createStructure(JSC::JSGlobalObject* globalObject
return JSValue::encode(structure);
}

extern "C" EncodedJSValue JSC__createEmptyObjectWithStructure(JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
auto& vm = JSC::getVM(globalObject);
auto* object = JSC::constructEmptyObject(vm, structure);

ensureStillAliveHere(object);
vm.writeBarrier(object);

return JSValue::encode(object);
}

extern "C" void JSC__putDirectOffset(JSC::VM* vm, JSC::EncodedJSValue object, uint32_t offset, JSC::EncodedJSValue value)
{
JSValue::decode(object).getObject()->putDirectOffset(*vm, offset, JSValue::decode(value));
}
extern "C" uint32_t JSC__JSObject__maxInlineCapacity = JSC::JSFinalObject::maxInlineCapacity;

// PostgreSQL time formatting helpers - following WebKit's pattern
Expand Down
11 changes: 0 additions & 11 deletions src/jsc/bindings/StringBuilderBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ extern "C" void StringBuilder__appendLatin1(WTF::StringBuilder* builder, Latin1C
builder->append({ ptr, len });
}

extern "C" void StringBuilder__appendUtf16(WTF::StringBuilder* builder, UChar const* ptr, size_t len)
{
builder->append({ ptr, len });
}

extern "C" void StringBuilder__appendDouble(WTF::StringBuilder* builder, double num)
Comment thread
robobun marked this conversation as resolved.
{
builder->append(num);
Expand Down Expand Up @@ -55,12 +50,6 @@ extern "C" void StringBuilder__appendUChar(WTF::StringBuilder* builder, UChar c)
builder->append(c);
}

extern "C" void StringBuilder__appendQuotedJsonString(WTF::StringBuilder* builder, const BunString* str)
{
auto string = str->toWTFString(BunString::ZeroCopy);
builder->appendQuotedJSONString(string);
}

extern "C" JSC::EncodedJSValue StringBuilder__toString(WTF::StringBuilder* builder, JSC::JSGlobalObject* globalObject)
{
auto& vm = globalObject->vm();
Expand Down
31 changes: 0 additions & 31 deletions src/jsc/bindings/ZigGlobalObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3280,37 +3280,6 @@ void GlobalObject::visitOutputConstraints(JSCell* cell, Visitor& visitor)
template void GlobalObject::visitOutputConstraints(JSCell*, AbstractSlotVisitor&);
template void GlobalObject::visitOutputConstraints(JSCell*, SlotVisitor&);

// void GlobalObject::destroy(JSCell* cell)
// {
// uncheckedDowncast<Zig::GlobalObject>(cell)->Zig::GlobalObject::~Zig::GlobalObject();
// }

// template<typename Visitor>
// void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
// {
// Zig::GlobalObject* thisObject = uncheckedDowncast<Zig::GlobalObject>(cell);
// ASSERT_GC_OBJECT_INHERITS(thisObject, info());
// Base::visitChildren(thisObject, visitor);

// {
// // The GC thread has to grab the GC lock even though it is not mutating the containers.
// Locker locker { thisObject->m_gcLock };

// for (auto& structure : thisObject->m_structures.values())
// visitor.append(structure);

// for (auto& guarded : thisObject->m_guardedObjects)
// guarded->visitAggregate(visitor);
// }

// for (auto& constructor : thisObject->constructors().array())
// visitor.append(constructor);

// thisObject->m_builtinInternalFunctions.visit(visitor);
// }

// DEFINE_VISIT_CHILDREN(Zig::GlobalObject);

void GlobalObject::clearModuleRegistry()
{
{
Expand Down
Loading
Loading