@rsdoctor/docs 1.5.1 → 1.5.2-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.
@@ -138,3 +138,49 @@ When using Rsdoctor to analyze the compilation time of Rspack projects, you may
138
138
  - Reason: The loader in [CssExtractRspackPlugin](https://rspack.rs/plugins/rspack/css-extract-rspack-plugin) asynchronously calls other loaders during the pitch phase and waits for the callback results after these loaders execute. Therefore, the time taken by CssExtractRspackPlugin actually includes the execution time of other loaders and idle time.
139
139
 
140
140
  <img src="https://assets.rspack.rs/rsdoctor/css-extract-loader.png" />
141
+
142
+ ## Using Rsdoctor with Re.Pack or Custom Bundle Extensions
143
+
144
+ Rsdoctor now supports custom JavaScript bundle file extensions beyond the standard `.js` extension. This is particularly useful for projects like Re.Pack that use `.bundle` extensions.
145
+
146
+ ### Supported Extensions
147
+
148
+ By default, Rsdoctor recognizes the following JavaScript bundle extensions:
149
+
150
+ - `.js` - Standard JavaScript files
151
+ - `.bundle` - Re.Pack and other custom bundlers
152
+
153
+ ### No Configuration Required
154
+
155
+ If your project generates bundle files with a `.bundle` extension (e.g., `main.bundle`, `vendor.bundle`), Rsdoctor will automatically:
156
+
157
+ - Parse and analyze `.bundle` files alongside `.js` files
158
+ - Display `.bundle` files in the Bundle Analyzer Graph
159
+ - Include `.bundle` assets in JavaScript asset statistics
160
+ - Support source map analysis for `.bundle` files
161
+
162
+ ### How It Works
163
+
164
+ The detection logic has been updated in the following areas:
165
+
166
+ 1. **Bundle Parsing**: The `parseBundle` function now accepts both `.js` and `.bundle` extensions when analyzing bundle contents.
167
+ 2. **Asset Filtering**: Asset summary and filtering functions treat `.bundle` files as JavaScript assets.
168
+ 3. **File Type Detection**: All file extension matching utilities include `.bundle` as a recognized JavaScript extension.
169
+
170
+ ### Example Use Case
171
+
172
+ Re.Pack projects typically generate bundles with the `.bundle` extension:
173
+
174
+ ```
175
+ dist/
176
+ ├── index.bundle ← Now supported!
177
+ ├── vendor.bundle ← Now supported!
178
+ ├── styles.css
179
+ └── assets/
180
+ ```
181
+
182
+ Rsdoctor will automatically detect and analyze these `.bundle` files without any additional configuration.
183
+
184
+ ### Future Extensions
185
+
186
+ If you need support for additional custom extensions, please open an issue on the [Rsdoctor GitHub repository](https://github.com/web-infra-dev/rsdoctor) with details about your use case.
@@ -138,3 +138,49 @@ export default {
138
138
  - 原因:[CssExtractRspackPlugin](https://rspack.rs/plugins/rspack/css-extract-rspack-plugin) 中的 loader 在 pitch 阶段会异步调用其他 loader,并等待这些 loader 执行后的回调结果。因此,CssExtractRspackPlugin 的耗时实际上包括了其他 loader 的执行时间和空闲时间。
139
139
 
140
140
  <img src="https://assets.rspack.rs/rsdoctor/css-extract-loader.png" />
141
+
142
+ ## 在 Re.Pack 或自定义 Bundle 扩展名项目中使用 Rsdoctor
143
+
144
+ Rsdoctor 现在支持标准 `.js` 扩展名之外的自定义 JavaScript bundle 文件扩展名。这对于使用 `.bundle` 扩展名的 Re.Pack 等项目特别有用。
145
+
146
+ ### 支持的扩展名
147
+
148
+ 默认情况下,Rsdoctor 识别以下 JavaScript bundle 扩展名:
149
+
150
+ - `.js` - 标准 JavaScript 文件
151
+ - `.bundle` - Re.Pack 和其他自定义打包工具
152
+
153
+ ### 无需配置
154
+
155
+ 如果您的项目生成带有 `.bundle` 扩展名的 bundle 文件(例如 `main.bundle`、`vendor.bundle`),Rsdoctor 将自动:
156
+
157
+ - 解析和分析 `.bundle` 文件以及 `.js` 文件
158
+ - 在 Bundle 分析图表中显示 `.bundle` 文件
159
+ - 在 JavaScript 资源统计中包含 `.bundle` 资源
160
+ - 支持 `.bundle` 文件的 source map 分析
161
+
162
+ ### 工作原理
163
+
164
+ 检测逻辑已在以下领域更新:
165
+
166
+ 1. **Bundle 解析**:`parseBundle` 函数现在在分析 bundle 内容时接受 `.js` 和 `.bundle` 扩展名。
167
+ 2. **资源过滤**:资源摘要和过滤函数将 `.bundle` 文件视为 JavaScript 资源。
168
+ 3. **文件类型检测**:所有文件扩展名匹配工具都包含 `.bundle` 作为公认的 JavaScript 扩展名。
169
+
170
+ ### 用例示例
171
+
172
+ Re.Pack 项目通常生成带有 `.bundle` 扩展名的 bundle:
173
+
174
+ ```
175
+ dist/
176
+ ├── index.bundle ← 现已支持!
177
+ ├── vendor.bundle ← 现已支持!
178
+ ├── styles.css
179
+ └── assets/
180
+ ```
181
+
182
+ Rsdoctor 将自动检测和分析这些 `.bundle` 文件,无需任何额外配置。
183
+
184
+ ### 未来扩展
185
+
186
+ 如果您需要支持其他自定义扩展名,请在 [Rsdoctor GitHub 仓库](https://github.com/web-infra-dev/rsdoctor) 上开启一个 issue,并详细说明您的使用场景。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/docs",
3
- "version": "1.5.1",
3
+ "version": "1.5.2-beta.0",
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.2.1",
34
34
  "typescript": "^5.9.2",
35
35
  "@rsbuild/plugin-sass": "^1.4.1",
36
- "@rsdoctor/types": "1.5.1"
36
+ "@rsdoctor/types": "1.5.2-beta.0"
37
37
  },
38
38
  "dependencies": {
39
39
  "@rstack-dev/doc-ui": "1.12.3",