@rsdoctor/docs 0.3.0 → 0.3.1-beta.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.
|
@@ -118,19 +118,13 @@ Therefore, **the default configuration enables bundle analysis capabilities and
|
|
|
118
118
|
- if the `features` is set as an `Array`, it will **open** the features which you define in this array **only**.
|
|
119
119
|
- if the `features` is set as an `Object`, it will **close** the features which you set the value is `false`.
|
|
120
120
|
|
|
121
|
-
### reportCodeType
|
|
121
|
+
### reportCodeType
|
|
122
122
|
|
|
123
123
|
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
124
124
|
- Optional: true
|
|
125
125
|
- Default: undefined
|
|
126
126
|
- Description
|
|
127
127
|
|
|
128
|
-
- 选择输出的分析数据:
|
|
129
|
-
|
|
130
|
-
- undefined 是所有完整数据;
|
|
131
|
-
- noModuleSource: true 是输出除了 module 代码之外的数据;Module 代码即 Bundle 内拆解出来的一个一个文件的打包模块代码。
|
|
132
|
-
- noAssetsAndModuleSource: true 是输出除了 module 代码和 Assets 产物代码之外的数据。
|
|
133
|
-
|
|
134
128
|
- Select the output analysis data:
|
|
135
129
|
|
|
136
130
|
- undefined is all complete data;
|
|
@@ -143,7 +137,7 @@ Therefore, **the default configuration enables bundle analysis capabilities and
|
|
|
143
137
|
|
|
144
138
|
```js
|
|
145
139
|
new WebDoctorWebpackPlugin({
|
|
146
|
-
disableClientServer: false, //
|
|
140
|
+
disableClientServer: false, // It is recommended to disable the server capability in the CI environment, otherwise it will block the pipeline process. You can check the CI environment using `process.env.CI_ACTOR`.
|
|
147
141
|
features: ['loader', 'bundle', 'plugins'],
|
|
148
142
|
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
149
143
|
}),
|
|
@@ -156,16 +150,38 @@ new WebDoctorWebpackPlugin({
|
|
|
156
150
|
- Default: false
|
|
157
151
|
- Description
|
|
158
152
|
|
|
159
|
-
开启或关闭需要 tos 上传, true 是关闭 tos 上传,false 是开启 tos 上传。
|
|
160
|
-
|
|
161
153
|
Turn tos upload on or off. True is to turn off tos upload, and false is tos upload on.
|
|
162
154
|
|
|
163
155
|
- Example
|
|
164
156
|
|
|
165
157
|
```js
|
|
166
158
|
new WebDoctorWebpackPlugin({
|
|
167
|
-
disableClientServer: false,
|
|
159
|
+
disableClientServer: false, // It is recommended to disable the server capability in the CI environment, otherwise it will block the pipeline process. You can check the CI environment using `process.env.CI_ACTOR`.
|
|
168
160
|
features: ['loader', 'bundle', 'plugins'],
|
|
169
161
|
disableTOSUpload: true,
|
|
170
162
|
}),
|
|
171
163
|
```
|
|
164
|
+
|
|
165
|
+
### supports
|
|
166
|
+
|
|
167
|
+
- **Type:** [Supports Types](#supports-types)
|
|
168
|
+
- **Optional:** `true`
|
|
169
|
+
- **Default:** `undefined`
|
|
170
|
+
|
|
171
|
+
This option is used to configure whether Rsdoctor enables support for certain detailed feature analysis capabilities, such as whether to enable compatibility with BannerPlugin.
|
|
172
|
+
|
|
173
|
+
#### Supports Types
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
type ISupport = {
|
|
177
|
+
banner: boolean;
|
|
178
|
+
};
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### banner
|
|
182
|
+
|
|
183
|
+
:::danger
|
|
184
|
+
When enabling the analysis of BannerPlugin, Rsdoctor should not be used in production versions.
|
|
185
|
+
:::
|
|
186
|
+
|
|
187
|
+
If `supports.banner` is enabled, Rsdoctor will enable compatibility logic for BannerPlugin. For more details, please refer to: [Supports BannerPlugin](../../guide/usage/bundle-size#supports-bannerplugin)
|
|
@@ -120,3 +120,29 @@ Click the **"Bundle Analyzer Graph"** button on the **"Bundle Size"** page to vi
|
|
|
120
120
|
width="500px"
|
|
121
121
|
style={{ margin: 'auto' }}
|
|
122
122
|
/>
|
|
123
|
+
|
|
124
|
+
## Supports BannerPlugin
|
|
125
|
+
|
|
126
|
+
:::danger
|
|
127
|
+
When enabling the BannerPlugin analysis, do not use Rsdoctor in the production version.
|
|
128
|
+
:::
|
|
129
|
+
|
|
130
|
+
Both Rspack and Webpack support the [BannerPlugin](https://www.rspack.dev/plugins/webpack/banner-plugin#bannerplugin), which is a built-in plugin that allows you to add specific content at the top or bottom of the generated chunks.
|
|
131
|
+
The added code segment will affect the analysis capability of the bundle.
|
|
132
|
+
|
|
133
|
+
Rsdoctor is compatible with the logic of adding code using the BannerPlugin, but it is not enabled by default because Rsdoctor needs to add tag code. The Rsdoctor BannerPlugin capability is enabled in the following two cases:
|
|
134
|
+
|
|
135
|
+
1. The project uses the BannerPlugin in `rspack.config.j|ts` or `webpack.config.j|ts`.
|
|
136
|
+
|
|
137
|
+
2. Enable Rsdoctor BannerPlugin capability through Rsdoctor options by setting `supports.banner`:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
new RsdoctorRspackPlugin (
|
|
141
|
+
supports: {
|
|
142
|
+
banner: true
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- Note: Enabling `drop_console` will affect Rsdoctor's analysis of the BannerPlugin. Therefore, you can disable `drop_console` when `RSDOCTOR = true`.
|
|
@@ -136,3 +136,27 @@ import Features from '@zh/shared/features.md';
|
|
|
136
136
|
import FeaturesRspack from '@zh/shared/features-rspack.md';
|
|
137
137
|
|
|
138
138
|
<FeaturesRspack />
|
|
139
|
+
|
|
140
|
+
### supports
|
|
141
|
+
|
|
142
|
+
- **Type:** [Supports Types](#supports-types)
|
|
143
|
+
- **Optional:** `true`
|
|
144
|
+
- **Default:** `undefined`
|
|
145
|
+
|
|
146
|
+
该选项是配置 Rsdoctor 是否开启某些细节特性分析能力支持的,例如:是否开启对 BannerPlugin 的兼容能力。
|
|
147
|
+
|
|
148
|
+
#### Supports Types
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
type ISupport = {
|
|
152
|
+
banner: boolean;
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### banner
|
|
157
|
+
|
|
158
|
+
:::danger
|
|
159
|
+
开启 BannerPlugin 分析时,请勿在生产版本中使用 Rsdoctor。
|
|
160
|
+
:::
|
|
161
|
+
|
|
162
|
+
如果开启 `supports.banner` 则会开启 Rsdoctor 对 BannerPlugin 的兼容逻辑。详细请看:[支持 BannerPlugin](../../guide/usage/bundle-size#%E6%94%AF%E6%8C%81-bannerplugin)
|
|
@@ -120,3 +120,29 @@
|
|
|
120
120
|
width="500px"
|
|
121
121
|
style={{ margin: 'auto' }}
|
|
122
122
|
/>
|
|
123
|
+
|
|
124
|
+
## 支持 BannerPlugin
|
|
125
|
+
|
|
126
|
+
:::danger
|
|
127
|
+
开启 BannerPlugin 分析时,请勿在生产版本中使用 Rsdoctor。
|
|
128
|
+
:::
|
|
129
|
+
|
|
130
|
+
由于 Rspack 和 Webpack 都支持 [BannerPlugin](https://www.rspack.dev/plugins/webpack/banner-plugin#bannerplugin),BannerPlugin 是可在生成的 chunk 顶部或尾部添加一段指定的内容的内置插件。
|
|
131
|
+
添加的代码段将会影响到对 Bundle 的解析能力。
|
|
132
|
+
|
|
133
|
+
Rsdoctor 兼容了对 BannerPlugin 这种添加代码的逻辑,但因为 Rsdoctor 需要添加标记代码,所以没有默认开启,以下两种情况会开启 Rsdoctor BannerPlugin 能力:
|
|
134
|
+
|
|
135
|
+
1. 项目在 `rspack.config.j|ts` 或 `webpack.config.j|ts` 中使用了 BannerPlugin;
|
|
136
|
+
|
|
137
|
+
2. 通过 Rsdoctor options 配置 supports.banner 来开启:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
new RsdoctorRspackPlugin (
|
|
141
|
+
supports: {
|
|
142
|
+
banner: true
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- 注:如果开启了 `drop_console` 将会影响 Rsdoctor 对 BannerPlugin 的分析,所以可以在 `RSDOCTOR = true` 时,关闭 `drop_console`。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "0.3.0",
|
|
3
|
+
"version": "0.3.1-beta.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.0",
|
|
29
29
|
"rspress-plugin-font-open-sans": "^1.0.0",
|
|
30
30
|
"typescript": "^5.2.2",
|
|
31
|
-
"@rsdoctor/types": "0.3.0"
|
|
31
|
+
"@rsdoctor/types": "0.3.1-beta.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"framer-motion": "^10.17.6",
|