@modern-js/main-doc 2.7.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +27 -0
- package/README.md +15 -18
- package/docs/en/apis/app/commands.mdx +299 -0
- package/docs/en/apis/app/hooks/api/framework/lambda.mdx +57 -0
- package/docs/en/apis/app/hooks/api/functions/api.mdx +81 -0
- package/docs/en/apis/app/hooks/src/routes.mdx +90 -0
- package/docs/en/apis/app/hooks/src/server.mdx +34 -0
- package/docs/en/apis/app/runtime/model/connect.mdx +145 -0
- package/docs/en/apis/app/runtime/model/model_.mdx +199 -0
- package/docs/en/apis/app/runtime/model/use-model.mdx +89 -0
- package/docs/en/apis/app/runtime/router/router.mdx +262 -0
- package/docs/en/apis/app/runtime/web-server/hook.mdx +133 -0
- package/docs/en/apis/app/runtime/web-server/middleware.mdx +134 -0
- package/docs/en/components/enable-bff.mdx +31 -0
- package/docs/en/components/init-app.mdx +43 -0
- package/docs/en/components/init-rspack-app.mdx +7 -0
- package/docs/en/components/prerequisites.mdx +18 -0
- package/docs/en/configure/app/bff/enable-handle-web.mdx +24 -0
- package/docs/en/configure/app/dev/asset-prefix.mdx +13 -0
- package/docs/en/configure/app/dev/before-start-url.mdx +13 -0
- package/docs/en/configure/app/dev/hmr.mdx +13 -0
- package/docs/en/configure/app/dev/host.mdx +13 -0
- package/docs/en/configure/app/dev/https.mdx +13 -0
- package/docs/en/configure/app/dev/port.mdx +13 -0
- package/docs/en/configure/app/dev/progress-bar.mdx +13 -0
- package/docs/en/configure/app/dev/start-url.mdx +13 -0
- package/docs/en/configure/app/experiments/lazy-compilation.mdx +13 -0
- package/docs/en/configure/app/html/app-icon.mdx +13 -0
- package/docs/en/configure/app/html/crossorigin.mdx +13 -0
- package/docs/en/configure/app/html/disable-html-folder.mdx +13 -0
- package/docs/en/configure/app/html/favicon-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/favicon.mdx +13 -0
- package/docs/en/configure/app/html/inject-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/inject.mdx +13 -0
- package/docs/en/configure/app/html/meta-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/meta.mdx +13 -0
- package/docs/en/configure/app/html/mount-id.mdx +13 -0
- package/docs/en/configure/app/html/tags-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/tags.mdx +13 -0
- package/docs/en/configure/app/html/template-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/template-parameters-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/template-parameters.mdx +13 -0
- package/docs/en/configure/app/html/template.mdx +13 -0
- package/docs/en/configure/app/html/title-by-entries.mdx +13 -0
- package/docs/en/configure/app/html/title.mdx +13 -0
- package/docs/en/configure/app/output/asset-prefix.mdx +13 -0
- package/docs/en/configure/app/output/assets-retry.mdx +13 -0
- package/docs/en/configure/app/output/charset.mdx +13 -0
- package/docs/en/configure/app/output/clean-dist-path.mdx +13 -0
- package/docs/en/configure/app/output/convert-to-rem.mdx +13 -0
- package/docs/en/configure/app/output/copy.mdx +13 -0
- package/docs/en/configure/app/output/css-module-local-ident-name.mdx +13 -0
- package/docs/en/configure/app/output/data-uri-limit.mdx +13 -0
- package/docs/en/configure/app/output/disable-css-extract.mdx +13 -0
- package/docs/en/configure/app/output/disable-css-module-extension.mdx +13 -0
- package/docs/en/configure/app/output/disable-filename-hash.mdx +13 -0
- package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +13 -0
- package/docs/en/configure/app/output/disable-minimize.mdx +13 -0
- package/docs/en/configure/app/output/disable-source-map.mdx +13 -0
- package/docs/en/configure/app/output/disable-ts-checker.mdx +13 -0
- package/docs/en/configure/app/output/dist-path.mdx +13 -0
- package/docs/en/configure/app/output/enable-asset-fallback.mdx +13 -0
- package/docs/en/configure/app/output/enable-asset-manifest.mdx +13 -0
- package/docs/en/configure/app/output/enable-css-module-tsdeclaration.mdx +13 -0
- package/docs/en/configure/app/output/enable-inline-scripts.mdx +13 -0
- package/docs/en/configure/app/output/enable-inline-styles.mdx +13 -0
- package/docs/en/configure/app/output/enable-latest-decorators.mdx +13 -0
- package/docs/en/configure/app/output/externals.mdx +13 -0
- package/docs/en/configure/app/output/filename.mdx +13 -0
- package/docs/en/configure/app/output/legal-comments.mdx +13 -0
- package/docs/en/configure/app/output/override-browserslist.mdx +13 -0
- package/docs/en/configure/app/output/polyfill.mdx +13 -0
- package/docs/en/configure/app/output/ssg.mdx +196 -0
- package/docs/en/configure/app/output/svg-default-export.mdx +13 -0
- package/docs/en/configure/app/performance/build-cache.mdx +13 -0
- package/docs/en/configure/app/performance/bundle-analyze.mdx +13 -0
- package/docs/en/configure/app/performance/chunk-split.mdx +13 -0
- package/docs/en/configure/app/performance/print-file-size.mdx +13 -0
- package/docs/en/configure/app/performance/profile.mdx +13 -0
- package/docs/en/configure/app/performance/remove-console.mdx +13 -0
- package/docs/en/configure/app/performance/remove-moment-locale.mdx +13 -0
- package/docs/en/configure/app/security/check-syntax.mdx +13 -0
- package/docs/en/configure/app/security/sri.mdx +13 -0
- package/docs/en/configure/app/server/enable-framework-ext.mdx +49 -0
- package/docs/en/configure/app/server/public-routes.mdx +26 -0
- package/docs/en/configure/app/server/ssr.mdx +38 -0
- package/docs/en/configure/app/source/alias.mdx +13 -0
- package/docs/en/configure/app/source/compile-js-data-uri.mdx +13 -0
- package/docs/en/configure/app/source/define.mdx +13 -0
- package/docs/en/configure/app/source/design-system.mdx +1175 -0
- package/docs/en/configure/app/source/disable-entry-dirs.mdx +39 -0
- package/docs/en/configure/app/source/entries.mdx +123 -0
- package/docs/en/configure/app/source/exclude.mdx +13 -0
- package/docs/en/configure/app/source/global-vars.mdx +13 -0
- package/docs/en/configure/app/source/include.mdx +13 -0
- package/docs/en/configure/app/source/module-scopes.mdx +13 -0
- package/docs/en/configure/app/source/pre-entry.mdx +13 -0
- package/docs/en/configure/app/source/resolve-extension-prefix.mdx +13 -0
- package/docs/en/configure/app/source/resolve-main-fields.mdx +13 -0
- package/docs/en/configure/app/tools/autoprefixer.mdx +13 -0
- package/docs/en/configure/app/tools/babel.mdx +13 -0
- package/docs/en/configure/app/tools/css-extract.mdx +13 -0
- package/docs/en/configure/app/tools/css-loader.mdx +13 -0
- package/docs/en/configure/app/tools/dev-server.mdx +13 -0
- package/docs/en/configure/app/tools/html-plugin.mdx +13 -0
- package/docs/en/configure/app/tools/inspector.mdx +13 -0
- package/docs/en/configure/app/tools/less.mdx +13 -0
- package/docs/en/configure/app/tools/minify-css.mdx +13 -0
- package/docs/en/configure/app/tools/postcss.mdx +13 -0
- package/docs/en/configure/app/tools/pug.mdx +13 -0
- package/docs/en/configure/app/tools/rspack.mdx +13 -0
- package/docs/en/configure/app/tools/sass.mdx +13 -0
- package/docs/en/configure/app/tools/style-loader.mdx +13 -0
- package/docs/en/configure/app/tools/styled-components.mdx +13 -0
- package/docs/en/configure/app/tools/terser.mdx +13 -0
- package/docs/en/configure/app/tools/ts-checker.mdx +13 -0
- package/docs/en/configure/app/tools/ts-loader.mdx +13 -0
- package/docs/en/configure/app/tools/webpack-chain.mdx +13 -0
- package/docs/en/configure/app/tools/webpack.mdx +13 -0
- package/docs/en/guides/advanced-features/bff/_category_.json +8 -0
- package/docs/en/guides/advanced-features/code-split.mdx +80 -0
- package/docs/en/guides/advanced-features/compatibility.mdx +78 -0
- package/docs/en/guides/advanced-features/eslint.mdx +148 -0
- package/docs/en/guides/advanced-features/low-level.mdx +45 -0
- package/docs/en/guides/advanced-features/rspack-start.mdx +61 -0
- package/docs/en/guides/advanced-features/ssg.mdx +116 -0
- package/docs/en/guides/advanced-features/ssr.mdx +518 -0
- package/docs/en/guides/advanced-features/testing.mdx +46 -0
- package/docs/en/guides/advanced-features/web-server.mdx +124 -0
- package/docs/en/guides/basic-features/data-fetch.mdx +404 -0
- package/docs/en/guides/basic-features/env-vars.mdx +174 -0
- package/docs/en/guides/basic-features/html.mdx +247 -0
- package/docs/en/guides/basic-features/proxy.mdx +61 -0
- package/docs/en/guides/concept/builder.mdx +47 -0
- package/docs/en/guides/get-started/introduction.mdx +50 -0
- package/docs/en/guides/get-started/quick-start.mdx +162 -0
- package/docs/en/guides/topic-detail/framework-plugin/extend.mdx +164 -0
- package/docs/en/guides/topic-detail/framework-plugin/hook-list.mdx +827 -0
- package/docs/en/guides/topic-detail/framework-plugin/hook.mdx +188 -0
- package/docs/en/guides/topic-detail/framework-plugin/implement.mdx +246 -0
- package/docs/en/guides/topic-detail/framework-plugin/introduction.mdx +50 -0
- package/docs/en/guides/topic-detail/framework-plugin/plugin-api.mdx +117 -0
- package/docs/en/guides/topic-detail/framework-plugin/relationship.mdx +119 -0
- package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +48 -0
- package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +53 -0
- package/docs/en/guides/topic-detail/generator/config/app.mdx +82 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +55 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +55 -0
- package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +18 -0
- package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +125 -0
- package/docs/en/guides/topic-detail/generator/project.mdx +118 -0
- package/docs/en/guides/topic-detail/micro-frontend/c01-introduction.mdx +29 -0
- package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +254 -0
- package/docs/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +282 -0
- package/docs/en/guides/topic-detail/micro-frontend/c04-communicate.mdx +57 -0
- package/docs/en/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +26 -0
- package/docs/en/guides/topic-detail/model/auto-actions.mdx +89 -0
- package/docs/en/guides/topic-detail/model/computed-state.mdx +153 -0
- package/docs/en/guides/topic-detail/model/define-model.mdx +66 -0
- package/docs/en/guides/topic-detail/model/faq.mdx +40 -0
- package/docs/en/guides/topic-detail/model/manage-effects.mdx +251 -0
- package/docs/en/guides/topic-detail/model/model-communicate.mdx +222 -0
- package/docs/en/guides/topic-detail/model/performance.mdx +170 -0
- package/docs/en/guides/topic-detail/model/quick-start.mdx +114 -0
- package/docs/en/guides/topic-detail/model/redux-integration.mdx +24 -0
- package/docs/en/guides/topic-detail/model/test-model.mdx +45 -0
- package/docs/en/guides/topic-detail/model/typescript-best-practice.mdx +72 -0
- package/docs/en/guides/topic-detail/model/use-model.mdx +247 -0
- package/docs/en/guides/topic-detail/model/use-out-of-modernjs.mdx +50 -0
- package/docs/en/guides/troubleshooting/cli.mdx +63 -0
- package/docs/en/tutorials/first-app/c03-css.mdx +323 -0
- package/docs/zh/apis/app/commands.mdx +301 -0
- package/docs/zh/apis/app/runtime/model/connect.mdx +143 -0
- package/docs/zh/apis/app/runtime/model/model_.mdx +199 -0
- package/docs/zh/apis/app/runtime/model/use-model.mdx +89 -0
- package/docs/zh/apis/app/runtime/web-server/hook.mdx +132 -0
- package/docs/zh/apis/app/runtime/web-server/middleware.mdx +131 -0
- package/docs/zh/apis/monorepo/commands/gen-release-note.mdx +32 -0
- package/docs/zh/apis/monorepo/commands/new.mdx +39 -0
- package/docs/zh/components/default-mwa-generate.mdx +5 -0
- package/docs/zh/components/enable-bff.mdx +31 -0
- package/docs/zh/components/init-app.mdx +44 -0
- package/docs/zh/components/init-rspack-app.mdx +7 -0
- package/docs/zh/components/prerequisites.mdx +18 -0
- package/docs/zh/components/release-note.mdx +1 -0
- package/docs/zh/configure/app/bff/enable-handle-web.mdx +24 -0
- package/docs/zh/configure/app/dev/asset-prefix.mdx +13 -0
- package/docs/zh/configure/app/dev/before-start-url.mdx +13 -0
- package/docs/zh/configure/app/dev/hmr.mdx +13 -0
- package/docs/zh/configure/app/dev/host.mdx +13 -0
- package/docs/zh/configure/app/dev/https.mdx +13 -0
- package/docs/zh/configure/app/dev/port.mdx +13 -0
- package/docs/zh/configure/app/dev/progress-bar.mdx +13 -0
- package/docs/zh/configure/app/dev/start-url.mdx +13 -0
- package/docs/zh/configure/app/experiments/lazy-compilation.mdx +13 -0
- package/docs/zh/configure/app/html/app-icon.mdx +13 -0
- package/docs/zh/configure/app/html/crossorigin.mdx +13 -0
- package/docs/zh/configure/app/html/disable-html-folder.mdx +13 -0
- package/docs/zh/configure/app/html/favicon-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/favicon.mdx +13 -0
- package/docs/zh/configure/app/html/inject-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/inject.mdx +13 -0
- package/docs/zh/configure/app/html/meta-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/meta.mdx +13 -0
- package/docs/zh/configure/app/html/mount-id.mdx +13 -0
- package/docs/zh/configure/app/html/tags-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/tags.mdx +13 -0
- package/docs/zh/configure/app/html/template-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/template-parameters-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/template-parameters.mdx +13 -0
- package/docs/zh/configure/app/html/template.mdx +13 -0
- package/docs/zh/configure/app/html/title-by-entries.mdx +13 -0
- package/docs/zh/configure/app/html/title.mdx +13 -0
- package/docs/zh/configure/app/output/asset-prefix.mdx +13 -0
- package/docs/zh/configure/app/output/assets-retry.mdx +13 -0
- package/docs/zh/configure/app/output/charset.mdx +13 -0
- package/docs/zh/configure/app/output/clean-dist-path.mdx +13 -0
- package/docs/zh/configure/app/output/convert-to-rem.mdx +13 -0
- package/docs/zh/configure/app/output/copy.mdx +13 -0
- package/docs/zh/configure/app/output/css-module-local-ident-name.mdx +13 -0
- package/docs/zh/configure/app/output/data-uri-limit.mdx +13 -0
- package/docs/zh/configure/app/output/disable-css-extract.mdx +13 -0
- package/docs/zh/configure/app/output/disable-css-module-extension.mdx +13 -0
- package/docs/zh/configure/app/output/disable-filename-hash.mdx +13 -0
- package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +13 -0
- package/docs/zh/configure/app/output/disable-minimize.mdx +13 -0
- package/docs/zh/configure/app/output/disable-source-map.mdx +13 -0
- package/docs/zh/configure/app/output/disable-ts-checker.mdx +13 -0
- package/docs/zh/configure/app/output/dist-path.mdx +13 -0
- package/docs/zh/configure/app/output/enable-asset-fallback.mdx +13 -0
- package/docs/zh/configure/app/output/enable-asset-manifest.mdx +13 -0
- package/docs/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +13 -0
- package/docs/zh/configure/app/output/enable-inline-scripts.mdx +13 -0
- package/docs/zh/configure/app/output/enable-inline-styles.mdx +13 -0
- package/docs/zh/configure/app/output/enable-latest-decorators.mdx +13 -0
- package/docs/zh/configure/app/output/externals.mdx +13 -0
- package/docs/zh/configure/app/output/filename.mdx +13 -0
- package/docs/zh/configure/app/output/legal-comments.mdx +13 -0
- package/docs/zh/configure/app/output/override-browserslist.mdx +13 -0
- package/docs/zh/configure/app/output/polyfill.mdx +13 -0
- package/docs/zh/configure/app/output/svg-default-export.mdx +13 -0
- package/docs/zh/configure/app/performance/build-cache.mdx +13 -0
- package/docs/zh/configure/app/performance/bundle-analyze.mdx +13 -0
- package/docs/zh/configure/app/performance/chunk-split.mdx +13 -0
- package/docs/zh/configure/app/performance/print-file-size.mdx +13 -0
- package/docs/zh/configure/app/performance/profile.mdx +13 -0
- package/docs/zh/configure/app/performance/remove-console.mdx +13 -0
- package/docs/zh/configure/app/performance/remove-moment-locale.mdx +13 -0
- package/docs/zh/configure/app/security/check-syntax.mdx +13 -0
- package/docs/zh/configure/app/security/sri.mdx +13 -0
- package/docs/zh/configure/app/server/enable-framework-ext.mdx +49 -0
- package/docs/zh/configure/app/source/alias.mdx +13 -0
- package/docs/zh/configure/app/source/compile-js-data-uri.mdx +13 -0
- package/docs/zh/configure/app/source/define.mdx +13 -0
- package/docs/zh/configure/app/source/exclude.mdx +13 -0
- package/docs/zh/configure/app/source/global-vars.mdx +13 -0
- package/docs/zh/configure/app/source/include.mdx +13 -0
- package/docs/zh/configure/app/source/module-scopes.mdx +13 -0
- package/docs/zh/configure/app/source/pre-entry.mdx +13 -0
- package/docs/zh/configure/app/source/resolve-extension-prefix.mdx +13 -0
- package/docs/zh/configure/app/source/resolve-main-fields.mdx +13 -0
- package/docs/zh/configure/app/tools/autoprefixer.mdx +13 -0
- package/docs/zh/configure/app/tools/babel.mdx +13 -0
- package/docs/zh/configure/app/tools/css-extract.mdx +13 -0
- package/docs/zh/configure/app/tools/css-loader.mdx +13 -0
- package/docs/zh/configure/app/tools/dev-server.mdx +13 -0
- package/docs/zh/configure/app/tools/html-plugin.mdx +13 -0
- package/docs/zh/configure/app/tools/inspector.mdx +13 -0
- package/docs/zh/configure/app/tools/less.mdx +13 -0
- package/docs/zh/configure/app/tools/minify-css.mdx +13 -0
- package/docs/zh/configure/app/tools/postcss.mdx +13 -0
- package/docs/zh/configure/app/tools/pug.mdx +13 -0
- package/docs/zh/configure/app/tools/rspack.mdx +13 -0
- package/docs/zh/configure/app/tools/sass.mdx +13 -0
- package/docs/zh/configure/app/tools/style-loader.mdx +13 -0
- package/docs/zh/configure/app/tools/styled-components.mdx +13 -0
- package/docs/zh/configure/app/tools/terser.mdx +13 -0
- package/docs/zh/configure/app/tools/ts-checker.mdx +13 -0
- package/docs/zh/configure/app/tools/ts-loader.mdx +13 -0
- package/docs/zh/configure/app/tools/webpack-chain.mdx +13 -0
- package/docs/zh/configure/app/tools/webpack.mdx +13 -0
- package/docs/zh/guides/advanced-features/bff/_category_.json +8 -0
- package/docs/zh/guides/advanced-features/rspack-start.mdx +62 -0
- package/docs/zh/guides/advanced-features/ssr.mdx +507 -0
- package/docs/zh/guides/advanced-features/web-server.mdx +122 -0
- package/docs/zh/guides/basic-features/mock.mdx +99 -0
- package/docs/zh/guides/concept/builder.mdx +47 -0
- package/docs/zh/guides/get-started/introduction.mdx +47 -0
- package/docs/zh/guides/topic-detail/changesets/changelog.mdx +238 -0
- package/docs/zh/guides/topic-detail/changesets/commit.mdx +271 -0
- package/docs/zh/guides/topic-detail/changesets/github.mdx +164 -0
- package/docs/zh/guides/topic-detail/changesets/release-note.mdx +259 -0
- package/docs/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +117 -0
- package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +125 -0
- package/docs/zh/guides/topic-detail/model/faq.mdx +41 -0
- package/docs/zh/guides/topic-detail/model/manage-effects.mdx +260 -0
- package/docs/zh/guides/topic-detail/model/model-communicate.mdx +220 -0
- package/docs/zh/guides/topic-detail/model/performance.mdx +171 -0
- package/docs/zh/guides/topic-detail/model/quick-start.mdx +113 -0
- package/docs/zh/guides/topic-detail/model/use-model.mdx +252 -0
- package/docs/zh/guides/topic-detail/monorepo/create-sub-project.mdx +67 -0
- package/docs/zh/guides/topic-detail/monorepo/sub-project-interface.mdx +179 -0
- package/docs/zh/index.md +4 -0
- package/en/configure/app/dev/asset-prefix.mdx +1 -1
- package/en/configure/app/dev/before-start-url.mdx +1 -1
- package/en/configure/app/dev/hmr.mdx +1 -1
- package/en/configure/app/dev/host.mdx +1 -1
- package/en/configure/app/dev/https.mdx +1 -1
- package/en/configure/app/dev/port.mdx +1 -1
- package/en/configure/app/dev/progress-bar.mdx +1 -1
- package/en/configure/app/dev/start-url.mdx +1 -1
- package/en/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/en/configure/app/html/app-icon.mdx +1 -1
- package/en/configure/app/html/crossorigin.mdx +1 -1
- package/en/configure/app/html/disable-html-folder.mdx +1 -1
- package/en/configure/app/html/favicon-by-entries.mdx +1 -1
- package/en/configure/app/html/favicon.mdx +1 -1
- package/en/configure/app/html/inject-by-entries.mdx +1 -1
- package/en/configure/app/html/inject.mdx +1 -1
- package/en/configure/app/html/meta-by-entries.mdx +1 -1
- package/en/configure/app/html/meta.mdx +1 -1
- package/en/configure/app/html/mount-id.mdx +1 -1
- package/en/configure/app/html/tags-by-entries.mdx +1 -1
- package/en/configure/app/html/tags.mdx +1 -1
- package/en/configure/app/html/template-by-entries.mdx +1 -1
- package/en/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/en/configure/app/html/template-parameters.mdx +1 -1
- package/en/configure/app/html/template.mdx +1 -1
- package/en/configure/app/html/title-by-entries.mdx +1 -1
- package/en/configure/app/html/title.mdx +1 -1
- package/en/configure/app/output/asset-prefix.mdx +1 -1
- package/en/configure/app/output/assets-retry.mdx +1 -1
- package/en/configure/app/output/charset.mdx +1 -1
- package/en/configure/app/output/clean-dist-path.mdx +1 -1
- package/en/configure/app/output/convert-to-rem.mdx +1 -1
- package/en/configure/app/output/copy.mdx +1 -1
- package/en/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/en/configure/app/output/data-uri-limit.mdx +1 -1
- package/en/configure/app/output/disable-css-extract.mdx +1 -1
- package/en/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/en/configure/app/output/disable-filename-hash.mdx +1 -1
- package/en/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/en/configure/app/output/disable-minimize.mdx +1 -1
- package/en/configure/app/output/disable-source-map.mdx +1 -1
- package/en/configure/app/output/disable-ts-checker.mdx +1 -1
- package/en/configure/app/output/dist-path.mdx +1 -1
- package/en/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/en/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/en/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/en/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/en/configure/app/output/enable-inline-styles.mdx +1 -1
- package/en/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/en/configure/app/output/externals.mdx +1 -1
- package/en/configure/app/output/filename.mdx +1 -1
- package/en/configure/app/output/legal-comments.mdx +1 -1
- package/en/configure/app/output/override-browserslist.mdx +1 -1
- package/en/configure/app/output/polyfill.mdx +1 -1
- package/en/configure/app/output/svg-default-export.mdx +1 -1
- package/en/configure/app/performance/build-cache.mdx +1 -1
- package/en/configure/app/performance/bundle-analyze.mdx +1 -1
- package/en/configure/app/performance/chunk-split.mdx +1 -1
- package/en/configure/app/performance/print-file-size.mdx +1 -1
- package/en/configure/app/performance/profile.mdx +1 -1
- package/en/configure/app/performance/remove-console.mdx +1 -1
- package/en/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/en/configure/app/security/check-syntax.mdx +1 -1
- package/en/configure/app/security/sri.mdx +1 -1
- package/en/configure/app/source/alias.mdx +1 -1
- package/en/configure/app/source/compile-js-data-uri.mdx +1 -1
- package/en/configure/app/source/define.mdx +1 -1
- package/en/configure/app/source/exclude.mdx +1 -1
- package/en/configure/app/source/global-vars.mdx +1 -1
- package/en/configure/app/source/include.mdx +1 -1
- package/en/configure/app/source/module-scopes.mdx +1 -1
- package/en/configure/app/source/pre-entry.mdx +1 -1
- package/en/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/en/configure/app/source/resolve-main-fields.mdx +1 -1
- package/en/configure/app/tools/autoprefixer.mdx +1 -1
- package/en/configure/app/tools/babel.mdx +1 -1
- package/en/configure/app/tools/css-extract.mdx +1 -1
- package/en/configure/app/tools/css-loader.mdx +1 -1
- package/en/configure/app/tools/dev-server.mdx +1 -1
- package/en/configure/app/tools/html-plugin.mdx +1 -1
- package/en/configure/app/tools/inspector.mdx +1 -1
- package/en/configure/app/tools/less.mdx +1 -1
- package/en/configure/app/tools/minify-css.mdx +1 -1
- package/en/configure/app/tools/postcss.mdx +1 -1
- package/en/configure/app/tools/pug.mdx +1 -1
- package/en/configure/app/tools/rspack.mdx +1 -1
- package/en/configure/app/tools/sass.mdx +1 -1
- package/en/configure/app/tools/style-loader.mdx +1 -1
- package/en/configure/app/tools/styled-components.mdx +1 -1
- package/en/configure/app/tools/terser.mdx +1 -1
- package/en/configure/app/tools/ts-checker.mdx +1 -1
- package/en/configure/app/tools/ts-loader.mdx +1 -1
- package/en/configure/app/tools/webpack-chain.mdx +1 -1
- package/en/configure/app/tools/webpack.mdx +1 -1
- package/modern.config.ts +157 -0
- package/package.json +16 -7
- package/src/components/ContentCard/index.module.scss +61 -0
- package/src/components/ContentCard/index.tsx +25 -0
- package/src/components/FeatureLayout/index.module.css +8 -0
- package/src/components/FeatureLayout/index.tsx +8 -0
- package/src/components/Footer/index.tsx +131 -0
- package/src/components/Footer/styles.module.scss +49 -0
- package/src/components/ListCard/index.module.css +58 -0
- package/src/components/ListCard/index.tsx +26 -0
- package/src/components/SecondaryTitle/index.module.css +14 -0
- package/src/components/SecondaryTitle/index.tsx +15 -0
- package/src/global.d.ts +28 -0
- package/src/i18n/enUS.ts +50 -0
- package/src/i18n/index.ts +18 -0
- package/src/i18n/zhCN.ts +50 -0
- package/src/index.ts +9 -0
- package/src/pages/index.module.scss +238 -0
- package/src/pages/index.tsx +162 -0
- package/static/img/favicon.ico +0 -0
- package/static/img/features/ai.svg +1 -0
- package/static/img/features/api.svg +1 -0
- package/static/img/features/app.svg +1 -0
- package/static/img/features/blocks.svg +1 -0
- package/static/img/features/browser.svg +12 -0
- package/static/img/features/cloud.svg +1 -0
- package/static/img/features/coding-backend.svg +1 -0
- package/static/img/features/compiler.svg +1 -0
- package/static/img/features/css-file.svg +1 -0
- package/static/img/features/customize.svg +1 -0
- package/static/img/features/developer.svg +1 -0
- package/static/img/features/dynamic.svg +1 -0
- package/static/img/features/editor.svg +1 -0
- package/static/img/features/framework-config.svg +1 -0
- package/static/img/features/framework.svg +1 -0
- package/static/img/features/frameworks.svg +1 -0
- package/static/img/features/html.svg +1 -0
- package/static/img/features/icon2.svg +1 -0
- package/static/img/features/javascript.svg +1 -0
- package/static/img/features/monorepo.svg +1 -0
- package/static/img/features/product.svg +1 -0
- package/static/img/features/server-network.svg +1 -0
- package/static/img/features/serverless.svg +1 -0
- package/static/img/features/test.svg +1 -0
- package/static/img/features/trinity.svg +1 -0
- package/static/img/features/unity.svg +1 -0
- package/static/img/features/url.svg +1 -0
- package/static/img/features/visual.svg +1 -0
- package/static/img/features/web-server.svg +1 -0
- package/zh/configure/app/dev/asset-prefix.mdx +1 -1
- package/zh/configure/app/dev/before-start-url.mdx +1 -1
- package/zh/configure/app/dev/hmr.mdx +1 -1
- package/zh/configure/app/dev/host.mdx +1 -1
- package/zh/configure/app/dev/https.mdx +1 -1
- package/zh/configure/app/dev/port.mdx +1 -1
- package/zh/configure/app/dev/progress-bar.mdx +1 -1
- package/zh/configure/app/dev/start-url.mdx +1 -1
- package/zh/configure/app/experiments/lazy-compilation.mdx +1 -1
- package/zh/configure/app/html/app-icon.mdx +1 -1
- package/zh/configure/app/html/crossorigin.mdx +1 -1
- package/zh/configure/app/html/disable-html-folder.mdx +1 -1
- package/zh/configure/app/html/favicon-by-entries.mdx +1 -1
- package/zh/configure/app/html/favicon.mdx +1 -1
- package/zh/configure/app/html/inject-by-entries.mdx +1 -1
- package/zh/configure/app/html/inject.mdx +1 -1
- package/zh/configure/app/html/meta-by-entries.mdx +1 -1
- package/zh/configure/app/html/meta.mdx +1 -1
- package/zh/configure/app/html/mount-id.mdx +1 -1
- package/zh/configure/app/html/tags-by-entries.mdx +1 -1
- package/zh/configure/app/html/tags.mdx +1 -1
- package/zh/configure/app/html/template-by-entries.mdx +1 -1
- package/zh/configure/app/html/template-parameters-by-entries.mdx +1 -1
- package/zh/configure/app/html/template-parameters.mdx +1 -1
- package/zh/configure/app/html/template.mdx +1 -1
- package/zh/configure/app/html/title-by-entries.mdx +1 -1
- package/zh/configure/app/html/title.mdx +1 -1
- package/zh/configure/app/output/asset-prefix.mdx +1 -1
- package/zh/configure/app/output/assets-retry.mdx +1 -1
- package/zh/configure/app/output/charset.mdx +1 -1
- package/zh/configure/app/output/clean-dist-path.mdx +1 -1
- package/zh/configure/app/output/convert-to-rem.mdx +1 -1
- package/zh/configure/app/output/copy.mdx +1 -1
- package/zh/configure/app/output/css-module-local-ident-name.mdx +1 -1
- package/zh/configure/app/output/data-uri-limit.mdx +1 -1
- package/zh/configure/app/output/disable-css-extract.mdx +1 -1
- package/zh/configure/app/output/disable-css-module-extension.mdx +1 -1
- package/zh/configure/app/output/disable-filename-hash.mdx +1 -1
- package/zh/configure/app/output/disable-inline-runtime-chunk.mdx +1 -1
- package/zh/configure/app/output/disable-minimize.mdx +1 -1
- package/zh/configure/app/output/disable-source-map.mdx +1 -1
- package/zh/configure/app/output/disable-ts-checker.mdx +1 -1
- package/zh/configure/app/output/dist-path.mdx +1 -1
- package/zh/configure/app/output/enable-asset-fallback.mdx +1 -1
- package/zh/configure/app/output/enable-asset-manifest.mdx +1 -1
- package/zh/configure/app/output/enable-css-module-tsdeclaration.mdx +1 -1
- package/zh/configure/app/output/enable-inline-scripts.mdx +1 -1
- package/zh/configure/app/output/enable-inline-styles.mdx +1 -1
- package/zh/configure/app/output/enable-latest-decorators.mdx +1 -1
- package/zh/configure/app/output/externals.mdx +1 -1
- package/zh/configure/app/output/filename.mdx +1 -1
- package/zh/configure/app/output/legal-comments.mdx +1 -1
- package/zh/configure/app/output/override-browserslist.mdx +1 -1
- package/zh/configure/app/output/polyfill.mdx +1 -1
- package/zh/configure/app/output/svg-default-export.mdx +1 -1
- package/zh/configure/app/performance/build-cache.mdx +1 -1
- package/zh/configure/app/performance/bundle-analyze.mdx +1 -1
- package/zh/configure/app/performance/chunk-split.mdx +1 -1
- package/zh/configure/app/performance/print-file-size.mdx +1 -1
- package/zh/configure/app/performance/profile.mdx +1 -1
- package/zh/configure/app/performance/remove-console.mdx +1 -1
- package/zh/configure/app/performance/remove-moment-locale.mdx +1 -1
- package/zh/configure/app/security/check-syntax.mdx +1 -1
- package/zh/configure/app/security/sri.mdx +1 -1
- package/zh/configure/app/source/alias.mdx +1 -1
- package/zh/configure/app/source/compile-js-data-uri.mdx +1 -1
- package/zh/configure/app/source/define.mdx +1 -1
- package/zh/configure/app/source/exclude.mdx +1 -1
- package/zh/configure/app/source/global-vars.mdx +1 -1
- package/zh/configure/app/source/include.mdx +1 -1
- package/zh/configure/app/source/module-scopes.mdx +1 -1
- package/zh/configure/app/source/pre-entry.mdx +1 -1
- package/zh/configure/app/source/resolve-extension-prefix.mdx +1 -1
- package/zh/configure/app/source/resolve-main-fields.mdx +1 -1
- package/zh/configure/app/tools/autoprefixer.mdx +1 -1
- package/zh/configure/app/tools/babel.mdx +1 -1
- package/zh/configure/app/tools/css-extract.mdx +1 -1
- package/zh/configure/app/tools/css-loader.mdx +1 -1
- package/zh/configure/app/tools/dev-server.mdx +1 -1
- package/zh/configure/app/tools/html-plugin.mdx +1 -1
- package/zh/configure/app/tools/inspector.mdx +1 -1
- package/zh/configure/app/tools/less.mdx +1 -1
- package/zh/configure/app/tools/minify-css.mdx +1 -1
- package/zh/configure/app/tools/postcss.mdx +1 -1
- package/zh/configure/app/tools/pug.mdx +1 -1
- package/zh/configure/app/tools/rspack.mdx +1 -1
- package/zh/configure/app/tools/sass.mdx +1 -1
- package/zh/configure/app/tools/style-loader.mdx +1 -1
- package/zh/configure/app/tools/styled-components.mdx +1 -1
- package/zh/configure/app/tools/terser.mdx +1 -1
- package/zh/configure/app/tools/ts-checker.mdx +1 -1
- package/zh/configure/app/tools/ts-loader.mdx +1 -1
- package/zh/configure/app/tools/webpack-chain.mdx +1 -1
- package/zh/configure/app/tools/webpack.mdx +1 -1
- package/.eslintrc.js +0 -12
- package/.turbo/turbo-build.log +0 -4
- package/en/apis/app/commands.mdx +0 -297
- package/en/apis/app/hooks/api/framework/lambda.mdx +0 -57
- package/en/apis/app/hooks/api/functions/api.mdx +0 -81
- package/en/apis/app/hooks/src/routes.mdx +0 -90
- package/en/apis/app/hooks/src/server.mdx +0 -34
- package/en/apis/app/runtime/model/connect.mdx +0 -145
- package/en/apis/app/runtime/model/model_.mdx +0 -199
- package/en/apis/app/runtime/model/use-model.mdx +0 -89
- package/en/apis/app/runtime/router/router.mdx +0 -262
- package/en/apis/app/runtime/web-server/hook.mdx +0 -133
- package/en/apis/app/runtime/web-server/middleware.mdx +0 -110
- package/en/components/enable-bff.mdx +0 -31
- package/en/components/init-app.mdx +0 -43
- package/en/components/prerequisites.mdx +0 -20
- package/en/configure/app/output/ssg.mdx +0 -196
- package/en/configure/app/server/enable-framework-ext.mdx +0 -49
- package/en/configure/app/server/public-routes.mdx +0 -26
- package/en/configure/app/server/ssr.mdx +0 -38
- package/en/configure/app/source/design-system.mdx +0 -1175
- package/en/configure/app/source/disable-entry-dirs.mdx +0 -39
- package/en/configure/app/source/entries.mdx +0 -123
- package/en/guides/advanced-features/bff/_category_.json +0 -8
- package/en/guides/advanced-features/code-split.mdx +0 -80
- package/en/guides/advanced-features/compatibility.mdx +0 -78
- package/en/guides/advanced-features/eslint.mdx +0 -150
- package/en/guides/advanced-features/low-level.mdx +0 -45
- package/en/guides/advanced-features/rspack-start.mdx +0 -69
- package/en/guides/advanced-features/ssg.mdx +0 -116
- package/en/guides/advanced-features/ssr.mdx +0 -513
- package/en/guides/advanced-features/testing.mdx +0 -46
- package/en/guides/advanced-features/web-server.mdx +0 -57
- package/en/guides/basic-features/data-fetch.mdx +0 -404
- package/en/guides/basic-features/env-vars.mdx +0 -174
- package/en/guides/basic-features/html.mdx +0 -247
- package/en/guides/basic-features/proxy.mdx +0 -61
- package/en/guides/concept/builder.mdx +0 -47
- package/en/guides/get-started/introduction.mdx +0 -34
- package/en/guides/get-started/quick-start.mdx +0 -162
- package/en/guides/topic-detail/framework-plugin/hook-list.mdx +0 -828
- package/en/guides/topic-detail/framework-plugin/plugin-api.mdx +0 -117
- package/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
- package/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
- package/en/guides/topic-detail/generator/config/app.mdx +0 -82
- package/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
- package/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
- package/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
- package/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
- package/en/guides/topic-detail/generator/project.mdx +0 -118
- package/en/guides/topic-detail/micro-frontend/c02-development.mdx +0 -256
- package/en/guides/topic-detail/micro-frontend/c03-main-app.mdx +0 -276
- package/en/guides/topic-detail/model/faq.mdx +0 -41
- package/en/guides/topic-detail/model/manage-effects.mdx +0 -260
- package/en/guides/topic-detail/model/model-communicate.mdx +0 -220
- package/en/guides/topic-detail/model/performance.mdx +0 -171
- package/en/guides/topic-detail/model/quick-start.mdx +0 -113
- package/en/guides/topic-detail/model/use-model.mdx +0 -252
- package/en/guides/troubleshooting/cli.mdx +0 -63
- package/en/tutorials/first-app/c03-css.mdx +0 -323
- package/scripts/config.ts +0 -96
- package/scripts/summary.en.json +0 -1
- package/scripts/summary.zh.json +0 -1
- package/scripts/sync.ts +0 -57
- package/tsconfig.json +0 -7
- package/zh/apis/app/commands.mdx +0 -299
- package/zh/apis/app/runtime/model/connect.mdx +0 -143
- package/zh/apis/app/runtime/model/model_.mdx +0 -199
- package/zh/apis/app/runtime/model/use-model.mdx +0 -89
- package/zh/apis/app/runtime/web-server/hook.mdx +0 -134
- package/zh/apis/app/runtime/web-server/middleware.mdx +0 -111
- package/zh/apis/monorepo/commands/gen-release-note.mdx +0 -32
- package/zh/apis/monorepo/commands/new.mdx +0 -39
- package/zh/components/default-mwa-generate.mdx +0 -5
- package/zh/components/enable-bff.mdx +0 -31
- package/zh/components/init-app.mdx +0 -44
- package/zh/components/prerequisites.mdx +0 -20
- package/zh/components/release-note.mdx +0 -1
- package/zh/configure/app/server/enable-framework-ext.mdx +0 -49
- package/zh/guides/advanced-features/bff/_category_.json +0 -8
- package/zh/guides/advanced-features/rspack-start.mdx +0 -69
- package/zh/guides/advanced-features/ssr.mdx +0 -501
- package/zh/guides/advanced-features/web-server.mdx +0 -57
- package/zh/guides/basic-features/mock.mdx +0 -99
- package/zh/guides/concept/builder.mdx +0 -47
- package/zh/guides/get-started/introduction.mdx +0 -31
- package/zh/guides/topic-detail/changesets/changelog.mdx +0 -238
- package/zh/guides/topic-detail/changesets/commit.mdx +0 -271
- package/zh/guides/topic-detail/changesets/github.mdx +0 -164
- package/zh/guides/topic-detail/changesets/release-note.mdx +0 -259
- package/zh/guides/topic-detail/framework-plugin/extend.mdx +0 -163
- package/zh/guides/topic-detail/framework-plugin/hook.mdx +0 -173
- package/zh/guides/topic-detail/framework-plugin/implement.mdx +0 -248
- package/zh/guides/topic-detail/framework-plugin/introduction.mdx +0 -51
- package/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +0 -117
- package/zh/guides/topic-detail/framework-plugin/relationship.mdx +0 -119
- package/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
- package/zh/guides/topic-detail/micro-frontend/c01-introduction.mdx +0 -29
- package/zh/guides/topic-detail/micro-frontend/c04-communicate.mdx +0 -57
- package/zh/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +0 -26
- package/zh/guides/topic-detail/model/auto-actions.mdx +0 -92
- package/zh/guides/topic-detail/model/computed-state.mdx +0 -151
- package/zh/guides/topic-detail/model/define-model.mdx +0 -66
- package/zh/guides/topic-detail/model/faq.mdx +0 -41
- package/zh/guides/topic-detail/model/manage-effects.mdx +0 -260
- package/zh/guides/topic-detail/model/model-communicate.mdx +0 -220
- package/zh/guides/topic-detail/model/performance.mdx +0 -171
- package/zh/guides/topic-detail/model/quick-start.mdx +0 -113
- package/zh/guides/topic-detail/model/redux-integration.mdx +0 -24
- package/zh/guides/topic-detail/model/test-model.mdx +0 -45
- package/zh/guides/topic-detail/model/typescript-best-practice.mdx +0 -71
- package/zh/guides/topic-detail/model/use-model.mdx +0 -252
- package/zh/guides/topic-detail/model/use-out-of-modernjs.mdx +0 -50
- package/zh/guides/topic-detail/monorepo/create-sub-project.mdx +0 -67
- package/zh/guides/topic-detail/monorepo/sub-project-interface.mdx +0 -179
- package/zh/index.md +0 -4
- /package/{en → docs/en}/apis/app/hooks/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/framework/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/functions/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/functions/app.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/functions/common.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/api/test.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/html.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/icon.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/mock.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/public.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/storybook.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/config/upload.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/modern-config.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/server/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/server/index_.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/server/test.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/shared.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/app.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/index_.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/pages.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/stories.mdx +0 -0
- /package/{en → docs/en}/apis/app/hooks/src/test.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/app/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/app/define-config.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/bff/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/bff/hook.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/bff/use-context.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/bootstrap.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/create-app.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/use-loader.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/use-module-apps.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/core/use-runtime-context.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/Provider.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/auto-actions.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/create-app.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/create-store.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/handle-effect.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/use-local-model.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/use-static-model.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/model/use-store.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/router/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/ssr/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/ssr/no-ssr.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/ssr/pre-render.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/testing/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/testing/act.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/testing/cleanup.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/testing/render.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/testing/renderApp.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/utility/_category_.json +0 -0
- /package/{en → docs/en}/apis/app/runtime/utility/css-in-js.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/utility/head.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/utility/loadable.mdx +0 -0
- /package/{en → docs/en}/apis/app/runtime/web-server/_category_.json +0 -0
- /package/{en → docs/en}/components/debug-app.mdx +0 -0
- /package/{en → docs/en}/components/enable-micro-frontend.mdx +0 -0
- /package/{en → docs/en}/components/global-proxy-config.mdx +0 -0
- /package/{en → docs/en}/components/global-proxy.mdx +0 -0
- /package/{en → docs/en}/components/micro-master-manifest-config.mdx +0 -0
- /package/{en → docs/en}/components/micro-runtime-config.mdx +0 -0
- /package/{en → docs/en}/components/reduck-migration.mdx +0 -0
- /package/{en → docs/en}/components/reduck-tip.mdx +0 -0
- /package/{en → docs/en}/components/router-legacy-tip.mdx +0 -0
- /package/{en → docs/en}/configure/app/auto-load-plugin.mdx +0 -0
- /package/{en → docs/en}/configure/app/bff/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/bff/prefix.mdx +0 -0
- /package/{en → docs/en}/configure/app/bff/proxy.mdx +0 -0
- /package/{en → docs/en}/configure/app/builder-plugins.mdx +0 -0
- /package/{en → docs/en}/configure/app/deploy/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/deploy/microFrontend.mdx +0 -0
- /package/{en → docs/en}/configure/app/dev/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/dev/proxy.mdx +0 -0
- /package/{en → docs/en}/configure/app/experiments/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/html/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/output/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/output/disable-node-polyfill.mdx +0 -0
- /package/{en → docs/en}/configure/app/performance/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/plugins.mdx +0 -0
- /package/{en → docs/en}/configure/app/runtime/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/runtime/intro.mdx +0 -0
- /package/{en → docs/en}/configure/app/runtime/master-app.mdx +0 -0
- /package/{en → docs/en}/configure/app/runtime/router.mdx +0 -0
- /package/{en → docs/en}/configure/app/runtime/state.mdx +0 -0
- /package/{en → docs/en}/configure/app/security/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/server/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/server/base-url.mdx +0 -0
- /package/{en → docs/en}/configure/app/server/port.mdx +0 -0
- /package/{en → docs/en}/configure/app/server/routes.mdx +0 -0
- /package/{en → docs/en}/configure/app/server/ssr-by-entries.mdx +0 -0
- /package/{en → docs/en}/configure/app/source/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/source/config-dir.mdx +0 -0
- /package/{en → docs/en}/configure/app/source/disable-default-entries.mdx +0 -0
- /package/{en → docs/en}/configure/app/source/enable-async-entry.mdx +0 -0
- /package/{en → docs/en}/configure/app/source/entries-dir.mdx +0 -0
- /package/{en → docs/en}/configure/app/testing/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/testing/transformer.mdx +0 -0
- /package/{en → docs/en}/configure/app/tools/_category_.json +0 -0
- /package/{en → docs/en}/configure/app/tools/esbuild.mdx +0 -0
- /package/{en → docs/en}/configure/app/tools/jest.mdx +0 -0
- /package/{en → docs/en}/configure/app/tools/swc.mdx +0 -0
- /package/{en → docs/en}/configure/app/tools/tailwindcss.mdx +0 -0
- /package/{en → docs/en}/configure/app/usage.mdx +0 -0
- /package/{en → docs/en}/guides/advanced-features/_category_.json +0 -0
- /package/{en → docs/en}/guides/advanced-features/bff/bff-proxy.mdx +0 -0
- /package/{en → docs/en}/guides/advanced-features/bff/frameworks.mdx +0 -0
- /package/{en → docs/en}/guides/advanced-features/bff/function.mdx +0 -0
- /package/{en → docs/en}/guides/advanced-features/bff/index.mdx +0 -0
- /package/{en → docs/en}/guides/advanced-features/bff/type.mdx +0 -0
- /package/{en → docs/en}/guides/basic-features/_category_.json +0 -0
- /package/{en → docs/en}/guides/basic-features/alias.mdx +0 -0
- /package/{en → docs/en}/guides/basic-features/css.mdx +0 -0
- /package/{en → docs/en}/guides/basic-features/mock.mdx +0 -0
- /package/{en → docs/en}/guides/basic-features/routes.mdx +0 -0
- /package/{en → docs/en}/guides/concept/_category_.json +0 -0
- /package/{en → docs/en}/guides/concept/entries.mdx +0 -0
- /package/{en → docs/en}/guides/get-started/_category_.json +0 -0
- /package/{en → docs/en}/guides/get-started/upgrade.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/framework-plugin/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/framework-plugin/lifecycle.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/app.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/git.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/api/json.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/introduce.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/codesmith/structure.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/config/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/config/common.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/config/module.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/config/monorepo.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/abstract.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/generator/plugin/use.mdx +0 -0
- /package/{en → docs/en}/guides/topic-detail/micro-frontend/_category_.json +0 -0
- /package/{en → docs/en}/guides/topic-detail/model/_category_.json +0 -0
- /package/{en → docs/en}/guides/troubleshooting/_category_.json +0 -0
- /package/{en → docs/en}/index.md +0 -0
- /package/{en → docs/en}/tutorials/first-app/_category_.json +0 -0
- /package/{en → docs/en}/tutorials/first-app/c01-start.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c02-component.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c04-routes.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c05-loader.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c06-model.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c07-container.mdx +0 -0
- /package/{en → docs/en}/tutorials/first-app/c08-entries.mdx +0 -0
- /package/{en → docs/en}/tutorials/foundations/_category_.json +0 -0
- /package/{en → docs/en}/tutorials/foundations/introduction.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/framework/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/framework/lambda.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/functions/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/functions/api.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/functions/app.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/functions/common.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/api/test.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/html.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/icon.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/mock.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/public.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/storybook.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/config/upload.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/modern-config.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/server/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/server/index_.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/server/test.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/shared.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/app.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/index_.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/pages.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/routes.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/server.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/stories.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/hooks/src/test.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/app/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/app/define-config.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/bff/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/bff/hook.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/bff/use-context.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/bootstrap.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/create-app.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/use-loader.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/use-module-apps.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/core/use-runtime-context.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/Provider.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/auto-actions.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/create-app.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/create-store.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/handle-effect.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/use-local-model.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/use-static-model.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/model/use-store.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/router/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/router/router.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/ssr/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/ssr/no-ssr.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/ssr/pre-render.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/testing/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/testing/act.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/testing/cleanup.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/testing/render.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/testing/renderApp.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/utility/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/utility/css-in-js.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/utility/head.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/utility/loadable.mdx +0 -0
- /package/{zh → docs/zh}/apis/app/runtime/web-server/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/bump.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/change.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/clear.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/deploy.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/index.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/lint.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/pre.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/release.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/commands/upgrade.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/_category_.json +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/apps.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/code-workspace.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/examples.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/features.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/index.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/packages.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/pnpm-workspace.mdx +0 -0
- /package/{zh → docs/zh}/apis/monorepo/hooks/pnpmfile.mdx +0 -0
- /package/{zh → docs/zh}/blog/index.md +0 -0
- /package/{zh → docs/zh}/community/index.mdx +0 -0
- /package/{zh → docs/zh}/components/custom-router-micro-frontend.mdx +0 -0
- /package/{zh → docs/zh}/components/debug-app.mdx +0 -0
- /package/{zh → docs/zh}/components/deploy.mdx +0 -0
- /package/{zh → docs/zh}/components/enable-micro-frontend.mdx +0 -0
- /package/{zh → docs/zh}/components/global-proxy-config.mdx +0 -0
- /package/{zh → docs/zh}/components/global-proxy.mdx +0 -0
- /package/{zh → docs/zh}/components/micro-master-manifest-config.mdx +0 -0
- /package/{zh → docs/zh}/components/micro-runtime-config.mdx +0 -0
- /package/{zh → docs/zh}/components/reduck-migration.mdx +0 -0
- /package/{zh → docs/zh}/components/reduck-tip.mdx +0 -0
- /package/{zh → docs/zh}/components/router-legacy-tip.mdx +0 -0
- /package/{zh → docs/zh}/components/self-route-example.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/auto-load-plugin.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/bff/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/bff/prefix.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/bff/proxy.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/builder-plugins.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/deploy/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/deploy/microFrontend.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/dev/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/dev/proxy.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/experiments/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/html/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/output/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/output/disable-node-polyfill.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/output/ssg.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/performance/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/plugins.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/runtime/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/runtime/intro.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/runtime/master-app.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/runtime/router.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/runtime/state.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/security/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/server/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/server/base-url.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/server/port.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/server/public-routes.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/server/routes.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/server/ssr-by-entries.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/server/ssr.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/source/config-dir.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/design-system.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/disable-default-entries.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/disable-entry-dirs.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/enable-async-entry.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/entries-dir.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/source/entries.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/testing/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/testing/transformer.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/tools/_category_.json +0 -0
- /package/{zh → docs/zh}/configure/app/tools/esbuild.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/tools/jest.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/tools/swc.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/tools/tailwindcss.mdx +0 -0
- /package/{zh → docs/zh}/configure/app/usage.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/bff/bff-proxy.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/bff/frameworks.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/bff/function.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/bff/index.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/bff/type.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/code-split.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/compatibility.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/eslint.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/low-level.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/ssg.mdx +0 -0
- /package/{zh → docs/zh}/guides/advanced-features/testing.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/basic-features/alias.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/css.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/data-fetch.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/env-vars.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/html.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/proxy.mdx +0 -0
- /package/{zh → docs/zh}/guides/basic-features/routes.mdx +0 -0
- /package/{zh → docs/zh}/guides/concept/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/concept/entries.mdx +0 -0
- /package/{zh → docs/zh}/guides/get-started/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/get-started/quick-start.mdx +0 -0
- /package/{zh → docs/zh}/guides/get-started/upgrade.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/add.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/config.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/introduce.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/release-pre.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/changesets/release.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/framework-plugin/_category_.json +0 -0
- /package/{en → docs/zh}/guides/topic-detail/framework-plugin/extend.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/framework-plugin/hook-list.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/framework-plugin/hook.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/framework-plugin/implement.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/framework-plugin/introduction.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/framework-plugin/lifecycle.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/framework-plugin/relationship.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/app.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/git.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/json.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/develop.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/introduce.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/codesmith/structure.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/config/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/config/app.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/config/common.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/config/module.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/config/monorepo.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/abstract.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/plugin/use.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/generator/project.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/micro-frontend/_category_.json +0 -0
- /package/{en → docs/zh}/guides/topic-detail/micro-frontend/c01-introduction.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/micro-frontend/c02-development.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/micro-frontend/c03-main-app.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/micro-frontend/c04-communicate.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/micro-frontend/c05-mixed-stack.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/model/_category_.json +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/auto-actions.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/computed-state.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/define-model.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/redux-integration.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/test-model.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/typescript-best-practice.mdx +0 -0
- /package/{en → docs/zh}/guides/topic-detail/model/use-out-of-modernjs.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/monorepo/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/monorepo/intro.mdx +0 -0
- /package/{zh → docs/zh}/guides/topic-detail/monorepo/publish.mdx +0 -0
- /package/{zh → docs/zh}/guides/troubleshooting/_category_.json +0 -0
- /package/{zh → docs/zh}/guides/troubleshooting/cli.mdx +0 -0
- /package/{zh → docs/zh}/guides/troubleshooting/dependencies.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/_category_.json +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c01-start.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c02-component.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c03-css.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c04-routes.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c05-loader.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c06-model.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c07-container.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/first-app/c08-entries.mdx +0 -0
- /package/{zh → docs/zh}/tutorials/foundations/_category_.json +0 -0
- /package/{zh → docs/zh}/tutorials/foundations/introduction.mdx +0 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
title: 使用 Rspack
|
3
|
+
sidebar_position: 1
|
4
|
+
---
|
5
|
+
|
6
|
+
# 使用 Rspack
|
7
|
+
|
8
|
+
import Rspack from '@modern-js/builder-doc/docs/zh/shared/rspack.md';
|
9
|
+
|
10
|
+
<Rspack />
|
11
|
+
|
12
|
+
**Modern.js 提供开箱即用的 Rspack 支持**,你可以在成熟的 Webpack 和更快的 Rspack 之间进行切换。
|
13
|
+
|
14
|
+
这篇文档会向你介绍如何在 Modern.js 中开启 Rspack 构建模式。
|
15
|
+
|
16
|
+
## 初始化 Rspack 项目
|
17
|
+
|
18
|
+
Modern.js 生成器会提供一个可交互的问答界面,只需将构建工具选择为 **Rspack**,即可创建一个 Rspack 项目:
|
19
|
+
|
20
|
+
import InitRspackApp from '@site-docs/components/init-rspack-app';
|
21
|
+
|
22
|
+
<InitRspackApp />
|
23
|
+
|
24
|
+
项目创建完成后,在项目中执行 `pnpm run dev` 即可体验项目,更多信息可参考[快速上手](/guides/get-started/quick-start.html)。
|
25
|
+
|
26
|
+
:::tip
|
27
|
+
在使用 Rspack 作为打包工具时,由于部分能力尚在开发中,以下 features 暂时无法使用,我们将在未来提供支持:
|
28
|
+
|
29
|
+
- 微前端(Micro Frontend)
|
30
|
+
- Storybook 调试
|
31
|
+
- 同时使用服务端渲染(SSR)和约定式路由的场景
|
32
|
+
- 同时使用静态站点生成(SSG)和约定式路由的场景
|
33
|
+
|
34
|
+
:::
|
35
|
+
|
36
|
+
## 从 webpack 迁移至 Rspack
|
37
|
+
|
38
|
+
在一个已有的 Modern.js 项目中,你可以通过执行 `pnpm run new` 来启用 Rspack 构建:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ pnpm run new
|
42
|
+
? 请选择你想要的操作:启用可选功能
|
43
|
+
? 启用可选功能:启用「Rspack 构建」
|
44
|
+
```
|
45
|
+
|
46
|
+
执行以上命令后,在 `modern.config.ts` 中添加 Rspack 相关配置即可:
|
47
|
+
|
48
|
+
```diff title=modern.config.ts
|
49
|
+
import appTools, { defineConfig } from '@modern-js/app-tools';
|
50
|
+
|
51
|
+
+ export default defineConfig<'rspack'>({
|
52
|
+
plugins: [
|
53
|
+
appTools({
|
54
|
+
+ bundler: 'experimental-rspack',
|
55
|
+
}),
|
56
|
+
],
|
57
|
+
});
|
58
|
+
```
|
59
|
+
|
60
|
+
:::tip
|
61
|
+
从 webpack 迁移至 Rspack 时,存在一些构建能力和配置上的差异,详情可参考:[配置差异](https://modernjs.dev/builder/guide/advanced/rspack-start.html#从-webpack-迁移到-rspack)
|
62
|
+
:::
|
@@ -0,0 +1,507 @@
|
|
1
|
+
---
|
2
|
+
title: 服务端渲染(SSR)
|
3
|
+
sidebar_position: 3
|
4
|
+
---
|
5
|
+
# 服务端渲染(SSR)
|
6
|
+
|
7
|
+
在 Modern.js 中,SSR 也是开箱即用的。开发者无需为 SSR 编写复杂的服务端逻辑,也无需关心 SSR 的运维,或是创建单独的服务。Modern.js 拥有完备的 SSR 降级策略,保证页面能够安全运行。
|
8
|
+
|
9
|
+
启用 SSR 非常简单,只需要设置 [`server.ssr`](/configure/app/server/ssr) 为 `true` 即可:
|
10
|
+
|
11
|
+
```ts title="modern.config.ts"
|
12
|
+
import { defineConfig } from '@modern-js/app-tools';
|
13
|
+
|
14
|
+
export default defineConfig({
|
15
|
+
"server": {
|
16
|
+
"ssr": true,
|
17
|
+
},
|
18
|
+
})
|
19
|
+
```
|
20
|
+
|
21
|
+
## SSR 时的数据获取
|
22
|
+
|
23
|
+
Modern.js 中提供了 Data Loader,方便开发者在 SSR、CSR 下同构的获取数据。每个路由模块,如 `layout.tsx` 和 `page.tsx` 都可以定义自己的 Data Loader:
|
24
|
+
|
25
|
+
```ts title="src/routes/page.loader.ts"
|
26
|
+
export default () => {
|
27
|
+
return {
|
28
|
+
message: 'Hello World',
|
29
|
+
};
|
30
|
+
};
|
31
|
+
```
|
32
|
+
|
33
|
+
在组件中可以通过 Hooks API 的方式获取 `loader` 函数返回的数据:
|
34
|
+
|
35
|
+
```tsx
|
36
|
+
import { useLoaderData } from '@modern-js/runtime/router'
|
37
|
+
export default () => {
|
38
|
+
const data = useLoaderData();
|
39
|
+
return <div>{data.message}</div>;
|
40
|
+
};
|
41
|
+
```
|
42
|
+
|
43
|
+
Modern.js 打破传统的 SSR 开发模式,提供了用户无感的 SSR 开发体验。并且提供了优雅的降级处理,一旦 SSR 请求失败,会自动降级在浏览器端重新发起请求。
|
44
|
+
|
45
|
+
不过,开发者仍然需要关注数据的兜底处理,例如 `null` 值或不符合预期的数据返回。避免在 SSR 时产生 React 渲染错误或是返回凌乱的渲染结果。
|
46
|
+
|
47
|
+
:::info 补充信息
|
48
|
+
1. 当以客户端路由的方式请求页面时,Modern.js 会发送一个 HTTP 请求,服务端接收到请求后执行页面对应的 Data Loader 函数,然后将执行结果作为请求的响应返回浏览器。
|
49
|
+
|
50
|
+
2. 使用 Data Loader 时,数据获取发生在渲染前,Modern.js 也仍然支持在组件渲染时获取数据。更多相关内容可以查看[数据获取](/guides/basic-features/data-fetch)。
|
51
|
+
:::
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
## 保持渲染一致
|
56
|
+
|
57
|
+
有些业务中,通常需要根据当前的运行容器环境特征做不同的 UI 展示,例如 [UA](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) 信息。如果处理不够仔细,此时很有可能出现不符合预期的渲染结果。
|
58
|
+
|
59
|
+
这里通过一个例子,演示当 SSR 与 CSR 渲染不一致时出现的问题,在组件中添加以下代码:
|
60
|
+
|
61
|
+
```tsx
|
62
|
+
{
|
63
|
+
typeof window !== 'undefined' ? <div>browser content</div> : null;
|
64
|
+
}
|
65
|
+
```
|
66
|
+
|
67
|
+
启动应用后,访问页面,会发现浏览器控制台抛出警告信息:
|
68
|
+
|
69
|
+
```sh
|
70
|
+
Warning: Expected server HTML to contain a matching <div> in <div>.
|
71
|
+
```
|
72
|
+
|
73
|
+
这是 React 在客户端执行 hydrate 逻辑时,发现渲染结果与 SSR 渲染结果不一致造成的。虽然页面表现正常,但在复杂应用中,很有可能因此出现 DOM 层级混乱、样式混乱等问题。
|
74
|
+
|
75
|
+
:::info
|
76
|
+
关于 hydrate (注水)逻辑请参考[这里](https://reactjs.org/docs/react-dom.html#hydrate)。
|
77
|
+
|
78
|
+
:::
|
79
|
+
|
80
|
+
应用需要保持 SSR 与 CSR 渲染结果的一致性,如果存在不一致的情况,说明这部分内容无需在 SSR 中进行渲染。Modern.js 为这类在 SSR 中不需要渲染的内容提供 [`<NoSSR>` 工具组件](/apis/app/runtime/core/use-runtime-context):
|
81
|
+
|
82
|
+
```ts
|
83
|
+
import { NoSSR } from '@modern-js/runtime/ssr';
|
84
|
+
```
|
85
|
+
|
86
|
+
在不需要进行 SSR 的元素外部,用 `NoSSR` 组件包裹:
|
87
|
+
|
88
|
+
```tsx
|
89
|
+
<NoSSR>
|
90
|
+
<div>client content</div>
|
91
|
+
</NoSSR>
|
92
|
+
```
|
93
|
+
|
94
|
+
修改代码后,刷新页发现之前的 Waring 消失。打开浏览器开发者工具的 Network 窗口,查看返回的 HTML 文档是不包含 `NoSSR` 组件包裹的内容的。
|
95
|
+
|
96
|
+
:::info 补充信息
|
97
|
+
[`useRuntimeContext`](/apis/app/runtime/core/use-runtime-context) 可以获取完整的请求信息,可以利用它保证 SSR 与 CSR 的渲染结果一致。
|
98
|
+
|
99
|
+
:::
|
100
|
+
|
101
|
+
## 关注内存泄漏
|
102
|
+
|
103
|
+
:::warning 警告
|
104
|
+
在 SSR 场景下,开发者需要特别关注内存泄露问题,即使是微小的内存泄露,在大量的访问后也会对服务造成影响。
|
105
|
+
|
106
|
+
:::
|
107
|
+
|
108
|
+
SSR 时,浏览器的每次请求,都会触发服务端重新执行一次组件渲染逻辑。所以,需要避免在全局定义任何可能不断增长的数据结构,或在全局进行事件订阅,或创建不会被销毁的流。
|
109
|
+
|
110
|
+
例如以下代码,使用 [redux-observable](https://redux-observable.js.org/) 时,习惯了 CSR 的开发者通常会在组件中这样编码:
|
111
|
+
|
112
|
+
```tsx
|
113
|
+
/* 代码仅作为示例,不可运行 */
|
114
|
+
import { createEpicMiddleware, combineEpics } from 'redux-observable';
|
115
|
+
|
116
|
+
const epicMiddleware = createEpicMiddleware();
|
117
|
+
const rootEpic = combineEpics();
|
118
|
+
|
119
|
+
export default function Test() {
|
120
|
+
epicMiddleware.run(rootEpic);
|
121
|
+
return <div>Hello Modern.js</div>;
|
122
|
+
}
|
123
|
+
```
|
124
|
+
|
125
|
+
在组件外层创建 Middleware 实例 `epicMiddleware`,并在组件内部调用 `epicMiddleware.run`。
|
126
|
+
|
127
|
+
在浏览器端,这段代码不会造成任何问题,但是在 SSR 时,Middleware 实例会一直无法被销毁。每次渲染组件,调用 `epicMiddleware.run(rootEpic)` 时,都会在内部添加新的事件绑定,导致整个对象不断变大,最终对应用性能造成影响。
|
128
|
+
|
129
|
+
CSR 中这类问题不易被发觉,因此从 CSR 切换到 SSR 时,如果不确定应用是否存在这类隐患,可以对应用进行压测。
|
130
|
+
|
131
|
+
## 收敛服务端数据
|
132
|
+
|
133
|
+
为了保持 SSR 阶段请求的数据,可以在浏览器端直接使用,Modern.js 会将渲染过程中收集的数据与状态注入到 HTML 内。但是,CSR 应用常常存在接口数据量大、组件状态未收敛的情况,这时如果直接使用 SSR,渲染得到的 HTML 体积可能会存在过大的问题。此时,SSR 不仅无法为应用带来用户体验上的提升,反而可能起到相反的作用。
|
134
|
+
|
135
|
+
因此,使用 SSR 时,**开发者需要为应用做合理的瘦身**:
|
136
|
+
|
137
|
+
1. 关注首屏,SSR 中可以只请求首屏需要的数据,并在浏览器端渲染剩余的部分。
|
138
|
+
2. 将与渲染无关的数据,从接口返回数据中剔除。
|
139
|
+
|
140
|
+
## Serverless Pre-render
|
141
|
+
|
142
|
+
Modern.js 提供 Serverless Pre-rendering (SPR) 这一特性来提升 SSR 性能。
|
143
|
+
|
144
|
+
SPR 利用预渲染与缓存技术,为 SSR 页面提供静态 Web 的响应性能。它让 SSR 应用拥有静态 Web 页面的响应速度与稳定性,同时还能保持数据的动态更新。
|
145
|
+
|
146
|
+
在 Modern.js 中使用 SPR 非常简单,只需要在组件中新增 `PreRender` 组件,该组件所在的页面就会自动开启 SPR。
|
147
|
+
|
148
|
+
这里模拟一个使用 `useLoaderData` API 的组件,Data Loader 中的请求需要消耗 2s 时间。
|
149
|
+
|
150
|
+
```jsx
|
151
|
+
import { useLoaderData } from '@modern-js/runtime/router';
|
152
|
+
|
153
|
+
export const loader = async () => {
|
154
|
+
await new Promise((resolve, reject) => {
|
155
|
+
setTimeout(() => {
|
156
|
+
resolve(null);
|
157
|
+
}, 2000);
|
158
|
+
});
|
159
|
+
|
160
|
+
return {
|
161
|
+
message: 'Hello Modern.js',
|
162
|
+
};
|
163
|
+
};
|
164
|
+
|
165
|
+
export default () => {
|
166
|
+
const data = useLoaderData();
|
167
|
+
return <div>{data?.message}</div>;
|
168
|
+
};
|
169
|
+
```
|
170
|
+
|
171
|
+
执行 `dev` 命令后,打开页面,可以明显的察觉到页面需要等到 2s 后才返回。
|
172
|
+
|
173
|
+
接下来使用 `PreRender` 组件来进行优化,该组件可以直接从 `@modern-js/runtime/ssr` 中导出:
|
174
|
+
|
175
|
+
```ts
|
176
|
+
import { PreRender } from '@modern-js/runtime/ssr';
|
177
|
+
```
|
178
|
+
|
179
|
+
在路由组件内使用 `PreRender` 组件,并设置参数 `interval`,用于表示该次渲染结果的过期时间为 5s:
|
180
|
+
|
181
|
+
```tsx
|
182
|
+
<PreRender interval={5} />
|
183
|
+
```
|
184
|
+
|
185
|
+
修改后,执行 `pnpm run build && pnpm run serve` 启动应用,并打开页面。
|
186
|
+
|
187
|
+
首次打开时,和之前的渲染并没有什么不同,同样存在 2s 延迟。点击刷新,页面瞬间打开,但此时,页面数据并没有因为刷新发生变化,这是因为缓存还没有过期。
|
188
|
+
|
189
|
+
等待 5s,重新刷新页面,页面的数据仍然没有变化。再一次刷新页面数据发生变化,但是页面仍然几乎是瞬间响应的。
|
190
|
+
这是因为在之前的请求时,SPR 已经在后台异步获取了新的渲染结果,本次请求到的页面是已经缓存在服务器中的版本。
|
191
|
+
|
192
|
+
可以想象,当 `interval` 设置为 1 时,用户可以在感知到实时数据的同时,拥有静态页面的响应体验。
|
193
|
+
|
194
|
+
:::info 补充信息
|
195
|
+
`PreRender` 的详细使用可以参考[这里](/apis/app/runtime/ssr/pre-render)。
|
196
|
+
|
197
|
+
:::
|
198
|
+
|
199
|
+
## Treeshaking
|
200
|
+
|
201
|
+
开启 SSR 时,Modern.js 会用相同的入口,构建出 SSR Bundle 和 CSR Bundle 两份产物。因此,在 SSR Bundle 中存在 Web API,或是在 CSR Bundle 中存在 Node API 时,都可能导致运行出错。
|
202
|
+
|
203
|
+
在组件中引入 Web API,通常情况下是要做一些全局监听,或是获取浏览器相关的数据,例如:
|
204
|
+
|
205
|
+
```tsx
|
206
|
+
document.addEventListener('load', () => {
|
207
|
+
console.log('document load');
|
208
|
+
});
|
209
|
+
const App = () => {
|
210
|
+
return <div>Hello World</div>;
|
211
|
+
};
|
212
|
+
export default App;
|
213
|
+
```
|
214
|
+
|
215
|
+
在组件文件中引入 Node API,通常情况下是因为使用了 Data Loader,例如:
|
216
|
+
|
217
|
+
```ts
|
218
|
+
import fse from 'fs-extra';
|
219
|
+
export const loader = () => {
|
220
|
+
const file = fse.readFileSync('./myfile');
|
221
|
+
return {
|
222
|
+
...
|
223
|
+
};
|
224
|
+
};
|
225
|
+
```
|
226
|
+
|
227
|
+
### 环境变量区分
|
228
|
+
|
229
|
+
对于第一种情况,我们可以直接使用 Modern.js 内置的环境变量 `MODERN_TARGET` 进行判断,在构建时删除无用代码:
|
230
|
+
|
231
|
+
```ts
|
232
|
+
if (process.env.MODERN_TARGET === 'browser') {
|
233
|
+
document.addEventListener('load', () => {
|
234
|
+
console.log('document load');
|
235
|
+
});
|
236
|
+
}
|
237
|
+
```
|
238
|
+
|
239
|
+
:::note
|
240
|
+
更多内容可以查看[环境变量](/guides/basic-features/env-vars)。
|
241
|
+
|
242
|
+
:::
|
243
|
+
|
244
|
+
### 文件后缀区分
|
245
|
+
|
246
|
+
但例如第二种情况,Treeshaking 的方式并不能保证代码被完全分离。Modern.js 也支持通过 `.node.` 后缀的文件来区分 SSR Bundle 和 CSR Bundle 产物的打包文件。
|
247
|
+
|
248
|
+
例如在代码中引入了 `fs-extra`,这时候直接引用到组件中,会造成 CSR 加载报错。可以创建同名的 `.ts` 和 `.node.ts` 文件做一层代理:
|
249
|
+
|
250
|
+
```ts title="compat.ts"
|
251
|
+
export const readFileSync: any = () => {};
|
252
|
+
```
|
253
|
+
|
254
|
+
```ts title="compat.node.ts"
|
255
|
+
export { readFileSync } from 'fs-extra';
|
256
|
+
```
|
257
|
+
|
258
|
+
在文件中直接引入 `./compat`,此时 SSR 环境下会优先使用 `.node.ts` 后缀的文件,CSR 环境下会使用 `.ts` 后缀的文件。
|
259
|
+
|
260
|
+
```ts title="App.tsx"
|
261
|
+
import { readFileSync } from './compat'
|
262
|
+
|
263
|
+
export const loader = () => {
|
264
|
+
const file = readFileSync('./myfile');
|
265
|
+
return {
|
266
|
+
...
|
267
|
+
};
|
268
|
+
};
|
269
|
+
```
|
270
|
+
|
271
|
+
### 独立文件
|
272
|
+
|
273
|
+
上述两种方式,都会为开发者带来一些心智负担。Modern.js 基于[嵌套路由](/guides/basic-features/routes)开发设计了[更简单的方案](/guides/basic-features/data-fetch)来分离 CSR 和 SSR 的代码。
|
274
|
+
|
275
|
+
## 接口请求
|
276
|
+
|
277
|
+
在 SSR 中发起接口请求时,开发者有时自己封装了同构的请求工具。部分接口需要传递用户 Cookie,开发者可以通过 [`useRuntimeContext`](/guides/basic-features/data-fetch#route-loader) API 获取到请求头来实现。
|
278
|
+
|
279
|
+
需要注意的是,此时获取到的是 HTML 请求的请求头,不一定适用于接口请求,因此**千万不能**透传所有请求头。并且,一些后端接口,或是通用网关,会根据请求头中的信息做校验,全量透传容易出现各种难以排查的问题,推荐**按需透传**。
|
280
|
+
|
281
|
+
如果实在需要透传所有请求头,请务必过滤 `host` 字段。
|
282
|
+
|
283
|
+
## 流式渲染
|
284
|
+
|
285
|
+
Modern.js 支持了 React 18 的流式渲染,可以通过如下配置启用:
|
286
|
+
|
287
|
+
```ts title="modern.config.ts"
|
288
|
+
import { defineConfig } from '@modern-js/app-tools';
|
289
|
+
|
290
|
+
export default defineConfig({
|
291
|
+
"server": {
|
292
|
+
"ssr": {
|
293
|
+
"mode": "stream",
|
294
|
+
},
|
295
|
+
},
|
296
|
+
})
|
297
|
+
```
|
298
|
+
|
299
|
+
Modern.js 的流式渲染基于 React Router 实现,主要涉及 API 有:
|
300
|
+
|
301
|
+
- [`defer`](https://reactrouter.com/en/main/utils/defer):在 Data Loader 中使用,用于支持异步获取数据。
|
302
|
+
- [`Await`](https://reactrouter.com/en/main/components/await):用于渲染 Data Loader 返回的异步数据。
|
303
|
+
- [`useAsyncValue`](https://reactrouter.com/en/main/hooks/use-async-value):用于从最近的父级 `Await` 组件中获取数据。
|
304
|
+
|
305
|
+
|
306
|
+
### 异步获取数据
|
307
|
+
|
308
|
+
```ts title='page.loader.ts'
|
309
|
+
import { defer, type LoaderFunctionArgs } from '@modern-js/runtime/router';
|
310
|
+
|
311
|
+
interface User {
|
312
|
+
name: string;
|
313
|
+
age: number;
|
314
|
+
}
|
315
|
+
|
316
|
+
export interface Data {
|
317
|
+
data: User;
|
318
|
+
}
|
319
|
+
|
320
|
+
export default ({ params }: LoaderFunctionArgs) => {
|
321
|
+
const userId = params.id;
|
322
|
+
|
323
|
+
const user = new Promise<User>(resolve => {
|
324
|
+
setTimeout(() => {
|
325
|
+
resolve({
|
326
|
+
name: `user-${userId}`,
|
327
|
+
age: 18,
|
328
|
+
});
|
329
|
+
}, 200);
|
330
|
+
});
|
331
|
+
|
332
|
+
return defer({ data: user });
|
333
|
+
};
|
334
|
+
|
335
|
+
```
|
336
|
+
|
337
|
+
`user` 是一个 Promise 类型的对象,表示需要异步获取的数据,通过 `defer` 处理需要异步获取的 `user`。注意,`defer` 必须接收一个对象类型的参数,
|
338
|
+
因此, 传入 `defer` 的参数为 `{data: user}`。
|
339
|
+
|
340
|
+
`defer` 还可以同时接收异步数据和同步数据。例如:
|
341
|
+
|
342
|
+
```ts title='page.loader.ts'
|
343
|
+
|
344
|
+
// 省略部分代码
|
345
|
+
|
346
|
+
export default ({ params }: LoaderFunctionArgs) => {
|
347
|
+
const userId = params.id;
|
348
|
+
|
349
|
+
const user = new Promise<User>(resolve => {
|
350
|
+
setTimeout(() => {
|
351
|
+
resolve({
|
352
|
+
name: `user-${userId}`,
|
353
|
+
age: 18,
|
354
|
+
});
|
355
|
+
}, 200);
|
356
|
+
});
|
357
|
+
|
358
|
+
const otherData = new Promise<string>(resolve => {
|
359
|
+
setTimeout(() => {
|
360
|
+
resolve('some sync data');
|
361
|
+
}, 200);
|
362
|
+
});
|
363
|
+
|
364
|
+
return defer({
|
365
|
+
data: user,
|
366
|
+
other: await otherData
|
367
|
+
});
|
368
|
+
};
|
369
|
+
|
370
|
+
```
|
371
|
+
|
372
|
+
`otherData` 前加了 `await`,所以是同步获取的数据,它可以和异步获取的数据 `user` 同时传入 `defer`。
|
373
|
+
|
374
|
+
|
375
|
+
### 渲染异步数据
|
376
|
+
|
377
|
+
通过 `Await` 组件,可以获取到 Data Loader 中异步返回的数据,然后进行渲染。例如:
|
378
|
+
|
379
|
+
```tsx title='page.tsx'
|
380
|
+
import { Await, useLoaderData } from '@modern-js/runtime/router';
|
381
|
+
import { Suspense } from 'react';
|
382
|
+
import type { Data } from './page.loader';
|
383
|
+
|
384
|
+
const Page = () => {
|
385
|
+
const data = useLoaderData() as Data;
|
386
|
+
|
387
|
+
return (
|
388
|
+
<div>
|
389
|
+
User info:
|
390
|
+
<Suspense fallback={<div id="loading">loading user data ...</div>}>
|
391
|
+
<Await resolve={data.data}>
|
392
|
+
{(user) => {
|
393
|
+
return (
|
394
|
+
<div id="data">
|
395
|
+
name: {user.name}, age: {user.age}
|
396
|
+
</div>
|
397
|
+
);
|
398
|
+
}}
|
399
|
+
</Await>
|
400
|
+
</Suspense>
|
401
|
+
</div>
|
402
|
+
);
|
403
|
+
};
|
404
|
+
|
405
|
+
export default Page;
|
406
|
+
```
|
407
|
+
|
408
|
+
`Await` 需要包裹在 `Suspense` 组件内部,`Await` 的 `resolve` 传入的是 Data Loader 异步获取的数据,当数据获取完成后,
|
409
|
+
通过 [Render Props](https://reactjs.org/docs/render-props.html) 模式,渲染获取到的数据。在数据的获取阶段,将展示
|
410
|
+
`Suspense` 组件 `fallback` 属性设置的内容。
|
411
|
+
|
412
|
+
:::warning 注意
|
413
|
+
从 Data Loader 文件导入类型时,需要使用 import type 语法,保证只导入类型信息,这样可以避免 Data Loader 的代码打包到前端产物的 bundle 文件中。
|
414
|
+
|
415
|
+
所以,这里的导入方式为:`import type { Data } from './page.loader'`;
|
416
|
+
:::
|
417
|
+
|
418
|
+
也可以通过 `useAsyncValue` 获取 Data Loader 返回的异步数据。例如:
|
419
|
+
|
420
|
+
|
421
|
+
```tsx title='page.tsx'
|
422
|
+
import { useAsyncValue } from '@modern-js/runtime/router';
|
423
|
+
|
424
|
+
// 省略部分代码
|
425
|
+
|
426
|
+
const UserInfo = () => {
|
427
|
+
const user = useAsyncValue();
|
428
|
+
|
429
|
+
return (
|
430
|
+
<div>
|
431
|
+
name: {user.name}, age: {user.age}
|
432
|
+
</div>
|
433
|
+
)
|
434
|
+
}
|
435
|
+
|
436
|
+
const Page = () => {
|
437
|
+
const data = useLoaderData() as Data;
|
438
|
+
|
439
|
+
return (
|
440
|
+
<div>
|
441
|
+
User info:
|
442
|
+
<Suspense fallback={<div id="loading">loading user data ...</div>}>
|
443
|
+
<Await resolve={data.data}>
|
444
|
+
<UserInfo />
|
445
|
+
</Await>
|
446
|
+
</Suspense>
|
447
|
+
</div>
|
448
|
+
);
|
449
|
+
};
|
450
|
+
|
451
|
+
export default Page;
|
452
|
+
```
|
453
|
+
|
454
|
+
### 错误处理
|
455
|
+
|
456
|
+
`Await` 组件的 `errorElement` 属性,可以用来处理当 Data Loader 执行时,或者子组件渲染时抛出的错误。
|
457
|
+
例如,我们故意在 Data Loader 函数中抛出错误:
|
458
|
+
|
459
|
+
```ts title='page.loader.ts'
|
460
|
+
import { defer } from '@modern-js/runtime/router';
|
461
|
+
|
462
|
+
export default () => {
|
463
|
+
const data = new Promise((resolve, reject) => {
|
464
|
+
setTimeout(() => {
|
465
|
+
reject(new Error('error occurs'));
|
466
|
+
}, 200);
|
467
|
+
});
|
468
|
+
|
469
|
+
return defer({ data });
|
470
|
+
};
|
471
|
+
```
|
472
|
+
|
473
|
+
然后通过 `useAsyncError` 获取错误,并将用于渲染错误信息的组件赋值给 `Await` 组件的 `errorElement` 属性:
|
474
|
+
|
475
|
+
```tsx title='page.ts'
|
476
|
+
import { Await, useAsyncError, useLoaderData } from '@modern-js/runtime/router';
|
477
|
+
import { Suspense } from 'react';
|
478
|
+
|
479
|
+
export default function Page() {
|
480
|
+
const data = useLoaderData();
|
481
|
+
|
482
|
+
return (
|
483
|
+
<div>
|
484
|
+
Error page
|
485
|
+
<Suspense fallback={<div>loading ...</div>}>
|
486
|
+
<Await resolve={data.data} errorElement={<ErrorElement />}>
|
487
|
+
{(data: any) => {
|
488
|
+
return <div>never displayed</div>;
|
489
|
+
}}
|
490
|
+
</Await>
|
491
|
+
</Suspense>
|
492
|
+
</div>
|
493
|
+
);
|
494
|
+
}
|
495
|
+
|
496
|
+
function ErrorElement() {
|
497
|
+
const error = useAsyncError() as Error;
|
498
|
+
return <p>Something went wrong! {error.message}</p>;
|
499
|
+
}
|
500
|
+
```
|
501
|
+
|
502
|
+
:::info 补充信息
|
503
|
+
|
504
|
+
1. [Deferred Data](https://reactrouter.com/en/main/guides/deferred)
|
505
|
+
2. [New Suspense SSR Architecture in React 18](https://github.com/reactwg/react-18/discussions/37)
|
506
|
+
|
507
|
+
:::
|
@@ -0,0 +1,122 @@
|
|
1
|
+
---
|
2
|
+
title: 自定义 Web Server
|
3
|
+
sidebar_position: 3
|
4
|
+
---
|
5
|
+
# 自定义 Web Server
|
6
|
+
|
7
|
+
Modern.js 作为以客户端为中心的开发框架,对服务端的定制能力较弱。而在有些开发场景下,需要定制特殊的服务端逻辑,例如用户鉴权、请求预处理、添加页面渲染骨架等。
|
8
|
+
|
9
|
+
一些开发者可能会有疑惑,Modern.js 已经提供了 [BFF 能力](/guides/advanced-features/bff/function.html),为什么还需要**自定义 Web Server**。
|
10
|
+
|
11
|
+
因为在默认情况下,页面路由并不会经过 BFF,它没有办法为页面访问提供服务端的定制逻辑。之所以这样设计,是因为我们不希望控制页面的服务与 BFF 服务绑定在一起,避免 BFF 的框架限制页面的部署方式。例如将页面与 BFF 分开托管、将页面服务部署到非 Node 的环境上,或是针对部署平台做定制等。
|
12
|
+
|
13
|
+
出于上述原因,Modern.js 提供了三种方式,让项目可以在根据需求,渐进式的定制服务端能力。
|
14
|
+
|
15
|
+
:::warning
|
16
|
+
三种扩展方式无法同时工作,开发者需要根据场景选择合适的方式。
|
17
|
+
:::
|
18
|
+
|
19
|
+
## 使用 API 扩展 Web Server
|
20
|
+
|
21
|
+
第一种方式是通过 Modern.js 提供的服务端运行时 API,在特定的生命周期对服务端进行定制。提供这种方式的目的是在部分情况下,开发者并不需要控制完整的 Web Server,只需要添加服务端逻辑即可。
|
22
|
+
|
23
|
+
这种方式无法控制完整的 Web Server,并且扩展逻辑**只在请求页面时生效**。因此,它适用于服务端逻辑相对简单,不希望额外创建 BFF 或者 BFF 和页面无需公用服务端逻辑场景。
|
24
|
+
|
25
|
+
可以在项目根目录执行 `pnpm run new` 命令,开启「自定义 Web Serve」功能:
|
26
|
+
|
27
|
+
```bash
|
28
|
+
? 请选择你想要的操作 创建工程元素
|
29
|
+
? 创建工程元素 新建「自定义 Web Server」源码目录
|
30
|
+
```
|
31
|
+
|
32
|
+
执行命令后,在 `modern.config.ts` 中注册 `@modern-js/plugin-server` 插件:
|
33
|
+
|
34
|
+
```ts title="modern.config.ts"
|
35
|
+
import serverPlugin from '@modern-js/plugin-server';
|
36
|
+
|
37
|
+
export default defineConfig({
|
38
|
+
plugins: [..., serverPlugin()],
|
39
|
+
});
|
40
|
+
```
|
41
|
+
|
42
|
+
开启功能后,项目目录下会自动创建 `server/index.ts` 文件,可以在这个文件中编写自定义逻辑。Modern.js 提供了 **Hook** 与 **Middleware** 两类 API 来扩展 Web Server。
|
43
|
+
|
44
|
+
### Hook
|
45
|
+
|
46
|
+
Modern.js 提供的 Hook 用于控制 Web Server 中的内置逻辑,所有的页面请求都会经过 Hook。
|
47
|
+
|
48
|
+
目前提供了两种 Hook,分别是 `AfterMatch` 和 `AfterRender`,可以用于修改渲染结果。可以在 `server/index.ts` 中这样写:
|
49
|
+
|
50
|
+
```ts
|
51
|
+
import type { AfterMatchHook, AfterRenderHook } from '@modern-js/runtime/server';
|
52
|
+
|
53
|
+
export const afterMatch: AfterMatchHook = (ctx, next) => {
|
54
|
+
next();
|
55
|
+
}
|
56
|
+
|
57
|
+
export const afterRender: AfterRenderHook = (ctx, next) => {
|
58
|
+
next();
|
59
|
+
}
|
60
|
+
```
|
61
|
+
|
62
|
+
项目在使用 Hook 时,应该有以下最佳实践:
|
63
|
+
|
64
|
+
1. 在 afterMatch 中做权限校验。
|
65
|
+
2. 在 afterMatch 做 Rewrite 和 Redirect。
|
66
|
+
3. 在 afterRender 中做 HTML 内容注入。
|
67
|
+
|
68
|
+
:::note
|
69
|
+
详细 API 和更多用法可以查看 [Hook](/apis/app/runtime/web-server/hook)。
|
70
|
+
:::
|
71
|
+
|
72
|
+
### Middleware
|
73
|
+
|
74
|
+
对于某些项目,可能在服务端有更多的需求,Modern.js 提供了 Middleware 为 Web Server 添加前置中间件。它只能运行在 Node 环境下,因此如果项目被部署到其他环境中,如 Worker 环境,则不可以使用 Middleware。
|
75
|
+
|
76
|
+
Modern.js 默认提供了一套 API 供项目使用:
|
77
|
+
|
78
|
+
```ts
|
79
|
+
import { Middlewre } from '@modern-js/runtime/server';
|
80
|
+
|
81
|
+
export const middleware = (context, next) => {
|
82
|
+
const { source: { req, res } } = context;
|
83
|
+
console.log(req.url);
|
84
|
+
next();
|
85
|
+
};
|
86
|
+
```
|
87
|
+
|
88
|
+
:::note
|
89
|
+
详细 API 和更多用法可以查看 [Middleware](/apis/app/runtime/web-server/middleware)。
|
90
|
+
:::
|
91
|
+
|
92
|
+
项目在使用 Middleware 时,应该有以下最佳实践:
|
93
|
+
|
94
|
+
1. 在 Middleware 中可以直接操作原生的请求、响应对象,做数据打点、注入 SSR 渲染可能用到的 Node 服务(数据库、Redis 等)。
|
95
|
+
2. 在 Middleware 里可以做类似功能打标、爬虫优化等功能。
|
96
|
+
3. 在 Middleware 里可以无视后续默认渲染,自定义渲染流程。
|
97
|
+
|
98
|
+
**总的来说,CSR 项目中,使用 Hook 基本能满足简单场景的所有需求。SSR 项目中,可以使用 Middleware 做更复杂的 Node 扩展。**
|
99
|
+
|
100
|
+
## 通过 BFF 托管页面请求
|
101
|
+
|
102
|
+
第二种方式,是利用 BFF 来托管页面渲染,这种方式下,所有的请求都会先打到 BFF 的服务。
|
103
|
+
|
104
|
+
因为这种方式可以通过 BFF 统一控制所有请求的服务端逻辑。因此,它适用于服务端逻辑复杂,BFF 和页面需要公用服务端逻辑的场景。但它整体还是依托于 Modern.js 的 Web Server 运行,无法将逻辑运行在已有的服务上。
|
105
|
+
|
106
|
+
使用这种方式,我们需要先通过 `pnpm new` 开启「BFF」功能。然后在配置文件中添加 [`bff.enableHandleWeb`](/configure/app/bff/enable-handle-web.html) 配置:
|
107
|
+
|
108
|
+
```ts
|
109
|
+
export default defineConfig({
|
110
|
+
bff: {
|
111
|
+
enableHandleWeb: true,
|
112
|
+
},
|
113
|
+
});
|
114
|
+
```
|
115
|
+
|
116
|
+
当该值设置为 `true` 时,页面请求流量也会经过 BFF,并且 Modern.js 内置的页面渲染的逻辑默认会作为 BFF 服务的最后一个中间件运行。
|
117
|
+
|
118
|
+
## 完全自定义的 Web Server
|
119
|
+
|
120
|
+
:::note
|
121
|
+
敬请期待
|
122
|
+
:::
|