@modern-js/main-doc 2.21.1 → 2.22.1

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 (292) hide show
  1. package/CHANGELOG.md +42 -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/debug-app.mdx +1 -1
  28. package/docs/en/components/deploy.mdx +1 -0
  29. package/docs/en/components/entry-mode.mdx +0 -0
  30. package/docs/en/components/init-app.mdx +6 -10
  31. package/docs/en/components/init-rspack-app.mdx +4 -4
  32. package/docs/en/components/language-config.mdx +9 -0
  33. package/docs/en/components/package-manager.mdx +11 -0
  34. package/docs/en/components/release-note.mdx +1 -0
  35. package/docs/en/components/ua-polyfill.mdx +2 -2
  36. package/docs/en/configure/app/output/css-modules.mdx +13 -0
  37. package/docs/en/configure/app/source/config-dir.mdx +1 -1
  38. package/docs/en/configure/app/source/design-system.mdx +67 -67
  39. package/docs/en/configure/app/source/disable-default-entries.mdx +6 -5
  40. package/docs/en/configure/app/source/disable-entry-dirs.mdx +5 -5
  41. package/docs/en/configure/app/source/enable-async-entry.mdx +9 -9
  42. package/docs/en/configure/app/source/entries-dir.mdx +3 -3
  43. package/docs/en/configure/app/source/entries.mdx +21 -19
  44. package/docs/en/configure/app/tools/swc.mdx +2 -16
  45. package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -2
  46. package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
  47. package/docs/en/guides/advanced-features/bff/type.mdx +5 -5
  48. package/docs/en/guides/advanced-features/rspack-start.mdx +7 -8
  49. package/docs/en/guides/advanced-features/ssg.mdx +2 -2
  50. package/docs/en/guides/advanced-features/testing.mdx +2 -2
  51. package/docs/en/guides/advanced-features/web-server.mdx +2 -2
  52. package/docs/en/guides/basic-features/css.mdx +2 -2
  53. package/docs/en/guides/basic-features/mock.mdx +1 -1
  54. package/docs/en/guides/basic-features/routes.mdx +11 -7
  55. package/docs/en/guides/concept/builder.mdx +15 -15
  56. package/docs/en/guides/concept/entries.mdx +50 -49
  57. package/docs/en/guides/get-started/glossary.mdx +12 -12
  58. package/docs/en/guides/get-started/introduction.mdx +17 -20
  59. package/docs/en/guides/get-started/quick-start.mdx +21 -37
  60. package/docs/en/guides/get-started/upgrade.mdx +15 -13
  61. package/docs/en/guides/topic-detail/changesets/_category_.json +4 -0
  62. package/docs/en/guides/topic-detail/changesets/add.mdx +125 -0
  63. package/docs/en/guides/topic-detail/changesets/changelog.mdx +238 -0
  64. package/docs/en/guides/topic-detail/changesets/commit.mdx +269 -0
  65. package/docs/en/guides/topic-detail/changesets/config.mdx +147 -0
  66. package/docs/en/guides/topic-detail/changesets/github.mdx +175 -0
  67. package/docs/en/guides/topic-detail/changesets/introduce.mdx +56 -0
  68. package/docs/en/guides/topic-detail/changesets/release-note.mdx +273 -0
  69. package/docs/en/guides/topic-detail/changesets/release-pre.mdx +49 -0
  70. package/docs/en/guides/topic-detail/changesets/release.mdx +229 -0
  71. package/docs/en/guides/topic-detail/generator/create/_category_.json +4 -0
  72. package/docs/en/guides/topic-detail/generator/create/config.mdx +75 -0
  73. package/docs/en/guides/topic-detail/generator/create/option.md +151 -0
  74. package/docs/en/guides/topic-detail/generator/create/use.mdx +66 -0
  75. package/docs/en/guides/topic-detail/generator/new/_category_.json +4 -0
  76. package/docs/en/guides/topic-detail/generator/new/config.md +155 -0
  77. package/docs/en/guides/topic-detail/generator/new/option.md +67 -0
  78. package/docs/en/guides/topic-detail/generator/new/use.md +95 -0
  79. package/docs/en/guides/topic-detail/generator/plugin/_category_.json +2 -2
  80. package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  81. package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +49 -0
  82. package/docs/en/guides/topic-detail/generator/plugin/api/context.md +184 -0
  83. package/docs/en/guides/topic-detail/generator/plugin/api/input.md +124 -0
  84. package/docs/en/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  85. package/docs/en/guides/topic-detail/generator/plugin/category.md +88 -0
  86. package/docs/en/guides/topic-detail/generator/plugin/context.md +104 -0
  87. package/docs/en/guides/topic-detail/generator/plugin/structure.md +106 -0
  88. package/docs/en/guides/topic-detail/generator/plugin/use.md +33 -0
  89. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +8 -8
  90. package/docs/en/guides/troubleshooting/builder.mdx +8 -0
  91. package/docs/en/tutorials/first-app/c03-css.mdx +2 -2
  92. package/docs/en/tutorials/first-app/c08-entries.mdx +3 -3
  93. package/docs/zh/apis/app/commands.mdx +3 -3
  94. package/docs/zh/apis/app/hooks/api/{functions/api.mdx → api.mdx} +4 -4
  95. package/docs/zh/apis/app/hooks/api/app.mdx +12 -0
  96. package/docs/zh/apis/app/hooks/api/{framework/lambda.mdx → lambda.mdx} +5 -5
  97. package/docs/zh/apis/app/hooks/api/test.mdx +3 -3
  98. package/docs/zh/apis/app/hooks/config/icon.mdx +15 -15
  99. package/docs/zh/apis/app/hooks/config/mock.mdx +1 -1
  100. package/docs/zh/apis/app/hooks/config/public.mdx +3 -3
  101. package/docs/zh/apis/app/hooks/config/upload.mdx +1 -1
  102. package/docs/zh/apis/app/hooks/modern-config.mdx +3 -3
  103. package/docs/zh/apis/app/hooks/server/index_.mdx +1 -6
  104. package/docs/zh/apis/app/hooks/shared.mdx +1 -1
  105. package/docs/zh/apis/app/hooks/src/app.mdx +15 -25
  106. package/docs/zh/apis/app/hooks/src/index_.mdx +6 -6
  107. package/docs/zh/apis/app/hooks/src/pages.mdx +7 -3
  108. package/docs/zh/apis/app/hooks/src/routes.mdx +4 -4
  109. package/docs/zh/apis/app/hooks/src/stories.mdx +1 -1
  110. package/docs/zh/apis/app/runtime/core/use-runtime-context.mdx +5 -1
  111. package/docs/zh/community/blog/v2-release-note.mdx +1 -1
  112. package/docs/zh/community/contributing-guide.mdx +1 -1
  113. package/docs/zh/components/entry-mode.mdx +0 -0
  114. package/docs/zh/components/init-app.mdx +5 -9
  115. package/docs/zh/components/language-config.mdx +9 -0
  116. package/docs/zh/components/package-manager.mdx +11 -0
  117. package/docs/zh/components/ua-polyfill.mdx +1 -1
  118. package/docs/zh/configure/app/output/css-modules.mdx +13 -0
  119. package/docs/zh/configure/app/source/design-system.mdx +3 -4
  120. package/docs/zh/configure/app/source/enable-async-entry.mdx +2 -5
  121. package/docs/zh/configure/app/source/entries.mdx +2 -2
  122. package/docs/zh/configure/app/tools/swc.mdx +2 -16
  123. package/docs/zh/guides/advanced-features/rspack-start.mdx +7 -8
  124. package/docs/zh/guides/advanced-features/ssg.mdx +1 -1
  125. package/docs/zh/guides/advanced-features/testing.mdx +2 -2
  126. package/docs/zh/guides/advanced-features/web-server.mdx +1 -1
  127. package/docs/zh/guides/basic-features/css.mdx +1 -1
  128. package/docs/zh/guides/basic-features/mock.mdx +1 -1
  129. package/docs/zh/guides/basic-features/routes.mdx +7 -4
  130. package/docs/zh/guides/concept/builder.mdx +1 -1
  131. package/docs/zh/guides/concept/entries.mdx +21 -17
  132. package/docs/zh/guides/get-started/quick-start.mdx +7 -10
  133. package/docs/zh/guides/get-started/upgrade.mdx +1 -1
  134. package/docs/zh/guides/topic-detail/changesets/add.mdx +15 -13
  135. package/docs/zh/guides/topic-detail/changesets/changelog.mdx +20 -20
  136. package/docs/zh/guides/topic-detail/changesets/commit.mdx +12 -14
  137. package/docs/zh/guides/topic-detail/changesets/config.mdx +5 -5
  138. package/docs/zh/guides/topic-detail/changesets/github.mdx +38 -27
  139. package/docs/zh/guides/topic-detail/changesets/introduce.mdx +12 -12
  140. package/docs/zh/guides/topic-detail/changesets/release-note.mdx +84 -70
  141. package/docs/zh/guides/topic-detail/changesets/release-pre.mdx +9 -9
  142. package/docs/zh/guides/topic-detail/changesets/release.mdx +29 -29
  143. package/docs/zh/guides/topic-detail/generator/create/_category_.json +4 -0
  144. package/docs/zh/guides/topic-detail/generator/create/config.mdx +76 -0
  145. package/docs/zh/guides/topic-detail/generator/create/option.md +151 -0
  146. package/docs/zh/guides/topic-detail/generator/create/use.mdx +66 -0
  147. package/docs/zh/guides/topic-detail/generator/new/_category_.json +4 -0
  148. package/docs/zh/guides/topic-detail/generator/new/config.md +153 -0
  149. package/docs/zh/guides/topic-detail/generator/new/option.md +67 -0
  150. package/docs/zh/guides/topic-detail/generator/new/use.md +94 -0
  151. package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +2 -2
  152. package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  153. package/docs/zh/guides/topic-detail/generator/plugin/api/afterForged.md +50 -0
  154. package/docs/zh/guides/topic-detail/generator/plugin/api/context.md +184 -0
  155. package/docs/zh/guides/topic-detail/generator/plugin/api/input.md +124 -0
  156. package/docs/zh/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  157. package/docs/zh/guides/topic-detail/generator/plugin/category.md +93 -0
  158. package/docs/zh/guides/topic-detail/generator/plugin/context.md +105 -0
  159. package/docs/zh/guides/topic-detail/generator/plugin/structure.md +106 -0
  160. package/docs/zh/guides/topic-detail/generator/plugin/use.md +33 -0
  161. package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +4 -4
  162. package/docs/zh/guides/topic-detail/model/test-model.mdx +1 -1
  163. package/docs/zh/guides/troubleshooting/builder.mdx +8 -0
  164. package/docs/zh/tutorials/first-app/c03-css.mdx +1 -1
  165. package/docs/zh/tutorials/first-app/c08-entries.mdx +1 -1
  166. package/package.json +5 -5
  167. package/docs/en/apis/app/hooks/api/framework/_category_.json +0 -4
  168. package/docs/en/apis/app/hooks/api/framework/lambda.mdx +0 -57
  169. package/docs/en/apis/app/hooks/api/functions/_category_.json +0 -4
  170. package/docs/en/apis/app/hooks/api/functions/api.mdx +0 -81
  171. package/docs/en/apis/app/hooks/api/functions/app.mdx +0 -12
  172. package/docs/en/apis/app/hooks/api/functions/common.mdx +0 -9
  173. package/docs/en/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  174. package/docs/en/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  175. package/docs/en/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  176. package/docs/en/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  177. package/docs/en/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  178. package/docs/en/guides/topic-detail/generator/codesmith/api/git.mdx +0 -50
  179. package/docs/en/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -57
  180. package/docs/en/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  181. package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
  182. package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  183. package/docs/en/guides/topic-detail/generator/codesmith/introduce.mdx +0 -47
  184. package/docs/en/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  185. package/docs/en/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  186. package/docs/en/guides/topic-detail/generator/config/_category_.json +0 -4
  187. package/docs/en/guides/topic-detail/generator/config/app.mdx +0 -82
  188. package/docs/en/guides/topic-detail/generator/config/common.mdx +0 -100
  189. package/docs/en/guides/topic-detail/generator/config/module.mdx +0 -42
  190. package/docs/en/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  191. package/docs/en/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  192. package/docs/en/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  193. package/docs/en/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  194. package/docs/en/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  195. package/docs/en/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -58
  196. package/docs/en/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  197. package/docs/en/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  198. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  199. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  200. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  201. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  202. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  203. package/docs/en/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  204. package/docs/en/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  205. package/docs/en/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  206. package/docs/en/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  207. package/docs/en/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  208. package/docs/en/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  209. package/docs/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  210. package/docs/en/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  211. package/docs/en/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  212. package/docs/en/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  213. package/docs/en/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  214. package/docs/en/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  215. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
  216. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
  217. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  218. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -31
  219. package/docs/en/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  220. package/docs/en/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -90
  221. package/docs/en/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  222. package/docs/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  223. package/docs/en/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  224. package/docs/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  225. package/docs/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  226. package/docs/en/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  227. package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
  228. package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  229. package/docs/en/guides/topic-detail/generator/plugin/use.mdx +0 -61
  230. package/docs/en/guides/topic-detail/generator/project.mdx +0 -118
  231. package/docs/zh/apis/app/hooks/api/framework/_category_.json +0 -4
  232. package/docs/zh/apis/app/hooks/api/functions/_category_.json +0 -4
  233. package/docs/zh/apis/app/hooks/api/functions/app.mdx +0 -12
  234. package/docs/zh/apis/app/hooks/api/functions/common.mdx +0 -9
  235. package/docs/zh/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  236. package/docs/zh/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  237. package/docs/zh/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  238. package/docs/zh/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  239. package/docs/zh/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  240. package/docs/zh/guides/topic-detail/generator/codesmith/api/git.mdx +0 -49
  241. package/docs/zh/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -56
  242. package/docs/zh/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  243. package/docs/zh/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -47
  244. package/docs/zh/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  245. package/docs/zh/guides/topic-detail/generator/codesmith/introduce.mdx +0 -59
  246. package/docs/zh/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  247. package/docs/zh/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  248. package/docs/zh/guides/topic-detail/generator/config/_category_.json +0 -4
  249. package/docs/zh/guides/topic-detail/generator/config/app.mdx +0 -82
  250. package/docs/zh/guides/topic-detail/generator/config/common.mdx +0 -100
  251. package/docs/zh/guides/topic-detail/generator/config/module.mdx +0 -42
  252. package/docs/zh/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  253. package/docs/zh/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  254. package/docs/zh/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  255. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  256. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  257. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -55
  258. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  259. package/docs/zh/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  260. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  261. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  262. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  263. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  264. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  265. package/docs/zh/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  266. package/docs/zh/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  267. package/docs/zh/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  268. package/docs/zh/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  269. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  270. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  271. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  272. package/docs/zh/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  273. package/docs/zh/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  274. package/docs/zh/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  275. package/docs/zh/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  276. package/docs/zh/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  277. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -57
  278. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -56
  279. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  280. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -29
  281. package/docs/zh/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  282. package/docs/zh/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -92
  283. package/docs/zh/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  284. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  285. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  286. package/docs/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  287. package/docs/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  288. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  289. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -16
  290. package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  291. package/docs/zh/guides/topic-detail/generator/plugin/use.mdx +0 -61
  292. package/docs/zh/guides/topic-detail/generator/project.mdx +0 -118
@@ -19,23 +19,9 @@ When using Rspack as the bundler, SWC will be used for transpiling and compressi
19
19
 
20
20
  ## Install
21
21
 
22
- First, you need to execute `pnpm run new` to enable the SWC compile:
22
+ import EnableSWC from '@modern-js/builder-doc/docs/en/shared/enable-swc.md';
23
23
 
24
- ```bash
25
- ? Action: Enable features
26
- ? Enable features: Enable SWC Compile
27
- ```
28
-
29
- After the installation, please register the SWC plugin in the `modern.config.ts` file, then the SWC compilation and compression will be enabled.
30
-
31
- ```ts title="modern.config.ts"
32
- import appTools, { defineConfig } from '@modern-js/app-tools';
33
- import swcPlugin from '@modern-js/plugin-swc';
34
-
35
- export default defineConfig({
36
- plugins: [appTools(), swcPlugin()],
37
- });
38
- ```
24
+ <EnableSWC />
39
25
 
40
26
  ## Config
41
27
 
@@ -6,7 +6,7 @@ title: Frameworks
6
6
 
7
7
  Modern.js's BFF supports different runtime frameworks, currently Modern.js's BFF supports two runtime frameworks[Express.js](https://expressjs.com/) 和 [Koa.js](https://koajs.com/).
8
8
 
9
- ## Function Writing
9
+ ## Function Mode
10
10
 
11
11
  Under the function writing, only the middleware writing method of various runtime frameworks is different, and other implementations are basically the same. Take Express as an example to introduce how to write a middleware by hand in the `api/_ app.ts` and add permission verification:
12
12
 
@@ -96,7 +96,7 @@ Refresh the page and you can see that `/api/hello` was accessed successfully:
96
96
 
97
97
  The above code simulates the way to add middleware to the `/api/_app.ts` to achieve an easy login function. Also, other functions can be implemented in this hook file to extend BFF Server.
98
98
 
99
- ## Framework Writing
99
+ ## Framework Mode
100
100
 
101
101
  Under the framework writing, Modern.js does not collect middleware in the `api/_app.ts`, and the running process is controlled by the plugin itself.
102
102
 
@@ -51,10 +51,10 @@ Execute `pnpm run dev`, then open `http://localhost:8080/` to see that the page
51
51
 
52
52
  In Modern.js, the BFF function routing system is implemented based on the file system, and it is also a conventional routing system.
53
53
 
54
- In **Function Writing**, All files under `api/` will map to an interface. In **Framework Writing**, All files under `api/lambda` will map to an interface
54
+ In **Function Mode**, All files under `api/` will map to an interface. In **Framework Mode**, All files under `api/lambda` will map to an interface
55
55
 
56
56
  :::note
57
- Function Writing & Framework Writing will introduce soon.
57
+ Function Mode & Framework Mode will introduce soon.
58
58
 
59
59
  :::
60
60
 
@@ -69,14 +69,14 @@ Files named `index.[jt]s` are mapped to the previous directory.
69
69
  - `api/index.ts` -> `{prefix}/`
70
70
  - `api/user/index.ts` -> `{prefix}/user`
71
71
 
72
- ### Multi-layer Route
72
+ ### Multi-layer Routing
73
73
 
74
74
  Supports parsing nested files, if you create a nested folder structure, the files will still automatically parse routes in the same way.
75
75
 
76
76
  - `api/hello.ts` -> `{prefix}/hello`
77
77
  - `api/user/list.ts` -> `{prefix}/user/list`
78
78
 
79
- ### Dynamic Route
79
+ ### Dynamic Routing
80
80
 
81
81
  Create folders or files named with `[xxx]` to support dynamic named routing parameters.
82
82
 
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  sidebar_position: 2
3
- title: Writing Type
3
+ title: BFF Type
4
4
  ---
5
- # Writing Type
5
+ # BFF Type
6
6
 
7
7
  Runtime framework support is also an important part of **BFF**. Modern.js supports extending BFF's runtime framework through plugins, and provides a series of built-in plugins, developers can directly use the conventions and ecology of the framework.
8
8
 
9
- The plugin is compatible with most of the specifications of these frameworks, and each framework needs to provide two types of ways to extend the writing of BFF functions, namely **Function Writing** and **Framework Writing**.
9
+ The plugin is compatible with most of the specifications of these frameworks, and each framework needs to provide two types of ways to extend the writing of BFF functions, namely **Function Mode** and **Framework Mode**.
10
10
 
11
11
  :::note
12
12
  Whether the current `api/` directory structure is written as a framework is determined by the corresponding plugin, Modern.js don't care.
13
13
 
14
14
  :::
15
15
 
16
- ## Function Writing
16
+ ## Function Mode
17
17
 
18
18
  When the plugin considers that it is currently written as a function, it must support writing middleware in the `api/_ app.ts` to extend the BFF function.
19
19
 
@@ -32,7 +32,7 @@ The writing of middleware for different plugins is not the same, see [Runtime Fr
32
32
 
33
33
  :::
34
34
 
35
- ## Framework Writing
35
+ ## Framework Mode
36
36
 
37
37
  Framework writing is a way of using frame structure to extend BFF functions. Compared with function writing, although frame writing can use more frame structure and make the entire BFF Server clearer in complex scenarios, it is also more complex and requires more attention to the content at the framework level.
38
38
 
@@ -30,14 +30,14 @@ When using Rspack as the bundler, the following Features are temporarily unavail
30
30
 
31
31
  :::
32
32
 
33
- ## Migrating from webpack to Rspack
33
+ ## Enable Rspack build
34
34
 
35
35
  You can enable Rspack build by running `pnpm run new`:
36
36
 
37
37
  ```bash
38
38
  $ pnpm run new
39
- ? Action: Enable features
40
- ? Enable features: Enable Rspack Build
39
+ ? Please select the operation you want: Enable features
40
+ ? Please select the feature name: Enable Rspack Build
41
41
  ```
42
42
 
43
43
  After executing the command, enable the Rspack build in `modern.config.ts`:
@@ -54,9 +54,9 @@ import appTools, { defineConfig } from '@modern-js/app-tools';
54
54
  });
55
55
  ```
56
56
 
57
- :::tip
58
- When migrating from webpack to Rspack, there may have some differences in build and configuration capabilities. For more details, please refer to [Configuration Differences](https://modernjs.dev/builder/en/guide/advanced/rspack-start.html#migrating-from-webpack-to-rspack).
59
- :::
57
+ ## Migrating configuration
58
+
59
+ After enabling Rspack building capability, further configuration migration is needed by referring to the [Configuration Differences](https://modernjs.dev/builder/en/guide/advanced/rspack-start.html#migrating-from-webpack-to-rspack).
60
60
 
61
61
  ## The relationship between Rspack and Modern.js versions
62
62
 
@@ -81,8 +81,7 @@ For example, if you are using pnpm, you can update the Rspack version with `over
81
81
  "@rspack/core": "nightly",
82
82
  "@rspack/dev-client": "nightly",
83
83
  "@rspack/dev-middleware": "nightly",
84
- "@rspack/plugin-html": "nightly",
85
- "@rspack/postcss-loader": "nightly"
84
+ "@rspack/plugin-html": "nightly"
86
85
  }
87
86
  }
88
87
  }
@@ -9,8 +9,8 @@ Static Site Generation is a solution for rendering complete static web pages at
9
9
  First need to execute `pnpm run new` to enable the SSG features:
10
10
 
11
11
  ```bash
12
- ? Action Enable features
13
- ? Enable features Enable SSG
12
+ ? Please select the operation you want: Enable features
13
+ ? Please select the feature name: Enable SSG
14
14
  ```
15
15
 
16
16
  After execute script, register SSG plugin in `modern.config.ts`:
@@ -9,8 +9,8 @@ Modern.js integrates the testing capabilities of [Jest](https://jestjs.io/) by d
9
9
  First need to execute `pnpm run new` enable [unit test/integration test] features:
10
10
 
11
11
  ```
12
- ? Action: Enable features
13
- ? Enable features: Enable Unit Test / Integration Test
12
+ ? Please select the operation you want: Enable features
13
+ ? Please select the feature name: Enable Unit Test / Integration Test
14
14
  ```
15
15
 
16
16
  After executing the above command, the `"test": "modern test"` command will be automatically generated in package.json.
@@ -27,8 +27,8 @@ Because the full web server cannot be controlled this way, and the extension log
27
27
  You can execute the'pnpm run new 'command in the project root directory to enable the "Custom Web Serve" function:
28
28
 
29
29
  ```bash
30
- ? Action Create project element
31
- ? New "Custom Web Server" source code directory
30
+ ? Please select the operation you want: Create Element
31
+ ? Please select the type of element to create: New "Custom Web Server" source code directory
32
32
  ```
33
33
 
34
34
  After executing the command, register the `@modern-js/plugin-server` plugin in `modern.config.ts`:
@@ -66,8 +66,8 @@ If you need to use other CSS-in-JS libraries such as [styled-jsx](https://www.np
66
66
  Follow the steps below to make a selection:
67
67
 
68
68
  ```bash
69
- ? Action: Enable features
70
- ? Enable features: Enable Tailwind CSS
69
+ ? Please select the operation you want: Enable features
70
+ ? Please select the feature name: Enable Tailwind CSS
71
71
  ```
72
72
 
73
73
  Register the Tailwind plugin in `modern.config.ts`:
@@ -32,7 +32,7 @@ export default {
32
32
  /* the default method is GET */
33
33
  '/api/getExample': { id: 1 },
34
34
 
35
- /* You can use custom functions to dynamically return data */
35
+ /* You can use custom functions to dynamically return data, req and res are both Node.js HTTP objects. */
36
36
  'POST /api/addInfo': (req, res, next) => {
37
37
  res.setHeader('Access-Control-Allow-Origin', '*');
38
38
  res.end('200');
@@ -182,7 +182,7 @@ Routes generated from file directories named with `[$]` will be treated as dynam
182
182
 
183
183
  The `routes/user/[id$]/page.tsx` file will be converted to the `/user/:id?` route. All routes under `/user` will match this route, and the `id` parameter is optional. This route is usually used to distinguish between **creation** and **editing**.
184
184
 
185
- In the component, you can use [useParams](/apis/app/runtime/router/router#useparams) to obtain the corresponding named parameter.
185
+ In the component, you can use [useParams](/apis/app/runtime/router/router#useparams) to get the corresponding named parameter.
186
186
 
187
187
  In the loader, params will be passed as the input parameter of the [loader function](/guides/basic-features/data-fetch#loader-function), and you can get the parameter value through `params.xxx`.
188
188
 
@@ -191,7 +191,7 @@ In the loader, params will be passed as the input parameter of the [loader funct
191
191
  If you create a `$.tsx` file under the routes directory, it will be treated as the catch-all routing component. When there is no matching route, this component will be rendered.
192
192
 
193
193
  :::note
194
- `$.tsx` can be considered as a special `page` route component. When there is a `layout` component in the current directory, `$.tsx` will be rendered as a child component of `layout`.
194
+ `$.tsx` can be considered as a special `page` route component. When there is a `layout.tsx` file in the current directory, `$.tsx` will be rendered as a child component of `layout`.
195
195
  :::
196
196
 
197
197
  For example, the following directory structure:
@@ -215,7 +215,7 @@ params['*']; // => 'aaa/bbb'
215
215
 
216
216
  ### No-path Layout
217
217
 
218
- When the directory name starts with `__`, the corresponding directory name will not be converted to an actual route path. For example, the following file directory:
218
+ When the directory name starts with `__`, the directory name will not be converted to an actual route path. For example, the following file directory:
219
219
 
220
220
  ```bash
221
221
  .
@@ -449,7 +449,7 @@ However, this also brings a problem: if the chunk corresponding to the route has
449
449
 
450
450
  In this case, you can define a `Loading` component to display a custom `Loading` component before the static resources are loaded.
451
451
 
452
- To further improve the user experience and reduce loading time, Modern.js supports defining the `prefetch` attribute on the Link component to preload static resources and data. The `prefetch` attribute has three optional values:
452
+ To further improve the user experience and reduce loading time, Modern.js supports defining the `prefetch` attribute on the Link component to preload static resources and data.
453
453
 
454
454
  ```tsx
455
455
  <Link prefetch="intent" to="page">
@@ -461,6 +461,8 @@ To further improve the user experience and reduce loading time, Modern.js suppor
461
461
 
462
462
  :::
463
463
 
464
+ The `prefetch` attribute has three optional values:
465
+
464
466
  - `none`: default value, no prefetching, no additional behavior.
465
467
  - `intent`: This is the value we recommend for most scenarios. When you hover over the Link, the corresponding chunk and data defined in the data loader will be loaded automatically. When you move the mouse away, the loading will be cancelled automatically. In our tests, even fast clicks can reduce loading time by about 200ms.
466
468
  - `render`: The corresponding chunk and data defined in the Data Loader will be loaded when the Link component is rendered.
@@ -504,8 +506,6 @@ export default () => {
504
506
  Modern.js provides a series of optimizations for resource loading and rendering for conventional routing by default, and provides out-of-the-box SSR capabilities. When using self-controlled routing, developers need to encapsulate these capabilities themselves. It is recommended to use conventional routing.
505
507
  :::
506
508
 
507
- When using self-controlled routing, if the developer turns off the [`runtime.router`](/configure/app/runtime/router) configuration and uses `react-router-dom` directly, they also need to wrap it according to the React Router documentation.
508
-
509
509
  ## Other
510
510
 
511
511
  By default, Modern.js will enable the built-in routing scheme, which is React Router.
@@ -518,7 +518,9 @@ export default defineConfig({
518
518
  });
519
519
  ```
520
520
 
521
- Modern.js exposes the API of React Router from the `@modern-js/runtime/router` namespace for developers to use, ensuring that developers and Modern.js use the same code. In addition, in this case, the React Router code will be bundled into the JS output. If the project already has its own routing scheme or does not need to use client-side routing, this feature can be turned off.
521
+ As mentioned above, when the [`runtime.router`](/configure/app/runtime/router) configuration is enabled, Modern.js will export the API of React Router from the `@modern-js/runtime/router` namespace for developers to use, ensuring that developers and Modern.js are using the same code, and automatically wrapping the `Provider` component according to the router configuration. In addition, in this case, the code of React Router will be packed into the JS output.
522
+
523
+ If the project already has its own routing plan or does not need to use client-side routing, this feature can be disabled.
522
524
 
523
525
  ```js
524
526
  export default defineConfig({
@@ -527,3 +529,5 @@ export default defineConfig({
527
529
  },
528
530
  });
529
531
  ```
532
+
533
+ As mentioned above, if the [`runtime.router`](/configure/app/runtime/router) configuration is disabled and `react-router-dom` is used directly for project routing management, the `Provider` needs to be wrapped according to the React Router documentation.
@@ -4,31 +4,31 @@ sidebar_position: 2
4
4
 
5
5
  # Builder
6
6
 
7
- **Modern.js uses [Modern.js Builder](https://modernjs.dev/builder) to build your Web App.**
7
+ **Modern.js uses [Modern.js Builder](https://modernjs.dev/builder/en) to build your Web App.**
8
8
 
9
- Modern.js Builder is one of the core components of Modern.js. It is A build engine for web development. and can be used independently of Modern.js. Modern.js Builder supports multiple bundlers such as webpack and Rspack, and it uses webpack by default.
9
+ Modern.js Builder is one of the core components of the Modern.js system. It is a build engine for web development scenarios that can be used independently of Modern.js. Modern.js Builder supports multiple bundlers such as webpack and Rspack, and by default uses the most mature webpack for bundling.
10
10
 
11
11
  ## Build Architecture
12
12
 
13
- From the perspective of building, Modern.js is divided into three layers, from top to bottom:
13
+ From a building perspective, Modern.js is divided into three layers, from top to bottom:
14
14
 
15
- - Upper-layer framework: Modern.js.
16
- - Universal build engine: Modern.js Builder.
17
- - Low-level bundlers: webpack and rspack.
15
+ - Upper-level development framework: Modern.js.
16
+ - Common build engine: Modern.js Builder.
17
+ - Low-level bundler: webpack and Rspack.
18
18
 
19
19
  <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## Builder Documentation
22
22
 
23
- Since Modern.js Builder is a module that can be used independently, we provide a separate document for it, the site address is: [modernjs.dev/builder](https://modernjs.dev/builder).
23
+ Since Modern.js Builder is a module that can be used independently, we have provided separate documentation for it, which can be found at [modernjs.dev/builder](https://modernjs.dev/builder/en).
24
24
 
25
- In this document, you can learn about the detailed introduction of Modern.js Builder, and you can also find a complete usage guide for each building features. When you encounter building issues, it is recommended that you first read the Modern.js Builder documentation to solve them.
25
+ In this documentation, you can learn about the detailed introduction of Modern.js Builder, and you can also find complete usage guides for various building capabilities. If you have any building needs or problems, it is recommended that you read the Modern.js Builder documentation first to solve them.
26
26
 
27
- ## Builder Config
27
+ ## Builder Configuration
28
28
 
29
- The config of Modern.js is inherited from Modern.js Builder, so you can use all build configs provided by Modern.js Builder in Modern.js.
29
+ Modern.js's configuration inherits from Modern.js Builder, so you can use all the build configurations provided by Modern.js Builder in Modern.js.
30
30
 
31
- Take the `html.title` config of Modern.js Builder as an example, you can directly use this config in the `modern.config.ts` file, and it will be automatically passed to Modern.js Builder.
31
+ Taking the `html.title` config option of Modern.js Builder as an example, you can directly use this option in the `modern.config.ts` file, and it will be automatically passed to Modern.js Builder.
32
32
 
33
33
  ```ts title="modern.config.js"
34
34
  export default defineConfig({
@@ -38,10 +38,10 @@ export default defineConfig({
38
38
  });
39
39
  ```
40
40
 
41
- For details of building configs, please refer to [「Modern.js Builder - Builder Config」](https://modernjs.dev/builder/en/guide/basic/builder-config.html).
41
+ For detailed information about build configuration, please refer to [「Modern.js Builder - Builder Config」](https://modernjs.dev/builder/en/guide/basic/builder-config.html).
42
42
 
43
- ## Building Features
43
+ ## Builder Capabilities
44
44
 
45
- Modern.js Builder provides a wealth of building features, including dozens of features such as JavaScript compilation, CSS compilation, static resource processing, hot module replacement, code compression, and TS type checking.
45
+ Modern.js Builder provides rich build capabilities, including JavaScript compilation, CSS compilation, static resource processing, code hot update, code compression, TS type checking, and dozens of other capabilities.
46
46
 
47
- We recommend you to read [「Modern.js Builder - All Features」](https://modernjs.dev/builder/en/guide/features.html) to learn all the building features provided by Modern.js Builder.
47
+ We recommend that you read [「Modern.js Builder - All Features」](https://modernjs.dev/builder/en/guide/features.html) to learn about all the features provided by Modern.js Builder.
@@ -2,21 +2,21 @@
2
2
  sidebar_position: 1
3
3
  ---
4
4
 
5
- # Entries
5
+ # Entry
6
6
 
7
- Through this chapter, you can learn about the entry convention in Modern.js and how to customize the entry.
7
+ In this chapter, you will learn about the entry convention in Modern.js and how to customize it.
8
8
 
9
- ## What is an Entry
9
+ ## What is Entry?
10
10
 
11
- **Entry is the starting module of a page.**
11
+ **Entry refers to the starting module of a page.**
12
12
 
13
- In the Modern.js project, each entry corresponds to an independent page, and also corresponds to a server route. By default, Modern.js will automatically determine the entry of the page based on the directory convention, and also supports customizing the entry through configuration items.
13
+ In a Modern.js project, each entry corresponds to an independent page and a server-side route. By default, Modern.js automatically determines the entry of a page based on directory conventions, but also supports customizing the entry through configuration options.
14
14
 
15
- Many configuration items provided by Modern.js are divided by entry, such as page title, HTML template, page Meta information, whether to enable SSR/SSG, server-side routing rules, etc.
15
+ Many configuration options provided by Modern.js are divided by entry, such as page title, HTML template, page meta information, whether to enable SSR/SSG, server-side routing rules, etc.
16
16
 
17
17
  ## Single Entry and Multiple Entries
18
18
 
19
- The project initialized by Modern.js is single-entry (SPA), and the project structure is as follows:
19
+ The project initialized by Modern.js is a single entry (SPA) project, with the following structure:
20
20
 
21
21
  ```
22
22
  .
@@ -30,15 +30,15 @@ The project initialized by Modern.js is single-entry (SPA), and the project stru
30
30
  └── tsconfig.json
31
31
  ```
32
32
 
33
- Modern.js can easily switch from single entry to multiple entry. You can execute `pnpm run new` under the project to create entry through generator:
33
+ In a Modern.js project, you can easily switch from single entry to multiple entries by running `pnpm run new` in the project directory and creating an entry:
34
34
 
35
35
  ```bash
36
- ? Action: Create project element
37
- ? Create project element: New "entry"
38
- ? Entry name: new-entry
36
+ ? Please select the operation you want: Create Element
37
+ ? Please select the type of element to create: New "entry"
38
+ ? Please fill in the entry name: new-entry
39
39
  ```
40
40
 
41
- After execution, Modern.js will automatically generate a new entry directory, and you can see that the `src/` directory has the following structure:
41
+ After running the command, Modern.js will automatically generate a new entry directory. At this point, you can see that the `src/` directory has the following structure:
42
42
 
43
43
  ```bash
44
44
  .
@@ -54,51 +54,55 @@ After execution, Modern.js will automatically generate a new entry directory, an
54
54
  └── page.tsx
55
55
  ```
56
56
 
57
- The original code was moved to the directory with the same name as the `name` in the `package.json`, and a new directory was created.
57
+ The original entry code has been moved to a directory with the same name as the `name` field in `package.json`, and a `new-entry` entry directory has been created.
58
58
 
59
- After executing `pnpm run dev`, you can see that a `/new-entry` route has been added, and the migrated code route has not changed.
59
+ After running `pnpm run dev`, you can see a new route named `/new-entry` has been added, and the migrated code route has not changed.
60
60
 
61
61
  :::tip
62
- Modern.js will use the entry with the same name as the `name` field in the package.json file as the main entry, the route of the main entry is `/`, and the route of other entries is `/{entryName}`.
62
+ Modern.js will use the entry with the same name as the `name` field in `package.json` as the main entry. The route of the main entry is `/`, and the route of other entries is `/{entryName}`.
63
63
 
64
- For example, when `name` in package.json is `myapp`, `src/myapp` will be used as the main entry of the project.
64
+ For example, when the `name` field in `package.json` is `myapp`, `src/myapp` will be the main entry of the project.
65
65
 
66
66
  :::
67
67
 
68
- ## Entry Type
68
+ ## Entry Types
69
69
 
70
- Different entry types have different compile and run-time behaviors. When creating a project in Modern.js, developers can manually choose to create a project in **framework mode** or **build mode**. After the creation is complete, you can see that the project template files for different modes are different.
70
+ Different entry types have different compilation and runtime behaviors.
71
71
 
72
- By default, Modern.js will scan the files under `src/` before starting the project, identify the entry, and generate the corresponding server-side route.
72
+ import EntryMode from '@site-docs-en/components/entry-mode.mdx';
73
+
74
+ <EntryMode />
75
+
76
+ By default, Modern.js scans the files under `src/` before starting the project, identifies the entry, and generates the corresponding server-side route.
73
77
 
74
78
  :::tip
75
- You can change the entry directory to another directory through [source.entriesDir](/configure/app/source/entries-dir).
79
+ You can modify the directory for entry identification by using the [source.entriesDir](/configure/app/source/entries-dir) config.
76
80
 
77
81
  :::
78
82
 
79
- Not all first-level directories under `src/` will become project entries, and the directory where the entry is located must meet one of the following four conditions:
83
+ Not all top-level directories under `src/` become project entries. The directory where the entry is located must meet one of the following four conditions:
80
84
 
81
- 1. Have a `routes/` directory
82
- 2. Has `App.[jt]sx?` file
83
- 3. Has `index.[jt]sx?` file
84
- 4. Has a `pages/` directory (Modern.js 1.0 compatible)
85
+ 1. Has a `routes/` directory.
86
+ 2. Has an `App.[jt]sx?` file.
87
+ 3. Has an `index.[jt]sx?` file.
88
+ 4. Has a `pages/` directory (compatible with Modern.js 1.0).
85
89
 
86
- When the `src/` directory meets the entry characteristics, Modern.js will consider the current project as a single-entry application.
90
+ When the `src/` directory meets the entry requirements, Modern.js considers the current project as a single entry application.
87
91
 
88
92
  :::tip
89
- In single-entry applications, the default entry is named `main`.
93
+ In a single entry application, the default entry name is `main`.
90
94
 
91
95
  :::
92
96
 
93
- When the project is not a single-entry application, Modern.js will further check the first-level directory under `src/`.
97
+ When the project is not a single entry application, Modern.js will further look at the top-level directories under `src/`.
94
98
 
95
99
  ### Framework Mode Entry
96
100
 
97
- Framework mode refers to the need to use the capabilities of the Modern.js framework, such as Router, SSR, integrated calls, etc. Under this kind of entry agreement, the entry defined by the developer is not the real Webpack compilation entry. Modern.js will generate an encapsulated entry when it starts, and the real entry can be found in `node_modules/.modern/{entryName}/index.js`.
101
+ Framework mode refers to the need to use Modern.js framework capabilities, such as Router, SSR, integrated calls, etc. Under this type of entry convention, the entry defined by the developer is not a real webpack compilation entry. Modern.js will generate a wrapped entry during startup, and you can find the real entry in `node_modules/.modern/{entryName}/index.js`.
98
102
 
99
103
  #### Conventional Routing
100
104
 
101
- If there is a `routes/` directory in the entry, Modern.js will scan the files under `routes/` at startup, and automatically generate client-side routes (react-router) based on file conventions. For example:
105
+ If there is a `routes/` directory in the entry, Modern.js will scan the files under `routes/` during startup, and automatically generate client-side routes (react-router) based on file conventions. For example:
102
106
 
103
107
  ```bash
104
108
  .
@@ -108,11 +112,13 @@ If there is a `routes/` directory in the entry, Modern.js will scan the files un
108
112
  │ └── page.tsx
109
113
  ```
110
114
 
111
- For details, please refer to [routing](/guides/basic-features/routes#conventional-routing).
115
+ In the above directory, the component exported in `layout.tsx` will be the outermost component, and the component exported in `page.tsx` will be the component of the `/` route.
116
+
117
+ For more information, please refer to [Conventional Routing](/guides/basic-features/routes.html#conventional-routing).
112
118
 
113
119
  #### Self-controlled Routing
114
120
 
115
- If there is an `App.[jt]sx?` file in the entry, the developer can freely set the client route in this file, or not set the client route.
121
+ If there is an `App.[jt]sx?` file in the entry, developers can set the client-side route in this file through code, or not set the client-side route.
116
122
 
117
123
  ```tsx
118
124
  import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
@@ -129,11 +135,11 @@ export default () => {
129
135
  };
130
136
  ```
131
137
 
132
- For details, please refer to [routing](/guides/basic-features/routes#self-controlled-routing).
138
+ For more information, please refer to [Self-controlled Routing](/guides/basic-features/routes.html#self-controlled-routing).
133
139
 
134
140
  #### Custom Bootstrap
135
141
 
136
- If there is an `index.[jt]sx` file in the entry, and when the file defaults to exporting functions, Modern.js will pass the default bootstrap function as an imported parameter, and replace the default bootstrap with the exported function, so that developers can customize Mounting components to DOM nodes, or adding custom behavior before mounting. E.g:
142
+ If there is an `index.[jt]sx` file in the entry, and the file exports a function by default, Modern.js will pass the default `bootstrap` function as a parameter and use the exported function to replace the default `bootstrap`. This way, developers can customize how components are mounted to DOM nodes or add custom behavior before mounting. For example:
137
143
 
138
144
  ```tsx
139
145
  export default (App: React.ComponentType, bootstrap: () => void) => {
@@ -144,12 +150,7 @@ export default (App: React.ComponentType, bootstrap: () => void) => {
144
150
  };
145
151
  ```
146
152
 
147
- :::warning
148
- Since the bootstrap function needs to be compatible with React17 and React18, you need to manually pass in ReactDOM parameters when calling the bootstrap function.
149
-
150
- :::
151
-
152
- The content of the file generated by Modern.js is as follows:
153
+ At this point, the generated file content of Modern.js is as follows:
153
154
 
154
155
  ```js
155
156
  import React from 'react';
@@ -180,9 +181,9 @@ export default AppWrapper;
180
181
 
181
182
  ### Build Mode Entry
182
183
 
183
- Build mode refers to the ability not to use any Modern.js runtime, and the developer defines the entry of the project Webpack completely by himself.
184
+ Build mode refers to not using any Modern.js runtime capabilities and completely defining the project's webpack entry by the developer.
184
185
 
185
- If `index.[jt]sx` exists in the entry and there is no default export function, then this file is the real Webpack entry file. This is similar to [Create React App](https://github.com/facebook/create-react-app), you need to mount components to DOM nodes, add hot update code, etc. For example:
186
+ If there is an `index.[jt]sx` file in the entry and it does not export a default function, then this file is the real webpack entry file. Similar to [Create React App](https://github.com/facebook/create-react-app), you need to mount the component to the DOM node by yourself, add hot update code, etc. For example:
186
187
 
187
188
  ```js title=src/index.jsx
188
189
  import React from 'react';
@@ -192,13 +193,13 @@ import App from './App';
192
193
  ReactDOM.render(<App />, document.getElementById('root'));
193
194
  ```
194
195
 
195
- Modern.js **not recommended** new project to use this method, this method loses some capabilities of the framework, such as the `runtime` configuration in the **`modern.config.js` file will no longer take effect**. But this method will be very useful when the project is migrated from other frameworks to Modern.js, such as CRA, or webpack that is manually built by yourself.
196
+ Modern.js **does not recommend** using this method for new projects, as it loses some of the framework's capabilities, such as the `runtime` configuration in the `modern.config.js` file will no longer take effect. However, this method can be very useful when migrating projects from other frameworks to Modern.js, such as CRA, or manually building webpack.
196
197
 
197
- ## Specify Entry Using Configuration
198
+ ## Specifying Entry Using Configuration
198
199
 
199
- Most existing projects are not built according to the directory convention of Modern.js. If you want to change to the directory structure agreed by Modern.js, there will be a certain migration cost.
200
+ Most existing projects are not built according to the directory structure of Modern.js. If you want to change to the directory structure of Modern.js, there will be certain migration costs.
200
201
 
201
- In this case, instead of generating the entry using file conventions, you can manually configure the entry in `modern.config.[jt]s`.
202
+ In this case, in addition to using file conventions to generate entries, you can manually configure the entry in `modern.config.[jt]s`.
202
203
 
203
204
  ```ts title="modern.config.ts"
204
205
  export default defineConfig({
@@ -213,11 +214,11 @@ export default defineConfig({
213
214
  });
214
215
  ```
215
216
 
216
- ### Disable Default Entries
217
+ ### Disable Default Entry Scanning
217
218
 
218
- When using a custom entry, part of the project structure may happen to hit the directory convention of Modern.js, but in fact this part of the directory is not the real entry.
219
+ When using custom entries, part of the project structure may coincidentally hit the directory conventions of Modern.js, but in fact, this part of the directory is not the real entry.
219
220
 
220
- Modern.js provides `disableDefaultEntries` config to disable default entry scanning rules. When you need to customize the entry, you generally need to use `disableDefaultEntries` with `entries`. In this way, some existing projects can be quickly migrated without modifying the directory structure.
221
+ Modern.js provides the `disableDefaultEntries` configuration to disable the default entry scanning rules. When you need to customize the entry, you generally need to use `disableDefaultEntries` in combination with `entries`. This way, some existing projects can be quickly migrated without modifying the directory structure.
221
222
 
222
223
  ```ts title="modern.config.ts"
223
224
  export default defineConfig({
@@ -6,9 +6,9 @@ sidebar_position: 4
6
6
 
7
7
  ## BFF
8
8
 
9
- BFF stands for "Backend For Frontend". It is an architectural pattern where a dedicated backend service is created for frontend applications.
9
+ BFF is short for "Backend For Frontend". It is an architecture pattern that involves creating a backend service for frontend applications.
10
10
 
11
- The BFF service acts as an intermediary between the frontend application and the backend APIs, providing a tailored API for the frontend to consume. This allows the frontend developers to have more control over the data and functionality that they need, without having to rely on a monolithic backend API to provide coresponding capabilities.
11
+ The BFF service acts as an intermediary between the frontend application and the server API, and can provide customized APIs for the frontend to use. This allows frontend developers to have more control over the data and functionality they need, without relying on the backend service to provide the corresponding capabilities.
12
12
 
13
13
  ## Bundler
14
14
 
@@ -24,15 +24,15 @@ import Builder from '@modern-js/builder-doc/docs/en/shared/builder.md';
24
24
 
25
25
  ## CSR
26
26
 
27
- CSR stands for "Client-Side Rendering". It means that pages are rendered directly in the browser using JavaScript. All the logic, data fetching, templating and routing is done on the client rather than the server.
27
+ CSR stands for "Client-Side Rendering". It means that the page is rendered in the browser using JavaScript, and logic such as data fetching, templates, and routing is completed on the client side rather than the server.
28
28
 
29
- In CSR, the server sends an empty HTML shell to the client along with some JavaScript bundles, which then fetches data from the server's APIs and populates the page with dynamic content.
29
+ In CSR, the server sends an empty HTML shell and some JavaScript scripts to the browser, and the browser fetching data from the server's API and renders dynamic content to the page.
30
30
 
31
31
  ## Garfish
32
32
 
33
- [Garfish](https://garfish.bytedance.net/) is a set of micro front-end solutions mainly used to solve problems such as cross-team collaboration and technical system diversification of web applications.
33
+ [Garfish](https://garfish.bytedance.net/) is a micro-frontend solution mainly used to solve problems such as cross-team collaboration and diversified technology systems in web applications.
34
34
 
35
- Starting from the architectural level, it integrates several independently delivered front-end applications. These front-end applications can be developed, tested and deployed independently, but from the user's point of view they are still a cohesive single product.
35
+ Starting from the architecture level, it combines multiple independently delivered frontend applications into a whole. These frontend applications can be developed, tested, and deployed independently, but in the user's perspective, they are still cohesive single products.
36
36
 
37
37
  ## Rspack
38
38
 
@@ -42,19 +42,19 @@ import Rspack from '@modern-js/builder-doc/docs/en/shared/rspack.md';
42
42
 
43
43
  ## SSR
44
44
 
45
- SSR stands for "Server-Side Rendering". It is a technique where the server generates the HTML of a web page and sends it to the client, instead of sending just an empty HTML shell and relying on JavaScript to populate the page.
45
+ SSR stands for "Server-Side Rendering". It means that the HTML of the web page is generated by the server and sent to the client, rather than sending only an empty HTML shell and relying on JavaScript to generate the page content.
46
46
 
47
- In traditional client-side rendering, the server sends an empty HTML shell to the client along with some JavaScript bundles, which then fetches data from the server's APIs and populates the page with dynamic content. This can result in a slower initial load time, which can be detrimental to user experience and SEO.
47
+ In traditional client-side rendering, the server sends an empty HTML shell and some JavaScript scripts to the client, and then fetching data from the server's API and fills the page with dynamic content. This leads to slow initial page loading times and is not conducive to user experience and SEO.
48
48
 
49
- With SSR, the server generates the HTML with the dynamic content already populated, and sends it to the client. This can result in a faster initial load time and better SEO, as search engines can crawl the fully rendered page.
49
+ With SSR, the server generates HTML that already contains dynamic content and sends it to the client. This makes the initial page loading faster and more SEO-friendly, as search engines can crawl the rendered page.
50
50
 
51
51
  ## SSG
52
52
 
53
- SSG stands for "Static Site Generation". It is a technique where a web page is pre-rendered into static HTML, and then served directly to the client without the need for a server to generate the HTML on the fly.
53
+ SSG stands for "Static Site Generation". It means that web pages are pre-rendered as static HTML and served directly to the client, without the need for the server to generate HTML in real-time.
54
54
 
55
- In traditional SSR, the server generates the HTML on the fly each time a user requests a page. With SSG, the HTML is generated ahead of time during the build process and can be served directly from a CDN or other static hosting service.
55
+ In traditional SSR, the server generates HTML in real-time every time a user requests a page. With SSG, HTML can be generated in advance during the build process and hosted on a CDN or other static resource service.
56
56
 
57
- SSG can provide faster load times and less server overhead to traditional SSR, as there is no need to maintain a server to generate the HTML on the fly. However, it is not suitable for websites that require dynamic content, as the HTML is generated during the build process and cannot be updated in real-time.
57
+ Compared to traditional SSR, SSG can provide faster loading speeds and less server-side overhead, as there is no need to maintain a server to generate HTML in real-time. However, SSG is not suitable for websites that require dynamic content, as the HTML is generated during the build process and does not support real-time updates.
58
58
 
59
59
  ## SWC
60
60