Repository navigation
Conversation
- bundler/index.mdx: move `outfile` under `compile` in the ESM bytecode
example. A top-level `outfile` is not a BuildConfig key and is ignored.
- bundler/index.mdx: use `text` and `file` in the loader map example.
The `dataurl` and `base64` loaders are accepted but emit an empty
string today, and are not in the `Loader` type.
- test/runtime-behavior.mdx: remove `bun test --hot` and
`bun test --frozen-lockfile`. The test runner only re-runs under
`--watch`, and `--frozen-lockfile` is an install flag. List the
auto-install flags the runtime does read.
- runtime/sql.mdx: the Postgres user variable is `PGUSER` (also
`PG_USER`, then `USER`). `PGUSERNAME` and `USERNAME` are never read.
Document the `PG_*` aliases for the other rows.
- guides/binary: `blob.stream(1024)` does not set a 1024-byte chunk size
and does not type-check. Show manual chunking instead.
- guides/runtime/import-{json5,yaml,xml}.mdx: `parse()` returns
`unknown` (or `XML.Document`), so the property accesses on the next
lines did not type-check. Cast the result to the expected shape.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. WalkthroughChangesDocumentation updates
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The updated examples and reference material correct documented runtime behavior without introducing an identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
Updated 7:42 AM PT - Sep 9th, 2026
✅ @robobun, your commit cfe059c818cd17cddeb05dae0289d5478816c04b passed in 🧪 To try this PR locally: bunx bun-pr 41734That installs a local version of the PR into your bun-41734 --bun |
|
Status: ready for review. Docs-only change, no build needed. How each row was verified on 1.4.3 canary (d316760):
|
There was a problem hiding this comment.
LGTM — thanks for fixing the chunk-size examples; the 64 KB / 16 KB split now demonstrates actual chunking. The open PASSWORD note on the Postgres table is optional and non-blocking.
What was reviewed:
- Re-checked both ReadableStream guides after 8ccfbfe: 64 KB buffer with 16 KB slices yields four enqueues, loop terminates and closes.
- Postgres env-var precedence against
src/js/internal/sql/shared.ts—PG_*beforePG*andUSERfallback are accurate as documented. Bun.buildcompile.outfileplacement,--hot/--frozen-lockfileremoval, and theunknownreturn-type casts onJSON5/YAML/XML.parse— each matches current source and types.
Extended reasoning...
Overview
This is a docs-only correction pass across eight .mdx files that fixes examples which do not run or type-check on current Bun: moving outfile under compile in the ESM-bytecode Bun.build snippet, swapping the loader example off dataurl (which currently emits an empty string), replacing the removed Blob.stream(chunkSize) overload with a manual ReadableStream that enqueues .subarray() slices, adding as casts to the Bun.JSON5/YAML/XML.parse() guides so they type-check against the unknown/generic-document return types, correcting the Postgres env-var table (PGUSER not PGUSERNAME, PG_* aliases, precedence note), and removing bun test --hot/--frozen-lockfile from the runtime-behavior page in favor of the auto-install flags the runtime actually reads.
Security risks
None. The diff touches only rendered documentation under docs/; no source, build config, CI, or type declarations are modified. The examples are illustrative snippets with no credential-shaped literals or unsafe patterns introduced.
Level of scrutiny
Low-to-moderate, per .claude/docs/landing-prs.md "Docs, types, and comments": the bar is that every published claim is verifiable against the implementation and every snippet runs as written. I previously left two optional inline comments; commit 8ccfbfe addressed the chunk-size one (both guides now use a 64 KB buffer with 16 KB chunks, so the loop visibly produces four slices). The other — the Postgres table omitting the PASSWORD fallback that shared.ts:1974 reads — remains open but is an optional completeness nit; the rewritten table is still strictly more accurate than the base version, which listed nonexistent PGUSERNAME/USERNAME.
Other factors
Exit reason was dry_streak, so the hunt completed without new findings. CODEOWNERS has no entry for docs/, and there are no outstanding CHANGES_REQUESTED reviews from other reviewers in the timeline. The Postgres precedence claim ("PG_* wins over PG*") matches env.PG_PASSWORD || env.PGPASSWORD || ... ordering in src/js/internal/sql/shared.ts. Given the change is mechanical, self-contained, and the one remaining note is non-blocking, approving is appropriate.
Bun.build reads outfile only inside the compile options object (CompileOptions::from_js in src/runtime/api/JSBundler.rs). A top-level outfile is ignored. Update the outfile and write rows to say so.
There was a problem hiding this comment.
LGTM — the follow-up commits addressed the chunk-size example and the new esbuild.mdx rows check out against source.
What was reviewed:
outfilein the JS API table:CompileOptions::from_js(src/runtime/api/JSBundler.rs:282-296, 405) readsoutfilefrom thecompilesub-object only, andbun-typesdeclares it onCompileBuildOptions(bun.d.ts:3682) — top-levelBun.build({ outfile })is indeed ignored.- Chunk-size examples now use 64 KB data with 16 KB chunks, so the loop demonstrably produces four slices.
- The earlier optional note about the
PASSWORDenv fallback (shared.ts:1974) still stands but is a completeness nit, not a correctness error in what's documented.
Extended reasoning...
Overview
Docs-only accuracy sweep across nine .mdx pages. Since the last review round, one new commit (cfe059c8) landed, updating two rows in the docs/bundler/esbuild.mdx JavaScript API comparison table: outfile is now marked "n/a / Not supported" for Bun.build() (pointing to outdir + naming or compile.outfile), and the write row drops the outfile reference. The earlier commit 8ccfbfe9 addressed the chunk-size feedback by bumping the sample buffers to 64 KB with a 16 KB chunk size in both buffer-to-readablestream.mdx and typedarray-to-readablestream.mdx.
Security risks
None. Documentation only; no runtime code, types, build configuration, or CI changes. No security-adjacent examples were introduced.
Level of scrutiny
Low-to-moderate, per the "Docs, types, and comments" guidance: verify claims against the implementation on main. I traced the new outfile claim through src/runtime/api/JSBundler.rs — CompileOptions::from_js binds object to the compile sub-value (line 296) before reading "outfile" at line 405, and the top-level Config::from_js (line 447 onward) has no outfile read. packages/bun-types/bun.d.ts places outfile?: string on CompileBuildOptions (line 3682), not BuildConfig. The write row change is a direct consequence. The CLI table (separate section, untouched) still documents --outfile, which is correct since the CLI does accept it — the change is properly scoped to the JS API table.
Other factors
No CODEOWNERS entry covers docs/. No third-party CHANGES_REQUESTED reviews are outstanding. The one prior optional finding not acted on — the PGPASSWORD row omitting the PASSWORD generic-env fallback that shared.ts:1974 reads — was already posted, is a minor completeness gap (the documented vars are all correct), and doesn't warrant blocking a docs-accuracy PR. Exit reason was dry_streak with zero findings this run.
Problem
outfiletoBun.build, which is not aBuildConfigkey. It is ignored, theindexto folder-name fallback runs, and the build fails withfailed to rename ... ENOTEMPTY.docs/test/runtime-behavior.mdxdocumentsbun test --hotandbun test --frozen-lockfile. The test runner only re-runs under--watch(test_command.rs:2653), and--frozen-lockfileis an install-family flag. Both run once and exit 0 with no signal.docs/runtime/sql.mdxlistsPGUSERNAMEwith fallbacksUSER,USERNAME. The adapter readsPG_USER || PGUSER || USER(src/js/internal/sql/shared.ts:1956). Two guides callblob.stream(1024)to set a chunk size, which neither type-checks (TS2554) nor changes the chunk size. Three guides read.nameoffJSON5.parse/YAML.parse/XML.parse, which returnunknown/XML.Document(TS2339).Fix
outfileundercompile: { outfile }, the formdocs/bundler/executables.mdxalready uses. Swap the loader map example totext/file(see Notes ondataurl).docs/bundler/esbuild.mdxmigration table, markoutfileas not supported and drop it from thewriterow (folded in from docs: put outfile under compile in the Bun.build bytecode example #37473). Probe on 1.4.3:Bun.build({ entrypoints: ["./in.js"], outfile: "./named.js" })returnsoutputsof["./in.js"]and writes nonamed.js.compile: truewith nooutdirstill writes the executable to disk.--hotand--frozen-lockfilelines. List the auto-install flags the runtime reads (--prefer-offline,--install=fallback,--no-install).PGUSERand add thePG_*aliases. Replaceblob.stream(1024)with manual chunking. Cast theparse()results to the expected shape.packages/bun-types, and runs with the stated output.prettier --checkpasses on the touched files.Background
Bun.buildreadsoutfileonly inside thecompileobject (src/runtime/api/JSBundler.rs:405).bun-typesdeclares it only onCompileBuildOptions.bun testshares the runtime argument table, so--hotparses. The test command installs aHotReloaderbut only enters the watch loop forHotReload::Watch.Notes
dataurl/base64loaders: accepted by the CLI,Bun.build, and bunfig, butParseTask.rsreturns an empty-string lazy export for them (var a_default = "";). bundler: implement dataurl and base64 loaders #36327 implements them and adds"dataurl"to theLoaderunion. Until that lands the docs example should not use them, so this PR swaps the example rather than touching types.Loaderunion gaps (json5,md, and others) are covered by bun-types: add json5 and md to the Loader union, document both loaders #38267 and bundler: honor jsonc and sqlite_embedded in loader maps, accept every loader name in Bun.build #38247.Blob.prototype.stream(n):Blob.rsstill parses the argument andByteBlobLoaderrecords it, butmaterializeNativeSourcetakesmax(chunkSize, 256 KiB), so any value below 256 KiB has no effect.bun-typesremoved the parameter in Better types #7670. The guides now match the types.JSON5.parse/YAML.parsereturningunknownis deliberate (addBun.YAML.parseto types #22129, feat: add native JSON5 parser (Bun.JSON5) #26439). The guides cast instead of loosening the types.--frozen-lockfileline gave no error.no test proof · iteration 0 · docs-only change; test-proof not applicable