Repository navigation
Conversation
WalkthroughLarge-scale repository reorganization: files and imports moved from Changes
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (2 passed)
Comment |
Step 1 of source reorganization - rename the JavaScript runtime directory from bun.js to buntime for better discoverability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 2 of source reorganization - move js_parser, js_lexer, js_printer, and transpiler files to src/transpiler/ directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 3 of source reorganization - move test runner files from src/buntime/test/ to src/test_runner/ for better discoverability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 4.1 of source reorganization - move console-related files: - ConsoleObject.cpp/h - UtilInspect.cpp/h - ConsoleObject.zig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 4.2 of source reorganization - move inspector-related files: - BunInspector.cpp - InspectorBunFrontendDevServerAgent.cpp/h - InspectorHTTPServerAgent.cpp/h - InspectorLifecycleAgent.cpp/h - InspectorTestReporterAgent.cpp/h 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 4.3 of source reorganization - move error-related files: - DeferredError.zig - ErrorCode.cpp/h/ts/zig - ErrorStackFrame.cpp/h - ErrorStackTrace.cpp/h - Errorable.zig - JSErrorCode.zig - SystemError.zig - ZigErrorType.zig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Step 4.4 of source reorganization - move cookie-related files: - JSCookie.cpp/h - JSCookieMap.cpp/h 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move domain-specific files from bindings/ to api/ subdirectories: - api/s3/: S3 client and error handling - api/secrets/: Platform secrets management - api/ffi/: Foreign Function Interface - api/sqlite/: SQLite bindings (moved from bindings/sqlite/) - api/sql/: SQL client - api/shell/: Shell bindings - api/ipc/: IPC bindings - api/test/: Testing utilities - api/server/: HTTP server bindings - api/plugin/: Bundler plugin system Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move v8 directory from bindings/ to compat/v8/ for better organization of compatibility layers. Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move webcrypto directory from bindings/ to webcore/webcrypto/ for better organization of web-related APIs. Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Consolidate node compatibility files: - Move node C++ files from bindings/node/ to buntime/node/ - Rename bindings/node/crypto to node/crypto_bindings for clarity - Move webcrypto from bindings/ to webcore/webcrypto/ - Update cmake include paths and source patterns Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move bindings/libuv/ to compat/libuv/ for libuv compatibility layer - Move bindings/webcore/ to webcore/ (438 files) - Update all include paths for webcore/ prefix removal - Fix relative includes in webcrypto files Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move napi files from bindings/ to compat/napi/ - Move module loader files from bindings/ to module/ - InternalModuleRegistry, JSModuleLoader, JSCommonJSModule, etc. - Update all import paths and cmake configurations Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move process-related files from bindings/ to api/process/: - BunProcess, ProcessBindingBuffer, ProcessBindingConstants - ProcessBindingFs, ProcessBindingHTTPParser, ProcessBindingNatives - ProcessBindingTTYWrap, ProcessBindingUV, ProcessIdentifier - bun-spawn Part of source code reorganization to make code location "guessable". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move BunClientData, BunCommonStrings, BunGCOutputConstraint, BunGlobalScope, BunIDL*, BunJSCEventLoop, BunObject, BunString, and BunWorkerGlobalScope from bindings/ to core/. This makes the purpose of these files clearer - they are core Bun runtime infrastructure rather than JavaScript bindings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move FetchHeaders, FetchTasklet, HTTPHeader*, JSFetchHeaders, NodeFetch, Undici, and fetch.zig from bindings/ and webcore/ to web/fetch/. This groups all fetch-related functionality in one directory for easier navigation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move DOMURL, URLSearchParams, URLPattern*, EncodeURIComponent, decodeURIComponentSIMD, ObjectURLRegistry, NodeURL and related files from bindings/ and webcore/ to web/url/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move blob.cpp, DOMFormData, JSDOMFile, and JSDOMFormData from bindings/ and webcore/ to web/blob/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move Base64Helpers, TextCodec*, TextEncoder*, TextDecoder*, EncodingLabel, encoding.zig and related files from bindings/ and webcore/ to web/encoding/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move JSCompressionStream and JSDecompressionStream from bindings/ to web/compression/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move Event*, MessagePort*, BroadcastChannel*, AbortSignal, EventTarget, EventEmitter, JS* event files from bindings/ and webcore/ to web/events/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move ReadableStream, WritableStream, TransformStream, Sink, FileSink, ByteStream, ResumableSink, JS* stream files from webcore/ to web/streams/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move Response.zig, Request.zig, Body.zig, BakeResponse.zig, and response.classes.ts from webcore/ to web/http/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move Blob.zig, ByteBlobLoader.zig and blob/ subdirectory files from webcore/ to web/blob/. Update relative imports for env.zig, S3File.zig, and Store/read_file/write_file/copy_file references. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move 60 performance-related files from webcore/ to web/performance/. Includes Performance API, PerformanceObserver, Timing, Marks, Measures, ResourceTiming, ServerTiming, and NetworkLoadMetrics. Added JSDOMWrapperCache.h include to JSPerformanceEntryCustom.cpp. Updated cmake/Sources.json and cmake/targets/BuildBun.cmake. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move 8 WebSocket-related files from webcore/ to web/websocket/. Includes WebSocket core, JSWebSocket bindings, and helpers. Updated cmake/Sources.json and cmake/targets/BuildBun.cmake. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move S3Client.zig, S3File.zig, S3Stat.zig from webcore/ to api/s3/. Update imports in webcore.zig and Blob.zig. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Script caching belongs with module loading infrastructure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
bmalloc and mimalloc integration belongs in core infrastructure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
String adaptors and utilities belong in core infrastructure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move StringAdaptors.h, MiString.h, and ConcatCStrings.h to the existing src/string/ directory where other string utilities live. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Debugger helpers belong with inspector/profiling code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Generic tuple algorithms belong in core utilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…e to module/ Move module loading related files to the module/ subdirectory: - ModuleLoader.zig - AsyncModule.zig - RuntimeTranspilerStore.zig - RuntimeTranspilerCache.zig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
These are JSC reference management utilities that belong with other bindings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Event loop is core runtime infrastructure that belongs in the core/ directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move RefString.zig, array_buffer.zig, dom_call.zig, host_fn.zig to bindings/ since they are JSC binding utilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
These are core runtime infrastructure files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move bindgen.zig, bindgen_test.zig, javascript_core_c_api.zig to bindings/ since they are all binding-related files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
These are core runtime infrastructure files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
According to PLAN.md, webcrypto should be under web/ as a Web Standard API, not under webcore/ which is for core JSDOM infrastructure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move string-related C++ files per PLAN.md section 4.80: - bun-simdutf.cpp, bun-simdutf.zig - BunString.cpp, BunString.h - BunCommonStrings.cpp, BunCommonStrings.h - DoubleFormatter.cpp - highway_strings.cpp - StringBuilderBinding.cpp - stripANSI.cpp, stripANSI.h 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Per PLAN.md section 4.90, this bundler-related file belongs in bake/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move bindings/ directory to jsc/ with the following organization: - jsc/types/ - JSValue types (JSArray, JSObject, JSPromise, etc.) - jsc/global/ - Global objects (ZigGlobalObject, ScriptExecutionContext, etc.) - jsc/gc/ - GC-related files (StrongRef, Weak, MarkingConstraint, etc.) - jsc/interop/ - C++/Zig interop (bindings.cpp, helpers.cpp, etc.) - jsc/generated/ - Generated code (GeneratedBindings, JS2Native, etc.) Also: - Move uv polyfills to compat/libuv/ - Move v8 fixture to compat/v8/ - Move Windows files to compat/windows/ - Move bindgen_test.bind.ts to jsc/interop/ - Update cmake Sources.json and BuildBun.cmake for new paths - Update codegen scripts to generate correct relative import paths - Fix Zig imports throughout the codebase 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move all JSDOM infrastructure from webcore/ to jsc/interop/: - ActiveDOMObject, ContextDestructionObserver - JSDOMConvert*, JSDOMPromise, JSDOMIterator - JSDOMWrapper*, JSDOMConstructor*, JSDOMBuiltin* - DOMJITHelpers, DOMIsoSubspaces, DOMClientIsoSubspaces - WebCoreTypedArrayController, BufferSource - All other JSDOM binding utilities Also: - Move AutoFlusher.zig to jsc/interop/ - Move ScriptExecutionContext.zig to jsc/global/ - Update cmake Sources.json to remove webcore/ glob - Fix missing JSDOMGlobalObject.h include in JSPerformanceObserverCallback.h - Fix JSC::JSValue qualification in JSAbortAlgorithm.h The webcore/ directory is now fully dissolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move C++ files from node/ root into organized subdirectories: - node/buffer/ - Buffer and StringDecoder - node/process/ - NextTickQueue - node/vm/ - VM, VMScript - node/crypto/ - All crypto bindings (renamed from crypto_bindings/) - node/http/ - HTTP server socket, NodeHTTP - node/fs/ - Dirent, stat bindings - node/os/ - OsBinding - node/path/ - Path utilities - node/util/ - NodeValidator - node/timers/ - Timer objects - node/async_hooks/ - AsyncContextFrame, AsyncHooks - node/perf_hooks/ - Performance histogram - node/constants/ - NodeConstants Also moves global scope files to jsc/global/: - BunGlobalScope, BunObject, BunWorkerGlobalScope - ZigSourceProvider Updates cmake Sources.json and BuildBun.cmake with new paths. Fixes include paths in NodeBufferModule.h and NodeStringDecoderModule.h. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Per PLAN.md's Final Structure, event_loop should be at the buntime/ root level. This move: - Moves the event_loop directory from core/event_loop/ to buntime/event_loop/ - Moves event_loop.zig and related C++ files (EventLoopTask.h, EventLoopTaskNoContext.cpp/h, BunJSCEventLoop.cpp) - Updates imports in jsc.zig, GeneratedJS2Native.zig, rare_data.zig - Fixes relative paths in event_loop.zig and Task.zig - Updates cmake Sources.json and BuildBun.cmake with new paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Move remaining core/ files to organized jsc/ subdirectories: - BunClientData, BunIDL*, CPUFeatures, JSCTaskScheduler, coroutine → jsc/interop/ - BunGCOutputConstraint, MimallocWTFMalloc.h, bmalloc_heap_ref.h → jsc/gc/ - RegularExpression → jsc/types/ Fix outdated file paths in documentation: - STREAMS.md: webcore/ → web/streams/ - event_loop/README.md: bindings/JSNextTickQueue → node/process/ - compat/v8/CLAUDE.md and AGENTS.md: bindings/v8/ → compat/v8/ - node/http/llhttp/README.md: bindings/ProcessBindingHTTPParser → api/process/ Fix cmake BuildBun.cmake issues: - Remove duplicate directory entries in BUN_ERROR_CODE_SOURCES - Remove directory (not file) arguments from WEBKIT_ADD_SOURCE_DEPENDENCIES Update Zig imports for moved files in jsc.zig and crash_handler.zig. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Rename files in src/transpiler/ to have consistent js_ prefix: - parser.zig → js_parser.zig - printer.zig → js_printer.zig - lexer.zig → js_lexer.zig - lexer_tables.zig → js_lexer_tables.zig Update all imports across the codebase: - bun.zig - renamer.zig - ast.zig - ast/Expr.zig - logger.zig - string/MutableString.zig - bundler/bundle_v2.zig - bundler/LinkerContext.zig - transpiler/js_lexer.zig (internal import) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Completely rewrite the Code Architecture section to reflect the reorganized source structure. Now includes: - Quick-reference table mapping tasks to directories - Full directory tree showing the organized buntime/ structure - Updated paths (src/buntime/ instead of src/bun.js/) - Removed references to dissolved directories (bindings/, webcore/) The goal: Claude should be able to GUESS where code lives. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2c97696 to
e48a998
Compare
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| ``` | ||
| src/ | ||
| ├── transpiler/ # JS/TS transpiler (js_parser, js_lexer, js_printer) | ||
| ├── test_runner/ # bun:test implementation | ||
| ├── bundler/ # bun build | ||
| ├── resolver/ # Module resolution | ||
| ├── install/ # Package manager (bun install) | ||
| ├── css/ # CSS parser | ||
| ├── shell/ # Bun.$ shell | ||
| ├── bake/ # Bake framework | ||
| ├── sql/ # SQL clients (postgres/, mysql/) | ||
| ├── s3/ # S3 core | ||
| ├── valkey/ # Valkey/Redis | ||
| ├── http/ # HTTP client | ||
| ├── string/ # String utilities | ||
| ├── ast/ # AST types | ||
| ├── js/ # TypeScript built-in modules | ||
| │ | ||
| └── buntime/ # JavaScript runtime | ||
| ├── api/ # Bun.* APIs | ||
| │ ├── server/ # Bun.serve() | ||
| │ ├── console/ # console.* | ||
| │ ├── inspector/ # Debugger, profiler | ||
| │ ├── error/ # Error handling, stack traces | ||
| │ ├── cookie/ # Cookie parsing | ||
| │ ├── s3/ # S3 JS bindings | ||
| │ ├── ffi/ # Bun.FFI | ||
| │ ├── sqlite/ # bun:sqlite | ||
| │ ├── sql/ # SQL bindings | ||
| │ ├── shell/ # Shell bindings | ||
| │ ├── ipc/ # IPC | ||
| │ ├── plugin/ # Bundler plugins | ||
| │ ├── secrets/ # Secrets API | ||
| │ └── test/ # Test helpers | ||
| │ | ||
| ├── web/ # Web Standards | ||
| │ ├── fetch/ # Fetch API | ||
| │ ├── url/ # URL, URLSearchParams | ||
| │ ├── blob/ # Blob, File, FormData | ||
| │ ├── encoding/ # TextEncoder/Decoder | ||
| │ ├── compression/ # CompressionStream | ||
| │ ├── events/ # EventTarget, CustomEvent | ||
| │ ├── streams/ # ReadableStream, WritableStream | ||
| │ ├── performance/ # Performance API | ||
| │ ├── websocket/ # WebSocket | ||
| │ └── webcrypto/ # crypto.subtle | ||
| │ | ||
| ├── node/ # Node.js Compatibility | ||
| │ ├── buffer/ # Buffer | ||
| │ ├── process/ # process.* | ||
| │ ├── vm/ # node:vm | ||
| │ ├── crypto/ # node:crypto | ||
| │ ├── http/ # node:http | ||
| │ ├── fs/ # node:fs helpers | ||
| │ ├── os/ # node:os | ||
| │ ├── path/ # node:path | ||
| │ ├── util/ # node:util | ||
| │ ├── timers/ # Timers | ||
| │ ├── async_hooks/ # AsyncLocalStorage | ||
| │ ├── perf_hooks/ # Performance hooks | ||
| │ └── constants/ # Constants | ||
| │ | ||
| ├── compat/ # Native Addon Compatibility | ||
| │ ├── napi/ # N-API | ||
| │ ├── v8/ # V8 C++ API | ||
| │ ├── libuv/ # libuv polyfills | ||
| │ └── windows/ # Windows-specific | ||
| │ | ||
| ├── jsc/ # JavaScriptCore Integration | ||
| │ ├── types/ # JSValue, JSString, JSArray, etc. | ||
| │ ├── global/ # ZigGlobalObject, BunGlobalScope | ||
| │ ├── gc/ # GC helpers, weak refs | ||
| │ ├── interop/ # C++/Zig bindings, IDL | ||
| │ └── generated/ # Generated bindings | ||
| │ | ||
| ├── module/ # Module system (CommonJS, ESM) | ||
| ├── event_loop/ # Event loop, tasks, timers | ||
| └── core/ # VirtualMachine, config | ||
| ``` |
There was a problem hiding this comment.
Add languages to new fenced code blocks to satisfy markdownlint
markdownlint is flagging several of the newly-added fenced blocks (directory tree and command snippets) for missing languages (MD040). To keep docs lint‑clean and improve rendering, consider:
- Using
```text(or```plaintext) for the directory tree under “Top-Level Source Organization”. - Using
```bashfor shell command examples (e.g., thebun bdverification snippet). - Using an appropriate language (e.g.,
```zig) if you later add Zig examples to these sections.
This is purely documentation hygiene; structure and content look good.
Also applies to: 220-229
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
164-164: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
176-176: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
185-185: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
196-196: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
208-208: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In CLAUDE.md around lines 140-218 (and also lines 220-229), the newly added
fenced code blocks lack language tags which triggers markdownlint MD040; update
the blocks by adding appropriate language identifiers — use ```text or
```plaintext for the directory tree block, use ```bash for any shell/command
snippets (e.g., bun bd verification), and use ```zig (or another specific
language) if you later add Zig examples — apply these changes to each offending
fenced block in the specified ranges.
| ${CWD}/src/buntime/bindings/*.h | ||
| ${CWD}/src/buntime/modules/*.h |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Confirm clang-format header coverage after tree move
BUN_H_SOURCES now globs only:
src/buntime/bindings/*.hsrc/bruntime/modules/*.h
This matches the new layout, but any headers in other new trees (e.g. api/, jsc/, compat/, etc.) will not be picked up by clang-format via this target. Please double‑check that these are the only header roots you intend to format here, or expand the glob patterns if more .h locations exist.
🤖 Prompt for AI Agents
In cmake/analysis/RunClangFormat.cmake around lines 4-5, the current globs only
include ${CWD}/src/buntime/bindings/*.h and ${CWD}/src/buntime/modules/*.h which
will miss headers moved into other roots (api/, jsc/, compat/, etc.); verify the
full set of header root directories that should be formatted and either add
explicit glob entries for each missing root (for example api/**/*.h, jsc/**/*.h,
compat/**/*.h) or broaden the pattern (e.g., src/**/*.h) to cover all expected
.h locations, ensuring the paths match the actual directory names in the tree.
| | "Fix Postgres" | `src/sql/postgres/` | | ||
| | "Fix MySQL" | `src/sql/mysql/` | | ||
| | "Fix Valkey/Redis" | `src/valkey/` | | ||
| | "Fix S3" | `src/s3/` (core) or `buntime/api/s3/` (JS bindings) | | ||
| | "Fix Bake" | `src/bake/` | | ||
| | "Fix Bun.serve()" | `src/buntime/api/server/` | | ||
| | "Fix fetch()" | `src/buntime/web/fetch/` | |
There was a problem hiding this comment.
Tighten a couple of path references for consistency in the plan
- In the “Fix S3” row, all other locations are rooted at
src/…, but the second location isbuntime/api/s3/. Consider making itsrc/buntime/api/s3/so it visually matches the rest of the table and CLAUDE.md. - In the “Don’t Forget” section,
bun-spawn.cpp, spawn.cpp → api/bun/spawn/doesn’t correspond to a documented subdirectory in thebuntime/apitree above. If the intent is to eventually havesrc/buntime/api/bun/spawn/, it may help to spell that out explicitly; otherwise, rephrase to match the actual destination directory name you plan to use.
Also applies to: 1107-1112
🤖 Prompt for AI Agents
In PLAN.md around lines 15 to 21 (and also apply same change to lines 1107 to
1112), tighten path references for consistency by changing the “Fix S3” second
location from buntime/api/s3/ to src/buntime/api/s3/ so it matches the other
src/... roots and CLAUDE.md, and update the “Don’t Forget” entry mapping
bun-spawn.cpp, spawn.cpp → api/bun/spawn/ to the explicit intended destination
(for example src/buntime/api/bun/spawn/) or rephrase it to match the actual
directory you plan to use; make the edits so all table rows and the “Don’t
Forget” line use consistent src/ rooted paths and accurate target directories.
| #include <JavaScriptCore/StructureCache.h> | ||
|
|
||
| #include <webcore/SerializedScriptValue.h> | ||
| #include "SerializedScriptValue.h" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if SerializedScriptValue.h exists and where it's located
find . -name "SerializedScriptValue.h" -type f 2>/dev/nullRepository: oven-sh/bun
Length of output: 110
🏁 Script executed:
# Check the BunProcess.cpp file, specifically lines 50-55 and around line 208
wc -l src/buntime/api/process/BunProcess.cppRepository: oven-sh/bun
Length of output: 98
🏁 Script executed:
# If it's not too large, read the relevant sections
head -220 src/buntime/api/process/BunProcess.cpp | tail -175Repository: oven-sh/bun
Length of output: 6683
🏁 Script executed:
# Check for llhttp directory structure
find . -type d -name "llhttp" 2>/dev/null | head -20Repository: oven-sh/bun
Length of output: 85
🏁 Script executed:
# Look for CMakeLists.txt files that might configure include directories
find . -name "CMakeLists.txt" -type f 2>/dev/null | grep -E "(api|process)" | head -10Repository: oven-sh/bun
Length of output: 94
🏁 Script executed:
# Find CMakeLists.txt near BunProcess.cpp
find ./src/buntime/api -name "CMakeLists.txt" -type fRepository: oven-sh/bun
Length of output: 94
🏁 Script executed:
# Check if there's a CMakeLists.txt in the process directory
find ./src/buntime/api/process -type f | head -20Repository: oven-sh/bun
Length of output: 1052
🏁 Script executed:
# Search for how the include directories are set up - look for files that might include BunProcess
rg "BunProcess.cpp" --type cmakeRepository: oven-sh/bun
Length of output: 131
🏁 Script executed:
# Verify the exact line 208 to confirm the comment
sed -n '205,210p' src/buntime/api/process/BunProcess.cppRepository: oven-sh/bun
Length of output: 644
🏁 Script executed:
# Check if README.md exists at the current path vs old path
ls -la ./src/buntime/node/http/llhttp/README.md 2>/dev/null || echo "File not found at current path"
ls -la ./src/buntime/bindings/node/http/llhttp/README.md 2>/dev/null || echo "File not found at old path"Repository: oven-sh/bun
Length of output: 170
🏁 Script executed:
# Check the BuildBun.cmake file to see how include directories are set
grep -A 20 -B 5 "BunProcess.cpp" cmake/targets/BuildBun.cmake | head -50Repository: oven-sh/bun
Length of output: 1110
🏁 Script executed:
# Look for include_directories or target_include_directories in BuildBun.cmake that might handle SerializedScriptValue.h
rg "include_directories|target_include_directories" cmake/targets/BuildBun.cmake -A 3 | head -60Repository: oven-sh/bun
Length of output: 730
🏁 Script executed:
# Search for where SerializedScriptValue.h include paths are configured
rg "SerializedScriptValue" . --type cmakeRepository: oven-sh/bun
Length of output: 37
🏁 Script executed:
# Check if there's a CMakeLists.txt that might set up include paths for src/buntime/api/process
find ./src/buntime -name "CMakeLists.txt" | xargs grep -l "api/process" 2>/dev/nullRepository: oven-sh/bun
Length of output: 39
🏁 Script executed:
# Look for any include path configurations for web/serialization
rg "web/serialization|web.*include" . --type cmake | head -20Repository: oven-sh/bun
Length of output: 124
🏁 Script executed:
# Verify the exact include directory configuration in BuildBun.cmake for web/serialization
grep -B 5 -A 5 "src/buntime/web/serialization" cmake/targets/BuildBun.cmakeRepository: oven-sh/bun
Length of output: 371
🏁 Script executed:
# Check if there are any other references to the old bindings path in comments
rg "bindings/node/http/llhttp" . --type cpp --type cmake | head -20Repository: oven-sh/bun
Length of output: 168
🏁 Script executed:
# Verify that the new llhttp path matches the directory structure
ls -la ./src/buntime/node/http/llhttp/ | head -20Repository: oven-sh/bun
Length of output: 524
Fix stale llhttp README path in comment at line 208
The comment references src/buntime/bindings/node/http/llhttp/README.md, but the file is now at src/buntime/node/http/llhttp/README.md. Update the comment to point to the correct location.
The #include "SerializedScriptValue.h" at line 52 is correct; the directory src/buntime/web/serialization is explicitly in the CMake include path for this target.
🧰 Tools
🪛 Cppcheck (2.19.0)
[information] 52-52: Include file
(missingInclude)
🤖 Prompt for AI Agents
In src/buntime/api/process/BunProcess.cpp around lines 52-52, leave the #include
"SerializedScriptValue.h" unchanged (it's correct), but update the stale comment
at line ~208 that references src/buntime/bindings/node/http/llhttp/README.md to
the new path src/buntime/node/http/llhttp/README.md; open the file, locate the
comment at line 208, replace the old path with the new one, and save the file.
| #define UV_PLATFORM_LOOP_FIELDS \ | ||
| int fs_fd; | ||
|
|
||
| #define UV_PLATFORM_FS_EVENT_FIELDS \ | ||
| uv__io_t event_watcher; \ | ||
| char *dir_filename; \ | ||
| #define UV_PLATFORM_FS_EVENT_FIELDS \ | ||
| uv__io_t event_watcher; \ | ||
| char* dir_filename; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Style‑only edits in vendored libuv header
These changes are purely formatting/pointer‑style; the macros still expand identically and won’t affect behavior. To keep future libuv updates straightforward, consider avoiding style‑only edits in vendored headers unless you’re standardizing on a repo‑wide C style here.
🤖 Prompt for AI Agents
In src/buntime/compat/libuv/uv/aix.h around lines 25 to 30, the PR contains
style-only edits to macro formatting/pointer style in vendored libuv headers;
revert these changes so the macros exactly match the upstream libuv file
(restore original whitespace and pointer style for UV_PLATFORM_LOOP_FIELDS and
UV_PLATFORM_FS_EVENT_FIELDS) and avoid touching other vendored headers unless
you intend a repo-wide C style standardization and provide a separate, tracked
change for that.
|
Closing this PR because it has been inactive for more than 90 days. |
Summary
This PR reorganizes the Bun source code to make file locations guessable. The goal: Claude (or any developer) should be able to guess where code lives without searching.
Key Changes
src/bun.js/→src/buntime/- More intuitive name for the JavaScript runtimesrc/transpiler/- Moved JS/TS transpiler (parser, lexer, printer) from rootsrc/test_runner/- Moved test runner from buntime/test/bindings/- Split ~150 files into domain-specific directorieswebcore/- Moved to appropriateweb/subdirectoriesnode/- Created subdirectories for buffer, process, vm, crypto, etc.jsc/- Organized JSC integration into types/, global/, gc/, interop/, generated/compat/- Grouped napi/, v8/, libuv/, windows/event_loop/- Now at buntime/ root levelNew Directory Structure
Guessability Table
src/transpiler/src/buntime/api/server/src/buntime/web/fetch/src/buntime/node/crypto/src/buntime/compat/napi/src/buntime/compat/v8/Stats
Test plan
bun bdbuilds successfully🤖 Generated with Claude Code