@modern-js/main-doc 2.6.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +2 -2
  4. package/en/apis/app/commands.mdx +2 -0
  5. package/en/apis/app/hooks/config/upload.mdx +10 -0
  6. package/en/apis/app/runtime/model/connect.mdx +1 -1
  7. package/en/apis/app/runtime/model/model_.mdx +1 -1
  8. package/en/apis/app/runtime/model/use-model.mdx +1 -1
  9. package/en/apis/app/runtime/web-server/hook.mdx +2 -2
  10. package/en/apis/app/runtime/web-server/middleware.mdx +33 -9
  11. package/en/components/enable-bff.mdx +4 -4
  12. package/en/components/init-rspack-app.mdx +7 -0
  13. package/en/configure/app/bff/enable-handle-web.mdx +24 -0
  14. package/en/configure/app/server/enable-framework-ext.mdx +1 -1
  15. package/en/configure/app/server/ssr.mdx +18 -0
  16. package/en/guides/advanced-features/bff/_category_.json +1 -1
  17. package/en/guides/advanced-features/eslint.mdx +30 -32
  18. package/en/guides/advanced-features/low-level.mdx +1 -1
  19. package/en/guides/advanced-features/rspack-start.mdx +13 -17
  20. package/en/guides/advanced-features/ssr.mdx +210 -5
  21. package/en/guides/advanced-features/web-server.mdx +87 -20
  22. package/en/guides/{css/tailwindcss.mdx → basic-features/css.mdx} +60 -3
  23. package/en/guides/basic-features/env-vars.mdx +4 -0
  24. package/en/guides/concept/builder.mdx +1 -1
  25. package/en/guides/topic-detail/framework-plugin/extend.mdx +20 -19
  26. package/en/guides/topic-detail/framework-plugin/hook-list.mdx +156 -155
  27. package/en/guides/topic-detail/framework-plugin/hook.mdx +58 -43
  28. package/en/guides/topic-detail/framework-plugin/implement.mdx +47 -49
  29. package/en/guides/topic-detail/framework-plugin/introduction.mdx +22 -23
  30. package/en/guides/topic-detail/framework-plugin/plugin-api.mdx +13 -13
  31. package/en/guides/topic-detail/framework-plugin/relationship.mdx +30 -30
  32. package/en/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  33. package/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +17 -17
  34. package/en/guides/topic-detail/micro-frontend/c02-development.mdx +76 -78
  35. package/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +57 -51
  36. package/en/guides/topic-detail/micro-frontend/c04-communicate.mdx +11 -11
  37. package/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +13 -13
  38. package/en/guides/topic-detail/model/auto-actions.mdx +18 -21
  39. package/en/guides/topic-detail/model/computed-state.mdx +27 -25
  40. package/en/guides/topic-detail/model/define-model.mdx +14 -14
  41. package/en/guides/topic-detail/model/faq.mdx +12 -13
  42. package/en/guides/topic-detail/model/manage-effects.mdx +43 -52
  43. package/en/guides/topic-detail/model/model-communicate.mdx +47 -45
  44. package/en/guides/topic-detail/model/performance.mdx +22 -23
  45. package/en/guides/topic-detail/model/quick-start.mdx +29 -28
  46. package/en/guides/topic-detail/model/redux-integration.mdx +7 -7
  47. package/en/guides/topic-detail/model/test-model.mdx +11 -11
  48. package/en/guides/topic-detail/model/typescript-best-practice.mdx +16 -15
  49. package/en/guides/topic-detail/model/use-model.mdx +40 -45
  50. package/en/guides/topic-detail/model/use-out-of-modernjs.mdx +16 -16
  51. package/en/guides/troubleshooting/cli.mdx +2 -2
  52. package/en/tutorials/first-app/c03-css.mdx +1 -1
  53. package/package.json +5 -5
  54. package/zh/apis/app/commands.mdx +2 -0
  55. package/zh/apis/app/hooks/config/upload.mdx +12 -2
  56. package/zh/apis/app/runtime/model/connect.mdx +1 -1
  57. package/zh/apis/app/runtime/model/model_.mdx +1 -1
  58. package/zh/apis/app/runtime/model/use-model.mdx +1 -1
  59. package/zh/apis/app/runtime/web-server/hook.mdx +2 -4
  60. package/zh/apis/app/runtime/web-server/middleware.mdx +30 -10
  61. package/zh/apis/monorepo/commands/gen-release-note.mdx +3 -3
  62. package/zh/components/enable-bff.mdx +4 -4
  63. package/zh/components/init-rspack-app.mdx +7 -0
  64. package/zh/components/release-note.mdx +1 -1
  65. package/zh/configure/app/bff/enable-handle-web.mdx +24 -0
  66. package/zh/configure/app/server/enable-framework-ext.mdx +1 -1
  67. package/zh/configure/app/server/ssr.mdx +19 -1
  68. package/zh/guides/advanced-features/bff/_category_.json +1 -1
  69. package/zh/guides/advanced-features/rspack-start.mdx +13 -17
  70. package/zh/guides/advanced-features/ssr.mdx +210 -4
  71. package/zh/guides/advanced-features/web-server.mdx +81 -16
  72. package/zh/guides/{css/tailwindcss.mdx → basic-features/css.mdx} +60 -3
  73. package/zh/guides/basic-features/env-vars.mdx +4 -0
  74. package/zh/guides/concept/builder.mdx +1 -1
  75. package/zh/guides/topic-detail/changesets/github.mdx +2 -2
  76. package/zh/guides/topic-detail/changesets/release-note.mdx +1 -1
  77. package/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +2 -2
  78. package/zh/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  79. package/zh/guides/topic-detail/model/faq.mdx +1 -1
  80. package/zh/guides/topic-detail/model/manage-effects.mdx +1 -1
  81. package/zh/guides/topic-detail/model/model-communicate.mdx +1 -1
  82. package/zh/guides/topic-detail/model/performance.mdx +1 -1
  83. package/zh/guides/topic-detail/model/quick-start.mdx +2 -2
  84. package/zh/guides/topic-detail/model/use-model.mdx +3 -3
  85. package/zh/tutorials/first-app/c03-css.mdx +1 -1
  86. package/en/guides/css/_category_.json +0 -5
  87. package/en/guides/css/css-in-js.mdx +0 -40
  88. package/en/guides/css/css-modules.mdx +0 -87
  89. package/en/guides/css/less-sass.mdx +0 -17
  90. package/en/guides/css/postcss.mdx +0 -79
  91. package/zh/guides/css/_category_.json +0 -5
  92. package/zh/guides/css/css-in-js.mdx +0 -40
  93. package/zh/guides/css/css-modules.mdx +0 -87
  94. package/zh/guides/css/less-sass.mdx +0 -17
  95. package/zh/guides/css/postcss.mdx +0 -80
@@ -1,20 +1,20 @@
1
1
  ---
2
- title: Hook 列表
2
+ title: Hook List
3
3
  sidebar_position: 8
4
4
  ---
5
- # Hook 列表
5
+ # Hook List
6
6
 
7
- Modern.js 中暴露了三类插件:CLIRuntimeServer。下面列举下各类中的 Hook:
7
+ Modern.js exposes three types of plugins: CLI, Runtime, and Server.
8
8
 
9
9
  ## CLI
10
10
 
11
11
  ### `config`
12
12
 
13
- - 功能:收集配置
14
- - 执行阶段:解析完 `modern.config.ts` 中的配置之后
15
- - Hook 模型:ParallelWorkflow
16
- - 类型:`ParallelWorkflow<void, unknown>`
17
- - 使用示例:
13
+ - Functionality: Collect configuration
14
+ - Execution phase: After parsing the configuration in `modern.config.ts`
15
+ - Hook model: ParallelWorkflow
16
+ - Type: `ParallelWorkflow<void, unknown>`
17
+ - Example usage:
18
18
 
19
19
  ```ts
20
20
  import type { CliPlugin } from '@modern-js/core';
@@ -32,15 +32,15 @@ export default (): CliPlugin => ({
32
32
  });
33
33
  ```
34
34
 
35
- 这里返回的配置信息,会被收集和统一处理合并。
35
+ The collected configuration information will be collected and processed uniformly.
36
36
 
37
37
  ### `validateSchema`
38
38
 
39
- - 功能:收集各个插件中配置的用来校验用户配置的 [JSON Schema](https://json-schema.org/)
40
- - 执行阶段:`config` Hook 运行完之后。
41
- - Hook 模型:ParallelWorkflow
42
- - 类型:`ParallelWorkflow<void, unknown>`
43
- - 使用示例:
39
+ - Functionality: Collect the JSON schema used to validate user configurations in various plugins.
40
+ - Execution phase: After the `config` Hook has run.
41
+ - Hook model: ParallelWorkflow
42
+ - Type: `ParallelWorkflow<void, unknown>`
43
+ - Example usage:
44
44
 
45
45
  ```ts
46
46
  import type { CliPlugin } from '@modern-js/core';
@@ -62,9 +62,9 @@ export default (): CliPlugin => ({
62
62
  });
63
63
  ```
64
64
 
65
- 这里返回的 JSON Schema 会用来校验 `modern.config.js` 中的配置信息。
65
+ The returned JSON Schema here is used to validate the configuration information in `modern.config.js`.
66
66
 
67
- 比如这里返回:
67
+ For example, the following JSON Schema is returned:
68
68
 
69
69
  ```json
70
70
  {
@@ -75,7 +75,7 @@ export default (): CliPlugin => ({
75
75
  }
76
76
  ```
77
77
 
78
- 就可以在 `modern.config.ts` 中这样配置:
78
+ You can configure it in `modern.config.ts` like this:
79
79
 
80
80
  ```ts title="modern.config.ts"
81
81
  export default defineConfig({
@@ -83,7 +83,7 @@ export default defineConfig({
83
83
  });
84
84
  ```
85
85
 
86
- 如果是别的类型,校验就不通过会报错,比如这样:
86
+ If it is another type, validation will fail and an error will be reported. For example:
87
87
 
88
88
  ```ts title="modern.config.ts"
89
89
  export default defineConfig({
@@ -91,7 +91,7 @@ export default defineConfig({
91
91
  });
92
92
  ```
93
93
 
94
- 就会报错:
94
+ then throw error:
95
95
 
96
96
  ```sh
97
97
  $ modern dev
@@ -102,11 +102,11 @@ $ modern dev
102
102
 
103
103
  ### `prepare`
104
104
 
105
- - 功能:运行主流程的前置准备流程
106
- - 执行阶段:校验完配置之后
107
- - Hook 模型:AsyncWorkflow
108
- - 类型:`AsyncWorkflow<void, void>`
109
- - 使用示例:
105
+ - Functionality: Preparatory process for running the main process.
106
+ - Execution phase: After configuration validation.
107
+ - Hook model: AsyncWorkflow
108
+ - Type: `AsyncWorkflow<void, void>`
109
+ - Example usage:
110
110
 
111
111
  ```ts
112
112
  import type { CliPlugin } from '@modern-js/core';
@@ -146,11 +146,11 @@ export default (): CliPlugin => ({
146
146
 
147
147
  ### `commands`
148
148
 
149
- - 功能:为 command 添加新的命令
150
- - 执行阶段:`prepare` Hook 运行完之后
151
- - Hook 模型:AsyncWorkflow
152
- - 类型:`AsyncWorkflow<{ program: Command; }, void>`
153
- - 使用示例:
149
+ - Functionality: Add new commands for the command.
150
+ - Execution phase: After the `prepare` Hook has run.
151
+ - Hook model: AsyncWorkflow
152
+ - Type: `AsyncWorkflow<{ program: Command; }, void>`
153
+ - Example usage:
154
154
 
155
155
  ```ts
156
156
  import type { CliPlugin } from '@modern-js/core';
@@ -169,7 +169,7 @@ export default (): CliPlugin => ({
169
169
  });
170
170
  ```
171
171
 
172
- 将上面这个插件添加到 `modern.config.ts` 中:
172
+ Move the plugin to `modern.config.ts`:
173
173
 
174
174
  ```ts title="modern.config.ts"
175
175
  import myPlugin from './config/plugin/myPlugin';
@@ -179,7 +179,7 @@ export default defineConfig({
179
179
  });
180
180
  ```
181
181
 
182
- 运行 `modern foo` 就可以看到控制台输出:
182
+ run `modern foo`:
183
183
 
184
184
  ```sh
185
185
  $ modern foo
@@ -188,11 +188,11 @@ foo
188
188
 
189
189
  ### `beforeExit`
190
190
 
191
- - 功能:在退出进程前,重置一些文件状态
192
- - 执行阶段:进程退出之前
193
- - Hook 模型:AsyncWorkflow
194
- - 类型:`AsyncWorkflow<void, void>`
195
- - 使用示例:
191
+ - Functionality: Reset some file states before exiting the process.
192
+ - Execution phase: Before the process exits.
193
+ - Hook model: AsyncWorkflow
194
+ - Type: `AsyncWorkflow<void, void>`
195
+ - Example usage:
196
196
 
197
197
  ```ts
198
198
  import type { CliPlugin } from '@modern-js/core';
@@ -210,11 +210,11 @@ export default (): CliPlugin => ({
210
210
 
211
211
  ### `beforeDev`
212
212
 
213
- - 功能:运行 dev 主流程的之前的任务
214
- - 执行阶段:`dev` 命令运行时,项目开始启动前执行
215
- - Hook 模型:AsyncWorkflow
216
- - 类型:`AsyncWorkflow<void, unknown>`
217
- - 使用示例:
213
+ - Functionality: Tasks before running the main dev process.
214
+ - Execution phase: Before the project starts when the `dev` command is run.
215
+ - Hook model: AsyncWorkflow
216
+ - Type: `AsyncWorkflow<void, unknown>`
217
+ - Example usage:
218
218
 
219
219
  ```ts
220
220
  import type { CliPlugin } from '@modern-js/core';
@@ -232,11 +232,11 @@ export default (): CliPlugin => ({
232
232
 
233
233
  ### `afterDev`
234
234
 
235
- - 功能:运行 dev 主流程的之后的任务
236
- - 执行阶段:`dev` 命令运行时,项目启动完成之后执行
237
- - Hook 模型:AsyncWorkflow
238
- - 类型:`AsyncWorkflow<void, unknown>`
239
- - 使用示例:
235
+ - Function: Tasks to be executed after the main process of `dev` command
236
+ - Execution Stage: Executed after the project is started when running the `dev` command
237
+ - Hook Model: AsyncWorkflow
238
+ - Type: `AsyncWorkflow<void, unknown>`
239
+ - Usage Example:
240
240
 
241
241
  ```ts
242
242
  import type { CliPlugin } from '@modern-js/core';
@@ -254,11 +254,11 @@ export default (): CliPlugin => ({
254
254
 
255
255
  ### `beforeCreateCompiler`
256
256
 
257
- - 功能:在中间件函数中可以拿到创建 Webpack Compiler Webpack 配置
258
- - 执行阶段:创建 Webpack Compiler 之前执行
259
- - Hook 模型:AsyncWorkflow
260
- - 类型:`AsyncWorkflow<{ webpackConfigs: Configuration[];}, unknown>`
261
- - 使用示例:
257
+ - Function: Provides access to the Webpack configuration used to create the Webpack Compiler within middleware functions.
258
+ - Execution Stage: Executed before creating the Webpack Compiler.
259
+ - Hook Model: AsyncWorkflow.
260
+ - Type: `AsyncWorkflow<{ webpackConfigs: Configuration[];}, unknown>`.
261
+ - Usage Example:
262
262
 
263
263
  ```ts
264
264
  import type { CliPlugin } from '@modern-js/core';
@@ -276,11 +276,11 @@ export default (): CliPlugin => ({
276
276
 
277
277
  ### `afterCreateCompiler`
278
278
 
279
- - 功能:在中间件函数中可以拿到创建的 Webpack Compiler
280
- - 执行阶段:创建 Webpack Compiler 之后执行
281
- - Hook 模型:AsyncWorkflow
282
- - 类型:`AsyncWorkflow<{ compiler: Compiler | MultiCompiler | undefined; }, unknown>`
283
- - 使用示例:
279
+ - Function: Provides access to the created Webpack Compiler within middleware functions.
280
+ - Execution Stage: Executed after creating the Webpack Compiler.
281
+ - Hook Model: AsyncWorkflow.
282
+ - Type: `AsyncWorkflow<{ compiler: Compiler | MultiCompiler | undefined; }, unknown>`.
283
+ - Usage Example:
284
284
 
285
285
  ```ts
286
286
  import type { CliPlugin } from '@modern-js/core';
@@ -298,11 +298,11 @@ export default (): CliPlugin => ({
298
298
 
299
299
  ### `beforePrintInstructions`
300
300
 
301
- - 功能:在中间件函数中可以拿到即将打印的日志信息,并对其进行修改
302
- - 执行阶段:打印日志信息之前执行
303
- - Hook 模型:AsyncWaterfall
304
- - 类型:`AsyncWaterfall<{ instructions: string }>`
305
- - 使用示例:
301
+ - Function: Provides access to the log information that will be printed within middleware functions and allows modification of the log information.
302
+ - Execution Stage: Executed before printing the log information.
303
+ - Hook Model: AsyncWaterfall.
304
+ - Type: `AsyncWaterfall<{ instructions: string }>`
305
+ - Usage Example:
306
306
 
307
307
  ```ts
308
308
  import type { CliPlugin } from '@modern-js/core';
@@ -323,11 +323,11 @@ export default (): CliPlugin => ({
323
323
 
324
324
  ### `beforeBuild`
325
325
 
326
- - 功能:运行 build 主流程的之前的任务,可以拿到构建的 Webpack 配置
327
- - 执行阶段:`build` 命令运行时,项目构建启动前执行
328
- - Hook 模型:AsyncWorkflow
329
- - 类型:`AsyncWorkflow<{ webpackConfigs: Configuration[]; }>`
330
- - 使用示例:
326
+ - Function: Tasks to be executed before the main process of the `build` command, provides access to the Webpack configuration used for building.
327
+ - Execution Stage: Executed before starting the project build when running the `build` command.
328
+ - Hook Model: AsyncWorkflow.
329
+ - Type: `AsyncWorkflow<{ webpackConfigs: Configuration[]; }>`.
330
+ - Usage Example:
331
331
 
332
332
  ```ts
333
333
  import type { CliPlugin } from '@modern-js/core';
@@ -345,11 +345,11 @@ export default (): CliPlugin => ({
345
345
 
346
346
  ### `afterBuild`
347
347
 
348
- - 功能:运行 build 主流程的之后的任务
349
- - 执行阶段:`build` 命令运行时,项目构建完成之后执行
350
- - Hook 模型:AsyncWorkflow
351
- - 类型:`AsyncWorkflow<void, unknown>`
352
- - 使用示例:
348
+ - Function: Tasks to be executed after the main process of the `build` command.
349
+ - Execution Stage: Executed after the project build is completed when running the `build` command.
350
+ - Hook Model: AsyncWorkflow.
351
+ - Type: `AsyncWorkflow<void, unknown>`.
352
+ - Usage Example:
353
353
 
354
354
  ```ts
355
355
  import type { CliPlugin } from '@modern-js/core';
@@ -367,11 +367,11 @@ export default (): CliPlugin => ({
367
367
 
368
368
  ### `modifyEntryImports`
369
369
 
370
- - 功能:用于修改、添加生成入口文件中的 `import` 语句
371
- - 执行阶段:生成入口文件之前,[`prepare`](#prepare) 阶段触发
372
- - Hook 模型:AsyncWaterfall
373
- - 类型:`AsyncWaterfall<{ imports: ImportStatement[]; entrypoint: Entrypoint; }>`
374
- - 使用示例:
370
+ - Function: Used for modifying or adding `import` statements in the generated entry files.
371
+ - Execution Stage: Executed before generating the entry files, triggered during the [`prepare`](#prepare) stage.
372
+ - Hook Model: AsyncWaterfall.
373
+ - Type: `AsyncWaterfall<{ imports: ImportStatement[]; entrypoint: Entrypoint; }>`
374
+ - Usage Example:
375
375
 
376
376
  ```ts
377
377
  import type { CliPlugin } from '@modern-js/core';
@@ -380,7 +380,7 @@ export default (): CliPlugin => ({
380
380
  setup(api) {
381
381
  return {
382
382
  modifyEntryImports({ entrypoint, imports }) {
383
- // 添加 `import React from 'React'`
383
+ // add `import React from 'React'`
384
384
  imports.push({
385
385
  value: 'react',
386
386
  specifiers: [
@@ -426,11 +426,11 @@ export default (): CliPlugin => ({
426
426
 
427
427
  ### `modifyEntryRuntimePlugins`
428
428
 
429
- - 功能:用于添加、修改生成入口文件中的 [Runtime 插件](#Runtime)
430
- - 执行阶段:生成入口文件之前,[`prepare`](#prepare) 阶段触发
431
- - Hook 模型:AsyncWaterfall
432
- - 类型:`AsyncWaterfall<{ entrypoint: Entrypoint; plugins: RuntimePlugin[]; }>`
433
- - 使用示例:
429
+ - Function: Used for adding or modifying [Runtime plugins](#Runtime) in the generated entry files.
430
+ - Execution Stage: Executed before generating the entry files, triggered during the [`prepare`](#prepare) stage.
431
+ - Hook Model: AsyncWaterfall.
432
+ - Type: `AsyncWaterfall<{ entrypoint: Entrypoint; plugins: RuntimePlugin[]; }>`
433
+ - Usage Example:
434
434
 
435
435
  ```ts
436
436
  import type { CliPlugin } from '@modern-js/core';
@@ -461,11 +461,11 @@ export default (): CliPlugin => ({
461
461
 
462
462
  ### `modifyEntryRenderFunction`
463
463
 
464
- - 功能:用于修改生成入口文件中 `render` 函数
465
- - 执行阶段:生成入口文件之前,[`prepare`](#prepare) 阶段触发
466
- - Hook 模型:AsyncWaterfall
467
- - 类型:`AsyncWaterfall<{ entrypoint: Entrypoint; code: string; }>`
468
- - 使用示例:
464
+ - Function: Used for modifying the `render` function in the generated entry files.
465
+ - Execution Stage: Executed before generating the entry files, triggered during the [`prepare`](#prepare) stage.
466
+ - Hook Model: AsyncWaterfall.
467
+ - Type: `AsyncWaterfall<{ entrypoint: Entrypoint; code: string; }>`
468
+ - Usage Example:
469
469
 
470
470
  ```ts
471
471
  import type { CliPlugin } from '@modern-js/core';
@@ -487,11 +487,11 @@ export default (): CliPlugin => ({
487
487
 
488
488
  ### `modifyFileSystemRoutes`
489
489
 
490
- - 功能:用于修改生成前端页面路由文件中的内容,内容都是需要可序列化的
491
- - 执行阶段:生成前端路由文件之前,[`prepare`](#prepare) 阶段触发
492
- - Hook 模型:AsyncWaterfall
493
- - 类型:`AsyncWaterfall<{ entrypoint: Entrypoint; routes: Route[]; }>`
494
- - 使用示例:
490
+ - Function: Used for modifying the content of the generated front-end page routing files, which must be serializable.
491
+ - Execution Stage: Executed before generating the front-end routing files, triggered during the [`prepare`](#prepare) stage.
492
+ - Hook Model: AsyncWaterfall.
493
+ - Type: `AsyncWaterfall<{ entrypoint: Entrypoint; routes: Route[]; }>`
494
+ - Usage Example:
495
495
 
496
496
  ```tsx
497
497
  import type { CliPlugin } from '@modern-js/core';
@@ -517,15 +517,15 @@ export default (): CliPlugin => ({
517
517
  });
518
518
  ```
519
519
 
520
- 这样就为前端新增了一个页面路由。
520
+ This adds a new page route for the front-end.
521
521
 
522
522
  ### `modifyServerRoutes`
523
523
 
524
- - 功能:用于修改生成服务器路由中的内容
525
- - 执行阶段:生成 Server 路由文件之前,[`prepare`](#prepare) 阶段触发
526
- - Hook 模型:AsyncWaterfall
527
- - 类型:`AsyncWaterfall<{ routes: ServerRoute[]; }>`
528
- - 使用示例:
524
+ - Function: Used for modifying the content of the generated server routes.
525
+ - Execution Stage: Executed before generating the server routing files, triggered during the [`prepare`](#prepare) stage.
526
+ - Hook Model: AsyncWaterfall.
527
+ - Type: `AsyncWaterfall<{ routes: ServerRoute[]; }>`
528
+ - Usage Example:
529
529
 
530
530
  ```ts
531
531
  import type { CliPlugin } from '@modern-js/core';
@@ -554,11 +554,11 @@ export default (): CliPlugin => ({
554
554
 
555
555
  ### `modifyAsyncEntry`
556
556
 
557
- - 功能:用于修改包裹入口文件的异步模块,参见 [source.enableAsyncEntry](/configure/app/source/enable-async-entry)
558
- - 执行阶段:生成入口文件之前,[`prepare`](#prepare) 阶段触发
559
- - Hook 模型:AsyncWaterfall
560
- - 类型:`AsyncWaterfall<{ entrypoint: Entrypoint; code: string; }>`
561
- - 使用示例:
557
+ - Function: Used for modifying the asynchronous module that wraps the entry file, see [source.enableAsyncEntry](/configure/app/source/enable-async-entry).
558
+ - Execution Stage: Executed before generating the entry files, triggered during the [`prepare`](#prepare) stage.
559
+ - Hook Model: AsyncWaterfall.
560
+ - Type: `AsyncWaterfall<{ entrypoint: Entrypoint; code: string; }>`
561
+ - Usage Example:
562
562
 
563
563
  ```ts
564
564
  import type { CliPlugin } from '@modern-js/core';
@@ -580,11 +580,11 @@ export default (): CliPlugin => ({
580
580
 
581
581
  ### `htmlPartials`
582
582
 
583
- - 功能:用于定制生成的 HTML 页面模版
584
- - 执行阶段:[`prepare`](#prepare) 阶段触发
585
- - Hook 模型:AsyncWaterfall
586
- - 类型:`AsyncWaterfall<{ entrypoint: Entrypoint; partials: HtmlPartials; }>`
587
- - 使用示例:
583
+ - Function: Used for customizing the generated HTML page template.
584
+ - Execution Stage: Triggered during the [`prepare`](#prepare) stage.
585
+ - Hook Model: AsyncWaterfall.
586
+ - Type: `AsyncWaterfall<{ entrypoint: Entrypoint; partials: HtmlPartials; }>`
587
+ - Usage Example:
588
588
 
589
589
  ```ts
590
590
  import type { CliPlugin } from '@modern-js/core';
@@ -604,24 +604,24 @@ export default (): CliPlugin => ({
604
604
  });
605
605
  ```
606
606
 
607
- 这样就为 HTML 模版中新增了一个 Script 标签。
607
+ This adds a new Script tag to the HTML template.
608
608
 
609
609
  ## Server
610
610
 
611
611
  :::note
612
- 目前 Server 插件还未完全开放,API 不保证稳定,使用需谨慎。
613
-
612
+ The Server plugin is currently not fully opened, and the API is not guaranteed to be stable. Use with caution.
614
613
  :::
615
614
 
616
- 应用工程中的 Server 部分也支持了插件。其中的 Hook 将会提供一些特定阶段调用和特殊功能的 Hook。
615
+ Plugins are also supported in the Server section of the application project. The hook will provide hooks for specific stage calls and special functionality.
617
616
 
618
617
  ### `create`
619
618
 
620
- - 功能:在中间件函数中会拿到 Server 初始化用到的指标测量工具配置 `measureOptions` 和日志工具配置 `loggerOptions`,并返回自定义的指标测量工具 `measure` 和日志工具配置 `logger`
621
- - 执行阶段:Server 初始化
622
- - Hook 模型:AsyncPipeline
623
- - 类型:`AsyncPipeline<ServerInitInput, InitExtension>`
624
- - 使用示例:
619
+ - Function: In the middleware function, you will get the measurement tool configuration `measureOptions` and log tool configuration `loggerOptions` used for Server initialization, and return a custom measurement tool `measure` and log tool configuration `logger`.
620
+ - Execution Stage: Server initialization.
621
+ - Hook Model: AsyncPipeline.
622
+ - Type: `AsyncPipeline<ServerInitInput, InitExtension>`
623
+ - Usage Example:
624
+
625
625
 
626
626
  ```ts
627
627
  import type { ServerPlugin } from '@modern-js/server-core';
@@ -639,11 +639,11 @@ export default (): ServerPlugin => ({
639
639
 
640
640
  ### `prepareWebServer`
641
641
 
642
- - 功能:设置 Web 路由的处理函数,在中间件函数中可以拿到 Web Server 的前置中间件
643
- - 执行阶段:在请求到达的时候
644
- - Hook 模型:AsyncPipeline
645
- - 类型:`AsyncPipeline<WebServerStartInput, Adapter>`
646
- - 使用示例:
642
+ - Function: Sets the handling function for the Web route. In the middleware function, you can get the front-end middleware of the Web server.
643
+ - Execution Stage: When the request arrives.
644
+ - Hook Model: AsyncPipeline.
645
+ - Type: `AsyncPipeline<WebServerStartInput, Adapter>`
646
+ - Usage Example:
647
647
 
648
648
  ```ts
649
649
  import type { ServerPlugin } from '@modern-js/server-core';
@@ -665,11 +665,11 @@ export default (): ServerPlugin => ({
665
665
 
666
666
  ### `prepareApiServer`
667
667
 
668
- - 功能:设置 API 路由的处理函数,在中间件函数中可以拿到 API Server 的前置中间件
669
- - 执行阶段:请求到达并且 match bff basename 之后执行
670
- - Hook 模型:AsyncPipeline
671
- - 类型:`AsyncPipeline<APIServerStartInput, Adapter>`
672
- - 使用示例:
668
+ - Function: Sets the handling function for the API route. In the middleware function, you can get the front-end middleware of the API server.
669
+ - Execution Stage: When the request arrives and matches the BFF basename.
670
+ - Hook Model: AsyncPipeline.
671
+ - Type: `AsyncPipeline<APIServerStartInput, Adapter>`
672
+ - Usage Example:
673
673
 
674
674
  ```ts
675
675
  import type { ServerPlugin } from '@modern-js/server-core';
@@ -692,19 +692,18 @@ export default (): ServerPlugin => ({
692
692
  ## Runtime
693
693
 
694
694
  :::note
695
- 目前 Runtime 插件还未完全开放,API 不保证稳定,使用需谨慎。
696
-
695
+ The Runtime plugin is currently not fully opened, and the API is not guaranteed to be stable. Use with caution.
697
696
  :::
698
697
 
699
- Runtime 插件主要用于开发者修改需要渲染的组件与 Element 和定制服务器端、客户端的渲染过程。
698
+ The Runtime plugin is mainly used for developers to modify the components and elements that need to be rendered, and customize the rendering process on the server and client side.
700
699
 
701
700
  ### `init`
702
701
 
703
- - 功能:执行 `App.init`
704
- - 执行阶段:渲染(SSR/CSR
705
- - Hook 模型:AsyncPipeline
706
- - 类型:`AsyncPipeline<{ context: RuntimeContext; }, unknown>`
707
- - 使用示例:
702
+ - Function: Executes `App.init`.
703
+ - Execution Stage: Rendering (SSR/CSR).
704
+ - Hook Model: AsyncPipeline.
705
+ - Type: `AsyncPipeline<{ context: RuntimeContext; }, unknown>`
706
+ - Usage Example:
708
707
 
709
708
  ```ts
710
709
  import type { Plugin } from '@modern-js/runtime';
@@ -723,11 +722,11 @@ export default (): Plugin => ({
723
722
 
724
723
  ### `hoc`
725
724
 
726
- - 功能:修改需要渲染的组件
727
- - 执行阶段:渲染(SSR/CSR
728
- - Hook 模型:Pipeline
729
- - 类型:`Pipeline<{ App: React.ComponentType<any>; }, React.ComponentType<any>>`
730
- - 使用示例:
725
+ - Function: Modifies the components that need to be rendered.
726
+ - Execution Stage: Rendering (SSR/CSR).
727
+ - Hook Model: Pipeline.
728
+ - Type: `Pipeline<{ App: React.ComponentType<any>; }, React.ComponentType<any>>`
729
+ - Usage Example:
731
730
 
732
731
  ```ts
733
732
  import { createContext } from 'react';
@@ -755,11 +754,11 @@ export default (): Plugin => ({
755
754
 
756
755
  ### `provide`
757
756
 
758
- - 功能:修改需要渲染的 Element
759
- - 执行阶段:渲染(SSR/CSR
760
- - Hook 模型:Pipeline
761
- - 类型:`Pipeline<{ element: JSX.Element; props: AppProps; context: RuntimeContext }, JSX.Element>`
762
- - 使用示例:
757
+ - Function: Modifies the Elements that need to be rendered.
758
+ - Execution Stage: Rendering (SSR/CSR).
759
+ - Hook Model: Pipeline.
760
+ - Type: `Pipeline<{ element: JSX.Element; props: AppProps; context: RuntimeContext }, JSX.Element>`
761
+ - Usage Example:
763
762
 
764
763
  ```ts
765
764
  import { createContext } from 'react';
@@ -778,11 +777,12 @@ export default (): Plugin => ({
778
777
 
779
778
  ### `client`
780
779
 
781
- - 功能:定制客户端渲染流程
782
- - 执行阶段:在浏览器客户端渲染
783
- - Hook 模型:AsyncPipeline
784
- - 类型:`AsyncPipeline<{ App: React.ComponentType<any>; context?: RuntimeContext; rootElement: HTMLElement; }, void>`
785
- - 使用示例:
780
+ - Function: Customizes the client-side rendering process.
781
+ - Execution Stage: Client-side rendering in the browser.
782
+ - Hook Model: AsyncPipeline.
783
+ - Type: `AsyncPipeline<{ App: React.ComponentType<any>; context?: RuntimeContext; rootElement: HTMLElement; }, void>`
784
+ - Usage Example:
785
+
786
786
 
787
787
  ```ts
788
788
  import ReactDOM from 'react-dom';
@@ -804,11 +804,12 @@ export default (): Plugin => ({
804
804
 
805
805
  ### `server`
806
806
 
807
- - 功能:定制服务器端渲染流程
808
- - 执行阶段:SSR
809
- - Hook 模型:AsyncPipeline
810
- - 类型:`AsyncPipeline<{ App: React.ComponentType<any>; context?: RuntimeContext; }, string>`
811
- - 使用示例:
807
+ - Function: Customize the server-side rendering process.
808
+ - Execution Phase: SSR
809
+ - Hook Model: AsyncPipeline
810
+ - Type: `AsyncPipeline<{ App: React.ComponentType<any>; context?: RuntimeContext; }, string>`
811
+ - Usage Example:
812
+
812
813
 
813
814
  ```ts
814
815
  import ReactDomServer from 'react-dom/server';