> For AI agents: the complete documentation index is available at https://rsdoctor.rs/zh/llms.txt, the full documentation bundle is available at https://rsdoctor.rs/zh/llms-full.txt.

# supports

- **类型：** [Supports Types](#supportstypes)
- **可选：** `true`
- **默认值：** `undefined`

该选项用于控制产物解析和压缩体积计算。

## supportsTypes

```ts
type ISupport = {
  parseBundle?: boolean;
  brotli?: boolean | { brotliLevel?: number };
  gzip?:
    | boolean
    | {
        gzipLevel?: number;
      };
};
```

## parseBundle

- **类型：** `boolean`
- **默认值：** `true`

控制 Rsdoctor 在缺少可用 source map 数据时，是否使用 AST 解析产物代码。

大型项目的 AST 解析可能比较耗时，可以将 `supports.parseBundle` 设置为 `false` 来跳过这一步：

```ts
new RsdoctorRspackPlugin({
  supports: {
    parseBundle: false,
  },
});
```

关闭后，依赖 AST 解析的模块可能无法显示 Bundled Size 和 Bundled Code，基于 source map 的分析不受影响。

如需控制报告中包含哪些代码，请使用 [output.reportCodeType](https://rsdoctor.rs/zh/config/options/output.md#reportcodetype)。


![](https://assets.rspack.rs/others/assets/rsdoctor/bundled-size.jpeg)![](https://assets.rspack.rs/others/assets/rsdoctor/bundled-code.png)

## gzip

- **类型：** `boolean | { gzipLevel?: number }`
- **默认值：** `true`

控制 Rsdoctor 是否计算 Asset 和 Module 的 gzip 大小。该计算只影响 Rsdoctor 报告中的大小数据，不会修改或压缩构建产物。

当编译器以 watch 模式运行时，Rsdoctor 会跳过 gzip 大小计算。如需分析生产 Bundle 的 gzip 大小，请运行一次性构建。

gzip 大小计算默认开启，默认压缩级别为 `6`。将 `gzip` 配置为对象可以自定义 `gzipLevel`，其值必须是 `0` 到 `9` 之间的整数：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: {
      gzipLevel: 9,
    },
  },
});
```

将 `gzip` 设置为 `false` 可以关闭 gzip 大小计算：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: false,
  },
});
```

## brotli

- **类型：** `boolean | { brotliLevel?: number }`
- **默认值：** `false`

计算报告中 Asset 和 Module 的 Brotli 大小，并在体积卡片和矩形树图中展示。该选项不会压缩或修改构建产物。与 gzip 一样，watch 模式下会跳过 Brotli 计算。

设置 `brotli: true` 或 `brotli: {}` 时使用默认压缩级别 `6`。`brotliLevel` 必须是 `0` 到 `11` 之间的整数；较高的级别可能增加分析耗时。只需要 Brotli 大小时，可以独立关闭 gzip：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: false,
    brotli: { brotliLevel: 11 },
  },
});
```
