@rsdoctor/docs 0.3.12-alpha.0 → 0.4.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.
- package/docs/en/config/options/options-shared.mdx +11 -10
- package/docs/en/config/options/options.mdx +82 -38
- package/docs/en/guide/start/_meta.json +1 -1
- package/docs/en/guide/start/cicd.mdx +42 -0
- package/docs/en/shared/features-rspack.md +25 -0
- package/docs/en/shared/features.md +30 -0
- package/docs/en/shared/mode-intro.md +5 -0
- package/docs/zh/config/options/options-shared.mdx +10 -10
- package/docs/zh/config/options/options.mdx +81 -13
- package/docs/zh/guide/start/_meta.json +1 -1
- package/docs/zh/guide/start/cicd.mdx +44 -0
- package/docs/zh/shared/features-rspack.md +1 -0
- package/docs/zh/shared/features.md +1 -0
- package/docs/zh/shared/mode-intro.md +5 -0
- package/package.json +7 -7
|
@@ -23,6 +23,17 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
23
23
|
|
|
24
24
|
#### features values
|
|
25
25
|
|
|
26
|
+
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
27
|
+
|
|
28
|
+
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
29
|
+
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
30
|
+
- **bundle**: Analysis of build artifacts, enabled by default.
|
|
31
|
+
- **resolver**: resolver analysis, disabled by default.
|
|
32
|
+
- **lite**: [**depracated, please use [mode.lite](#mode)**]
|
|
33
|
+
lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
34
|
+
|
|
35
|
+
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
36
|
+
|
|
26
37
|
:::tip
|
|
27
38
|
|
|
28
39
|
**If an "out of memory" error occurs, you can try the following:**
|
|
@@ -35,16 +46,6 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
35
46
|
|
|
36
47
|
:::
|
|
37
48
|
|
|
38
|
-
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
39
|
-
|
|
40
|
-
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
41
|
-
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
42
|
-
- **bundle**: Analysis of build artifacts, enabled by default.
|
|
43
|
-
- **resolver**: resolver analysis, disabled by default.
|
|
44
|
-
- **lite**: lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
45
|
-
|
|
46
|
-
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
47
|
-
|
|
48
49
|
#### features types
|
|
49
50
|
|
|
50
51
|
- if the `features` is set as an `Array`, it will **open** the features which you define in this array **only**.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
1
3
|
# Options
|
|
2
4
|
|
|
3
5
|
## RsdoctorRspackPlugin
|
|
@@ -91,11 +93,22 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
91
93
|
|
|
92
94
|
#### features values
|
|
93
95
|
|
|
96
|
+
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
97
|
+
|
|
98
|
+
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
99
|
+
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
100
|
+
- **bundle**: Analysis of build bundles, enabled by default.
|
|
101
|
+
- **resolver**: resolver analysis, disabled by default.
|
|
102
|
+
- **lite**: [**depracated, please use [mode.lite](#mode)**]
|
|
103
|
+
lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
104
|
+
|
|
105
|
+
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
106
|
+
|
|
94
107
|
:::tip
|
|
95
108
|
|
|
96
109
|
**If an "out of memory" error occurs, you can try the following:**
|
|
97
110
|
|
|
98
|
-
1. Open the **lite** mode
|
|
111
|
+
1. Open the **lite** mode.[mode.lite](#mode)
|
|
99
112
|
2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
|
|
100
113
|
|
|
101
114
|
- Reason: During the build process, source code information is cached, which exceeds memory. Therefore, enabling the **"lite" mode** can help alleviate the problem.
|
|
@@ -103,63 +116,94 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
103
116
|
|
|
104
117
|
:::
|
|
105
118
|
|
|
106
|
-
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
107
|
-
|
|
108
|
-
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
109
|
-
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
110
|
-
- **bundle**: Analysis of build artifacts, enabled by default.
|
|
111
|
-
- **resolver**: resolver analysis, disabled by default.
|
|
112
|
-
- **lite**: lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
113
|
-
|
|
114
|
-
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
115
|
-
|
|
116
119
|
#### features types
|
|
117
120
|
|
|
118
121
|
- if the `features` is set as an `Array`, it will **open** the features which you define in this array **only**.
|
|
119
122
|
- if the `features` is set as an `Object`, it will **close** the features which you set the value is `false`.
|
|
120
123
|
|
|
121
|
-
|
|
124
|
+
#### RsdoctorWebpackPluginFeatures
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
- Optional: true
|
|
125
|
-
- Default: undefined
|
|
126
|
-
- Description
|
|
126
|
+
`features` type:
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
import Features from '@en/shared/features.md';
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
<Features />
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
#### RsdoctorRspackPluginFeatures
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
`features` type:
|
|
135
135
|
|
|
136
|
-
-
|
|
136
|
+
import FeaturesRspack from '@en/shared/features-rspack.md';
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
<FeaturesRspack />
|
|
139
|
+
|
|
140
|
+
### mode
|
|
141
|
+
|
|
142
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
143
|
+
|
|
144
|
+
- **Type:** `normal | brief | lite`
|
|
145
|
+
- **Optional:** `true`
|
|
146
|
+
- **Default:** `normal`
|
|
147
|
+
|
|
148
|
+
Choose the Rsdoctor build report mode to use, which includes the following options:
|
|
149
|
+
|
|
150
|
+
import ModeIntro from '@en/shared/mode-intro.md';
|
|
151
|
+
|
|
152
|
+
<ModeIntro />
|
|
153
|
+
|
|
154
|
+
### reportDir
|
|
155
|
+
|
|
156
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
157
|
+
|
|
158
|
+
- **Type:** string
|
|
159
|
+
- **Optional:** `true`
|
|
160
|
+
- **Default:** undefined
|
|
161
|
+
|
|
162
|
+
The output directory for Rsdoctor reports. By default, it is the build output directory.
|
|
163
|
+
|
|
164
|
+
### brief
|
|
165
|
+
|
|
166
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
167
|
+
|
|
168
|
+
- **Type:** [BriefType](#brieftype)
|
|
169
|
+
- **Optional:** `true`
|
|
170
|
+
- **Default:** undefined
|
|
171
|
+
|
|
172
|
+
More configurations for Brief mode are as follows:
|
|
173
|
+
|
|
174
|
+
- **reportHtmlName:** Configures the name of the HTML report for Brief mode. The default value is `report-rsdoctor.html`.
|
|
175
|
+
- **writeDataJson:** By default, in Brief mode, the analysis data is injected into the HTML file, so no additional build analysis data is generated. If you want to generate additional local data, you need to configure `writeDataJson: true`.
|
|
176
|
+
|
|
177
|
+
#### briefType
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
interface BriefConfig {
|
|
181
|
+
reportHtmlName?: string | undefined;
|
|
182
|
+
writeDataJson: boolean;
|
|
183
|
+
}
|
|
144
184
|
```
|
|
145
185
|
|
|
146
|
-
###
|
|
186
|
+
### reportCodeType
|
|
147
187
|
|
|
148
|
-
- Type: boolean
|
|
188
|
+
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
149
189
|
- Optional: true
|
|
150
|
-
- Default:
|
|
190
|
+
- Default: undefined
|
|
151
191
|
- Description
|
|
152
192
|
|
|
153
|
-
|
|
193
|
+
- Select the output analysis data:
|
|
194
|
+
|
|
195
|
+
- default is all complete data;
|
|
196
|
+
|
|
197
|
+
- noModuleSource: true is the output of data other than module code; Module code is the packaged module code of a file disassembled in the Bundle.
|
|
198
|
+
|
|
199
|
+
- noAssetsAndModuleSource: true is the output of data other than module code and Assets product code.
|
|
154
200
|
|
|
155
201
|
- Example
|
|
156
202
|
|
|
157
203
|
```js
|
|
158
|
-
new
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
disableTOSUpload: true,
|
|
162
|
-
}),
|
|
204
|
+
new RsdoctorRspackPlugin({
|
|
205
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
206
|
+
}),
|
|
163
207
|
```
|
|
164
208
|
|
|
165
209
|
### supports
|
|
@@ -215,14 +259,14 @@ Disabling the Parse Bundle capability will only affect the visibility of the Bun
|
|
|
215
259
|
<img
|
|
216
260
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-size.jpeg"
|
|
217
261
|
height="300px"
|
|
218
|
-
width="
|
|
262
|
+
width="300px"
|
|
219
263
|
style={{ margin: 'auto' }}
|
|
220
264
|
/>
|
|
221
265
|
|
|
222
266
|
<img
|
|
223
267
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-code.png"
|
|
224
268
|
height="300px"
|
|
225
|
-
width="
|
|
269
|
+
width="400px"
|
|
226
270
|
style={{ margin: 'auto' }}
|
|
227
271
|
/>
|
|
228
272
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
["intro", "quick-start", "features", "cli"]
|
|
1
|
+
["intro", "quick-start", "features", "cicd", "cli"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
3
|
+
# CI/CD Tutorial
|
|
4
|
+
|
|
5
|
+
In CI/CD, there is often a desire to upload historical reports to the CDN as historical records. Because it's not convenient to achieve instant use in the standard mode, the **Brief** mode is supported.
|
|
6
|
+
|
|
7
|
+
## Brief Mode
|
|
8
|
+
|
|
9
|
+
In Brief mode, data reports are integrated into a single HTML page, making it easy for users to view historical build data in a summary form within CI/CD and other scenarios.
|
|
10
|
+
|
|
11
|
+
### Enabling Brief Mode
|
|
12
|
+
|
|
13
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
14
|
+
|
|
15
|
+
You can enable Brief mode by configuring the [mode.brief](/config/options/options#mode) option in the Rsdoctor plugin. After the build, Brief mode will generate a report in the build output directory: `[outputDir]/.rsdoctor/report-rsdoctor.html`. You can view the build analysis summary by opening the HTML file in a browser.
|
|
16
|
+
|
|
17
|
+
- In Brief mode, no code data is displayed to prevent the page from crashing due to large data sizes.
|
|
18
|
+
- The report output directory and file name can be configured. Refer to: [Options](/config/options/options#brief).
|
|
19
|
+
- For more configurations, refer to: [Options](/config/options/options#brief).
|
|
20
|
+
|
|
21
|
+
```ts title="rspack.config.js"
|
|
22
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
// ...
|
|
26
|
+
plugins: [
|
|
27
|
+
process.env.RSDOCTOR &&
|
|
28
|
+
new RsdoctorRspackPlugin({
|
|
29
|
+
// other options
|
|
30
|
+
mode: 'brief',
|
|
31
|
+
}),
|
|
32
|
+
].filter(Boolean),
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Differences between Brief Mode and Lite Mode
|
|
37
|
+
|
|
38
|
+
Currently, Rsdoctor has several report modes: `Normal, Brief, and Lite`.
|
|
39
|
+
|
|
40
|
+
import ModeIntro from '@en/shared/mode-intro.md';
|
|
41
|
+
|
|
42
|
+
<ModeIntro />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
interface RsdoctorRspackPluginFeatures {
|
|
3
|
+
/**
|
|
4
|
+
* turn off it if you need not to analyze the executions of webpack loaders.
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
loader?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* turn off it if you need not to analyze the executions of webpack plugins.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
plugins?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* turn off it if you need not to analyze the output bundle.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
bundle?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* turn on it if you just use lite mode. This mode do not have source codes.
|
|
20
|
+
* @default false
|
|
21
|
+
* @deprecated
|
|
22
|
+
*/
|
|
23
|
+
lite?: boolean;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
interface RsdoctorWebpackPluginFeatures {
|
|
3
|
+
/**
|
|
4
|
+
* turn off it if you need not to analyze the executions of webpack loaders.
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
loader?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* turn off it if you need not to analyze the executions of webpack plugins.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
plugins?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* turn off it if you need not to analyze the executions of resolver.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
resolver?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* turn off it if you need not to analyze the output bundle.
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
bundle?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* turn on it if you just use lite mode. This mode do not have source codes.
|
|
25
|
+
* @default false
|
|
26
|
+
* @deprecated
|
|
27
|
+
*/
|
|
28
|
+
lite?: boolean;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- **normal mode:** Generates a `.rsdoctor` folder in the build output directory, which contains various data files and displays code in the report page. The output directory can be configured via [reportDir](/config/options/options#reportdir).
|
|
2
|
+
|
|
3
|
+
- **brief mode:** Generates an HTML report file in the `.rsdoctor` folder within the build output directory. All build analysis data will be consolidated into this HTML file, which can be viewed by opening it in a browser. Brief mode also has additional configuration options, detailed at: [brief](/config/options/options#brief).
|
|
4
|
+
|
|
5
|
+
- **lite mode:** Based on the normal mode, this mode does not display source code and product code, only showing the information of the bundled code.
|
|
@@ -27,6 +27,16 @@
|
|
|
27
27
|
|
|
28
28
|
#### features values
|
|
29
29
|
|
|
30
|
+
features 属性是用于分析功能开关的,具体的功能项如下:
|
|
31
|
+
|
|
32
|
+
- **loader**:Loaders 耗时及代码编译变化分析,默认开启。
|
|
33
|
+
- **plugins**:Plugins 调用以及耗时分析,默认开启。
|
|
34
|
+
- **bundle**:构建产物分析,默认开启。
|
|
35
|
+
- **resolver**:resolver 分析,默认关闭。
|
|
36
|
+
- **lite**: **(废弃,参考:[mode.lite]())** lite 模式。lite 模式和普通模式的区别就是不再缓存源码信息,只缓存打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
37
|
+
|
|
38
|
+
所以,**默认配置是开启了 Bundle 分析能力、 Loader he Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
39
|
+
|
|
30
40
|
:::tip
|
|
31
41
|
**如果出现了 out of memory 的报错,可以尝试:**
|
|
32
42
|
|
|
@@ -38,16 +48,6 @@
|
|
|
38
48
|
|
|
39
49
|
:::
|
|
40
50
|
|
|
41
|
-
features 属性是用于分析功能开关的,具体的功能项如下:
|
|
42
|
-
|
|
43
|
-
- **loader**:Loaders 耗时及代码编译变化分析,默认开启。
|
|
44
|
-
- **plugins**:Plugins 调用以及耗时分析,默认开启。
|
|
45
|
-
- **bundle**:构建产物分析,默认开启。
|
|
46
|
-
- **resolver**:resolver 分析,默认关闭。
|
|
47
|
-
- **lite**: lite 模式。lite 模式和普通模式的区别就是不再缓存源码信息,只缓存打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
48
|
-
|
|
49
|
-
所以,**默认配置是开启了 Bundle 分析能力、 Loader he Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
50
|
-
|
|
51
51
|
#### features types
|
|
52
52
|
|
|
53
53
|
- 如果你将 `features` 设置为**数组**类型,该插件**只会开启**你在 `features` 数组中定义的功能。
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
1
3
|
# Options 配置
|
|
2
4
|
|
|
3
5
|
## RsdoctorRspackPlugin 插件
|
|
@@ -95,6 +97,16 @@ new RsdoctorWebpackPlugin({
|
|
|
95
97
|
|
|
96
98
|
#### features values
|
|
97
99
|
|
|
100
|
+
features 属性是用于分析功能开关的,具体的功能项如下:
|
|
101
|
+
|
|
102
|
+
- **loader**:Loaders 耗时及代码编译变化分析,默认开启。
|
|
103
|
+
- **plugins**:Plugins 调用以及耗时分析,默认开启。
|
|
104
|
+
- **bundle**:构建产物分析,默认开启。
|
|
105
|
+
- **resolver**:resolver 分析,默认关闭。
|
|
106
|
+
- **lite**: **(废弃,使用 [mode.lite](#mode))** lite 模式。lite 模式和普通模式的区别就是不再展示源码信息,只展示打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
107
|
+
|
|
108
|
+
所以,**默认配置是开启了 Bundle 分析能力、 Loader he Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
109
|
+
|
|
98
110
|
:::tip
|
|
99
111
|
**如果出现了 out of memory 的报错,可以尝试:**
|
|
100
112
|
|
|
@@ -106,16 +118,6 @@ new RsdoctorWebpackPlugin({
|
|
|
106
118
|
|
|
107
119
|
:::
|
|
108
120
|
|
|
109
|
-
features 属性是用于分析功能开关的,具体的功能项如下:
|
|
110
|
-
|
|
111
|
-
- **loader**:Loaders 耗时及代码编译变化分析,默认开启。
|
|
112
|
-
- **plugins**:Plugins 调用以及耗时分析,默认开启。
|
|
113
|
-
- **bundle**:构建产物分析,默认开启。
|
|
114
|
-
- **resolver**:resolver 分析,默认关闭。
|
|
115
|
-
- **lite**: lite 模式。lite 模式和普通模式的区别就是不再缓存源码信息,只缓存打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
116
|
-
|
|
117
|
-
所以,**默认配置是开启了 Bundle 分析能力、 Loader he Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
118
|
-
|
|
119
121
|
#### features types
|
|
120
122
|
|
|
121
123
|
- 如果你将 `features` 设置为**数组**类型,该插件**只会开启**你在 `features` 数组中定义的功能。
|
|
@@ -137,6 +139,72 @@ import FeaturesRspack from '@zh/shared/features-rspack.md';
|
|
|
137
139
|
|
|
138
140
|
<FeaturesRspack />
|
|
139
141
|
|
|
142
|
+
### mode
|
|
143
|
+
|
|
144
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
145
|
+
|
|
146
|
+
- **Type:** `normal | brief | lite`
|
|
147
|
+
- **Optional:** `true`
|
|
148
|
+
- **Default:** `normal`
|
|
149
|
+
|
|
150
|
+
选择使用的 Rsdoctor 构建报告模式,有以下几种:
|
|
151
|
+
|
|
152
|
+
import ModeIntro from '@zh/shared/mode-intro.md';
|
|
153
|
+
|
|
154
|
+
<ModeIntro />
|
|
155
|
+
|
|
156
|
+
### reportDir
|
|
157
|
+
|
|
158
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
159
|
+
|
|
160
|
+
- **Type:** string
|
|
161
|
+
- **Optional:** `true`
|
|
162
|
+
- **Default:** undefined
|
|
163
|
+
|
|
164
|
+
Rsdoctor 报告输出目录,默认是构建产物输出目录。
|
|
165
|
+
|
|
166
|
+
### brief
|
|
167
|
+
|
|
168
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
169
|
+
|
|
170
|
+
- **Type:** [BriefType](#brieftype)
|
|
171
|
+
- **Optional:** `true`
|
|
172
|
+
- **Default:** undefined
|
|
173
|
+
|
|
174
|
+
Brief 模式更多配置,如下:
|
|
175
|
+
|
|
176
|
+
- **reportHtmlName:** 配置 Brief 的 HTML 报告的名称,默认 `report-rsdoctor.html`。
|
|
177
|
+
- **writeDataJson:** 默认 Brief 模式下将分析数据注入到 HTML 文件中,所以不会再产生构建分析数据。如果想要而外本地生成数据则需要配置 `writeDataJson: true`。
|
|
178
|
+
|
|
179
|
+
#### briefType
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
interface BriefConfig {
|
|
183
|
+
reportHtmlName?: string | undefined;
|
|
184
|
+
writeDataJson: boolean;
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### reportCodeType
|
|
189
|
+
|
|
190
|
+
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
191
|
+
- Optional: true
|
|
192
|
+
- Default: undefined
|
|
193
|
+
- Description
|
|
194
|
+
|
|
195
|
+
- 选择输出的分析数据:
|
|
196
|
+
- 默认是所有完整数据;
|
|
197
|
+
- noModuleSource: true 是输出除了 module 代码之外的数据,Module 代码即 Bundle 内一个一个文件的打包模块代码。
|
|
198
|
+
- noAssetsAndModuleSource: true 是输出除了 module 代码和 Assets 产物代码之外的数据。
|
|
199
|
+
|
|
200
|
+
- Example
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
new RsdoctorRspackPlugin({
|
|
204
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
205
|
+
}),
|
|
206
|
+
```
|
|
207
|
+
|
|
140
208
|
### supports
|
|
141
209
|
|
|
142
210
|
- **Type:** [Supports Types](#supports-types)
|
|
@@ -145,7 +213,7 @@ import FeaturesRspack from '@zh/shared/features-rspack.md';
|
|
|
145
213
|
|
|
146
214
|
该选项是配置 Rsdoctor 是否开启某些细节特性分析能力支持的,例如:是否开启对 BannerPlugin 的兼容能力。
|
|
147
215
|
|
|
148
|
-
####
|
|
216
|
+
#### supportsTypes
|
|
149
217
|
|
|
150
218
|
```ts
|
|
151
219
|
type ISupport = {
|
|
@@ -189,14 +257,14 @@ chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [
|
|
|
189
257
|
<img
|
|
190
258
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-size.jpeg"
|
|
191
259
|
height="300px"
|
|
192
|
-
width="
|
|
260
|
+
width="300px"
|
|
193
261
|
style={{ margin: 'auto' }}
|
|
194
262
|
/>
|
|
195
263
|
|
|
196
264
|
<img
|
|
197
265
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-code.png"
|
|
198
266
|
height="300px"
|
|
199
|
-
width="
|
|
267
|
+
width="400px"
|
|
200
268
|
style={{ margin: 'auto' }}
|
|
201
269
|
/>
|
|
202
270
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
["intro", "quick-start", "features", "cli"]
|
|
1
|
+
["intro", "quick-start", "features", "cicd", "cli"]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
3
|
+
# CI/CD 使用教程
|
|
4
|
+
|
|
5
|
+
CI/CD 中,往往想要上报历史报告到 CDN 作为历史记录,因为普通模式下无法便捷的做到即开即用,所以支持了 **Brief** 模式。
|
|
6
|
+
|
|
7
|
+
## Brief 模式
|
|
8
|
+
|
|
9
|
+
Brief 模式中,会将数据报告整合到一个 HTML 页面中,方便用户在 CI/CD 及其他方试下使用简报来查看历史构建数据。
|
|
10
|
+
|
|
11
|
+
### 开启 Brief 模式
|
|
12
|
+
|
|
13
|
+
<Badge text="Version: 0.4.0" type="warning" />
|
|
14
|
+
|
|
15
|
+
通过配置 Rsdoctor 插件的 [mode.brief](/config/options/options#mode) 选项,即可开启 Brief 模式。Brief 模式会在构建后生成一份报告到构建产物目录中: `[outputDir]/.rsdoctor/report-rsdoctor.html`,通过浏览器打开 HTML 文件,
|
|
16
|
+
即可看到构建分析简报。
|
|
17
|
+
|
|
18
|
+
- Brief 模式下是不展示任何的代码数据的,为了防止数据过大导致页面崩溃。
|
|
19
|
+
- 报告输出的目录和文件名可配置,可参考:[Options](/config/options/options#brief)。
|
|
20
|
+
- 更多配置可参考:[Options](/config/options/options#brief)。
|
|
21
|
+
|
|
22
|
+
```ts title="rspack.config.js"
|
|
23
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
// ...
|
|
27
|
+
plugins: [
|
|
28
|
+
// 仅在 RSDOCTOR 为 true 时注册插件,因为插件会增加构建耗时
|
|
29
|
+
process.env.RSDOCTOR &&
|
|
30
|
+
new RsdoctorRspackPlugin({
|
|
31
|
+
// 其他插件选项
|
|
32
|
+
mode: 'brief',
|
|
33
|
+
}),
|
|
34
|
+
].filter(Boolean),
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Brief 模式和 Lite 模式的区别
|
|
39
|
+
|
|
40
|
+
目前 Rsdoctor 有几种报告模式:`Normal、Brief 和 Lite`。
|
|
41
|
+
|
|
42
|
+
import ModeIntro from '@zh/shared/mode-intro.md';
|
|
43
|
+
|
|
44
|
+
<ModeIntro />
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- **normal 模式:** 在构建产物目录中生成一个 `.rsdoctor` 文件夹,其中包含各种数据文件,并在报告页面中展示代码。输出目录可以通过 [reportDir](/config/options/options#reportdir) 进行配置。
|
|
2
|
+
|
|
3
|
+
- **brief 模式:** 在构建产物目录的 `.rsdoctor` 文件夹中生成一个 HTML 报告文件,所有构建分析数据会整合注入到这个 HTML 文件中,可以通过浏览器打开该 HTML 文件查看报告。brief 模式还有更多配置项,详细信息请参阅:[brief](/config/options/options#brief).
|
|
4
|
+
|
|
5
|
+
- **lite 模式:** 基于普通模式,不展示源码和产物代码,仅显示打包后的代码信息。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^16",
|
|
23
|
-
"@types/react": "^18",
|
|
23
|
+
"@types/react": "^18.3.5",
|
|
24
24
|
"@types/react-dom": "^18",
|
|
25
25
|
"react": "18.2.0",
|
|
26
26
|
"react-dom": "18.2.0",
|
|
27
|
-
"rsbuild-plugin-google-analytics": "^1.0.
|
|
28
|
-
"rsbuild-plugin-open-graph": "^1.0.
|
|
27
|
+
"rsbuild-plugin-google-analytics": "^1.0.2",
|
|
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.
|
|
31
|
+
"@rsdoctor/types": "0.4.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"react-markdown": "^9.0.1",
|
|
35
|
-
"@rstack-dev/doc-ui": "
|
|
36
|
-
"rspress": "^1.
|
|
35
|
+
"@rstack-dev/doc-ui": "1.4.2",
|
|
36
|
+
"rspress": "^1.28.3"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"dev": "rspress dev",
|