@modern-js/main-doc 2.58.0 → 2.58.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. package/docs/en/_meta.json +27 -0
  2. package/docs/en/apis/_meta.json +13 -0
  3. package/docs/en/apis/app/hooks/_meta.json +28 -0
  4. package/docs/en/apis/app/hooks/config/icon.mdx +1 -1
  5. package/docs/en/apis/app/runtime/_meta.json +50 -0
  6. package/docs/en/apis/app/runtime/web-server/unstable_middleware.mdx +2 -2
  7. package/docs/en/community/_meta.json +11 -0
  8. package/docs/en/community/blog/2022-0708-updates.md +95 -0
  9. package/docs/en/community/blog/2022-0910-updates.md +80 -0
  10. package/docs/en/community/blog/_meta.json +6 -0
  11. package/docs/en/community/blog/v2-release-note.mdx +246 -0
  12. package/docs/en/components/debug-app.mdx +1 -1
  13. package/docs/en/configure/_meta.json +78 -0
  14. package/docs/en/configure/app/bff/prefix.mdx +1 -1
  15. package/docs/en/configure/app/deploy/microFrontend.mdx +1 -1
  16. package/docs/en/configure/app/dev/asset-prefix.mdx +1 -1
  17. package/docs/en/configure/app/dev/before-start-url.mdx +1 -1
  18. package/docs/en/configure/app/dev/client.mdx +1 -1
  19. package/docs/en/configure/app/dev/hmr.mdx +1 -1
  20. package/docs/en/configure/app/dev/host.mdx +1 -1
  21. package/docs/en/configure/app/dev/https.mdx +1 -1
  22. package/docs/en/configure/app/dev/live-reload.mdx +1 -1
  23. package/docs/en/configure/app/dev/port.mdx +1 -1
  24. package/docs/en/configure/app/dev/progress-bar.mdx +1 -1
  25. package/docs/en/configure/app/dev/proxy.mdx +1 -1
  26. package/docs/en/configure/app/dev/setup-middlewares.mdx +1 -1
  27. package/docs/en/configure/app/dev/start-url.mdx +1 -1
  28. package/docs/en/configure/app/dev/watch-files.mdx +1 -1
  29. package/docs/en/configure/app/dev/write-to-disk.mdx +1 -1
  30. package/docs/en/configure/app/experiments/lazy-compilation.mdx +1 -1
  31. package/docs/en/configure/app/experiments/source-build.mdx +1 -1
  32. package/docs/en/configure/app/html/app-icon.mdx +1 -1
  33. package/docs/en/configure/app/html/crossorigin.mdx +1 -1
  34. package/docs/en/configure/app/html/disable-html-folder.mdx +1 -1
  35. package/docs/en/configure/app/html/favicon-by-entries.mdx +1 -1
  36. package/docs/en/configure/app/html/favicon.mdx +1 -1
  37. package/docs/en/configure/app/html/inject-by-entries.mdx +1 -1
  38. package/docs/en/configure/app/html/inject.mdx +1 -1
  39. package/docs/en/configure/app/html/meta-by-entries.mdx +1 -1
  40. package/docs/en/configure/app/html/meta.mdx +1 -1
  41. package/docs/en/configure/app/html/mount-id.mdx +1 -1
  42. package/docs/en/configure/app/html/script-loading.mdx +1 -1
  43. package/docs/en/configure/app/html/tags-by-entries.mdx +1 -1
  44. package/docs/en/configure/app/html/tags.mdx +1 -1
  45. package/docs/en/configure/app/html/template-by-entries.mdx +1 -1
  46. package/docs/en/configure/app/html/template-parameters-by-entries.mdx +1 -1
  47. package/docs/en/configure/app/html/template-parameters.mdx +1 -1
  48. package/docs/en/configure/app/html/template.mdx +1 -1
  49. package/docs/en/configure/app/html/title-by-entries.mdx +1 -1
  50. package/docs/en/configure/app/html/title.mdx +1 -1
  51. package/docs/en/configure/app/output/asset-prefix.mdx +1 -1
  52. package/docs/en/configure/app/output/assets-retry.mdx +1 -1
  53. package/docs/en/configure/app/output/charset.mdx +1 -1
  54. package/docs/en/configure/app/output/clean-dist-path.mdx +1 -1
  55. package/docs/en/configure/app/output/convert-to-rem.mdx +1 -1
  56. package/docs/en/configure/app/output/copy.mdx +1 -1
  57. package/docs/en/configure/app/output/css-module-local-ident-name.mdx +1 -1
  58. package/docs/en/configure/app/output/css-modules.mdx +1 -1
  59. package/docs/en/configure/app/output/data-uri-limit.mdx +1 -1
  60. package/docs/en/configure/app/output/disable-css-extract.mdx +1 -1
  61. package/docs/en/configure/app/output/disable-css-module-extension.mdx +1 -1
  62. package/docs/en/configure/app/output/disable-filename-hash.mdx +1 -1
  63. package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
  64. package/docs/en/configure/app/output/disable-minimize.mdx +1 -1
  65. package/docs/en/configure/app/output/disable-node-polyfill.mdx +1 -1
  66. package/docs/en/configure/app/output/disable-source-map.mdx +1 -1
  67. package/docs/en/configure/app/output/disable-svgr.mdx +1 -1
  68. package/docs/en/configure/app/output/disable-ts-checker.mdx +1 -1
  69. package/docs/en/configure/app/output/dist-path.mdx +1 -1
  70. package/docs/en/configure/app/output/enable-asset-fallback.mdx +1 -1
  71. package/docs/en/configure/app/output/enable-asset-manifest.mdx +1 -1
  72. package/docs/en/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
  73. package/docs/en/configure/app/output/enable-inline-route-manifests.mdx +1 -1
  74. package/docs/en/configure/app/output/enable-inline-scripts.mdx +1 -1
  75. package/docs/en/configure/app/output/enable-inline-styles.mdx +1 -1
  76. package/docs/en/configure/app/output/enable-latest-decorators.mdx +1 -1
  77. package/docs/en/configure/app/output/externals.mdx +1 -1
  78. package/docs/en/configure/app/output/filename-hash.mdx +1 -1
  79. package/docs/en/configure/app/output/filename.mdx +1 -1
  80. package/docs/en/configure/app/output/legal-comments.mdx +1 -1
  81. package/docs/en/configure/app/output/override-browserslist.mdx +1 -1
  82. package/docs/en/configure/app/output/polyfill.mdx +1 -1
  83. package/docs/en/configure/app/output/splitRouteChunks.mdx +1 -1
  84. package/docs/en/configure/app/output/ssg.mdx +1 -1
  85. package/docs/en/configure/app/output/svg-default-export.mdx +1 -1
  86. package/docs/en/configure/app/output/temp-dir.mdx +1 -1
  87. package/docs/en/configure/app/performance/build-cache.mdx +1 -1
  88. package/docs/en/configure/app/performance/bundle-analyze.mdx +1 -1
  89. package/docs/en/configure/app/performance/chunk-split.mdx +1 -1
  90. package/docs/en/configure/app/performance/dns-prefetch.mdx +1 -1
  91. package/docs/en/configure/app/performance/preconnect.mdx +1 -1
  92. package/docs/en/configure/app/performance/prefetch.mdx +1 -1
  93. package/docs/en/configure/app/performance/preload.mdx +1 -1
  94. package/docs/en/configure/app/performance/print-file-size.mdx +1 -1
  95. package/docs/en/configure/app/performance/profile.mdx +1 -1
  96. package/docs/en/configure/app/performance/remove-console.mdx +1 -1
  97. package/docs/en/configure/app/performance/remove-moment-locale.mdx +1 -1
  98. package/docs/en/configure/app/performance/transform-lodash.mdx +1 -1
  99. package/docs/en/configure/app/runtime/{intro.mdx → 0-intro.mdx} +1 -1
  100. package/docs/en/configure/app/runtime/master-app.mdx +1 -1
  101. package/docs/en/configure/app/runtime/router.mdx +3 -1
  102. package/docs/en/configure/app/runtime/state.mdx +1 -1
  103. package/docs/en/configure/app/security/check-syntax.mdx +1 -1
  104. package/docs/en/configure/app/security/nonce.mdx +1 -1
  105. package/docs/en/configure/app/security/sri.mdx +1 -1
  106. package/docs/en/configure/app/server/base-url.mdx +1 -1
  107. package/docs/en/configure/app/server/enable-framework-ext.mdx +1 -1
  108. package/docs/en/configure/app/server/port.mdx +1 -1
  109. package/docs/en/configure/app/server/public-routes.mdx +1 -1
  110. package/docs/en/configure/app/server/routes.mdx +1 -1
  111. package/docs/en/configure/app/server/ssr-by-entries.mdx +1 -1
  112. package/docs/en/configure/app/server/ssr.mdx +1 -1
  113. package/docs/en/configure/app/source/alias-strategy.mdx +1 -1
  114. package/docs/en/configure/app/source/alias.mdx +1 -1
  115. package/docs/en/configure/app/source/config-dir.mdx +1 -1
  116. package/docs/en/configure/app/source/decorators.mdx +1 -1
  117. package/docs/en/configure/app/source/define.mdx +1 -1
  118. package/docs/en/configure/app/source/disable-default-entries.mdx +1 -1
  119. package/docs/en/configure/app/source/disable-entry-dirs.mdx +1 -1
  120. package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
  121. package/docs/en/configure/app/source/enable-custom-entry.mdx +1 -1
  122. package/docs/en/configure/app/source/entries-dir.mdx +1 -1
  123. package/docs/en/configure/app/source/entries.mdx +1 -1
  124. package/docs/en/configure/app/source/exclude.mdx +1 -1
  125. package/docs/en/configure/app/source/global-vars.mdx +1 -1
  126. package/docs/en/configure/app/source/include.mdx +1 -1
  127. package/docs/en/configure/app/source/mainEntryName.mdx +1 -1
  128. package/docs/en/configure/app/source/module-scopes.mdx +1 -1
  129. package/docs/en/configure/app/source/pre-entry.mdx +1 -1
  130. package/docs/en/configure/app/source/resolve-extension-prefix.mdx +1 -1
  131. package/docs/en/configure/app/source/resolve-main-fields.mdx +1 -1
  132. package/docs/en/configure/app/source/transform-import.mdx +1 -1
  133. package/docs/en/configure/app/tools/autoprefixer.mdx +1 -1
  134. package/docs/en/configure/app/tools/babel.mdx +1 -1
  135. package/docs/en/configure/app/tools/bundler-chain.mdx +1 -1
  136. package/docs/en/configure/app/tools/css-extract.mdx +1 -1
  137. package/docs/en/configure/app/tools/css-loader.mdx +1 -1
  138. package/docs/en/configure/app/tools/dev-server.mdx +1 -1
  139. package/docs/en/configure/app/tools/esbuild.mdx +2 -2
  140. package/docs/en/configure/app/tools/html-plugin.mdx +1 -1
  141. package/docs/en/configure/app/tools/less.mdx +1 -1
  142. package/docs/en/configure/app/tools/minify-css.mdx +1 -1
  143. package/docs/en/configure/app/tools/postcss.mdx +1 -1
  144. package/docs/en/configure/app/tools/pug.mdx +1 -1
  145. package/docs/en/configure/app/tools/rspack.mdx +1 -1
  146. package/docs/en/configure/app/tools/sass.mdx +1 -1
  147. package/docs/en/configure/app/tools/style-loader.mdx +1 -1
  148. package/docs/en/configure/app/tools/styled-components.mdx +1 -1
  149. package/docs/en/configure/app/tools/swc.mdx +2 -2
  150. package/docs/en/configure/app/tools/tailwindcss.mdx +1 -1
  151. package/docs/en/configure/app/tools/terser.mdx +1 -1
  152. package/docs/en/configure/app/tools/ts-checker.mdx +1 -1
  153. package/docs/en/configure/app/tools/ts-loader.mdx +1 -1
  154. package/docs/en/configure/app/tools/webpack-chain.mdx +1 -1
  155. package/docs/en/configure/app/tools/webpack.mdx +1 -1
  156. package/docs/en/guides/_meta.json +38 -0
  157. package/docs/en/guides/advanced-features/_meta.json +26 -0
  158. package/docs/en/guides/advanced-features/bff/_meta.json +6 -0
  159. package/docs/en/guides/advanced-features/rsbuild-plugin.mdx +9 -9
  160. package/docs/en/guides/advanced-features/ssr/_meta.json +5 -0
  161. package/docs/en/guides/basic-features/_meta.json +22 -0
  162. package/docs/en/guides/basic-features/data/_meta.json +4 -0
  163. package/docs/en/guides/concept/_meta.json +4 -0
  164. package/docs/en/guides/{deprecat.md → deprecated.md} +1 -1
  165. package/docs/en/guides/get-started/_meta.json +7 -0
  166. package/docs/en/guides/get-started/quick-start.mdx +2 -2
  167. package/docs/en/guides/get-started/upgrade.mdx +1 -1
  168. package/docs/en/guides/rsbuild-plugins/plugin-esbuild.mdx +205 -0
  169. package/docs/en/guides/rsbuild-plugins/plugin-swc.mdx +356 -0
  170. package/docs/en/guides/topic-detail/_meta.json +26 -0
  171. package/docs/en/guides/topic-detail/framework-plugin/_meta.json +10 -0
  172. package/docs/en/guides/topic-detail/generator/_meta.json +17 -0
  173. package/docs/en/guides/topic-detail/generator/create/_meta.json +5 -0
  174. package/docs/en/guides/topic-detail/generator/new/_meta.json +5 -0
  175. package/docs/en/guides/topic-detail/generator/plugin/_meta.json +11 -0
  176. package/docs/en/guides/topic-detail/model/_meta.json +14 -0
  177. package/docs/en/guides/troubleshooting/_meta.json +6 -0
  178. package/docs/en/guides/troubleshooting/dependencies.mdx +4 -4
  179. package/docs/en/tutorials/_meta.json +17 -0
  180. package/docs/zh/_meta.json +27 -0
  181. package/docs/zh/apis/_meta.json +13 -0
  182. package/docs/zh/apis/app/hooks/_meta.json +28 -0
  183. package/docs/zh/apis/app/hooks/config/icon.mdx +1 -1
  184. package/docs/zh/apis/app/runtime/_meta.json +50 -0
  185. package/docs/zh/apis/app/runtime/web-server/unstable_middleware.mdx +2 -2
  186. package/docs/zh/community/_meta.json +11 -0
  187. package/docs/zh/community/blog/_meta.json +6 -0
  188. package/docs/zh/community/blog/v2-release-note.mdx +1 -2
  189. package/docs/zh/components/debug-app.mdx +1 -1
  190. package/docs/zh/configure/_meta.json +78 -0
  191. package/docs/zh/configure/app/auto-load-plugin.mdx +1 -1
  192. package/docs/zh/configure/app/bff/prefix.mdx +1 -1
  193. package/docs/zh/configure/app/builder-plugins.mdx +1 -1
  194. package/docs/zh/configure/app/deploy/microFrontend.mdx +1 -1
  195. package/docs/zh/configure/app/dev/asset-prefix.mdx +1 -1
  196. package/docs/zh/configure/app/dev/before-start-url.mdx +1 -1
  197. package/docs/zh/configure/app/dev/client.mdx +1 -1
  198. package/docs/zh/configure/app/dev/hmr.mdx +1 -1
  199. package/docs/zh/configure/app/dev/host.mdx +1 -1
  200. package/docs/zh/configure/app/dev/https.mdx +1 -1
  201. package/docs/zh/configure/app/dev/live-reload.mdx +1 -1
  202. package/docs/zh/configure/app/dev/port.mdx +1 -1
  203. package/docs/zh/configure/app/dev/progress-bar.mdx +1 -1
  204. package/docs/zh/configure/app/dev/proxy.mdx +1 -1
  205. package/docs/zh/configure/app/dev/setup-middlewares.mdx +1 -1
  206. package/docs/zh/configure/app/dev/start-url.mdx +1 -1
  207. package/docs/zh/configure/app/dev/watch-files.mdx +1 -1
  208. package/docs/zh/configure/app/dev/write-to-disk.mdx +1 -1
  209. package/docs/zh/configure/app/experiments/lazy-compilation.mdx +1 -1
  210. package/docs/zh/configure/app/experiments/source-build.mdx +1 -1
  211. package/docs/zh/configure/app/html/app-icon.mdx +1 -1
  212. package/docs/zh/configure/app/html/crossorigin.mdx +1 -1
  213. package/docs/zh/configure/app/html/disable-html-folder.mdx +1 -1
  214. package/docs/zh/configure/app/html/favicon-by-entries.mdx +1 -1
  215. package/docs/zh/configure/app/html/favicon.mdx +1 -1
  216. package/docs/zh/configure/app/html/inject-by-entries.mdx +1 -1
  217. package/docs/zh/configure/app/html/inject.mdx +1 -1
  218. package/docs/zh/configure/app/html/meta-by-entries.mdx +1 -1
  219. package/docs/zh/configure/app/html/meta.mdx +1 -1
  220. package/docs/zh/configure/app/html/mount-id.mdx +1 -1
  221. package/docs/zh/configure/app/html/script-loading.mdx +1 -1
  222. package/docs/zh/configure/app/html/tags-by-entries.mdx +1 -1
  223. package/docs/zh/configure/app/html/tags.mdx +1 -1
  224. package/docs/zh/configure/app/html/template-by-entries.mdx +1 -1
  225. package/docs/zh/configure/app/html/template-parameters-by-entries.mdx +1 -1
  226. package/docs/zh/configure/app/html/template-parameters.mdx +1 -1
  227. package/docs/zh/configure/app/html/template.mdx +1 -1
  228. package/docs/zh/configure/app/html/title-by-entries.mdx +1 -1
  229. package/docs/zh/configure/app/html/title.mdx +1 -1
  230. package/docs/zh/configure/app/output/asset-prefix.mdx +1 -1
  231. package/docs/zh/configure/app/output/assets-retry.mdx +1 -1
  232. package/docs/zh/configure/app/output/charset.mdx +1 -1
  233. package/docs/zh/configure/app/output/clean-dist-path.mdx +1 -1
  234. package/docs/zh/configure/app/output/convert-to-rem.mdx +1 -1
  235. package/docs/zh/configure/app/output/copy.mdx +1 -1
  236. package/docs/zh/configure/app/output/css-module-local-ident-name.mdx +1 -1
  237. package/docs/zh/configure/app/output/css-modules.mdx +1 -1
  238. package/docs/zh/configure/app/output/data-uri-limit.mdx +1 -1
  239. package/docs/zh/configure/app/output/disable-css-extract.mdx +1 -1
  240. package/docs/zh/configure/app/output/disable-css-module-extension.mdx +1 -1
  241. package/docs/zh/configure/app/output/disable-filename-hash.mdx +1 -1
  242. package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
  243. package/docs/zh/configure/app/output/disable-minimize.mdx +1 -1
  244. package/docs/zh/configure/app/output/disable-node-polyfill.mdx +1 -1
  245. package/docs/zh/configure/app/output/disable-source-map.mdx +1 -1
  246. package/docs/zh/configure/app/output/disable-svgr.mdx +1 -1
  247. package/docs/zh/configure/app/output/disable-ts-checker.mdx +1 -1
  248. package/docs/zh/configure/app/output/dist-path.mdx +1 -1
  249. package/docs/zh/configure/app/output/enable-asset-fallback.mdx +1 -1
  250. package/docs/zh/configure/app/output/enable-asset-manifest.mdx +1 -1
  251. package/docs/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
  252. package/docs/zh/configure/app/output/enable-inline-route-manifests.mdx +1 -1
  253. package/docs/zh/configure/app/output/enable-inline-scripts.mdx +1 -1
  254. package/docs/zh/configure/app/output/enable-inline-styles.mdx +1 -1
  255. package/docs/zh/configure/app/output/enable-latest-decorators.mdx +1 -1
  256. package/docs/zh/configure/app/output/externals.mdx +1 -1
  257. package/docs/zh/configure/app/output/filename-hash.mdx +1 -1
  258. package/docs/zh/configure/app/output/filename.mdx +1 -1
  259. package/docs/zh/configure/app/output/legal-comments.mdx +1 -1
  260. package/docs/zh/configure/app/output/override-browserslist.mdx +1 -1
  261. package/docs/zh/configure/app/output/polyfill.mdx +1 -1
  262. package/docs/zh/configure/app/output/splitRouteChunks.mdx +1 -1
  263. package/docs/zh/configure/app/output/ssg.mdx +1 -1
  264. package/docs/zh/configure/app/output/svg-default-export.mdx +1 -1
  265. package/docs/zh/configure/app/output/temp-dir.mdx +1 -1
  266. package/docs/zh/configure/app/performance/build-cache.mdx +1 -1
  267. package/docs/zh/configure/app/performance/bundle-analyze.mdx +1 -1
  268. package/docs/zh/configure/app/performance/chunk-split.mdx +1 -1
  269. package/docs/zh/configure/app/performance/dns-prefetch.mdx +1 -1
  270. package/docs/zh/configure/app/performance/preconnect.mdx +1 -1
  271. package/docs/zh/configure/app/performance/prefetch.mdx +1 -1
  272. package/docs/zh/configure/app/performance/preload.mdx +1 -1
  273. package/docs/zh/configure/app/performance/print-file-size.mdx +1 -1
  274. package/docs/zh/configure/app/performance/profile.mdx +1 -1
  275. package/docs/zh/configure/app/performance/remove-console.mdx +1 -1
  276. package/docs/zh/configure/app/performance/remove-moment-locale.mdx +1 -1
  277. package/docs/zh/configure/app/performance/transform-lodash.mdx +1 -1
  278. package/docs/zh/configure/app/plugins.mdx +1 -1
  279. package/docs/zh/configure/app/runtime/{intro.mdx → 0-intro.mdx} +1 -1
  280. package/docs/zh/configure/app/runtime/master-app.mdx +1 -1
  281. package/docs/zh/configure/app/runtime/router.mdx +3 -1
  282. package/docs/zh/configure/app/runtime/state.mdx +1 -1
  283. package/docs/zh/configure/app/security/check-syntax.mdx +1 -1
  284. package/docs/zh/configure/app/security/nonce.mdx +1 -1
  285. package/docs/zh/configure/app/security/sri.mdx +1 -1
  286. package/docs/zh/configure/app/server/base-url.mdx +1 -1
  287. package/docs/zh/configure/app/server/enable-framework-ext.mdx +1 -1
  288. package/docs/zh/configure/app/server/port.mdx +1 -1
  289. package/docs/zh/configure/app/server/public-routes.mdx +1 -1
  290. package/docs/zh/configure/app/server/routes.mdx +1 -1
  291. package/docs/zh/configure/app/server/ssr-by-entries.mdx +1 -1
  292. package/docs/zh/configure/app/server/ssr.mdx +1 -1
  293. package/docs/zh/configure/app/source/alias-strategy.mdx +1 -1
  294. package/docs/zh/configure/app/source/alias.mdx +1 -1
  295. package/docs/zh/configure/app/source/config-dir.mdx +1 -1
  296. package/docs/zh/configure/app/source/decorators.mdx +1 -1
  297. package/docs/zh/configure/app/source/define.mdx +1 -1
  298. package/docs/zh/configure/app/source/disable-default-entries.mdx +1 -1
  299. package/docs/zh/configure/app/source/disable-entry-dirs.mdx +1 -1
  300. package/docs/zh/configure/app/source/enable-async-entry.mdx +1 -1
  301. package/docs/zh/configure/app/source/enable-custom-entry.mdx +1 -1
  302. package/docs/zh/configure/app/source/entries-dir.mdx +1 -1
  303. package/docs/zh/configure/app/source/entries.mdx +1 -1
  304. package/docs/zh/configure/app/source/exclude.mdx +1 -1
  305. package/docs/zh/configure/app/source/global-vars.mdx +1 -1
  306. package/docs/zh/configure/app/source/include.mdx +1 -1
  307. package/docs/zh/configure/app/source/mainEntryName.mdx +1 -1
  308. package/docs/zh/configure/app/source/module-scopes.mdx +1 -1
  309. package/docs/zh/configure/app/source/pre-entry.mdx +1 -1
  310. package/docs/zh/configure/app/source/resolve-extension-prefix.mdx +1 -1
  311. package/docs/zh/configure/app/source/resolve-main-fields.mdx +1 -1
  312. package/docs/zh/configure/app/source/transform-import.mdx +1 -1
  313. package/docs/zh/configure/app/tools/autoprefixer.mdx +1 -1
  314. package/docs/zh/configure/app/tools/babel.mdx +1 -1
  315. package/docs/zh/configure/app/tools/bundler-chain.mdx +1 -1
  316. package/docs/zh/configure/app/tools/css-extract.mdx +1 -1
  317. package/docs/zh/configure/app/tools/css-loader.mdx +1 -1
  318. package/docs/zh/configure/app/tools/dev-server.mdx +1 -1
  319. package/docs/zh/configure/app/tools/esbuild.mdx +2 -2
  320. package/docs/zh/configure/app/tools/html-plugin.mdx +1 -1
  321. package/docs/zh/configure/app/tools/less.mdx +1 -1
  322. package/docs/zh/configure/app/tools/minify-css.mdx +1 -1
  323. package/docs/zh/configure/app/tools/postcss.mdx +1 -1
  324. package/docs/zh/configure/app/tools/pug.mdx +1 -1
  325. package/docs/zh/configure/app/tools/rspack.mdx +1 -1
  326. package/docs/zh/configure/app/tools/sass.mdx +1 -1
  327. package/docs/zh/configure/app/tools/style-loader.mdx +1 -1
  328. package/docs/zh/configure/app/tools/styled-components.mdx +1 -1
  329. package/docs/zh/configure/app/tools/swc.mdx +2 -2
  330. package/docs/zh/configure/app/tools/tailwindcss.mdx +1 -1
  331. package/docs/zh/configure/app/tools/terser.mdx +1 -1
  332. package/docs/zh/configure/app/tools/ts-checker.mdx +1 -1
  333. package/docs/zh/configure/app/tools/ts-loader.mdx +1 -1
  334. package/docs/zh/configure/app/tools/webpack-chain.mdx +1 -1
  335. package/docs/zh/configure/app/tools/webpack.mdx +1 -1
  336. package/docs/zh/guides/_meta.json +38 -0
  337. package/docs/zh/guides/advanced-features/_meta.json +26 -0
  338. package/docs/zh/guides/advanced-features/bff/_meta.json +6 -0
  339. package/docs/zh/guides/advanced-features/rsbuild-plugin.mdx +9 -9
  340. package/docs/zh/guides/advanced-features/ssr/_meta.json +5 -0
  341. package/docs/zh/guides/basic-features/_meta.json +22 -0
  342. package/docs/zh/guides/basic-features/data/_meta.json +4 -0
  343. package/docs/zh/guides/basic-features/mock.mdx +1 -1
  344. package/docs/zh/guides/concept/_meta.json +4 -0
  345. package/docs/zh/guides/get-started/_meta.json +7 -0
  346. package/docs/zh/guides/get-started/quick-start.mdx +2 -2
  347. package/docs/zh/guides/get-started/upgrade.mdx +1 -1
  348. package/docs/zh/guides/rsbuild-plugins/plugin-esbuild.mdx +201 -0
  349. package/docs/zh/guides/rsbuild-plugins/plugin-swc.mdx +344 -0
  350. package/docs/zh/guides/topic-detail/_meta.json +26 -0
  351. package/docs/zh/guides/topic-detail/framework-plugin/_meta.json +10 -0
  352. package/docs/zh/guides/topic-detail/generator/_meta.json +17 -0
  353. package/docs/zh/guides/topic-detail/generator/create/_meta.json +5 -0
  354. package/docs/zh/guides/topic-detail/generator/new/_meta.json +5 -0
  355. package/docs/zh/guides/topic-detail/generator/plugin/_meta.json +11 -0
  356. package/docs/zh/guides/topic-detail/model/_meta.json +14 -0
  357. package/docs/zh/guides/troubleshooting/_meta.json +6 -0
  358. package/docs/zh/guides/troubleshooting/dependencies.mdx +4 -4
  359. package/docs/zh/tutorials/_meta.json +17 -0
  360. package/i18n.json +110 -0
  361. package/package.json +9 -10
  362. package/rspress.config.ts +3 -20
  363. package/src/components/ContentCard/index.tsx +1 -1
  364. package/src/components/FeatureLayout/index.tsx +1 -1
  365. package/src/components/Footer/index.tsx +2 -2
  366. package/src/components/ListCard/index.tsx +1 -1
  367. package/src/components/Sandpack/index.tsx +4 -2
  368. package/src/components/SecondaryTitle/index.tsx +1 -1
  369. package/src/i18n/zhCN.ts +1 -1
  370. package/src/index.ts +0 -1
  371. package/src/pages/index.tsx +13 -5
  372. package/docs/en/apis/app/hooks/_category_.json +0 -5
  373. package/docs/en/apis/app/hooks/api/_category_.json +0 -4
  374. package/docs/en/apis/app/hooks/config/_category_.json +0 -4
  375. package/docs/en/apis/app/hooks/server/_category_.json +0 -4
  376. package/docs/en/apis/app/hooks/src/_category_.json +0 -4
  377. package/docs/en/apis/app/runtime/_category_.json +0 -5
  378. package/docs/en/apis/app/runtime/app/_category_.json +0 -4
  379. package/docs/en/apis/app/runtime/bff/_category_.json +0 -4
  380. package/docs/en/apis/app/runtime/core/_category_.json +0 -5
  381. package/docs/en/apis/app/runtime/model/_category_.json +0 -4
  382. package/docs/en/apis/app/runtime/router/_category_.json +0 -4
  383. package/docs/en/apis/app/runtime/ssr/_category_.json +0 -4
  384. package/docs/en/apis/app/runtime/utility/_category_.json +0 -4
  385. package/docs/en/apis/app/runtime/web-server/_category_.json +0 -4
  386. package/docs/en/community/blog/_category_.json +0 -6
  387. package/docs/en/configure/app/bff/_category_.json +0 -4
  388. package/docs/en/configure/app/deploy/_category_.json +0 -4
  389. package/docs/en/configure/app/dev/_category_.json +0 -4
  390. package/docs/en/configure/app/experiments/_category_.json +0 -4
  391. package/docs/en/configure/app/html/_category_.json +0 -4
  392. package/docs/en/configure/app/output/_category_.json +0 -4
  393. package/docs/en/configure/app/performance/_category_.json +0 -4
  394. package/docs/en/configure/app/runtime/_category_.json +0 -4
  395. package/docs/en/configure/app/security/_category_.json +0 -4
  396. package/docs/en/configure/app/server/_category_.json +0 -4
  397. package/docs/en/configure/app/source/_category_.json +0 -4
  398. package/docs/en/configure/app/tools/_category_.json +0 -4
  399. package/docs/en/guides/advanced-features/_category_.json +0 -5
  400. package/docs/en/guides/advanced-features/bff/_category_.json +0 -8
  401. package/docs/en/guides/advanced-features/ssr/_category_.json +0 -8
  402. package/docs/en/guides/basic-features/_category_.json +0 -5
  403. package/docs/en/guides/basic-features/data/_category_.json +0 -4
  404. package/docs/en/guides/concept/_category_.json +0 -5
  405. package/docs/en/guides/get-started/_category_.json +0 -5
  406. package/docs/en/guides/topic-detail/_category_.json +0 -5
  407. package/docs/en/guides/topic-detail/framework-plugin/_category_.json +0 -4
  408. package/docs/en/guides/topic-detail/generator/_category_.json +0 -4
  409. package/docs/en/guides/topic-detail/generator/create/_category_.json +0 -4
  410. package/docs/en/guides/topic-detail/generator/new/_category_.json +0 -4
  411. package/docs/en/guides/topic-detail/generator/plugin/_category_.json +0 -4
  412. package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +0 -4
  413. package/docs/en/guides/topic-detail/micro-frontend/_category_.json +0 -4
  414. package/docs/en/guides/topic-detail/model/_category_.json +0 -4
  415. package/docs/en/guides/troubleshooting/_category_.json +0 -5
  416. package/docs/en/tutorials/examples/_category_.json +0 -5
  417. package/docs/en/tutorials/first-app/_category_.json +0 -5
  418. package/docs/en/tutorials/foundations/_category_.json +0 -5
  419. package/docs/zh/apis/app/hooks/_category_.json +0 -5
  420. package/docs/zh/apis/app/hooks/api/_category_.json +0 -4
  421. package/docs/zh/apis/app/hooks/config/_category_.json +0 -4
  422. package/docs/zh/apis/app/hooks/server/_category_.json +0 -4
  423. package/docs/zh/apis/app/hooks/src/_category_.json +0 -4
  424. package/docs/zh/apis/app/runtime/_category_.json +0 -5
  425. package/docs/zh/apis/app/runtime/app/_category_.json +0 -4
  426. package/docs/zh/apis/app/runtime/bff/_category_.json +0 -4
  427. package/docs/zh/apis/app/runtime/core/_category_.json +0 -4
  428. package/docs/zh/apis/app/runtime/model/_category_.json +0 -4
  429. package/docs/zh/apis/app/runtime/router/_category_.json +0 -4
  430. package/docs/zh/apis/app/runtime/ssr/_category_.json +0 -4
  431. package/docs/zh/apis/app/runtime/utility/_category_.json +0 -4
  432. package/docs/zh/apis/app/runtime/web-server/_category_.json +0 -4
  433. package/docs/zh/community/blog/_category_.json +0 -6
  434. package/docs/zh/configure/app/bff/_category_.json +0 -4
  435. package/docs/zh/configure/app/deploy/_category_.json +0 -4
  436. package/docs/zh/configure/app/dev/_category_.json +0 -4
  437. package/docs/zh/configure/app/experiments/_category_.json +0 -4
  438. package/docs/zh/configure/app/html/_category_.json +0 -4
  439. package/docs/zh/configure/app/output/_category_.json +0 -4
  440. package/docs/zh/configure/app/performance/_category_.json +0 -4
  441. package/docs/zh/configure/app/runtime/_category_.json +0 -4
  442. package/docs/zh/configure/app/security/_category_.json +0 -4
  443. package/docs/zh/configure/app/server/_category_.json +0 -4
  444. package/docs/zh/configure/app/source/_category_.json +0 -4
  445. package/docs/zh/configure/app/tools/_category_.json +0 -4
  446. package/docs/zh/guides/advanced-features/_category_.json +0 -5
  447. package/docs/zh/guides/advanced-features/bff/_category_.json +0 -8
  448. package/docs/zh/guides/advanced-features/ssr/_category_.json +0 -8
  449. package/docs/zh/guides/basic-features/_category_.json +0 -5
  450. package/docs/zh/guides/basic-features/data/_category_.json +0 -4
  451. package/docs/zh/guides/concept/_category_.json +0 -5
  452. package/docs/zh/guides/get-started/_category_.json +0 -5
  453. package/docs/zh/guides/topic-detail/_category_.json +0 -5
  454. package/docs/zh/guides/topic-detail/framework-plugin/_category_.json +0 -4
  455. package/docs/zh/guides/topic-detail/generator/_category_.json +0 -4
  456. package/docs/zh/guides/topic-detail/generator/create/_category_.json +0 -4
  457. package/docs/zh/guides/topic-detail/generator/new/_category_.json +0 -4
  458. package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +0 -4
  459. package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +0 -4
  460. package/docs/zh/guides/topic-detail/micro-frontend/_category_.json +0 -4
  461. package/docs/zh/guides/topic-detail/model/_category_.json +0 -4
  462. package/docs/zh/guides/troubleshooting/_category_.json +0 -5
  463. package/docs/zh/tutorials/examples/_category_.json +0 -5
  464. package/docs/zh/tutorials/first-app/_category_.json +0 -5
  465. package/docs/zh/tutorials/foundations/_category_.json +0 -5
  466. package/src/.eslintrc.json +0 -3
  467. /package/docs/zh/guides/{deprecat.md → deprecated.md} +0 -0
@@ -0,0 +1,356 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # SWC Plugin
6
+
7
+ import SWC from '@modern-js/builder-doc/docs/en/shared/swc.md';
8
+
9
+ <SWC />
10
+
11
+ ## Usage Scenarios
12
+
13
+ Before using the SWC plugin, please understand the scenarios and limitations of the SWC plugin to determine whether your project is suitable for using it.
14
+
15
+ ### Rspack Scenario
16
+
17
+ If you are already using Rspack as the bundler in your project, then you do not need to use the SWC plugin, because Rspack uses SWC for transpiler and minifier by default, and the SWC compilation capabilities are available out of the box.
18
+
19
+ If you have configured the current SWC plugin when using Rspack, it will not have any effect.
20
+
21
+ ### Babel Plugins
22
+
23
+ If your project requires the registration of some custom Babel plugins, you will not be able to register and use Babel plugins after using SWC, since it replaces Babel as the transpiler.
24
+
25
+ For most common Babel plugins, you can find corresponding replacements in SWC, such as:
26
+
27
+ - `@babel/preset-env`: use [presetEnv](#presetenv) instead.
28
+ - `@babel/preset-react`: use [presetReact](#presetreact) instead.
29
+ - `babel-plugin-import`: use [source.transformImport](/configure/app/source/transform-import) instead.
30
+ - `babel-plugin-lodash`: use [extensions.lodash](#extensionslodash) instead.
31
+ - `@emotion/babel-plugin`: use [extensions.emotion](#extensionsemotion) instead.
32
+ - `babel-plugin-styled-components`: use [extensions.styledComponents](#extensionsstyledcomponents) instead.
33
+ - `@babel/plugin-react-transform-remove-prop-types`: use [reactUtils.removePropTypes](#extensionsreactutils) instead.
34
+
35
+ If you use Babel plugin capabilities that are not yet supported by SWC, you will no longer be able to use them after switching to SWC compilation. You can give feedback via issues under the [swc-plugins](https://github.com/web-infra-dev/swc-plugins) repository and we will evaluate if built-in support is needed.
36
+
37
+ ### Bundle Size
38
+
39
+ When using SWC for code minification instead of [terser](https://github.com/terser/terser) and [cssnano](https://github.com/cssnano/cssnano), there may be a small change in the bundle size. SWC outperforms terser for JavaScript code compression and slightly underperforms cssnano for CSS code compression.
40
+
41
+ For a detailed comparison between minifiers, see [minification-benchmarks](https://github.com/privatenumber/minification-benchmarks).
42
+
43
+ ## Quick Start
44
+
45
+ ### Used in Modern.js framework
46
+
47
+ The Modern.js framework integrates the Builder's SWC plugin, and you can use it in the following ways:
48
+
49
+ import EnableSWC from '@modern-js/builder-doc/docs/en/shared/enableSwc.md';
50
+
51
+ <EnableSWC />
52
+
53
+ That's it! Now you can use SWC transformation and minification in your project.
54
+
55
+ ## Config
56
+
57
+ - **Type:**
58
+
59
+ ```ts
60
+ type PluginConfig =
61
+ | ObjPluginConfig
62
+ | ((
63
+ config: ObjPluginConfig,
64
+ utils: { mergeConfig: typeof lodash.merge; setConfig: typeof lodash.set },
65
+ ) => ObjPluginConfig | void);
66
+
67
+ // SwcOptions is configurations of swc https://swc.rs/docs/configuration/compilation
68
+ interface ObjPluginConfig extends SwcOptions {
69
+ presetReact?: ReactConfig;
70
+ presetEnv?: EnvConfig;
71
+ jsMinify?: boolean | JsMinifyOptions;
72
+ cssMinify?: boolean | CssMinifyOptions;
73
+ extensions?: Extensions;
74
+ overrides?: Overrides;
75
+ }
76
+ ```
77
+
78
+ The plugin configuration is based on the SWC configuration. In order to simplify some deep-level configurations and improve development experience, certain extensions have been made. When using object-based configuration, for example you can use `presetReact` and `presetEnv` to quickly configure React-related features and syntax downgrading. Other configurations will also be directly passed through to SWC.
79
+
80
+ When using function-based configuration, the default configuration generated by the plugin will be passed in, allowing you to modify it or return a new configuration.
81
+
82
+ ### presetReact
83
+
84
+ - **Type:** [presetReact](https://swc.rs/docs/configuration/compilation#jsctransformreact) in SWC.
85
+
86
+ Ported from `@babel/preset-react`. The value you passed will be merged with default option.
87
+
88
+ By default, the plugin will set `runtime` field based on your `react` version, if `react` version is newer than 17.0.0, it will be set to `automatic`, otherwish `classic`.
89
+
90
+ ### presetEnv
91
+
92
+ - **Type:** [presetEnv](https://swc.rs/docs/configuration/supported-browsers#options) in SWC.
93
+
94
+ Ported from `@babel/preset-env`. The value you passed will be merged with default option.
95
+
96
+ Default option is:
97
+
98
+ ```ts
99
+ {
100
+ targets: '', // automatic get browserslist from your project, so you don't have to set this field
101
+ mode: 'usage',
102
+ }
103
+ ```
104
+
105
+ ### jsMinify
106
+
107
+ - **Type:** `boolean` or [compress configuration](https://terser.org/docs/api-reference.html#compress-options).
108
+ - **Default:** `{ compress: {}, mangle: true }`.
109
+
110
+ If set it to `false`, then SWC minification will be disabled, if set it to `true` then will it applies default option. If you pass an object, then this object will be merged with default option.
111
+
112
+ ### cssMinify
113
+
114
+ - **Type:**: `boolean`
115
+ - **Default:**: `true`
116
+
117
+ Whether enable to compress CSS files by SWC. If enabled, it will improve the performance of CSS compression, but the compression ratio will be slightly reduced.
118
+
119
+ ### overrides
120
+
121
+ - **Type:**
122
+
123
+ ```ts
124
+ interface Overrides extends SwcOptions {
125
+ test: RegExp;
126
+ include: RegExp[];
127
+ exclude: RegExp[];
128
+ }
129
+ ```
130
+
131
+ - **Default:** `undefined`
132
+
133
+ Specify special configuration for specific modules. For example if you want to set ie 11 target for `foo.ts`:
134
+
135
+ ```ts
136
+ {
137
+ test: /foo.ts/,
138
+ env: { targets: 'ie 11' }
139
+ }
140
+ ```
141
+
142
+ This will merged into the default configuration, and do not affect other modules.
143
+
144
+ ### extensions
145
+
146
+ - **Type:** `Object`
147
+
148
+ Some plugins ported from Babel.
149
+
150
+ #### extensions.reactUtils
151
+
152
+ - **Type:** `Object`
153
+
154
+ ```ts
155
+ type ReactUtilsOptions = {
156
+ autoImportReact?: boolean;
157
+ removeEffect?: boolean;
158
+ removePropTypes?: {
159
+ mode?: 'remove' | 'unwrap' | 'unsafe-wrap';
160
+ removeImport?: boolean;
161
+ ignoreFilenames?: string[];
162
+ additionalLibraries?: string[];
163
+ classNameMatchers?: string[];
164
+ };
165
+ };
166
+ ```
167
+
168
+ Some little help utils for `React`.
169
+
170
+ **reactUtils.autoImportReact**
171
+
172
+ - **Type:** `boolean`
173
+
174
+ Automatically import `React` as global variable, eg: `import React from 'react'`.
175
+ Mostly used for generated `React.createElement`.
176
+
177
+ **reactUtils.removeEffect**
178
+
179
+ - **Type:** `boolean`
180
+
181
+ Remove `useEffect` call.
182
+
183
+ **reactUtils.removePropTypes**
184
+
185
+ - **Type:**
186
+
187
+ ```ts
188
+ type RemovePropTypesOptions = {
189
+ mode?: 'remove' | 'unwrap' | 'unsafe-wrap';
190
+ removeImport?: boolean;
191
+ ignoreFilenames?: string[];
192
+ additionalLibraries?: string[];
193
+ classNameMatchers?: string[];
194
+ };
195
+ ```
196
+
197
+ Remove `React` runtime type checking. This is ported from [@babel/plugin-react-transform-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types), All the configurations remain the same.
198
+
199
+ #### extensions.lodash
200
+
201
+ - **Type:**
202
+
203
+ ```ts
204
+ type LodashOptions = {
205
+ cwd?: string;
206
+ ids?: string[];
207
+ };
208
+ ```
209
+
210
+ - **Default:**
211
+
212
+ ```ts
213
+ const defaultOptions = {
214
+ cwd: process.cwd(),
215
+ ids: ['lodash', 'lodash-es'],
216
+ };
217
+ ```
218
+
219
+ Ported from [babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash), it is used to automatically convert references to Lodash into on-demand imports, thereby reducing the bundle size of Lodash code.
220
+
221
+ ```ts
222
+ // Input
223
+ import { get, throttle } from 'lodash';
224
+
225
+ // Output
226
+ import get from 'lodash/get';
227
+ import throttle from 'lodash/throttle';
228
+ ```
229
+
230
+ #### extensions.styledComponents
231
+
232
+ - **Type:**
233
+
234
+ ```ts
235
+ boolean | {
236
+ // Enabled by default in development, disabled in production to reduce file size,
237
+ // setting this will override the default for all environments.
238
+ displayName?: boolean,
239
+ // Enabled by default.
240
+ ssr?: boolean,
241
+ // Enabled by default.
242
+ fileName?: boolean,
243
+ // Empty by default.
244
+ topLevelImportPaths?: string[],
245
+ // Defaults to ["index"].
246
+ meaninglessFileNames?: string[],
247
+ // Enabled by default.
248
+ cssProp?: boolean,
249
+ // Empty by default.
250
+ namespace?: string,
251
+ };
252
+ ```
253
+
254
+ This is ported by Next.js team from [babel-plugin-styled-components](https://github.com/styled-components/babel-plugin-styled-components).
255
+
256
+ #### extensions.emotion
257
+
258
+ - **Type:**
259
+
260
+ ```ts
261
+ boolean | {
262
+ // default is true. It will be disabled when build type is production.
263
+ sourceMap?: boolean,
264
+ // default is 'dev-only'.
265
+ autoLabel?: 'never' | 'dev-only' | 'always',
266
+ // default is '[local]'.
267
+ // Allowed values: `[local]` `[filename]` and `[dirname]`
268
+ // This option only works when autoLabel is set to 'dev-only' or 'always'.
269
+ // It allows you to define the format of the resulting label.
270
+ // The format is defined via string where variable parts are enclosed in square brackets [].
271
+ // For example labelFormat: "my-classname--[local]", where [local] will be replaced with the name of the variable the result is assigned to.
272
+ labelFormat?: string,
273
+ // default is undefined.
274
+ // This option allows you to tell the compiler what imports it should
275
+ // look at to determine what it should transform so if you re-export
276
+ // Emotion's exports, you can still use transforms.
277
+ importMap?: {
278
+ [packageName: string]: {
279
+ [exportName: string]: {
280
+ canonicalImport?: [string, string],
281
+ styledBaseImport?: [string, string],
282
+ }
283
+ }
284
+ },
285
+ }
286
+ ```
287
+
288
+ This is ported by Next.js team from [@emotion/babel-plugin](https://www.npmjs.com/package/@emotion/babel-plugin)
289
+
290
+ #### extensions.pluginImport
291
+
292
+ :::tip
293
+ Builder provides the [source.transformImport](/configure/app/source/transform-import) config, so you don't need to configure `extensions.pluginImport` manually.
294
+ :::
295
+
296
+ Ported from [babel-plugin-import](https://github.com/umijs/babel-plugin-import), configurations are the same.
297
+
298
+ Some configurations can be passed in functions, such as `customName`, `customStyleName`. These JavaScript functions will be called by Rust through Node-API, which will cause some performance overhead.
299
+
300
+ Some simple function logic can be replaced by template language. Therefore, the configuration of function items such as `customName`, `customStyleName` can also be passed in strings as templates to replace functions and improve performance.
301
+
302
+ For example:
303
+
304
+ ```ts
305
+ import { MyButton as Btn } from 'foo';
306
+ ```
307
+
308
+ Apply following configurations:
309
+
310
+ ```ts
311
+ PluginSWC({
312
+ extensions: {
313
+ pluginImport: [
314
+ {
315
+ libraryName: 'foo',
316
+ customName: 'foo/es/{{ member }}',
317
+ },
318
+ ],
319
+ },
320
+ });
321
+ ```
322
+
323
+ `{{ member }}` will be replaced by the imported specifier:
324
+
325
+ ```ts
326
+ import Btn from 'foo/es/MyButton';
327
+ ```
328
+
329
+ Template `customName: 'foo/es/{{ member }}'` is the same as `` customName: (member) => `foo/es/${member}` ``, but template value has no performance overhead of Node-API.
330
+
331
+ The template used here is [handlebars](https://handlebarsjs.com). There are some useful builtin tools, Take the above import statement as an example:
332
+
333
+ ```ts
334
+ PluginSWC({
335
+ extensions: {
336
+ pluginImport: [
337
+ {
338
+ libraryName: 'foo',
339
+ customName: 'foo/es/{{ kebabCase member }}',
340
+ },
341
+ ],
342
+ },
343
+ });
344
+ ```
345
+
346
+ Transformed to:
347
+
348
+ ```ts
349
+ import Btn from 'foo/es/my-button';
350
+ ```
351
+
352
+ In addition to `kebabCase`, there are `cameraCase`, `snakeCase`, `upperCase` and `lowerCase` can be used as well.
353
+
354
+ ## Limitation
355
+
356
+ Do not support `@babel/plugin-transform-runtime` and other custom Babel plugins.
@@ -0,0 +1,26 @@
1
+ [
2
+ {
3
+ "type": "dir",
4
+ "name": "micro-frontend",
5
+ "label": "micro-frontend",
6
+ "collapsed": true
7
+ },
8
+ {
9
+ "type": "dir",
10
+ "name": "framework-plugin",
11
+ "label": "framework-plugin",
12
+ "collapsed": true
13
+ },
14
+ {
15
+ "type": "dir",
16
+ "name": "model",
17
+ "label": "reduck",
18
+ "collapsed": true
19
+ },
20
+ {
21
+ "type": "dir",
22
+ "name": "generator",
23
+ "label": "generator",
24
+ "collapsed": true
25
+ }
26
+ ]
@@ -0,0 +1,10 @@
1
+ [
2
+ "introduction",
3
+ "lifecycle",
4
+ "hook",
5
+ "implement",
6
+ "relationship",
7
+ "extend",
8
+ "plugin-api",
9
+ "hook-list"
10
+ ]
@@ -0,0 +1,17 @@
1
+ [
2
+ {
3
+ "type": "dir",
4
+ "name": "create",
5
+ "label": "@modern-js/create"
6
+ },
7
+ {
8
+ "type": "dir",
9
+ "name": "new",
10
+ "label": "new-command"
11
+ },
12
+ {
13
+ "type": "dir",
14
+ "name": "plugin",
15
+ "label": "generator-plugin"
16
+ }
17
+ ]
@@ -0,0 +1,5 @@
1
+ [
2
+ "use",
3
+ "option",
4
+ "config"
5
+ ]
@@ -0,0 +1,5 @@
1
+ [
2
+ "use",
3
+ "option",
4
+ "config"
5
+ ]
@@ -0,0 +1,11 @@
1
+ [
2
+ "structure",
3
+ "category",
4
+ "use",
5
+ "context",
6
+ {
7
+ "type": "dir",
8
+ "name": "api",
9
+ "label": "API"
10
+ }
11
+ ]
@@ -0,0 +1,14 @@
1
+ [
2
+ "quick-start",
3
+ "define-model",
4
+ "use-model",
5
+ "computed-state",
6
+ "manage-effects",
7
+ "auto-actions",
8
+ "model-communicate",
9
+ "performance",
10
+ "typescript-best-practice",
11
+ "redux-integration",
12
+ "use-out-of-modernjs",
13
+ "faq"
14
+ ]
@@ -0,0 +1,6 @@
1
+ [
2
+ "dependencies",
3
+ "cli",
4
+ "builder",
5
+ "hmr"
6
+ ]
@@ -18,8 +18,8 @@ For example, running `npm ls @modern-js/core` will show the following result:
18
18
 
19
19
  ```
20
20
  project
21
- └─┬ @modern-js/app-tools@2.0.0
22
- └── @modern-js/core@2.0.0
21
+ └─┬ @modern-js/app-tools@x.y.z
22
+ └── @modern-js/core@x.y.z
23
23
  ```
24
24
 
25
25
  **pnpm**
@@ -30,8 +30,8 @@ For example, running `pnpm ls @modern-js/core --depth Infinity` will show the fo
30
30
 
31
31
  ```
32
32
  devDependencies:
33
- @modern-js/app-tools 2.0.0
34
- └── @modern-js/core 2.0.0
33
+ @modern-js/app-tools x.y.z
34
+ └── @modern-js/core x.y.z
35
35
  ```
36
36
 
37
37
  ---
@@ -0,0 +1,17 @@
1
+ [
2
+ {
3
+ "type": "dir",
4
+ "name": "foundations",
5
+ "label": "foundations"
6
+ },
7
+ {
8
+ "type": "dir",
9
+ "name": "first-app",
10
+ "label": "first-app"
11
+ },
12
+ {
13
+ "type": "dir",
14
+ "name": "examples",
15
+ "label": "examples"
16
+ }
17
+ ]
@@ -0,0 +1,27 @@
1
+ [
2
+ {
3
+ "text": "guide",
4
+ "link": "/guides/get-started/introduction",
5
+ "activeMatch": "/guides/"
6
+ },
7
+ {
8
+ "text": "tutorials",
9
+ "link": "/tutorials/foundations/introduction",
10
+ "activeMatch": "/tutorials/"
11
+ },
12
+ {
13
+ "text": "configure",
14
+ "link": "/configure/app/usage",
15
+ "activeMatch": "/configure/"
16
+ },
17
+ {
18
+ "text": "apis",
19
+ "link": "/apis/app/commands",
20
+ "activeMatch": "/apis/"
21
+ },
22
+ {
23
+ "text": "community",
24
+ "link": "/community/showcase",
25
+ "activeMatch": "/community/"
26
+ }
27
+ ]
@@ -0,0 +1,13 @@
1
+ [
2
+ "app/commands",
3
+ {
4
+ "type": "dir",
5
+ "name": "app/hooks",
6
+ "label": "file-conventions"
7
+ },
8
+ {
9
+ "type": "dir",
10
+ "name": "app/runtime",
11
+ "label": "runtime-api"
12
+ }
13
+ ]
@@ -0,0 +1,28 @@
1
+ [
2
+ {
3
+ "type": "dir",
4
+ "name": "src",
5
+ "label": "src/",
6
+ "collapsed": true
7
+ },
8
+ {
9
+ "type": "dir",
10
+ "name": "api",
11
+ "label": "api/",
12
+ "collapsed": true
13
+ },
14
+ {
15
+ "type": "dir",
16
+ "name": "server",
17
+ "label": "server/",
18
+ "collapsed": true
19
+ },
20
+ "shared",
21
+ {
22
+ "type": "dir",
23
+ "name": "config",
24
+ "label": "config/",
25
+ "collapsed": true
26
+ },
27
+ "modern-config"
28
+ ]
@@ -42,7 +42,7 @@ sidebar_position: 2
42
42
  构建完成后,可以看到 HTML 中自动生成了以下标签:
43
43
 
44
44
  ```html
45
- <link rel="apple-touch-icon" sizes="180*180" href="/static/image/icon.png" />
45
+ <link rel="apple-touch-icon" sizes="180x180" href="/static/image/icon.png" />
46
46
  ```
47
47
 
48
48
  ### 查找顺序
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "type": "dir",
4
+ "name": "core",
5
+ "label": "Core",
6
+ "collapsed": true
7
+ },
8
+ {
9
+ "type": "dir",
10
+ "name": "app",
11
+ "label": "App",
12
+ "collapsed": true
13
+ },
14
+ {
15
+ "type": "dir",
16
+ "name": "router",
17
+ "label": "Router",
18
+ "collapsed": true
19
+ },
20
+ {
21
+ "type": "dir",
22
+ "name": "model",
23
+ "label": "Model",
24
+ "collapsed": true
25
+ },
26
+ {
27
+ "type": "dir",
28
+ "name": "ssr",
29
+ "label": "SSR",
30
+ "collapsed": true
31
+ },
32
+ {
33
+ "type": "dir",
34
+ "name": "bff",
35
+ "label": "BFF",
36
+ "collapsed": true
37
+ },
38
+ {
39
+ "type": "dir",
40
+ "name": "web-server",
41
+ "label": "Web Server",
42
+ "collapsed": true
43
+ },
44
+ {
45
+ "type": "dir",
46
+ "name": "utility",
47
+ "label": "Utility",
48
+ "collapsed": true
49
+ }
50
+ ]
@@ -91,7 +91,7 @@ import {
91
91
  } from '@modern-js/runtime/server';
92
92
  import type { Vars } from '../shared/index';
93
93
 
94
- const setPayload: UnstableMiddleware = async (
94
+ const setPayload: UnstableMiddleware<Vars> = async (
95
95
  c: UnstableMiddlewareContext<Vars>,
96
96
  next,
97
97
  ) => {
@@ -100,7 +100,7 @@ const setPayload: UnstableMiddleware = async (
100
100
  await next();
101
101
  };
102
102
 
103
- export const unstableMiddleware: UnstableMiddleware[] = [setPayload];
103
+ export const unstableMiddleware: UnstableMiddleware<Vars>[] = [setPayload];
104
104
  ```
105
105
 
106
106
  ```ts title="src/routes/page.data.ts"
@@ -0,0 +1,11 @@
1
+ [
2
+ "showcase",
3
+ "team",
4
+ "releases",
5
+ "contributing-guide",
6
+ {
7
+ "type": "dir",
8
+ "name": "blog",
9
+ "label": "blog"
10
+ }
11
+ ]
@@ -0,0 +1,6 @@
1
+ [
2
+ "overview",
3
+ "v2-release-note",
4
+ "2022-0910-updates",
5
+ "2022-0708-updates"
6
+ ]
@@ -1,6 +1,5 @@
1
1
  ---
2
- sidebar_label: Modern.js v2 发布
3
- sidebar_position: 97
2
+ title: Modern.js v2 发布
4
3
  ---
5
4
 
6
5
  # Modern.js v2 发布:支持 Rspack 构建