diff --git a/packages/bun-debug-adapter-protocol/scripts/generate-protocol.ts b/packages/bun-debug-adapter-protocol/scripts/generate-protocol.ts index 3b350ced10ca..fff75a12b210 100644 --- a/packages/bun-debug-adapter-protocol/scripts/generate-protocol.ts +++ b/packages/bun-debug-adapter-protocol/scripts/generate-protocol.ts @@ -20,7 +20,7 @@ async function run() { write("index.d.ts", `// GENERATED - DO NOT EDIT\n${types}`); } -function formatProtocol(protocol: Protocol, extraTs?: string): string { +function formatProtocol(protocol: Protocol): string { const { definitions } = protocol; const requestMap = new Map(); const responseMap = new Map(); @@ -86,9 +86,6 @@ function formatProtocol(protocol: Protocol, extraTs?: string): string { body += formatMapType("RequestMap", requestMap); body += formatMapType("ResponseMap", responseMap); body += formatMapType("EventMap", eventMap); - if (extraTs) { - body += extraTs; - } return body + "};"; } diff --git a/packages/bun-debug-adapter-protocol/src/debugger/node-socket-framer.ts b/packages/bun-debug-adapter-protocol/src/debugger/node-socket-framer.ts index 4c7b9519b1c5..60ea43bcf9b6 100644 --- a/packages/bun-debug-adapter-protocol/src/debugger/node-socket-framer.ts +++ b/packages/bun-debug-adapter-protocol/src/debugger/node-socket-framer.ts @@ -1,15 +1,7 @@ import type { Socket } from "node:net"; -const enum FramerState { - WaitingForLength, - WaitingForMessage, -} let socketFramerMessageLengthBuffer: Buffer; export class SocketFramer { - state: FramerState = FramerState.WaitingForLength; - pendingLength: number = 0; - sizeBuffer: Buffer = Buffer.alloc(4); - sizeBufferIndex: number = 0; bufferedData: Buffer = Buffer.alloc(0); socket: Socket; private onMessage: (message: string | string[]) => void; @@ -26,10 +18,7 @@ export class SocketFramer { } reset(): void { - this.state = FramerState.WaitingForLength; this.bufferedData = Buffer.alloc(0); - this.sizeBufferIndex = 0; - this.sizeBuffer = Buffer.alloc(4); } send(data: string): void { diff --git a/packages/bun-error/bun-error.css b/packages/bun-error/bun-error.css index dff68f46eb60..4999475f9038 100644 --- a/packages/bun-error/bun-error.css +++ b/packages/bun-error/bun-error.css @@ -335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weight: bold; - text-decoration-style: wavy; -} - -.BunError-JSException--TypeError #BunError-SourceLine-text-highlightExpression { - border: 1px solid rgba(0, 0, 0, 0.2); -} -.BunError-Indented { - display: inline-block; - user-select: none; - -webkit-user-select: none; -} - -.BunError-divet { - vertical-align: bottom; - user-select: none; - -webkit-user-select: none; -} - .BunError-error-typename { font-family: var(--bun-error-monospace); color: #e39437; font-weight: bold; } -.BunError-error-muted { - font-weight: normal; - user-select: none; - -webkit-user-select: none; -} - -.BunError-error-muted, .BunError-StackFrame--muted { color: rgb(165, 165, 165); } diff --git a/packages/bun-error/index.tsx b/packages/bun-error/index.tsx index 88b763a518f1..b910cb6cf78e 100644 --- a/packages/bun-error/index.tsx +++ b/packages/bun-error/index.tsx @@ -298,7 +298,6 @@ enum LoadState { const AsyncSourceLines = ({ highlight = -1, highlightColumnStart = 0, - highlightColumnEnd = Infinity, children, buildURL, sourceLines, @@ -306,7 +305,6 @@ const AsyncSourceLines = ({ }: { highlight: number; highlightColumnStart: number; - highlightColumnEnd?: number; children?: any; buildURL: (line?: number, column?: number) => string; sourceLines: SourceLine[]; @@ -396,7 +394,6 @@ const AsyncSourceLines = ({ @@ -414,21 +411,18 @@ const SourceLines = ({ sourceLines, highlight = -1, highlightColumnStart = 0, - highlightColumnEnd = Infinity, children, buildURL, }: { sourceLines: SourceLine[]; highlight: number; highlightColumnStart: number; - highlightColumnEnd?: number; children?: any; buildURL: (line?: number, column?: number) => string; }) => { let start = sourceLines.length; let end = 0; let dedent = Infinity; - let _i = 0; var minLineNumber = sourceLines.length + highlight + 1; var maxLineNumber = 0; for (let i = 0; i < sourceLines.length; i++) { @@ -504,15 +498,7 @@ const BuildErrorSourceLines = ({ location, filename }: { location: Location; fil const { line, line_text, column } = location; const sourceLines: SourceLine[] = [{ line, text: line_text }]; const buildURL = useCallback((line, column) => srcFileURL(filename, line, column), [filename]); - return ( - - ); + return ; }; const BuildErrorStackTrace = ({ location }: { location: Location }) => { @@ -687,7 +673,6 @@ const NativeStackTrace = ({ sourceLines={sourceLines} highlightColumnStart={position.column} buildURL={buildURL} - highlightColumnEnd={position.column_stop} > {children} @@ -699,7 +684,6 @@ const NativeStackTrace = ({ setSourceLines={setSourceLines} highlightColumnStart={position.column} buildURL={buildURL} - highlightColumnEnd={position.column_stop} > {children} diff --git a/packages/bun-native-plugin-rs/.gitignore b/packages/bun-native-plugin-rs/.gitignore index 2f7896d1d136..cb482d81522e 100644 --- a/packages/bun-native-plugin-rs/.gitignore +++ b/packages/bun-native-plugin-rs/.gitignore @@ -1 +1,2 @@ target/ +headers/ diff --git a/packages/bun-native-plugin-rs/headers/bun-native-bundler-plugin-api/bundler_plugin.h b/packages/bun-native-plugin-rs/headers/bun-native-bundler-plugin-api/bundler_plugin.h deleted file mode 100644 index ff10c27ccd62..000000000000 --- a/packages/bun-native-plugin-rs/headers/bun-native-bundler-plugin-api/bundler_plugin.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef BUN_NATIVE_BUNDLER_PLUGIN_API_H -#define BUN_NATIVE_BUNDLER_PLUGIN_API_H - -#include -#include - -typedef enum { - BUN_LOADER_JSX = 0, - BUN_LOADER_JS = 1, - BUN_LOADER_TS = 2, - BUN_LOADER_TSX = 3, - BUN_LOADER_CSS = 4, - BUN_LOADER_FILE = 5, - BUN_LOADER_JSON = 6, - BUN_LOADER_TOML = 7, - BUN_LOADER_WASM = 8, - BUN_LOADER_NAPI = 9, - BUN_LOADER_BASE64 = 10, - BUN_LOADER_DATAURL = 11, - BUN_LOADER_TEXT = 12, -} BunLoader; - -const BunLoader BUN_LOADER_MAX = BUN_LOADER_TEXT; - -typedef struct BunLogOptions { - size_t __struct_size; - const uint8_t *message_ptr; - size_t message_len; - const uint8_t *path_ptr; - size_t path_len; - const uint8_t *source_line_text_ptr; - size_t source_line_text_len; - int8_t level; - int line; - int lineEnd; - int column; - int columnEnd; -} BunLogOptions; - -typedef struct { - size_t __struct_size; - void *bun; - const uint8_t *path_ptr; - size_t path_len; - const uint8_t *namespace_ptr; - size_t namespace_len; - uint8_t default_loader; - void *external; -} OnBeforeParseArguments; - -typedef struct OnBeforeParseResult { - size_t __struct_size; - uint8_t *source_ptr; - size_t source_len; - uint8_t loader; - int (*fetchSourceCode)(const OnBeforeParseArguments *args, - struct OnBeforeParseResult *result); - void *plugin_source_code_context; - void (*free_plugin_source_code_context)(void *ctx); - void (*log)(const OnBeforeParseArguments *args, BunLogOptions *options); -} OnBeforeParseResult; - -typedef enum { - BUN_LOG_LEVEL_VERBOSE = 0, - BUN_LOG_LEVEL_DEBUG = 1, - BUN_LOG_LEVEL_INFO = 2, - BUN_LOG_LEVEL_WARN = 3, - BUN_LOG_LEVEL_ERROR = 4, -} BunLogLevel; - -const BunLogLevel BUN_LOG_MAX = BUN_LOG_LEVEL_ERROR; - -#endif // BUN_NATIVE_BUNDLER_PLUGIN_API_H diff --git a/scripts/build/clean.ts b/scripts/build/clean.ts index 68aeb8bb62ae..1b7af62aaefd 100644 --- a/scripts/build/clean.ts +++ b/scripts/build/clean.ts @@ -13,7 +13,7 @@ import { fileURLToPath } from "node:url"; import { allDeps } from "./deps/index.ts"; const cwd = resolve(dirname(fileURLToPath(import.meta.url)), "..", ".."); -// Machine-shared cache (ccache/cargo/tarballs/webkit). Matches resolveConfig()'s +// Machine-shared cache (ccache/tarballs/webkit). Matches resolveConfig()'s // non-CI default. `clean` is a dev-machine tool so we don't branch on CI here. const sharedCacheDir = resolve(process.env.BUN_INSTALL || resolve(homedir(), ".bun"), "build-cache"); @@ -31,9 +31,9 @@ presets: release build/release/ debug-local build/debug-local/ release-local build/release-local/ - rust cargo target dirs across all profiles + ~/.bun/build-cache/cargo + rust cargo target dirs across all profiles cpp C++ obj/ + pch/ across all profiles - cache machine-shared build cache (~/.bun/build-cache: ccache, cargo, + cache machine-shared build cache (~/.bun/build-cache: ccache, tarballs, prebuilt webkit) — affects ALL checkouts deep build/, target/, vendor/* (except manually managed deps like WebKit) @@ -68,7 +68,6 @@ const presets: Record string[]> = { rust: () => [ ...buildProfiles().map(p => resolve(p, "rust-target")), - resolve(sharedCacheDir, "cargo"), // `cargo check`/`cargo clippy` run from the repo root with no // --target-dir, so they write to the workspace-default `target/`. resolve(cwd, "target"), diff --git a/scripts/build/configure.ts b/scripts/build/configure.ts index 962786a56897..0cbdf3d68165 100644 --- a/scripts/build/configure.ts +++ b/scripts/build/configure.ts @@ -120,8 +120,6 @@ export function resolveToolchain(targetOs?: OS, packageManager: PackageManager = export interface ConfigureResult { cfg: Config; output: BunOutput; - /** Build.ninja absolute path. */ - ninjaFile: string; /** Env vars the caller should set before spawning ninja. */ env: Record; /** Wall-clock ms for the configure pass. */ @@ -391,10 +389,8 @@ export async function configure(input: ConfigureInput, fromNinja = false): Promi } mark("orderFile"); - const ninjaFile = ninjaPath; - const elapsed = Math.round(performance.now() - start); const exe = bunExeName(cfg) + (shouldStrip(cfg) ? " → bun (stripped)" : ""); - return { cfg, output, ninjaFile, env: ccacheEnv(cfg), elapsed, changed, exe }; + return { cfg, output, env: ccacheEnv(cfg), elapsed, changed, exe }; } diff --git a/scripts/build/tty.ts b/scripts/build/tty.ts index b657a3c2b78b..372cc9f3cd20 100644 --- a/scripts/build/tty.ts +++ b/scripts/build/tty.ts @@ -31,7 +31,6 @@ export function formatElapsed(ms: number): string { /** * Hash a name to a stable 256-color. Same name → same color across runs, * so `[tinycc]` in stream output and `tinycc` in the done line match. - * zig overridden to brand orange. * * `color` defaults to this module's stderr-TTY check. stream.ts passes * its own — it writes to FD 3 (a terminal when set up by build.ts) while @@ -39,14 +38,13 @@ export function formatElapsed(ms: number): string { */ export function nameColor(name: string, text: string = name, color: boolean = useColor): string { if (!color) return text; - const overrides: Record = { zig: 214 }; const palette = [220, 184, 154, 120, 114, 86, 87, 81, 111, 147, 141, 183]; let h = 2166136261; for (let i = 0; i < name.length; i++) { h ^= name.charCodeAt(i); h = Math.imul(h, 16777619); } - const c = overrides[name] ?? palette[(h >>> 0) % palette.length]; + const c = palette[(h >>> 0) % palette.length]; return `\x1b[38;5;${c}m${text}\x1b[39m`; } diff --git a/src/codegen/bake-codegen.ts b/src/codegen/bake-codegen.ts index 1eaf4ff7239c..7e9a0c9572d5 100644 --- a/src/codegen/bake-codegen.ts +++ b/src/codegen/bake-codegen.ts @@ -1,5 +1,5 @@ import assert from "node:assert"; -import { existsSync, readFileSync, rmSync } from "node:fs"; +import { readFileSync, rmSync } from "node:fs"; import { basename, join } from "node:path"; import { argParse, writeIfNotChanged } from "./helpers"; @@ -204,9 +204,6 @@ async function run() { process.exit(1); } else { console.log("-> bake.client.js, bake.server.js, bake.error.js"); - - const empty_file = join(codegenRoot, "bake_empty_file"); - if (!existsSync(empty_file)) writeIfNotChanged(empty_file, "this is used to fulfill a build dependency"); } } diff --git a/src/codegen/bundle-functions.ts b/src/codegen/bundle-functions.ts index ca05f1f3df72..6cc0ec46451a 100644 --- a/src/codegen/bundle-functions.ts +++ b/src/codegen/bundle-functions.ts @@ -160,7 +160,7 @@ async function processFileSplit(filename: string): Promise<{ functions: BundledB const i = contents.indexOf("\n") + 1; internal ||= contents.slice(0, i).includes("@internal"); contents = contents.slice(i); - } else if (match[1] === "type" || match[1] === "export type") { + } else if (match[1] === "type") { const i = contents.search(consumeEndOfType); contents = contents.slice(i + 1); } else if (match[1] === "interface") { @@ -281,10 +281,6 @@ async function processFileSplit(filename: string): Promise<{ functions: BundledB for (const fn of functions) { const tmpFile = path.join(TMP_DIR, `${basename}.${fn.name}.ts`); - // not sure if this optimization works properly in jsc builtins - // const useThis = fn.usesThis; - const useThis = true; - // TODO: we should use format=IIFE so we could bundle imports and extra functions. writeFileSync( tmpFile, @@ -295,11 +291,7 @@ ${fn.enums.join("\n")} // do not allow the bundler to rename a symbol to $ ($); -$$capture_start$$(${fn.async ? "async " : ""}${ - useThis - ? `function(${fn.params.join(",")})` - : `${fn.params.length === 1 ? fn.params[0] : `(${fn.params.join(",")})`}=>` - } {${fn.source}}).$$capture_end$$; +$$capture_start$$(${fn.async ? "async " : ""}function(${fn.params.join(",")}) {${fn.source}}).$$capture_end$$; `, ); await Bun.sleep(1); diff --git a/src/codegen/bundle-modules.ts b/src/codegen/bundle-modules.ts index 9d6fd1f9482f..49604d6d9697 100644 --- a/src/codegen/bundle-modules.ts +++ b/src/codegen/bundle-modules.ts @@ -254,8 +254,6 @@ for (const entrypoint of bundledEntryPoints) { captured = captured .replace(/\$\$EXPORT\$\$\((.*)\).\$\$EXPORT_END\$\$;/, "return $1") - .replace(/]\s*,\s*__(debug|assert)_end__\)/g, ")") - .replace(/]\s*,\s*__debug_end__\)/g, ")") .replace(/import.meta.require\((.*?)\)/g, (expr, specifier) => { throw new Error(`Builtin Bundler: do not use import.meta.require() (in ${file_path}))`); }) @@ -377,7 +375,6 @@ mark("Bundle Functions"); writeIfNotChanged( path.join(CODEGEN_DIR, "InternalModuleRegistry+numberOfModules.h"), `#define BUN_INTERNAL_MODULE_COUNT ${moduleList.length} -#define BUN_NATIVE_MODULE_START_INDEX ${nativeStartIndex} `, ); diff --git a/src/codegen/cppbind.ts b/src/codegen/cppbind.ts index 3136b507bb88..ef715f18d7c4 100644 --- a/src/codegen/cppbind.ts +++ b/src/codegen/cppbind.ts @@ -43,13 +43,12 @@ To run manually: ### Parameters -- **[[ZIG_NONNULL]]** - Mark pointer parameters as non-nullable: +- **[[ZIG_NONNULL]]** - Accepted on pointer parameters. It does not change the generated binding: ```cpp [[ZIG_EXPORT(nothrow)]] void process([[ZIG_NONNULL]] JSGlobalObject* globalThis, [[ZIG_NONNULL]] JSValue* values, size_t count) { ... } ``` - Generates: `pub extern fn process(globalThis: *jsc.JSGlobalObject, values: [*]const jsc.JSValue) void;` */ @@ -88,8 +87,6 @@ type CppType = child: CppType; position: Srcloc; isConst: boolean; - isMany: boolean; - isNonNull: boolean; } | { type: "named"; @@ -292,16 +289,12 @@ function processDeclarator( if (declarator?.name === "PointerDeclarator") { if (!rootmostType) throwError(nodePosition(declarator, ctx), "no rootmost type provided to PointerDeclarator"); const isConst = !!declarator.parent?.getChild("const") || rootmostType.type === "fn"; - const parentAttributes = declarator.parent?.getChildren("Attribute") ?? []; - const isNonNull = parentAttributes.some(attr => text(attr.getChild("AttributeName")!, ctx) === "ZIG_NONNULL"); return processDeclarator(ctx, declarator, { type: "pointer", child: rootmostType, position: nodePosition(declarator, ctx), isConst, - isNonNull, - isMany: false, }); } else if (declarator?.name === "ReferenceDeclarator") { throwError(nodePosition(declarator, ctx), "references are not allowed"); @@ -357,15 +350,6 @@ function processFunction(ctx: ParseContext, node: SyntaxNode, tag: ExportTag): C parameters.push({ type: paramDeclarator.type, name: text(name, ctx) }); } - for (let i = 0; i < parameters.length; i++) { - const param = parameters[i]; - const next = parameters[i + 1]; - if (param.type.type === "pointer" && next?.type.type === "named" && next.type.name === "size_t") { - param.type.isMany = true; - i++; - } - } - return { returnType: declarator.type, name: text(nameNode, ctx), diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index 6327c8ecc8bc..88ef9dd56f15 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1111,7 +1111,6 @@ function generateClassHeader(typeName, obj: ClassDefinition) { static constexpr unsigned StructureFlags = Base::StructureFlags; static ${name}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); ${obj.valuesArray ? `static ${name}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx, WTF::FixedVector>&& jsvalueArray);` : ""} - ${obj.valuesArray && obj.values && obj.values.length > 0 ? `static ${name}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx${obj.values.map(v => `, JSC::JSValue ${v}`).join("")});` : ""} ${obj.valuesArray && obj.values && obj.values.length > 0 ? `static ${name}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx, WTF::FixedVector>&& jsvalueArray${obj.values.map(v => `, JSC::JSValue ${v}`).join("")});` : ""} DECLARE_EXPORT_INFO; @@ -1153,10 +1152,6 @@ function generateClassHeader(typeName, obj: ClassDefinition) { } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - // constexpr: the extern "C" __ptrOffset constants initialized from - // this are then constant-initialized in every build mode (no static - // initializer at -O0; the link-time initializer audit relies on it). - static constexpr ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(${name}, m_ctx); } /** * Estimated size of the object from Zig including the JS wrapper. @@ -1177,17 +1172,6 @@ function generateClassHeader(typeName, obj: ClassDefinition) { ${weakInit.trim()} } - ${ - obj.valuesArray && obj.values && obj.values.length > 0 - ? `${name}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) - : Base(vm, structure)${obj.values.map(v => `\n , m_${v}(${v}, JSC::WriteBarrierEarlyInit)`).join("")} - { - m_ctx = sinkPtr; - ${weakInit.trim()} - }` - : "" - } - ${ obj.valuesArray && obj.values && obj.values.length > 0 ? `${name}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr, WTF::FixedVector>&& jsvalueArray_${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) @@ -1411,16 +1395,6 @@ ${ : "" } -${ - obj.valuesArray && obj.values && obj.values.length > 0 - ? `${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) { - ${name}* ptr = new (NotNull, JSC::allocateCell<${name}>(vm)) ${name}(vm, structure, ctx${obj.values.map(v => `, ${v}`).join("")}); - ptr->finishCreation(vm); - return ptr; -}` - : "" -} - ${ obj.valuesArray && obj.values && obj.values.length > 0 ? `${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx, WTF::FixedVector>&& jsvalueArray${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) { @@ -1473,8 +1447,6 @@ extern JSC_CALLCONV bool JSC_HOST_CALL_ATTRIBUTES ${typeName}__dangerouslySetPtr return true; } -extern "C" const size_t ${typeName}__ptrOffset = ${className(typeName)}::offsetOfWrapped(); - void ${name}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { auto* thisObject = uncheckedDowncast<${name}>(cell); @@ -1563,47 +1535,6 @@ ${ : "" } -${ - obj.valuesArray && obj.values && obj.values.length > 0 - ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithInitialValues(Zig::GlobalObject* globalObject, void* ptr${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { - auto &vm = globalObject->vm(); - JSC::Structure* structure = globalObject->${className(typeName)}Structure(); - ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr${obj.values.map(v => `, JSC::JSValue::decode(${v})`).join("")}); - ${ - obj.estimatedSize - ? ` - auto size = ${symbolName(typeName, "estimatedSize")}(ptr); - vm.heap.reportExtraMemoryAllocated(instance, size);` - : "" - } - return JSValue::encode(instance); -}` - : "" -} - -${ - obj.valuesArray && obj.values && obj.values.length > 0 - ? `extern JSC_CALLCONV JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${typeName}__createWithValuesAndInitialValues(Zig::GlobalObject* globalObject, void* ptr, void* markedArgumentBuffer${obj.values.map(v => `, JSC::EncodedJSValue ${v}`).join("")}) { - auto &vm = globalObject->vm(); - JSC::Structure* structure = globalObject->${className(typeName)}Structure(); - auto* args = static_cast(markedArgumentBuffer); - WTF::FixedVector> jsvalueArray(args->size()); - for (size_t i = 0; i < args->size(); ++i) { - jsvalueArray[i].setWithoutWriteBarrier(args->at(i)); - } - ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr, WTF::move(jsvalueArray)${obj.values.map(v => `, JSC::JSValue::decode(${v})`).join("")}); - ${ - obj.estimatedSize - ? ` - auto size = ${symbolName(typeName, "estimatedSize")}(ptr); - vm.heap.reportExtraMemoryAllocated(instance, size);` - : "" - } - return JSValue::encode(instance); -}` - : "" -} - ${DEFINE_VISIT_CHILDREN} `.trim(); @@ -1808,10 +1739,6 @@ const rustModuleResolver = (() => { // `pub use bun_jsc::{BuildMessage, ResolveMessage};` so route there. return `crate::api::${name}`; }, - /** Resolve an absolute `.rs` file path to its `crate::…` module path. */ - resolveFile(absRs: string): string | null { - return fileToMod.get(path.resolve(absRs)) ?? null; - }, has(name: string): boolean { return structToPath.has(name); }, @@ -2120,13 +2047,6 @@ function generateRust( `(this: ${recv}, global: &JSGlobalObject, ctx: *mut c_void, write_bytes: WriteBytesFn) -> ()`, ` ${T}::on_structured_clone_serialize(this, global, ctx, write_bytes)`, ); - if (typeof structuredClone === "object" && structuredClone.transferable) { - thunk( - symbolName(typeName, "onStructuredCloneTransfer"), - `(this: ${recv}, global: &JSGlobalObject, ctx: *mut c_void, write_bytes: WriteBytesFn) -> ()`, - ` ${T}::on_structured_clone_transfer(this, global, ctx, write_bytes)`, - ); - } thunk( symbolName(typeName, "onStructuredCloneDeserialize"), `(global: &JSGlobalObject, ptr: *mut *mut u8, end: *const u8) -> JSValue`, diff --git a/src/codegen/generate-jssink.ts b/src/codegen/generate-jssink.ts index 5f600e7a5ef5..7ea3887b39a2 100644 --- a/src/codegen/generate-jssink.ts +++ b/src/codegen/generate-jssink.ts @@ -31,7 +31,6 @@ function header() { public: using Base = JSC::InternalFunction; static ${constructor}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype); - static constexpr SinkID Sink = SinkID::${name}; static constexpr unsigned StructureFlags = Base::StructureFlags; static constexpr JSC::DestructionMode needsDestruction = DoesNotNeedDestruction; @@ -83,8 +82,6 @@ function header() { { return Bun::createClassStructure(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject& globalObject); ~${className}(); @@ -124,7 +121,6 @@ function header() { public: using Base = JSReadableSinkControllerBase; static ${controller}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr, uintptr_t onDestroy); - static constexpr SinkID Sink = SinkID::${name}; DECLARE_EXPORT_INFO; template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) @@ -179,8 +175,6 @@ JSC_DECLARE_CUSTOM_GETTER(function${name}__getter); #include "Sink.h" -extern "C" bool JSSink_isSink(JSC::JSGlobalObject*, JSC::EncodedJSValue); - namespace WebCore { using namespace JSC; @@ -287,7 +281,6 @@ async function implementation() { #include "ExtendedDOMClientIsoSubspaces.h" #include "ExtendedDOMIsoSubspaces.h" #include "IDLTypes.h" -// #include "JSBlob.h" #include "JSDOMAttribute.h" #include "JSDOMBinding.h" #include "JSDOMConstructor.h" @@ -314,12 +307,7 @@ async function implementation() { #include "JSBufferEncodingType.h" #include -#if ENABLE(MEDIA_SOURCE) -#include "BufferMediaSource.h" -#include "JSMediaSource.h" -#endif -// #include #include #include "BunClientData.h" @@ -695,11 +683,6 @@ ${controller}::~${controller}() } } -JSObject* ${className}::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) -{ - return ${prototypeName}::create(vm, &globalObject, ${prototypeName}::createStructure(vm, &globalObject, globalObject.objectPrototype())); -} - JSObject* JS${controllerName}::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { return ${controllerPrototypeName}::create(vm, &globalObject, ${controllerPrototypeName}::createStructure(vm, &globalObject, globalObject.objectPrototype())); @@ -817,8 +800,6 @@ void ${className}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = uncheckedDowncast<${className}>(cell); if (void* wrapped = thisObject->wrapped()) { analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, makeString("url ", thisObject->scriptExecutionContext()->url().string())); } } @@ -829,8 +810,6 @@ void ${controller}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) auto* thisObject = uncheckedDowncast<${controller}>(cell); if (void* wrapped = thisObject->wrapped()) { analyzer.setWrappedObjectForCell(cell, wrapped); - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, makeString("url ", thisObject->scriptExecutionContext()->url().string())); } auto& vm = cell->vm(); diff --git a/src/js/builtins.d.ts b/src/js/builtins.d.ts index 4d0a84598226..4b077a90ea1e 100644 --- a/src/js/builtins.d.ts +++ b/src/js/builtins.d.ts @@ -320,13 +320,6 @@ declare interface Promise extends ClassWithIntrinsics> {} declare interface ArrayBufferConstructor extends ClassWithIntrinsics {} declare interface PromiseConstructor extends ClassWithIntrinsics {} -declare interface UnderlyingSource { - $lazy?: boolean; - $bunNativePtr?: undefined | TODO; - autoAllocateChunkSize?: number; - $stream?: ReadableStream; -} - declare interface AddEventListenerOptions { /** * Private symbol read by the native EventTarget. A listener registered with it still @@ -359,8 +352,6 @@ declare function notImplementedIssue(issueNumber: number, description: string): /** Return a function that throws a not implemented error that points to a github issue */ declare function notImplementedIssueFn(issueNumber: number, description: string): (...args: any[]) => never; -declare type JSCSourceCodeObject = unique symbol; - declare interface Function { path: string; } diff --git a/src/js/builtins/CommonJS.ts b/src/js/builtins/CommonJS.ts index dcb010804272..58503ffe1c6b 100644 --- a/src/js/builtins/CommonJS.ts +++ b/src/js/builtins/CommonJS.ts @@ -79,7 +79,7 @@ export function overridableRequire(this: JSCommonJSModule, originalId: string, o const mod = $createCommonJSModule(id, {}, false, this); requireMap.$set(id, mod); - var out: LoaderModule | -1; + var out: any; // This is where we load the module. We will see if Module._load and // Module._compile are actually important for compatibility. diff --git a/src/js/private.d.ts b/src/js/private.d.ts index 96e211655406..e5e371685cfd 100644 --- a/src/js/private.d.ts +++ b/src/js/private.d.ts @@ -42,26 +42,6 @@ declare module "bun" { var fetch: typeof globalThis.fetch; } -interface LoaderEntry { - key: string; - state: number; - fetch: Promise; - instantiate: Promise; - satisfy: Promise; - dependencies: string[]; - module: LoaderModule; - linkError?: any; - linkSucceeded: boolean; - evaluated: boolean; - then?: any; - isAsync: boolean; - isSatisfied: boolean; -} - -interface LoaderModule { - dependenciesMap: Map; -} - declare interface Error { code?: string; } diff --git a/src/jsc/bindings/InternalModuleRegistry.cpp b/src/jsc/bindings/InternalModuleRegistry.cpp index 075f546fd450..986f760fcc38 100644 --- a/src/jsc/bindings/InternalModuleRegistry.cpp +++ b/src/jsc/bindings/InternalModuleRegistry.cpp @@ -279,7 +279,7 @@ static bool encodeInternalModule(const String& text, const String& moduleName, c } // bun build --compile: bytecode for this executable's internal JS module `id` (an index below -// BUN_NATIVE_MODULE_START_INDEX), generated the way generateInternalModule() will consume it. The caller owns *handle and +// bun_internal_modules_header.moduleCount), generated the way generateInternalModule() will consume it. The caller owns *handle and // releases it with CachedBytecode__deref. `depth`: how many levels of nested functions get code blocks too // (UINT32_MAX = all; 0 = only the module wrapper's own). extern "C" bool Bun__generateInternalModuleBytecode(uint32_t id, uint32_t depth, const uint8_t** bytes, size_t* size, JSC::CachedBytecode** handle, JSC::EncoderStringTable* externalStrings) diff --git a/src/jsc/bindings/JSBuffer.cpp b/src/jsc/bindings/JSBuffer.cpp index f9dd25d36898..6e5f8b743e07 100644 --- a/src/jsc/bindings/JSBuffer.cpp +++ b/src/jsc/bindings/JSBuffer.cpp @@ -107,78 +107,6 @@ static_assert(std::is_same_v, "all Buffer BigInt func JSC_DECLARE_HOST_FUNCTION(constructJSBuffer); JSC_DECLARE_HOST_FUNCTION(callJSBuffer); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_alloc); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_allocUnsafe); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_allocUnsafeSlow); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_byteLength); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_compare); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_concat); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_copyBytesFrom); -JSC_DECLARE_HOST_FUNCTION(jsBufferConstructorFunction_isEncoding); - -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_compare); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_copy); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_equals); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_fill); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_includes); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_indexOf); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_inspect); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_lastIndexOf); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_swap16); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_swap32); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_swap64); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_toString); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_slice); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_write); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeBigInt64LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeBigInt64BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeBigUInt64LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeBigUInt64BE); - -// Fixed-width readers / writers. Each is registered as a JSC "buffer accessor" (BufferAccessorIntrinsic + -// runtime/BufferAccessorRegistry.h) so DFG/FTL compile call sites into bounds-checked loads / stores. -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readInt8); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUInt8); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readInt16LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readInt16BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUInt16LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUInt16BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readInt32LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readInt32BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUInt32LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUInt32BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readFloatLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readFloatBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readDoubleLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readDoubleBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readBigInt64LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readBigInt64BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readBigUInt64LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readBigUInt64BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeInt8); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUInt8); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeInt16LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeInt16BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUInt16LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUInt16BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeInt32LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeInt32BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUInt32LE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUInt32BE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeFloatLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeFloatBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeDoubleLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeDoubleBE); -// Variable-width (byteLength 1..6) readers / writers. JIT-inlined when byteLength is a constant 1, 2 or 4. -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readIntLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readIntBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUIntLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_readUIntBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeIntLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeIntBE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUIntLE); -JSC_DECLARE_HOST_FUNCTION(jsBufferPrototypeFunction_writeUIntBE); - extern "C" EncodedJSValue WebCore_BufferEncodingType_toJS(JSC::JSGlobalObject* lexicalGlobalObject, WebCore::BufferEncodingType encoding) { return JSC::JSValue::encode(WebCore::convertEnumerationToJS(*lexicalGlobalObject, encoding)); diff --git a/src/jsc/bindings/JSDOMExceptionHandling.h b/src/jsc/bindings/JSDOMExceptionHandling.h index c6c7bf156a3d..d79e67af98d6 100644 --- a/src/jsc/bindings/JSDOMExceptionHandling.h +++ b/src/jsc/bindings/JSDOMExceptionHandling.h @@ -97,16 +97,4 @@ template void invokeFunctorPropagatingExceptionIfNecessary(JSC functor(); } -template void invokeFunctorPropagatingExceptionIfNecessary(JSC::JSGlobalObject* lexicalGlobalObject, JSC::ThrowScope& throwScope, Functor&& functor) -{ - using ReturnType = std::invoke_result_t; - - if constexpr (IsExceptionOr) { - auto result = functor(); - if (result.hasException()) [[unlikely]] - propagateException(lexicalGlobalObject, throwScope, result.releaseException()); - } else - functor(); -} - } // namespace WebCore diff --git a/src/jsc/bindings/JSDOMWrapper.h b/src/jsc/bindings/JSDOMWrapper.h index 31a2b19edf27..d0cbbf0dc459 100644 --- a/src/jsc/bindings/JSDOMWrapper.h +++ b/src/jsc/bindings/JSDOMWrapper.h @@ -77,7 +77,6 @@ class JSDOMWrapper : public JSDOMObject { ImplementationClass& wrapped() const { return m_wrapped; } Ref protectedWrapped() const { return m_wrapped; } - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDOMWrapper, m_wrapped); } protected: JSDOMWrapper(JSC::Structure* structure, JSC::JSGlobalObject& globalObject, Ref&& impl) diff --git a/src/jsc/bindings/Path.cpp b/src/jsc/bindings/Path.cpp index cfc4edddf11d..fa01fd917916 100644 --- a/src/jsc/bindings/Path.cpp +++ b/src/jsc/bindings/Path.cpp @@ -18,10 +18,7 @@ using JSGlobalObject = JSC::JSGlobalObject; using Exception = JSC::Exception; using JSValue = JSC::JSValue; using JSString = JSC::JSString; -using JSModuleLoader = JSC::JSModuleLoader; -using JSModuleRecord = JSC::JSModuleRecord; using Identifier = JSC::Identifier; -using SourceOrigin = JSC::SourceOrigin; using JSObject = JSC::JSObject; using JSNonFinalObject = JSC::JSNonFinalObject; namespace JSCastingHelpers = JSC::JSCastingHelpers; diff --git a/src/jsc/bindings/ZigSourceProvider.cpp b/src/jsc/bindings/ZigSourceProvider.cpp index b58cd9adbcd4..f9e366e50df2 100644 --- a/src/jsc/bindings/ZigSourceProvider.cpp +++ b/src/jsc/bindings/ZigSourceProvider.cpp @@ -22,7 +22,6 @@ namespace Zig { using SourceOrigin = JSC::SourceOrigin; using String = WTF::String; -using SourceProviderSourceType = JSC::SourceProviderSourceType; SourceOrigin toSourceOrigin(const String& sourceURL, bool isBuiltin) { diff --git a/src/jsc/bindings/webcore/EventEmitter.h b/src/jsc/bindings/webcore/EventEmitter.h index 475ebfd9bd81..d2f63865bf36 100644 --- a/src/jsc/bindings/webcore/EventEmitter.h +++ b/src/jsc/bindings/webcore/EventEmitter.h @@ -62,10 +62,8 @@ class EventEmitter final : public ScriptWrappable, public CanMakeWeakPtr getListeners(const Identifier& eventType); WEBCORE_EXPORT int listenerCount(const Identifier& eventType); - bool hasEventListeners() const; bool hasEventListeners(const Identifier& eventType) const; bool hasActiveEventListeners(const Identifier& eventType) const; - bool hasEventListeners(JSC::VM& vm, ASCIILiteral eventType) const; WTF::Function onDidChangeListener = WTF::Function(nullptr); @@ -121,23 +119,12 @@ inline bool EventEmitter::isFiringEventListeners() const return data && data->isFiringEventListeners; } -inline bool EventEmitter::hasEventListeners() const -{ - auto* data = eventTargetData(); - return data && !data->eventListenerMap.isEmpty(); -} - inline bool EventEmitter::hasEventListeners(const Identifier& eventType) const { auto* data = eventTargetData(); return data && data->eventListenerMap.contains(eventType); } -inline bool EventEmitter::hasEventListeners(JSC::VM& vm, ASCIILiteral eventType) const -{ - return this->hasEventListeners(Identifier::fromString(vm, eventType)); -} - inline void EventEmitter::setMaxListeners(unsigned count) { this->m_maxListeners = count; diff --git a/src/jsc/bindings/webcore/EventTarget.h b/src/jsc/bindings/webcore/EventTarget.h index 277f33006fd1..edeec60519d8 100644 --- a/src/jsc/bindings/webcore/EventTarget.h +++ b/src/jsc/bindings/webcore/EventTarget.h @@ -117,7 +117,6 @@ class EventTarget : public ScriptWrappable, public CanMakeWeakPtrWithBitFieldisFiringEventListeners; } -inline bool EventTarget::hasEventListeners() const -{ - auto* data = eventTargetData(); - return data && !data->eventListenerMap.isEmpty(); -} - inline bool EventTarget::hasEventListeners(const AtomString& eventType) const { auto* data = eventTargetData(); diff --git a/src/jsc/bindings/webcore/WebSocket.cpp b/src/jsc/bindings/webcore/WebSocket.cpp index b72642deaa80..37838485ac32 100644 --- a/src/jsc/bindings/webcore/WebSocket.cpp +++ b/src/jsc/bindings/webcore/WebSocket.cpp @@ -370,14 +370,6 @@ static String resourceName(const URL& url) return result; } -static String hostName(const URL& url, bool secure) -{ - // ASSERT(url.protocolIs("wss"_s) == secure); - if (url.port() && ((!secure && url.port().value() != 80) || (secure && url.port().value() != 443))) - return makeString(asASCIILowercase(url.host()), ':', url.port().value()); - return url.host().convertToASCIILowercase(); -} - ExceptionOr WebSocket::connect(const String& url, const Vector& protocols, std::optional&& headersInit) { return connect(url, protocols, WTF::move(headersInit), std::nullopt); diff --git a/src/runtime/bake/bake.private.d.ts b/src/runtime/bake/bake.private.d.ts index 1c8649f07bbb..ffb371933606 100644 --- a/src/runtime/bake/bake.private.d.ts +++ b/src/runtime/bake/bake.private.d.ts @@ -2,9 +2,6 @@ * In practice, these strings are the relative file path to the module. */ type Id = string; -/** Index with same usage as `IncrementalGraph(.client).Index` */ -type FileIndex = number; - interface Config { // Server + Client main: Id; @@ -21,11 +18,6 @@ interface Config { version: string; /** If available, this is the Id of `react-refresh/runtime` */ refresh?: Id; - /** - * A list of "roots" that the client is aware of. This includes - * the framework entry point, as well as every client component. - */ - roots: FileIndex[]; /** * If true, the client will receive console logs from the server. */ @@ -56,11 +48,6 @@ declare type UnloadedCommonJS = ( module: import("./hmr-module").HMRModule["cjs"], exports: unknown, ) => unknown; -declare type CommonJSModule = { - id: Id; - exports: any; - require: (id: Id) => unknown; -}; declare const config: Config; diff --git a/src/runtime/bake/client/overlay.ts b/src/runtime/bake/client/overlay.ts index 64757a8f84c2..8af88bc75f63 100644 --- a/src/runtime/bake/client/overlay.ts +++ b/src/runtime/bake/client/overlay.ts @@ -107,8 +107,6 @@ interface RuntimeError { message: string; /** error.stack after remapping */ trace: RemappedFrame[]; - /** When the `fetch` request fails or takes too long */ - remapped: boolean; /** Promise rejection */ async: boolean; @@ -311,7 +309,6 @@ export async function onRuntimeError(err: any, fatal = false, async = false) { name, message, trace, - remapped: true, async, code, }); @@ -321,7 +318,6 @@ export async function onRuntimeError(err: any, fatal = false, async = false) { name, message, trace: parsed, - remapped: false, async, }); } diff --git a/src/runtime/bake/client/websocket.ts b/src/runtime/bake/client/websocket.ts index 854d57d7b47b..bca7be55220f 100644 --- a/src/runtime/bake/client/websocket.ts +++ b/src/runtime/bake/client/websocket.ts @@ -36,8 +36,6 @@ let wait = }) : () => new Promise(done => setTimeout(done, 2_500)); -let mainWebSocket: WebSocketWrapper | null = null; - interface WebSocketWrapper { /** When re-connected, this is re-assigned */ wrapped: WebSocket | null; @@ -102,19 +100,12 @@ export function initWebSocket( close() { closed = true; this.wrapped?.close(); - if (mainWebSocket === this) { - mainWebSocket = null; - } }, [Symbol.dispose]() { this.close(); }, }; - if (mainWebSocket === null) { - mainWebSocket = wsProxy; - } - function onFirstOpen() { console.info("[Bun] Hot-module-reloading socket connected, waiting for changes..."); onStatusChange?.(true); diff --git a/src/runtime/bake/hmr-runtime-server.ts b/src/runtime/bake/hmr-runtime-server.ts index 94d27b70203c..2ac0d6ba62c6 100644 --- a/src/runtime/bake/hmr-runtime-server.ts +++ b/src/runtime/bake/hmr-runtime-server.ts @@ -14,7 +14,6 @@ export type RequestContext = { responseOptions: ResponseInit; streaming: boolean; streamingStarted?: boolean; - renderAbort?: (path: string, params: Record | null) => never; }; // Create the AsyncLocalStorage instance for propagating response options diff --git a/src/runtime/generated_classes.rs b/src/runtime/generated_classes.rs index 69979de0cd28..0faf9a1b9f4f 100644 --- a/src/runtime/generated_classes.rs +++ b/src/runtime/generated_classes.rs @@ -17,7 +17,7 @@ dead_code, // The `${T}__fromJS`/`${T}__create` externs traffic in `*mut ` // where the C++ side stores the value as `void* m_ctx` and never derefs it - // (see ZigGeneratedClasses.h `offsetOfWrapped`). The Rust payload's field + // (see ZigGeneratedClasses.h `wrapped()`). The Rust payload's field // layout is therefore irrelevant to the ABI, but rustc's improper_ctypes // lint recurses into every field. Suppress here rather than forcing every // `m_ctx` payload (and its transitive fields — `JsRef`, `Strong`, …) to be