Skip to content

Conversation

@robobun
Copy link
Collaborator

@robobun robobun commented Dec 31, 2025

Summary

  • Documents configuration fields that exist in bunfig.zig but were missing from the docs
  • Adds new sections for [serve] and [bundle] that were entirely undocumented
  • Adds missing options for existing sections ([test], [install], [run])

New fields documented:

Top-level runtime:

  • origin - Origin URL for the application
  • macros - Enable/disable macros
  • external - Modules to exclude from bundling

New [serve] section:

  • serve.port - Dev server port
  • serve.static.plugins - Plugins to load
  • serve.static.hmr - Hot Module Replacement toggle
  • serve.static.minify - Minification settings
  • serve.static.define - Define constants for dev server
  • serve.static.publicPath - Public path for assets
  • serve.static.env - Environment variable handling

[test]:

  • test.coverageIgnoreSourcemaps - Ignore sourcemaps when computing coverage

[install]:

  • install.concurrentScripts - Number of concurrent lifecycle scripts
  • install.ignoreScripts - Skip lifecycle scripts
  • install.prefer - Resolution mode (online/offline/latest)
  • install.logLevel - Log level for package installation
  • install.lockfile.path - Custom path to read lockfile from
  • install.lockfile.savePath - Custom path to save lockfile to
  • install.hoistPattern - Glob patterns for hoisting (pnpm-style)
  • install.publicHoistPattern - Glob patterns for public hoisting

[run]:

  • run.elide-lines - Lines to elide in error output

New [bundle] section:

  • bundle.entryPoints - Entry points for bundling
  • bundle.outdir - Output directory
  • bundle.logLevel - Log level for bundler
  • bundle.packages - Per-package bundling configuration

Test plan

  • Reviewed src/bunfig.zig to identify all configuration fields
  • Cross-referenced with existing documentation
  • Added documentation for missing fields with appropriate examples

🤖 Generated with Claude Code

@robobun
Copy link
Collaborator Author

robobun commented Dec 31, 2025

Updated 5:58 AM PT - Dec 31st, 2025

✅ Your commit 3b9951c has passed in Build #33926! 🎉


🧪   To try this PR locally:

bunx bun-pr 25784

That installs a local version of the PR into your bun-25784 executable, so you can run:

bun-25784 --bun

Documents configuration fields that exist in bunfig.zig but were missing from
the docs, including:

- Top-level: origin, macros, external
- New [serve] section: port, static.plugins, static.hmr, static.minify,
  static.define, static.publicPath, static.env
- [test]: coverageIgnoreSourcemaps
- [install]: concurrentScripts, ignoreScripts, prefer, logLevel,
  lockfile.path, lockfile.savePath, hoistPattern, publicHoistPattern
- [run]: elide-lines
- New [bundle] section: entryPoints, outdir, logLevel, packages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Walkthrough

Adds extensive bunfig.toml documentation in a single file, introducing new sections and examples for macros, serve, test, install, run, and bundle configuration options without changing code or exports. (47 words)

Changes

Cohort / File(s) Summary
Configuration docs
docs/runtime/bunfig.mdx
Adds comprehensive documentation and examples for bunfig.toml: new macros entry; serve section (port, static with plugins, hmr, minify with nested options, define, publicPath, env); test.coverageIgnoreSourcemaps; expanded install.* options (concurrentScripts, ignoreScripts, prefer modes, logLevel, lockfile/savePath, linker, hoistPattern, publicHoistPattern); run.elide-lines; and bundle options (entryPoints, outdir, logLevel, packages).

Possibly related PRs

Suggested reviewers

  • lydiahallie
  • RiskyMH

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding missing configuration options documentation to bunfig.
Description check ✅ Passed The description comprehensively covers what the PR does and how it was verified, exceeding the template requirements with detailed documentation of all new fields and sections added.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ad9a16f and 3b9951c.

📒 Files selected for processing (1)
  • docs/runtime/bunfig.mdx
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 25248
File: src/install/pnpm.zig:1747-1762
Timestamp: 2025-11-30T13:44:16.488Z
Learning: Bun's TOML parser (bun.interchange.toml.TOML) gracefully handles duplicate section headers by merging keys from multiple sections with the same name into a single table. For example, two [install] sections in bunfig.toml will be merged into one install configuration object. This lenient behavior differs from strict TOML parsers but is intentional in Bun.
📚 Learning: 2025-11-14T16:07:01.064Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-30T13:44:16.488Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 25248
File: src/install/pnpm.zig:1747-1762
Timestamp: 2025-11-30T13:44:16.488Z
Learning: Bun's TOML parser (bun.interchange.toml.TOML) gracefully handles duplicate section headers by merging keys from multiple sections with the same name into a single table. For example, two [install] sections in bunfig.toml will be merged into one install configuration object. This lenient behavior differs from strict TOML parsers but is intentional in Bun.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-09-13T17:01:41.393Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 21459
File: docs/api/import-meta.md:0-0
Timestamp: 2025-09-13T17:01:41.393Z
Learning: For docs/api/import-meta.md, keep documentation entries concise and consistent with the existing style - brief descriptions with small inline examples, not extensive bullet points or detailed explanations.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : When spawning Bun processes in tests, use `bunExe` and `bunEnv` from `harness` to ensure the same build of Bun is used and debug logging is silenced

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `bun:test` with files that end in `*.test.{ts,js,jsx,tsx,mjs,cjs}`

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-10-19T02:52:37.412Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/tsconfig.json:1-15
Timestamp: 2025-10-19T02:52:37.412Z
Learning: In the Bun repository, packages under packages/ (e.g., bun-otel) can follow a TypeScript-first pattern where package.json exports point directly to .ts files (not compiled .js files). Bun natively runs TypeScript, so consumers import .ts sources directly and receive full type information without needing compiled .d.ts declaration files. For such packages, adding "declaration": true or "outDir" in tsconfig.json is unnecessary and would break the export structure.
<!-- [remove_learning]
ceedde95-980e-4898-a2c6-40ff73913664

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Write JS builtins for Bun's Node.js compatibility and APIs, and run `bun bd` after changes

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_<scopeName>=1` to enable specific scoped debug logging in Zig

Applied to files:

  • docs/runtime/bunfig.mdx
🔇 Additional comments (5)
docs/runtime/bunfig.mdx (5)

760-776: LGTM: Hoist pattern documentation is accurate and well-written.

The documentation for hoistPattern and publicHoistPattern correctly explains when these options apply (isolated linker mode) and references pnpm for context. Both options are properly implemented and tested, with comprehensive test coverage confirming they work as documented with array syntax, glob patterns, and both include/exclude filtering.


167-254: Serve configuration options are correctly documented. All documented serve.* options (port, static.plugins, static.hmr, static.minify, static.define, static.publicPath, static.env) are implemented in src/bunfig.zig and the documentation accurately reflects their behavior, including support for minify as both a boolean and object with granular syntax/whitespace/identifiers control, and env pattern matching with prefix support.


118-131: All newly documented configuration options are properly defined in src/bunfig.zig. The following fields have been confirmed to exist and are parsed correctly:

  • macros (line 1101)
  • test.coverageIgnoreSourcemaps (line 368)
  • install.concurrentScripts (line 597)
  • install.ignoreScripts (line 604)
  • install.prefer (line 541)
  • install.logLevel (line 683)
  • install.lockfile.path (line 640)
  • install.lockfile.savePath (line 646)
  • install.hoistPattern (line 788)
  • install.publicHoistPattern (line 776)
  • run.elide-lines (line 810)

No discrepancies between documentation and implementation.


604-611: Verify whether install.logLevel supports the "info" value.

The documentation shows install.logLevel accepts "debug", "info", "warn", and "error" (line 606), while the top-level logLevel field supports only "debug", "warn", and "error" (no "info"). The top-level configuration is correct per the official documentation. However, the valid values for install.logLevel should be explicitly confirmed to ensure the scope-specific difference is intentional and accurately documented.


945-991: No action needed. The bundle section options documented are correctly implemented.

All four options (entryPoints, outdir, logLevel, packages) are fully parsed from the [bundle] section in bunfig.toml (see src/bunfig.zig lines 973-1023) and actively applied when running bun build. These are not CLI-only options—they are legitimate configuration file settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/runtime/bunfig.mdx (1)

773-794: Incorrect section placement: Debug section is within the Install section.

The ## Debug heading and its content (lines 773-794) are placed in the middle of the Package manager ([install]) section, between install.publicHoistPattern and install.security.scanner. This breaks the document structure.

The Debug section should either:

  1. Be moved to appear after all install-related sections (after line 834)
  2. Or be removed from this location if it already exists elsewhere in the file
🔎 Suggested fix

Move the Debug section (lines 773-794) to after the install section completes (after line 834), before the ## bun run section (line 836).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce7e90 and ad9a16f.

📒 Files selected for processing (1)
  • docs/runtime/bunfig.mdx
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 25248
File: src/install/pnpm.zig:1747-1762
Timestamp: 2025-11-30T13:44:16.488Z
Learning: Bun's TOML parser (bun.interchange.toml.TOML) gracefully handles duplicate section headers by merging keys from multiple sections with the same name into a single table. For example, two [install] sections in bunfig.toml will be merged into one install configuration object. This lenient behavior differs from strict TOML parsers but is intentional in Bun.
📚 Learning: 2025-11-14T16:07:01.064Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-30T13:44:16.488Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 25248
File: src/install/pnpm.zig:1747-1762
Timestamp: 2025-11-30T13:44:16.488Z
Learning: Bun's TOML parser (bun.interchange.toml.TOML) gracefully handles duplicate section headers by merging keys from multiple sections with the same name into a single table. For example, two [install] sections in bunfig.toml will be merged into one install configuration object. This lenient behavior differs from strict TOML parsers but is intentional in Bun.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : When spawning Bun processes in tests, use `bunExe` and `bunEnv` from `harness` to ensure the same build of Bun is used and debug logging is silenced

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `bun:test` with files that end in `*.test.{ts,js,jsx,tsx,mjs,cjs}`

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-10-19T02:52:37.412Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/tsconfig.json:1-15
Timestamp: 2025-10-19T02:52:37.412Z
Learning: In the Bun repository, packages under packages/ (e.g., bun-otel) can follow a TypeScript-first pattern where package.json exports point directly to .ts files (not compiled .js files). Bun natively runs TypeScript, so consumers import .ts sources directly and receive full type information without needing compiled .d.ts declaration files. For such packages, adding "declaration": true or "outDir" in tsconfig.json is unnecessary and would break the export structure.
<!-- [remove_learning]
ceedde95-980e-4898-a2c6-40ff73913664

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Write JS builtins for Bun's Node.js compatibility and APIs, and run `bun bd` after changes

Applied to files:

  • docs/runtime/bunfig.mdx
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_<scopeName>=1` to enable specific scoped debug logging in Zig

Applied to files:

  • docs/runtime/bunfig.mdx
🪛 LanguageTool
docs/runtime/bunfig.mdx

[style] ~204-~204: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...nify` Configure minification settings. Can be a boolean to enable/disable all mini...

(MISSING_IT_THERE)

🔇 Additional comments (6)
docs/runtime/bunfig.mdx (6)

723-735: Lockfile path configuration options are correctly implemented.

Both path and savePath options for custom lockfile paths are properly implemented in the bunfig configuration (lines 640 and 646 of src/bunfig.zig). The documentation accurately reflects the available functionality.


358-365: Verify coverageIgnoreSourcemaps option exists in bunfig.zig.

Manual verification required—unable to access repository to confirm this option is actually implemented in the codebase.


564-607: The documentation for the install configuration options (concurrentScripts, ignoreScripts, prefer, logLevel) is accurate and complete. All options exist in the source code with the correct types and enum values as documented:

  • prefer enum values match: "online", "offline", "latest"
  • logLevel enum values match: "debug", "info", "warn", "error"
  • concurrentScripts accepts a number as documented
  • ignoreScripts accepts a boolean as documented

No changes required.


755-771: All details verified. The hoistPattern and publicHoistPattern options are correctly implemented in the codebase, the documentation examples are accurate, and the restriction to linker = "isolated" is properly enforced by the implementation. Both options use the same PnpmMatcher parsing mechanism as their pnpm counterparts, and the TOML syntax examples in the documentation match the actual configuration patterns used throughout the test suite.


162-249: All [serve] section configuration options are correctly implemented.

Verified in bunfig.zig and schema.zig:

  • serve.port defaults to 3000 ✓
  • serve.static.plugins
  • serve.static.hmr defaults to enabled (true) ✓
  • serve.static.minify with syntax, whitespace, and identifiers options ✓
  • serve.static.define
  • serve.static.publicPath
  • serve.static.env with behavior and prefix support ✓

All documented default values match the implementation.


940-986: Add note clarifying that bundle.logLevel is CLI-only.

The bundle.logLevel option only applies to the bun build CLI command and is not available when using the Bun.build() programmatic API. The other bundle options (entryPoints, outdir, packages) work in both contexts.

- Add macro object mapping example
- Fix grammar in minify description

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants