@rsdoctor/docs 0.3.11 → 0.4.0
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 +74 -38
- package/docs/en/guide/start/_meta.json +1 -1
- package/docs/en/guide/start/cicd.mdx +30 -0
- package/docs/en/shared/features-rspack.md +25 -0
- package/docs/en/shared/features.md +30 -0
- package/docs/zh/config/options/options-shared.mdx +10 -10
- package/docs/zh/config/options/options.mdx +73 -13
- package/docs/zh/guide/start/_meta.json +1 -1
- package/docs/zh/guide/start/cicd.mdx +32 -0
- package/docs/zh/shared/features-rspack.md +1 -0
- package/docs/zh/shared/features.md +1 -0
- package/package.json +2 -2
|
@@ -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**.
|
|
@@ -91,11 +91,22 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
91
91
|
|
|
92
92
|
#### features values
|
|
93
93
|
|
|
94
|
+
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
95
|
+
|
|
96
|
+
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
97
|
+
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
98
|
+
- **bundle**: Analysis of build bundles, enabled by default.
|
|
99
|
+
- **resolver**: resolver analysis, disabled by default.
|
|
100
|
+
- **lite**: [**depracated, please use [mode.lite](#mode)**]
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
94
105
|
:::tip
|
|
95
106
|
|
|
96
107
|
**If an "out of memory" error occurs, you can try the following:**
|
|
97
108
|
|
|
98
|
-
1. Open the **lite** mode
|
|
109
|
+
1. Open the **lite** mode.[mode.lite](#mode)
|
|
99
110
|
2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
|
|
100
111
|
|
|
101
112
|
- 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 +114,88 @@ Whether to automatically open the Rsdoctor report page. If you do not need to vi
|
|
|
103
114
|
|
|
104
115
|
:::
|
|
105
116
|
|
|
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
117
|
#### features types
|
|
117
118
|
|
|
118
119
|
- if the `features` is set as an `Array`, it will **open** the features which you define in this array **only**.
|
|
119
120
|
- if the `features` is set as an `Object`, it will **close** the features which you set the value is `false`.
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
#### RsdoctorWebpackPluginFeatures
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
- Optional: true
|
|
125
|
-
- Default: undefined
|
|
126
|
-
- Description
|
|
124
|
+
`features` type:
|
|
127
125
|
|
|
128
|
-
|
|
126
|
+
import Features from '@en/shared/features.md';
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
<Features />
|
|
131
129
|
|
|
132
|
-
|
|
130
|
+
#### RsdoctorRspackPluginFeatures
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
`features` type:
|
|
135
133
|
|
|
136
|
-
-
|
|
134
|
+
import FeaturesRspack from '@en/shared/features-rspack.md';
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
<FeaturesRspack />
|
|
137
|
+
|
|
138
|
+
### mode
|
|
139
|
+
|
|
140
|
+
- **Type:** `normal | brief | lite`
|
|
141
|
+
- **Optional:** `true`
|
|
142
|
+
- **Default:** `normal`
|
|
143
|
+
|
|
144
|
+
Choose the Rsdoctor build report mode to use, which includes the following options:
|
|
145
|
+
|
|
146
|
+
- normal: Normal mode, which generates a '.rsdoctor' folder in the build output directory. It contains different data files and the report page displays code. The output directory can be configured using [reportDir](#reportdir).
|
|
147
|
+
- brief: Brief mode, which generates an HTML report file in the `.rsdoctor` folder of the build output directory. You can open this HTML file in a browser to view the report. Brief mode also has additional configuration options, see [brief](#brief).
|
|
148
|
+
- lite: Lite mode, which is a mode based on normal mode that does not display source code and bundles codes. It only displays information about the built codes.
|
|
149
|
+
|
|
150
|
+
### reportDir
|
|
151
|
+
|
|
152
|
+
- **Type:** string
|
|
153
|
+
- **Optional:** `true`
|
|
154
|
+
- **Default:** undefined
|
|
155
|
+
|
|
156
|
+
The output directory for Rsdoctor reports. By default, it is the build output directory.
|
|
157
|
+
|
|
158
|
+
### brief
|
|
159
|
+
|
|
160
|
+
- **Type:** [BriefType](#brieftype)
|
|
161
|
+
- **Optional:** `true`
|
|
162
|
+
- **Default:** undefined
|
|
163
|
+
|
|
164
|
+
More configurations for Brief mode are as follows:
|
|
165
|
+
|
|
166
|
+
- **reportHtmlName:** Configures the name of the HTML report for Brief mode. The default value is `report-rsdoctor.html`.
|
|
167
|
+
- **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`.
|
|
168
|
+
|
|
169
|
+
#### briefType
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
interface BriefConfig {
|
|
173
|
+
reportHtmlName?: string | undefined;
|
|
174
|
+
writeDataJson: boolean;
|
|
175
|
+
}
|
|
144
176
|
```
|
|
145
177
|
|
|
146
|
-
###
|
|
178
|
+
### reportCodeType
|
|
147
179
|
|
|
148
|
-
- Type: boolean
|
|
180
|
+
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
149
181
|
- Optional: true
|
|
150
|
-
- Default:
|
|
182
|
+
- Default: undefined
|
|
151
183
|
- Description
|
|
152
184
|
|
|
153
|
-
|
|
185
|
+
- Select the output analysis data:
|
|
186
|
+
|
|
187
|
+
- default is all complete data;
|
|
188
|
+
|
|
189
|
+
- 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.
|
|
190
|
+
|
|
191
|
+
- noAssetsAndModuleSource: true is the output of data other than module code and Assets product code.
|
|
154
192
|
|
|
155
193
|
- Example
|
|
156
194
|
|
|
157
195
|
```js
|
|
158
|
-
new
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
disableTOSUpload: true,
|
|
162
|
-
}),
|
|
196
|
+
new RsdoctorRspackPlugin({
|
|
197
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
198
|
+
}),
|
|
163
199
|
```
|
|
164
200
|
|
|
165
201
|
### supports
|
|
@@ -215,14 +251,14 @@ Disabling the Parse Bundle capability will only affect the visibility of the Bun
|
|
|
215
251
|
<img
|
|
216
252
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-size.jpeg"
|
|
217
253
|
height="300px"
|
|
218
|
-
width="
|
|
254
|
+
width="300px"
|
|
219
255
|
style={{ margin: 'auto' }}
|
|
220
256
|
/>
|
|
221
257
|
|
|
222
258
|
<img
|
|
223
259
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-code.png"
|
|
224
260
|
height="300px"
|
|
225
|
-
width="
|
|
261
|
+
width="400px"
|
|
226
262
|
style={{ margin: 'auto' }}
|
|
227
263
|
/>
|
|
228
264
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
["intro", "quick-start", "features", "cli"]
|
|
1
|
+
["intro", "quick-start", "features", "cicd", "cli"]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# CI/CD Tutorial
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Brief Mode
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
### Enabling Brief Mode
|
|
10
|
+
|
|
11
|
+
You can enable Brief mode by configuring the `mode.brief` 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.
|
|
12
|
+
|
|
13
|
+
- In Brief mode, no code data is displayed to prevent the page from crashing due to large data sizes.
|
|
14
|
+
- The report output directory and file name can be configured. Refer to: [Options](/config/options/options#brief).
|
|
15
|
+
- For more configurations, refer to: [Options](/config/options/options#brief).
|
|
16
|
+
|
|
17
|
+
```ts title="rspack.config.js"
|
|
18
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
// ...
|
|
22
|
+
plugins: [
|
|
23
|
+
process.env.RSDOCTOR &&
|
|
24
|
+
new RsdoctorRspackPlugin({
|
|
25
|
+
// other options
|
|
26
|
+
mode: 'brief',
|
|
27
|
+
}),
|
|
28
|
+
].filter(Boolean),
|
|
29
|
+
};
|
|
30
|
+
```
|
|
@@ -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
|
+
```
|
|
@@ -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` 数组中定义的功能。
|
|
@@ -95,6 +95,16 @@ new RsdoctorWebpackPlugin({
|
|
|
95
95
|
|
|
96
96
|
#### features values
|
|
97
97
|
|
|
98
|
+
features 属性是用于分析功能开关的,具体的功能项如下:
|
|
99
|
+
|
|
100
|
+
- **loader**:Loaders 耗时及代码编译变化分析,默认开启。
|
|
101
|
+
- **plugins**:Plugins 调用以及耗时分析,默认开启。
|
|
102
|
+
- **bundle**:构建产物分析,默认开启。
|
|
103
|
+
- **resolver**:resolver 分析,默认关闭。
|
|
104
|
+
- **lite**: **(废弃,使用 [mode.lite](#mode))** lite 模式。lite 模式和普通模式的区别就是不再展示源码信息,只展示打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
105
|
+
|
|
106
|
+
所以,**默认配置是开启了 Bundle 分析能力、 Loader he Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
107
|
+
|
|
98
108
|
:::tip
|
|
99
109
|
**如果出现了 out of memory 的报错,可以尝试:**
|
|
100
110
|
|
|
@@ -106,16 +116,6 @@ new RsdoctorWebpackPlugin({
|
|
|
106
116
|
|
|
107
117
|
:::
|
|
108
118
|
|
|
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
119
|
#### features types
|
|
120
120
|
|
|
121
121
|
- 如果你将 `features` 设置为**数组**类型,该插件**只会开启**你在 `features` 数组中定义的功能。
|
|
@@ -137,6 +137,66 @@ import FeaturesRspack from '@zh/shared/features-rspack.md';
|
|
|
137
137
|
|
|
138
138
|
<FeaturesRspack />
|
|
139
139
|
|
|
140
|
+
### mode
|
|
141
|
+
|
|
142
|
+
- **Type:** `normal | brief | lite`
|
|
143
|
+
- **Optional:** `true`
|
|
144
|
+
- **Default:** `normal`
|
|
145
|
+
|
|
146
|
+
选择使用的 Rsdoctor 构建报告模式,有以下几种:
|
|
147
|
+
|
|
148
|
+
- normal:普通模式,会在构建产物目录生成 '.rsdoctor' 文件夹,里面会有不同的数据文件,报告页面中会有代码展示。输出目录可配置:[reportDir](#reportdir).
|
|
149
|
+
- brief: 简报模式,会在构建产物目录的 '.rsdoctor' 文件夹中生成一个 HTML 报告文件,可通过在浏览器中打开这个 HTML 查看报告.brief 模式还有更多配置项,查看:[brief](#brief)
|
|
150
|
+
- lite: 轻量模式,这个模式是在普通模式基础下不展示源码和产物代码的模式,只展示打包后的代码信息。
|
|
151
|
+
|
|
152
|
+
### reportDir
|
|
153
|
+
|
|
154
|
+
- **Type:** string
|
|
155
|
+
- **Optional:** `true`
|
|
156
|
+
- **Default:** undefined
|
|
157
|
+
|
|
158
|
+
Rsdoctor 报告输出目录,默认是构建产物输出目录。
|
|
159
|
+
|
|
160
|
+
### brief
|
|
161
|
+
|
|
162
|
+
- **Type:** [BriefType](#brieftype)
|
|
163
|
+
- **Optional:** `true`
|
|
164
|
+
- **Default:** undefined
|
|
165
|
+
|
|
166
|
+
Brief 模式更多配置,如下:
|
|
167
|
+
|
|
168
|
+
- **reportHtmlName:** 配置 Brief 的 HTML 报告的名称,默认 `report-rsdoctor.html`。
|
|
169
|
+
- **writeDataJson:** 默认 Brief 模式下将分析数据注入到 HTML 文件中,所以不会再产生构建分析数据。如果想要而外本地生成数据则需要配置 `writeDataJson: true`。
|
|
170
|
+
|
|
171
|
+
#### briefType
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
interface BriefConfig {
|
|
175
|
+
reportHtmlName?: string | undefined;
|
|
176
|
+
writeDataJson: boolean;
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### reportCodeType
|
|
181
|
+
|
|
182
|
+
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
183
|
+
- Optional: true
|
|
184
|
+
- Default: undefined
|
|
185
|
+
- Description
|
|
186
|
+
|
|
187
|
+
- 选择输出的分析数据:
|
|
188
|
+
- 默认是所有完整数据;
|
|
189
|
+
- noModuleSource: true 是输出除了 module 代码之外的数据,Module 代码即 Bundle 内一个一个文件的打包模块代码。
|
|
190
|
+
- noAssetsAndModuleSource: true 是输出除了 module 代码和 Assets 产物代码之外的数据。
|
|
191
|
+
|
|
192
|
+
- Example
|
|
193
|
+
|
|
194
|
+
```js
|
|
195
|
+
new RsdoctorRspackPlugin({
|
|
196
|
+
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
197
|
+
}),
|
|
198
|
+
```
|
|
199
|
+
|
|
140
200
|
### supports
|
|
141
201
|
|
|
142
202
|
- **Type:** [Supports Types](#supports-types)
|
|
@@ -145,7 +205,7 @@ import FeaturesRspack from '@zh/shared/features-rspack.md';
|
|
|
145
205
|
|
|
146
206
|
该选项是配置 Rsdoctor 是否开启某些细节特性分析能力支持的,例如:是否开启对 BannerPlugin 的兼容能力。
|
|
147
207
|
|
|
148
|
-
####
|
|
208
|
+
#### supportsTypes
|
|
149
209
|
|
|
150
210
|
```ts
|
|
151
211
|
type ISupport = {
|
|
@@ -189,14 +249,14 @@ chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [
|
|
|
189
249
|
<img
|
|
190
250
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-size.jpeg"
|
|
191
251
|
height="300px"
|
|
192
|
-
width="
|
|
252
|
+
width="300px"
|
|
193
253
|
style={{ margin: 'auto' }}
|
|
194
254
|
/>
|
|
195
255
|
|
|
196
256
|
<img
|
|
197
257
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/bundle/bundled-code.png"
|
|
198
258
|
height="300px"
|
|
199
|
-
width="
|
|
259
|
+
width="400px"
|
|
200
260
|
style={{ margin: 'auto' }}
|
|
201
261
|
/>
|
|
202
262
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
["intro", "quick-start", "features", "cli"]
|
|
1
|
+
["intro", "quick-start", "features", "cicd", "cli"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# CI/CD 使用教程
|
|
2
|
+
|
|
3
|
+
CI/CD 中,往往想要上报历史报告到 CDN 作为历史记录,因为普通模式下无法便捷的做到即开即用,所以支持了 **Brief** 模式。
|
|
4
|
+
|
|
5
|
+
## Brief 模式
|
|
6
|
+
|
|
7
|
+
Brief 模式中,会将数据报告整合到一个 HTML 页面中,方便用户在 CI/CD 及其他方试下使用简报来查看历史构建数据。
|
|
8
|
+
|
|
9
|
+
### 开启 Brief 模式
|
|
10
|
+
|
|
11
|
+
通过配置 Rsdoctor 插件的 `mode.brief` 选项,即可开启 Brief 模式。Brief 模式会在构建后生成一份报告到构建产物目录中: `[outputDir]/.rsdoctor/report-rsdoctor.html`,通过浏览器打开 HTML 文件,
|
|
12
|
+
即可看到构建分析简报。
|
|
13
|
+
|
|
14
|
+
- Brief 模式下是不展示任何的代码数据的,为了防止数据过大导致页面崩溃。
|
|
15
|
+
- 报告输出的目录和文件名可配置,可参考:[Options](/config/options/options#brief)。
|
|
16
|
+
- 更多配置可参考:[Options](/config/options/options#brief)。
|
|
17
|
+
|
|
18
|
+
```ts title="rspack.config.js"
|
|
19
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
// ...
|
|
23
|
+
plugins: [
|
|
24
|
+
// 仅在 RSDOCTOR 为 true 时注册插件,因为插件会增加构建耗时
|
|
25
|
+
process.env.RSDOCTOR &&
|
|
26
|
+
new RsdoctorRspackPlugin({
|
|
27
|
+
// 其他插件选项
|
|
28
|
+
mode: 'brief',
|
|
29
|
+
}),
|
|
30
|
+
].filter(Boolean),
|
|
31
|
+
};
|
|
32
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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.1",
|
|
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.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"react-markdown": "^9.0.1",
|