> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bun outdated

> 检查过期的依赖

使用 `bun outdated` 来检查项目中过期的依赖。该命令会显示一个依赖列表表格，其中列出了有更新版本的依赖包。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update    | Latest     |
| ------------------------------ | ------- | --------- | ---------- |
| @sinclair/typebox              | 0.34.15 | 0.34.16   | 0.34.16    |
| @types/bun (dev)               | 1.3.0   | 1.3.3     | 1.3.3      |
| eslint (dev)                   | 8.57.1  | 8.57.1    | 9.20.0     |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1     | 3.0.1      |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0    | 3.0.1      |
| expect-type (dev)              | 0.16.0  | 0.16.0    | 1.1.0      |
| prettier (dev)                 | 3.4.2   | 3.5.0     | 3.5.0      |
| tsup (dev)                    | 8.3.5   | 8.3.6     | 8.3.6      |
| typescript (dev)               | 5.7.2   | 5.7.3     | 5.7.3      |

```

## 版本信息

输出的表格显示了三列版本信息：

* **Current（当前）**：当前安装的版本
* **Update（更新）**：满足你的 package.json 版本范围的最新版本
* **Latest（最新）**：注册表中发布的最新版本

### 依赖过滤

`bun outdated` 支持通过包名或通配符模式搜索过期的依赖。

要检查特定的依赖是否过期，可以将包名作为位置参数传递：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated eslint-plugin-security eslint-plugin-sonarjs
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update | Latest    |
| ------------------------------ | ------- | ------ | --------- |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1  | 3.0.1     |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0 | 3.0.1     |

```

你也可以传入通配符模式来检查过期的包：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated 'eslint*'
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update | Latest     |
| ------------------------------ | ------- | ------ | ---------- |
| eslint (dev)                   | 8.57.1  | 8.57.1 | 9.20.0     |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1  | 3.0.1      |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0 | 3.0.1      |
```

例如，要检查过期的 `@types/*` 包：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated '@types/*'
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package            | Current | Update | Latest |
| ------------------ | ------- | ------ | ------ |
| @types/bun (dev)   | 1.3.0   | 1.3.3  | 1.3.3 |
```

或者排除所有 `@types/*` 包：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated '!@types/*'
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update    | Latest     |
| ------------------------------ | ------- | --------- | ---------- |
| @sinclair/typebox              | 0.34.15 | 0.34.16   | 0.34.16    |
| eslint (dev)                   | 8.57.1  | 8.57.1    | 9.20.0     |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1     | 3.0.1      |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0    | 3.0.1      |
| expect-type (dev)              | 0.16.0  | 0.16.0    | 1.1.0      |
| prettier (dev)                 | 3.4.2   | 3.5.0     | 3.5.0      |
| tsup (dev)                    | 8.3.5   | 8.3.6     | 8.3.6      |
| typescript (dev)               | 5.7.2   | 5.7.3     | 5.7.3      |
```

### 工作区过滤

使用 `--filter` 参数可以检查其它工作区包的过期依赖：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated --filter='@monorepo/types'
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package            | Current | Update | Latest |
| ------------------ | ------- | ------ | ------ |
| tsup (dev)         | 8.3.5   | 8.3.6  | 8.3.6  |
| typescript (dev)   | 5.7.2   | 5.7.3  | 5.7.3  |
```

你可以传入多个 `--filter` 来检查多个工作区：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated --filter @monorepo/types --filter @monorepo/cli
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update | Latest     |
| ------------------------------ | ------- | ------ | ---------- |
| eslint (dev)                   | 8.57.1  | 8.57.1 | 9.20.0     |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1  | 3.0.1      |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0 | 3.0.1      |
| expect-type (dev)              | 0.16.0  | 0.16.0 | 1.1.0      |
| tsup (dev)                    | 8.3.5   | 8.3.6  | 8.3.6      |
| typescript (dev)               | 5.7.2   | 5.7.3  | 5.7.3      |
```

你也可以使用通配符匹配工作区名：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated --filter='@monorepo/{types,cli}'
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
| Package                        | Current | Update | Latest     |
| ------------------------------ | ------- | ------ | ---------- |
| eslint (dev)                   | 8.57.1  | 8.57.1 | 9.20.0     |
| eslint-plugin-security (dev)   | 2.1.1   | 2.1.1  | 3.0.1      |
| eslint-plugin-sonarjs (dev)    | 0.23.0  | 0.23.0 | 3.0.1      |
| expect-type (dev)              | 0.16.0  | 0.16.0 | 1.1.0      |
| tsup (dev)                    | 8.3.5   | 8.3.6  | 8.3.6      |
| typescript (dev)               | 5.7.2   | 5.7.3  | 5.7.3      |
```

### 目录依赖

`bun outdated` 支持检查 `package.json` 中定义的目录依赖：

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated -r
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
┌────────────────────┬─────────┬─────────┬─────────┬────────────────────────────────┐
│ Package            │ Current │ Update  │ Latest  │ Workspace                      │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ body-parser        │ 1.19.0  │ 1.19.0  │ 2.2.0   │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ cors               │ 2.8.0   │ 2.8.0   │ 2.8.5   │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ chalk              │ 4.0.0   │ 4.0.0   │ 5.6.2   │ @test/utils                    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ uuid               │ 8.0.0   │ 8.0.0   │ 13.0.0  │ @test/utils                    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ axios              │ 0.21.0  │ 0.21.0  │ 1.12.2  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ lodash             │ 4.17.15 │ 4.17.15 │ 4.17.21 │ catalog (@test/app, @test/app) │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ react              │ 17.0.0  │ 17.0.0  │ 19.1.1  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ react-dom          │ 17.0.0  │ 17.0.0  │ 19.1.1  │ catalog (@test/app)            │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ express            │ 4.17.0  │ 4.17.0  │ 5.1.0   │ catalog (@test/shared)         │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ moment             │ 2.24.0  │ 2.24.0  │ 2.30.1  │ catalog (@test/utils)          │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ @types/node (dev)  │ 14.0.0  │ 14.0.0  │ 24.5.2  │ @test/shared                   │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ @types/react (dev) │ 17.0.0  │ 17.0.0  │ 19.1.15 │ catalog:testing (@test/app)    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ eslint (dev)       │ 7.0.0   │ 7.0.0   │ 9.36.0  │ catalog:testing (@test/app)    │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ typescript (dev)   │ 4.9.5   │ 4.9.5   │ 5.9.2   │ catalog:build (@test/app)      │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ jest (dev)         │ 26.0.0  │ 26.0.0  │ 30.2.0  │ catalog:testing (@test/shared) │
├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
│ prettier (dev)     │ 2.0.0   │ 2.0.0   │ 3.6.2   │ catalog:build (@test/utils)    │
└────────────────────┴─────────┴─────────┴─────────┴────────────────────────────────┘
```

***

## CLI 使用方法

```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun outdated <filter>
```

### 通用选项

<ParamField path="-c, --config" type="string">
  指定配置文件路径（<code>bunfig.toml</code>）
</ParamField>

<ParamField path="--cwd" type="string">
  设置特定的当前工作目录
</ParamField>

<ParamField path="-h, --help" type="boolean">
  打印帮助菜单
</ParamField>

<ParamField path="-F, --filter" type="string">
  显示匹配工作区的过期依赖项
</ParamField>

### 输出与日志

<ParamField path="--silent" type="boolean">
  不输出任何日志
</ParamField>

<ParamField path="--verbose" type="boolean">
  详细输出日志
</ParamField>

<ParamField path="--no-progress" type="boolean">
  禁用进度条
</ParamField>

<ParamField path="--no-summary" type="boolean">
  不打印摘要
</ParamField>

### 依赖范围与目标

<ParamField path="-p, --production" type="boolean">
  不安装 devDependencies
</ParamField>

<ParamField path="--omit" type="string">
  排除 <code>dev</code>、<code>optional</code> 或 <code>peer</code> 依赖安装
</ParamField>

<ParamField path="-g, --global" type="boolean">
  全局安装
</ParamField>

### 锁文件与 package.json

<ParamField path="-y, --yarn" type="boolean">
  写入 <code>yarn.lock</code> 文件（yarn v1）
</ParamField>

<ParamField path="--no-save" type="boolean">
  不更新 <code>package.json</code> 或保存锁文件
</ParamField>

<ParamField path="--save" type="boolean" default="true">
  保存至 <code>package.json</code>（默认 true）
</ParamField>

<ParamField path="--frozen-lockfile" type="boolean">
  禁止修改锁文件
</ParamField>

<ParamField path="--save-text-lockfile" type="boolean">
  保存基于文本的锁文件
</ParamField>

<ParamField path="--lockfile-only" type="boolean">
  仅生成锁文件，不安装依赖
</ParamField>

<ParamField path="--trust" type="boolean">
  添加至项目的 <code>package.json</code> 中的 <code>trustedDependencies</code> 并安装包
</ParamField>

### 网络与注册表

<ParamField path="--ca" type="string">
  提供证书颁发机构签名证书
</ParamField>

<ParamField path="--cafile" type="string">
  同 <code>--ca</code>，但为证书文件路径
</ParamField>

<ParamField path="--registry" type="string">
  默认使用特定注册表，覆盖 <code>.npmrc</code>、<code>bunfig.toml</code> 和环境变量
</ParamField>

<ParamField path="--network-concurrency" type="number" default="48">
  最大并发网络请求数（默认 48）
</ParamField>

### 缓存

<ParamField path="--cache-dir" type="string">
  从特定目录路径存储和加载缓存数据
</ParamField>

<ParamField path="--no-cache" type="boolean">
  完全忽略清单缓存
</ParamField>

### 执行行为

<ParamField path="--dry-run" type="boolean">
  不进行任何安装
</ParamField>

<ParamField path="-f, --force" type="boolean">
  始终从注册表请求最新版本并重新安装所有依赖
</ParamField>

<ParamField path="--no-verify" type="boolean">
  跳过校验新下载包的完整性
</ParamField>

<ParamField path="--ignore-scripts" type="boolean">
  跳过项目 <code>package.json</code> 中的生命周期脚本（依赖脚本永不执行）
</ParamField>

<ParamField path="--backend" type="string" default="clonefile">
  用于安装依赖的特定平台优化。可选值：<code>clonefile</code>（默认），<code>hardlink</code>，<code>symlink</code>，<code>copyfile</code>
</ParamField>

<ParamField path="--concurrent-scripts" type="number" default="5">
  生命周期脚本最大并发作业数（默认 5）
</ParamField>
