@modern-js/main-doc 2.21.1 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (253) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/docs/en/apis/app/commands.mdx +5 -5
  3. package/docs/en/apis/app/hooks/api/api.mdx +80 -0
  4. package/docs/en/apis/app/hooks/api/app.mdx +12 -0
  5. package/docs/en/apis/app/hooks/api/lambda.mdx +57 -0
  6. package/docs/en/apis/app/hooks/api/test.mdx +1 -1
  7. package/docs/en/apis/app/hooks/config/html.mdx +2 -2
  8. package/docs/en/apis/app/hooks/config/icon.mdx +19 -19
  9. package/docs/en/apis/app/hooks/config/mock.mdx +1 -1
  10. package/docs/en/apis/app/hooks/config/public.mdx +10 -10
  11. package/docs/en/apis/app/hooks/config/storybook.mdx +3 -3
  12. package/docs/en/apis/app/hooks/config/upload.mdx +13 -13
  13. package/docs/en/apis/app/hooks/modern-config.mdx +4 -4
  14. package/docs/en/apis/app/hooks/server/index_.mdx +2 -9
  15. package/docs/en/apis/app/hooks/server/test.mdx +5 -2
  16. package/docs/en/apis/app/hooks/shared.mdx +1 -1
  17. package/docs/en/apis/app/hooks/src/app.mdx +17 -27
  18. package/docs/en/apis/app/hooks/src/index_.mdx +6 -6
  19. package/docs/en/apis/app/hooks/src/pages.mdx +41 -37
  20. package/docs/en/apis/app/hooks/src/routes.mdx +16 -36
  21. package/docs/en/apis/app/hooks/src/server.mdx +1 -1
  22. package/docs/en/apis/app/hooks/src/stories.mdx +6 -3
  23. package/docs/en/apis/app/hooks/src/test.mdx +4 -3
  24. package/docs/en/apis/app/runtime/core/use-runtime-context.mdx +5 -1
  25. package/docs/en/apis/app/runtime/web-server/hook.mdx +2 -2
  26. package/docs/en/apis/app/runtime/web-server/middleware.mdx +2 -2
  27. package/docs/en/components/init-app.mdx +3 -3
  28. package/docs/en/components/init-rspack-app.mdx +4 -4
  29. package/docs/en/components/language-config.mdx +9 -0
  30. package/docs/en/components/package-manager.mdx +11 -0
  31. package/docs/en/components/ua-polyfill.mdx +2 -2
  32. package/docs/en/configure/app/source/config-dir.mdx +1 -1
  33. package/docs/en/configure/app/source/design-system.mdx +67 -67
  34. package/docs/en/configure/app/source/disable-default-entries.mdx +6 -5
  35. package/docs/en/configure/app/source/disable-entry-dirs.mdx +5 -5
  36. package/docs/en/configure/app/source/enable-async-entry.mdx +9 -9
  37. package/docs/en/configure/app/source/entries-dir.mdx +3 -3
  38. package/docs/en/configure/app/source/entries.mdx +21 -19
  39. package/docs/en/configure/app/tools/swc.mdx +2 -2
  40. package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -2
  41. package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
  42. package/docs/en/guides/advanced-features/bff/type.mdx +5 -5
  43. package/docs/en/guides/advanced-features/rspack-start.mdx +6 -6
  44. package/docs/en/guides/advanced-features/ssg.mdx +2 -2
  45. package/docs/en/guides/advanced-features/testing.mdx +2 -2
  46. package/docs/en/guides/advanced-features/web-server.mdx +2 -2
  47. package/docs/en/guides/basic-features/css.mdx +2 -2
  48. package/docs/en/guides/basic-features/mock.mdx +1 -1
  49. package/docs/en/guides/basic-features/routes.mdx +11 -7
  50. package/docs/en/guides/concept/entries.mdx +3 -3
  51. package/docs/en/guides/topic-detail/generator/create/_category_.json +4 -0
  52. package/docs/en/guides/topic-detail/generator/create/config.mdx +75 -0
  53. package/docs/en/guides/topic-detail/generator/create/option.md +151 -0
  54. package/docs/en/guides/topic-detail/generator/create/use.mdx +66 -0
  55. package/docs/en/guides/topic-detail/generator/new/_category_.json +4 -0
  56. package/docs/en/guides/topic-detail/generator/new/config.md +155 -0
  57. package/docs/en/guides/topic-detail/generator/new/option.md +67 -0
  58. package/docs/en/guides/topic-detail/generator/new/use.md +95 -0
  59. package/docs/en/guides/topic-detail/generator/plugin/_category_.json +2 -2
  60. package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  61. package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +49 -0
  62. package/docs/en/guides/topic-detail/generator/plugin/api/context.md +184 -0
  63. package/docs/en/guides/topic-detail/generator/plugin/api/input.md +124 -0
  64. package/docs/en/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  65. package/docs/en/guides/topic-detail/generator/plugin/category.md +88 -0
  66. package/docs/en/guides/topic-detail/generator/plugin/context.md +104 -0
  67. package/docs/en/guides/topic-detail/generator/plugin/structure.md +106 -0
  68. package/docs/en/guides/topic-detail/generator/plugin/use.md +33 -0
  69. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +8 -8
  70. package/docs/en/tutorials/first-app/c03-css.mdx +2 -2
  71. package/docs/en/tutorials/first-app/c08-entries.mdx +3 -3
  72. package/docs/zh/apis/app/commands.mdx +3 -3
  73. package/docs/zh/apis/app/hooks/api/{functions/api.mdx → api.mdx} +4 -4
  74. package/docs/zh/apis/app/hooks/api/app.mdx +12 -0
  75. package/docs/zh/apis/app/hooks/api/{framework/lambda.mdx → lambda.mdx} +5 -5
  76. package/docs/zh/apis/app/hooks/api/test.mdx +3 -3
  77. package/docs/zh/apis/app/hooks/config/icon.mdx +15 -15
  78. package/docs/zh/apis/app/hooks/config/mock.mdx +1 -1
  79. package/docs/zh/apis/app/hooks/config/public.mdx +3 -3
  80. package/docs/zh/apis/app/hooks/config/upload.mdx +1 -1
  81. package/docs/zh/apis/app/hooks/modern-config.mdx +3 -3
  82. package/docs/zh/apis/app/hooks/server/index_.mdx +1 -6
  83. package/docs/zh/apis/app/hooks/shared.mdx +1 -1
  84. package/docs/zh/apis/app/hooks/src/app.mdx +15 -25
  85. package/docs/zh/apis/app/hooks/src/index_.mdx +6 -6
  86. package/docs/zh/apis/app/hooks/src/pages.mdx +7 -3
  87. package/docs/zh/apis/app/hooks/src/routes.mdx +4 -4
  88. package/docs/zh/apis/app/hooks/src/stories.mdx +1 -1
  89. package/docs/zh/apis/app/runtime/core/use-runtime-context.mdx +5 -1
  90. package/docs/zh/components/language-config.mdx +9 -0
  91. package/docs/zh/components/package-manager.mdx +11 -0
  92. package/docs/zh/components/ua-polyfill.mdx +1 -1
  93. package/docs/zh/configure/app/source/design-system.mdx +3 -4
  94. package/docs/zh/configure/app/source/enable-async-entry.mdx +2 -5
  95. package/docs/zh/configure/app/source/entries.mdx +2 -2
  96. package/docs/zh/configure/app/tools/swc.mdx +2 -2
  97. package/docs/zh/guides/advanced-features/rspack-start.mdx +6 -6
  98. package/docs/zh/guides/advanced-features/ssg.mdx +1 -1
  99. package/docs/zh/guides/advanced-features/testing.mdx +2 -2
  100. package/docs/zh/guides/advanced-features/web-server.mdx +1 -1
  101. package/docs/zh/guides/basic-features/css.mdx +1 -1
  102. package/docs/zh/guides/basic-features/mock.mdx +1 -1
  103. package/docs/zh/guides/basic-features/routes.mdx +7 -4
  104. package/docs/zh/guides/concept/entries.mdx +3 -3
  105. package/docs/zh/guides/topic-detail/generator/create/_category_.json +4 -0
  106. package/docs/zh/guides/topic-detail/generator/create/config.mdx +76 -0
  107. package/docs/zh/guides/topic-detail/generator/create/option.md +151 -0
  108. package/docs/zh/guides/topic-detail/generator/create/use.mdx +66 -0
  109. package/docs/zh/guides/topic-detail/generator/new/_category_.json +4 -0
  110. package/docs/zh/guides/topic-detail/generator/new/config.md +153 -0
  111. package/docs/zh/guides/topic-detail/generator/new/option.md +67 -0
  112. package/docs/zh/guides/topic-detail/generator/new/use.md +94 -0
  113. package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +2 -2
  114. package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  115. package/docs/zh/guides/topic-detail/generator/plugin/api/afterForged.md +50 -0
  116. package/docs/zh/guides/topic-detail/generator/plugin/api/context.md +184 -0
  117. package/docs/zh/guides/topic-detail/generator/plugin/api/input.md +124 -0
  118. package/docs/zh/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  119. package/docs/zh/guides/topic-detail/generator/plugin/category.md +93 -0
  120. package/docs/zh/guides/topic-detail/generator/plugin/context.md +105 -0
  121. package/docs/zh/guides/topic-detail/generator/plugin/structure.md +106 -0
  122. package/docs/zh/guides/topic-detail/generator/plugin/use.md +33 -0
  123. package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +4 -4
  124. package/docs/zh/guides/topic-detail/model/test-model.mdx +1 -1
  125. package/docs/zh/tutorials/first-app/c03-css.mdx +1 -1
  126. package/docs/zh/tutorials/first-app/c08-entries.mdx +1 -1
  127. package/package.json +5 -5
  128. package/docs/en/apis/app/hooks/api/framework/_category_.json +0 -4
  129. package/docs/en/apis/app/hooks/api/framework/lambda.mdx +0 -57
  130. package/docs/en/apis/app/hooks/api/functions/_category_.json +0 -4
  131. package/docs/en/apis/app/hooks/api/functions/api.mdx +0 -81
  132. package/docs/en/apis/app/hooks/api/functions/app.mdx +0 -12
  133. package/docs/en/apis/app/hooks/api/functions/common.mdx +0 -9
  134. package/docs/en/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  135. package/docs/en/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  136. package/docs/en/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  137. package/docs/en/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  138. package/docs/en/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  139. package/docs/en/guides/topic-detail/generator/codesmith/api/git.mdx +0 -50
  140. package/docs/en/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -57
  141. package/docs/en/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  142. package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
  143. package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  144. package/docs/en/guides/topic-detail/generator/codesmith/introduce.mdx +0 -47
  145. package/docs/en/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  146. package/docs/en/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  147. package/docs/en/guides/topic-detail/generator/config/_category_.json +0 -4
  148. package/docs/en/guides/topic-detail/generator/config/app.mdx +0 -82
  149. package/docs/en/guides/topic-detail/generator/config/common.mdx +0 -100
  150. package/docs/en/guides/topic-detail/generator/config/module.mdx +0 -42
  151. package/docs/en/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  152. package/docs/en/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  153. package/docs/en/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  154. package/docs/en/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  155. package/docs/en/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  156. package/docs/en/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -58
  157. package/docs/en/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  158. package/docs/en/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  159. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  160. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  161. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  162. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  163. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  164. package/docs/en/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  165. package/docs/en/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  166. package/docs/en/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  167. package/docs/en/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  168. package/docs/en/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  169. package/docs/en/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  170. package/docs/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  171. package/docs/en/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  172. package/docs/en/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  173. package/docs/en/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  174. package/docs/en/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  175. package/docs/en/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  176. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
  177. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
  178. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  179. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -31
  180. package/docs/en/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  181. package/docs/en/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -90
  182. package/docs/en/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  183. package/docs/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  184. package/docs/en/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  185. package/docs/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  186. package/docs/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  187. package/docs/en/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  188. package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
  189. package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  190. package/docs/en/guides/topic-detail/generator/plugin/use.mdx +0 -61
  191. package/docs/en/guides/topic-detail/generator/project.mdx +0 -118
  192. package/docs/zh/apis/app/hooks/api/framework/_category_.json +0 -4
  193. package/docs/zh/apis/app/hooks/api/functions/_category_.json +0 -4
  194. package/docs/zh/apis/app/hooks/api/functions/app.mdx +0 -12
  195. package/docs/zh/apis/app/hooks/api/functions/common.mdx +0 -9
  196. package/docs/zh/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  197. package/docs/zh/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  198. package/docs/zh/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  199. package/docs/zh/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  200. package/docs/zh/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  201. package/docs/zh/guides/topic-detail/generator/codesmith/api/git.mdx +0 -49
  202. package/docs/zh/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -56
  203. package/docs/zh/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  204. package/docs/zh/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -47
  205. package/docs/zh/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  206. package/docs/zh/guides/topic-detail/generator/codesmith/introduce.mdx +0 -59
  207. package/docs/zh/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  208. package/docs/zh/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  209. package/docs/zh/guides/topic-detail/generator/config/_category_.json +0 -4
  210. package/docs/zh/guides/topic-detail/generator/config/app.mdx +0 -82
  211. package/docs/zh/guides/topic-detail/generator/config/common.mdx +0 -100
  212. package/docs/zh/guides/topic-detail/generator/config/module.mdx +0 -42
  213. package/docs/zh/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  214. package/docs/zh/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  215. package/docs/zh/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  216. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  217. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  218. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -55
  219. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  220. package/docs/zh/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  221. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  222. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  223. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  224. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  225. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  226. package/docs/zh/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  227. package/docs/zh/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  228. package/docs/zh/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  229. package/docs/zh/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  230. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  231. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  232. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  233. package/docs/zh/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  234. package/docs/zh/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  235. package/docs/zh/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  236. package/docs/zh/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  237. package/docs/zh/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  238. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -57
  239. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -56
  240. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  241. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -29
  242. package/docs/zh/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  243. package/docs/zh/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -92
  244. package/docs/zh/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  245. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  246. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  247. package/docs/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  248. package/docs/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  249. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  250. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -16
  251. package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  252. package/docs/zh/guides/topic-detail/generator/plugin/use.mdx +0 -61
  253. package/docs/zh/guides/topic-detail/generator/project.mdx +0 -118
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7d1b96e: feat(changeset): optimize release note display
8
+
9
+ feat(changeset): 优化生成 Release Note 文案
10
+
11
+ ### Patch Changes
12
+
13
+ - 3c3d1e2: docs: update project creation and new command text.
14
+
15
+ docs: 更新生成器创建项目和 new 命令文案。
16
+
17
+ - Updated dependencies [850cde6]
18
+ - Updated dependencies [e7a5f94]
19
+ - @modern-js/builder-doc@2.22.0
20
+
3
21
  ## 2.21.1
4
22
 
5
23
  ### Patch Changes
@@ -125,9 +125,9 @@ In the project, execute the `new` command to add entries as follows:
125
125
 
126
126
  ```bash
127
127
  $ npx modern new
128
- ? Action Create project element
129
- ? Create project element New "entry"
130
- ? Entry name entry
128
+ ? Please select the operation you want: Create Element
129
+ ? Please select the type of element to create: New "entry"
130
+ ? Please fill in the entry name: entry
131
131
  ```
132
132
 
133
133
  ### Enable Features
@@ -136,8 +136,8 @@ In the project, execute the `new` command to enable features as follows:
136
136
 
137
137
  ```bash
138
138
  $ npx modern new
139
- ? Action Enable features
140
- ? Enable features (Use arrow keys)
139
+ ? Please select the operation you want: Enable features
140
+ ? Please select the feature name: (Use arrow keys)
141
141
  ❯ Enable Tailwind CSS
142
142
  Enable BFF
143
143
  Enable SSG
@@ -0,0 +1,80 @@
1
+ ---
2
+ title: '**/*.[tj]s'
3
+ sidebar_position: 1
4
+ ---
5
+ # **/*.[tj]s
6
+
7
+ Files that declare API routes in the [BFF Function Mode](/guides/advanced-features/bff/type.html#function-mode). Except for some [convention files](/apis/app/hooks/api/api#allow-list), files in the `api` directory will be registered as the routes.
8
+
9
+ :::info
10
+ Using the `api` directory requires enabling the BFF feature, and you need to run the `new` command in the project to enable the "BFF" feature.
11
+
12
+ This file supports using the `js` or `ts` language, but you must use `esm` syntax to export functions.
13
+
14
+ :::
15
+
16
+ ## Routing File Convention
17
+
18
+ ### Default Routing
19
+
20
+ The routing system will map files named `index` to the previous directory.
21
+
22
+ - `api/index.ts` -> `$BASENAME/`
23
+ - `api/user/index.ts` -> `$BASENAME/user`
24
+
25
+ ### Nested Routing
26
+
27
+ The routing system also supports parsing nested files. If you create a nested folder structure, the files will still automatically resolve routes in the same way.
28
+
29
+ - `api/hello.ts` -> `$BASENAME/hello`
30
+ - `api/user/list.ts` -> `$BASENAME/user/list`
31
+
32
+ ### Dynamic Routing
33
+
34
+ The routing system supports generating dynamic routes through file directories named with `[]`.
35
+
36
+ - `api/user/[username]/info.ts` -> `$BASENAME/user/:username/info`
37
+ - `api/user/[username]/delete.ts` -> `$BASENAME/user/:username/delete`
38
+ - `api/article/[id]/info.ts` -> `$BASENAME/article/:id/info`
39
+
40
+ The `$BASENAME` can be configured in `modern.config.js`, and the default value is `/api`.
41
+
42
+ ### Allow List
43
+
44
+ By default, all files in the `api` directory will be parsed as BFF function files, but we also set a white list for these files that are not parsed:
45
+
46
+ - Files whose names start with `_`. For example: `_utils.ts`.
47
+ - All files in folders whose names start with `_`. For example: `_utils/index.ts`, `_utils/cp.ts`.
48
+ - Test files. For example: `foo.test.ts`.
49
+ - TypeScript type files. For example: `hello.d.ts`.
50
+ - Files under `node_modules`.
51
+
52
+ ## Function Definition
53
+
54
+ In addition to the routing rules above, there are also conventions for function definitions and exports in the code.
55
+
56
+ Functions are exported by name, and the name of the exported function is the HTTP method accepted by the corresponding interface, that is:
57
+
58
+ ```ts
59
+ export const get = async () => {
60
+ return {
61
+ name: 'Modern.js',
62
+ desc: 'Modern web Solutions',
63
+ };
64
+ };
65
+ ```
66
+
67
+ By exporting functions in this way, you will get a `GET` interface.
68
+
69
+ The application project supports 9 Method definitions, namely: `GET`, `POST`, `PUT`, `DELETE`, `CONNECT`, `TRACE`, `PATCH`, `OPTION`, `HEAD`, that is, these Methods can be used as the names of the exported functions.
70
+
71
+ The name is case-insensitive, that is, if it is `GET`, it can be written as `get`, `Get`, `GEt`, `GET`, all of which can be accurately recognized. The default export, that is, `export default xxx`, will be mapped to `Get`.
72
+
73
+ Because `delete` is a keyword in JavaScript, you can use `del` or `DELETE` instead.
74
+
75
+ Multiple functions with different Methods can be defined in one file, but if multiple functions with the same Method are defined, only the first one will take effect.
76
+
77
+ :::info
78
+ It should be noted that the defined functions should all be asynchronous, which is related to the type when calling the function.
79
+
80
+ :::
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: _app.[tj]s
3
+ sidebar_position: 2
4
+ ---
5
+ # _app.[tj]s
6
+
7
+ In the [BFF Function Mode](/guides/advanced-features/bff/type.html#function-mode), this file can add pre-middleware for BFF functions.
8
+
9
+ :::note
10
+ For specific examples, please refer to [hook](/apis/app/runtime/bff/hook).
11
+
12
+ :::
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: lambda/*.[tj]s
3
+ sidebar_position: 3
4
+ ---
5
+ # lambda/*.[tj]s
6
+
7
+ Files that declare API routes under the [BFF Framework Mode](/guides/advanced-features/bff/type.html#framework-mode). Except for [convention files](/apis/app/hooks/api/api#allow-list), files under the `lambda/` directory will be registered as the routes.
8
+
9
+ :::info
10
+ Using the `api` directory requires enabling the BFF function, and you need to run the new command to enable the "BFF" function under the project.
11
+
12
+ :::
13
+
14
+ :::tip
15
+ This file supports using `js` or `ts` language, but must export functions using `esm` syntax.
16
+
17
+ :::
18
+
19
+ ## Routing File Convention
20
+
21
+ ### Default Routing
22
+
23
+ The routing system will map files named `index` to the previous directory.
24
+
25
+ - `api/lambda/index.ts` -> `$BASENAME/`
26
+ - `api/lambda/user/index.ts` -> `$BASENAME/user`
27
+
28
+ ### Nested Routing
29
+
30
+ The routing system also supports parsing nested files. If you create a nested folder structure, the files will still automatically resolve routes in the same way.
31
+
32
+ - `api/lambda/hello.ts` -> `$BASENAME/hello`
33
+ - `api/lambda/user/list.ts` -> `$BASENAME/user/list`
34
+
35
+ ### Dynamic Routing
36
+
37
+ The routing system supports generating dynamic routes through file directories named with `[]`.
38
+
39
+ - `api/lambda/user/[username]/info.ts` -> `$BASENAME/user/:username/info`
40
+ - `api/lambda/user/[username]/delete.ts` -> `$BASENAME/user/:username/delete`
41
+ - `api/lambda/article/[id]/info.ts` -> `$BASENAME/article/:id/info`
42
+
43
+ The `$BASENAME` can be configured in `modern.config.js`, and the default value is `/api`.
44
+
45
+ ### Allow List
46
+
47
+ By default, all files in the `lambda` directory are parsed as BFF function files, but we also set up a whitelist so that these files are not parsed:
48
+
49
+ - Files named starting with `_`. For example: `_utils.ts`.
50
+ - All files in a folder named starting with `_`. For example: `_utils/index.ts`, `_utils/cp.ts`.
51
+ - Test files. For example: `foo.test.ts`.
52
+ - TypeScript type files. For example: `hello.d.ts`.
53
+ - Files under `node_module`.
54
+
55
+ ## Function Definition
56
+
57
+ Completely consistent with the [Function Definition](/apis/app/hooks/api/api#function-definition) under the function mode.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: test.[tj]s
3
- sidebar_position: 2
3
+ sidebar_position: 4
4
4
  ---
5
5
 
6
6
  # test.[tj]s
@@ -4,6 +4,6 @@ sidebar_position: 1
4
4
  ---
5
5
  # html/
6
6
 
7
- The `config/html` directory allows you to inject custom html snippets in different places in the default html template.
7
+ You can inject custom HTML fragments at different locations of the default internal HTML template through the `config/html` directory.
8
8
 
9
- For detail, see [HTML](/guides/basic-features/html).
9
+ For specific usage, please refer to: [Custom HTML](/guides/basic-features/html).
@@ -1,20 +1,20 @@
1
1
  ---
2
- title: icon
2
+ title: icon/
3
3
  sidebar_position: 2
4
4
  ---
5
5
 
6
- # Icon
6
+ # icon/
7
7
 
8
- ## Set favicon
8
+ ## Favicon
9
9
 
10
- When there is a `favicon.*` file in the `config` directory of the project root directory, Modern.js will automatically set the file to the [html.favicon](/configure/app/html/favicon) config to generate the favicon icon for the page:
10
+ When there is a `favicon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.favicon](/configure/app/html/favicon) configuration item for generating the favicon icon on the page:
11
11
 
12
12
  ```
13
13
  ./config
14
14
  └── favicon.ico
15
15
  ```
16
16
 
17
- After the build is complete, you can see that the following tags are automatically generated in the HTML:
17
+ After the build is completed, you can see the following tags automatically generated in HTML:
18
18
 
19
19
  ```html
20
20
  <link rel="icon" href="/favicon.ico" />
@@ -24,22 +24,22 @@ After the build is complete, you can see that the following tags are automatical
24
24
 
25
25
  When setting up the favicon, Modern.js looks for files in the following order:
26
26
 
27
- - favicon.png
28
- - favicon.jpg
29
- - favicon.jpeg
30
- - favicon.svg
31
- - favicon.ico
27
+ - `favicon.png`
28
+ - `favicon.jpg`
29
+ - `favicon.jpeg`
30
+ - `favicon.svg`
31
+ - `favicon.ico`
32
32
 
33
- ## Set app icon
33
+ ## Apple Touch Icon
34
34
 
35
- When there is an `icon.*` file in the `config` directory of the project root directory, Modern.js will automatically set the file to the [html.appIcon](/configure/app/html/app-icon) config, it is used to generate the apple-touch-icon icon for the iOS system.
35
+ When there is an `icon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.appIcon](/configure/app/html/app-icon) configuration item for generating the Apple Touch Icon icon under the iOS system.
36
36
 
37
37
  ```
38
38
  ./config
39
39
  └── icon.png
40
40
  ```
41
41
 
42
- After the build is complete, you can see that the following tags are automatically generated in the HTML:
42
+ After the build is completed, you can see the following tags automatically generated in HTML:
43
43
 
44
44
  ```html
45
45
  <link rel="apple-touch-icon" sizes="180*180" href="/static/image/icon.png" />
@@ -47,10 +47,10 @@ After the build is complete, you can see that the following tags are automatical
47
47
 
48
48
  ### Order
49
49
 
50
- When setting the app icon, Modern.js looks for files in the following order:
50
+ When setting up the app icon, Modern.js looks for files in the following order:
51
51
 
52
- - icon.png
53
- - icon.jpg
54
- - icon.jpeg
55
- - icon.svg
56
- - icon.ico
52
+ - `icon.png`
53
+ - `icon.jpg`
54
+ - `icon.jpeg`
55
+ - `icon.svg`
56
+ - `icon.ico`
@@ -4,4 +4,4 @@ sidebar_position: 5
4
4
  ---
5
5
  # mock/
6
6
 
7
- when `config/mock/index.js` exist, Modernjs auto start the Mock service in the development.
7
+ When there is a `config/mock/index.js` file in the project directory, Modern.js will automatically enable the Mock service during development.
@@ -4,27 +4,27 @@ sidebar_position: 3
4
4
  ---
5
5
  # public/
6
6
 
7
- Static resource files in any format can be placed in the `public/`, and the files will be Served under the web application domain name.
7
+ Any static resource files can be placed in the `public/` directory, and the files will be deployed to the corresponding application domain by the server.
8
8
 
9
9
  ## Description
10
10
 
11
- The routing of files to be served is based on the convention of the file system. `public/` is the root directory, which corresponds to the root path of the Web application.
11
+ The file routing is based on the convention of the directory structure, where `public/` is the root directory corresponding to the root path of the Web application.
12
12
 
13
- For example, the `config/public/sdk/index.js` file will be Served under `${domain}/sdk/index.js` after deployment.
13
+ For example, the `config/public/sdk/index.js` file will be deployed under `${domain}/sdk/index.js` after deployment.
14
14
 
15
- ## Scene
15
+ ## Scenarios
16
16
 
17
- For example, `robots.txt`, `auth.xml` and other authentication file.
17
+ For example, authentication files required by third-party systems such as `robots.txt` and `auth.xml`.
18
18
 
19
- SDK (requiring the same routing) for other business, or an HTML file for static host.
19
+ Or SDKs for other business parties (requiring unchanged routing), or HTML files without entry.
20
20
 
21
21
  :::info
22
- For static resources (such as SVG pictures) that need to be referenced by import in the source code, it is recommended to put them in the `src/assets/` for management.
22
+ For static resources (such as SVG images) that need to be imported through import in the source code, it is recommended to manage them in the `src/assets` directory.
23
23
 
24
24
  :::
25
25
 
26
- ## Compression
26
+ ## Code Compression
27
27
 
28
- If the file is a `.js` file, it will be automatically compressed when the production environment is built.
28
+ If the file in the directory is a `.js` file, it will be automatically compressed during production environment construction.
29
29
 
30
- If the file ends with `.min.js`, it will not compression.
30
+ If the file ends with `.min.js`, it will not be compressed.
@@ -4,11 +4,11 @@ sidebar_position: 7
4
4
  ---
5
5
  # storybook/
6
6
 
7
- Modern.js.js supports debugging with Storybook. When you need to configure Storybook, configure it in the `config/storybook/`.
7
+ Modern.js supports debugging using Storybook. When configuring Storybook, you need to configure it in the `config/storybook` directory of the project.
8
8
 
9
- For detail, see [Storybook](https://storybook.js.org/docs/react/configure/overview).
9
+ Please refer to [Storybook Configuration](https://storybook.js.org/docs/react/configure/overview) for Storybook configuration.
10
10
 
11
11
  :::info
12
- Debugging with Storybook requires executing the `new` command to enable the 「Visual Testing (Storybook)」 mode feature.
12
+ Enabling the Visual Testing (Storybook) mode function requires running the new command to enable it under the project first.
13
13
 
14
14
  :::
@@ -4,29 +4,29 @@ sidebar_position: 4
4
4
  ---
5
5
  # upload/
6
6
 
7
- Static resource files in any format can be placed in the `upload/`.
7
+ Any static resource files can be placed in the `upload/` directory.
8
8
 
9
9
  ## Description
10
10
 
11
- In the development environment, the static resource files in this directory will be hosted in the '/upload' path. After building the application product, the files in this directory will be copied to the dist path.
11
+ In the development environment, the static resource files in this directory will be hosted under the `/upload` path. After building the application, the files in this directory will be copied to the dist directory.
12
12
 
13
- This file convention is mainly used for developers to use plugins to upload static resource files to the CDN.
13
+ This file convention is mainly used for developers to use plugins to proactively upload static resource files to the CDN.
14
14
 
15
- ## Scene
15
+ ## Scenarios
16
16
 
17
- For example, the SDK used by the project such as `google-analysis.js` (usually requires http caching).
17
+ For example, SDKs for project use only, such as `google-analysis.js` (usually requires HTTP caching).
18
18
 
19
- Images, font files, generic CSS, etc.
19
+ Pictures, font files, common CSS, etc.
20
20
 
21
- ## Compression
21
+ ## Code Compression
22
22
 
23
- If the file is a `.js` file, it will be automatically compressed when the production environment is built.
23
+ If the file in the directory is a `.js` file, it will be automatically compressed during production environment construction.
24
24
 
25
- If the file ends with `.min.js`, it will not compression.
25
+ If the file ends with `.min.js`, it will not be compressed.
26
26
 
27
27
  ## More Usage
28
28
 
29
- In React components, this prefix can be added via [built-in environment variables](/guides/basic-features/env-vars.html#asset_prefix):
29
+ In React components, you can add this prefix through [Environment Variables](/guides/basic-features/env-vars.html#asset_prefix):
30
30
 
31
31
  ```tsx
32
32
  export default () => {
@@ -36,19 +36,19 @@ export default () => {
36
36
  };
37
37
  ```
38
38
 
39
- Whether in [custom HTML](/guides/basic-features/html), or in any HTML file under ['config/public/'](/apis/app/hooks/config/public), you can directly use the HTML tag to refer to the resources in the `config/upload/`:
39
+ In addition, whether it is in [Custom HTML](/guides/basic-features/html) or any HTML file under [`config/public/`](/apis/app/hooks/config/public), you can directly use HTML tags to reference resources in the `config/upload/` directory:
40
40
 
41
41
  ```html
42
42
  <script src="/upload/index.js"></script>
43
43
  ```
44
44
 
45
- if [`output.assetPrefix`](/configure/app/output/asset-prefix) is configured, add this prefix directly using template syntax:
45
+ If you set the [`dev.assetPrefix`](/configure/app/dev/asset-prefix) or [`output.assetPrefix`](/configure/app/output/asset-prefix) prefix, you can also use template syntax to add the prefix directly:
46
46
 
47
47
  ```html
48
48
  <script src="<%=assetPrefix %>/upload/index.js"></script>
49
49
  ```
50
50
 
51
51
  :::info
52
- Modern.js does not support the use files under `upload/` in `config/public/*.css` via URL.
52
+ Modern.js does not support using files under `config/upload/` through URLs in `config/public/*.css` (such as background-image).
53
53
 
54
54
  :::
@@ -1,9 +1,9 @@
1
1
  ---
2
- title: modern.config.js
2
+ title: modern.config.[tj]s
3
3
  sidebar_position: 8
4
4
  ---
5
- # modern.config.js
5
+ # modern.config.[tj]s
6
6
 
7
- Modern.js config file, through which you can confiured all aspects of the current project.
7
+ The Modern.js configuration file. Through this file, you can personalize the configuration of various aspects of the current project.
8
8
 
9
- For detail, see [configure](/configure/app/usage).
9
+ To learn more about how to use the configuration, please refer to [Configuration Usage](/configure/app/usage).
@@ -5,13 +5,6 @@ sidebar_position: 1
5
5
 
6
6
  # index.[tj]s
7
7
 
8
- A file that extends the Modern.js Web Server, to add a Hook or Middleware to the Web Server that the project uses.
8
+ A file that extends the Modern.js Web Server. You can add [Hooks](/apis/app/runtime/web-server/hook) or [Middleware](/apis/app/runtime/web-server/middleware) to the Web Server started by the application project in this file.
9
9
 
10
- It can intercept requests and responses, authenticate and role, request preprocessing, exception bottom-up, etc.;
11
-
12
- It can also be inserted logic into the built-in processing handler (including route matching, resource addressing, header injection, page rendering, static web hosting).
13
-
14
- :::info
15
- For detail, see [Hook](/apis/app/runtime/web-server/hook) & [Middleware](/apis/app/runtime/web-server/middleware).
16
-
17
- :::
10
+ You can intercept and process requests and responses, perform authentication and role verification, preprocess requests, and catch exceptions. You can also insert specific business logic into the built-in processing logic (including route matching, resource addressing, header injection, page rendering, and static web hosting).
@@ -2,11 +2,14 @@
2
2
  title: test.[tj]s
3
3
  sidebar_position: 2
4
4
  ---
5
+
5
6
  # test.[tj]s
6
7
 
7
- App's Web Server test file, support for writing test cases in the `server/` directory which file with suffix `.test.[tj]s`.
8
+ Custom Web Server test directory.
9
+
10
+ The application supports testing custom Web Server. You can directly create files with the suffix `.test.[tj]s` under the `server/` directory of the project to write test cases.
8
11
 
9
12
  :::info
10
- To use unit test and integration test, you need to execute the `new` command in advance to enable the `unit test/integration test`.
13
+ Enabling unit testing and integration testing requires running the `new` command to enable the "Unit Testing/Integration Testing" function under the project first.
11
14
 
12
15
  :::
@@ -4,4 +4,4 @@ sidebar_position: 5
4
4
  ---
5
5
  # shared/
6
6
 
7
- Shared directory. When the project has common code under `api/`, `server/`, `src/`, put the code under this directory rather then import directly.
7
+ Shared source code directory. When there is common code in `api/`, `server/`, and `src/` in the project, you can put these codes in the `shared` directory instead of directly referencing them.
@@ -4,51 +4,41 @@ sidebar_position: 1
4
4
  ---
5
5
  # App.[tj]sx
6
6
 
7
- Entry identifier if App want control route by code.
7
+ The identifier for the entry points when the application uses [Self-controlled Routing](/guides/basic-features/routes.html#self-controlled-routing).
8
8
 
9
- `App.[tj]sx` is not the actual App entry, Modern.js will auto generate the entry file, the content is roughly as follows:
9
+ `App.[tj]sx` is not the actual entry. Modern.js will generate the real entry for application. The content is roughly as follows:
10
10
 
11
11
  ```js
12
12
  import React from 'react';
13
+ import ReactDOM from 'react-dom/client';
13
14
  import { createApp, bootstrap } from '@modern-js/runtime';
14
15
  // App.[jt]sx
15
16
  import App from '@_modern_js_src/App';
16
- import { state } from '@modern-js/runtime/plugins';
17
- import {
18
- immer,
19
- effects,
20
- autoActions,
21
- devtools,
22
- } from '@modern-js/runtime/model';
23
-
24
- const createStatePlugins = config => {
25
- const plugins = [];
26
- plugins.push(immer(config['immer']));
27
- plugins.push(effects(config['effects']));
28
- plugins.push(autoActions(config['autoActions']));
29
- plugins.push(devtools(config['devtools']));
30
- return plugins;
31
- };
17
+ // runtime plugin
18
+ import { router } from '@modern-js/runtime/plugins';
19
+
20
+ const IS_BROWSER = typeof window !== 'undefined' && window.name !== 'nodejs';
21
+ const MOUNT_ID = 'root';
22
+
32
23
  let AppWrapper = null;
24
+
33
25
  function render() {
34
26
  AppWrapper = createApp({
35
27
  plugins: [
36
- state({
37
- ...{ plugins: createStatePlugins(true) },
38
- ...App?.config?.state,
39
- }),
40
- ],
41
- })(App);
28
+ router({...{"serverBase":["/"]}, ...App.config?.router}),
29
+ ]
30
+ })(App)
42
31
  if (IS_BROWSER) {
43
- bootstrap(AppWrapper, MOUNT_ID);
32
+ bootstrap(AppWrapper, MOUNT_ID, null, ReactDOM);
44
33
  }
45
- return AppWrapper;
34
+ return AppWrapper
46
35
  }
36
+
47
37
  AppWrapper = render();
48
38
  export default AppWrapper;
49
39
  ```
50
40
 
51
41
  :::note
52
- In multi-entry App, each entry can have a `App.[jt]sx`, for detail, see [Entry](/guides/concept/entries).
42
+ In the multi-entry scenario, each entry can have its own `App.[jt]sx`. See [Entries](/guides/concept/entries) for details.
53
43
 
54
44
  :::
@@ -4,13 +4,13 @@ sidebar_position: 4
4
4
  ---
5
5
  # index.[tj]s
6
6
 
7
- Entry identifier if App want use custom bootstrap. In most case, [`App.[tj]sx`](/apis/app/hooks/src/app) hook file can already meet our needs.
7
+ The identifier for the entry point when the application uses custom `bootstrap`.
8
8
 
9
- When we need to add custom behavior before `bootstrap` or completely take over the webpack entry, we can place `index.[tj]s` in `src/` or entry directory. The following are discussed in two cases:
9
+ In general, the [`App.[tj]sx`](/apis/app/hooks/src/app) hook file can already meet our needs. When we need to add custom behavior before `bootstrap` or completely take over the webpack packaging entry, we can place `index.[tj]s` in the `src` or entry directory. There are two cases below:
10
10
 
11
- 1. add custom behavior before bootstrap
11
+ ## Add custom behavior before bootstrap
12
12
 
13
- Just add default export under `src/index.[tj]s`:
13
+ Just export a function in `src/index.[tj]s`:
14
14
 
15
15
  ```js title=src/index.js
16
16
  import { bootstrap } from '@modern-js/runtime';
@@ -21,9 +21,9 @@ export default App => {
21
21
  };
22
22
  ```
23
23
 
24
- 2. Fully take over the webpack entry
24
+ ## Completely take over the webpack entry
25
25
 
26
- When there is no default export function under `src/index.[tj]sx?`, this file is the real webpack entry file, and the code can be organized such as create-react-app:
26
+ When there is no default export function in `src/index.[tj]sx?`, the file is the real webpack packaging entry file and the code can be organized directly as using create-react-app and other scaffolding tools:
27
27
 
28
28
  ```js title=src/index.jsx
29
29
  import React from 'react';