@modern-js/main-doc 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (525) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/index.md +0 -5
  3. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/lint.md +1 -1
  4. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/serve.md +2 -4
  5. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/framework/lambda.md +12 -12
  6. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/api.md +13 -13
  7. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/app.md +0 -2
  8. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/api/functions/common.md +1 -3
  9. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/app.md +16 -9
  10. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/index_.md +0 -1
  11. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/routes.md +5 -3
  12. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/server.md +6 -4
  13. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/stories.md +2 -2
  14. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/test.md +1 -1
  15. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/app/define-config.md +0 -1
  16. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/bff/hook.md +3 -3
  17. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/bootstrap.md +3 -6
  18. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/create-app.md +1 -3
  19. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-loader.md +2 -2
  20. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-module-apps.md +58 -51
  21. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/core/use-runtime-context.md +3 -4
  22. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/index.md +0 -5
  23. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/Provider.md +1 -1
  24. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/connect.md +8 -5
  25. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/create-store.md +1 -3
  26. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/handle-effect.md +3 -3
  27. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/model_.md +0 -1
  28. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-model.md +0 -3
  29. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/model/use-store.md +0 -2
  30. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/router/router.md +23 -54
  31. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/ssr/no-ssr.md +1 -8
  32. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/ssr/pre-render.md +10 -6
  33. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/testing/render.md +0 -2
  34. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/css-in-js.md +2 -2
  35. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/head.md +3 -5
  36. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/utility/loadable.md +14 -15
  37. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/web-server/hook.md +4 -5
  38. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/web-server/middleware.md +7 -6
  39. package/en/docusaurus-plugin-content-docs/current/components/command-tip.md +3 -2
  40. package/en/docusaurus-plugin-content-docs/current/components/debug-app.md +17 -0
  41. package/en/docusaurus-plugin-content-docs/current/components/enable-bff.md +10 -14
  42. package/en/docusaurus-plugin-content-docs/current/components/enable-micro-frontend.md +4 -4
  43. package/en/docusaurus-plugin-content-docs/current/components/global-proxy-config.md +6 -9
  44. package/en/docusaurus-plugin-content-docs/current/components/global-proxy.md +0 -1
  45. package/en/docusaurus-plugin-content-docs/current/components/micro-master-manifest-config.md +2 -2
  46. package/en/docusaurus-plugin-content-docs/current/components/micro-runtime-config.md +1 -1
  47. package/en/docusaurus-plugin-content-docs/current/components/prerequisites.md +19 -0
  48. package/en/docusaurus-plugin-content-docs/current/components/reduck-migration.md +0 -1
  49. package/en/docusaurus-plugin-content-docs/current/components/reduck-tip.md +1 -1
  50. package/en/docusaurus-plugin-content-docs/current/components/router-legacy-tip.md +0 -1
  51. package/en/docusaurus-plugin-content-docs/current/configure/app/auto-load-plugin.md +8 -9
  52. package/en/docusaurus-plugin-content-docs/current/configure/app/bff/prefix.md +6 -6
  53. package/en/docusaurus-plugin-content-docs/current/configure/app/bff/proxy.md +8 -9
  54. package/en/docusaurus-plugin-content-docs/current/configure/app/builder-plugins.md +6 -6
  55. package/en/docusaurus-plugin-content-docs/current/configure/app/deploy/microFrontend.md +11 -13
  56. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/asset-prefix.md +2 -2
  57. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/hmr.md +2 -2
  58. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/https.md +2 -2
  59. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/port.md +2 -2
  60. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/progress-bar.md +2 -2
  61. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/proxy.md +0 -1
  62. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/start-url.md +2 -2
  63. package/en/docusaurus-plugin-content-docs/current/configure/app/experiments/lazy-compilation.md +2 -2
  64. package/en/docusaurus-plugin-content-docs/current/configure/app/html/app-icon.md +2 -2
  65. package/en/docusaurus-plugin-content-docs/current/configure/app/html/crossorigin.md +2 -2
  66. package/en/docusaurus-plugin-content-docs/current/configure/app/html/disable-html-folder.md +2 -2
  67. package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon-by-entries.md +2 -2
  68. package/en/docusaurus-plugin-content-docs/current/configure/app/html/favicon.md +2 -2
  69. package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject-by-entries.md +2 -2
  70. package/en/docusaurus-plugin-content-docs/current/configure/app/html/inject.md +2 -2
  71. package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta-by-entries.md +2 -2
  72. package/en/docusaurus-plugin-content-docs/current/configure/app/html/meta.md +2 -2
  73. package/en/docusaurus-plugin-content-docs/current/configure/app/html/mount-id.md +2 -2
  74. package/en/docusaurus-plugin-content-docs/current/configure/app/html/tags-by-entries.md +12 -0
  75. package/en/docusaurus-plugin-content-docs/current/configure/app/html/tags.md +12 -0
  76. package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-by-entries.md +2 -2
  77. package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters-by-entries.md +2 -2
  78. package/en/docusaurus-plugin-content-docs/current/configure/app/html/template-parameters.md +2 -2
  79. package/en/docusaurus-plugin-content-docs/current/configure/app/html/template.md +2 -2
  80. package/en/docusaurus-plugin-content-docs/current/configure/app/html/title-by-entries.md +2 -2
  81. package/en/docusaurus-plugin-content-docs/current/configure/app/html/title.md +2 -2
  82. package/en/docusaurus-plugin-content-docs/current/configure/app/output/asset-prefix.md +2 -2
  83. package/en/docusaurus-plugin-content-docs/current/configure/app/output/assets-retry.md +2 -2
  84. package/en/docusaurus-plugin-content-docs/current/configure/app/output/charset.md +2 -2
  85. package/en/docusaurus-plugin-content-docs/current/configure/app/output/clean-dist-path.md +2 -2
  86. package/en/docusaurus-plugin-content-docs/current/configure/app/output/convert-to-rem.md +2 -2
  87. package/en/docusaurus-plugin-content-docs/current/configure/app/output/copy.md +2 -2
  88. package/en/docusaurus-plugin-content-docs/current/configure/app/output/css-module-local-ident-name.md +2 -2
  89. package/en/docusaurus-plugin-content-docs/current/configure/app/output/data-uri-limit.md +2 -2
  90. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-extract.md +2 -2
  91. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-css-module-extension.md +2 -2
  92. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-filename-hash.md +2 -2
  93. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-inline-runtime-chunk.md +2 -2
  94. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-minimize.md +2 -2
  95. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-node-polyfill.md +8 -6
  96. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-source-map.md +2 -2
  97. package/en/docusaurus-plugin-content-docs/current/configure/app/output/disable-ts-checker.md +2 -2
  98. package/en/docusaurus-plugin-content-docs/current/configure/app/output/dist-path.md +2 -2
  99. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-fallback.md +2 -2
  100. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-asset-manifest.md +2 -2
  101. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-css-module-tsdeclaration.md +2 -2
  102. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-scripts.md +2 -2
  103. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-inline-styles.md +2 -2
  104. package/en/docusaurus-plugin-content-docs/current/configure/app/output/enable-latest-decorators.md +2 -2
  105. package/en/docusaurus-plugin-content-docs/current/configure/app/output/externals.md +2 -2
  106. package/en/docusaurus-plugin-content-docs/current/configure/app/output/filename.md +2 -2
  107. package/en/docusaurus-plugin-content-docs/current/configure/app/output/legal-comments.md +2 -2
  108. package/en/docusaurus-plugin-content-docs/current/configure/app/output/override-browserslist.md +2 -2
  109. package/en/docusaurus-plugin-content-docs/current/configure/app/output/polyfill.md +2 -2
  110. package/en/docusaurus-plugin-content-docs/current/configure/app/output/ssg.md +3 -2
  111. package/en/docusaurus-plugin-content-docs/current/configure/app/output/svg-default-export.md +2 -2
  112. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/build-cache.md +2 -2
  113. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/bundle-analyze.md +2 -2
  114. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/chunk-split.md +2 -2
  115. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/print-file-size.md +2 -2
  116. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/profile.md +2 -2
  117. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-console.md +2 -2
  118. package/en/docusaurus-plugin-content-docs/current/configure/app/performance/remove-moment-locale.md +2 -2
  119. package/en/docusaurus-plugin-content-docs/current/configure/app/plugins.md +6 -6
  120. package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/intro.md +11 -10
  121. package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/master-app.md +1 -2
  122. package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/router.md +7 -7
  123. package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/state.md +15 -15
  124. package/en/docusaurus-plugin-content-docs/current/configure/app/security/sri.md +2 -2
  125. package/en/docusaurus-plugin-content-docs/current/configure/app/server/base-url.md +3 -4
  126. package/en/docusaurus-plugin-content-docs/current/configure/app/server/enable-framework-ext.md +5 -4
  127. package/en/docusaurus-plugin-content-docs/current/configure/app/server/port.md +24 -4
  128. package/en/docusaurus-plugin-content-docs/current/configure/app/server/public-routes.md +6 -6
  129. package/en/docusaurus-plugin-content-docs/current/configure/app/server/routes.md +7 -7
  130. package/en/docusaurus-plugin-content-docs/current/configure/app/server/ssr-by-entries.md +5 -5
  131. package/en/docusaurus-plugin-content-docs/current/configure/app/server/ssr.md +4 -4
  132. package/en/docusaurus-plugin-content-docs/current/configure/app/source/alias.md +2 -2
  133. package/en/docusaurus-plugin-content-docs/current/configure/app/source/compile-js-data-uri.md +2 -2
  134. package/en/docusaurus-plugin-content-docs/current/configure/app/source/config-dir.md +2 -2
  135. package/en/docusaurus-plugin-content-docs/current/configure/app/source/define.md +2 -2
  136. package/en/docusaurus-plugin-content-docs/current/configure/app/source/design-system.md +656 -634
  137. package/en/docusaurus-plugin-content-docs/current/configure/app/source/disable-default-entries.md +1 -1
  138. package/en/docusaurus-plugin-content-docs/current/configure/app/source/disable-entry-dirs.md +8 -8
  139. package/en/docusaurus-plugin-content-docs/current/configure/app/source/enable-async-entry.md +1 -1
  140. package/en/docusaurus-plugin-content-docs/current/configure/app/source/entries-dir.md +7 -7
  141. package/en/docusaurus-plugin-content-docs/current/configure/app/source/entries.md +4 -6
  142. package/en/docusaurus-plugin-content-docs/current/configure/app/source/exclude.md +2 -2
  143. package/en/docusaurus-plugin-content-docs/current/configure/app/source/global-vars.md +2 -2
  144. package/en/docusaurus-plugin-content-docs/current/configure/app/source/include.md +2 -2
  145. package/en/docusaurus-plugin-content-docs/current/configure/app/source/module-scopes.md +2 -2
  146. package/en/docusaurus-plugin-content-docs/current/configure/app/source/pre-entry.md +2 -2
  147. package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-extension-prefix.md +2 -2
  148. package/en/docusaurus-plugin-content-docs/current/configure/app/source/resolve-main-fields.md +2 -2
  149. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/autoprefixer.md +2 -2
  150. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/babel.md +2 -2
  151. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-extract.md +2 -2
  152. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/css-loader.md +2 -2
  153. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/dev-server.md +2 -2
  154. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/html-plugin.md +2 -2
  155. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/inspector.md +2 -2
  156. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/jest.md +9 -9
  157. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/less.md +2 -2
  158. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/minify-css.md +2 -2
  159. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/postcss.md +2 -2
  160. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/pug.md +2 -2
  161. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/sass.md +2 -2
  162. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/style-loader.md +2 -2
  163. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/styled-components.md +2 -2
  164. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/swc.md +12 -1
  165. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/terser.md +2 -2
  166. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-checker.md +2 -2
  167. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/ts-loader.md +2 -2
  168. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack-chain.md +2 -2
  169. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/webpack.md +2 -2
  170. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/frameworks.md +6 -6
  171. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/function.md +44 -38
  172. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/index.md +9 -9
  173. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/type.md +0 -1
  174. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/code-split.md +3 -4
  175. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/compatibility.md +6 -7
  176. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/eslint.md +0 -1
  177. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/index.md +0 -5
  178. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/low-level.md +17 -19
  179. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssg.md +8 -10
  180. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssr.md +5 -11
  181. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/testing.md +3 -3
  182. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/web-server.md +3 -4
  183. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/alias.md +7 -11
  184. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/css-in-js.md +6 -6
  185. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/css-modules.md +2 -2
  186. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/less-sass.md +1 -2
  187. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/postcss.md +43 -47
  188. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/tailwindcss.md +3 -3
  189. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/data-fetch.md +106 -192
  190. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/env-vars.md +8 -8
  191. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/html.md +55 -47
  192. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/mock.md +4 -4
  193. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/proxy.md +4 -5
  194. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/routes.md +90 -9
  195. package/en/docusaurus-plugin-content-docs/current/guides/concept/entries.md +1 -2
  196. package/en/docusaurus-plugin-content-docs/current/guides/get-started/quick-start.md +2 -2
  197. package/en/docusaurus-plugin-content-docs/current/guides/get-started/upgrade.md +1 -1
  198. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/extend.md +13 -13
  199. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/hook-list.md +2 -2
  200. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/hook.md +57 -54
  201. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/implement.md +11 -11
  202. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/lifecycle.md +0 -1
  203. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/framework-plugin/plugin-api.md +4 -4
  204. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/app.md +33 -33
  205. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/ejs.md +3 -3
  206. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/fs.md +3 -3
  207. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/git.md +3 -2
  208. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/handlebars.md +3 -4
  209. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/json.md +9 -12
  210. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/api/npm.md +2 -3
  211. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/introduce.md +4 -3
  212. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/run-in-js.md +4 -5
  213. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/codesmith/structure.md +13 -11
  214. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/config/common.md +18 -27
  215. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/abstract.md +1 -4
  216. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/introduce.md +1 -1
  217. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +4 -5
  218. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/hook/onForged.md +0 -1
  219. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +1 -4
  220. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +1 -3
  221. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/setInput.md +1 -1
  222. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/input/type.md +1 -1
  223. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/api/introduce.md +8 -9
  224. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/develop.md +11 -12
  225. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/plugin/use.md +8 -8
  226. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/generator/project.md +1 -2
  227. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c01-introduction.md +7 -8
  228. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c02-development.md +18 -21
  229. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c03-main-app.md +41 -44
  230. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c04-communicate.md +7 -5
  231. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/micro-frontend/c05-mixed-stack.md +1 -1
  232. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/auto-actions.md +0 -1
  233. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/computed-state.md +0 -2
  234. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/define-model.md +3 -6
  235. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/faq.md +2 -5
  236. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/manage-effects.md +2 -5
  237. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/model-communicate.md +1 -4
  238. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/performance.md +1 -5
  239. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/quick-start.md +0 -6
  240. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/redux-integration.md +3 -2
  241. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/test-model.md +1 -1
  242. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/typescript-best-practice.md +13 -14
  243. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/use-model.md +14 -12
  244. package/en/docusaurus-plugin-content-docs/current/guides/topic-detail/model/use-out-of-modernjs.md +4 -6
  245. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c01-start.md +19 -19
  246. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c02-component.md +11 -11
  247. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c03-css.md +52 -55
  248. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c04-routes.md +23 -23
  249. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c05-loader.md +12 -11
  250. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c06-model.md +28 -28
  251. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c07-container.md +25 -26
  252. package/en/docusaurus-plugin-content-docs/current/tutorials/first-app/c08-entries.md +36 -38
  253. package/en/docusaurus-plugin-content-docs/current.json +3 -47
  254. package/package.json +3 -3
  255. package/scripts/config.ts +4 -2
  256. package/scripts/summary.en.json +1 -1
  257. package/scripts/summary.zh.json +1 -1
  258. package/scripts/sync.ts +1 -1
  259. package/zh/apis/app/commands/index.md +0 -5
  260. package/zh/apis/app/commands/lint.md +1 -1
  261. package/zh/apis/app/commands/serve.md +2 -4
  262. package/zh/apis/app/hooks/api/framework/lambda.md +12 -12
  263. package/zh/apis/app/hooks/api/functions/api.md +13 -13
  264. package/zh/apis/app/hooks/api/functions/app.md +0 -2
  265. package/zh/apis/app/hooks/api/functions/common.md +1 -1
  266. package/zh/apis/app/hooks/index.md +0 -5
  267. package/zh/apis/app/hooks/shared.md +0 -1
  268. package/zh/apis/app/hooks/src/app.md +16 -9
  269. package/zh/apis/app/hooks/src/index_.md +0 -2
  270. package/zh/apis/app/hooks/src/routes.md +6 -7
  271. package/zh/apis/app/hooks/src/server.md +6 -4
  272. package/zh/apis/app/hooks/src/stories.md +1 -1
  273. package/zh/apis/app/hooks/src/test.md +1 -1
  274. package/zh/apis/app/runtime/app/define-config.md +1 -2
  275. package/zh/apis/app/runtime/bff/hook.md +3 -3
  276. package/zh/apis/app/runtime/core/bootstrap.md +2 -3
  277. package/zh/apis/app/runtime/core/use-loader.md +2 -2
  278. package/zh/apis/app/runtime/core/use-module-apps.md +53 -50
  279. package/zh/apis/app/runtime/core/use-runtime-context.md +3 -4
  280. package/zh/apis/app/runtime/index.md +0 -5
  281. package/zh/apis/app/runtime/model/Provider.md +1 -0
  282. package/zh/apis/app/runtime/model/auto-actions.md +1 -1
  283. package/zh/apis/app/runtime/model/connect.md +9 -5
  284. package/zh/apis/app/runtime/model/create-app.md +3 -3
  285. package/zh/apis/app/runtime/model/create-store.md +2 -4
  286. package/zh/apis/app/runtime/model/handle-effect.md +3 -4
  287. package/zh/apis/app/runtime/model/model_.md +0 -3
  288. package/zh/apis/app/runtime/model/use-local-model.md +0 -1
  289. package/zh/apis/app/runtime/model/use-store.md +0 -2
  290. package/zh/apis/app/runtime/router/router.md +23 -53
  291. package/zh/apis/app/runtime/ssr/no-ssr.md +1 -5
  292. package/zh/apis/app/runtime/ssr/pre-render.md +10 -6
  293. package/zh/apis/app/runtime/testing/cleanup.md +2 -2
  294. package/zh/apis/app/runtime/testing/render.md +0 -2
  295. package/zh/apis/app/runtime/utility/css-in-js.md +2 -2
  296. package/zh/apis/app/runtime/utility/head.md +3 -5
  297. package/zh/apis/app/runtime/utility/loadable.md +14 -15
  298. package/zh/apis/app/runtime/web-server/hook.md +5 -4
  299. package/zh/apis/app/runtime/web-server/middleware.md +8 -6
  300. package/zh/apis/monorepo/commands/bump.md +1 -1
  301. package/zh/apis/monorepo/commands/change.md +3 -2
  302. package/zh/apis/monorepo/commands/gen-release-note.md +1 -2
  303. package/zh/apis/monorepo/commands/index.md +1 -6
  304. package/zh/apis/monorepo/commands/lint.md +1 -1
  305. package/zh/apis/monorepo/commands/release.md +0 -1
  306. package/zh/apis/monorepo/hooks/index.md +1 -6
  307. package/zh/components/command-tip.md +3 -2
  308. package/zh/components/enable-bff.md +10 -14
  309. package/zh/components/enable-micro-frontend.md +4 -4
  310. package/zh/components/global-proxy-config.md +6 -9
  311. package/zh/components/global-proxy.md +0 -1
  312. package/zh/components/init-app.md +0 -1
  313. package/zh/components/micro-master-manifest-config.md +2 -2
  314. package/zh/components/micro-runtime-config.md +1 -1
  315. package/zh/components/reduck-migration.md +0 -1
  316. package/zh/components/router-legacy-tip.md +0 -1
  317. package/zh/configure/app/auto-load-plugin.md +9 -10
  318. package/zh/configure/app/bff/prefix.md +6 -10
  319. package/zh/configure/app/bff/proxy.md +9 -8
  320. package/zh/configure/app/builder-plugins.md +6 -6
  321. package/zh/configure/app/deploy/microFrontend.md +11 -11
  322. package/zh/configure/app/dev/asset-prefix.md +2 -2
  323. package/zh/configure/app/dev/hmr.md +2 -2
  324. package/zh/configure/app/dev/https.md +2 -2
  325. package/zh/configure/app/dev/port.md +2 -2
  326. package/zh/configure/app/dev/progress-bar.md +2 -2
  327. package/zh/configure/app/dev/proxy.md +0 -1
  328. package/zh/configure/app/dev/start-url.md +2 -2
  329. package/zh/configure/app/experiments/lazy-compilation.md +2 -2
  330. package/zh/configure/app/html/app-icon.md +2 -2
  331. package/zh/configure/app/html/crossorigin.md +2 -2
  332. package/zh/configure/app/html/disable-html-folder.md +2 -2
  333. package/zh/configure/app/html/favicon-by-entries.md +2 -2
  334. package/zh/configure/app/html/favicon.md +2 -2
  335. package/zh/configure/app/html/inject-by-entries.md +2 -2
  336. package/zh/configure/app/html/inject.md +2 -2
  337. package/zh/configure/app/html/meta-by-entries.md +2 -2
  338. package/zh/configure/app/html/meta.md +2 -2
  339. package/zh/configure/app/html/mount-id.md +2 -2
  340. package/zh/configure/app/html/tags-by-entries.md +12 -0
  341. package/zh/configure/app/html/tags.md +12 -0
  342. package/zh/configure/app/html/template-by-entries.md +2 -2
  343. package/zh/configure/app/html/template-parameters-by-entries.md +2 -2
  344. package/zh/configure/app/html/template-parameters.md +2 -2
  345. package/zh/configure/app/html/template.md +2 -2
  346. package/zh/configure/app/html/title-by-entries.md +2 -2
  347. package/zh/configure/app/html/title.md +2 -2
  348. package/zh/configure/app/output/asset-prefix.md +2 -2
  349. package/zh/configure/app/output/assets-retry.md +2 -2
  350. package/zh/configure/app/output/charset.md +2 -2
  351. package/zh/configure/app/output/clean-dist-path.md +2 -2
  352. package/zh/configure/app/output/convert-to-rem.md +2 -2
  353. package/zh/configure/app/output/copy.md +2 -2
  354. package/zh/configure/app/output/css-module-local-ident-name.md +2 -2
  355. package/zh/configure/app/output/data-uri-limit.md +2 -2
  356. package/zh/configure/app/output/disable-css-extract.md +2 -2
  357. package/zh/configure/app/output/disable-css-module-extension.md +2 -2
  358. package/zh/configure/app/output/disable-filename-hash.md +2 -2
  359. package/zh/configure/app/output/disable-inline-runtime-chunk.md +2 -2
  360. package/zh/configure/app/output/disable-minimize.md +2 -2
  361. package/zh/configure/app/output/disable-node-polyfill.md +8 -8
  362. package/zh/configure/app/output/disable-source-map.md +2 -2
  363. package/zh/configure/app/output/disable-ts-checker.md +2 -2
  364. package/zh/configure/app/output/dist-path.md +2 -2
  365. package/zh/configure/app/output/enable-asset-fallback.md +2 -2
  366. package/zh/configure/app/output/enable-asset-manifest.md +2 -2
  367. package/zh/configure/app/output/enable-css-module-tsdeclaration.md +2 -2
  368. package/zh/configure/app/output/enable-inline-scripts.md +2 -2
  369. package/zh/configure/app/output/enable-inline-styles.md +2 -2
  370. package/zh/configure/app/output/enable-latest-decorators.md +2 -2
  371. package/zh/configure/app/output/externals.md +2 -2
  372. package/zh/configure/app/output/filename.md +2 -2
  373. package/zh/configure/app/output/legal-comments.md +2 -2
  374. package/zh/configure/app/output/override-browserslist.md +2 -2
  375. package/zh/configure/app/output/polyfill.md +2 -2
  376. package/zh/configure/app/output/ssg.md +3 -2
  377. package/zh/configure/app/output/svg-default-export.md +2 -2
  378. package/zh/configure/app/performance/build-cache.md +2 -2
  379. package/zh/configure/app/performance/bundle-analyze.md +2 -2
  380. package/zh/configure/app/performance/chunk-split.md +2 -2
  381. package/zh/configure/app/performance/print-file-size.md +2 -2
  382. package/zh/configure/app/performance/profile.md +2 -2
  383. package/zh/configure/app/performance/remove-console.md +2 -2
  384. package/zh/configure/app/performance/remove-moment-locale.md +2 -2
  385. package/zh/configure/app/plugins.md +6 -6
  386. package/zh/configure/app/runtime/intro.md +39 -11
  387. package/zh/configure/app/runtime/master-app.md +1 -2
  388. package/zh/configure/app/runtime/router.md +6 -7
  389. package/zh/configure/app/runtime/state.md +15 -16
  390. package/zh/configure/app/security/sri.md +2 -2
  391. package/zh/configure/app/server/base-url.md +3 -6
  392. package/zh/configure/app/server/enable-framework-ext.md +5 -4
  393. package/zh/configure/app/server/port.md +24 -6
  394. package/zh/configure/app/server/public-routes.md +6 -8
  395. package/zh/configure/app/server/routes.md +6 -6
  396. package/zh/configure/app/server/ssr-by-entries.md +5 -8
  397. package/zh/configure/app/server/ssr.md +4 -5
  398. package/zh/configure/app/source/alias.md +2 -2
  399. package/zh/configure/app/source/compile-js-data-uri.md +2 -2
  400. package/zh/configure/app/source/config-dir.md +2 -2
  401. package/zh/configure/app/source/define.md +2 -2
  402. package/zh/configure/app/source/design-system.md +656 -630
  403. package/zh/configure/app/source/disable-default-entries.md +3 -3
  404. package/zh/configure/app/source/disable-entry-dirs.md +8 -7
  405. package/zh/configure/app/source/enable-async-entry.md +3 -3
  406. package/zh/configure/app/source/entries-dir.md +7 -7
  407. package/zh/configure/app/source/entries.md +5 -6
  408. package/zh/configure/app/source/exclude.md +2 -2
  409. package/zh/configure/app/source/global-vars.md +2 -2
  410. package/zh/configure/app/source/include.md +2 -2
  411. package/zh/configure/app/source/module-scopes.md +2 -2
  412. package/zh/configure/app/source/pre-entry.md +2 -2
  413. package/zh/configure/app/source/resolve-extension-prefix.md +2 -2
  414. package/zh/configure/app/source/resolve-main-fields.md +2 -2
  415. package/zh/configure/app/testing/transformer.md +2 -3
  416. package/zh/configure/app/tools/autoprefixer.md +2 -2
  417. package/zh/configure/app/tools/babel.md +2 -2
  418. package/zh/configure/app/tools/css-extract.md +2 -2
  419. package/zh/configure/app/tools/css-loader.md +2 -2
  420. package/zh/configure/app/tools/dev-server.md +2 -2
  421. package/zh/configure/app/tools/html-plugin.md +2 -2
  422. package/zh/configure/app/tools/inspector.md +2 -2
  423. package/zh/configure/app/tools/jest.md +9 -9
  424. package/zh/configure/app/tools/less.md +2 -2
  425. package/zh/configure/app/tools/minify-css.md +2 -2
  426. package/zh/configure/app/tools/postcss.md +2 -2
  427. package/zh/configure/app/tools/pug.md +2 -2
  428. package/zh/configure/app/tools/sass.md +2 -2
  429. package/zh/configure/app/tools/style-loader.md +2 -2
  430. package/zh/configure/app/tools/styled-components.md +2 -2
  431. package/zh/configure/app/tools/swc.md +12 -1
  432. package/zh/configure/app/tools/terser.md +2 -2
  433. package/zh/configure/app/tools/ts-checker.md +2 -2
  434. package/zh/configure/app/tools/ts-loader.md +2 -2
  435. package/zh/configure/app/tools/webpack-chain.md +2 -2
  436. package/zh/configure/app/tools/webpack.md +2 -2
  437. package/zh/guides/advanced-features/bff/frameworks.md +6 -6
  438. package/zh/guides/advanced-features/bff/function.md +49 -44
  439. package/zh/guides/advanced-features/bff/index.md +9 -9
  440. package/zh/guides/advanced-features/bff/type.md +0 -1
  441. package/zh/guides/advanced-features/code-split.md +3 -3
  442. package/zh/guides/advanced-features/compatibility.md +6 -7
  443. package/zh/guides/advanced-features/eslint.md +0 -1
  444. package/zh/guides/advanced-features/index.md +0 -5
  445. package/zh/guides/advanced-features/low-level.md +17 -19
  446. package/zh/guides/advanced-features/ssg.md +8 -9
  447. package/zh/guides/advanced-features/ssr.md +5 -11
  448. package/zh/guides/advanced-features/testing.md +3 -2
  449. package/zh/guides/advanced-features/web-server.md +3 -4
  450. package/zh/guides/basic-features/alias.md +7 -11
  451. package/zh/guides/basic-features/css/css-in-js.md +5 -5
  452. package/zh/guides/basic-features/css/css-modules.md +2 -2
  453. package/zh/guides/basic-features/css/postcss.md +42 -46
  454. package/zh/guides/basic-features/css/tailwindcss.md +5 -5
  455. package/zh/guides/basic-features/data-fetch.md +109 -192
  456. package/zh/guides/basic-features/env-vars.md +7 -6
  457. package/zh/guides/basic-features/html.md +54 -46
  458. package/zh/guides/basic-features/index.md +0 -5
  459. package/zh/guides/basic-features/mock.md +4 -4
  460. package/zh/guides/basic-features/proxy.md +4 -5
  461. package/zh/guides/basic-features/routes.md +105 -18
  462. package/zh/guides/concept/entries.md +5 -7
  463. package/zh/guides/get-started/quick-start.md +3 -4
  464. package/zh/guides/topic-detail/changesets/add.md +1 -3
  465. package/zh/guides/topic-detail/changesets/changelog.md +30 -31
  466. package/zh/guides/topic-detail/changesets/commit.md +44 -45
  467. package/zh/guides/topic-detail/changesets/config.md +2 -1
  468. package/zh/guides/topic-detail/changesets/github.md +6 -10
  469. package/zh/guides/topic-detail/changesets/introduce.md +0 -1
  470. package/zh/guides/topic-detail/changesets/release-note.md +9 -12
  471. package/zh/guides/topic-detail/changesets/release-pre.md +1 -1
  472. package/zh/guides/topic-detail/framework-plugin/extend.md +13 -13
  473. package/zh/guides/topic-detail/framework-plugin/hook-list.md +2 -2
  474. package/zh/guides/topic-detail/framework-plugin/hook.md +57 -54
  475. package/zh/guides/topic-detail/framework-plugin/implement.md +11 -11
  476. package/zh/guides/topic-detail/framework-plugin/plugin-api.md +4 -4
  477. package/zh/guides/topic-detail/generator/codesmith/api/app.md +36 -36
  478. package/zh/guides/topic-detail/generator/codesmith/api/ejs.md +2 -2
  479. package/zh/guides/topic-detail/generator/codesmith/api/fs.md +2 -2
  480. package/zh/guides/topic-detail/generator/codesmith/api/git.md +3 -2
  481. package/zh/guides/topic-detail/generator/codesmith/api/handlebars.md +2 -2
  482. package/zh/guides/topic-detail/generator/codesmith/api/json.md +9 -11
  483. package/zh/guides/topic-detail/generator/codesmith/api/npm.md +4 -2
  484. package/zh/guides/topic-detail/generator/codesmith/introduce.md +20 -7
  485. package/zh/guides/topic-detail/generator/codesmith/run-in-js.md +4 -5
  486. package/zh/guides/topic-detail/generator/codesmith/structure.md +13 -10
  487. package/zh/guides/topic-detail/generator/config/common.md +18 -27
  488. package/zh/guides/topic-detail/generator/plugin/abstract.md +1 -1
  489. package/zh/guides/topic-detail/generator/plugin/api/file/introduce.md +1 -0
  490. package/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.md +4 -4
  491. package/zh/guides/topic-detail/generator/plugin/api/info/locale.md +1 -1
  492. package/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.md +2 -2
  493. package/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.md +3 -4
  494. package/zh/guides/topic-detail/generator/plugin/api/input/setInput.md +1 -1
  495. package/zh/guides/topic-detail/generator/plugin/api/input/type.md +1 -1
  496. package/zh/guides/topic-detail/generator/plugin/api/introduce.md +8 -9
  497. package/zh/guides/topic-detail/generator/plugin/develop.md +13 -13
  498. package/zh/guides/topic-detail/generator/plugin/use.md +8 -8
  499. package/zh/guides/topic-detail/generator/project.md +1 -1
  500. package/zh/guides/topic-detail/micro-frontend/c01-introduction.md +7 -8
  501. package/zh/guides/topic-detail/micro-frontend/c02-development.md +20 -23
  502. package/zh/guides/topic-detail/micro-frontend/c03-main-app.md +41 -44
  503. package/zh/guides/topic-detail/micro-frontend/c04-communicate.md +7 -5
  504. package/zh/guides/topic-detail/micro-frontend/c05-mixed-stack.md +1 -1
  505. package/zh/guides/topic-detail/model/auto-actions.md +0 -1
  506. package/zh/guides/topic-detail/model/computed-state.md +0 -2
  507. package/zh/guides/topic-detail/model/define-model.md +3 -6
  508. package/zh/guides/topic-detail/model/faq.md +2 -5
  509. package/zh/guides/topic-detail/model/manage-effects.md +2 -5
  510. package/zh/guides/topic-detail/model/model-communicate.md +1 -4
  511. package/zh/guides/topic-detail/model/performance.md +1 -5
  512. package/zh/guides/topic-detail/model/quick-start.md +0 -6
  513. package/zh/guides/topic-detail/model/redux-integration.md +3 -2
  514. package/zh/guides/topic-detail/model/test-model.md +1 -1
  515. package/zh/guides/topic-detail/model/typescript-best-practice.md +13 -14
  516. package/zh/guides/topic-detail/model/use-model.md +14 -12
  517. package/zh/guides/topic-detail/model/use-out-of-modernjs.md +4 -6
  518. package/zh/guides/topic-detail/monorepo/intro.md +0 -1
  519. package/zh/guides/topic-detail/monorepo/sub-project-interface.md +14 -7
  520. package/zh/tutorials/first-app/c01-start.md +2 -2
  521. package/zh/tutorials/first-app/c03-css.md +6 -9
  522. package/zh/tutorials/first-app/c04-routes.md +1 -1
  523. package/zh/tutorials/first-app/c05-loader.md +2 -1
  524. package/zh/tutorials/first-app/c07-container.md +6 -7
  525. package/zh/tutorials/first-app/c08-entries.md +5 -7
@@ -1,37 +1,37 @@
1
1
  ---
2
- title: 创建项目
2
+ title: Create Project
3
3
  ---
4
4
 
5
- 从这一章节开始,我们将进入实战教程部分。在实战教程中,我们将会从环境准备开始,从简单到复杂,一步一步搭建一个真实的项目。
5
+ Starting from this chapter, we will enter the practical tutorial section. In the practical tutorial, we will start with environment preparation, starting from simple to complex, building a real project step by step.
6
6
 
7
- ## 环境准备
7
+ ## Environment preparation
8
8
 
9
- import Prerequisites from '@site-docs/components/prerequisites.md'
9
+ import Prerequisites from '@site-docs-en/components/prerequisites.md'
10
10
 
11
11
  <Prerequisites />
12
12
 
13
- ## 初始化项目
13
+ ## Initialization project
14
14
 
15
- 我们创建新的目录,通过命令行工具初始化项目:
15
+ We create a new directory and initialize the project via the command line tool:
16
16
 
17
17
  ```bash
18
18
  mkdir myapp && cd myapp
19
19
  npx @modern-js/create
20
20
  ```
21
21
 
22
- import InitApp from '@site-docs/components/init-app.md'
22
+ import InitApp from '@site-docs-en/components/init-app.md'
23
23
 
24
24
  <InitApp />
25
25
 
26
- ## 调试项目
26
+ ## Debug Project
27
27
 
28
- import DebugApp from '@site-docs/components/debug-app.md'
28
+ import DebugApp from '@site-docs-en/components/debug-app.md'
29
29
 
30
30
  <DebugApp />
31
31
 
32
- ## 修改代码
32
+ ## Modify the code
33
33
 
34
- 我们将原本的示例代码删除,替换成一个简单的联系人列表:
34
+ We delete the original sample code and replace it with a simple point of contact list:
35
35
 
36
36
  ```tsx title="src/routes/page.tsx"
37
37
  const getAvatar = (users: Array<{ name: string; email: string }>) =>
@@ -64,24 +64,24 @@ function App() {
64
64
  export default App;
65
65
  ```
66
66
 
67
- 删除多余的 css 文件,保持目录没有多余的文件:
67
+ Remove redundant css files and keep the directory free of redundant files:
68
68
 
69
69
  ```bash
70
70
  rm src/routes/index.css
71
71
  ```
72
72
 
73
- 因为框架默认支持 [HMR](https://webpack.js.org/concepts/hot-module-replacement/),可以看到 `http://localhost:8080/` 里的内容会自动更新为:
73
+ Since the framework supports [HMR](https://webpack.js.org/concepts/hot-module-replacement/) by default, you can see that the content in http://localhost:8080/ is automatically updated to:
74
74
 
75
75
  ![result](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvt/ljhwZthlaukjlkulzlp/screenshot-20221214-141909.png)
76
76
 
77
- 此刻的页面还没有样式。下一章节将展开这部分的内容。
77
+ The page has no styles at the moment. The next chapter will expand on this section.
78
78
 
79
- ## 开启 SSR
79
+ ## Enable SSR
80
80
 
81
- 接下来,我们修改项目中的 `modern.config.ts`,开启 SSR 能力:
81
+ Next, we modify the `modern.config.ts` in the project to enable the SSR capability:
82
82
 
83
83
  ```ts
84
- import AppToolsPlugin, { defineConfig } from '@modern-js/app-tools';
84
+ import appTools, { defineConfig } from '@modern-js/app-tools';
85
85
 
86
86
  // https://modernjs.dev/docs/apis/app/config
87
87
  export default defineConfig({
@@ -92,8 +92,8 @@ export default defineConfig({
92
92
  server: {
93
93
  ssr: true,
94
94
  },
95
- plugins: [AppToolsPlugin()],
95
+ plugins: [appTools()],
96
96
  });
97
97
  ```
98
98
 
99
- 重新执行 `pnpm run dev`,可以发现项目已经在服务端完成了页面渲染。
99
+ Re-execute `pnpm run dev` to find that the project has completed page rendering at the server level.
@@ -1,24 +1,24 @@
1
1
  ---
2
- title: 编写 UI 组件
2
+ title: Add UI Components
3
3
  ---
4
4
 
5
- 上一章节中,我们学习了如何初始化项目,并使用配置修改 Modern.js 的默认行为。
5
+ In the previous chapter, we learned how to initialize a project and use configuration to modify the default behavior of Modern.js.
6
6
 
7
- 这一章节中,我们继续沿用上一章节的项目代码,继续完善联系人列表。
7
+ In this chapter, we continue to use the project code of the previous chapter and continue to improve the point of contact list.
8
8
 
9
- 为了做更好的 UI 展示和交互,我们引入组件库 [Antd](https://ant.design/index-cn) 来开发,使用 `<List>` 组件来代替原始的列表。先添加依赖:
9
+ In order to do better UI display and interaction, we introduce the component library [Antd](https://ant.design/index-cn) to develop, and use the `<List>` component instead of the primitive list. Add dependency first:
10
10
 
11
11
  ```bash
12
12
  pnpm add antd
13
13
  ```
14
14
 
15
- 修改 `src/routes/page.tsx`,在顶部导入组件:
15
+ Modify `src/routes/page.tsx` to import components at the top:
16
16
 
17
17
  ```ts
18
18
  import { List } from 'antd';
19
19
  ```
20
20
 
21
- 修改 `<App>` 组件的实现:
21
+ Modify the implementation of the `<App>` component:
22
22
 
23
23
  ```tsx
24
24
  function App() {
@@ -41,16 +41,16 @@ function App() {
41
41
  }
42
42
  ```
43
43
 
44
- 执行 `pnpm run dev`,查看运行结果:
44
+ Execute `pnpm run dev` to see the running results:
45
45
 
46
46
  ![result](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c02-antd-result.png)
47
47
 
48
- 可以看到 Ant Design 导出的组件,已经具备了完整的样式。
48
+ You can see that the components exported by Ant Design already have complete styles.
49
49
 
50
- :::info
51
- Modern.js [自动按需导入 Ant Design 组件需要的 CSS](https://github.com/ant-design/babel-plugin-import)
50
+ :::info note
51
+ Modern.js [Automatically import CSS required by Ant Design component on demand](https://github.com/ant-design/babel-plugin-import).
52
52
  :::
53
53
 
54
54
  :::note
55
- 我们也可以使用其他组件库来实现同样的功能,例如 [Arco Design](https://arco.design/)
55
+ We can also use other component libraries to implement the same functionality, such as [Arco Design](https://arco.design/).
56
56
  :::
@@ -1,31 +1,31 @@
1
1
  ---
2
- title: 添加样式
2
+ title: Add Style
3
3
  ---
4
4
 
5
5
  import Tabs from '@theme/Tabs';
6
6
  import TabItem from '@theme/TabItem';
7
7
 
8
- 上一章节中,我们学习了如何使用使用三方库中的组件。
8
+ In the previous chapter, we learned how to use components from the three-way library.
9
9
 
10
- 这一章节中,我们将学习如何实现 UI 组件。
10
+ In this chapter, we will learn how to implement UI components.
11
11
 
12
- ## 使用 CSS JS 组件
12
+ ## JS components using CSS
13
13
 
14
- 首先我们希望自己控制联系人头像的展示,实现这种设计稿:
14
+ First of all, we want to control the display of contact avatars by ourselves, and implement this design draft:
15
15
 
16
16
  ![design](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c03-css-expect.jpg)
17
17
 
18
- 假设没有现成的组件可以实现,那就需要自己写些 CSS 了,这里我们使用 [styled-components](https://styled-components.com/),来实现类似的需求。Modern.js 开箱即用的支持 styled-components,既不需要安装依赖,也不需要做任何配置。
18
+ Hypothesis has no ready-made components to implement, so you need to write some CSS yourself. Here we use [styled-components] (https://styled-components.com/) to implement similar requirements. Modern.js out of the box supports styled-components, which requires neither dependency nor configuration.
19
19
 
20
- styled-components 通过模块化的方式,避免了传统 CSS 写法上的诸多问题。例如直接在元素的 style 属性上写样式,UI 视觉上的细节也会跟 UI 结构上的细节和业务逻辑混在一起。或是 classname 需要避免全局空间重名,需要用到命名规范的问题。
20
+ Style-components avoids many problems of traditional CSS writing through modularization. For example, writing styles directly on the style attribute of elements, the visual details of UI will also be mixed with the details of UI structure and business logic. Or classname needs to avoid global space renaming, which requires the use of naming conventions.
21
21
 
22
- `src/routes/page.tsx` 里修改顶部的代码:
22
+ Modify the code at the top in `src/routes/page.tsx`:
23
23
 
24
24
  ```js
25
25
  import styled from '@modern-js/runtime/styled';
26
26
  ```
27
27
 
28
- 添加以下代码:
28
+ Add the following code:
29
29
 
30
30
  ```js
31
31
  const Avatar = styled.img`
@@ -36,7 +36,7 @@ const Avatar = styled.img`
36
36
  `;
37
37
  ```
38
38
 
39
- 修改 `List.Item.Meta` 的代码:
39
+ Modify the code of `List.Item.Meta`:
40
40
 
41
41
  ```tsx
42
42
  <List.Item.Meta
@@ -46,11 +46,11 @@ const Avatar = styled.img`
46
46
  />
47
47
  ```
48
48
 
49
- 执行 `pnpm run dev`,可以看到预期的运行结果:
49
+ Execute `pnpm run dev` to see the expected running result:
50
50
 
51
51
  ![result](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c03-css-result1.png)
52
52
 
53
- 接下来我们做一点重构,为了增强可读性,让代码更容易维护,可以把 Avatar 组件拆分出去。我们在终端执行以下命令,创建新的文件:
53
+ Next we do a little refactoring. To enhance legibility and make the code easier to maintain, we can split the Avatar component. We execute the following command at the end point to create a new file:
54
54
 
55
55
  <Tabs>
56
56
  <TabItem value="macOS" label="macOS" default>
@@ -71,13 +71,13 @@ ni src/components/Avatar/index.tsx
71
71
  </TabItem>
72
72
  </Tabs>
73
73
 
74
- `src/routes/page.tsx` 里的 `<Avatar>` 实现删掉,修改为:
74
+ Delete the `<Avatar>` implementation in `src/routes/page.tsx` and change it to:
75
75
 
76
76
  ```ts
77
77
  import Avatar from '../components/Avatar';
78
78
  ```
79
79
 
80
- `src/components/Avatar/index.tsx` 的内容,修改为:
80
+ The content of `src/components/Avatar/index.tsx` is modified to:
81
81
 
82
82
  ```ts
83
83
  import styled from '@modern-js/runtime/styled';
@@ -92,37 +92,36 @@ const Avatar = styled.img`
92
92
  export default Avatar;
93
93
  ```
94
94
 
95
- 执行 `pnpm run dev`,运行结果应该是一样的。
95
+ Execute `pnpm run dev`, the result should be the same.
96
96
 
97
- :::info
98
- 采用目录形式 `Avatar/index.tsx` 而不是单文件形式 `Avatar.tsx` 的原因是,之后可以方便的在目录内部增加子文件,包括专用的资源(图片等)、专用子组件、CSS 文件等。
97
+ :::info note
98
+ The reason for using the directory form `Avatar/index.tsx` instead of the single-file form `Avatar.tsx` is that you can easily add sub-files inside the directory later, including dedicated resources (pictures, etc.), dedicated sub-components, CSS files, etc.
99
99
  :::
100
100
 
101
+ ## Utility
101
102
 
102
- ## 使用 Utility
103
+ We have used the style-components implementation `<Avatar>` component, but the current UI is still unsatisfactory and lacks professionalism, such as the list item inhouse layout is a bit rough and misaligned in many places.
103
104
 
104
- 我们已经使用 style-components 实现 `<Avatar>` 组件,但当前的 UI 仍然不能让人满意,缺乏专业感,例如列表项内部的布局有点粗糙,很多地方没对齐。
105
-
106
- 现在,我们自己来实现一个更好的 `Item` 组件,实现这样的设计稿:
105
+ Now, let's implement a better `Item` component ourselves, implementing a design draft like this:
107
106
 
108
107
  ![design](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/docs/06/design2.png)
109
108
 
110
- 这次要实现的 UI 更复杂,有内部结构,但另一方面,并没有 `<Avatar>` 组件的**很粗的亮蓝色边框**这样很特殊的 UI,都是很常规的水平垂直布局、居中、字体样式等。这种情况下,其实根本没必要写 CSS,有更高效的、跟 styled-components 互补的实现方式:**Utility Class**。
109
+ The UI to be implemented this time is more complex and has an internal structure, but on the other hand, there is no very thick bright blue border of the `<Avatar>` component such a very special UI, which is a very conventional horizontal and vertical layout, centering, font style, etc. In this case, there is actually no need to write CSS at all. There is a more efficient implementation method that complements styled-components: **Utility Class**.
111
110
 
112
- Modern.js 集成了主流、轻量、通用的 Utility Class 工具库 [Tailwind CSS](https://tailwindcss.com/)
111
+ Modern.js integrates the mainstream, light, general-purpose Utility Class library [Tailwind CSS](https://tailwindcss.com/).
113
112
 
114
- 执行 `pnpm run new`,进行如下选择,开启 Tailwind CSS
113
+ Execute `pnpm run new` and select the following to start Tailwind CSS:
115
114
 
116
115
  ```bash
117
- ? 请选择你想要的操作 启用可选功能
118
- ? 启用可选功能 启用 Tailwind CSS 支持
116
+ ? Action: Enable features
117
+ ? Enable features: Enable Tailwind CSS
119
118
  ```
120
119
 
121
- `modern.config.ts` 中注册 Tailwind 插件:
120
+ Register the Tailwind plugin in `modern.config.ts`:
122
121
 
123
122
  ```ts title="modern.config.ts"
124
- import AppToolsPlugin, { defineConfig } from '@modern-js/app-tools';
125
- import TailwindCSSPlugin from '@modern-js/plugin-tailwindcss';
123
+ import appTools, { defineConfig } from '@modern-js/app-tools';
124
+ import tailwindcssPlugin from '@modern-js/plugin-tailwindcss';
126
125
 
127
126
  // https://modernjs.dev/docs/apis/app/config
128
127
  export default defineConfig({
@@ -133,11 +132,11 @@ export default defineConfig({
133
132
  server: {
134
133
  ssr: true,
135
134
  },
136
- plugins: [AppToolsPlugin(), TailwindCSSPlugin()],
135
+ plugins: [appTools(), tailwindcssPlugin()],
137
136
  });
138
137
  ```
139
138
 
140
- `src/routes/page.tsx` 顶部引入 Tailwind CSS css 文件,就可以开始快速实现专业的 UI
139
+ Import the Tailwind CSS css file at the top of `src/routes/page.tsx` to start a quick implementation of the professional UI:
141
140
 
142
141
  ```js
143
142
  import 'tailwindcss/base.css';
@@ -145,7 +144,7 @@ import 'tailwindcss/components.css';
145
144
  import 'tailwindcss/utilities.css';
146
145
  ```
147
146
 
148
- 先创建 Item 组件:
147
+ Create the Item component first:
149
148
 
150
149
  <Tabs>
151
150
  <TabItem value="macOS" label="macOS" default>
@@ -166,7 +165,7 @@ ni src/components/Item/index.tsx
166
165
  </TabItem>
167
166
  </Tabs>
168
167
 
169
- 修改 `src/routes/page.tsx`,把 `List` `render` 实现交给 `Item` 组件:
168
+ Modify `src/routes/page.tsx` to pass the `render` implementation of `List` to `Item` component:
170
169
 
171
170
  ```js
172
171
  import { List } from 'antd';
@@ -175,7 +174,7 @@ import 'tailwindcss/components.css';
175
174
  import 'tailwindcss/utilities.css';
176
175
  import Item from '../components/Item';
177
176
 
178
- const getAvatar = (users: Array<{ name: string; email: string }>) =>
177
+ const getAvatar = (users: Array<{ name: string, email: string }>) =>
179
178
  users.map(user => ({
180
179
  ...user,
181
180
  avatar: `https://avatars.dicebear.com/v2/identicon/${user.name}.svg`,
@@ -202,9 +201,9 @@ function Index() {
202
201
  export default Index;
203
202
  ```
204
203
 
205
- 在父容器的上使用了 [Utility Class](https://tailwindcss.com/docs/container) ,快速实现了最基本的最大宽度、居中等样式。
204
+ Utility Class(https://tailwindcss.com/docs/container) is used on the parent container for a quick implementation of the most basic maximum width, center, and other styles.
206
205
 
207
- 接下来实现 `src/components/Item/index.tsx`:
206
+ Next implementation `src/components/Item/index.tsx`:
208
207
 
209
208
  ```tsx
210
209
  import Avatar from '../Avatar';
@@ -242,20 +241,19 @@ const Item = ({ info }: { info: InfoProps }) => {
242
241
  export default Item;
243
242
  ```
244
243
 
245
- 执行 `pnpm run dev`,可以看到预期的运行结果:
244
+ Execute `pnpm run dev` to see the expected running result:
246
245
 
247
246
  ![result](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/docs/06/result2.png)
248
247
 
249
- 我们只使用了少量 Utility Class,比如 [Flex](https://tailwindcss.com/docs/display/)[Padding](https://tailwindcss.com/docs/padding/)[Margin](https://tailwindcss.com/docs/margin/)[Text](https://tailwindcss.com/docs/text-color/)[Font](https://tailwindcss.com/docs/font-weight/)[Border](https://tailwindcss.com/docs/border-width),不写一行 CSS 就实现了符合设计稿的专业 UI
250
-
248
+ We only use a few Utility Classes, such as [Flex](https://tailwindcss.com/docs/display/), [Padding](https://tailwindcss.com/docs/padding/), [Margin](https://tailwindcss.com/docs/margin/), [Text](https://tailwindcss.com/docs/text-color/), [Font](https://tailwindcss.com/docs/font-weight/), [Border](https://tailwindcss.com/docs/border-width), without writing a single CSS implementation Professional UI that conforms to the design draft.
251
249
 
252
- ## 自定义 Utility Class
250
+ ## Customized Utility Class
253
251
 
254
- 我们也可以自己实现新的 Utility Class,方便在代码间复用。
252
+ We can also implement the new Utility Class ourselves to facilitate reuse between codes.
255
253
 
256
- Utility Class 本身也是一种**面向组件**的技术(将不同 class 用在一个组件上,等价于给这个组件设置了一些来自基类的属性),但 Utility Class classname 是全局的(因为要用在任意组件/元素上),很适合用独立 CSS 文件来实现。
254
+ Utility Class itself is also a **component-oriented** technology (using different classes on a component is equivalent to setting some attributes from the base class for this component), but the classname of Utility Class is global (because it is used on arbitrary components/elements), it is very suitable for implementation with separate CSS files.
257
255
 
258
- 创建一个新的 CSS 文件:
256
+ Create a new CSS file:
259
257
 
260
258
  <Tabs>
261
259
  <TabItem value="macOS" label="macOS" default>
@@ -282,11 +280,11 @@ ni src/styles/utils.css
282
280
  import '../styles/utils.css';
283
281
  ```
284
282
 
285
- `src/routes/styles/utils.css` 里实现一个名为 `custom-text-gray` Utility Class。
283
+ A Utility Class named `custom-text-gray` is implemented in `src/routes/styles/utils.css`.
286
284
 
287
285
  ```css
288
286
  :root {
289
- --custom-text-color:rgb(113, 128, 150);
287
+ --custom-text-color: rgb(113, 128, 150);
290
288
  }
291
289
 
292
290
  .custom-text-gray {
@@ -294,31 +292,30 @@ import '../styles/utils.css';
294
292
  }
295
293
  ```
296
294
 
297
- :::info
298
- Modern.js 集成了 [PostCSS](/docs/guides/basic-features/css/postcss),支持现代 CSS 语法特性,比如 [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*)
295
+ :::info note
296
+ Modern.js integrates with [PostCSS](/docs/guides/basic-features/css/postcss) and supports modern CSS syntax features such as [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).
299
297
  :::
300
298
 
301
- `src/routes/components/Item/index.tsx` 里使用,把:
299
+ Use in `src/routes/components/Item/index.tsx`:
302
300
 
303
301
  ```js
304
302
  <div className="ml-4 flex-1 flex justify-between">
305
303
  ```
306
304
 
307
- 改成:
305
+ Change to:
308
306
 
309
307
  ```js
310
308
  <div className="ml-4 custom-text-gray flex-1 flex justify-between">
311
309
  ```
312
310
 
313
- 执行 `pnpm run dev`,可以看到字体颜色改变了:
311
+ Execute `pnpm run dev`, you can see that the font color has changed:
314
312
 
315
313
  ![design2](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/docs/06/result3.png)
316
314
 
317
- :::info
318
- 此处只是为了演示 Utility Class 用法。真实项目中,在有 Tailwind CSS 的情况下,这种 Utility Class 没什么价值,应该通过配置 Design System [**theme**](https://tailwindcss.com/docs/customizing-colors) 来增加字体颜色。
315
+ :::info note
316
+ This is just to demonstrate Utility Class usage. In a real project, with Tailwind CSS, this Utility Class is of little value and should be added to the font color through the [**theme**](https://tailwindcss.com/docs/customizing-colors) of the configuration Design System.
319
317
 
320
- `utils.css` 也可以写成 `utils.scss` `utils.less`,Modern.js SCSS Less 同样提供开箱即用的支持。
318
+ `utils.css` can also be written as `utils.scss` or `utils.less`, Modern.js out of the box support for SCSS and Less.
321
319
 
322
- 不过在 PostCSS 的支持下,现代 CSS 应该足以满足这些开发需求,性能相较于预处理器也更好,建议优先用 .css 文件。
320
+ However, with the support of PostCSS, modern CSS should be sufficient to meet these development needs, and the performance is also better than that of the preprocessor. It is recommended to use `.css` files first.
323
321
  :::
324
-
@@ -1,17 +1,17 @@
1
1
  ---
2
- title: 添加客户端路由
2
+ title: Add Client Route
3
3
  ---
4
4
 
5
5
  import Tabs from '@theme/Tabs';
6
6
  import TabItem from '@theme/TabItem';
7
7
 
8
- 上一章节中,我们学习了如何为创建 UI 组件,并添加样式。
8
+ In the previous chapter, we learned how to create UI components and add styles.
9
9
 
10
- 这一章节中,我们将会学习如何添加**客户端路由**。
10
+ In this chapter, we will learn how to add **Client Route**.
11
11
 
12
- 之前我们已经为联系人列表增加了 Archive 按钮,接下来我们添加一个客户端路由 `/archives`,访问这个路由时,只显示已存档的联系人,而原有的 `/` 继续显示所有联系人。
12
+ Previously we have added the Archive button to the point of contact list, next we add a route `/archives`, when accessing this route, only the point of contact of the saved file is displayed, while the original `/` continues to display all points of contact.
13
13
 
14
- 新建 `src/routes/archives/page.tsx` 文件:
14
+ Create a new `src/routes/archives/page.tsx` file:
15
15
 
16
16
  <Tabs>
17
17
  <TabItem value="macOS" label="macOS" default>
@@ -32,7 +32,7 @@ ni src/routes/archives/page.tsx
32
32
  </TabItem>
33
33
  </Tabs>
34
34
 
35
- 添加如下代码:
35
+ Add the following code:
36
36
 
37
37
  ```tsx title="src/archives/page.tsx"
38
38
  import { List } from 'antd';
@@ -67,7 +67,7 @@ function Index() {
67
67
  export default Index;
68
68
  ```
69
69
 
70
- 这里使用了 [React Helmet](https://github.com/nfl/react-helmet) `Helmet` 组件,在 `src/routes/page.tsx` 中也添加 Helmet 组件:
70
+ The `Helmet` component of [React Helmet](https://github.com/nfl/react-helmet) is used here, and the Helmet component is also added in `src/routes/page.tsx`:
71
71
 
72
72
  ```tsx
73
73
  import { Helmet } from '@modern-js/runtime/head';
@@ -84,11 +84,11 @@ function Index() {
84
84
  }
85
85
  ```
86
86
 
87
- :::info
88
- Modern.js 默认集成了 react-helmet,也可以结合 SSR 使用,满足 SEO 需求。
87
+ :::info note
88
+ Modern.js integrates react-helmet by default, and can also be used in conjunction with SSR to meet SEO needs.
89
89
  :::
90
90
 
91
- 因为现在有多个页面,都需要用到前面的 Utility Class,因此我们需要把样式文件移动到 `src/routes/layout.tsx`:
91
+ Since there are multiple pages now, all of which need to use the previous Utility Class, we need to move the style file to `src/routes/layout.tsx`:
92
92
 
93
93
  ```tsx
94
94
  import 'tailwindcss/base.css';
@@ -97,25 +97,25 @@ import 'tailwindcss/utilities.css';
97
97
  import '../styles/utils.css';
98
98
  ```
99
99
 
100
- 执行 `pnpm run dev`,访问 `http://localhost:8080`,可以看到完整的联系人,页面的标题是 All
100
+ Execute `pnpm run dev`, visit `http://localhost:8080`, you can see the full point of contact, the title of the page is All:
101
101
 
102
102
  ![display1](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c04-archives.png)
103
103
 
104
- 访问 `http://localhost:8080/archives`,只会看到已存档的联系人,页面的标题是 Archives
104
+ Visit `http://localhost:8080/archives` and you will only see the point of contact of the saved file with the title Archives:
105
105
 
106
106
  ![display](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c04-all.png)
107
107
 
108
- 查看页面 HTML 源码,可以看到两个页面的内容是一样,是在客户端针对不同 URL 渲染不同内容。
108
+ Looking at the HTML source code of the page, you can see that the content of the two pages is the same, and different content is rendered for different URLs.
109
109
 
110
- **接下来我们增加一个简单的导航栏,让用户能在两个列表之间切换**。
110
+ **Next we add a simple navigation bar that allows the user to toggle between the two lists**.
111
111
 
112
- 打开 `src/routes/layout.tsx`,在顶部导入 Radio 组件:
112
+ Open `src/routes/layout.tsx` and import the Radio component at the top:
113
113
 
114
114
  ```tsx
115
115
  import { Radio } from 'antd';
116
116
  ```
117
117
 
118
- 然后将 UI 最顶部进行修改,增加一组单选框
118
+ Then modify the top of the UI to add a set of radio group:
119
119
 
120
120
  ```tsx {4-9}
121
121
  export default function Layout() {
@@ -133,17 +133,17 @@ export default function Layout() {
133
133
  }
134
134
  ```
135
135
 
136
- 然后我们来实现 `currentList` `handleSetList`。
136
+ Then we come to the implementation of `currentList` and `handleSetList`.
137
137
 
138
- 引入三个 React Hook:`useState` `useNavigate` `useParams`,以及 Ant Design 的事件类型定义:
138
+ Introducing three React Hooks: `useState` and `useNavigate` and `useParams`, as well as Ant Design's event type definition:
139
139
 
140
140
  ```js
141
141
  import { useState } from 'react';
142
142
  import { Radio, RadioChangeEvent } from 'antd';
143
- import { Outlet, useLocation, useNavigate } from "@modern-js/runtime/router";
143
+ import { Outlet, useLocation, useNavigate } from '@modern-js/runtime/router';
144
144
  ```
145
145
 
146
- 最后在 Layout 组件里增加局部状态和相关逻辑:
146
+ Finally, add local state and related logic to the Layout component:
147
147
 
148
148
  ```tsx {2-9}
149
149
  export default function Layout() {
@@ -160,10 +160,10 @@ export default function Layout() {
160
160
  }
161
161
  ```
162
162
 
163
- 到这里就已经完成了页面导航栏实现,执行 `pnpm run dev` 查看效果:
163
+ At this point, the page navigation bar implementation has been completed, and execute `pnpm run dev` to see the effect:
164
164
 
165
165
  ![display2](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/tutorials/c04-switch.png)
166
166
 
167
- 点击导航栏中 Archives,可以看到单选框的选中状态和 URL 都会变化,页面没有刷新,只发生了 CSR
167
+ Click Archives in the navigation bar, you can see that the selected state and URL of the radio box will change, the page is not refreshed, only CSR occurs.
168
168
 
169
- 通过 URL 访问两个页面,可以看到 HTML 内容是不同的,这是因为在 SSR 阶段页面就执行了客户端路由的逻辑,HTML 里已经包含了最终的渲染结果。
169
+ Accessing the two pages through the URL, you can see that the HTML content is different, because the page executes the logic of client routing in the SSR stage, and the HTML already contains the final render result.
@@ -1,23 +1,23 @@
1
1
  ---
2
- title: 添加 Loader
2
+ title: Add Loader
3
3
  ---
4
4
 
5
- 上一章节中,我们学习了如何添加客户端路由。
5
+ In the previous chapter, we learned how to add client route.
6
6
 
7
- 这一章节中,我们将会学习如何为**路由组件添加 Loader**。
7
+ In this chapter, we will learn how to add **Loader** to the routing component.
8
8
 
9
- 到目前为止,我们都是通过硬编码的方式,为组件提供数据。如果要从远端获取数据,通常情况下会使用 `useEffect` 来做。但在启用 SSR 的情况下,`useEffect` 是不会在服务端执行的,所以这种 SSR 只能渲染很有限的 UI
9
+ By far, we have provided data to components through hardcoding. If you want to get data from the remote, you usually use `useEffect` to do it. But when SSR is enabled, `useEffect` will not be executed at the server level, so this SSR can only render a very limited UI.
10
10
 
11
- Modern.js 为提供了 Data Loader 的能力,支持同构的在组件中获取数据,让 SSR 的价值最大化。
11
+ Modern.js provides the ability of Data Loader to support homogeneous data acquisition in components to maximize the value of SSR.
12
12
 
13
- 下面我们演示如何为路由组件添加 Data Loader,并模拟远端数据获取。我们使用 faker mock 需要的数据,首先安装依赖:
13
+ Below we demonstrate how to add Data Loader to the routing component and simulate remote data acquisition. We use faker to mock the required data, first install dependency:
14
14
 
15
15
  ```bash
16
16
  pnpm add faker@5
17
17
  pnpm add @types/faker@5 -D
18
18
  ```
19
19
 
20
- 修改 `src/routes/page.tsx`:
20
+ Modify `src/routes/page.tsx`:
21
21
 
22
22
  ```tsx
23
23
  import { name, internet } from 'faker';
@@ -49,10 +49,10 @@ export const loader = async (): Promise<LoaderData> => {
49
49
  ```
50
50
 
51
51
  :::note
52
- Data Loader 并非只为 SSR 工作。在 CSR 项目中,Data Loader 也可以避免数据获取依赖 UI 渲染,解决请求瀑布流的问题。未来,Modern.js 也会为这一特性添加更多能力,例如预获取、数据缓存等。
52
+ Data Loader doesn't just work for SSR. In CSR projects, Data Loader can also avoid data acquisition dependency UI rendering, which solves the problem of requesting dynamic grid layout. In the future, Modern.js will also add more capabilities to this feature, such as pre-fetching, data caching, etc.
53
53
  :::
54
54
 
55
- Modern.js 也提供了一个叫 `useLoaderData` hooks API,我们修改 `src/routes/page.tsx` 导出的组件:
55
+ Modern.js also provides a hooks API called `useLoaderData`, we modify the exported component of `src/routes/page.tsx`:
56
56
 
57
57
  ```tsx {1,4,13}
58
58
  import { useLoaderData } from '@modern-js/runtime/router';
@@ -67,7 +67,7 @@ function Index() {
67
67
  </Helmet>
68
68
  <List
69
69
  dataSource={data}
70
- renderItem={(info) => <Item key={info.name} info={info} />}
70
+ renderItem={info => <Item key={info.name} info={info} />}
71
71
  />
72
72
  </div>
73
73
  );
@@ -77,6 +77,7 @@ export default Index;
77
77
  ```
78
78
 
79
79
  <!-- Todo 重新截图,SSR 内容 -->
80
- 重新执行 `pnpm run dev`,查看 `view-source:http://localhost:8080/`,或在 devtools 的 Network 面板里查看 HTML 请求的「 Preview 」,可以看到 SSR 渲染出来的 HTML 已经包含完整的 UI:
80
+
81
+ Re-execute `pnpm run dev`, view `view-source: http://localhost:8080/`, or view the "Preview" of the HTML request in the Network panel of devtools, you can see that the HTML rendered by SSR already contains the complete UI:
81
82
 
82
83
  ![display6](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/docs/11/display6.png)