@rsdoctor/docs 0.4.5 → 0.4.6

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.
@@ -11,7 +11,7 @@
11
11
  },
12
12
  {
13
13
  "text": "Blog",
14
- "link": "/blog/release/release-note-0_1",
14
+ "link": "/blog/release/release-note-0_4",
15
15
  "activeMatch": "/blog/"
16
16
  }
17
17
  ]
@@ -1 +1 @@
1
- ["release-note-0_1", "release-note-0_3"]
1
+ ["release-note-0_4", "release-note-0_3", "release-note-0_1"]
@@ -0,0 +1,74 @@
1
+ # Rsdoctor v0.4 Release Note
2
+
3
+ Rsdoctor v0.4 is now released!
4
+
5
+ The new features of Rsdoctor v0.4 include:
6
+
7
+ - **Brief Mode**: Outputs a single HTML file, ideal for CI processes.
8
+ - **Bundle Diff**: Compare and analyze changes between two build artifacts.
9
+ - **Vue Loader Analysis**: Added support for loader analysis in Vue projects.
10
+
11
+ ## Brief Mode
12
+
13
+ In Rsdoctor v0.4, a new **Brief mode** has been added, designed specifically for CI/CD scenarios. Brief mode consolidates the data report into a single HTML page, making it convenient for users to view historical build data in CI/CD and other scenarios. The main features of Brief mode are:
14
+
15
+ - **Single report file**: Previously, Rsdoctor output multiple report data and `Manifest.json`, which was inconvenient for CDN upload and sharing. Brief mode outputs a single report, making it convenient for use in CI processes.
16
+ - **Easy to configure**: Enable by configuring the [mode.brief](/config/options/options#mode) option in the Rsdoctor plugin.
17
+ - **Report output**: The report will be generated in the build artifacts directory, and the output directory and filename of the Brief report can be configured.
18
+
19
+ This feature greatly enhances the convenience of using Rsdoctor analysis reports in CI processes. The report can be uploaded to a CDN in the pipeline to display historical reports. [For more details, please refer to](/guide/start/cicd)
20
+
21
+ ## Bundle Diff
22
+
23
+ import { Badge } from '@theme';
24
+
25
+ <Badge text="Version: 0.4.5" type="warning" />
26
+
27
+ The **Bundle Diff** feature helps users compare and analyze changes between two build artifacts. Key capabilities include:
28
+
29
+ - **Total size change**: Displays the total size change between two build artifacts.
30
+ - **File type change**: Compares the size changes of different types of files (JS, CSS, images, fonts, etc.).
31
+ - **First screen resource change**: Analyzes the size changes of resources loaded on the first screen.
32
+ - **Duplicate package count change**: Counts and compares the number of duplicate packages between two builds.
33
+ - **NPM Packages change**: Displays changes in the number of NPM packages, including added, removed, and changed packages.
34
+ - **Detailed data query**: Provides a detailed list module for deeper data query and analysis.
35
+ - **Module-level comparison**: View the name, size, and change rate of modules, and supports viewing the code changes of modules.
36
+
37
+ <div style={{ display: 'flex', justifyContent: 'space-between' }}>
38
+ <img
39
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-cards.png"
40
+ style={{ width: '48%' }}
41
+ />
42
+ <img
43
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-list.png"
44
+ style={{ width: '48%' }}
45
+ />
46
+ </div>
47
+
48
+ This feature enhances the user's ability to visually analyze changes in build artifacts, helping users better understand and optimize build results. [For more details, please refer to](/guide/usage/bundle-diff)
49
+
50
+ ### Next
51
+
52
+ Plans to support Bundle Diff Action on GitHub to simplify degradation monitoring during the CI phase.
53
+
54
+ ## Vue Loader Analysis
55
+
56
+ <Badge text="Version: 0.4.5" type="warning" />
57
+
58
+ Support for loader analysis for Vue projects has been added in Rsdoctor v0.4.
59
+
60
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/d8074588e99dbdcaa278cd1e82f1298663e425db/others/assets/rsdoctor/vue-loader.png" />
61
+
62
+ ## Other Features
63
+
64
+ - **Rspack's builtin:lightningcss-loader analysis**: Added support for [builtin:lightningcss-loader](https://rspack.dev/guide/features/builtin-lightningcss-loader#builtin-lightningcss-loader) analysis.
65
+ - **Performance optimization**:
66
+
67
+ - Reduced the size of the `@rsdoctor/client` package by 60%, improving page rendering speed.
68
+
69
+ <img
70
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/34e6d96d6948a08cade4bd419f50b962e228a4a8/others/assets/rsdoctor/package-size-diff.png"
71
+ style={{ width: '60%', margin: 'auto' }}
72
+ />
73
+
74
+ - Reduced third-party dependencies, thereby reducing the total download size during installation.
@@ -49,6 +49,25 @@ rsdoctor analyze --profile <manifestFile>
49
49
  rsdoctor analyze --profile "./dist/.rsdoctor/manifest.json"
50
50
  ```
51
51
 
52
+ ### `bundle-diff` Command
53
+
54
+ The `bundle-diff` command is used to load **two** [manifest.json](/config/options/term#manifestjson) files **locally** and open the Rsdoctor [Bundle Diff](../usage/bundle-diff) page for **comparison and analysis of build bundles**.
55
+
56
+ ```bash
57
+ rsdoctor bundle-diff --baseline <baselineManifestJsonPath> --current <currentManifestJsonPath>
58
+ ```
59
+
60
+ **Parameter Definitions**
61
+
62
+ - `baselineManifestJsonPath` Path to the [manifest.json](/config/options/term#manifestjson) used as the **baseline** (supports local paths as well as online URLs).
63
+ - `currentManifestJsonPath` Path to the [manifest.json](/config/options/term#manifestjson) used as the **current** (supports local paths as well as online URLs) for comparison with the **baseline**.
64
+
65
+ **Usage Example**
66
+
67
+ ```bash
68
+ rsdoctor bundle-diff --baseline="baseline/.rsdoctor/manifest.json" --current="current/.rsdoctor/manifest.json"
69
+ ```
70
+
52
71
  ## Node API
53
72
 
54
73
  We provide a Node.js API in `@rsdoctor/cli` that allows you to make calls during runtime in Node.js.
@@ -33,4 +33,4 @@ Here you can learn about the main features supported by Rsdoctor.
33
33
  | Bundle Analysis | Analysis of the relationships between assets, chunks, and modules in the artifact, as well as the packaged code and size analysis of each module, etc. | [Bundle Analysis](../usage/bundle-size) |
34
34
  | Module Analysis | Analysis of module dependencies | [Modules Dependency Analysis](../usage/module-analysis) |
35
35
  | Duplicate Packages Optimization | Inspection of duplicate dependencies used in the project | [Duplicate Packages Optimization](../../blog/topic/duplicate-pkg-problem) |
36
- | Bundle Diff | Comparative analysis of two artifacts | Planned support |
36
+ | Bundle Diff | Comparative analysis of two artifacts | [Bundle Diff](../usage/bundle-diff) |
@@ -161,10 +161,6 @@ export default defineConfig({
161
161
 
162
162
  - **Options:** The plugin provides some configurations, please refer to [Options](../../config/options/options).
163
163
 
164
- #### 📢 Vue Project Notice
165
-
166
- Because `vue-loader` analysis is not supported at the moment, loader analysis is disabled by default for Vue projects. However, plugin and build artifact analysis can still be performed.
167
-
168
164
  ---
169
165
 
170
166
  ## Step 3: Run Build
@@ -10,5 +10,6 @@
10
10
  "bundle-size",
11
11
  "module-analysis",
12
12
  "resolver",
13
- "rule-config"
13
+ "rule-config",
14
+ "bundle-diff"
14
15
  ]
@@ -0,0 +1,131 @@
1
+ # Bundle Diff
2
+
3
+ import { Badge } from '@theme';
4
+
5
+ <Badge text="Version: 0.4.5" type="warning" />
6
+
7
+ We provide the Bundle Diff feature, which allows you to compare and analyze the changes between two build bundles.
8
+
9
+ Currently, we offer the following usage methods:
10
+
11
+ - [Open locally with CLI](/guide/start/cli)
12
+ - Online upload analysis (planned support)
13
+
14
+ ## Usage
15
+
16
+ ### Open locally with CLI
17
+
18
+ First, you need to prepare **2 copies** of the [manifest.json](/config/options/term#manifestjson) produced by Rsdoctor. Then, install [@rsdoctor/cli](/guide/start/cli#cli-tutorial) and use the CLI command `bundle-diff`. For detailed command usage, see [command usage tutorial](/guide/start/cli#bundle-diff-command).
19
+
20
+ ### Online upload analysis (planned support)
21
+
22
+ We plan to provide an online page for Bundle Diff analysis. You can upload **2 copies** of the [manifest.json](/config/options/term#manifestjson) produced by Rsdoctor on the page, one as the Baseline and the other as the Current. By clicking Start Diff, you can enter our analysis page.
23
+
24
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/51ae2fdf0635ebf52ef04a11f779314c64ef2fb6/others/assets/rsdoctor/bundle-diff.png" />
25
+
26
+ ## User Guide
27
+
28
+ ### Feature Overview
29
+
30
+ In the Bundle Diff module, you can see the comparison of information between the two build bundles, including:
31
+
32
+ - **total size changes**
33
+ - **size changes of different file types**
34
+ - **initial bundles size changes**
35
+ - **changes in the number of duplicate packages**
36
+ - **changes in the number of NPM Packages**, and more.
37
+
38
+ In addition to the above data overview, we can also perform more in-depth data query and analysis through the **details list** module at the bottom of the page.
39
+
40
+ ### Terminology
41
+
42
+ | Term | Description |
43
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
44
+ | <b><i>Baseline</i></b> | Represents the **reference data source** |
45
+ | <b><i>Current</i></b> | Represents the **target data source** to be compared with the Baseline |
46
+ | <b><i>Asset / Assets</i></b> | Represents the **build files** |
47
+ | <b><i>Bundle Size</i></b> | Represents the **total size** of all files in the build |
48
+ | <b><i>Total JS</i></b> | Represents the total size of all `.js` files in the build |
49
+ | <b><i>Initial JS</i></b> | Represents the total size of all **first screen** `.js` files in the build |
50
+ | <b><i>Total CSS</i></b> | Represents the total size of all `.css` files in the build |
51
+ | <b><i>Initial CSS</i></b> | Represents the total size of all **first screen** `.css` files in the build |
52
+ | <b><i>Image</i></b> | Represents the total size of all `.png`/`.jpg`/`.svg`/`.webp`/`.jpeg`/`.gif`/`.bmp` files in the build |
53
+ | <b><i>Font</i></b> | Represents the total size of all `.ttf`/`.fnt`/`.fon`/`.otf` files in the build |
54
+ | <b><i>Media</i></b> | Represents the total size of all `.mp3`/`.mp4`/`.avi`/`.wav`/`.flv`/`.mov`/`.mpg`/`.mpeg` files in the build |
55
+ | <b><i>HTML</i></b> | Represents the total size of all `.html` files in the build |
56
+ | <b><i>Duplicate Packages</i></b> | Represents the **total number of duplicate packages** in the build |
57
+ | <b><i>Modules</i></b> | Represents the total number of modules in the build |
58
+ | <b><i>Packages</i></b> | Represents the total number of **NPM Packages** in the build |
59
+ | <b><i>New</i></b> | Represents **newly added** items, i.e., **not present in Baseline but present in Current** |
60
+ | <b><i>Deleted</i></b> | Represents **removed** items, i.e., **present in Baseline but not in Current** |
61
+ | <b><i>Changed</i></b> | Represents items that **only changed in content**, i.e., **present in both Baseline and Current but with content changes** |
62
+ | <b><i>Parsed Size</i></b> | Represents the **final size** of the build bundles |
63
+
64
+ ### Instructions
65
+
66
+ #### Dashboard
67
+
68
+ At the top of the page, we can see many data points composed of different cards, including the following information:
69
+
70
+ - **Bundle Size** includes the total size of the two builds and the change rate.
71
+ - **Total JS | Initial JS** includes the total size and change rate of all JS and first screen JS in the two builds.
72
+ - **Total CSS | Initial CSS** includes the total size and change rate of all CSS and first screen CSS in the two builds.
73
+ - **Image | Font | Media** includes the size and change rate of image, font, and media files.
74
+ - **HTML** includes the size and change rate of HTML files.
75
+ - **Others** represents the size and change rate of all other files not mentioned above.
76
+ - **Duplicate Package** represents the number of duplicate packages in the two builds. Clicking on it allows you to view the details of the duplicate packages.
77
+ - **Modules** represents the number of modules in the two builds.
78
+ - **Packages** represents the total number of NPM Packages in the two builds, as well as the number of new, deleted, and changed packages.
79
+
80
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-cards.png" />
81
+
82
+ #### Overview
83
+
84
+ In the Overview module, we can see the **size**, **quantity**, and **change rate** of different **file types**.
85
+
86
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-all.png" />
87
+
88
+ #### Assets
89
+
90
+ :::tip
91
+ When displaying Asset names, Rsdoctor tries to remove the hash values from the build file names to facilitate comparison.
92
+ :::
93
+
94
+ In the Assets module, we can see the **size** and **change rate** of the build files.
95
+
96
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets-list.png" />
97
+
98
+ By **clicking** the **"+" button** in front of the list items, you can expand to see the **list of modules** contained in the corresponding Asset (i.e., `Modules of "xxx"`), which shows the **size** and **change rate** of the modules.
99
+
100
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets.png" />
101
+
102
+ Rsdoctor is compatible with the situation where Assets files have **the same name but different hashes**. However, for Assets with **different names generated by splitting packages**, Rsdoctor cannot identify their comparison objects.
103
+
104
+ Therefore, the Rsdoctor Assets module also provides a select component, allowing you to **manually select the Assets resources you want to compare**.
105
+
106
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-select-assets.png" />
107
+
108
+ #### Modules
109
+
110
+ In the Modules module, we can see the **name**, **size**, and **change rate** of all modules contained in the two builds.
111
+
112
+ The `New` / `Deleted` / `Changed` tags indicate whether the module is newly added, deleted, or just changed in the `Current` build.
113
+
114
+ The `node_modules` tag indicates that the module's path contains `/node_modules/`.
115
+
116
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-list.png" />
117
+
118
+ On the right side of the list items, you can view the module code changes by clicking the corresponding "View Changes" button.
119
+
120
+ **Code comparison includes several types of data:**
121
+
122
+ - **Source Code: Source code data.** Available in `Normal` mode, not available in `Lite` mode, and not available in `Brief` mode.
123
+ - **Bundled Code: Built code.** Available in `Normal` mode, available in `Lite` mode, and not available in `Brief` mode.
124
+
125
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-changes.png" />
126
+
127
+ #### Packages
128
+
129
+ In the Packages module, we can see the **list of all NPM Packages** contained in the two builds. Each list item includes the **Package Name**, **Version**, and **Parsed Size** (final size after packaging).
130
+
131
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-packages.png" />
@@ -11,7 +11,7 @@
11
11
  },
12
12
  {
13
13
  "text": "博客",
14
- "link": "/blog/release/release-note-0_1",
14
+ "link": "/blog/release/release-note-0_4",
15
15
  "activeMatch": "/blog/"
16
16
  }
17
17
  ]
@@ -1 +1 @@
1
- ["release-note-0_1", "release-note-0_3"]
1
+ ["release-note-0_4", "release-note-0_3", "release-note-0_1"]
@@ -0,0 +1,77 @@
1
+ # Rsdoctor v0.4 Release Note
2
+
3
+ Rsdoctor v0.4 已经发布啦!
4
+
5
+ Rsdoctor v0.4 的新特性有:
6
+
7
+ - **Brief 模式**: 输出单个报告文件,适用于 CI 流程。
8
+ - **Bundle Diff**: 对比和分析两次构建产物的变化。
9
+ - **Vue Loader 分析**: 增加了对 Vue 项目中 loader 分析的支持。
10
+
11
+ ## Brief Report
12
+
13
+ 在 Rsdoctor v0.4 中,新增了 **Brief 模式**,专为 CI/CD 场景设计。Brief 模式将数据报告整合到一个 HTML 页面中,方便用户在 CI/CD 及其他场景下查看历史构建数据。以下是 Brief 模式的主要特点:
14
+
15
+ - **单个报告文件**:之前 Rsdoctor 输出的多个报告数据与 `Manifest.json`,不方便进行 CDN 上传和共享,Brief 模式输出单一报告方便 CI 流程中使用。
16
+ - **易于配置**:通过配置 Rsdoctor 插件的 [mode.brief](/config/options/options#mode) 选项即可开启 Brief 模式。
17
+ - **报告输出**:报告会生成在构建产物目录中,同时可配置 Brief 报告生成目录和文件名。
18
+
19
+ 此功能极大地提升了在 CI 流程中使用 Rsdoctor 分析报告的便捷性,可以在 Pipeline 中将报告上传到 CDN 以便展示历史报告。[详情请参阅](/guide/start/cicd)
20
+
21
+ ## Bundle Diff
22
+
23
+ import { Badge } from '@theme';
24
+
25
+ <Badge text="Version: 0.4.5" type="warning" />
26
+
27
+ 我们引入了 **Bundle Diff** 功能,帮助用户对比分析两次构建产物的变化。以下是 Bundle Diff 的主要能力:
28
+
29
+ - **总体积变化**:展示两次构建产物的总体积变化。
30
+ - **文件类型变化**:对比不同类型文件(如 JS、CSS、图片、字体等)的体积变化。
31
+ - **首屏资源变化**:分析首屏加载资源的体积变化。
32
+ - **重复包数量变化**:统计并对比两次构建中重复包的数量变化。
33
+ - **NPM Packages 变化**:展示 NPM 包的数量变化,包括新增、删除和变更的包。
34
+ - **详细数据查询**:通过详情列表模块,进行更深入的数据查询和分析。
35
+ - **模块级别对比**:查看模块的名称、体积及变化幅度,并支持查看模块代码的变更。
36
+
37
+ <div style={{ display: 'flex', justifyContent: 'space-between' }}>
38
+ <img
39
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-cards.png"
40
+ style={{ width: '48%' }}
41
+ />
42
+ <img
43
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-list.png"
44
+ style={{ width: '48%' }}
45
+ />
46
+ </div>
47
+
48
+ 此功能极大地提升了用户对构建产物变化的可视化分析能力,帮助用户更好地理解和优化构建结果。[详情请参阅](/guide/usage/bundle-diff)
49
+
50
+ ### 计划
51
+
52
+ 后续将计划支持用于 GitHub 平台的 Bundle Diff Action,更方便的进行 CI 阶段的劣化监控。
53
+
54
+ ## 支持 Vue Loader 分析能力
55
+
56
+ <Badge text="Version: 0.4.5" type="warning" />
57
+
58
+ 在 Rsdoctor 0.4 版本中支持了 Vue 项目的 Loader 分析。
59
+
60
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/d8074588e99dbdcaa278cd1e82f1298663e425db/others/assets/rsdoctor/vue-loader.png" />
61
+
62
+ ## 其他 Feature
63
+
64
+ - 支持了 Rspack 的 builtin:lightningcss-loader 分析
65
+
66
+ 在 Rsdoctor 0.4 版本中支持了 Rspack 的 [builtin:lightningcss-loader](https://rspack.dev/guide/features/builtin-lightningcss-loader#builtin-lightningcss-loader) 分析。
67
+
68
+ - Rsdoctor 自身的性能优化
69
+
70
+ - 减少了 60% 的 `@rsdoctor/client` 包体积,提高页面渲染速度。
71
+
72
+ <img
73
+ src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/34e6d96d6948a08cade4bd419f50b962e228a4a8/others/assets/rsdoctor/package-size-diff.png"
74
+ style={{ width: '60%', margin: 'auto' }}
75
+ />
76
+
77
+ - 减少 Rsdoctor 可替代的第三方依赖包,从而减少安装时下载总大小。
@@ -49,6 +49,25 @@ rsdoctor analyze --profile <manifestFile>
49
49
  rsdoctor analyze --profile "./dist/.rsdoctor/manifest.json"
50
50
  ```
51
51
 
52
+ ### bundle-diff 命令
53
+
54
+ `bundle-diff` 命令是用于在**本地**加载**两份** [manifest.json](/config/options/term#manifestjson) 并且打开 Rsdoctor 的 [Bundle Diff](../usage/bundle-diff) 页面进行**构建产物的对比和分析**。
55
+
56
+ ```bash
57
+ rsdoctor bundle-diff --baseline <baselineManifestJsonPath> --current <currentManifestJsonPath>
58
+ ```
59
+
60
+ **参数定义**
61
+
62
+ - `baselineManifestJsonPath` 当作 **基准** 的 [manifest.json](/config/options/term#manifestjson) 的路径(支持本地路径以及在线 url)
63
+ - `currentManifestJsonPath` 当作 **当前** 的 [manifest.json](/config/options/term#manifestjson) 的路径(支持本地路径以及在线 url),用于和 **基准** 进行对比
64
+
65
+ **使用示例**
66
+
67
+ ```bash
68
+ rsdoctor bundle-diff --baseline="baseline/.rsdoctor/manifest.json" --current="current/.rsdoctor/manifest.json"
69
+ ```
70
+
52
71
  ## Node API
53
72
 
54
73
  我们在 `@rsdoctor/cli` 中提供了 Node.js API,可以让你在 Node.js 运行时进行调用。
@@ -33,4 +33,4 @@
33
33
  | 产物分析 | 产物中 assets、chunks、modules 关系分析,以及每个 module 打包代码及大小分析等 | [产物分析](../usage/bundle-size) |
34
34
  | 模块分析 | Modules 依赖关系分析 | [Modules 依赖链分析](../usage/module-analysis) |
35
35
  | 重复包优化 | 检查项目使用的依赖包的重复情况 | [重复包优化](../../blog/topic/duplicate-pkg-problem) |
36
- | Bundle Diff | 两份产物对比分析 | 计划支持 |
36
+ | Bundle Diff | 两份产物对比分析 | [Bundle Diff](../usage/bundle-diff) |
@@ -160,10 +160,6 @@ export default defineConfig({
160
160
 
161
161
  - **Options:** 插件提供了一些配置项,请参考 [Options](../../config/options/options)。
162
162
 
163
- #### 📢 Vue 项目使用注意
164
-
165
- 由于目前不支持对 `vue-loader` 进行分析,对于 Vue 项目,默认情况下禁用了 loader 分析。但是,仍然可以进行插件和构建产物的分析。
166
-
167
163
  ---
168
164
 
169
165
  ## 第三步:执行构建
@@ -10,5 +10,6 @@
10
10
  "bundle-size",
11
11
  "module-analysis",
12
12
  "resolver",
13
- "rule-config"
13
+ "rule-config",
14
+ "bundle-diff"
14
15
  ]
@@ -0,0 +1,131 @@
1
+ # Bundle Diff
2
+
3
+ import { Badge } from '@theme';
4
+
5
+ <Badge text="Version: 0.4.5" type="warning" />
6
+
7
+ 我们提供了 Bundle Diff 的功能,可以让你进行对比分析两次构建产物发生的变化。
8
+
9
+ 目前我们提供了以下几种使用方式:
10
+
11
+ - [CLI 本地打开](/guide/start/cli)
12
+ - 在线上传分析(计划支持)
13
+
14
+ ## 使用方式
15
+
16
+ ### CLI 本地打开
17
+
18
+ 首先你需要准备 **2 份** Rsdoctor 产出的[manifest.json](/config/options/term#manifestjson),然后通过安装[@rsdoctor/cli](/guide/start/cli#%E5%AE%89%E8%A3%85-rsdoctorcli) 并使用 CLI 提供的 `bundle-diff` 命令,详见[命令使用教程](/guide/start/cli#bundle-diff-%E5%91%BD%E4%BB%A4)。
19
+
20
+ ### 在线上传分析(计划支持)
21
+
22
+ 我们计划提供了一个在线页面用于 Bundle Diff 分析,你可以通过在页面中上传 **2 份** Rsdoctor 产出的[manifest.json](/config/options/term#manifestjson),其中一份作为基准(Baseline),另一份则作为当前产物结果 (Current),通过点击 Start Diff 则就可以进入我们的分析页面。
23
+
24
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/51ae2fdf0635ebf52ef04a11f779314c64ef2fb6/others/assets/rsdoctor/bundle-diff.png" />
25
+
26
+ ## 使用指南
27
+
28
+ ### 功能概览
29
+
30
+ 在 Bundle Diff 模块,你可以看到两次产物结果的信息对比,其中包含:
31
+
32
+ - **总体积变化**
33
+ - **不同类型文件的体积变化**
34
+ - **首屏资源的体积变化**
35
+ - **重复包的数量变化**
36
+ - **NPM Packages 的数量变化** 等信息
37
+
38
+ 除了上面的数据变化概览之外,我们还能通过页面下方的**详情列表**模块,进行更深入的数据查询分析。
39
+
40
+ ### 名词释义
41
+
42
+ | 名词 | 描述说明 |
43
+ | -------------------------------- | ---------------------------------------------------------------------------------- |
44
+ | <b><i>Baseline</i></b> | 代表作为**基准的数据源** |
45
+ | <b><i>Current</i></b> | 代表当前需要**与 Baseline 进行对比的目标数据源** |
46
+ | <b><i>Asset / Assets</i></b> | 代表当前**产物文件** |
47
+ | <b><i>Bundle Size</i></b> | 代表产物中**所有文件**的体积 |
48
+ | <b><i>Total JS</i></b> | 代表产物中所有 `.js` 文件的体积 |
49
+ | <b><i>Initial JS</i></b> | 代表产物中所有**首屏**加载的 `.js` 文件的体积 |
50
+ | <b><i>Total CSS</i></b> | 代表产物中所有 `.css` 文件的体积 |
51
+ | <b><i>Initial CSS</i></b> | 代表产物中所有**首屏**加载的 `.css` 文件的体积 |
52
+ | <b><i>Image</i></b> | 代表产物中所有 `.png`/`.jpg`/`.svg`/`.webp`/`.jpeg`/`.gif`/`.bmp` 的文件体积 |
53
+ | <b><i>Font</i></b> | 代表产物中所有 `.ttf`/`.fnt`/`.fon`/`.otf` 的文件体积 |
54
+ | <b><i>Media</i></b> | 代表产物中所有 `.mp3`/`.mp4`/`.avi`/`.wav`/`.flv`/`.mov`/`.mpg`/`.mpeg` 的文件体积 |
55
+ | <b><i>HTML</i></b> | 代表产物中所有 `.html` 的文件体积 |
56
+ | <b><i>Duplicate Packages</i></b> | 代表产物中存在的**重复包总数** |
57
+ | <b><i>Modules</i></b> | 代表产物中 Module 总数 |
58
+ | <b><i>Packages</i></b> | 代表产物中存在的 **NPM Packages 总数** |
59
+ | <b><i>New</i></b> | 代表**新增**,即 **Baseline 中不存在,Current 中存在** |
60
+ | <b><i>Deleted</i></b> | 代表**移除了**,即 **Baseline 中存在,Current 中不存在** |
61
+ | <b><i>Changed</i></b> | 代表**只发生了内容改变**,即 **Baseline 和 Current 中都存在**,但是**内容变化**了 |
62
+ | <b><i>Parsed Size</i></b> | 代表**打包进产物的最终体积** |
63
+
64
+ ### 使用说明
65
+
66
+ #### Dashboard
67
+
68
+ 在页面顶部,我们可以看到很多数据由不同的卡片组成,其中包含了如下信息:
69
+
70
+ - **Bundle Size** 包含了两次产物总体积以及变化幅度。
71
+ - **Total JS | Initial JS** 包含了两次产物中 所有 JS 与 首屏 JS 的总体积以及变化幅度。
72
+ - **Total CSS | Initial CSS** 包含了两次产物中 所有 CSS 与 首屏 CSS 的总体积以及变化幅度。
73
+ - **Image | Font | Media** 包含了图片、字体、音频类文件的体积以及变化幅度。
74
+ - **HTML** 包含了 html 文件的体积以及变化幅度。
75
+ - **Others** 代表除了上述文件外的其他所有文件的体积以及变化幅度。
76
+ - **Duplicate Package** 代表两次产物中存在的重复包数量,点击则可以查看对应的重复包详情。
77
+ - **Modules** 代表两次产物中存在的 Modules 数量。
78
+ - **Packages** 代表两次产物中存在的 NPM Packages 总数,以及新增、删除、变更的数量变化。
79
+
80
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-cards.png" />
81
+
82
+ #### Overview
83
+
84
+ 在 Overview 模块中,我们可以看到不同**文件类型维度**的**体积**、**数量**以及**变化幅度**。
85
+
86
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-all.png" />
87
+
88
+ #### Assets
89
+
90
+ :::tip
91
+ Rsdoctor 在展示 Asset 名称时,会尝试移除产物文件名中的 hash 值,以方便进行产物文件对比。
92
+ :::
93
+
94
+ 在 Assets 模块中,我们可以看到产物文件之间的**体积**以及**变化幅度**。
95
+
96
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets-list.png" />
97
+
98
+ 同时**点击**列表项目前的 **"+" 按钮**,则可以展开看到对应 Asset 所**包含的模块列表**(即 `Modules of "xxx"`),其中则会显示模块之间的**体积**以及**变化幅度**。
99
+
100
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets.png" />
101
+
102
+ Rsdoctor 会**兼容同名 Assets 文件 hash 不同**的情况,但是对于**拆包产生的命名不同的 Assets**,Rsdoctor 则无法辨别其比较对象。
103
+
104
+ 所以 Rsdoctor Assets 模块**还提供了 select 组件**,你可以**手动选择想要对比的 Assets 资源**。
105
+
106
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/6c20c39a1dd576a513c2a7cb0fb0d2e162f63343/others/assets/rsdoctor/bundle-diff-select-assets.png" />
107
+
108
+ #### Modules
109
+
110
+ 在 Modules 模块中,我们可以看到两次产物中包含的所有模块的**名称**、**体积**以及**变化幅度**。
111
+
112
+ 其中 `New` / `Deleted` / `Changed` 标签则代表模块在 `Current` 中到底是 新增 还是 被删除 或者只是发生了改变。
113
+
114
+ 而 `node_modules` 标签则意味着该模块的路径中包含了 `/node_modules/`。
115
+
116
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-list.png" />
117
+
118
+ 在列表项的右侧,则可以通过对应的「View Changes」按钮来查看模块代码的变更。
119
+
120
+ **代码对比,分几种数据:**
121
+
122
+ - **Source Code: 源码数据。** `Normal` 模式下存在代码资源,`Lite` 模式下不存在代码资源,`Brief` 模式不存在代码资源。
123
+ - **Bundled Code: 构建后代码。** `Normal` 模式下存在代码资源,`Lite` 模式下存在代码资源,`Brief` 模式不存在代码资源。
124
+
125
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-module-changes.png" />
126
+
127
+ #### Packages
128
+
129
+ 在 Packages 模块,我们可以看到两次产物中包含的**所有 NPM Packages 列表**,每个列表项则会包含其对应的 **Package Name**、**Version(版本号)**、**Parsed Size(打包后的最终体积)**。
130
+
131
+ <img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-packages.png" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/docs",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -28,7 +28,7 @@
28
28
  "rsbuild-plugin-open-graph": "^1.0.2",
29
29
  "rspress-plugin-font-open-sans": "^1.0.0",
30
30
  "typescript": "^5.2.2",
31
- "@rsdoctor/types": "0.4.5"
31
+ "@rsdoctor/types": "0.4.6"
32
32
  },
33
33
  "dependencies": {
34
34
  "react-markdown": "^9.0.1",