Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
dist
compiled
doc_build
pnpm-lock.yaml

**/doctor-core/**/tests
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
"change": "changeset",
"changeset": "changeset",
"bump": "changeset version",
"check-spell": "npx cspell",
"check-spell": "pnpx cspell && heading-case",
"check-changeset": "pnpx disallow-major-changeset",
"check-dependency-version": "pnpx check-dependency-version-consistency .",
"dev:doc": "cd packages/document && pnpm run dev",
"e2e": "pnpm run e2e:base && pnpm run e2e:native",
"e2e:base": "cd ./e2e && cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm test",
"e2e:native": "cd ./e2e && cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm test:native",
"format": "prettier --write . && heading-case --write",
"lint": "biome lint . --diagnostic-level=error",
"prepare": "pnpm run build && husky",
"test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm run ut",
Expand All @@ -42,6 +43,7 @@
"@scripts/test-helper": "workspace:*",
"cross-env": "^7.0.3",
"cspell-ban-words": "^0.0.4",
"heading-case": "^0.1.4",
"husky": "^9.1.7",
"nano-staged": "^0.8.0",
"nx": "^17.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/document/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rsdoctor Website
# Rsdoctor website

## Writing style guide

Expand Down
20 changes: 10 additions & 10 deletions packages/document/docs/en/guide/rules/rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Please refer to the [Linter Type](#linter-type) in this document for the type de

:::

### [E1001] Duplicate Packages
### [E1001] Duplicate packages

#### Rule Details
#### Rule details

- The `Duplicate Packages` card displays the number of duplicate third-party packages in the project. Clicking the image allows you to view the specific details of the duplicate third-party packages. Note: The third-party packages referred to here are all bundled third-party packages.

Expand Down Expand Up @@ -91,13 +91,13 @@ enum CheckVersion {
}
```

#### Duplicate Package Optimization Problem
#### Duplicate package optimization problem

Please refer to the [Duplicate Package Optimization Solution](../../blog/topic/duplicate-pkg-problem).

Clicking 「**More**」 can view the corresponding rule explanation.

### [E1002] Cross Chunks Package
### [E1002] Cross chunks package

The cross chunks duplicate package rule can scan **duplicate packages in different `chunks`**. These duplicate packages may also lead to redundant code in the build artifacts, depending on the business logic and the size of the redundant code.

Expand All @@ -111,15 +111,15 @@ The cross chunks duplicate package rule can scan **duplicate packages in differe

Please refer to [[E1002] Cross Chunks Packages](../more/rules)

### [E1003] Loader Performance Optimization
### [E1003] Loader performance optimization

This module allows you to visually see some warning information about our project's compilation, which can help us further optimize the project's compilation performance.

#### Solution

Please refer to [[E1003] Loader Performance Optimization](../more/rules)

#### Configuration Type
#### Configuration type

- **ignore**: Can include strings or regular expressions, used to specify the loaders to be ignored.
- **threshold**: Represents the total time threshold for the loader, in milliseconds. If the loader's execution time exceeds this threshold, it may trigger warnings or errors. The default value is 5000 milliseconds.
Expand All @@ -145,7 +145,7 @@ interface Config {
}
```

### [E1004] ECMA Version Check
### [E1004] ECMA version check

This rule is used to detect incompatible advanced syntax. When scanning the rule, the configuration of `browserslist` is prioritized; if `browserslist` is not configured, manual detection is required, as shown below:

Expand All @@ -171,7 +171,7 @@ export default {
};
```

#### Type Definitions
#### Type definitions

```ts
type CheckSyntaxOptions = {
Expand Down Expand Up @@ -205,7 +205,7 @@ type CheckSyntaxOptions = {

For more `ECMA Version Check` configuration options, please refer to [ECMA Version Check Options](https://github.com/rspack-contrib/rsbuild-plugin-check-syntax?tab=readme-ov-file#options)

### [E1005] Default Import Check
### [E1005] Default import check

Typically, Rspack automatically supports different types of modules, but in some cases, compatibility operations may fail. For example, when using `Default Import` to import a `cjs` module, if the module does not have a compatible statement (such as `exports.default`), issues may arise.

Expand All @@ -224,7 +224,7 @@ interface Config {
}
```

## Linter Type
## Linter type

- The type definition for the `linter` field is as follows:

Expand Down
4 changes: 2 additions & 2 deletions packages/document/docs/en/guide/start/quick-start-shared.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Step 2: Register plugin
## Step 2: register plugin

After the dependency installation, you need to integrate the Rsdoctor plugin into your project. Below are some examples of common tools and frameworks:

Expand Down Expand Up @@ -141,7 +141,7 @@ export default defineConfig({

---

## Step 3: Run build
## Step 3: run build

Now, you can run the **build** command in the project. After the build is complete, Rsdoctor will automatically open the analysis page of this build.

Expand Down
2 changes: 1 addition & 1 deletion packages/document/docs/en/guide/start/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This document will explain how to access the Rsdoctor ability.

## Step 1: Install dependencies
## Step 1: install dependencies

import { PackageManagerTabs } from '@theme';

Expand Down
2 changes: 1 addition & 1 deletion packages/document/docs/en/guide/usage/bundle-alerts.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bundle Alerts
# Bundle alerts

## Introduction

Expand Down
4 changes: 2 additions & 2 deletions packages/document/docs/en/guide/usage/bundle-size.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The top toolbar from left to right includes: the search tool for **Assets**, the

<img src="https://assets.rspack.dev/others/assets/rsdoctor/bundle-size-analysis-selects.png" />

#### Search Module
#### Search module

Search for which Assets the Module is located in. As shown in the figure, you can see the results of matching the search Module keyword.

Expand All @@ -91,7 +91,7 @@ Search for which Assets the Module is located in. As shown in the figure, you ca
src="https://assets.rspack.dev/others/assets/rsdoctor/search-modules.png"
/>

#### Search Module
#### Search module

The module search functionality is supported, allowing users to click the "**Search Module**" button to open the module search dialog. By entering the module name, users can quickly locate and view the module's position in the Assets, making it easier to analyze the module's reference relationships and size. The search determines which Assets the Module is located in.

Expand Down
2 changes: 1 addition & 1 deletion packages/document/docs/en/guide/usage/compile-alerts.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Compile Alerts
# Compile alerts

We have integrated some capabilities based on compilation data detection. If the current compilation result contains data that hits the rules we define, the `Compile Alerts` module will appear at the bottom of the **Rsdoctor** main interface, as shown in the image below:

Expand Down
2 changes: 1 addition & 1 deletion packages/document/docs/en/guide/usage/compile-overall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Hovering over a data point in the chart will display the following information i

In this section, you can navigate to "Compile Analysis" -> "Loader Analysis" -> [**"Loader Timeline"**](./loaders-timeline.mdx) in the navigation bar to view the timeline of loader compilation time.

### AfterCompile -> Done details
### AfterCompile -> done details

By **clicking on the data of the `AfterCompile -> Done` phase**, a popup will appear on the page, as shown in the following image:

Expand Down
6 changes: 3 additions & 3 deletions packages/document/docs/en/guide/usage/rule-config.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Compilation Diagnostic Rules
# Compilation diagnostic rules

Building diagnostic rules is similar to `ESLint` like lint tools, but different from it in that `ESLint` performs code scanning and is unrelated to the build process. In contrast, the code diagnostics here are closely related to the build process of `Rspack or Webpack`, incorporating many internal parameters generated during the build process to aid judgment, such as ModuleGraph, Webpack's internal markings for each module, and runtime added after code transformation, among others.

Expand All @@ -16,7 +16,7 @@ During the build process, if issues are discovered, they will be visible in the
src="https://assets.rspack.dev/others/assets/rsdoctor/bundle-alerts.png"
/>

## How to Use
## How to use

Currently, Rsdoctor provides **built-in rules** and **custom rules**.

Expand All @@ -32,6 +32,6 @@ The existing diagnostic tool includes multiple rules, all of which are enabled b

For specific details, refer to [Built-in Rules](/guide/rules/rules).

### Custom Rules
### Custom rules

Rsdoctor also collects analyzed data and allows users to integrate custom rules through the Linter API. For details on custom rules, refer to [Custom Rules](/guide/rules/rule-custom).
10 changes: 5 additions & 5 deletions packages/document/docs/zh/guide/rules/rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

:::

### [E1001] Duplicate Packages
### [E1001] Duplicate packages

#### 规则详情

Expand Down Expand Up @@ -94,7 +94,7 @@ enum CheckVersion {

点击 「**More**」可以查看对应规则解释。

### [E1002] Cross Chunks Package
### [E1002] Cross chunks package

跨 Chunks 的重复包规则能够扫描**不同 `chunks` 中的重复包**。这些重复包也有可能导致打包代码冗余,具体还要看业务逻辑及冗余代码大小。

Expand All @@ -108,7 +108,7 @@ enum CheckVersion {

可查看 [[E1002] Cross Chunks Packages](../more/rules)

### [E1003] Loader Performance Optimization
### [E1003] Loader performance optimization

通过该模块可以比较直观的看到我们项目在编译方面的一些预警信息,有助于我们可以更进一步优化项目的编译性能。

Expand Down Expand Up @@ -142,7 +142,7 @@ interface Config {
}
```

### [E1004] ECMA Version Check
### [E1004] ECMA version check

该规则用于检测不兼容的高级语法。在规则扫描时,优先使用 `browserslist` 的配置;如果未配置 `browserslist`,则需要手动进行检测,示例如下:

Expand Down Expand Up @@ -202,7 +202,7 @@ type CheckSyntaxOptions = {

更多 `ECMA Version Check` 配置请参考 [ECMA Version Check Options](https://github.com/rspack-contrib/rsbuild-plugin-check-syntax?tab=readme-ov-file#options)

### [E1005] Default Import Check
### [E1005] Default import check

通常,Rspack 会自动兼容不同类型的模块,但在某些情况下,兼容性操作可能会失败。例如,当使用 `Default Import` 导入一个 `cjs` 模块时,如果该模块没有兼容的语句(如 `exports.default`),则会出现问题。

Expand Down
2 changes: 1 addition & 1 deletion packages/document/docs/zh/guide/usage/compile-overall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

该部分可以查看导航栏 「Compile Analysis」-> 「Loader Analysis」-> [**Loader Timeline**](./loaders-timeline.mdx) 来查看 Loader 编译耗时时序图。

### AfterCompile -> Done 耗时详情
### AfterCompile -> done 耗时详情

通过**点击 `AfterCompile -> Done` 阶段后的数据**会在页面中弹出一个浮层,其内容如下图所示:

Expand Down
27 changes: 18 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading