@rsdoctor/docs 1.2.4-beta.5 → 1.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,9 @@ Mode does not have a lite configuration option. The lite mode will be deprecated
32
32
  Brief mode is used to generate lightweight analysis reports, supporting both HTML and JSON output formats.
33
33
 
34
34
  - **`type`**: Output type, supports `'html'` and `'json'` arrays, allowing multiple formats to be selected simultaneously
35
+ - If configured with `['html', 'json']`, it will generate both an HTML file and a JSON file.
36
+ - If configured with `['json']`, it will generate a JSON file named `rsdoctor-data.json`.
37
+ - If configured with `['html']`, it will generate an HTML file. The filename can be configured via `htmlOptions.reportHtmlName`.
35
38
  - **`htmlOptions`**: HTML output related configuration
36
39
  - **`reportHtmlName`**: HTML report filename, defaults to `report-rsdoctor.html`
37
40
  - **`jsonOptions`**: JSON output related configuration
@@ -40,6 +43,10 @@ Brief mode is used to generate lightweight analysis reports, supporting both HTM
40
43
  - **`chunkGraph`**: Whether to include Chunk graph data, defaults to `true`
41
44
  - **`rules`**: Whether to include rules data, defaults to `true`
42
45
 
46
+ **Notes:**
47
+
48
+ - In Brief mode, the **`reportCodeType`** configuration item is invalid because only **`'noCode'`** is supported.
49
+
43
50
  **Configuration Example:**
44
51
 
45
52
  ```js
@@ -57,11 +64,58 @@ new RsdoctorRspackPlugin({
57
64
  });
58
65
  ```
59
66
 
60
- **Notes:**
67
+ #### HTML vs JSON Output Format Differences
61
68
 
62
- - In Brief mode, the **`reportCodeType`** configuration item is invalid because only **`'noCode'`** is supported.
63
- - In Brief mode, when **type is 'html'**, analysis data is directly injected into the HTML file, making it convenient for single-file sharing.
64
- - In Brief mode, when **type is 'json'**, structured data files are generated, making it convenient for programmatic processing.
69
+ | Feature | HTML Format | JSON Format |
70
+ | --------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
71
+ | **File Structure** | Single file containing complete analysis report page | Pure data file requiring client support |
72
+ | **Usage** | Can be opened directly in browser for viewing | Needs to be uploaded to Playground or parsed with client |
73
+ | **Data Completeness** | Contains all analysis data and visualization interface | Contains only raw analysis data |
74
+ | **File Size** | Larger (includes styles and scripts) | Smaller (data only) |
75
+ | **Use Cases** | • Offline report viewing<br/>• Direct sharing with others<br/>• No secondary processing needed | • Upload to Playground<br/>• Programmatic processing<br/>• Data analysis and integration |
76
+ | **Dependencies** | Self-contained, no external dependencies | Requires Rsdoctor client support |
77
+
78
+ > For viewing analysis reports in Playground, see [Playground](/guide/start/playground).
79
+
80
+ **Configuration Example Comparison:**
81
+
82
+ ```js
83
+ // Generate HTML report only (suitable for offline viewing)
84
+ new RsdoctorRspackPlugin({
85
+ output: {
86
+ mode: 'brief',
87
+ options: {
88
+ type: ['html'],
89
+ htmlOptions: {
90
+ reportHtmlName: 'build-report.html',
91
+ },
92
+ },
93
+ },
94
+ });
95
+
96
+ // Generate JSON data only (suitable for uploading to Playground)
97
+ new RsdoctorRspackPlugin({
98
+ output: {
99
+ mode: 'brief',
100
+ options: {
101
+ type: ['json'],
102
+ },
103
+ },
104
+ });
105
+
106
+ // Generate both formats (suitable for different use cases)
107
+ new RsdoctorRspackPlugin({
108
+ output: {
109
+ mode: 'brief',
110
+ options: {
111
+ type: ['html', 'json'],
112
+ htmlOptions: {
113
+ reportHtmlName: 'build-report.html',
114
+ },
115
+ },
116
+ },
117
+ });
118
+ ```
65
119
 
66
120
  ### mode: 'normal'
67
121
 
@@ -1 +1 @@
1
- ["intro", "quick-start", "features", "cicd", "cli", "mcp"]
1
+ ["intro", "quick-start", "features", "cicd", "cli", "mcp", "playground"]
@@ -0,0 +1,93 @@
1
+ # Playground
2
+
3
+ ## Introduction
4
+
5
+ Playground is an online analysis tool provided by Rsdoctor that supports uploading build analysis data and viewing analysis reports online. No local installation of Rsdoctor is required to quickly experience build analysis features, with support for complete report display.
6
+
7
+ ## Supported Data Formats
8
+
9
+ ### 1. Rsdoctor Analysis Data
10
+
11
+ Supports uploading JSON format analysis data generated by Rsdoctor to re-display complete analysis reports.
12
+
13
+ #### Configuration Requirements
14
+
15
+ Need to configure `output.mode: 'brief'` and set `output.options.type` to `['json']` or `['html', 'json']`:
16
+
17
+ ```js title="rspack.config.mjs/webpack.config.mjs"
18
+ export default {
19
+ plugins: [
20
+ new RsdoctorRspackPlugin({
21
+ output: {
22
+ mode: 'brief',
23
+ options: {
24
+ type: ['json'], // or ['html', 'json']
25
+ },
26
+ },
27
+ }),
28
+ ],
29
+ };
30
+ ```
31
+
32
+ - Optional configuration
33
+ - `optimizationBailout`: Optional configuration. If not enabled, it will only affect the display of [Bailout Reason](/guide/usage/module-analysis#bailout-reason) for each Module.
34
+
35
+ #### Usage Steps
36
+
37
+ 1. After building the project, find the `rsdoctor-data.json` file in the output directory
38
+ 2. Visit the [Playground page](https://rsdoctor.rs/preview/#/resources/uploader)
39
+ 3. Upload the `rsdoctor-data.json` file
40
+ 4. View the complete analysis report
41
+
42
+ :::tip
43
+ Difference between Brief mode and Normal mode:
44
+
45
+ - **Brief mode**: Generates single files (HTML or JSON), convenient for sharing and uploading
46
+ - **Normal mode**: Generates folders containing multiple files, suitable for local viewing
47
+ :::
48
+
49
+ ### 2. Webpack/Rspack Stats Data
50
+
51
+ Supports uploading `stats.json` files from Webpack or Rspack to automatically generate analysis reports.
52
+
53
+ #### Configuration Requirements
54
+
55
+ Need to configure detailed stats options to get complete build information:
56
+
57
+ **Method 1: Use verbose mode**
58
+
59
+ `verbose` mode outputs all build information (except debug info) and automatically includes all data required by Rsdoctor. For custom configuration, refer to the example below. See [Rspack stats](https://rspack.dev/config/stats) for detailed information.
60
+
61
+ ```js title="rspack.config.mjs/webpack.config.mjs"
62
+ export default {
63
+ stats: 'verbose',
64
+ };
65
+ ```
66
+
67
+ **Method 2: Stats configuration**
68
+
69
+ Configure according to the Stats options below.
70
+
71
+ ```js title="rspack.config.mjs/webpack.config.mjs"
72
+ export default {
73
+ stats: {
74
+ all: false,
75
+ chunks: true,
76
+ assets: true,
77
+ modules: true,
78
+ chunkModules: true,
79
+ hash: true,
80
+ ids: true,
81
+ version: true,
82
+ optimizationBailout: true, // Optional configuration
83
+ },
84
+ };
85
+ ```
86
+
87
+ #### Usage Steps
88
+
89
+ 1. Set the above stats options in the build configuration
90
+ 2. Build the project to generate the `stats.json` file
91
+ 3. Visit the [Playground page](https://rsdoctor.rs/preview/#/resources/uploader)
92
+ 4. Upload the `stats.json` file
93
+ 5. View the automatically generated analysis report
@@ -32,6 +32,9 @@ mode 是没有 lite 配置项的,lite 模式即将废弃,参考 [lite 模式
32
32
  Brief 模式用于生成轻量级的分析报告,支持 HTML 和 JSON 两种输出格式。
33
33
 
34
34
  - **`type`**:输出类型,支持 `'html'` 和 `'json'` 数组,可同时选择多种格式
35
+ - 如果配置了 `['html', 'json']`,则会生成一个 html 文件,同时生成一个 json 文件。
36
+ - 如果配置了 `['json']`,则会生成一个 json 文件。文件名为 `rsdoctor-data.json`。
37
+ - 如果配置了 `['html']`,则会生成一个 html 文件。文件名可通过 `htmlOptions.reportHtmlName` 配置。
35
38
  - **`htmlOptions`**:HTML 输出相关配置
36
39
  - **`reportHtmlName`**:HTML 报告文件名,默认为 `report-rsdoctor.html`
37
40
  - **`jsonOptions`**:JSON 输出相关配置
@@ -40,6 +43,10 @@ Brief 模式用于生成轻量级的分析报告,支持 HTML 和 JSON 两种
40
43
  - **`chunkGraph`**:是否包含 Chunk 图数据,默认为 `true`
41
44
  - **`rules`**:是否包含规则数据,默认为 `true`
42
45
 
46
+ **注意事项:**
47
+
48
+ - Brief 模式下,**`reportCodeType`** 配置项无效,因为只支持 **`'noCode'`**。
49
+
43
50
  **配置示例:**
44
51
 
45
52
  ```js
@@ -57,11 +64,58 @@ new RsdoctorRspackPlugin({
57
64
  });
58
65
  ```
59
66
 
60
- **注意事项:**
67
+ #### HTML 与 JSON 输出格式的区别
61
68
 
62
- - Brief 模式下,**`reportCodeType`** 配置项无效,因为只支持 **`'noCode'`**。
63
- - Brief 模式下,**type 'html' 时**,分析数据会直接注入到 HTML 文件中,便于单文件分享。
64
- - Brief 模式下,**type 为 'json' 时**,会生成结构化的数据文件,便于程序化处理。
69
+ | 特性 | HTML 格式 | JSON 格式 |
70
+ | -------------- | -------------------------------------------------------- | --------------------------------------------------------- |
71
+ | **文件结构** | 单文件,包含完整的分析报告页面 | 纯数据文件,需要配合客户端使用 |
72
+ | **使用方式** | 可直接在浏览器中打开查看 | 需要上传到 Playground 或配合客户端解析 |
73
+ | **数据完整性** | 包含所有分析数据和可视化界面 | 仅包含原始分析数据 |
74
+ | **文件大小** | 较大(包含样式和脚本) | 较小(仅数据) |
75
+ | **适用场景** | • 离线查看报告<br/>• 直接分享给他人<br/>• 不需要二次处理 | • 上传到 Playground<br/>• 程序化处理<br/>• 数据分析和集成 |
76
+ | **依赖关系** | 无外部依赖,自包含 | 需要 Rsdoctor 客户端支持 |
77
+
78
+ > Playground 查看分析报告,详见 [Playground](/guide/start/playground)。
79
+
80
+ **配置示例对比:**
81
+
82
+ ```js
83
+ // 仅生成 HTML 报告(适合离线查看)
84
+ new RsdoctorRspackPlugin({
85
+ output: {
86
+ mode: 'brief',
87
+ options: {
88
+ type: ['html'],
89
+ htmlOptions: {
90
+ reportHtmlName: 'build-report.html',
91
+ },
92
+ },
93
+ },
94
+ });
95
+
96
+ // 仅生成 JSON 数据(适合上传到 Playground)
97
+ new RsdoctorRspackPlugin({
98
+ output: {
99
+ mode: 'brief',
100
+ options: {
101
+ type: ['json'],
102
+ },
103
+ },
104
+ });
105
+
106
+ // 同时生成两种格式(适合不同使用场景)
107
+ new RsdoctorRspackPlugin({
108
+ output: {
109
+ mode: 'brief',
110
+ options: {
111
+ type: ['html', 'json'],
112
+ htmlOptions: {
113
+ reportHtmlName: 'build-report.html',
114
+ },
115
+ },
116
+ },
117
+ });
118
+ ```
65
119
 
66
120
  ### mode: 'normal'
67
121
 
@@ -1 +1 @@
1
- ["intro", "quick-start", "features", "cicd", "cli", "mcp"]
1
+ ["intro", "quick-start", "features", "cicd", "cli", "mcp", "playground"]
@@ -0,0 +1,97 @@
1
+ # Playground
2
+
3
+ ## 介绍
4
+
5
+ Playground 是 Rsdoctor 提供的在线分析工具,支持上传构建分析数据并在线查看分析报告。无需本地安装 Rsdoctor,即可快速体验构建分析功能,支持完整报告展示。
6
+
7
+ ## 支持的数据格式
8
+
9
+ ### 1. Rsdoctor 分析数据
10
+
11
+ 支持上传 Rsdoctor 生成的 JSON 格式分析数据,重新展示完整的分析报告。
12
+
13
+ #### 配置要求
14
+
15
+ 需要配置 `output.mode: 'brief'` 并设置 `output.options.type` 为 `['json']` 或 `['html', 'json']`:
16
+
17
+ > 具体配置可查看 [output 配置](/config/options/output)。
18
+
19
+ ```js title="rspack.config.mjs 或 webpack.config.mjs"
20
+ export default {
21
+ plugins: [
22
+ new RsdoctorRspackPlugin({
23
+ output: {
24
+ mode: 'brief',
25
+ options: {
26
+ type: ['json'], // 或 ['html', 'json']
27
+ },
28
+ },
29
+ }),
30
+ ],
31
+ };
32
+ ```
33
+
34
+ #### 使用步骤
35
+
36
+ 1. 构建项目后,在输出目录中找到 `rsdoctor-data.json` 文件
37
+ 2. 访问 [Playground 页面](https://rsdoctor.rs/preview/#/resources/uploader)
38
+ 3. 上传 `rsdoctor-data.json` 文件
39
+ 4. 查看完整的分析报告
40
+
41
+ :::tip
42
+
43
+ Brief 模式与 Normal 模式的区别:
44
+
45
+ - **Brief 模式**:生成单一文件(HTML 或 JSON),便于分享和上传
46
+ - **Normal 模式**:生成包含多个文件的文件夹,适合本地查看
47
+
48
+ :::
49
+
50
+ ### 2. Rspack Stats 数据
51
+
52
+ 支持上传 Rspack 或 webpack 的 `stats.json` 文件,自动生成分析报告。
53
+
54
+ #### 配置要求
55
+
56
+ 需要配置详细的 stats 选项以获取完整的构建信息:
57
+
58
+ **方式一:使用 verbose 模式**
59
+
60
+ `verbose` 模式会输出所有构建信息(除调试信息外),自动包含 Rsdoctor 所需的数据。如想精简 stats 的输出数据,可参考下方示例。详细说明请查看 [Rspack stats](https://rspack.dev/config/stats)。
61
+
62
+ ```js title="rspack.config.mjs 或 webpack.config.mjs"
63
+ export default {
64
+ stats: 'verbose',
65
+ };
66
+ ```
67
+
68
+ **方式二:stats 配置**
69
+
70
+ 需要按照下面的 Stats options 进行配置。
71
+
72
+ ```js title="rspack.config.mjs 或 webpack.config.mjs"
73
+ export default {
74
+ stats: {
75
+ all: false,
76
+ chunks: true,
77
+ assets: true,
78
+ modules: true,
79
+ chunkModules: true,
80
+ hash: true,
81
+ ids: true,
82
+ version: true,
83
+ optimizationBailout: true, // 可选配置
84
+ },
85
+ };
86
+ ```
87
+
88
+ - 可选配置
89
+ - `optimizationBailout`:可选配置,如果不开启该配置,只会影响每个 Module 的 [Bailout Reason](/guide/usage/module-analysis#bailout-reason) 的展示。
90
+
91
+ #### 使用步骤
92
+
93
+ 1. 在构建配置中设置上述 stats 选项
94
+ 2. 构建项目,生成 `stats.json` 文件
95
+ 3. 访问 [Playground 页面](https://rsdoctor.rs/preview/#/resources/uploader)
96
+ 4. 上传 `stats.json` 文件
97
+ 5. 查看自动生成的分析报告
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/docs",
3
- "version": "1.2.4-beta.5",
3
+ "version": "1.3.0-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -33,7 +33,7 @@
33
33
  "rspress-plugin-sitemap": "^1.1.4",
34
34
  "typescript": "^5.9.2",
35
35
  "@rsbuild/plugin-sass": "^1.4.0",
36
- "@rsdoctor/types": "1.2.4-beta.5"
36
+ "@rsdoctor/types": "1.3.0-beta.1"
37
37
  },
38
38
  "dependencies": {
39
39
  "@rstack-dev/doc-ui": "1.11.0",