@modern-js/main-doc 2.32.2-alpha.1 → 2.33.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +3 -3
- package/docs/en/community/contributing-guide.mdx +2 -3
- package/docs/en/configure/app/builder-plugins.mdx +1 -1
- package/docs/en/configure/app/source/enable-async-entry.mdx +3 -1
- package/docs/en/guides/concept/builder.mdx +2 -2
- package/docs/en/guides/get-started/glossary.mdx +13 -1
- package/docs/en/guides/get-started/introduction.mdx +10 -6
- package/docs/en/guides/topic-detail/generator/create/use.mdx +1 -1
- package/docs/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +2 -5
- package/docs/zh/community/blog/v2-release-note.mdx +7 -8
- package/docs/zh/community/contributing-guide.mdx +2 -3
- package/docs/zh/configure/app/builder-plugins.mdx +1 -1
- package/docs/zh/configure/app/source/enable-async-entry.mdx +4 -2
- package/docs/zh/guides/concept/builder.mdx +3 -3
- package/docs/zh/guides/get-started/glossary.mdx +13 -1
- package/docs/zh/guides/get-started/introduction.mdx +11 -7
- package/docs/zh/guides/topic-detail/generator/create/use.mdx +1 -1
- package/docs/zh/guides/topic-detail/micro-frontend/c01-introduction.mdx +3 -6
- package/docs/zh/tutorials/first-app/c06-model.mdx +1 -4
- package/package.json +9 -8
- package/{modern.config.ts → rspress.config.ts} +77 -83
- package/src/components/ContentCard/index.tsx +2 -3
- package/src/components/ListCard/index.tsx +1 -1
- package/src/components/RandomMemberList/index.tsx +1 -1
- package/src/components/ShowcaseList/index.module.scss +5 -5
- package/src/components/SolutionCards/index.module.scss +2 -2
- package/src/i18n/enUS.ts +2 -2
- package/src/i18n/index.ts +1 -1
- package/src/i18n/zhCN.ts +2 -2
- package/src/index.ts +3 -2
- package/src/pages/index.module.scss +1 -1
- package/src/pages/index.tsx +7 -6
package/CHANGELOG.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# @modern-js/main-doc
|
2
2
|
|
3
|
-
## 2.
|
3
|
+
## 2.33.0
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- bc1f8da: feat(builder): support custom logger in dev server
|
8
8
|
|
9
9
|
feat(builder): 支持自定义 logger
|
10
10
|
|
11
|
-
- @modern-js/builder-doc@2.
|
11
|
+
- @modern-js/builder-doc@2.33.0
|
12
12
|
|
13
13
|
## 2.32.1
|
14
14
|
|
@@ -189,14 +189,13 @@ root
|
|
189
189
|
└─ packages
|
190
190
|
└─ document
|
191
191
|
├─ builder-doc # Documentation for Modern.js Builder
|
192
|
-
├─ doc-tools-doc # Documentation for Modern.js Doc
|
193
192
|
├─ main-doc # Documentation for Modern.js Framework
|
194
193
|
└─ module-doc # Documentation for Modern.js Module
|
195
194
|
```
|
196
195
|
|
197
|
-
This website is built with
|
196
|
+
This website is built with Rspress, the document content can be written using markdown or mdx syntax. You can refer to the [Rspress Website](https://rspress.dev/) for detailed usage.
|
198
197
|
|
199
|
-
The source code of
|
198
|
+
The source code of Rspress can be found in [this repo](https://github.com/web-infra-dev/rspress).
|
200
199
|
|
201
200
|
---
|
202
201
|
|
@@ -9,7 +9,7 @@ sidebar_position: 21
|
|
9
9
|
|
10
10
|
Used to configure the Modern.js Builder plugin.
|
11
11
|
|
12
|
-
Modern.js Builder is the build
|
12
|
+
Modern.js Builder is the build tool of Modern.js, please read [Builder](/guides/concept/builder) for background. If you want to know how to write Builder plugins, you can refer to [Modern.js Builder - Introduce to Plugin](https://modernjs.dev/builder/en/plugins/introduction.html).
|
13
13
|
|
14
14
|
## Precautions
|
15
15
|
|
@@ -13,7 +13,9 @@ When this option is enabled, Modern.js will wrap the automatically generated ent
|
|
13
13
|
|
14
14
|
## Background
|
15
15
|
|
16
|
-
|
16
|
+
import ModuleFederation from '@modern-js/builder-doc/docs/zh/shared/module-federation.md';
|
17
|
+
|
18
|
+
<ModuleFederation />
|
17
19
|
|
18
20
|
## Example
|
19
21
|
|
@@ -6,14 +6,14 @@ sidebar_position: 2
|
|
6
6
|
|
7
7
|
**Modern.js uses [Modern.js Builder](https://modernjs.dev/builder/en) to build your Web App.**
|
8
8
|
|
9
|
-
Modern.js Builder is one of the core components of the Modern.js system. It is a build
|
9
|
+
Modern.js Builder is one of the core components of the Modern.js system. It is a build tool for web development scenarios that can be used independently of Modern.js. Modern.js Builder supports multiple bundlers such as webpack and Rspack, and by default uses the most mature webpack for bundling.
|
10
10
|
|
11
11
|
## Build Architecture
|
12
12
|
|
13
13
|
From a building perspective, Modern.js is divided into three layers, from top to bottom:
|
14
14
|
|
15
15
|
- Upper-level development framework: Modern.js.
|
16
|
-
- Common build
|
16
|
+
- Common build tool: Modern.js Builder.
|
17
17
|
- Low-level bundler: webpack and Rspack.
|
18
18
|
|
19
19
|
<img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-0824.png" style={{ width: '100%', maxWidth: '540px' }} />
|
@@ -30,10 +30,22 @@ In CSR, the server sends an empty HTML shell and some JavaScript scripts to the
|
|
30
30
|
|
31
31
|
## Garfish
|
32
32
|
|
33
|
-
[Garfish](https://
|
33
|
+
[Garfish](https://garfishjs.org/) is a micro-frontend solution mainly used to solve problems such as cross-team collaboration and diversified technology systems in web applications.
|
34
34
|
|
35
35
|
Starting from the architecture level, it combines multiple independently delivered frontend applications into a whole. These frontend applications can be developed, tested, and deployed independently, but in the user's perspective, they are still cohesive single products.
|
36
36
|
|
37
|
+
## Micro-frontend
|
38
|
+
|
39
|
+
import MicroFrontend from '@modern-js/builder-doc/docs/en/shared/micro-frontend.md';
|
40
|
+
|
41
|
+
<MicroFrontend />
|
42
|
+
|
43
|
+
## Module Federation
|
44
|
+
|
45
|
+
import ModuleFederation from '@modern-js/builder-doc/docs/en/shared/module-federation.md';
|
46
|
+
|
47
|
+
<ModuleFederation />
|
48
|
+
|
37
49
|
## Rspack
|
38
50
|
|
39
51
|
import Rspack from '@modern-js/builder-doc/docs/en/shared/rspack.md';
|
@@ -7,7 +7,7 @@ sidebar_position: 1
|
|
7
7
|
|
8
8
|
**Modern.js is an open source web engineering system from ByteDance**, which provides multiple solutions to help developers solve problems in different development scenarios.
|
9
9
|
|
10
|
-
Currently, Modern.js includes three solutions, targeting web application development, npm package development, and
|
10
|
+
Currently, Modern.js includes three solutions, targeting web application development, npm package development, and web application building:
|
11
11
|
|
12
12
|
import { SolutionCards } from '@site/src/components/SolutionCards';
|
13
13
|
|
@@ -24,9 +24,9 @@ import { SolutionCards } from '@site/src/components/SolutionCards';
|
|
24
24
|
link: 'http://modernjs.dev/module-tools/en/',
|
25
25
|
},
|
26
26
|
{
|
27
|
-
title: 'Modern.js
|
28
|
-
description: 'For
|
29
|
-
link: 'http://modernjs.dev/
|
27
|
+
title: 'Modern.js Builder',
|
28
|
+
description: 'For web application building',
|
29
|
+
link: 'http://modernjs.dev/builder/en/',
|
30
30
|
},
|
31
31
|
]}
|
32
32
|
/>
|
@@ -38,13 +38,17 @@ As part of the Modern.js engineering system, each of the above solutions can be
|
|
38
38
|
**The current documentation site corresponds to the Modern.js framework**, which is used to developing web applications.
|
39
39
|
|
40
40
|
- If you need to develop an npm package, please refer to the [Modern.js Module](https://modernjs.dev/module-tools) documentation.
|
41
|
-
- If you need to
|
42
|
-
- If you need to implement a web development framework based on the Modern.js build engine, please refer to the [Modern.js Builder](https://modernjs.dev/builder) documentation.
|
41
|
+
- If you need to implement a web development framework based on the Modern.js build tool, please refer to the [Modern.js Builder](https://modernjs.dev/builder) documentation.
|
43
42
|
|
44
43
|
:::tip
|
45
44
|
Since the Modern.js framework is the most widely used, in this documentation site, we will omit "framework" and directly refer to it as Modern.js.
|
46
45
|
:::
|
47
46
|
|
47
|
+
Modern.js can also be combined with the following solutions:
|
48
|
+
|
49
|
+
- If you need to develop a documentation site, [Rspress](https://rspress.dev/) is recommended.
|
50
|
+
- If you need to introduce micro-frontend architecture, [Garfish](https://garfishjs.org/) is recommended.
|
51
|
+
|
48
52
|
## Modern.js Framework
|
49
53
|
|
50
54
|
**The Modern.js framework is a progressive web framework based on React**. At ByteDance, we use Modern.js to build upper-level frameworks that have supported the development of thousands of web applications.
|
@@ -4,7 +4,7 @@ sidebar_position: 1
|
|
4
4
|
|
5
5
|
# Usage
|
6
6
|
|
7
|
-
Modern.js provides `@modern-js/create` tool for creating project templates provided by Modern.js, including [Web App](https://modernjs.dev/), [Npm Module](https://modernjs.dev/module-tools), [
|
7
|
+
Modern.js provides `@modern-js/create` tool for creating project templates provided by Modern.js, including [Web App](https://modernjs.dev/), [Npm Module](https://modernjs.dev/module-tools), [Monorepo](/guides/topic-detail/monorepo/intro.html).
|
8
8
|
|
9
9
|
The following will introduce how to use `@modern-js/create`.
|
10
10
|
|
@@ -4,12 +4,9 @@ title: Introduction
|
|
4
4
|
---
|
5
5
|
# Introduction
|
6
6
|
|
7
|
-
|
7
|
+
import MicroFrontend from '@modern-js/builder-doc/docs/en/shared/micro-frontend.md';
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
- As the iterative application of the project becomes larger and more difficult to maintain.
|
12
|
-
- Collaborative development of projects across teams or departments leads to inefficiencies.
|
9
|
+
<MicroFrontend />
|
13
10
|
|
14
11
|
## Keyword
|
15
12
|
|
@@ -205,17 +205,17 @@ Modern.js Module 的核心能力包括:
|
|
205
205
|
|
206
206
|
> 如果你对 Modern.js Module 感兴趣,请移步[「Modern.js Module 文档」](https://modernjs.dev/module-tools)来了解更多。
|
207
207
|
|
208
|
-
##
|
208
|
+
## Rspress
|
209
209
|
|
210
|
-
|
210
|
+
Rspress 是一个面向文档站场景的框架,它的目标是给开发者提供一个简单、高效、可扩展的文档站解决方案。
|
211
211
|
|
212
|
-

|
213
213
|
|
214
214
|
<div style={{ textAlign: 'center', fontStyle: 'italic' }}>
|
215
|
-
|
215
|
+
Rspress 官网介绍页
|
216
216
|
</div>
|
217
217
|
|
218
|
-
目前,
|
218
|
+
目前,Rspress 包含如下能力:
|
219
219
|
|
220
220
|
- **基于 Rspack 构建**:项目构建和 HMR 速度飞快,提供愉悦的开发和生产部署体验。
|
221
221
|
- **支持 MDX 语法**:在普通 Markdown 语法的基础上可以嵌入 React 组件和 JSX 语法。
|
@@ -224,9 +224,9 @@ Modern.js Doc 是一个面向文档站场景的框架,它的目标是给开发
|
|
224
224
|
- **自定义主题**:内置一套默认主题,你可以基于这套主题进行扩展,也可以从零定制一套自定义主题。
|
225
225
|
- **插件机制**:提供丰富的插件钩子能力,让你能够充分自定义扩展框架功能。
|
226
226
|
|
227
|
-
我们做
|
227
|
+
我们做 Rspress 的初心,是为了解决我们团队内的文档站搭建需求。随着 Rspress 的功能逐渐完整,我们也将它开放给社区使用,使它能发挥更大的价值。
|
228
228
|
|
229
|
-
目前,
|
229
|
+
目前,Rspress 仍处于 beta 测试状态,相关源代码已经开放在 [Rspress 仓库](https://github.com/web-infra-dev/rspress) 中,并提供了基础的 [使用文档](https://rspress.dev/)。在未来,我们将继续投入,使之成为一个完成度更高的文档解决方案。
|
230
230
|
|
231
231
|
## 致谢
|
232
232
|
|
@@ -236,7 +236,6 @@ Modern.js 中的部分代码实现参考了社区中的开源项目,我们对
|
|
236
236
|
- `@modern-js/plugin`: hook API 的实现参考了 [farrow-pipeline](https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline)。
|
237
237
|
- `@modern-js/builder`: moduleScope 和 fileSize 插件参考了 [create-react-app](https://github.com/facebook/create-react-app),TsConfigPathsPlugin 参考了 [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin),generateMetaTags 函数参考了 [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin)。
|
238
238
|
- `@modern-js/plugin-testing`: jest runner 参考了 [jest-cli](https://github.com/facebook/jest/blob/fdc74af37235354e077edeeee8aa2d1a4a863032/packages/jest-cli/src/cli/index.ts#L21)。
|
239
|
-
- `@modern-js/doc-tools`: 部分样式参考了 [vitepress](https://github.com/vuejs/vitepress)。
|
240
239
|
- `@modern-js/plugin-data-loader`: 部分实现参考了 [remix](https://github.com/remix-run/remix)。
|
241
240
|
|
242
241
|
## 最后
|
@@ -188,14 +188,13 @@ root
|
|
188
188
|
└─ packages
|
189
189
|
└─ document
|
190
190
|
├─ builder-doc # Modern.js Builder 文档
|
191
|
-
├─ doc-tools-doc # Modern.js Doc 文档
|
192
191
|
├─ main-doc # Modern.js Framework 文档
|
193
192
|
└─ module-doc # Modern.js Module 文档
|
194
193
|
```
|
195
194
|
|
196
|
-
文档站使用
|
195
|
+
文档站使用 Rspress 构建,文档内容可以使用 markdown 或 mdx 语法编写。详细使用方法可以参考 [Rspress 文档](https://rspress.dev/)。
|
197
196
|
|
198
|
-
|
197
|
+
Rspress 的源代码可以在 [这个仓库](https://github.com/web-infra-dev/rspress) 中找到。
|
199
198
|
|
200
199
|
---
|
201
200
|
|
@@ -9,7 +9,7 @@ sidebar_position: 21
|
|
9
9
|
|
10
10
|
用于配置 Modern.js Builder 构建插件。
|
11
11
|
|
12
|
-
Modern.js Builder 是 Modern.js
|
12
|
+
Modern.js Builder 是 Modern.js 底层的构建工具,请阅读 [构建能力](/guides/concept/builder) 了解相关背景。
|
13
13
|
|
14
14
|
如果你想了解 Builder 插件的编写方式,可以参考 [Modern.js Builder - 插件系统](https://modernjs.dev/builder/plugins/introduction.html)。
|
15
15
|
|
@@ -9,11 +9,13 @@ sidebar_label: enableAsyncEntry
|
|
9
9
|
|
10
10
|
该选项用于 webpack 模块联邦(Module Federation)场景。
|
11
11
|
|
12
|
-
开启此选项后,Modern.js 会通过
|
12
|
+
开启此选项后,Modern.js 会通过 dynamic import 来包裹自动生成的入口文件(Asynchronous Boundaries),使页面代码可以消费模块联邦生成的远程模块。
|
13
13
|
|
14
14
|
## 背景知识
|
15
15
|
|
16
|
-
|
16
|
+
import ModuleFederation from '@modern-js/builder-doc/docs/zh/shared/module-federation.md';
|
17
|
+
|
18
|
+
<ModuleFederation />
|
17
19
|
|
18
20
|
## 示例
|
19
21
|
|
@@ -2,18 +2,18 @@
|
|
2
2
|
sidebar_position: 2
|
3
3
|
---
|
4
4
|
|
5
|
-
#
|
5
|
+
# 构建工具
|
6
6
|
|
7
7
|
**Modern.js 的构建能力由 [Modern.js Builder](https://modernjs.dev/builder) 提供。**
|
8
8
|
|
9
|
-
Modern.js Builder 是 Modern.js
|
9
|
+
Modern.js Builder 是 Modern.js 体系的核心组件之一,它是一个基于 Rspack 的 Web 构建工具,可以脱离 Modern.js 被独立使用。Modern.js Builder 同时支持 webpack 和 Rspack 等多种打包工具,默认情况下使用最成熟的 webpack 进行打包。
|
10
10
|
|
11
11
|
## 构建架构
|
12
12
|
|
13
13
|
从构建的角度看,Modern.js 分为三层架构,从上到下依次是:
|
14
14
|
|
15
15
|
- 上层研发框架:Modern.js。
|
16
|
-
-
|
16
|
+
- 通用构建工具:Modern.js Builder。
|
17
17
|
- 底层打包工具:webpack 和 Rspack。
|
18
18
|
|
19
19
|
<img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-0824.png" style={{ width: '100%', maxWidth: '540px' }} />
|
@@ -30,10 +30,22 @@ CSR 是 "Client-Side Rendering"(客户端渲染)的缩写。它表示页面
|
|
30
30
|
|
31
31
|
## Garfish
|
32
32
|
|
33
|
-
[Garfish](https://
|
33
|
+
[Garfish](https://garfishjs.org/) 是一套微前端解决方案,主要用于解决 web 应用的跨团队协作、技术体系多样化等问题。
|
34
34
|
|
35
35
|
它从架构层面出发,将多个独立交付的前端应用组成整体,这些前端应用能够独立开发、独立测试、独立部署,但是在用户视角仍然是内聚的单个产品。
|
36
36
|
|
37
|
+
## Micro-frontend
|
38
|
+
|
39
|
+
import MicroFrontend from '@modern-js/builder-doc/docs/zh/shared/micro-frontend.md';
|
40
|
+
|
41
|
+
<MicroFrontend />
|
42
|
+
|
43
|
+
## Module Federation
|
44
|
+
|
45
|
+
import ModuleFederation from '@modern-js/builder-doc/docs/zh/shared/module-federation.md';
|
46
|
+
|
47
|
+
<ModuleFederation />
|
48
|
+
|
37
49
|
## Rspack
|
38
50
|
|
39
51
|
import Rspack from '@modern-js/builder-doc/docs/zh/shared/rspack.md';
|
@@ -7,7 +7,7 @@ sidebar_position: 1
|
|
7
7
|
|
8
8
|
**Modern.js 是字节跳动 Web 工程体系的开源版本**,它提供多个解决方案,来帮助开发者解决不同研发场景下的问题。
|
9
9
|
|
10
|
-
目前 Modern.js 包含三个解决方案,分别面向 Web 应用开发场景、npm
|
10
|
+
目前 Modern.js 包含三个解决方案,分别面向 Web 应用开发场景、npm 包开发场景和 Web 应用构建场景:
|
11
11
|
|
12
12
|
import { SolutionCards } from '@site/src/components/SolutionCards';
|
13
13
|
|
@@ -24,9 +24,9 @@ import { SolutionCards } from '@site/src/components/SolutionCards';
|
|
24
24
|
link: 'http://modernjs.dev/module-tools/',
|
25
25
|
},
|
26
26
|
{
|
27
|
-
title: 'Modern.js
|
28
|
-
description: '基于 Rspack
|
29
|
-
link: 'http://modernjs.dev/
|
27
|
+
title: 'Modern.js Builder',
|
28
|
+
description: '基于 Rspack 的 Web 构建工具',
|
29
|
+
link: 'http://modernjs.dev/builder/',
|
30
30
|
},
|
31
31
|
]}
|
32
32
|
/>
|
@@ -37,14 +37,18 @@ import { SolutionCards } from '@site/src/components/SolutionCards';
|
|
37
37
|
|
38
38
|
**当前文档站对应的是 Modern.js 框架**,适用于开发 Web 应用。
|
39
39
|
|
40
|
-
- 如果你需要开发一个 npm
|
41
|
-
-
|
42
|
-
- 如果你需要基于 Modern.js 的构建引擎来实现一个 Web 开发框架,请移步至 [Modern.js Builder](https://modernjs.dev/builder) 文档。
|
40
|
+
- 如果你需要开发一个 npm 包,请移步 [Modern.js Module](https://modernjs.dev/module-tools) 文档。
|
41
|
+
- 如果你需要基于 Modern.js 的构建工具来实现一个 Web 开发框架,请移步 [Modern.js Builder](https://modernjs.dev/builder) 文档。
|
43
42
|
|
44
43
|
:::tip
|
45
44
|
由于 Modern.js 框架的使用最为广泛,在本文档站中,我们会省略「框架」,直接称其为 Modern.js。
|
46
45
|
:::
|
47
46
|
|
47
|
+
Modern.js 也可以与以下解决方案结合使用:
|
48
|
+
|
49
|
+
- 如果你需要开发一个文档站点,推荐使用 [Rspress](https://rspress.dev/) 文档。
|
50
|
+
- 如果你需要引入微前端架构,推荐使用 [Garfish](https://garfishjs.org/)。
|
51
|
+
|
48
52
|
## Modern.js 框架
|
49
53
|
|
50
54
|
**Modern.js 框架是一个基于 React 的渐进式 Web 开发框架**。在字节跳动内部,我们将 Modern.js 封装为上层框架,并支撑了数千个 Web 应用的研发。
|
@@ -4,7 +4,7 @@ sidebar_position: 1
|
|
4
4
|
|
5
5
|
# 使用
|
6
6
|
|
7
|
-
Modern.js 提供了 `@modern-js/create` 工具用于创建 Modern.js 提供的工程方案项目,例如 [Web 应用](https://modernjs.dev/)、[Npm 模块](https://modernjs.dev/module-tools)、[
|
7
|
+
Modern.js 提供了 `@modern-js/create` 工具用于创建 Modern.js 提供的工程方案项目,例如 [Web 应用](https://modernjs.dev/)、[Npm 模块](https://modernjs.dev/module-tools)、[Monorepo](/guides/topic-detail/monorepo/intro.html) 等。
|
8
8
|
|
9
9
|
下面将介绍 `@modern-js/create` 的使用姿势。
|
10
10
|
|
@@ -1,15 +1,12 @@
|
|
1
1
|
---
|
2
2
|
sidebar_position: 1
|
3
|
-
title: 微前端介绍
|
4
3
|
---
|
5
|
-
# 微前端介绍
|
6
4
|
|
7
|
-
|
5
|
+
# 微前端介绍
|
8
6
|
|
9
|
-
|
7
|
+
import MicroFrontend from '@modern-js/builder-doc/docs/zh/shared/micro-frontend.md';
|
10
8
|
|
11
|
-
|
12
|
-
- 跨团队或跨部门协作开发项目导致效率低下的问题。
|
9
|
+
<MicroFrontend />
|
13
10
|
|
14
11
|
## 微前端关键词
|
15
12
|
|
package/package.json
CHANGED
@@ -15,14 +15,14 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.33.0",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"peerDependencies": {
|
25
|
-
"@modern-js/builder-doc": "^2.
|
25
|
+
"@modern-js/builder-doc": "^2.33.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"classnames": "^2",
|
@@ -32,16 +32,17 @@
|
|
32
32
|
"ts-node": "^10.9.1",
|
33
33
|
"typescript": "^5",
|
34
34
|
"fs-extra": "^10",
|
35
|
+
"rspress": "0.0.6",
|
36
|
+
"@rspress/shared": "0.0.6",
|
35
37
|
"@types/node": "^16",
|
36
38
|
"@types/fs-extra": "^9",
|
37
|
-
"@modern-js/
|
38
|
-
"@modern-js/doc
|
39
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.32.2-alpha.1"
|
39
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.33.0",
|
40
|
+
"@modern-js/builder-doc": "2.33.0"
|
40
41
|
},
|
41
42
|
"scripts": {
|
42
|
-
"dev": "
|
43
|
+
"dev": "rspress dev",
|
43
44
|
"build": "npx ts-node ./scripts/sync.ts",
|
44
|
-
"build:doc": "
|
45
|
-
"preview": "
|
45
|
+
"build:doc": "rspress build",
|
46
|
+
"preview": "rspress preview"
|
46
47
|
}
|
47
48
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import path from 'path';
|
2
|
-
import {
|
2
|
+
import { defineConfig } from 'rspress/config';
|
3
|
+
import { NavItem } from '@rspress/shared';
|
3
4
|
import { pluginAutoSidebar } from '@modern-js/doc-plugin-auto-sidebar';
|
4
5
|
|
5
6
|
const rootCategories = [
|
@@ -52,10 +53,6 @@ const getNavbar = (lang: string): NavItem[] => {
|
|
52
53
|
text: 'Modern.js Module',
|
53
54
|
link: 'https://modernjs.dev/module-tools/en/',
|
54
55
|
},
|
55
|
-
{
|
56
|
-
text: 'Modern.js Doc',
|
57
|
-
link: 'https://modernjs.dev/doc-tools/',
|
58
|
-
},
|
59
56
|
{
|
60
57
|
text: 'Modern.js Builder',
|
61
58
|
link: 'https://modernjs.dev/builder/en/',
|
@@ -70,25 +67,24 @@ const getNavbar = (lang: string): NavItem[] => {
|
|
70
67
|
};
|
71
68
|
|
72
69
|
export default defineConfig({
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
`
|
70
|
+
root: docPath,
|
71
|
+
base: '/',
|
72
|
+
logo: 'https://lf-cdn-tos.bytescm.com/obj/static/webinfra/modern-js-website/assets/images/images/modernjs-logo.svg',
|
73
|
+
icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico',
|
74
|
+
lang: 'zh',
|
75
|
+
themeDir: path.join(__dirname, 'src'),
|
76
|
+
markdown: {
|
77
|
+
checkDeadLinks: true,
|
78
|
+
experimentalMdxRs: true,
|
79
|
+
},
|
80
|
+
head: [
|
81
|
+
`
|
86
82
|
<script>
|
87
83
|
;(function (w, d, u, b, n, pc, ga, ae, po, s, p, e, t, pp) {pc = 'precollect';ga = 'getAttribute';ae = 'addEventListener';po = 'PerformanceObserver';s = function (m) {p = [].slice.call(arguments);p.push(Date.now(), location.href);(m == pc ? s.p.a : s.q).push(p)};s.q = [];s.p = { a: [] };w[n] = s;e = document.createElement('script');e.src = u + '?bid=' + b + '&globalName=' + n;e.crossorigin = u.indexOf('sdk-web') > 0 ? 'anonymous' : 'use-credentials';d.getElementsByTagName('head')[0].appendChild(e);if (ae in w) {s.pcErr = function (e) {e = e || w.event;t = e.target || e.srcElement;if (t instanceof Element || t instanceof HTMLElement) {if (t[ga]('integrity')) {w[n](pc, 'sri', t[ga]('href') || t[ga]('src'))} else {w[n](pc, 'st', { tagName: t.tagName, url: t[ga]('href') || t[ga]('src') })}} else {w[n](pc, 'err', e.error)}};s.pcRej = function (e) {e = e || w.event;w[n](pc, 'err', e.reason || (e.detail && e.detail.reason))};w[ae]('error', s.pcErr, true);w[ae]('unhandledrejection', s.pcRej, true);};if('PerformanceLongTaskTiming' in w) {pp = s.pp = { entries: [] };pp.observer = new PerformanceObserver(function (l) {pp.entries = pp.entries.concat(l.getEntries)});pp.observer.observe({ entryTypes: ['longtask', 'largest-contentful-paint','layout-shift'] })}})(window,document,'https://lf3-short.bytegoofy.com/slardar/fe/sdk-web/browser.cn.js','modernjs_dev','Slardar');
|
88
84
|
|
89
85
|
</script>
|
90
86
|
`,
|
91
|
-
|
87
|
+
`
|
92
88
|
<script>
|
93
89
|
window.Slardar('init', {
|
94
90
|
bid: 'modernjs_dev'
|
@@ -96,76 +92,74 @@ export default defineConfig({
|
|
96
92
|
window.Slardar('start')
|
97
93
|
</script>
|
98
94
|
`,
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
},
|
110
|
-
{
|
111
|
-
lang: 'en',
|
112
|
-
title: 'Modern.js',
|
113
|
-
description:
|
114
|
-
'A Progressive React Framework for modern web development.',
|
115
|
-
nav: getNavbar('en'),
|
116
|
-
label: 'English',
|
117
|
-
},
|
118
|
-
],
|
119
|
-
editLink: {
|
120
|
-
docRepoBaseUrl:
|
121
|
-
'https://github.com/web-infra-dev/modern.js/tree/main/packages/document/main-doc/docs',
|
122
|
-
text: 'Edit this page on GitHub',
|
95
|
+
],
|
96
|
+
themeConfig: {
|
97
|
+
locales: [
|
98
|
+
{
|
99
|
+
lang: 'zh',
|
100
|
+
title: 'Modern.js',
|
101
|
+
description:
|
102
|
+
'A Progressive React Framework for modern web development.',
|
103
|
+
nav: getNavbar('zh'),
|
104
|
+
label: '简体中文',
|
123
105
|
},
|
124
|
-
socialLinks: [
|
125
|
-
{
|
126
|
-
icon: 'github',
|
127
|
-
mode: 'link',
|
128
|
-
content: 'https://github.com/web-infra-dev/modern.js',
|
129
|
-
},
|
130
|
-
],
|
131
|
-
},
|
132
|
-
route: {
|
133
|
-
// exclude document fragments from routes
|
134
|
-
exclude: ['scripts/**', '**/zh/components/**', '**/en/components/**'],
|
135
|
-
},
|
136
|
-
replaceRules: [
|
137
106
|
{
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
107
|
+
lang: 'en',
|
108
|
+
title: 'Modern.js',
|
109
|
+
description:
|
110
|
+
'A Progressive React Framework for modern web development.',
|
111
|
+
nav: getNavbar('en'),
|
112
|
+
label: 'English',
|
142
113
|
},
|
143
114
|
],
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
115
|
+
editLink: {
|
116
|
+
docRepoBaseUrl:
|
117
|
+
'https://github.com/web-infra-dev/modern.js/tree/main/packages/document/main-doc/docs',
|
118
|
+
text: 'Edit this page on GitHub',
|
119
|
+
},
|
120
|
+
socialLinks: [
|
121
|
+
{
|
122
|
+
icon: 'github',
|
123
|
+
mode: 'link',
|
124
|
+
content: 'https://github.com/web-infra-dev/modern.js',
|
152
125
|
},
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
126
|
+
],
|
127
|
+
},
|
128
|
+
route: {
|
129
|
+
// exclude document fragments from routes
|
130
|
+
exclude: ['scripts/**', '**/zh/components/**', '**/en/components/**'],
|
131
|
+
},
|
132
|
+
replaceRules: [
|
133
|
+
{
|
134
|
+
// The major version is different inside the ByteDance,
|
135
|
+
// so we use a flag to define it.
|
136
|
+
search: /MAJOR_VERSION/g,
|
137
|
+
replace: '2',
|
138
|
+
},
|
139
|
+
],
|
140
|
+
builderConfig: {
|
141
|
+
output: {
|
142
|
+
disableTsChecker: true,
|
143
|
+
svgDefaultExport: 'component',
|
144
|
+
dataUriLimit: 0,
|
145
|
+
},
|
146
|
+
dev: {
|
147
|
+
startUrl: false,
|
148
|
+
},
|
149
|
+
source: {
|
150
|
+
alias: {
|
151
|
+
'@site-docs': path.join(__dirname, './docs/zh'),
|
152
|
+
'@site-docs-en': path.join(__dirname, './docs/en'),
|
153
|
+
'@site': require('path').resolve(__dirname),
|
159
154
|
},
|
160
155
|
},
|
161
|
-
plugins: [
|
162
|
-
pluginAutoSidebar({
|
163
|
-
root: docPath,
|
164
|
-
categories: ['zh', 'en'].flatMap(lang =>
|
165
|
-
rootCategories.map(category => `${lang}/${category}`),
|
166
|
-
),
|
167
|
-
}),
|
168
|
-
],
|
169
156
|
},
|
170
|
-
plugins: [
|
157
|
+
plugins: [
|
158
|
+
pluginAutoSidebar({
|
159
|
+
root: docPath,
|
160
|
+
categories: ['zh', 'en'].flatMap(lang =>
|
161
|
+
rootCategories.map(category => `${lang}/${category}`),
|
162
|
+
),
|
163
|
+
}),
|
164
|
+
],
|
171
165
|
});
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import cl from 'classnames';
|
3
|
-
import { withBase } from '
|
3
|
+
import { withBase } from 'rspress/runtime';
|
4
4
|
import styles from './index.module.scss';
|
5
5
|
|
6
6
|
export interface ContentCardProps {
|
7
7
|
title: string;
|
8
8
|
desc?: string;
|
9
|
-
img?: string | ComponentType<SVGProps<SVGSVGElement>>;
|
10
9
|
href: string;
|
11
10
|
}
|
12
11
|
|
@@ -18,10 +18,10 @@
|
|
18
18
|
border-radius: 20px;
|
19
19
|
overflow: hidden;
|
20
20
|
transition: 0.15s ease-in;
|
21
|
-
border: 1px solid var(--
|
21
|
+
border: 1px solid var(--rp-c-divider-light);
|
22
22
|
|
23
23
|
&:hover {
|
24
|
-
border-color: var(--
|
24
|
+
border-color: var(--rp-c-brand);
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
@@ -33,7 +33,7 @@
|
|
33
33
|
cursor: pointer;
|
34
34
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
35
35
|
pointer-events: none;
|
36
|
-
background-color: var(--
|
36
|
+
background-color: var(--rp-c-bg-soft);
|
37
37
|
}
|
38
38
|
|
39
39
|
.bottom {
|
@@ -46,7 +46,7 @@
|
|
46
46
|
font-weight: 600;
|
47
47
|
font-size: 17px;
|
48
48
|
line-height: 28px;
|
49
|
-
color: var(--
|
49
|
+
color: var(--rp-c-text-1);
|
50
50
|
}
|
51
51
|
|
52
52
|
.type {
|
@@ -76,5 +76,5 @@
|
|
76
76
|
.domain {
|
77
77
|
font-size: 13px;
|
78
78
|
line-height: 24px;
|
79
|
-
color: var(--
|
79
|
+
color: var(--rp-c-text-2);
|
80
80
|
}
|
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
.card {
|
9
9
|
cursor: pointer;
|
10
|
-
border: 1px solid var(--
|
11
|
-
background-color: var(--
|
10
|
+
border: 1px solid var(--rp-c-bg-soft);
|
11
|
+
background-color: var(--rp-c-bg-soft);
|
12
12
|
transition: color 0.5s, background-color 0.5s;
|
13
13
|
padding: 22px;
|
14
14
|
border-radius: 16px;
|
package/src/i18n/enUS.ts
CHANGED
@@ -27,8 +27,8 @@ export const EN_US = {
|
|
27
27
|
solutions: 'Solutions',
|
28
28
|
solutionsDesc1: 'A progressive React framework for web development.',
|
29
29
|
solutionsDesc2: 'A powerful solution for npm package development.',
|
30
|
-
solutionsDesc3: '
|
31
|
-
solutionsDesc4: 'A
|
30
|
+
solutionsDesc3: 'An Rspack-based build tool for web development.',
|
31
|
+
solutionsDesc4: 'A fast Rspack-based static site generator',
|
32
32
|
|
33
33
|
// Footer
|
34
34
|
guide: 'Guide',
|
package/src/i18n/index.ts
CHANGED
package/src/i18n/zhCN.ts
CHANGED
@@ -27,8 +27,8 @@ export const ZH_CN: Record<keyof typeof EN_US, string> = {
|
|
27
27
|
solutions: '解决方案',
|
28
28
|
solutionsDesc1: '基于 React 的渐进式 Web 开发框架。',
|
29
29
|
solutionsDesc2: '简单、高性能的 npm 包开发方案。',
|
30
|
-
solutionsDesc3: '基于 Rspack
|
31
|
-
solutionsDesc4: '
|
30
|
+
solutionsDesc3: '基于 Rspack 的 Web 构建工具。',
|
31
|
+
solutionsDesc4: '基于 Rspack 的静态站点生成器。',
|
32
32
|
|
33
33
|
// Footer
|
34
34
|
guide: '指南',
|
package/src/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Theme from '
|
1
|
+
import Theme from 'rspress/theme';
|
2
2
|
import HomeLayout from './pages';
|
3
3
|
|
4
4
|
export default {
|
@@ -6,4 +6,5 @@ export default {
|
|
6
6
|
HomeLayout,
|
7
7
|
};
|
8
8
|
|
9
|
-
|
9
|
+
// eslint-disable-next-line import/export
|
10
|
+
export * from 'rspress/theme';
|
package/src/pages/index.tsx
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
/* eslint-disable react/no-unescaped-entities */
|
1
2
|
import clsx from 'clsx';
|
2
|
-
import { useLang, Helmet, useLocation } from '
|
3
|
+
import { useLang, Helmet, useLocation } from 'rspress/runtime';
|
3
4
|
import { useEffect } from 'react';
|
4
5
|
import ContentCard from '../components/ContentCard';
|
5
6
|
import SecondaryTitle from '../components/SecondaryTitle';
|
@@ -99,13 +100,13 @@ export default function Home() {
|
|
99
100
|
desc: t('solutionsDesc2'),
|
100
101
|
},
|
101
102
|
{
|
102
|
-
title: 'Modern.js
|
103
|
-
href: `https://modernjs.dev/
|
103
|
+
title: 'Modern.js Builder',
|
104
|
+
href: `https://modernjs.dev/builder${lang === 'en' ? '/en' : ''}`,
|
104
105
|
desc: t('solutionsDesc3'),
|
105
106
|
},
|
106
107
|
{
|
107
|
-
title: '
|
108
|
-
href: `https://
|
108
|
+
title: 'Rspress',
|
109
|
+
href: `https://rspress.dev${lang === 'en' ? '' : '/zh'}`,
|
109
110
|
desc: t('solutionsDesc4'),
|
110
111
|
},
|
111
112
|
];
|
@@ -116,7 +117,7 @@ export default function Home() {
|
|
116
117
|
<html className="dark"></html>
|
117
118
|
<script>window.MODERN_THEME = 'dark';</script>
|
118
119
|
<style type="text/css">{`
|
119
|
-
.
|
120
|
+
.rspress-doc-appearance {
|
120
121
|
display: none!important;
|
121
122
|
}
|
122
123
|
`}</style>
|