Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/bundler/executables.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ The `--sourcemap` argument embeds a sourcemap compressed with zstd, so that erro

The `--bytecode` argument enables bytecode compilation. Every time you run JavaScript code in Bun, JavaScriptCore (the engine) will compile your source code into bytecode. We can move this parsing work from runtime to bundle time, saving you startup time.

## 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
```

```js
// In the compiled app
console.log(process.execArgv); // ["--smol", "--user-agent=MyBot"]
```

## Act as the Bun CLI

{% note %}
Expand Down
9 changes: 9 additions & 0 deletions docs/cli/bunx.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ $ bunx --bun my-cli # good
$ bunx my-cli --bun # bad
```

## 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
```

To force bun to always be used with a script, use a shebang.

```
Expand Down
8 changes: 8 additions & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ $ bun --smol run index.tsx

This causes the garbage collector to run more frequently, which can slow down execution. However, it can be useful in environments with limited memory. Bun automatically adjusts the garbage collector's heap size based on the available memory (accounting for cgroups and other memory limits) with and without the `--smol` flag, so this is mostly useful for cases where you want to make the heap size grow more slowly.

## `--user-agent`

**`--user-agent <string>`** - Set User-Agent header for all `fetch()` requests:

```bash
bun --user-agent "MyBot/1.0" run index.tsx
```

## Resolution order

Absolute paths and paths starting with `./` or `.\\` are always executed as source files. Unless using `bun run`, running a file with an allowed extension will prefer the file over a package.json script.
Expand Down
20 changes: 20 additions & 0 deletions docs/install/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ To update all dependencies to the latest versions (including breaking changes):
bun update --latest
```

### Filtering options

**`--audit-level=<low|moderate|high|critical>`** - Only show vulnerabilities at this severity level or higher:

```bash
bun audit --audit-level=high
```

**`--prod`** - Audit only production dependencies (excludes devDependencies):

```bash
bun audit --prod
```

**`--ignore <CVE>`** - Ignore specific CVEs (can be used multiple times):

```bash
bun audit --ignore CVE-2022-25883 --ignore CVE-2023-26136
```

### `--json`

Use the `--json` flag to print the raw JSON response from the registry instead of the formatted report:
Expand Down