@modern-js/main-doc 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) 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/runtime/model/connect.mdx +1 -1
  6. package/en/apis/app/runtime/model/model_.mdx +1 -1
  7. package/en/apis/app/runtime/model/use-model.mdx +1 -1
  8. package/en/apis/app/runtime/web-server/hook.mdx +2 -2
  9. package/en/apis/app/runtime/web-server/middleware.mdx +33 -9
  10. package/en/components/enable-bff.mdx +4 -4
  11. package/en/components/init-rspack-app.mdx +7 -0
  12. package/en/configure/app/bff/enable-handle-web.mdx +24 -0
  13. package/en/configure/app/server/enable-framework-ext.mdx +1 -1
  14. package/en/guides/advanced-features/bff/_category_.json +1 -1
  15. package/en/guides/advanced-features/eslint.mdx +30 -32
  16. package/en/guides/advanced-features/low-level.mdx +1 -1
  17. package/en/guides/advanced-features/rspack-start.mdx +13 -17
  18. package/en/guides/advanced-features/web-server.mdx +87 -20
  19. package/en/guides/concept/builder.mdx +1 -1
  20. package/en/guides/topic-detail/framework-plugin/extend.mdx +20 -19
  21. package/en/guides/topic-detail/framework-plugin/hook-list.mdx +156 -155
  22. package/en/guides/topic-detail/framework-plugin/hook.mdx +58 -43
  23. package/en/guides/topic-detail/framework-plugin/implement.mdx +47 -49
  24. package/en/guides/topic-detail/framework-plugin/introduction.mdx +22 -23
  25. package/en/guides/topic-detail/framework-plugin/plugin-api.mdx +13 -13
  26. package/en/guides/topic-detail/framework-plugin/relationship.mdx +30 -30
  27. package/en/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  28. package/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +17 -17
  29. package/en/guides/topic-detail/micro-frontend/c02-development.mdx +76 -78
  30. package/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +57 -51
  31. package/en/guides/topic-detail/micro-frontend/c04-communicate.mdx +11 -11
  32. package/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +13 -13
  33. package/en/guides/topic-detail/model/auto-actions.mdx +18 -21
  34. package/en/guides/topic-detail/model/computed-state.mdx +27 -25
  35. package/en/guides/topic-detail/model/define-model.mdx +14 -14
  36. package/en/guides/topic-detail/model/faq.mdx +12 -13
  37. package/en/guides/topic-detail/model/manage-effects.mdx +43 -52
  38. package/en/guides/topic-detail/model/model-communicate.mdx +47 -45
  39. package/en/guides/topic-detail/model/performance.mdx +22 -23
  40. package/en/guides/topic-detail/model/quick-start.mdx +29 -28
  41. package/en/guides/topic-detail/model/redux-integration.mdx +7 -7
  42. package/en/guides/topic-detail/model/test-model.mdx +11 -11
  43. package/en/guides/topic-detail/model/typescript-best-practice.mdx +16 -15
  44. package/en/guides/topic-detail/model/use-model.mdx +40 -45
  45. package/en/guides/topic-detail/model/use-out-of-modernjs.mdx +16 -16
  46. package/en/guides/troubleshooting/cli.mdx +2 -2
  47. package/package.json +5 -5
  48. package/zh/apis/app/commands.mdx +2 -0
  49. package/zh/apis/app/runtime/model/connect.mdx +1 -1
  50. package/zh/apis/app/runtime/model/model_.mdx +1 -1
  51. package/zh/apis/app/runtime/model/use-model.mdx +1 -1
  52. package/zh/apis/app/runtime/web-server/hook.mdx +2 -4
  53. package/zh/apis/app/runtime/web-server/middleware.mdx +30 -10
  54. package/zh/apis/monorepo/commands/gen-release-note.mdx +3 -3
  55. package/zh/components/enable-bff.mdx +4 -4
  56. package/zh/components/init-rspack-app.mdx +7 -0
  57. package/zh/components/release-note.mdx +1 -1
  58. package/zh/configure/app/bff/enable-handle-web.mdx +24 -0
  59. package/zh/configure/app/server/enable-framework-ext.mdx +1 -1
  60. package/zh/guides/advanced-features/bff/_category_.json +1 -1
  61. package/zh/guides/advanced-features/rspack-start.mdx +13 -17
  62. package/zh/guides/advanced-features/web-server.mdx +81 -16
  63. package/zh/guides/concept/builder.mdx +1 -1
  64. package/zh/guides/topic-detail/changesets/github.mdx +2 -2
  65. package/zh/guides/topic-detail/changesets/release-note.mdx +1 -1
  66. package/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +2 -2
  67. package/zh/guides/topic-detail/generator/plugin/develop.mdx +1 -1
  68. package/zh/guides/topic-detail/model/faq.mdx +1 -1
  69. package/zh/guides/topic-detail/model/manage-effects.mdx +1 -1
  70. package/zh/guides/topic-detail/model/model-communicate.mdx +1 -1
  71. package/zh/guides/topic-detail/model/performance.mdx +1 -1
  72. package/zh/guides/topic-detail/model/quick-start.mdx +2 -2
  73. package/zh/guides/topic-detail/model/use-model.mdx +3 -3
@@ -1,24 +1,24 @@
1
1
  ---
2
- title: 扩展插件 Hook
2
+ title: Extending
3
3
  sidebar_position: 5
4
4
  ---
5
- # 扩展插件 Hook
5
+ # Extending Plugin Hooks
6
6
 
7
- 本小节介绍如何通过动态注册 [Hook 模型](/guides/topic-detail/framework-plugin/hook) 的方式来扩展插件 Hook。
7
+ This section describes how to extend plugin Hooks by dynamically registering [Hook models](/guides/topic-detail/framework-plugin/hook).
8
8
 
9
- ## 示例
9
+ ## Example
10
10
 
11
- 这里我们用一个简单的例子演示一下。假设我们要添加一些管理控制台输出信息的 Hook。
11
+ Here is a simple example to demonstrate how to extend plugin Hooks by adding Hooks that manage console output.
12
12
 
13
- 首先我们初始化一个空的项目文件,并添加基础依赖:
13
+ First, we initialize an empty project file and add basic dependencies:
14
14
 
15
15
  ```bash
16
16
  $ npx @modern-js/create modern-js-demo
17
17
  ```
18
18
 
19
- ### 创建 Hook
19
+ ### Creating Hooks
20
20
 
21
- 我们先创建一个 Hook 模型:
21
+ First, let's create a Hook model:
22
22
 
23
23
  ```ts title=config/plugin/myPlugin.ts
24
24
  import { createWaterfall } from '@modern-js/plugin';
@@ -26,7 +26,7 @@ import { createWaterfall } from '@modern-js/plugin';
26
26
  const message = createWaterfall<string[]>();
27
27
  ```
28
28
 
29
- 然后注册它:
29
+ then register:
30
30
 
31
31
  ```ts title=config/plugin/myPlugin.ts
32
32
  import type { CliPlugin } from '@modern-js/core';
@@ -40,7 +40,7 @@ export default (): CliPlugin => ({
40
40
  });
41
41
  ```
42
42
 
43
- 添加 Hook 类型:
43
+ add Hook types:
44
44
 
45
45
  ```ts title=config/plugin/myPlugin.ts
46
46
  declare module '@modern-js/core' {
@@ -50,9 +50,9 @@ declare module '@modern-js/core' {
50
50
  }
51
51
  ```
52
52
 
53
- ### 使用 Hook
53
+ ### Using Hooks
54
54
 
55
- 创建插件,通过 `commands` Hook 函数,添加命令处理逻辑:
55
+ Create a plugin and add command handling logic through the `commands` Hook function:
56
56
 
57
57
  ```ts title=config/plugin/myPlugin.ts
58
58
  import type { CliPlugin } from '@modern-js/core';
@@ -74,7 +74,7 @@ export default (): CliPlugin => ({
74
74
  });
75
75
  ```
76
76
 
77
- 最后 `config/plugin/myPlugin.ts` 的状态是:
77
+ now `config/plugin/myPlugin.ts` is:
78
78
 
79
79
  ```ts title=config/plugin/myPlugin.ts
80
80
  import { createWaterfall } from '@modern-js/plugin';
@@ -109,7 +109,7 @@ declare module '@modern-js/core' {
109
109
  }
110
110
  ```
111
111
 
112
- 然后在 `modern.config.ts` 中添加这个插件:
112
+ Then add this plugin in `modern.config.ts`:
113
113
 
114
114
  ```ts title="modern.config.ts"
115
115
  import { defineConfig } from '@modern-js/app-tools';
@@ -120,9 +120,9 @@ export default defineConfig({
120
120
  });
121
121
  ```
122
122
 
123
- 这时运行 `npx modern message` 就会执行相关逻辑,但由于没有收集到任何信息,所以控制台输出为空。
123
+ Now, run `npx modern message`, and the related logic will be executed, but no information is collected, so the console output is empty.
124
124
 
125
- 那这里我们添加一个:
125
+ add:
126
126
 
127
127
  ```ts title=config/plugin/otherPlugin.ts
128
128
  import type { CliPlugin } from '@modern-js/core';
@@ -140,7 +140,7 @@ export default (): CliPlugin => ({
140
140
  });
141
141
  ```
142
142
 
143
- 将它添加到配置中:
143
+ add to config:
144
144
 
145
145
  ```ts title="modern.config.ts"
146
146
  import { defineConfig } from '@modern-js/app-tools';
@@ -152,7 +152,7 @@ export default defineConfig({
152
152
  });
153
153
  ```
154
154
 
155
- 这时运行 `npx modern message` 就可以在控制台看到信息了:
155
+ run `npx modern message`, then we can get follow in console:
156
156
 
157
157
  ```bash
158
158
  $ modern message
@@ -160,4 +160,5 @@ $ modern message
160
160
  [foo] line 1
161
161
  ```
162
162
 
163
- 以上面这种方式就可以扩展出拥有各种能力的插件 Hook。
163
+ By using the above approach, you can extend plugin Hooks with various capabilities.
164
+