@modern-js/main-doc 2.65.5 → 2.66.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 (81) hide show
  1. package/docs/en/community/blog/v2-release-note.mdx +1 -1
  2. package/docs/en/configure/app/plugins.mdx +2 -2
  3. package/docs/en/configure/app/tools/esbuild.mdx +1 -1
  4. package/docs/en/configure/app/tools/swc.mdx +1 -1
  5. package/docs/en/plugin/_meta.json +8 -7
  6. package/docs/en/plugin/cli-plugins/_meta.json +1 -1
  7. package/docs/en/plugin/cli-plugins/api.mdx +617 -0
  8. package/docs/en/plugin/cli-plugins/life-cycle.mdx +139 -0
  9. package/docs/en/plugin/cli-plugins/migration.mdx +98 -0
  10. package/docs/en/plugin/introduction.mdx +119 -47
  11. package/docs/en/plugin/official/_meta.json +12 -0
  12. package/docs/en/plugin/official/cli-plugins/_meta.json +1 -0
  13. package/docs/en/plugin/official/cli-plugins.mdx +6 -0
  14. package/docs/en/plugin/official/rsbuild-plugins.mdx +3 -0
  15. package/docs/en/plugin/plugin-system.mdx +237 -0
  16. package/docs/en/plugin/runtime-plugins/_meta.json +1 -0
  17. package/docs/en/plugin/runtime-plugins/api.mdx +165 -0
  18. package/docs/en/plugin/runtime-plugins/life-cycle.mdx +29 -0
  19. package/docs/en/plugin/runtime-plugins/migration.mdx +101 -0
  20. package/docs/en/plugin/server-plugins/api.mdx +3 -0
  21. package/docs/en/plugin/server-plugins/life-cycle.mdx +3 -0
  22. package/docs/zh/community/blog/v2-release-note.mdx +1 -1
  23. package/docs/zh/configure/app/plugins.mdx +2 -2
  24. package/docs/zh/configure/app/tools/esbuild.mdx +1 -1
  25. package/docs/zh/configure/app/tools/swc.mdx +1 -1
  26. package/docs/zh/plugin/_meta.json +8 -7
  27. package/docs/zh/plugin/cli-plugins/_meta.json +1 -1
  28. package/docs/zh/plugin/cli-plugins/api.mdx +617 -0
  29. package/docs/zh/plugin/cli-plugins/life-cycle.mdx +139 -0
  30. package/docs/zh/plugin/cli-plugins/migration.mdx +98 -0
  31. package/docs/zh/plugin/introduction.mdx +92 -20
  32. package/docs/zh/plugin/official/_meta.json +12 -0
  33. package/docs/zh/plugin/official/cli-plugins/_meta.json +1 -0
  34. package/docs/zh/plugin/official/cli-plugins.mdx +6 -0
  35. package/docs/zh/plugin/official/rsbuild-plugins.mdx +3 -0
  36. package/docs/zh/plugin/plugin-system.mdx +239 -0
  37. package/docs/zh/plugin/runtime-plugins/_meta.json +1 -0
  38. package/docs/zh/plugin/runtime-plugins/api.mdx +166 -0
  39. package/docs/zh/plugin/runtime-plugins/life-cycle.mdx +29 -0
  40. package/docs/zh/plugin/runtime-plugins/migration.mdx +101 -0
  41. package/docs/zh/plugin/server-plugins/api.mdx +3 -0
  42. package/docs/zh/plugin/server-plugins/life-cycle.mdx +3 -0
  43. package/i18n.json +4 -0
  44. package/package.json +3 -2
  45. package/src/components/Footer/index.tsx +1 -1
  46. package/src/components/Mermaid/index.tsx +60 -0
  47. package/src/components/Mermaid/style.scss +221 -0
  48. package/docs/en/plugin/cli-plugins.mdx +0 -6
  49. package/docs/en/plugin/plugin-system/_meta.json +0 -10
  50. package/docs/en/plugin/plugin-system/extend.mdx +0 -163
  51. package/docs/en/plugin/plugin-system/hook-list.mdx +0 -711
  52. package/docs/en/plugin/plugin-system/hook.mdx +0 -188
  53. package/docs/en/plugin/plugin-system/implement.mdx +0 -243
  54. package/docs/en/plugin/plugin-system/introduction.mdx +0 -95
  55. package/docs/en/plugin/plugin-system/lifecycle.mdx +0 -16
  56. package/docs/en/plugin/plugin-system/plugin-api.mdx +0 -138
  57. package/docs/en/plugin/plugin-system/relationship.mdx +0 -119
  58. package/docs/en/plugin/rsbuild-plugins.mdx +0 -3
  59. package/docs/zh/plugin/cli-plugins.mdx +0 -6
  60. package/docs/zh/plugin/plugin-system/_meta.json +0 -10
  61. package/docs/zh/plugin/plugin-system/extend.mdx +0 -163
  62. package/docs/zh/plugin/plugin-system/hook-list.mdx +0 -715
  63. package/docs/zh/plugin/plugin-system/hook.mdx +0 -173
  64. package/docs/zh/plugin/plugin-system/implement.mdx +0 -250
  65. package/docs/zh/plugin/plugin-system/introduction.mdx +0 -94
  66. package/docs/zh/plugin/plugin-system/lifecycle.mdx +0 -16
  67. package/docs/zh/plugin/plugin-system/plugin-api.mdx +0 -138
  68. package/docs/zh/plugin/plugin-system/relationship.mdx +0 -119
  69. package/docs/zh/plugin/rsbuild-plugins.mdx +0 -4
  70. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-bff.mdx +0 -0
  71. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-ssg.mdx +0 -0
  72. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-swc.mdx +0 -0
  73. /package/docs/en/plugin/{cli-plugins → official/cli-plugins}/plugin-tailwind.mdx +0 -0
  74. /package/docs/en/plugin/{rsbuild-plugins → official/rsbuild-plugins}/_meta.json +0 -0
  75. /package/docs/en/plugin/{rsbuild-plugins → official/rsbuild-plugins}/plugin-esbuild.mdx +0 -0
  76. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-bff.mdx +0 -0
  77. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-ssg.mdx +0 -0
  78. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-swc.mdx +0 -0
  79. /package/docs/zh/plugin/{cli-plugins → official/cli-plugins}/plugin-tailwind.mdx +0 -0
  80. /package/docs/zh/plugin/{rsbuild-plugins → official/rsbuild-plugins}/_meta.json +0 -0
  81. /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
-