Repository navigation
docs: add missing v1.2.21 features to documentation - #23085
Conversation
Add documentation for features introduced in Bun v1.2.21: - bun audit filtering options (--audit-level, --prod, --ignore) - --compile-exec-argv flag for embedding runtime args - bunx --package/-p flag for running binaries from packages - package.json sideEffects glob pattern support - --user-agent CLI flag for customizing fetch requests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Updated 8:12 AM PT - Sep 29th, 2025
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 23085That installs a local version of the PR into your bun-23085 --bun |
|
Warning Rate limit exceeded@robobun has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughDocumentation updates add new sections across bundler, CLI, and audit pages describing flags and options. Several additions are duplicated within the same files. No code or runtime changes; only doc content and placement updates. Changes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (5)
docs/bundler/executables.md (1)
143-155: Clarify quoting/precedence for embedded args; add Windows example
- Please state how embedded args are ordered relative to runtime args in
process.execArgvand whether runtime flags can override embedded ones.- Add a Windows cmd.exe/PowerShell example (quoting differs), and note escaping for spaces/equals.
- Optional: link to the flag’s reference and
process.execArgv.Example additions:
## Embedding runtime arguments **`--compile-exec-argv="args"`** - Embed runtime arguments that are available via `process.execArgv`: ```bash $ bun build --compile --compile-exec-argv="--smol --user-agent=MyBot" ./app.ts --outfile myapp+On Windows (PowerShell):
+
+powershell +PS> bun build --compile --compile-exec-argv '--smol --user-agent=MyBot' .\app.ts --outfile myapp.exe +
+
+Precedence: embedded args appear inprocess.execArgvbefore CLI‑time args. If the same flag is provided at runtime, the runtime value takes precedence. (Please confirm.)
+// In the compiled app console.log(process.execArgv); // ["--smol", "--user-agent=MyBot"]</blockquote></details> <details> <summary>docs/cli/bunx.md (1)</summary><blockquote> `66-73`: **Explain scope of `--package/-p` and multiple-use behavior** - Note that `-p/--package` selects the package supplying the binary (affects resolution/install), and is not forwarded to the target binary. - Clarify whether multiple `-p` flags are supported (and how conflicts are resolved). - Consider adding one example where binary name differs from package name but both exist on PATH to show why `-p` is needed. ```diff ## Package flag **`--package <pkg>` or `-p <pkg>`** - Run binary from specific package. Useful when binary name differs from package name: ```bash $ bunx -p renovate renovate-config-validator $ bunx --package @angular/cli ng
+Notes:
+---packageaffects which package is installed/resolved; it is not passed through to the binary.
+- Only one--packagevalue is used (later flags override earlier ones). (Please confirm.)</blockquote></details> <details> <summary>docs/cli/run.md (1)</summary><blockquote> `215-221`: **Clarify scope and precedence of `--user-agent`** - Confirm it applies to Bun’s `fetch()` only (not third‑party HTTP libs). - State precedence: per‑request `headers: { "User-Agent": ... }` should override the global flag if set. - If relevant, note whether redirects/retries preserve the header. </blockquote></details> <details> <summary>docs/bundler/index.md (1)</summary><blockquote> `788-799`: **Expand `sideEffects` semantics and path rules** Great to document glob support. Please also cover: - Boolean vs array behavior (`false` ⇒ tree‑shake all except explicitly imported side‑effect files). - Path base (globs are resolved relative to package root where `package.json` lives). - Negation patterns support (if supported) or explicitly say not supported. - Common pitfalls (mark CSS or setup files as side‑effectful to avoid accidental removal). ```diff ### `sideEffects` Bun supports `package.json` `sideEffects` field with glob pattern matching: ```json { "sideEffects": ["**/*.css", "./src/setup.js"] }-Supported glob patterns:
*,?,**,[],{}.
+Supported glob patterns:*,?,**,[],{}. Globs are resolved relative to the package root (the directory containingpackage.json).
+You can also use:
+-true— treat all files as having side effects (disable DCE for the package)
+-false— assume files are side‑effect free unless matched by the array (enables aggressive tree‑shaking)
+
+Tip: keep CSS and initialization files (e.g.src/setup.ts) listed to prevent their removal during bundling.</blockquote></details> <details> <summary>docs/install/audit.md (1)</summary><blockquote> `27-46`: **Define exit code semantics with filters and ignored CVEs** - Please state whether exit status is based on the post‑filter set (after `--audit-level`, `--prod`, and `--ignore`) and whether `--json` output is filtered accordingly. - Add one combined example to show typical usage. ```diff ### Filtering options @@ **`--ignore <CVE>`** - Ignore specific CVEs (can be used multiple times): @@ $ bun audit --ignore CVE-2022-25883 --ignore CVE-2023-26136
+Exit codes: the exit status reflects vulnerabilities remaining after applying all filters/ignores. (Please confirm.)
+
+Example (combine flags):
+bash +$ bun audit --prod --audit-level=high --ignore CVE-2023-26136 +</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro **Disabled knowledge base sources:** - Linear integration is disabled by default for public repositories > You can enable these sources in your CodeRabbit configuration. <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9c75db45fa955b5d968abc0bd7bc650966ee3fb1 and 61882b6c7ddb35fd037ec7f6e46f8bb0b073c2ec. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `docs/bundler/executables.md` (1 hunks) * `docs/bundler/index.md` (1 hunks) * `docs/cli/bunx.md` (1 hunks) * `docs/cli/run.md` (1 hunks) * `docs/install/audit.md` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🧠 Learnings (5)</summary> <details> <summary>📚 Learning: 2025-09-03T17:10:13.486Z</summary>Learnt from: CR
PR: oven-sh/bun#0
File: test/CLAUDE.md:0-0
Timestamp: 2025-09-03T17:10:13.486Z
Learning: Usebun bd <...cmd>to run commands with your debug build of Bun**Applied to files:** - `docs/bundler/executables.md` - `docs/cli/bunx.md` </details> <details> <summary>📚 Learning: 2025-08-30T00:12:56.803Z</summary>Learnt from: CR
PR: oven-sh/bun#0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/cli/**/*.{js,ts} : When testing Bun as a CLI, use spawn with bunExe() and bunEnv from harness, and capture stdout/stderr via pipes**Applied to files:** - `docs/bundler/executables.md` - `docs/cli/run.md` </details> <details> <summary>📚 Learning: 2025-08-30T00:07:54.573Z</summary>Learnt from: CR
PR: oven-sh/bun#0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-08-30T00:07:54.573Z
Learning: To run a file, usebun bd <file> <...args>; never usebun <file>directly**Applied to files:** - `docs/bundler/executables.md` - `docs/cli/bunx.md` </details> <details> <summary>📚 Learning: 2025-09-12T22:27:19.572Z</summary>Learnt from: RiskyMH
PR: #22613
File: src/cli/package_manager_command.zig:0-0
Timestamp: 2025-09-12T22:27:19.572Z
Learning: In Bun's CLI architecture, commands that go through the standard Command.Context flow should usectx.positionals(which excludes flags) rather than manually parsingbun.argv. Manualbun.argvparsing is only used for standalone commands likebun infothat bypass the normal command routing.**Applied to files:** - `docs/cli/bunx.md` </details> <details> <summary>📚 Learning: 2025-09-12T22:30:48.490Z</summary>Learnt from: RiskyMH
PR: #22613
File: src/cli/package_manager_command.zig:0-0
Timestamp: 2025-09-12T22:30:48.490Z
Learning: Commands likebun infoandbun whoamithat are promoted from pm-only subcommands to top-level commands use manualbun.argvparsing to detect direct invocation vs. pm invocation. This is different from regular commands that should usectx.positionals.**Applied to files:** - `docs/cli/bunx.md` </details> </details><details> <summary>🪛 markdownlint-cli2 (0.18.1)</summary> <details> <summary>docs/bundler/executables.md</summary> 148-148: Dollar signs used before commands without showing output (MD014, commands-show-output) </details> <details> <summary>docs/install/audit.md</summary> 32-32: Dollar signs used before commands without showing output (MD014, commands-show-output) --- 38-38: Dollar signs used before commands without showing output (MD014, commands-show-output) --- 44-44: Dollar signs used before commands without showing output (MD014, commands-show-output) </details> <details> <summary>docs/cli/bunx.md</summary> 71-71: Dollar signs used before commands without showing output (MD014, commands-show-output) --- 72-72: Dollar signs used before commands without showing output (MD014, commands-show-output) </details> <details> <summary>docs/cli/run.md</summary> 220-220: Dollar signs used before commands without showing output (MD014, commands-show-output) </details> </details> </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)</summary> * GitHub Check: Format </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
|
|
||
| boolean; --> | ||
|
|
||
| ### `sideEffects` |
There was a problem hiding this comment.
this if anything should explain what side effect means, but also the docs here is for Bun.build options...
- Remove sideEffects docs from Bun.build options (it's a package.json field) - Remove dollar signs from command examples per markdownlint 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
Changes
bun audit filtering options (
docs/install/audit.md)--audit-level=<low|moderate|high|critical>- filter by severity--prod- audit only production dependencies--ignore <CVE>- ignore specific vulnerabilities--compile-exec-argv flag (
docs/bundler/executables.md)process.execArgvbunx --package/-p flag (
docs/cli/bunx.md)package.json sideEffects glob patterns (
docs/bundler/index.md)*,?,**,[],{}patterns--user-agent CLI flag (
docs/cli/run.md)Test plan
🤖 Generated with Claude Code