@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.
- package/docs/en/_meta.json +27 -0
- package/docs/en/apis/_meta.json +13 -0
- package/docs/en/apis/app/hooks/_meta.json +28 -0
- package/docs/en/apis/app/hooks/config/icon.mdx +1 -1
- package/docs/en/apis/app/runtime/_meta.json +50 -0
- package/docs/en/apis/app/runtime/web-server/unstable_middleware.mdx +2 -2
- package/docs/en/community/_meta.json +11 -0
- package/docs/en/community/blog/2022-0708-updates.md +95 -0
- package/docs/en/community/blog/2022-0910-updates.md +80 -0
- package/docs/en/community/blog/_meta.json +6 -0
- package/docs/en/community/blog/v2-release-note.mdx +246 -0
- package/docs/en/components/debug-app.mdx +1 -1
- package/docs/en/configure/_meta.json +78 -0
- package/docs/en/configure/app/bff/prefix.mdx +1 -1
- package/docs/en/configure/app/deploy/microFrontend.mdx +1 -1
- package/docs/en/configure/app/dev/asset-prefix.mdx +1 -1
- package/docs/en/configure/app/dev/before-start-url.mdx +1 -1
- package/docs/en/configure/app/dev/client.mdx +1 -1
- package/docs/en/configure/app/dev/hmr.mdx +1 -1
- package/docs/en/configure/app/dev/host.mdx +1 -1
- package/docs/en/configure/app/dev/https.mdx +1 -1
- package/docs/en/configure/app/dev/live-reload.mdx +1 -1
- package/docs/en/configure/app/dev/port.mdx +1 -1
- package/docs/en/configure/app/dev/progress-bar.mdx +1 -1
- package/docs/en/configure/app/dev/proxy.mdx +1 -1
- package/docs/en/configure/app/dev/setup-middlewares.mdx +1 -1
- package/docs/en/configure/app/dev/start-url.mdx +1 -1
- package/docs/en/configure/app/dev/watch-files.mdx +1 -1
- package/docs/en/configure/app/dev/write-to-disk.mdx +1 -1
- package/docs/en/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/docs/en/configure/app/experiments/source-build.mdx +1 -1
- package/docs/en/configure/app/html/app-icon.mdx +1 -1
- package/docs/en/configure/app/html/crossorigin.mdx +1 -1
- package/docs/en/configure/app/html/disable-html-folder.mdx +1 -1
- package/docs/en/configure/app/html/favicon-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/favicon.mdx +1 -1
- package/docs/en/configure/app/html/inject-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/inject.mdx +1 -1
- package/docs/en/configure/app/html/meta-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/meta.mdx +1 -1
- package/docs/en/configure/app/html/mount-id.mdx +1 -1
- package/docs/en/configure/app/html/script-loading.mdx +1 -1
- package/docs/en/configure/app/html/tags-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/tags.mdx +1 -1
- package/docs/en/configure/app/html/template-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/template-parameters.mdx +1 -1
- package/docs/en/configure/app/html/template.mdx +1 -1
- package/docs/en/configure/app/html/title-by-entries.mdx +1 -1
- package/docs/en/configure/app/html/title.mdx +1 -1
- package/docs/en/configure/app/output/asset-prefix.mdx +1 -1
- package/docs/en/configure/app/output/assets-retry.mdx +1 -1
- package/docs/en/configure/app/output/charset.mdx +1 -1
- package/docs/en/configure/app/output/clean-dist-path.mdx +1 -1
- package/docs/en/configure/app/output/convert-to-rem.mdx +1 -1
- package/docs/en/configure/app/output/copy.mdx +1 -1
- package/docs/en/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/docs/en/configure/app/output/css-modules.mdx +1 -1
- package/docs/en/configure/app/output/data-uri-limit.mdx +1 -1
- package/docs/en/configure/app/output/disable-css-extract.mdx +1 -1
- package/docs/en/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/docs/en/configure/app/output/disable-filename-hash.mdx +1 -1
- package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/docs/en/configure/app/output/disable-minimize.mdx +1 -1
- package/docs/en/configure/app/output/disable-node-polyfill.mdx +1 -1
- package/docs/en/configure/app/output/disable-source-map.mdx +1 -1
- package/docs/en/configure/app/output/disable-svgr.mdx +1 -1
- package/docs/en/configure/app/output/disable-ts-checker.mdx +1 -1
- package/docs/en/configure/app/output/dist-path.mdx +1 -1
- package/docs/en/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/docs/en/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/docs/en/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/docs/en/configure/app/output/enable-inline-route-manifests.mdx +1 -1
- package/docs/en/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/docs/en/configure/app/output/enable-inline-styles.mdx +1 -1
- package/docs/en/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/docs/en/configure/app/output/externals.mdx +1 -1
- package/docs/en/configure/app/output/filename-hash.mdx +1 -1
- package/docs/en/configure/app/output/filename.mdx +1 -1
- package/docs/en/configure/app/output/legal-comments.mdx +1 -1
- package/docs/en/configure/app/output/override-browserslist.mdx +1 -1
- package/docs/en/configure/app/output/polyfill.mdx +1 -1
- package/docs/en/configure/app/output/splitRouteChunks.mdx +1 -1
- package/docs/en/configure/app/output/ssg.mdx +1 -1
- package/docs/en/configure/app/output/svg-default-export.mdx +1 -1
- package/docs/en/configure/app/output/temp-dir.mdx +1 -1
- package/docs/en/configure/app/performance/build-cache.mdx +1 -1
- package/docs/en/configure/app/performance/bundle-analyze.mdx +1 -1
- package/docs/en/configure/app/performance/chunk-split.mdx +1 -1
- package/docs/en/configure/app/performance/dns-prefetch.mdx +1 -1
- package/docs/en/configure/app/performance/preconnect.mdx +1 -1
- package/docs/en/configure/app/performance/prefetch.mdx +1 -1
- package/docs/en/configure/app/performance/preload.mdx +1 -1
- package/docs/en/configure/app/performance/print-file-size.mdx +1 -1
- package/docs/en/configure/app/performance/profile.mdx +1 -1
- package/docs/en/configure/app/performance/remove-console.mdx +1 -1
- package/docs/en/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/docs/en/configure/app/performance/transform-lodash.mdx +1 -1
- package/docs/en/configure/app/runtime/{intro.mdx → 0-intro.mdx} +1 -1
- package/docs/en/configure/app/runtime/master-app.mdx +1 -1
- package/docs/en/configure/app/runtime/router.mdx +3 -1
- package/docs/en/configure/app/runtime/state.mdx +1 -1
- package/docs/en/configure/app/security/check-syntax.mdx +1 -1
- package/docs/en/configure/app/security/nonce.mdx +1 -1
- package/docs/en/configure/app/security/sri.mdx +1 -1
- package/docs/en/configure/app/server/base-url.mdx +1 -1
- package/docs/en/configure/app/server/enable-framework-ext.mdx +1 -1
- package/docs/en/configure/app/server/port.mdx +1 -1
- package/docs/en/configure/app/server/public-routes.mdx +1 -1
- package/docs/en/configure/app/server/routes.mdx +1 -1
- package/docs/en/configure/app/server/ssr-by-entries.mdx +1 -1
- package/docs/en/configure/app/server/ssr.mdx +1 -1
- package/docs/en/configure/app/source/alias-strategy.mdx +1 -1
- package/docs/en/configure/app/source/alias.mdx +1 -1
- package/docs/en/configure/app/source/config-dir.mdx +1 -1
- package/docs/en/configure/app/source/decorators.mdx +1 -1
- package/docs/en/configure/app/source/define.mdx +1 -1
- package/docs/en/configure/app/source/disable-default-entries.mdx +1 -1
- package/docs/en/configure/app/source/disable-entry-dirs.mdx +1 -1
- package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
- package/docs/en/configure/app/source/enable-custom-entry.mdx +1 -1
- package/docs/en/configure/app/source/entries-dir.mdx +1 -1
- package/docs/en/configure/app/source/entries.mdx +1 -1
- package/docs/en/configure/app/source/exclude.mdx +1 -1
- package/docs/en/configure/app/source/global-vars.mdx +1 -1
- package/docs/en/configure/app/source/include.mdx +1 -1
- package/docs/en/configure/app/source/mainEntryName.mdx +1 -1
- package/docs/en/configure/app/source/module-scopes.mdx +1 -1
- package/docs/en/configure/app/source/pre-entry.mdx +1 -1
- package/docs/en/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/docs/en/configure/app/source/resolve-main-fields.mdx +1 -1
- package/docs/en/configure/app/source/transform-import.mdx +1 -1
- package/docs/en/configure/app/tools/autoprefixer.mdx +1 -1
- package/docs/en/configure/app/tools/babel.mdx +1 -1
- package/docs/en/configure/app/tools/bundler-chain.mdx +1 -1
- package/docs/en/configure/app/tools/css-extract.mdx +1 -1
- package/docs/en/configure/app/tools/css-loader.mdx +1 -1
- package/docs/en/configure/app/tools/dev-server.mdx +1 -1
- package/docs/en/configure/app/tools/esbuild.mdx +2 -2
- package/docs/en/configure/app/tools/html-plugin.mdx +1 -1
- package/docs/en/configure/app/tools/less.mdx +1 -1
- package/docs/en/configure/app/tools/minify-css.mdx +1 -1
- package/docs/en/configure/app/tools/postcss.mdx +1 -1
- package/docs/en/configure/app/tools/pug.mdx +1 -1
- package/docs/en/configure/app/tools/rspack.mdx +1 -1
- package/docs/en/configure/app/tools/sass.mdx +1 -1
- package/docs/en/configure/app/tools/style-loader.mdx +1 -1
- package/docs/en/configure/app/tools/styled-components.mdx +1 -1
- package/docs/en/configure/app/tools/swc.mdx +2 -2
- package/docs/en/configure/app/tools/tailwindcss.mdx +1 -1
- package/docs/en/configure/app/tools/terser.mdx +1 -1
- package/docs/en/configure/app/tools/ts-checker.mdx +1 -1
- package/docs/en/configure/app/tools/ts-loader.mdx +1 -1
- package/docs/en/configure/app/tools/webpack-chain.mdx +1 -1
- package/docs/en/configure/app/tools/webpack.mdx +1 -1
- package/docs/en/guides/_meta.json +38 -0
- package/docs/en/guides/advanced-features/_meta.json +26 -0
- package/docs/en/guides/advanced-features/bff/_meta.json +6 -0
- package/docs/en/guides/advanced-features/rsbuild-plugin.mdx +9 -9
- package/docs/en/guides/advanced-features/ssr/_meta.json +5 -0
- package/docs/en/guides/basic-features/_meta.json +22 -0
- package/docs/en/guides/basic-features/data/_meta.json +4 -0
- package/docs/en/guides/concept/_meta.json +4 -0
- package/docs/en/guides/{deprecat.md → deprecated.md} +1 -1
- package/docs/en/guides/get-started/_meta.json +7 -0
- package/docs/en/guides/get-started/quick-start.mdx +2 -2
- package/docs/en/guides/get-started/upgrade.mdx +1 -1
- package/docs/en/guides/rsbuild-plugins/plugin-esbuild.mdx +205 -0
- package/docs/en/guides/rsbuild-plugins/plugin-swc.mdx +356 -0
- package/docs/en/guides/topic-detail/_meta.json +26 -0
- package/docs/en/guides/topic-detail/framework-plugin/_meta.json +10 -0
- package/docs/en/guides/topic-detail/generator/_meta.json +17 -0
- package/docs/en/guides/topic-detail/generator/create/_meta.json +5 -0
- package/docs/en/guides/topic-detail/generator/new/_meta.json +5 -0
- package/docs/en/guides/topic-detail/generator/plugin/_meta.json +11 -0
- package/docs/en/guides/topic-detail/model/_meta.json +14 -0
- package/docs/en/guides/troubleshooting/_meta.json +6 -0
- package/docs/en/guides/troubleshooting/dependencies.mdx +4 -4
- package/docs/en/tutorials/_meta.json +17 -0
- package/docs/zh/_meta.json +27 -0
- package/docs/zh/apis/_meta.json +13 -0
- package/docs/zh/apis/app/hooks/_meta.json +28 -0
- package/docs/zh/apis/app/hooks/config/icon.mdx +1 -1
- package/docs/zh/apis/app/runtime/_meta.json +50 -0
- package/docs/zh/apis/app/runtime/web-server/unstable_middleware.mdx +2 -2
- package/docs/zh/community/_meta.json +11 -0
- package/docs/zh/community/blog/_meta.json +6 -0
- package/docs/zh/community/blog/v2-release-note.mdx +1 -2
- package/docs/zh/components/debug-app.mdx +1 -1
- package/docs/zh/configure/_meta.json +78 -0
- package/docs/zh/configure/app/auto-load-plugin.mdx +1 -1
- package/docs/zh/configure/app/bff/prefix.mdx +1 -1
- package/docs/zh/configure/app/builder-plugins.mdx +1 -1
- package/docs/zh/configure/app/deploy/microFrontend.mdx +1 -1
- package/docs/zh/configure/app/dev/asset-prefix.mdx +1 -1
- package/docs/zh/configure/app/dev/before-start-url.mdx +1 -1
- package/docs/zh/configure/app/dev/client.mdx +1 -1
- package/docs/zh/configure/app/dev/hmr.mdx +1 -1
- package/docs/zh/configure/app/dev/host.mdx +1 -1
- package/docs/zh/configure/app/dev/https.mdx +1 -1
- package/docs/zh/configure/app/dev/live-reload.mdx +1 -1
- package/docs/zh/configure/app/dev/port.mdx +1 -1
- package/docs/zh/configure/app/dev/progress-bar.mdx +1 -1
- package/docs/zh/configure/app/dev/proxy.mdx +1 -1
- package/docs/zh/configure/app/dev/setup-middlewares.mdx +1 -1
- package/docs/zh/configure/app/dev/start-url.mdx +1 -1
- package/docs/zh/configure/app/dev/watch-files.mdx +1 -1
- package/docs/zh/configure/app/dev/write-to-disk.mdx +1 -1
- package/docs/zh/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/docs/zh/configure/app/experiments/source-build.mdx +1 -1
- package/docs/zh/configure/app/html/app-icon.mdx +1 -1
- package/docs/zh/configure/app/html/crossorigin.mdx +1 -1
- package/docs/zh/configure/app/html/disable-html-folder.mdx +1 -1
- package/docs/zh/configure/app/html/favicon-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/favicon.mdx +1 -1
- package/docs/zh/configure/app/html/inject-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/inject.mdx +1 -1
- package/docs/zh/configure/app/html/meta-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/meta.mdx +1 -1
- package/docs/zh/configure/app/html/mount-id.mdx +1 -1
- package/docs/zh/configure/app/html/script-loading.mdx +1 -1
- package/docs/zh/configure/app/html/tags-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/tags.mdx +1 -1
- package/docs/zh/configure/app/html/template-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/template-parameters.mdx +1 -1
- package/docs/zh/configure/app/html/template.mdx +1 -1
- package/docs/zh/configure/app/html/title-by-entries.mdx +1 -1
- package/docs/zh/configure/app/html/title.mdx +1 -1
- package/docs/zh/configure/app/output/asset-prefix.mdx +1 -1
- package/docs/zh/configure/app/output/assets-retry.mdx +1 -1
- package/docs/zh/configure/app/output/charset.mdx +1 -1
- package/docs/zh/configure/app/output/clean-dist-path.mdx +1 -1
- package/docs/zh/configure/app/output/convert-to-rem.mdx +1 -1
- package/docs/zh/configure/app/output/copy.mdx +1 -1
- package/docs/zh/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/docs/zh/configure/app/output/css-modules.mdx +1 -1
- package/docs/zh/configure/app/output/data-uri-limit.mdx +1 -1
- package/docs/zh/configure/app/output/disable-css-extract.mdx +1 -1
- package/docs/zh/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/docs/zh/configure/app/output/disable-filename-hash.mdx +1 -1
- package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/docs/zh/configure/app/output/disable-minimize.mdx +1 -1
- package/docs/zh/configure/app/output/disable-node-polyfill.mdx +1 -1
- package/docs/zh/configure/app/output/disable-source-map.mdx +1 -1
- package/docs/zh/configure/app/output/disable-svgr.mdx +1 -1
- package/docs/zh/configure/app/output/disable-ts-checker.mdx +1 -1
- package/docs/zh/configure/app/output/dist-path.mdx +1 -1
- package/docs/zh/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/docs/zh/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/docs/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/docs/zh/configure/app/output/enable-inline-route-manifests.mdx +1 -1
- package/docs/zh/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/docs/zh/configure/app/output/enable-inline-styles.mdx +1 -1
- package/docs/zh/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/docs/zh/configure/app/output/externals.mdx +1 -1
- package/docs/zh/configure/app/output/filename-hash.mdx +1 -1
- package/docs/zh/configure/app/output/filename.mdx +1 -1
- package/docs/zh/configure/app/output/legal-comments.mdx +1 -1
- package/docs/zh/configure/app/output/override-browserslist.mdx +1 -1
- package/docs/zh/configure/app/output/polyfill.mdx +1 -1
- package/docs/zh/configure/app/output/splitRouteChunks.mdx +1 -1
- package/docs/zh/configure/app/output/ssg.mdx +1 -1
- package/docs/zh/configure/app/output/svg-default-export.mdx +1 -1
- package/docs/zh/configure/app/output/temp-dir.mdx +1 -1
- package/docs/zh/configure/app/performance/build-cache.mdx +1 -1
- package/docs/zh/configure/app/performance/bundle-analyze.mdx +1 -1
- package/docs/zh/configure/app/performance/chunk-split.mdx +1 -1
- package/docs/zh/configure/app/performance/dns-prefetch.mdx +1 -1
- package/docs/zh/configure/app/performance/preconnect.mdx +1 -1
- package/docs/zh/configure/app/performance/prefetch.mdx +1 -1
- package/docs/zh/configure/app/performance/preload.mdx +1 -1
- package/docs/zh/configure/app/performance/print-file-size.mdx +1 -1
- package/docs/zh/configure/app/performance/profile.mdx +1 -1
- package/docs/zh/configure/app/performance/remove-console.mdx +1 -1
- package/docs/zh/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/docs/zh/configure/app/performance/transform-lodash.mdx +1 -1
- package/docs/zh/configure/app/plugins.mdx +1 -1
- package/docs/zh/configure/app/runtime/{intro.mdx → 0-intro.mdx} +1 -1
- package/docs/zh/configure/app/runtime/master-app.mdx +1 -1
- package/docs/zh/configure/app/runtime/router.mdx +3 -1
- package/docs/zh/configure/app/runtime/state.mdx +1 -1
- package/docs/zh/configure/app/security/check-syntax.mdx +1 -1
- package/docs/zh/configure/app/security/nonce.mdx +1 -1
- package/docs/zh/configure/app/security/sri.mdx +1 -1
- package/docs/zh/configure/app/server/base-url.mdx +1 -1
- package/docs/zh/configure/app/server/enable-framework-ext.mdx +1 -1
- package/docs/zh/configure/app/server/port.mdx +1 -1
- package/docs/zh/configure/app/server/public-routes.mdx +1 -1
- package/docs/zh/configure/app/server/routes.mdx +1 -1
- package/docs/zh/configure/app/server/ssr-by-entries.mdx +1 -1
- package/docs/zh/configure/app/server/ssr.mdx +1 -1
- package/docs/zh/configure/app/source/alias-strategy.mdx +1 -1
- package/docs/zh/configure/app/source/alias.mdx +1 -1
- package/docs/zh/configure/app/source/config-dir.mdx +1 -1
- package/docs/zh/configure/app/source/decorators.mdx +1 -1
- package/docs/zh/configure/app/source/define.mdx +1 -1
- package/docs/zh/configure/app/source/disable-default-entries.mdx +1 -1
- package/docs/zh/configure/app/source/disable-entry-dirs.mdx +1 -1
- package/docs/zh/configure/app/source/enable-async-entry.mdx +1 -1
- package/docs/zh/configure/app/source/enable-custom-entry.mdx +1 -1
- package/docs/zh/configure/app/source/entries-dir.mdx +1 -1
- package/docs/zh/configure/app/source/entries.mdx +1 -1
- package/docs/zh/configure/app/source/exclude.mdx +1 -1
- package/docs/zh/configure/app/source/global-vars.mdx +1 -1
- package/docs/zh/configure/app/source/include.mdx +1 -1
- package/docs/zh/configure/app/source/mainEntryName.mdx +1 -1
- package/docs/zh/configure/app/source/module-scopes.mdx +1 -1
- package/docs/zh/configure/app/source/pre-entry.mdx +1 -1
- package/docs/zh/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/docs/zh/configure/app/source/resolve-main-fields.mdx +1 -1
- package/docs/zh/configure/app/source/transform-import.mdx +1 -1
- package/docs/zh/configure/app/tools/autoprefixer.mdx +1 -1
- package/docs/zh/configure/app/tools/babel.mdx +1 -1
- package/docs/zh/configure/app/tools/bundler-chain.mdx +1 -1
- package/docs/zh/configure/app/tools/css-extract.mdx +1 -1
- package/docs/zh/configure/app/tools/css-loader.mdx +1 -1
- package/docs/zh/configure/app/tools/dev-server.mdx +1 -1
- package/docs/zh/configure/app/tools/esbuild.mdx +2 -2
- package/docs/zh/configure/app/tools/html-plugin.mdx +1 -1
- package/docs/zh/configure/app/tools/less.mdx +1 -1
- package/docs/zh/configure/app/tools/minify-css.mdx +1 -1
- package/docs/zh/configure/app/tools/postcss.mdx +1 -1
- package/docs/zh/configure/app/tools/pug.mdx +1 -1
- package/docs/zh/configure/app/tools/rspack.mdx +1 -1
- package/docs/zh/configure/app/tools/sass.mdx +1 -1
- package/docs/zh/configure/app/tools/style-loader.mdx +1 -1
- package/docs/zh/configure/app/tools/styled-components.mdx +1 -1
- package/docs/zh/configure/app/tools/swc.mdx +2 -2
- package/docs/zh/configure/app/tools/tailwindcss.mdx +1 -1
- package/docs/zh/configure/app/tools/terser.mdx +1 -1
- package/docs/zh/configure/app/tools/ts-checker.mdx +1 -1
- package/docs/zh/configure/app/tools/ts-loader.mdx +1 -1
- package/docs/zh/configure/app/tools/webpack-chain.mdx +1 -1
- package/docs/zh/configure/app/tools/webpack.mdx +1 -1
- package/docs/zh/guides/_meta.json +38 -0
- package/docs/zh/guides/advanced-features/_meta.json +26 -0
- package/docs/zh/guides/advanced-features/bff/_meta.json +6 -0
- package/docs/zh/guides/advanced-features/rsbuild-plugin.mdx +9 -9
- package/docs/zh/guides/advanced-features/ssr/_meta.json +5 -0
- package/docs/zh/guides/basic-features/_meta.json +22 -0
- package/docs/zh/guides/basic-features/data/_meta.json +4 -0
- package/docs/zh/guides/basic-features/mock.mdx +1 -1
- package/docs/zh/guides/concept/_meta.json +4 -0
- package/docs/zh/guides/get-started/_meta.json +7 -0
- package/docs/zh/guides/get-started/quick-start.mdx +2 -2
- package/docs/zh/guides/get-started/upgrade.mdx +1 -1
- package/docs/zh/guides/rsbuild-plugins/plugin-esbuild.mdx +201 -0
- package/docs/zh/guides/rsbuild-plugins/plugin-swc.mdx +344 -0
- package/docs/zh/guides/topic-detail/_meta.json +26 -0
- package/docs/zh/guides/topic-detail/framework-plugin/_meta.json +10 -0
- package/docs/zh/guides/topic-detail/generator/_meta.json +17 -0
- package/docs/zh/guides/topic-detail/generator/create/_meta.json +5 -0
- package/docs/zh/guides/topic-detail/generator/new/_meta.json +5 -0
- package/docs/zh/guides/topic-detail/generator/plugin/_meta.json +11 -0
- package/docs/zh/guides/topic-detail/model/_meta.json +14 -0
- package/docs/zh/guides/troubleshooting/_meta.json +6 -0
- package/docs/zh/guides/troubleshooting/dependencies.mdx +4 -4
- package/docs/zh/tutorials/_meta.json +17 -0
- package/i18n.json +110 -0
- package/package.json +9 -10
- package/rspress.config.ts +3 -20
- package/src/components/ContentCard/index.tsx +1 -1
- package/src/components/FeatureLayout/index.tsx +1 -1
- package/src/components/Footer/index.tsx +2 -2
- package/src/components/ListCard/index.tsx +1 -1
- package/src/components/Sandpack/index.tsx +4 -2
- package/src/components/SecondaryTitle/index.tsx +1 -1
- package/src/i18n/zhCN.ts +1 -1
- package/src/index.ts +0 -1
- package/src/pages/index.tsx +13 -5
- package/docs/en/apis/app/hooks/_category_.json +0 -5
- package/docs/en/apis/app/hooks/api/_category_.json +0 -4
- package/docs/en/apis/app/hooks/config/_category_.json +0 -4
- package/docs/en/apis/app/hooks/server/_category_.json +0 -4
- package/docs/en/apis/app/hooks/src/_category_.json +0 -4
- package/docs/en/apis/app/runtime/_category_.json +0 -5
- package/docs/en/apis/app/runtime/app/_category_.json +0 -4
- package/docs/en/apis/app/runtime/bff/_category_.json +0 -4
- package/docs/en/apis/app/runtime/core/_category_.json +0 -5
- package/docs/en/apis/app/runtime/model/_category_.json +0 -4
- package/docs/en/apis/app/runtime/router/_category_.json +0 -4
- package/docs/en/apis/app/runtime/ssr/_category_.json +0 -4
- package/docs/en/apis/app/runtime/utility/_category_.json +0 -4
- package/docs/en/apis/app/runtime/web-server/_category_.json +0 -4
- package/docs/en/community/blog/_category_.json +0 -6
- package/docs/en/configure/app/bff/_category_.json +0 -4
- package/docs/en/configure/app/deploy/_category_.json +0 -4
- package/docs/en/configure/app/dev/_category_.json +0 -4
- package/docs/en/configure/app/experiments/_category_.json +0 -4
- package/docs/en/configure/app/html/_category_.json +0 -4
- package/docs/en/configure/app/output/_category_.json +0 -4
- package/docs/en/configure/app/performance/_category_.json +0 -4
- package/docs/en/configure/app/runtime/_category_.json +0 -4
- package/docs/en/configure/app/security/_category_.json +0 -4
- package/docs/en/configure/app/server/_category_.json +0 -4
- package/docs/en/configure/app/source/_category_.json +0 -4
- package/docs/en/configure/app/tools/_category_.json +0 -4
- package/docs/en/guides/advanced-features/_category_.json +0 -5
- package/docs/en/guides/advanced-features/bff/_category_.json +0 -8
- package/docs/en/guides/advanced-features/ssr/_category_.json +0 -8
- package/docs/en/guides/basic-features/_category_.json +0 -5
- package/docs/en/guides/basic-features/data/_category_.json +0 -4
- package/docs/en/guides/concept/_category_.json +0 -5
- package/docs/en/guides/get-started/_category_.json +0 -5
- package/docs/en/guides/topic-detail/_category_.json +0 -5
- package/docs/en/guides/topic-detail/framework-plugin/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/create/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/new/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/_category_.json +0 -4
- package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +0 -4
- package/docs/en/guides/topic-detail/micro-frontend/_category_.json +0 -4
- package/docs/en/guides/topic-detail/model/_category_.json +0 -4
- package/docs/en/guides/troubleshooting/_category_.json +0 -5
- package/docs/en/tutorials/examples/_category_.json +0 -5
- package/docs/en/tutorials/first-app/_category_.json +0 -5
- package/docs/en/tutorials/foundations/_category_.json +0 -5
- package/docs/zh/apis/app/hooks/_category_.json +0 -5
- package/docs/zh/apis/app/hooks/api/_category_.json +0 -4
- package/docs/zh/apis/app/hooks/config/_category_.json +0 -4
- package/docs/zh/apis/app/hooks/server/_category_.json +0 -4
- package/docs/zh/apis/app/hooks/src/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/_category_.json +0 -5
- package/docs/zh/apis/app/runtime/app/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/bff/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/core/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/model/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/router/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/ssr/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/utility/_category_.json +0 -4
- package/docs/zh/apis/app/runtime/web-server/_category_.json +0 -4
- package/docs/zh/community/blog/_category_.json +0 -6
- package/docs/zh/configure/app/bff/_category_.json +0 -4
- package/docs/zh/configure/app/deploy/_category_.json +0 -4
- package/docs/zh/configure/app/dev/_category_.json +0 -4
- package/docs/zh/configure/app/experiments/_category_.json +0 -4
- package/docs/zh/configure/app/html/_category_.json +0 -4
- package/docs/zh/configure/app/output/_category_.json +0 -4
- package/docs/zh/configure/app/performance/_category_.json +0 -4
- package/docs/zh/configure/app/runtime/_category_.json +0 -4
- package/docs/zh/configure/app/security/_category_.json +0 -4
- package/docs/zh/configure/app/server/_category_.json +0 -4
- package/docs/zh/configure/app/source/_category_.json +0 -4
- package/docs/zh/configure/app/tools/_category_.json +0 -4
- package/docs/zh/guides/advanced-features/_category_.json +0 -5
- package/docs/zh/guides/advanced-features/bff/_category_.json +0 -8
- package/docs/zh/guides/advanced-features/ssr/_category_.json +0 -8
- package/docs/zh/guides/basic-features/_category_.json +0 -5
- package/docs/zh/guides/basic-features/data/_category_.json +0 -4
- package/docs/zh/guides/concept/_category_.json +0 -5
- package/docs/zh/guides/get-started/_category_.json +0 -5
- package/docs/zh/guides/topic-detail/_category_.json +0 -5
- package/docs/zh/guides/topic-detail/framework-plugin/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/create/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/new/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/micro-frontend/_category_.json +0 -4
- package/docs/zh/guides/topic-detail/model/_category_.json +0 -4
- package/docs/zh/guides/troubleshooting/_category_.json +0 -5
- package/docs/zh/tutorials/examples/_category_.json +0 -5
- package/docs/zh/tutorials/first-app/_category_.json +0 -5
- package/docs/zh/tutorials/foundations/_category_.json +0 -5
- package/src/.eslintrc.json +0 -3
- /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
|
+
]
|
@@ -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@
|
22
|
-
└── @modern-js/core@
|
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
|
34
|
-
└── @modern-js/core
|
33
|
+
@modern-js/app-tools x.y.z
|
34
|
+
└── @modern-js/core x.y.z
|
35
35
|
```
|
36
36
|
|
37
37
|
---
|
@@ -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,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
|
+
]
|
@@ -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"
|