@modern-js/main-doc 3.9.3 → 3.10.1
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.
- package/docs/en/apis/app/hooks/api/lambda.mdx +2 -1
- package/docs/en/apis/app/hooks/config/html.mdx +1 -0
- package/docs/en/apis/app/hooks/config/mock.mdx +1 -0
- package/docs/en/apis/app/hooks/config/public.mdx +1 -0
- package/docs/en/apis/app/hooks/config/upload.mdx +2 -3
- package/docs/en/apis/app/hooks/modern-config.mdx +1 -0
- package/docs/en/apis/app/hooks/shared.mdx +1 -0
- package/docs/en/apis/app/hooks/src/modern.runtime.mdx +1 -0
- package/docs/en/apis/app/hooks/src/routes.mdx +1 -0
- package/docs/en/apis/app/hooks/src/server.mdx +2 -1
- package/docs/en/apis/app/runtime/bff/use-hono-context.mdx +1 -0
- package/docs/en/apis/app/runtime/core/create-root.mdx +4 -1
- package/docs/en/apis/app/runtime/core/render.mdx +6 -2
- package/docs/en/apis/app/runtime/core/runtime-context.mdx +17 -17
- package/docs/en/apis/app/runtime/router/router.mdx +9 -6
- package/docs/en/apis/app/runtime/ssr/no-ssr.mdx +1 -0
- package/docs/en/apis/app/runtime/utility/head.mdx +1 -0
- package/docs/en/apis/app/runtime/utility/loadable.mdx +1 -0
- package/docs/en/community/blog/v3-release-note.mdx +36 -27
- package/docs/en/community/contributing-guide.mdx +15 -33
- package/docs/en/components/default-browserslist.mdx +0 -1
- package/docs/en/components/deploy-command.mdx +1 -1
- package/docs/en/components/deploy.mdx +1 -1
- package/docs/en/components/entry-scan-logic.mdx +1 -1
- package/docs/en/components/init-app.mdx +9 -3
- package/docs/en/components/international/custom-instance-code.mdx +0 -1
- package/docs/en/components/micro-runtime-config.mdx +12 -9
- package/docs/en/components/nodeVersion.mdx +2 -2
- package/docs/en/components/rsc-deploy-tip.mdx +0 -1
- package/docs/en/components/ssr-monitor.mdx +1 -1
- package/docs/en/configure/app/bff/cross-project.mdx +2 -2
- package/docs/en/configure/app/bff/prefix.mdx +1 -1
- package/docs/en/configure/app/dev/lazy-compilation.mdx +17 -1
- package/docs/en/configure/app/dev/start-url.mdx +0 -1
- package/docs/en/configure/app/output/css-modules.mdx +1 -5
- package/docs/en/configure/app/output/dist-path.mdx +0 -1
- package/docs/en/configure/app/output/inline-scripts.mdx +1 -2
- package/docs/en/configure/app/output/inline-styles.mdx +1 -2
- package/docs/en/configure/app/output/split-route-chunks.mdx +1 -1
- package/docs/en/configure/app/output/ssg.mdx +1 -1
- package/docs/en/configure/app/output/ssgByEntries.mdx +1 -0
- package/docs/en/configure/app/performance/chunk-split.mdx +1 -4
- package/docs/en/configure/app/runtime/plugins.mdx +6 -4
- package/docs/en/configure/app/server/rsc.mdx +1 -1
- package/docs/en/configure/app/server/ssr.mdx +7 -8
- package/docs/en/configure/app/server/tsconfig-path.mdx +2 -2
- package/docs/en/configure/app/tools/less.mdx +5 -6
- package/docs/en/configure/app/tools/sass.mdx +5 -6
- package/docs/en/configure/app/tools/svgr.mdx +7 -7
- package/docs/en/configure/app/usage.mdx +1 -5
- package/docs/en/guides/advanced-features/bff/cross-project.mdx +5 -4
- package/docs/en/guides/advanced-features/compatibility.mdx +0 -1
- package/docs/en/guides/advanced-features/international/advanced.mdx +1 -1
- package/docs/en/guides/advanced-features/international/api.mdx +34 -28
- package/docs/en/guides/advanced-features/international/best-practices.mdx +15 -15
- package/docs/en/guides/advanced-features/international/configuration.mdx +37 -37
- package/docs/en/guides/advanced-features/international/locale-detection.mdx +37 -28
- package/docs/en/guides/advanced-features/international/resource-loading.mdx +19 -17
- package/docs/en/guides/advanced-features/international/routing.mdx +8 -6
- package/docs/en/guides/advanced-features/international.mdx +8 -8
- package/docs/en/guides/advanced-features/server-monitor/logger.mdx +5 -5
- package/docs/en/guides/advanced-features/server-monitor/metrics.mdx +8 -8
- package/docs/en/guides/advanced-features/server-monitor/monitors.mdx +1 -3
- package/docs/en/guides/advanced-features/source-build.mdx +1 -1
- package/docs/en/guides/advanced-features/web-server.mdx +3 -3
- package/docs/en/guides/basic-features/data/data-fetch.mdx +1 -3
- package/docs/en/guides/basic-features/data/data-write.mdx +24 -28
- package/docs/en/guides/basic-features/debug/mock.mdx +2 -2
- package/docs/en/guides/basic-features/debug/using-storybook.mdx +5 -6
- package/docs/en/guides/basic-features/html.mdx +2 -3
- package/docs/en/guides/basic-features/output-files.mdx +1 -1
- package/docs/en/guides/basic-features/render/overview.mdx +12 -12
- package/docs/en/guides/basic-features/render/rsc.mdx +16 -9
- package/docs/en/guides/basic-features/render/ssr-cache.mdx +5 -5
- package/docs/en/guides/basic-features/render/ssr.mdx +8 -12
- package/docs/en/guides/basic-features/render/streaming-ssr.mdx +2 -1
- package/docs/en/guides/basic-features/routes/config-routes.mdx +60 -59
- package/docs/en/guides/basic-features/testing/playwright.mdx +14 -8
- package/docs/en/guides/basic-features/testing/rstest.mdx +6 -4
- package/docs/en/guides/get-started/ai-coding-agents.mdx +6 -6
- package/docs/en/guides/get-started/introduction.mdx +0 -1
- package/docs/en/guides/topic-detail/module-federation/deploy.mdx +2 -2
- package/docs/en/guides/topic-detail/module-federation/introduce.mdx +0 -1
- package/docs/en/guides/upgrade/config.mdx +12 -0
- package/docs/en/guides/upgrade/other.mdx +4 -4
- package/docs/en/guides/upgrade/tailwindcss.mdx +0 -1
- package/docs/en/guides/upgrade/web-server.md +34 -17
- package/docs/en/index.md +1 -0
- package/docs/en/plugin/cli-plugins/api.mdx +23 -23
- package/docs/en/plugin/cli-plugins/life-cycle.mdx +2 -0
- package/docs/en/plugin/introduction.mdx +6 -6
- package/docs/en/plugin/official/cli-plugins/plugin-bff.mdx +1 -1
- package/docs/en/plugin/official/cli-plugins/plugin-ssg.mdx +1 -1
- package/docs/en/plugin/plugin-system.mdx +19 -26
- package/docs/en/plugin/runtime-plugins/life-cycle.mdx +2 -0
- package/docs/en/plugin/server-plugins/api.mdx +11 -14
- package/docs/en/plugin/server-plugins/life-cycle.mdx +2 -0
- package/docs/zh/apis/app/hooks/api/lambda.mdx +1 -1
- package/docs/zh/apis/app/hooks/config/html.mdx +1 -0
- package/docs/zh/apis/app/hooks/config/mock.mdx +1 -0
- package/docs/zh/apis/app/hooks/config/public.mdx +1 -0
- package/docs/zh/apis/app/hooks/config/upload.mdx +2 -3
- package/docs/zh/apis/app/hooks/modern-config.mdx +1 -0
- package/docs/zh/apis/app/hooks/shared.mdx +1 -0
- package/docs/zh/apis/app/hooks/src/modern.runtime.mdx +1 -0
- package/docs/zh/apis/app/hooks/src/routes.mdx +1 -0
- package/docs/zh/apis/app/hooks/src/server.mdx +2 -1
- package/docs/zh/apis/app/runtime/bff/use-hono-context.mdx +1 -1
- package/docs/zh/apis/app/runtime/core/create-root.mdx +4 -1
- package/docs/zh/apis/app/runtime/core/render.mdx +6 -3
- package/docs/zh/apis/app/runtime/core/runtime-context.mdx +17 -17
- package/docs/zh/apis/app/runtime/router/router.mdx +10 -6
- package/docs/zh/apis/app/runtime/ssr/no-ssr.mdx +1 -0
- package/docs/zh/apis/app/runtime/utility/head.mdx +1 -0
- package/docs/zh/apis/app/runtime/utility/loadable.mdx +1 -0
- package/docs/zh/community/blog/v3-release-note.mdx +38 -29
- package/docs/zh/community/contributing-guide.mdx +16 -34
- package/docs/zh/components/default-browserslist.mdx +0 -1
- package/docs/zh/components/deploy-command.mdx +1 -1
- package/docs/zh/components/deploy.mdx +1 -1
- package/docs/zh/components/entry-scan-logic.mdx +1 -1
- package/docs/zh/components/init-app.mdx +9 -3
- package/docs/zh/components/international/custom-instance-code.mdx +0 -1
- package/docs/zh/components/international/install-command.mdx +0 -1
- package/docs/zh/components/micro-runtime-config.mdx +12 -9
- package/docs/zh/components/nodeVersion.mdx +2 -2
- package/docs/zh/components/rsc-deploy-tip.mdx +0 -1
- package/docs/zh/components/ssr-monitor.mdx +1 -1
- package/docs/zh/configure/app/bff/cross-project.mdx +2 -2
- package/docs/zh/configure/app/bff/prefix.mdx +1 -1
- package/docs/zh/configure/app/dev/lazy-compilation.mdx +17 -1
- package/docs/zh/configure/app/html/crossorigin.mdx +0 -1
- package/docs/zh/configure/app/html/favicon.mdx +0 -1
- package/docs/zh/configure/app/output/convert-to-rem.mdx +0 -1
- package/docs/zh/configure/app/output/css-modules.mdx +1 -5
- package/docs/zh/configure/app/output/inline-scripts.mdx +1 -2
- package/docs/zh/configure/app/output/inline-styles.mdx +1 -2
- package/docs/zh/configure/app/output/source-map.mdx +0 -2
- package/docs/zh/configure/app/output/split-route-chunks.mdx +1 -1
- package/docs/zh/configure/app/output/ssg.mdx +1 -0
- package/docs/zh/configure/app/output/ssgByEntries.mdx +1 -1
- package/docs/zh/configure/app/performance/chunk-split.mdx +1 -4
- package/docs/zh/configure/app/resolve/dedupe.mdx +0 -1
- package/docs/zh/configure/app/runtime/plugins.mdx +6 -4
- package/docs/zh/configure/app/server/rsc.mdx +1 -1
- package/docs/zh/configure/app/server/ssr.mdx +6 -7
- package/docs/zh/configure/app/server/tsconfig-path.mdx +2 -2
- package/docs/zh/configure/app/tools/less.mdx +6 -7
- package/docs/zh/configure/app/tools/sass.mdx +6 -7
- package/docs/zh/configure/app/tools/svgr.mdx +11 -11
- package/docs/zh/configure/app/usage.mdx +1 -5
- package/docs/zh/guides/advanced-features/bff.mdx +1 -0
- package/docs/zh/guides/advanced-features/international/advanced.mdx +1 -1
- package/docs/zh/guides/advanced-features/international/api.mdx +28 -27
- package/docs/zh/guides/advanced-features/international/best-practices.mdx +15 -15
- package/docs/zh/guides/advanced-features/international/configuration.mdx +38 -36
- package/docs/zh/guides/advanced-features/international/locale-detection.mdx +37 -28
- package/docs/zh/guides/advanced-features/international/resource-loading.mdx +20 -16
- package/docs/zh/guides/advanced-features/international/routing.mdx +6 -4
- package/docs/zh/guides/advanced-features/international.mdx +9 -9
- package/docs/zh/guides/advanced-features/server-monitor/logger.mdx +4 -6
- package/docs/zh/guides/advanced-features/server-monitor/metrics.mdx +9 -10
- package/docs/zh/guides/advanced-features/source-build.mdx +1 -1
- package/docs/zh/guides/advanced-features/web-server.mdx +3 -3
- package/docs/zh/guides/basic-features/data/data-fetch.mdx +1 -3
- package/docs/zh/guides/basic-features/data/data-write.mdx +25 -31
- package/docs/zh/guides/basic-features/debug/mock.mdx +2 -2
- package/docs/zh/guides/basic-features/debug/using-storybook.mdx +5 -5
- package/docs/zh/guides/basic-features/env-vars.mdx +0 -1
- package/docs/zh/guides/basic-features/html.mdx +2 -3
- package/docs/zh/guides/basic-features/render/overview.mdx +12 -13
- package/docs/zh/guides/basic-features/render/rsc.mdx +16 -9
- package/docs/zh/guides/basic-features/render/ssr.mdx +8 -17
- package/docs/zh/guides/basic-features/routes/config-routes.mdx +61 -59
- package/docs/zh/guides/basic-features/testing/playwright.mdx +15 -10
- package/docs/zh/guides/basic-features/testing/rstest.mdx +6 -4
- package/docs/zh/guides/get-started/ai-coding-agents.mdx +7 -7
- package/docs/zh/guides/topic-detail/module-federation/deploy.mdx +2 -2
- package/docs/zh/guides/upgrade/config.mdx +12 -0
- package/docs/zh/guides/upgrade/other.md +4 -11
- package/docs/zh/guides/upgrade/overview.mdx +1 -4
- package/docs/zh/guides/upgrade/tailwindcss.mdx +0 -1
- package/docs/zh/guides/upgrade/web-server.md +34 -19
- package/docs/zh/index.md +1 -0
- package/docs/zh/plugin/cli-plugins/api.mdx +24 -24
- package/docs/zh/plugin/cli-plugins/life-cycle.mdx +2 -0
- package/docs/zh/plugin/introduction.mdx +6 -6
- package/docs/zh/plugin/official/cli-plugins/plugin-bff.mdx +1 -1
- package/docs/zh/plugin/official/cli-plugins/plugin-ssg.mdx +1 -1
- package/docs/zh/plugin/plugin-system.mdx +19 -26
- package/docs/zh/plugin/runtime-plugins/life-cycle.mdx +2 -0
- package/docs/zh/plugin/server-plugins/api.mdx +11 -14
- package/docs/zh/plugin/server-plugins/life-cycle.mdx +2 -0
- package/package.json +11 -13
- package/{rspress.config.ts → rstack.config.mts} +7 -10
- package/src/components/Footer/styles.module.scss +1 -1
- package/src/components/SolutionCards/index.module.scss +3 -1
|
@@ -126,12 +126,12 @@ Rsbuild 是 Modern.js 底层的构建工具,通过添加 Rsbuild 插件可修
|
|
|
126
126
|
|
|
127
127
|
以下为已在 Modern.js 中内置的 Rsbuild 官方插件,无需安装,即可启用:
|
|
128
128
|
|
|
129
|
-
| 插件
|
|
130
|
-
|
|
|
131
|
-
| [React 插件](https://v2.rsbuild.rs/zh/plugins/list/plugin-react)
|
|
132
|
-
| [SVGR 插件](https://v2.rsbuild.rs/zh/plugins/list/plugin-svgr)
|
|
133
|
-
| [Assets Retry 插件](https://github.com/rstackjs/rsbuild-plugin-assets-retry)
|
|
134
|
-
| [Type Check 插件](https://github.com/rstackjs/rsbuild-plugin-type-check)
|
|
129
|
+
| 插件 | 介绍 | Modern.js 链接 |
|
|
130
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
131
|
+
| [React 插件](https://v2.rsbuild.rs/zh/plugins/list/plugin-react) | 提供对 React 的支持 | - |
|
|
132
|
+
| [SVGR 插件](https://v2.rsbuild.rs/zh/plugins/list/plugin-svgr) | 支持将 SVG 图片转换为一个 React 组件 | [tools.svgr](/configure/app/tools/svgr) |
|
|
133
|
+
| [Assets Retry 插件](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | 用于在静态资源加载失败时自动发起重试请求 | [output.assetsRetry](/configure/app/output/assets-retry.html) |
|
|
134
|
+
| [Type Check 插件](https://github.com/rstackjs/rsbuild-plugin-type-check) | 用于在单独的进程中运行 TypeScript 类型检查 | [output.disableTsChecker](/configure/app/output/disable-ts-checker.html)<br />[tools.tsChecker](/configure/app/tools/ts-checker.html) |
|
|
135
135
|
| [Source Build 插件](https://github.com/rstackjs/rsbuild-plugin-source-build) | 用于 monorepo 场景,支持引用其他子目录的源代码,并完成构建和热更新 | [experiments.sourceBuild](/configure/app/experiments/source-build.html) |
|
|
136
136
|
| [Check Syntax 插件](https://github.com/rstackjs/rsbuild-plugin-check-syntax) | 用于分析产物的语法兼容性,判断是否存在导致兼容性问题的高级语法 | [security.checkSyntax](/configure/app/security/check-syntax.html) |
|
|
137
137
|
| [CSS Minimizer 插件](https://github.com/rstackjs/rsbuild-plugin-css-minimizer) | 用于自定义 CSS 压缩工具,切换到 [cssnano](https://cssnano.co/) 或其他工具进行 CSS 压缩 | [tools.minifyCss](/configure/app/tools/minify-css.html) |
|
|
@@ -14,31 +14,26 @@ Modern.js 秉承“一切皆插件”的设计哲学,将框架的各项功能
|
|
|
14
14
|
## 插件类型与适用场景
|
|
15
15
|
|
|
16
16
|
**CLI 插件**:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
|
|
18
|
+
- **作用阶段**:构建时(执行 `modern` 命令时)。
|
|
19
|
+
- **典型场景**:
|
|
20
|
+
- 扩展命令行工具。
|
|
21
|
+
- 修改构建配置。
|
|
22
|
+
- 监听文件变化。
|
|
23
|
+
- 控制构建流程。
|
|
24
|
+
- **配置方式**:`modern.config.ts` 中的 `plugins` 字段。
|
|
24
25
|
|
|
25
26
|
**Runtime 插件**:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- **典型场景**:
|
|
37
|
-
- 添加自定义中间件。
|
|
38
|
-
- 扩展服务端 API。
|
|
39
|
-
- 定制化 SSR 逻辑。
|
|
40
|
-
- 与后端框架集成。
|
|
41
|
-
- **配置方式**:`server/modern.server.ts` 中的 `plugins` 字段。 */}
|
|
27
|
+
|
|
28
|
+
- **作用阶段**:应用运行时(浏览器/Node.js 环境)。
|
|
29
|
+
- **典型场景**:
|
|
30
|
+
- 初始化全局状态或服务。
|
|
31
|
+
- 封装 React 高阶组件(HOC)。
|
|
32
|
+
- 拦截或修改路由行为。
|
|
33
|
+
- 控制渲染流程。
|
|
34
|
+
- **配置方式**:`src/modern.runtime.ts` 中的 `plugins` 字段。
|
|
35
|
+
|
|
36
|
+
{/* **Server 插件**: - **作用阶段**:服务端请求处理阶段。 - **典型场景**: - 添加自定义中间件。 - 扩展服务端 API。 - 定制化 SSR 逻辑。 - 与后端框架集成。 - **配置方式**:`server/modern.server.ts` 中的 `plugins` 字段。 */}
|
|
42
37
|
|
|
43
38
|
## 插件结构
|
|
44
39
|
|
|
@@ -194,9 +189,7 @@ const myPlugin2 = () => ({
|
|
|
194
189
|
// 定义 Hooks
|
|
195
190
|
import { createSyncHook } from '@modern-js/plugin';
|
|
196
191
|
|
|
197
|
-
type RouteObject = {
|
|
198
|
-
/** TODO **/
|
|
199
|
-
};
|
|
192
|
+
type RouteObject = {/** TODO **/};
|
|
200
193
|
const modifyRoutes = createSyncHook<(routes: RouteObject[]) => RouteObject[]>();
|
|
201
194
|
|
|
202
195
|
// 插件中注册 Hooks
|
|
@@ -46,17 +46,17 @@ export default myServerPlugin;
|
|
|
46
46
|
|
|
47
47
|
- **返回值:** `ServerContext` 对象,包含以下字段:
|
|
48
48
|
|
|
49
|
-
| 字段名
|
|
50
|
-
|
|
|
51
|
-
| `middlewares`
|
|
52
|
-
| `renderMiddlewares` | `MiddlewareObj[]` | 渲染中间件列表
|
|
53
|
-
| `routes`
|
|
54
|
-
| `appDirectory`
|
|
55
|
-
| `apiDirectory`
|
|
56
|
-
| `lambdaDirectory`
|
|
57
|
-
| `sharedDirectory`
|
|
58
|
-
| `distDirectory`
|
|
59
|
-
| `plugins`
|
|
49
|
+
| 字段名 | 类型 | 描述 |
|
|
50
|
+
| ------------------- | ----------------- | -------------------------- |
|
|
51
|
+
| `middlewares` | `MiddlewareObj[]` | 中间件列表 |
|
|
52
|
+
| `renderMiddlewares` | `MiddlewareObj[]` | 渲染中间件列表 |
|
|
53
|
+
| `routes` | `ServerRoute[]` | 服务器路由信息 |
|
|
54
|
+
| `appDirectory` | `string` | 项目根目录的绝对路径 |
|
|
55
|
+
| `apiDirectory` | `string` | API 模块目录的绝对路径 |
|
|
56
|
+
| `lambdaDirectory` | `string` | Lambda 模块目录的绝对路径 |
|
|
57
|
+
| `sharedDirectory` | `string` | 公共模块目录的绝对路径 |
|
|
58
|
+
| `distDirectory` | `string` | 项目产物输出目录的绝对路径 |
|
|
59
|
+
| `plugins` | `ServerPlugin[]` | 当前已注册的插件列表 |
|
|
60
60
|
|
|
61
61
|
- **示例:**
|
|
62
62
|
|
|
@@ -111,7 +111,6 @@ await hooks.onPrepare.call();
|
|
|
111
111
|
|
|
112
112
|
---
|
|
113
113
|
|
|
114
|
-
|
|
115
114
|
## 上下文修改
|
|
116
115
|
|
|
117
116
|
#### `api.updateServerContext`
|
|
@@ -143,7 +142,6 @@ api.onPrepare(() => {
|
|
|
143
142
|
|
|
144
143
|
---
|
|
145
144
|
|
|
146
|
-
|
|
147
145
|
## 生命周期钩子
|
|
148
146
|
|
|
149
147
|
#### `api.onPrepare`
|
|
@@ -205,7 +203,6 @@ api.onReset(async ({ event }) => {
|
|
|
205
203
|
|
|
206
204
|
---
|
|
207
205
|
|
|
208
|
-
|
|
209
206
|
## 其他说明
|
|
210
207
|
|
|
211
208
|
- 可以参考 [Server 插件生命周期](./life-cycle.mdx) 了解插件钩子的执行顺序。
|
package/package.json
CHANGED
|
@@ -16,19 +16,18 @@
|
|
|
16
16
|
"modern",
|
|
17
17
|
"modern.js"
|
|
18
18
|
],
|
|
19
|
-
"version": "3.
|
|
19
|
+
"version": "3.10.1",
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"registry": "https://registry.npmjs.org/",
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"mermaid": "^11.
|
|
26
|
-
"@modern-js/sandpack-react": "3.
|
|
25
|
+
"mermaid": "^11.17.2",
|
|
26
|
+
"@modern-js/sandpack-react": "3.10.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"rsbuild-plugin-open-graph": "1.1.3",
|
|
30
29
|
"@rsbuild/plugin-sass": "2.0.1",
|
|
31
|
-
"@rspress/core": "2.0.
|
|
30
|
+
"@rspress/core": "2.0.23",
|
|
32
31
|
"@rspress/plugin-llms": "2.0.2",
|
|
33
32
|
"@rspress/shared": "2.0.2",
|
|
34
33
|
"@shikijs/transformers": "^3.23.0",
|
|
@@ -37,8 +36,9 @@
|
|
|
37
36
|
"classnames": "^2.5.1",
|
|
38
37
|
"clsx": "^1.2.1",
|
|
39
38
|
"fs-extra": "^10.1.0",
|
|
40
|
-
"react": "^19.
|
|
41
|
-
"react-dom": "^19.
|
|
39
|
+
"react": "^19.3.1",
|
|
40
|
+
"react-dom": "^19.3.1",
|
|
41
|
+
"rsbuild-plugin-open-graph": "1.1.3",
|
|
42
42
|
"ts-node": "^10.9.2",
|
|
43
43
|
"typescript": "^5"
|
|
44
44
|
},
|
|
@@ -48,8 +48,7 @@
|
|
|
48
48
|
"inputs": [
|
|
49
49
|
"build",
|
|
50
50
|
"^build",
|
|
51
|
-
"{projectRoot}/docs/**/*"
|
|
52
|
-
"{projectRoot}/rspress.config.ts"
|
|
51
|
+
"{projectRoot}/docs/**/*"
|
|
53
52
|
],
|
|
54
53
|
"outputs": [
|
|
55
54
|
"{projectRoot}/doc_build"
|
|
@@ -58,9 +57,8 @@
|
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
59
|
"scripts": {
|
|
61
|
-
"dev": "
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"preview": "rspress preview"
|
|
60
|
+
"dev": "rs doc",
|
|
61
|
+
"build": "rs doc build",
|
|
62
|
+
"preview": "rs doc preview"
|
|
65
63
|
}
|
|
66
64
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { pluginSass } from '@rsbuild/plugin-sass';
|
|
3
|
-
import { defineConfig } from '@rspress/core';
|
|
4
3
|
import { transformerNotationHighlight } from '@shikijs/transformers';
|
|
5
4
|
import { pluginOpenGraph } from 'rsbuild-plugin-open-graph';
|
|
5
|
+
import { define } from 'rstack';
|
|
6
6
|
|
|
7
|
-
const docPath = path.join(
|
|
7
|
+
const docPath = path.join(import.meta.dirname, 'docs');
|
|
8
8
|
const siteTitle = 'Modern.js';
|
|
9
9
|
const siteDescription =
|
|
10
10
|
'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.';
|
|
@@ -13,7 +13,7 @@ const socialDescription =
|
|
|
13
13
|
const socialImage =
|
|
14
14
|
'https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/banner.jpeg';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
define.doc({
|
|
17
17
|
root: docPath,
|
|
18
18
|
llms: true,
|
|
19
19
|
title: siteTitle,
|
|
@@ -22,7 +22,7 @@ export default defineConfig({
|
|
|
22
22
|
logo: 'https://lf-cdn-tos.bytescm.com/obj/static/webinfra/modern-js-website/assets/images/images/modernjs-logo.svg',
|
|
23
23
|
icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico',
|
|
24
24
|
lang: 'en',
|
|
25
|
-
themeDir: path.join(
|
|
25
|
+
themeDir: path.join(import.meta.dirname, 'src'),
|
|
26
26
|
markdown: {
|
|
27
27
|
checkDeadLinks: true,
|
|
28
28
|
shiki: {
|
|
@@ -111,14 +111,11 @@ export default defineConfig({
|
|
|
111
111
|
output: {
|
|
112
112
|
dataUriLimit: 0,
|
|
113
113
|
},
|
|
114
|
-
dev: {
|
|
115
|
-
lazyCompilation: process.env.LAZY !== 'false',
|
|
116
|
-
},
|
|
117
114
|
resolve: {
|
|
118
115
|
alias: {
|
|
119
|
-
'@site-docs': path.join(
|
|
120
|
-
'@site-docs-en': path.join(
|
|
121
|
-
'@site':
|
|
116
|
+
'@site-docs': path.join(import.meta.dirname, './docs/zh'),
|
|
117
|
+
'@site-docs-en': path.join(import.meta.dirname, './docs/en'),
|
|
118
|
+
'@site': import.meta.dirname,
|
|
122
119
|
},
|
|
123
120
|
},
|
|
124
121
|
plugins: [
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
cursor: pointer;
|
|
10
10
|
border: 1px solid var(--rp-c-bg-soft);
|
|
11
11
|
background-color: var(--rp-c-bg-soft);
|
|
12
|
-
transition:
|
|
12
|
+
transition:
|
|
13
|
+
color 0.5s,
|
|
14
|
+
background-color 0.5s;
|
|
13
15
|
padding: 22px;
|
|
14
16
|
border-radius: 16px;
|
|
15
17
|
flex: 0 1 32%;
|