@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
@@ -0,0 +1,221 @@
1
+ .dark {
2
+ .modern-mermaid {
3
+ .flowchart-label {
4
+ rect {
5
+ fill: #23272f !important;
6
+ stroke: #81b1db !important;
7
+ stroke-width: 1px !important;
8
+ }
9
+
10
+ polygon {
11
+ fill: #23272f !important;
12
+ stroke: #81b1db !important;
13
+ stroke-width: 1px !important;
14
+ }
15
+
16
+ span.nodeLabel {
17
+ color: #ccc !important;
18
+ }
19
+ }
20
+
21
+ .edgeLabel {
22
+ fill: #23272f !important;
23
+ color: #ccc !important;
24
+ background-color: #23272f !important;
25
+ }
26
+
27
+ .flowchart-link {
28
+ stroke: #ccc !important;
29
+ }
30
+
31
+ .marker {
32
+ stroke: #ccc !important;
33
+ fill: #ccc !important;
34
+ }
35
+ }
36
+ }
37
+
38
+ .modern-doc {
39
+ .modern-mermaid {
40
+ svg {
41
+ display: block;
42
+ margin: 0 auto;
43
+ }
44
+ .flow-start,
45
+ .flow-end {
46
+ rect,
47
+ polygon {
48
+ fill: #666 !important;
49
+ stroke: #666 !important;
50
+ }
51
+
52
+ span.nodeLabel {
53
+ color: #fff !important;
54
+ }
55
+ }
56
+
57
+ .flow-optimization {
58
+ rect,
59
+ polygon {
60
+ fill: var(--tw-ring-color) !important;
61
+ stroke: var(--rp-container-details-link) !important;
62
+ }
63
+
64
+ span.nodeLabel {
65
+ color: #333 !important;
66
+ }
67
+ }
68
+
69
+ .flow-hook {
70
+ rect,
71
+ polygon {
72
+ fill: var(--rp-container-info-border) !important;
73
+ stroke: var(--rp-container-info-border) !important;
74
+ }
75
+
76
+ span.nodeLabel {
77
+ color: #333 !important;
78
+ }
79
+ }
80
+
81
+ .flow-hook-non-support {
82
+ rect,
83
+ polygon {
84
+ fill: var(--rp-container-danger-border) !important;
85
+ stroke: var(--rp-container-danger-border) !important;
86
+ }
87
+
88
+ span.nodeLabel {
89
+ color: #333 !important;
90
+ }
91
+ }
92
+
93
+ .flow-hook-partial-support {
94
+ rect,
95
+ polygon {
96
+ fill: var(--rp-container-warning-border) !important;
97
+ stroke: var(--rp-container-warning-border) !important;
98
+ }
99
+
100
+ span.nodeLabel {
101
+ color: #333 !important;
102
+ }
103
+ }
104
+
105
+ .flow-process {
106
+ rect,
107
+ polygon {
108
+ fill: var(--rp-container-details-border) !important;
109
+ stroke: var(--rp-container-details-border) !important;
110
+ }
111
+
112
+ span.nodeLabel {
113
+ color: #333 !important;
114
+ }
115
+ }
116
+ }
117
+
118
+ .flowchart-link {
119
+ stroke: #666 !important;
120
+ }
121
+
122
+ .marker {
123
+ stroke: #666 !important;
124
+ fill: #666 !important;
125
+ }
126
+
127
+ .cluster {
128
+ rect {
129
+ fill: transparent !important;
130
+ stroke: #666 !important;
131
+ }
132
+ }
133
+ }
134
+
135
+ .dark {
136
+ .rspress-doc {
137
+ .modern-mermaid {
138
+ .flow-start,
139
+ .flow-end {
140
+ rect,
141
+ polygon {
142
+ fill: #666 !important;
143
+ stroke: #666 !important;
144
+ }
145
+
146
+ span.nodeLabel {
147
+ color: #ccc !important;
148
+ }
149
+ }
150
+
151
+ .flow-optimization {
152
+ rect,
153
+ polygon {
154
+ fill: var(--tw-ring-color) !important;
155
+ stroke: var(--rp-container-details-link) !important;
156
+ }
157
+
158
+ span.nodeLabel {
159
+ color: #ccc !important;
160
+ }
161
+ }
162
+
163
+ .flow-hook {
164
+ rect,
165
+ polygon {
166
+ fill: var(--rp-container-info-bg) !important;
167
+ stroke: var(--rp-container-info-border) !important;
168
+ }
169
+
170
+ span.nodeLabel {
171
+ color: #ccc !important;
172
+ }
173
+ }
174
+
175
+ .flow-hook-non-support {
176
+ rect,
177
+ polygon {
178
+ fill: var(--rp-container-danger-bg) !important;
179
+ stroke: var(--rp-container-danger-border) !important;
180
+ }
181
+
182
+ span.nodeLabel {
183
+ color: #ccc !important;
184
+ }
185
+ }
186
+
187
+ .flow-hook-partial-support {
188
+ rect,
189
+ polygon {
190
+ fill: var(--rp-container-warning-bg) !important;
191
+ stroke: var(--rp-container-warning-border) !important;
192
+ }
193
+
194
+ span.nodeLabel {
195
+ color: #ccc !important;
196
+ }
197
+ }
198
+
199
+ .flow-process {
200
+ rect,
201
+ polygon {
202
+ fill: var(--rp-container-details-bg) !important;
203
+ stroke: var(--rp-container-details-border) !important;
204
+ }
205
+
206
+ span.nodeLabel {
207
+ color: #ccc !important;
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ .modern-mermaid {
215
+ font-size: 20px;
216
+ text-align: center;
217
+ svg {
218
+ display: block;
219
+ margin: 0 auto;
220
+ }
221
+ }
@@ -1,6 +0,0 @@
1
- # Overview
2
-
3
- - [@modern-js/plugin-tailwindcss](/plugin/cli-plugins/plugin-tailwind): Enables the use of Tailwind CSS styles.
4
- - [@modern-js/plugin-bff](/plugin/cli-plugins/plugin-bff): Provides BFF services and unified invocation capabilities.
5
- - [@modern-js/plugin-ssg](/plugin/cli-plugins/plugin-ssg): Provides static site generation capabilities.
6
- - [@modern-js/plugin-swc](/plugin/cli-plugins/plugin-swc): Provides SWC compilation support.
@@ -1,10 +0,0 @@
1
- [
2
- "introduction",
3
- "lifecycle",
4
- "hook",
5
- "implement",
6
- "relationship",
7
- "extend",
8
- "plugin-api",
9
- "hook-list"
10
- ]
@@ -1,163 +0,0 @@
1
- ---
2
- sidebar_position: 5
3
- ---
4
-
5
- # Extending Plugin Hooks
6
-
7
- This section describes how to extend plugin Hooks by dynamically registering [Hook models](/plugin/plugin-system/hook).
8
-
9
- ## Example
10
-
11
- Here is a simple example to demonstrate how to extend plugin Hooks by adding Hooks that manage console output.
12
-
13
- First, we initialize an empty project file and add basic dependencies:
14
-
15
- ```bash
16
- $ npx @modern-js/create@latest modern-js-demo
17
- ```
18
-
19
- ### Creating Hooks
20
-
21
- First, let's create a Hook model:
22
-
23
- ```ts title=config/plugin/myPlugin.ts
24
- import { createWaterfall } from '@modern-js/plugin';
25
-
26
- const message = createWaterfall<string[]>();
27
- ```
28
-
29
- then register:
30
-
31
- ```ts title=config/plugin/myPlugin.ts
32
- import type { CliPlugin } from '@modern-js/core';
33
-
34
- export const myPlugin = (): CliPlugin => ({
35
- name: 'my-plugin',
36
-
37
- registerHook: {
38
- message,
39
- },
40
- });
41
- ```
42
-
43
- add Hook types:
44
-
45
- ```ts title=config/plugin/myPlugin.ts
46
- declare module '@modern-js/core' {
47
- export interface Hooks {
48
- message: typeof message;
49
- }
50
- }
51
- ```
52
-
53
- ### Using Hooks
54
-
55
- Create a plugin and add command handling logic through the `commands` Hook function:
56
-
57
- ```ts title=config/plugin/myPlugin.ts
58
- import type { CliPlugin } from '@modern-js/core';
59
-
60
- export const myPlugin = (): CliPlugin => ({
61
- name: 'my-plugin',
62
-
63
- setup(api) {
64
- return {
65
- commands({ program }) {
66
- program.command('message').action(async () => {
67
- const hookRunners = api.useHookRunners();
68
- const messages = hookRunners.message([]);
69
- console.log(messages.join('\n'));
70
- });
71
- },
72
- };
73
- },
74
- });
75
- ```
76
-
77
- now `config/plugin/myPlugin.ts` is:
78
-
79
- ```ts title=config/plugin/myPlugin.ts
80
- import { createWaterfall } from '@modern-js/plugin';
81
- import type { CliPlugin } from '@modern-js/core';
82
-
83
- const message = createWaterfall<string[]>();
84
-
85
- export const myPlugin = (): CliPlugin => ({
86
- name: 'my-plugin',
87
-
88
- registerHook: {
89
- message,
90
- },
91
-
92
- setup(api) {
93
- return {
94
- commands({ program }) {
95
- program.command('message').action(async () => {
96
- const hookRunners = api.useHookRunners();
97
- const messages = hookRunners.message([]);
98
- console.log(messages.join('\n'));
99
- });
100
- },
101
- };
102
- },
103
- });
104
-
105
- declare module '@modern-js/core' {
106
- export interface Hooks {
107
- message: typeof message;
108
- }
109
- }
110
- ```
111
-
112
- Then add this plugin in `modern.config.ts`:
113
-
114
- ```ts title="modern.config.ts"
115
- import { defineConfig } from '@modern-js/app-tools';
116
- import { myPlugin } from './config/plugin/myPlugin';
117
-
118
- export default defineConfig({
119
- plugins: [myPlugin()],
120
- });
121
- ```
122
-
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
-
125
- add:
126
-
127
- ```ts title=config/plugin/otherPlugin.ts
128
- import type { CliPlugin } from '@modern-js/core';
129
-
130
- export const otherPlugin = (): CliPlugin => ({
131
- name: 'other-plugin',
132
-
133
- setup(api) {
134
- return {
135
- message(list) {
136
- return [...list, '[foo] line 0', '[foo] line 1'];
137
- },
138
- };
139
- },
140
- });
141
- ```
142
-
143
- add to config:
144
-
145
- ```ts title="modern.config.ts"
146
- import { defineConfig } from '@modern-js/app-tools';
147
- import { myPlugin } from './config/plugin/myPlugin';
148
- import { otherPlugin } from './config/plugin/otherPlugin';
149
-
150
- export default defineConfig({
151
- plugins: [myPlugin(), otherPlugin()],
152
- });
153
- ```
154
-
155
- run `npx modern message`, then we can get follow in console:
156
-
157
- ```bash
158
- $ modern message
159
- [foo] line 0
160
- [foo] line 1
161
- ```
162
-
163
- By using the above approach, you can extend plugin Hooks with various capabilities.