@modern-js/main-doc 2.60.2 → 2.60.4
Sign up to get free protection for your applications and to get access to all the features.
- package/docs/en/configure/app/dev/watch-files.mdx +13 -6
- package/docs/en/configure/app/html/disable-html-folder.mdx +4 -0
- package/docs/en/configure/app/html/output-structure.mdx +15 -0
- package/docs/en/configure/app/output/copy.mdx +4 -1
- package/docs/en/configure/app/output/inline-scripts.mdx +1 -1
- package/docs/en/configure/app/output/inline-styles.mdx +1 -1
- package/docs/zh/configure/app/dev/watch-files.mdx +13 -6
- package/docs/zh/configure/app/html/disable-html-folder.mdx +4 -0
- package/docs/zh/configure/app/html/output-structure.mdx +15 -0
- package/docs/zh/configure/app/output/copy.mdx +4 -2
- package/docs/zh/configure/app/output/inline-scripts.mdx +1 -1
- package/docs/zh/configure/app/output/inline-styles.mdx +1 -1
- package/docs/zh/plugin/introduction.mdx +4 -4
- package/package.json +4 -4
- package/src/components/ListCard/index.module.css +8 -9
@@ -8,12 +8,19 @@ configName: dev.watchFiles
|
|
8
8
|
- **Type:**
|
9
9
|
|
10
10
|
```ts
|
11
|
-
type WatchFiles =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
type WatchFiles =
|
12
|
+
| {
|
13
|
+
paths: string | string[];
|
14
|
+
type?: 'reload-page';
|
15
|
+
// watch options for chokidar
|
16
|
+
options?: WatchOptions;
|
17
|
+
}
|
18
|
+
| {
|
19
|
+
paths: string | string[];
|
20
|
+
type?: 'reload-server';
|
21
|
+
};
|
22
|
+
|
23
|
+
type WatchFilesConfig = WatchFiles | WatchFiles[];
|
17
24
|
```
|
18
25
|
|
19
26
|
- **Default:** `undefined`
|
@@ -9,6 +9,10 @@ title: disableHtmlFolder
|
|
9
9
|
|
10
10
|
Remove the folder of the HTML files. When this option is enabled, the generated HTML file path will change from `[name]/index.html` to `[name].html`.
|
11
11
|
|
12
|
+
:::warning
|
13
|
+
**Deprecated**: This configuration is deprecated, please use `html.outputStructure` instead.
|
14
|
+
:::
|
15
|
+
|
12
16
|
### Example
|
13
17
|
|
14
18
|
By default, the structure of HTML files in the `dist` directory is:
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
title: outputStructure
|
3
|
+
configName: html.outputStructure
|
4
|
+
---
|
5
|
+
|
6
|
+
# html.outputStructure
|
7
|
+
|
8
|
+
- **Type:** `'flat' | 'nested'`
|
9
|
+
- **Default:** `'flat'`
|
10
|
+
|
11
|
+
Define the directory structure of the HTML output files.
|
12
|
+
|
13
|
+
import RsbuildConig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
|
+
|
15
|
+
<RsbuildConig />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
2
|
title: copy
|
3
|
+
configName: output.copy
|
3
4
|
---
|
4
5
|
|
5
6
|
# output.copy
|
@@ -9,4 +10,6 @@ title: copy
|
|
9
10
|
|
10
11
|
Copies the specified file or directory to the dist directory, implemented based on [rspack.CopyRspackPlugin](https://rspack.dev/zh/plugins/rspack/copy-rspack-plugin).
|
11
12
|
|
12
|
-
|
13
|
+
import RsbuildConig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
|
+
|
15
|
+
<RsbuildConig />
|
@@ -26,7 +26,7 @@ type InlineScripts =
|
|
26
26
|
Whether to inline output scripts files (.js files) into HTML with `<script>` tags.
|
27
27
|
|
28
28
|
:::tip
|
29
|
-
When using convention-based routing, you need to set [output.splitRouteChunks](
|
29
|
+
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks) to false if this option is turned on.
|
30
30
|
:::
|
31
31
|
|
32
32
|
import RsbuildConig from '@site-docs-en/components/rsbuild-config-tooltip';
|
@@ -26,7 +26,7 @@ type InlineStyles =
|
|
26
26
|
Whether to inline output style files (.css files) into HTML with `<style>` tags.
|
27
27
|
|
28
28
|
:::tip
|
29
|
-
When using convention-based routing, you need to set [output.splitRouteChunks](
|
29
|
+
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks) to false if this option is turned on.
|
30
30
|
:::
|
31
31
|
|
32
32
|
import RsbuildConig from '@site-docs-en/components/rsbuild-config-tooltip';
|
@@ -8,12 +8,19 @@ configName: dev.watchFiles
|
|
8
8
|
- **类型:**
|
9
9
|
|
10
10
|
```ts
|
11
|
-
type WatchFiles =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
type WatchFiles =
|
12
|
+
| {
|
13
|
+
paths: string | string[];
|
14
|
+
type?: 'reload-page';
|
15
|
+
// chokidar 选项
|
16
|
+
options?: WatchOptions;
|
17
|
+
}
|
18
|
+
| {
|
19
|
+
paths: string | string[];
|
20
|
+
type?: 'reload-server';
|
21
|
+
};
|
22
|
+
|
23
|
+
type WatchFilesConfig = WatchFiles | WatchFiles[];
|
17
24
|
```
|
18
25
|
|
19
26
|
- **默认值:** `undefined`
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
title: outputStructure
|
3
|
+
configName: html.outputStructure
|
4
|
+
---
|
5
|
+
|
6
|
+
# html.outputStructure
|
7
|
+
|
8
|
+
- **类型:** `'flat' | 'nested'`
|
9
|
+
- **默认值:** `'flat'`
|
10
|
+
|
11
|
+
用于定义 HTML 产物文件的目录结构。
|
12
|
+
|
13
|
+
import RsbuildConig from '@site-docs/components/rsbuild-config-tooltip';
|
14
|
+
|
15
|
+
<RsbuildConig />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
2
|
title: copy
|
3
|
+
configName: output.copy
|
3
4
|
---
|
4
5
|
|
5
6
|
# output.copy
|
@@ -7,7 +8,8 @@ title: copy
|
|
7
8
|
- **类型:** `Rspack.CopyRspackPluginOptions | Rspack.CopyRspackPluginOptions['patterns']`
|
8
9
|
- **默认值:** `undefined`
|
9
10
|
|
10
|
-
|
11
11
|
将指定的文件或目录拷贝到构建输出目录中,基于 [rspack.CopyRspackPlugin](https://rspack.dev/zh/plugins/rspack/copy-rspack-plugin) 实现。
|
12
12
|
|
13
|
-
|
13
|
+
import RsbuildConig from '@site-docs/components/rsbuild-config-tooltip';
|
14
|
+
|
15
|
+
<RsbuildConig />
|
@@ -26,7 +26,7 @@ type InlineScripts =
|
|
26
26
|
用来控制是否用 `<script>` 标签将产物中的 script 文件(.js 文件)inline 到 HTML 中。
|
27
27
|
|
28
28
|
:::tip
|
29
|
-
当使用约定式路由时,如果开启了这个选项,需要将 [output.splitRouteChunks](
|
29
|
+
当使用约定式路由时,如果开启了这个选项,需要将 [output.splitRouteChunks](/configure/app/output/split-route-chunks) 设置为 false。
|
30
30
|
:::
|
31
31
|
|
32
32
|
import RsbuildConig from '@site-docs/components/rsbuild-config-tooltip';
|
@@ -26,7 +26,7 @@ type InlineStyles =
|
|
26
26
|
用来控制是否用 `<style>` 标签将产物中的 style 文件(.css 文件)inline 到 HTML 中。
|
27
27
|
|
28
28
|
:::tip
|
29
|
-
当使用约定式路由时,如果开启了这个选项,需要将 [output.splitRouteChunks](
|
29
|
+
当使用约定式路由时,如果开启了这个选项,需要将 [output.splitRouteChunks](/configure/app/output/split-route-chunks) 设置为 false。
|
30
30
|
:::
|
31
31
|
|
32
32
|
import RsbuildConig from '@site-docs/components/rsbuild-config-tooltip';
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Modern.js 拥有自己的框架插件系统,你可以通过在 `modern.config.ts` 中配置 [`plugins`](/configure/app/plugins) 字段来使用 Modern.js 插件。
|
8
8
|
|
9
|
-
### 插件类型
|
9
|
+
### 插件类型
|
10
10
|
|
11
11
|
框架插件可以细分成三类,分别是:
|
12
12
|
|
@@ -62,8 +62,8 @@ Modern.js 从 `MAJOR_VERSION.46.0` 起开始将底层的构建工具升级为 [R
|
|
62
62
|
| [CSS Minimizer 插件](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) | 用于自定义 CSS 压缩工具,切换到 [cssnano](https://cssnano.co/) 或其他工具进行 CSS 压缩。 | [tools.minifyCss](/configure/app/tools/minify-css.html) |
|
63
63
|
| [Pug 插件](https://github.com/rspack-contrib/rsbuild-plugin-pug) | 提供对 Pug 模板引擎的支持 | [tools.pug](/configure/app/tools/pug.html) |
|
64
64
|
| [Rem 插件](https://github.com/rspack-contrib/rsbuild-plugin-rem) | 用于实现移动端页面的 rem 自适应布局 | [output.convertToRem](/configure/app/output/convert-to-rem.html) |
|
65
|
-
| [YAML 插件](https://github.com/rspack-contrib/rsbuild-plugin-yaml) | 用于引用 YAML 文件,并将其转换为 JavaScript 对象 | [
|
66
|
-
| [TOML 插件](https://github.com/rspack-contrib/rsbuild-plugin-toml) | 用于引用 TOML 文件,并将其转换为 JavaScript 对象 | [
|
65
|
+
| [YAML 插件](https://github.com/rspack-contrib/rsbuild-plugin-yaml) | 用于引用 YAML 文件,并将其转换为 JavaScript 对象 | [YAML 文件](/guides/basic-features/static-assets/json-files.html#yaml-文件) |
|
66
|
+
| [TOML 插件](https://github.com/rspack-contrib/rsbuild-plugin-toml) | 用于引用 TOML 文件,并将其转换为 JavaScript 对象 | [TOML 文件](/guides/basic-features/static-assets/json-files.html#toml-文件) |
|
67
67
|
|
68
68
|
#### 未内置的插件
|
69
69
|
|
@@ -75,4 +75,4 @@ Modern.js 从 `MAJOR_VERSION.46.0` 起开始将底层的构建工具升级为 [R
|
|
75
75
|
|
76
76
|
import OtherPlugins from '@site-docs/components/other-plugins.mdx';
|
77
77
|
|
78
|
-
<OtherPlugins />
|
78
|
+
<OtherPlugins />
|
package/package.json
CHANGED
@@ -15,17 +15,17 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.60.
|
18
|
+
"version": "2.60.4",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@modern-js/sandpack-react": "2.60.
|
25
|
+
"@modern-js/sandpack-react": "2.60.4"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
|
-
"@rspress/shared": "1.31.
|
28
|
+
"@rspress/shared": "1.31.1",
|
29
29
|
"@types/fs-extra": "9.0.13",
|
30
30
|
"@types/node": "^16",
|
31
31
|
"classnames": "^2",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"fs-extra": "^10",
|
34
34
|
"react": "^18",
|
35
35
|
"react-dom": "^18",
|
36
|
-
"rspress": "1.31.
|
36
|
+
"rspress": "1.31.1",
|
37
37
|
"ts-node": "^10.9.1",
|
38
38
|
"typescript": "^5"
|
39
39
|
},
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
.card{
|
1
|
+
.card {
|
3
2
|
display: flex;
|
4
3
|
max-width: 32%;
|
5
4
|
flex: 1 1 32%;
|
@@ -8,7 +7,7 @@
|
|
8
7
|
margin-bottom: 16px;
|
9
8
|
height: 135px;
|
10
9
|
padding: 0 35.4px;
|
11
|
-
color: #
|
10
|
+
color: #ffffff;
|
12
11
|
background: rgba(255, 255, 255, 0.1);
|
13
12
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
14
13
|
box-sizing: border-box;
|
@@ -17,17 +16,17 @@
|
|
17
16
|
transition: all 0.3s ease;
|
18
17
|
}
|
19
18
|
|
20
|
-
.card:hover{
|
19
|
+
.card:hover {
|
21
20
|
transition: all 0.3s ease;
|
22
21
|
background: rgba(78, 202, 255, 0.2);
|
23
22
|
}
|
24
|
-
.desc{
|
23
|
+
.desc {
|
25
24
|
display: inline-block;
|
26
25
|
margin-left: 20px;
|
27
26
|
color: #fff;
|
28
27
|
}
|
29
28
|
|
30
|
-
.icon{
|
29
|
+
.icon {
|
31
30
|
width: 48px;
|
32
31
|
height: 48px;
|
33
32
|
fill: #fff;
|
@@ -35,14 +34,14 @@
|
|
35
34
|
}
|
36
35
|
|
37
36
|
@media screen and (min-width: 966px) and (max-width: 1300px) {
|
38
|
-
.card{
|
37
|
+
.card {
|
39
38
|
max-width: 48%;
|
40
39
|
flex: 1 1 48%;
|
41
40
|
}
|
42
41
|
}
|
43
42
|
|
44
43
|
@media screen and (max-width: 966px) {
|
45
|
-
.card{
|
44
|
+
.card {
|
46
45
|
width: 100%;
|
47
46
|
height: 70px;
|
48
47
|
margin: 0;
|
@@ -51,7 +50,7 @@
|
|
51
50
|
max-width: none;
|
52
51
|
flex: none;
|
53
52
|
}
|
54
|
-
.icon{
|
53
|
+
.icon {
|
55
54
|
width: 20px;
|
56
55
|
height: 20px;
|
57
56
|
}
|