@modern-js/main-doc 2.65.5 → 2.66.1-alpha.0

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.
Files changed (131) hide show
  1. package/docs/en/apis/app/hooks/src/app.mdx +20 -34
  2. package/docs/en/apis/app/hooks/src/modern.runtime.mdx +9 -0
  3. package/docs/en/apis/app/runtime/app/define-config.mdx +6 -0
  4. package/docs/en/community/blog/v2-release-note.mdx +1 -1
  5. package/docs/en/components/enable-micro-frontend.mdx +20 -3
  6. package/docs/en/components/micro-runtime-config.mdx +12 -13
  7. package/docs/en/components/reduck-notify.mdx +27 -0
  8. package/docs/en/configure/app/plugins.mdx +2 -2
  9. package/docs/en/configure/app/runtime/0-intro.mdx +63 -91
  10. package/docs/en/configure/app/tools/esbuild.mdx +1 -1
  11. package/docs/en/configure/app/tools/swc.mdx +1 -1
  12. package/docs/en/configure/app/usage.mdx +93 -69
  13. package/docs/en/guides/basic-features/render/_meta.json +1 -1
  14. package/docs/en/guides/basic-features/render/before-render.mdx +115 -0
  15. package/docs/en/guides/basic-features/routes.mdx +0 -95
  16. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +3 -5
  17. package/docs/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +4 -2
  18. package/docs/en/guides/topic-detail/model/auto-actions.mdx +0 -4
  19. package/docs/en/guides/topic-detail/model/computed-state.mdx +0 -5
  20. package/docs/en/guides/topic-detail/model/define-model.mdx +0 -4
  21. package/docs/en/guides/topic-detail/model/faq.mdx +0 -5
  22. package/docs/en/guides/topic-detail/model/manage-effects.mdx +0 -5
  23. package/docs/en/guides/topic-detail/model/model-communicate.mdx +0 -5
  24. package/docs/en/guides/topic-detail/model/performance.mdx +0 -4
  25. package/docs/en/guides/topic-detail/model/quick-start.mdx +5 -7
  26. package/docs/en/guides/topic-detail/model/redux-integration.mdx +0 -4
  27. package/docs/en/guides/topic-detail/model/typescript-best-practice.mdx +0 -4
  28. package/docs/en/guides/topic-detail/model/use-model.mdx +0 -5
  29. package/docs/en/guides/topic-detail/model/use-out-of-modernjs.mdx +0 -4
  30. package/docs/en/plugin/_meta.json +8 -7
  31. package/docs/en/plugin/cli-plugins/_meta.json +1 -1
  32. package/docs/en/plugin/cli-plugins/api.mdx +617 -0
  33. package/docs/en/plugin/cli-plugins/life-cycle.mdx +139 -0
  34. package/docs/en/plugin/cli-plugins/migration.mdx +98 -0
  35. package/docs/en/plugin/introduction.mdx +119 -47
  36. package/docs/en/plugin/official/_meta.json +12 -0
  37. package/docs/en/plugin/official/cli-plugins/_meta.json +1 -0
  38. package/docs/en/plugin/official/cli-plugins.mdx +6 -0
  39. package/docs/en/plugin/official/rsbuild-plugins.mdx +3 -0
  40. package/docs/en/plugin/plugin-system.mdx +237 -0
  41. package/docs/en/plugin/runtime-plugins/_meta.json +1 -0
  42. package/docs/en/plugin/runtime-plugins/api.mdx +165 -0
  43. package/docs/en/plugin/runtime-plugins/life-cycle.mdx +29 -0
  44. package/docs/en/plugin/runtime-plugins/migration.mdx +101 -0
  45. package/docs/en/plugin/server-plugins/api.mdx +3 -0
  46. package/docs/en/plugin/server-plugins/life-cycle.mdx +3 -0
  47. package/docs/zh/apis/app/hooks/src/app.mdx +18 -26
  48. package/docs/zh/apis/app/hooks/src/modern.runtime.mdx +9 -0
  49. package/docs/zh/apis/app/runtime/app/define-config.mdx +5 -0
  50. package/docs/zh/community/blog/v2-release-note.mdx +1 -1
  51. package/docs/zh/components/enable-micro-frontend.mdx +19 -12
  52. package/docs/zh/components/micro-runtime-config.mdx +3 -3
  53. package/docs/zh/components/reduck-notify.mdx +27 -0
  54. package/docs/zh/configure/app/plugins.mdx +2 -2
  55. package/docs/zh/configure/app/runtime/0-intro.mdx +67 -86
  56. package/docs/zh/configure/app/tools/esbuild.mdx +1 -1
  57. package/docs/zh/configure/app/tools/swc.mdx +1 -1
  58. package/docs/zh/configure/app/usage.mdx +44 -21
  59. package/docs/zh/guides/basic-features/render/_meta.json +1 -1
  60. package/docs/zh/guides/basic-features/render/before-render.mdx +115 -0
  61. package/docs/zh/guides/basic-features/routes.mdx +0 -95
  62. package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +3 -5
  63. package/docs/zh/guides/topic-detail/micro-frontend/c03-main-app.mdx +4 -2
  64. package/docs/zh/guides/topic-detail/model/auto-actions.mdx +0 -4
  65. package/docs/zh/guides/topic-detail/model/computed-state.mdx +0 -4
  66. package/docs/zh/guides/topic-detail/model/define-model.mdx +1 -4
  67. package/docs/zh/guides/topic-detail/model/faq.mdx +0 -5
  68. package/docs/zh/guides/topic-detail/model/manage-effects.mdx +0 -4
  69. package/docs/zh/guides/topic-detail/model/model-communicate.mdx +1 -4
  70. package/docs/zh/guides/topic-detail/model/performance.mdx +0 -4
  71. package/docs/zh/guides/topic-detail/model/quick-start.mdx +7 -8
  72. package/docs/zh/guides/topic-detail/model/redux-integration.mdx +0 -4
  73. package/docs/zh/guides/topic-detail/model/typescript-best-practice.mdx +0 -4
  74. package/docs/zh/guides/topic-detail/model/use-model.mdx +0 -5
  75. package/docs/zh/guides/topic-detail/model/use-out-of-modernjs.mdx +0 -4
  76. package/docs/zh/plugin/_meta.json +8 -7
  77. package/docs/zh/plugin/cli-plugins/_meta.json +1 -1
  78. package/docs/zh/plugin/cli-plugins/api.mdx +617 -0
  79. package/docs/zh/plugin/cli-plugins/life-cycle.mdx +139 -0
  80. package/docs/zh/plugin/cli-plugins/migration.mdx +98 -0
  81. package/docs/zh/plugin/introduction.mdx +92 -20
  82. package/docs/zh/plugin/official/_meta.json +12 -0
  83. package/docs/zh/plugin/official/cli-plugins/_meta.json +1 -0
  84. package/docs/zh/plugin/official/cli-plugins.mdx +6 -0
  85. package/docs/zh/plugin/official/rsbuild-plugins.mdx +3 -0
  86. package/docs/zh/plugin/plugin-system.mdx +239 -0
  87. package/docs/zh/plugin/runtime-plugins/_meta.json +1 -0
  88. package/docs/zh/plugin/runtime-plugins/api.mdx +166 -0
  89. package/docs/zh/plugin/runtime-plugins/life-cycle.mdx +29 -0
  90. package/docs/zh/plugin/runtime-plugins/migration.mdx +101 -0
  91. package/docs/zh/plugin/server-plugins/api.mdx +3 -0
  92. package/docs/zh/plugin/server-plugins/life-cycle.mdx +3 -0
  93. package/i18n.json +4 -0
  94. package/package.json +3 -2
  95. package/src/components/Footer/index.tsx +1 -1
  96. package/src/components/Mermaid/index.tsx +60 -0
  97. package/src/components/Mermaid/style.scss +221 -0
  98. package/docs/en/plugin/cli-plugins.mdx +0 -6
  99. package/docs/en/plugin/plugin-system/_meta.json +0 -10
  100. package/docs/en/plugin/plugin-system/extend.mdx +0 -163
  101. package/docs/en/plugin/plugin-system/hook-list.mdx +0 -711
  102. package/docs/en/plugin/plugin-system/hook.mdx +0 -188
  103. package/docs/en/plugin/plugin-system/implement.mdx +0 -243
  104. package/docs/en/plugin/plugin-system/introduction.mdx +0 -95
  105. package/docs/en/plugin/plugin-system/lifecycle.mdx +0 -16
  106. package/docs/en/plugin/plugin-system/plugin-api.mdx +0 -138
  107. package/docs/en/plugin/plugin-system/relationship.mdx +0 -119
  108. package/docs/en/plugin/rsbuild-plugins.mdx +0 -3
  109. package/docs/zh/plugin/cli-plugins.mdx +0 -6
  110. package/docs/zh/plugin/plugin-system/_meta.json +0 -10
  111. package/docs/zh/plugin/plugin-system/extend.mdx +0 -163
  112. package/docs/zh/plugin/plugin-system/hook-list.mdx +0 -715
  113. package/docs/zh/plugin/plugin-system/hook.mdx +0 -173
  114. package/docs/zh/plugin/plugin-system/implement.mdx +0 -250
  115. package/docs/zh/plugin/plugin-system/introduction.mdx +0 -94
  116. package/docs/zh/plugin/plugin-system/lifecycle.mdx +0 -16
  117. package/docs/zh/plugin/plugin-system/plugin-api.mdx +0 -138
  118. package/docs/zh/plugin/plugin-system/relationship.mdx +0 -119
  119. package/docs/zh/plugin/rsbuild-plugins.mdx +0 -4
  120. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-bff.mdx +0 -0
  121. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-ssg.mdx +0 -0
  122. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-swc.mdx +0 -0
  123. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-tailwind.mdx +0 -0
  124. /package/docs/en/plugin/{rsbuild-plugins → official/rsbuild-plugins}/_meta.json +0 -0
  125. /package/docs/en/plugin/{rsbuild-plugins → official/rsbuild-plugins}/plugin-esbuild.mdx +0 -0
  126. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-bff.mdx +0 -0
  127. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-ssg.mdx +0 -0
  128. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-swc.mdx +0 -0
  129. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-tailwind.mdx +0 -0
  130. /package/docs/zh/plugin/{rsbuild-plugins → official/rsbuild-plugins}/_meta.json +0 -0
  131. /package/docs/zh/plugin/{rsbuild-plugins → official/rsbuild-plugins}/plugin-esbuild.mdx +0 -0
@@ -1,119 +0,0 @@
1
- ---
2
- sidebar_position: 4
3
- ---
4
-
5
- # 插件之间的关系
6
-
7
- Modern.js 的插件配置对象提供了一系列的字段,用于控制插件顺序、互斥等能力,可用的字段如下:
8
-
9
- - `name`: `string`,设置当前插件的名称。
10
- - `pre`: `string[]`,这些插件最终会调整到当前插件前面。
11
- - `post`: `string[]`,这些插件最终会调整到当前插件后面。
12
- - `rivals`: `string[]`,互斥插件,遇到这些插件时会报错。
13
- - `required`: `string[]`,必需插件,插件列表中没有对应的插件时会报错。
14
- - `usePlugin`: `CliPlugin[]`,注册其他插件。
15
-
16
- 通过以上参数可以实现插件的前置、后置、互斥、必需等逻辑。
17
-
18
- ## 插件排序
19
-
20
- Modern.js 的插件通过 `pre`、`post` 参数来实现了插件排序的功能。
21
-
22
- ### 前置插件
23
-
24
- 默认情况下,插件会按照添加顺序依次执行,通过 `pre` 字段可以声明前置执行的插件。
25
-
26
- 比如有下面两个插件:
27
-
28
- ```ts title=foo.ts
29
- const foo = {
30
- name: 'plugin-foo',
31
- };
32
- ```
33
-
34
- ```ts title=bar.ts
35
- const bar = {
36
- name: 'plugin-bar',
37
- pre: ['plugin-foo'],
38
- };
39
- ```
40
-
41
- `bar` 插件在 `pre` 字段中配置了 `foo` 插件,因此 `foo` 插件一定会在 `bar` 插件之前执行。
42
-
43
- ### 后置插件
44
-
45
- 同样的,通过 `post` 字段可以声明后置执行的插件。
46
-
47
- ```ts title=foo.ts
48
- const foo = {
49
- name: 'plugin-foo',
50
- };
51
- ```
52
-
53
- ```ts title=bar.ts
54
- const bar = {
55
- name: 'plugin-bar',
56
- post: ['plugin-foo'],
57
- };
58
- ```
59
-
60
- `bar` 插件在 `post` 字段中配置了 `foo` 插件,因此 `foo` 插件一定会在 `bar` 插件之后执行。
61
-
62
- ## 互斥插件
63
-
64
- 通过 `rivals` 字段可以声明插件间的互斥关系。
65
-
66
- 有下面两个插件:
67
-
68
- ```ts title=foo.ts
69
- const foo = {
70
- name: 'plugin-foo',
71
- };
72
- ```
73
-
74
- ```ts title=bar.ts
75
- const bar = {
76
- name: 'plugin-bar',
77
- rivals: ['plugin-foo'],
78
- };
79
- ```
80
-
81
- `bar` 插件在 `rivals` 字段中配置了 `foo` 插件,因此同时添加了 `foo` 插件和 `bar` 插件就会报错。
82
-
83
- ## 必需插件
84
-
85
- 通过 `required` 字段可以声明插件间的依赖关系。
86
-
87
- 有下面两个插件:
88
-
89
- ```ts title=foo.ts
90
- const foo = {
91
- name: 'plugin-foo',
92
- };
93
- ```
94
-
95
- ```ts title=bar.ts
96
- const bar = {
97
- name: 'plugin-bar',
98
- required: ['plugin-foo'],
99
- };
100
- ```
101
-
102
- `bar` 插件在 `required` 字段中配置了 `foo` 插件,因此使用 `bar` 插件时,如果未配置 `foo` 插件就会报错。
103
-
104
- ## 注册插件
105
-
106
- 当插件之间存在依赖关系时,我们也可以在一个插件中通过 `usePlugin` 主动注册另一个插件:
107
-
108
- ```ts title=foo.ts
109
- const foo = () => ({
110
- name: 'plugin-foo',
111
- });
112
-
113
- const bar = () => ({
114
- name: 'plugin-bar',
115
- usePlugin: [foo()],
116
- });
117
- ```
118
-
119
- 当使用者配置了 `bar` 插件时,`foo` 插件也会自动注册生效,使用者就不需要去额外注册 `foo` 插件了。
@@ -1,4 +0,0 @@
1
- # 概览
2
-
3
- - [@modern-js/plugin-esbuild](/plugin/rsbuild-plugins/plugin-esbuild):提供 esbuild 编译支持。
4
-