@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.100 → 3.5.0-ultramodern.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modern-bundle-docs.js +7 -0
- package/dist/cjs/bundleDocs.js +114 -0
- package/dist/esm/bundleDocs.mjs +62 -0
- package/dist/esm-node/bundleDocs.mjs +63 -0
- package/dist/types/bundleDocs.d.ts +20 -0
- package/docs/apis/app/{commands.mdx → commands.md} +35 -9
- package/docs/apis/app/hooks/api/{lambda.mdx → lambda.md} +2 -6
- package/docs/apis/app/hooks/config/{favicon.mdx → favicon.md} +1 -6
- package/docs/apis/app/hooks/config/{html.mdx → html.md} +1 -5
- package/docs/apis/app/hooks/config/{icon.mdx → icon.md} +1 -6
- package/docs/apis/app/hooks/config/{mock.mdx → mock.md} +1 -5
- package/docs/apis/app/hooks/config/{public.mdx → public.md} +0 -4
- package/docs/apis/app/hooks/config/{upload.mdx → upload.md} +3 -7
- package/docs/apis/app/hooks/{modern-config.mdx → modern-config.md} +1 -5
- package/docs/apis/app/hooks/server/{server.mdx → server.md} +1 -6
- package/docs/apis/app/hooks/{shared.mdx → shared.md} +0 -4
- package/docs/apis/app/hooks/src/{app.mdx → app.md} +2 -2
- package/docs/apis/app/hooks/src/{entry.mdx → entry.md} +1 -6
- package/docs/apis/app/hooks/src/{entry.server.mdx → entry.server.md} +0 -5
- package/docs/apis/app/hooks/src/{modern.runtime.mdx → modern.runtime.md} +1 -5
- package/docs/apis/app/hooks/src/{routes.mdx → routes.md} +3 -7
- package/docs/apis/app/hooks/src/{server.mdx → server.md} +1 -5
- package/docs/apis/app/runtime/bff/{use-backend-context.mdx → use-backend-context.md} +0 -3
- package/docs/apis/app/runtime/core/{create-root.mdx → create-root.md} +0 -3
- package/docs/apis/app/runtime/core/{render.mdx → render.md} +1 -4
- package/docs/apis/app/runtime/core/{runtime-context.mdx → runtime-context.md} +0 -4
- package/docs/apis/app/runtime/router/{router.mdx → router.md} +1 -6
- package/docs/apis/app/runtime/ssr/{no-ssr.mdx → no-ssr.md} +0 -3
- package/docs/apis/app/runtime/ssr/{renderStreaming.mdx → renderStreaming.md} +0 -4
- package/docs/apis/app/runtime/ssr/{renderString.mdx → renderString.md} +0 -4
- package/docs/apis/app/runtime/ssr/{requestHandler.mdx → requestHandler.md} +0 -4
- package/docs/apis/app/runtime/utility/{css-in-js.mdx → css-in-js.md} +0 -4
- package/docs/apis/app/runtime/utility/{head.mdx → head.md} +0 -3
- package/docs/apis/app/runtime/utility/{loadable.mdx → loadable.md} +0 -3
- package/docs/community/blog/2022-0708-updates.md +91 -0
- package/docs/community/blog/2022-0910-updates.md +76 -0
- package/docs/community/blog/overview.md +63 -0
- package/docs/community/blog/v2-release-note.md +238 -0
- package/docs/community/blog/v3-release-note.md +622 -0
- package/docs/community/contributing-guide.md +252 -0
- package/docs/community/releases.md +23 -0
- package/docs/community/showcase.md +24 -0
- package/docs/community/team.md +14 -0
- package/docs/configure/app/bff/{cross-project.mdx → cross-project.md} +4 -8
- package/docs/configure/app/bff/{effect.mdx → effect.md} +3 -7
- package/docs/configure/app/bff/{prefix.mdx → prefix.md} +3 -7
- package/docs/configure/app/bff/{runtime-framework.mdx → runtime-framework.md} +3 -7
- package/docs/configure/app/{builder-plugins.mdx → builder-plugins.md} +4 -8
- package/docs/configure/app/dev/{asset-prefix.mdx → asset-prefix.md} +4 -9
- package/docs/configure/app/dev/{before-start-url.mdx → before-start-url.md} +0 -4
- package/docs/configure/app/dev/{client.mdx → client.md} +3 -7
- package/docs/configure/app/dev/hmr.md +10 -0
- package/docs/configure/app/dev/{host.mdx → host.md} +0 -4
- package/docs/configure/app/dev/{https.mdx → https.md} +0 -4
- package/docs/configure/app/dev/{lazy-compilation.mdx → lazy-compilation.md} +2 -8
- package/docs/configure/app/dev/live-reload.md +10 -0
- package/docs/configure/app/dev/{mock-dir.mdx → mock-dir.md} +0 -4
- package/docs/configure/app/dev/progress-bar.md +19 -0
- package/docs/configure/app/dev/{server.mdx → server.md} +0 -4
- package/docs/configure/app/dev/{setup-middlewares.mdx → setup-middlewares.md} +3 -7
- package/docs/configure/app/dev/{start-url.mdx → start-url.md} +0 -5
- package/docs/configure/app/dev/{watch-files.mdx → watch-files.md} +3 -7
- package/docs/configure/app/dev/{write-to-disk.mdx → write-to-disk.md} +3 -7
- package/docs/configure/app/experiments/{source-build.mdx → source-build.md} +1 -3
- package/docs/configure/app/html/{app-icon.mdx → app-icon.md} +3 -7
- package/docs/configure/app/html/{crossorigin.mdx → crossorigin.md} +3 -7
- package/docs/configure/app/html/{favicon.mdx → favicon.md} +3 -7
- package/docs/configure/app/html/inject.md +10 -0
- package/docs/configure/app/html/{meta.mdx → meta.md} +3 -7
- package/docs/configure/app/html/{mount-id.mdx → mount-id.md} +3 -7
- package/docs/configure/app/html/output-structure.md +10 -0
- package/docs/configure/app/html/script-loading.md +10 -0
- package/docs/configure/app/html/{tags.mdx → tags.md} +3 -7
- package/docs/configure/app/html/{template-parameters.mdx → template-parameters.md} +3 -7
- package/docs/configure/app/html/template.md +10 -0
- package/docs/configure/app/html/title.md +18 -0
- package/docs/configure/app/output/asset-prefix.md +11 -0
- package/docs/configure/app/output/{assets-retry.mdx → assets-retry.md} +1 -5
- package/docs/configure/app/output/{charset.mdx → charset.md} +3 -7
- package/docs/configure/app/output/{clean-dist-path.mdx → clean-dist-path.md} +0 -4
- package/docs/configure/app/output/{convert-to-rem.mdx → convert-to-rem.md} +12 -16
- package/docs/configure/app/output/{copy.mdx → copy.md} +3 -7
- package/docs/configure/app/output/{css-modules.mdx → css-modules.md} +3 -7
- package/docs/configure/app/output/{data-uri-limit.mdx → data-uri-limit.md} +3 -7
- package/docs/configure/app/output/{disable-css-module-extension.mdx → disable-css-module-extension.md} +3 -7
- package/docs/configure/app/output/{disable-inline-runtime-chunk.mdx → disable-inline-runtime-chunk.md} +0 -4
- package/docs/configure/app/output/{disable-svgr.mdx → disable-svgr.md} +0 -4
- package/docs/configure/app/output/{disable-ts-checker.mdx → disable-ts-checker.md} +0 -4
- package/docs/configure/app/output/{dist-path.mdx → dist-path.md} +3 -11
- package/docs/configure/app/output/{enable-asset-manifest.mdx → enable-asset-manifest.md} +0 -4
- package/docs/configure/app/output/{enable-css-module-tsdeclaration.mdx → enable-css-module-tsdeclaration.md} +0 -4
- package/docs/configure/app/output/{enable-inline-route-manifests.mdx → enable-inline-route-manifests.md} +0 -4
- package/docs/configure/app/output/{externals.mdx → externals.md} +3 -7
- package/docs/configure/app/output/filename-hash.md +10 -0
- package/docs/configure/app/output/{filename.mdx → filename.md} +3 -7
- package/docs/configure/app/output/inject-styles.md +10 -0
- package/docs/configure/app/output/{inline-scripts.mdx → inline-scripts.md} +4 -8
- package/docs/configure/app/output/{inline-styles.mdx → inline-styles.md} +4 -8
- package/docs/configure/app/output/{legal-comments.mdx → legal-comments.md} +3 -7
- package/docs/configure/app/output/{minify.mdx → minify.md} +3 -7
- package/docs/configure/app/output/{override-browserslist.mdx → override-browserslist.md} +4 -8
- package/docs/configure/app/output/polyfill.md +12 -0
- package/docs/configure/app/output/{source-map.mdx → source-map.md} +3 -7
- package/docs/configure/app/output/{split-route-chunks.mdx → split-route-chunks.md} +0 -4
- package/docs/configure/app/output/{ssg.mdx → ssg.md} +3 -7
- package/docs/configure/app/output/{ssgByEntries.mdx → ssgByEntries.md} +1 -4
- package/docs/configure/app/output/{svg-default-export.mdx → svg-default-export.md} +0 -4
- package/docs/configure/app/output/{temp-dir.mdx → temp-dir.md} +0 -4
- package/docs/configure/app/performance/{build-cache.mdx → build-cache.md} +3 -7
- package/docs/configure/app/performance/{chunk-split.mdx → chunk-split.md} +3 -7
- package/docs/configure/app/performance/{dns-prefetch.mdx → dns-prefetch.md} +3 -7
- package/docs/configure/app/performance/preconnect.md +16 -0
- package/docs/configure/app/performance/{prefetch.mdx → prefetch.md} +3 -7
- package/docs/configure/app/performance/{preload.mdx → preload.md} +3 -7
- package/docs/configure/app/performance/{print-file-size.mdx → print-file-size.md} +3 -7
- package/docs/configure/app/performance/profile.md +10 -0
- package/docs/configure/app/performance/remove-console.md +10 -0
- package/docs/configure/app/performance/remove-moment-locale.md +10 -0
- package/docs/configure/app/performance/{rsdoctor.mdx → rsdoctor.md} +0 -4
- package/docs/configure/app/{plugins.mdx → plugins.md} +4 -4
- package/docs/configure/app/resolve/{alias-strategy.mdx → alias-strategy.md} +3 -7
- package/docs/configure/app/resolve/alias.md +9 -0
- package/docs/configure/app/resolve/{condition-names.mdx → condition-names.md} +3 -8
- package/docs/configure/app/resolve/{dedupe.mdx → dedupe.md} +3 -7
- package/docs/configure/app/resolve/{extensions.mdx → extensions.md} +3 -8
- package/docs/configure/app/runtime/{0-intro.mdx → 0-intro.md} +1 -4
- package/docs/configure/app/runtime/{plugins.mdx → plugins.md} +1 -1
- package/docs/configure/app/runtime/{router.mdx → router.md} +3 -7
- package/docs/configure/app/security/{check-syntax.mdx → check-syntax.md} +0 -4
- package/docs/configure/app/security/{nonce.mdx → nonce.md} +3 -7
- package/docs/configure/app/security/{sri.mdx → sri.md} +0 -4
- package/docs/configure/app/server/{base-url.mdx → base-url.md} +0 -4
- package/docs/configure/app/server/{port.mdx → port.md} +3 -7
- package/docs/configure/app/server/{public-routes.mdx → public-routes.md} +0 -4
- package/docs/configure/app/server/{routes.mdx → routes.md} +1 -5
- package/docs/configure/app/server/{rsc.mdx → rsc.md} +2 -6
- package/docs/configure/app/server/{ssr-by-entries.mdx → ssr-by-entries.md} +1 -5
- package/docs/configure/app/server/ssr.md +80 -0
- package/docs/configure/app/server/{tsconfig-path.mdx → tsconfig-path.md} +0 -4
- package/docs/configure/app/source/{alias-strategy.mdx → alias-strategy.md} +4 -8
- package/docs/configure/app/source/{alias.mdx → alias.md} +4 -8
- package/docs/configure/app/source/{config-dir.mdx → config-dir.md} +1 -5
- package/docs/configure/app/source/{decorators.mdx → decorators.md} +0 -4
- package/docs/configure/app/source/{define.mdx → define.md} +3 -7
- package/docs/configure/app/source/{disable-default-entries.mdx → disable-default-entries.md} +2 -6
- package/docs/{components/module-federation.mdx → configure/app/source/enable-async-entry.md} +47 -0
- package/docs/configure/app/source/{enable-async-pre-entry.mdx → enable-async-pre-entry.md} +0 -4
- package/docs/configure/app/source/{entries-dir.mdx → entries-dir.md} +0 -4
- package/docs/configure/app/source/{entries.mdx → entries.md} +1 -5
- package/docs/configure/app/source/{exclude.mdx → exclude.md} +4 -8
- package/docs/configure/app/source/{global-vars.mdx → global-vars.md} +0 -4
- package/docs/configure/app/source/{include.mdx → include.md} +4 -8
- package/docs/configure/app/source/{main-entry-name.mdx → main-entry-name.md} +0 -4
- package/docs/configure/app/source/{pre-entry.mdx → pre-entry.md} +3 -7
- package/docs/configure/app/source/{react-compiler.mdx → react-compiler.md} +0 -4
- package/docs/configure/app/source/{transform-import.mdx → transform-import.md} +3 -7
- package/docs/configure/app/{split-chunks.mdx → split-chunks.md} +3 -3
- package/docs/configure/app/tools/{autoprefixer.mdx → autoprefixer.md} +0 -4
- package/docs/configure/app/tools/{bundler-chain.mdx → bundler-chain.md} +0 -4
- package/docs/configure/app/tools/{css-extract.mdx → css-extract.md} +3 -7
- package/docs/configure/app/tools/{css-loader.mdx → css-loader.md} +3 -7
- package/docs/configure/app/tools/{dev-server.mdx → dev-server.md} +0 -4
- package/docs/configure/app/tools/{html-plugin.mdx → html-plugin.md} +3 -7
- package/docs/configure/app/tools/{less.mdx → less.md} +0 -4
- package/docs/configure/app/tools/{lightningcss-loader.mdx → lightningcss-loader.md} +3 -7
- package/docs/configure/app/tools/{minify-css.mdx → minify-css.md} +0 -4
- package/docs/configure/app/tools/{postcss.mdx → postcss.md} +3 -7
- package/docs/configure/app/tools/rspack.md +10 -0
- package/docs/configure/app/tools/{sass.mdx → sass.md} +0 -4
- package/docs/configure/app/tools/style-loader.md +10 -0
- package/docs/configure/app/tools/{swc.mdx → swc.md} +4 -8
- package/docs/configure/app/tools/{ts-checker.mdx → ts-checker.md} +20 -7
- package/docs/configure/app/{usage.mdx → usage.md} +1 -1
- package/docs/guides/advanced-features/bff/{cross-project.mdx → cross-project.md} +1 -2
- package/docs/guides/advanced-features/bff/{data-platform.mdx → data-platform.md} +0 -4
- package/docs/guides/advanced-features/bff/{extend-server.mdx → extend-server.md} +1 -1
- package/docs/guides/advanced-features/bff/frameworks.md +243 -0
- package/docs/guides/advanced-features/bff/{function.mdx → function.md} +60 -7
- package/docs/guides/advanced-features/bff/{operators.mdx → operators.md} +2 -77
- package/docs/{components/bff-upload.mdx → guides/advanced-features/bff/upload.md} +4 -0
- package/docs/guides/advanced-features/{bff.mdx → bff.md} +0 -4
- package/docs/guides/advanced-features/{build-performance.mdx → build-performance.md} +3 -7
- package/docs/guides/advanced-features/{compatibility.mdx → compatibility.md} +54 -15
- package/docs/guides/advanced-features/international/{advanced.mdx → advanced.md} +0 -4
- package/docs/guides/advanced-features/international/{api.mdx → api.md} +16 -20
- package/docs/guides/advanced-features/international/{best-practices.mdx → best-practices.md} +0 -4
- package/docs/guides/advanced-features/international/configuration.md +228 -0
- package/docs/guides/advanced-features/international/{locale-detection.mdx → locale-detection.md} +25 -29
- package/docs/guides/advanced-features/international/{quick-start.mdx → quick-start.md} +29 -13
- package/docs/guides/advanced-features/international/{resource-loading.mdx → resource-loading.md} +11 -15
- package/docs/guides/advanced-features/international/{routing.mdx → routing.md} +12 -16
- package/docs/guides/advanced-features/international.md +27 -0
- package/docs/guides/advanced-features/{low-level.mdx → low-level.md} +17 -21
- package/docs/guides/advanced-features/page-performance/{code-split.mdx → code-split.md} +2 -6
- package/docs/guides/advanced-features/page-performance/{inline-assets.mdx → inline-assets.md} +3 -7
- package/docs/guides/advanced-features/page-performance/{optimize-bundle.mdx → optimize-bundle.md} +4 -8
- package/docs/{components/internal-logger.mdx → guides/advanced-features/server-monitor/logger.md} +16 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
- package/docs/guides/advanced-features/server-monitor/{monitors.mdx → monitors.md} +3 -3
- package/docs/guides/advanced-features/{source-build.mdx → source-build.md} +1 -5
- package/docs/guides/advanced-features/{web-server.mdx → web-server.md} +1 -9
- package/docs/guides/basic-features/{alias.mdx → alias.md} +3 -7
- package/docs/guides/basic-features/css/{css-in-js.mdx → css-in-js.md} +12 -9
- package/docs/guides/basic-features/css/{css-modules.mdx → css-modules.md} +3 -3
- package/docs/guides/basic-features/css/{css.mdx → css.md} +2 -6
- package/docs/guides/basic-features/data/{data-cache.mdx → data-cache.md} +1 -6
- package/docs/guides/basic-features/data/{data-fetch.mdx → data-fetch.md} +4 -8
- package/docs/guides/basic-features/data/{data-write.mdx → data-write.md} +6 -9
- package/docs/guides/basic-features/debug/{mock.mdx → mock.md} +1 -5
- package/docs/guides/basic-features/debug/{proxy.mdx → proxy.md} +1 -5
- package/docs/guides/basic-features/debug/{using-storybook.mdx → using-storybook.md} +20 -8
- package/docs/guides/basic-features/{deploy.mdx → deploy.md} +23 -13
- package/docs/guides/basic-features/{env-vars.mdx → env-vars.md} +8 -12
- package/docs/guides/basic-features/{html.mdx → html.md} +3 -7
- package/docs/guides/basic-features/{output-files.mdx → output-files.md} +6 -10
- package/docs/guides/basic-features/render/{before-render.mdx → before-render.md} +1 -1
- package/docs/guides/basic-features/render/overview.md +47 -0
- package/docs/guides/basic-features/render/{rsc.mdx → rsc.md} +12 -20
- package/docs/guides/basic-features/render/{ssg.mdx → ssg.md} +71 -10
- package/docs/guides/basic-features/render/{ssr-cache.mdx → ssr-cache.md} +5 -5
- package/docs/guides/basic-features/render/{ssr.mdx → ssr.md} +10 -12
- package/docs/guides/basic-features/render/{streaming-ssr.mdx → streaming-ssr.md} +5 -8
- package/docs/guides/basic-features/routes/{config-routes.mdx → config-routes.md} +10 -11
- package/docs/guides/basic-features/routes/{routes.mdx → routes.md} +8 -16
- package/docs/guides/basic-features/static-assets/{json-files.mdx → json-files.md} +0 -4
- package/docs/guides/basic-features/static-assets/{svg-assets.mdx → svg-assets.md} +3 -7
- package/docs/guides/basic-features/static-assets/{wasm-assets.mdx → wasm-assets.md} +1 -5
- package/docs/guides/basic-features/{static-assets.mdx → static-assets.md} +10 -14
- package/docs/guides/basic-features/testing/{playwright.mdx → playwright.md} +12 -3
- package/docs/guides/basic-features/testing/{rstest.mdx → rstest.md} +70 -11
- package/docs/guides/concept/{builder.mdx → builder.md} +3 -26
- package/docs/guides/concept/{entries.mdx → entries.md} +11 -17
- package/docs/guides/concept/{server.mdx → server.md} +3 -3
- package/docs/guides/get-started/{ai-coding-agents.mdx → ai-coding-agents.md} +4 -9
- package/docs/guides/get-started/glossary.md +63 -0
- package/docs/guides/get-started/{introduction.mdx → introduction.md} +1 -6
- package/docs/guides/get-started/quick-start.md +269 -0
- package/docs/guides/get-started/{tech-stack.mdx → tech-stack.md} +9 -15
- package/docs/guides/get-started/{ultramodern.mdx → ultramodern.md} +19 -24
- package/docs/guides/get-started/{upgrade.mdx → upgrade.md} +21 -12
- package/docs/guides/topic-detail/module-federation/{application.mdx → application.md} +3 -3
- package/docs/guides/topic-detail/module-federation/{deploy.mdx → deploy.md} +2 -2
- package/docs/guides/topic-detail/module-federation/{i18n.mdx → i18n.md} +14 -14
- package/docs/guides/topic-detail/module-federation/{introduce.mdx → introduce.md} +2 -3
- package/docs/guides/topic-detail/module-federation/{ssr.mdx → ssr.md} +12 -7
- package/docs/guides/topic-detail/module-federation/{usage.mdx → usage.md} +20 -3
- package/docs/guides/troubleshooting/{builder.mdx → builder.md} +10 -14
- package/docs/guides/troubleshooting/{cli.mdx → cli.md} +0 -4
- package/docs/guides/troubleshooting/{dependencies.mdx → dependencies.md} +7 -11
- package/docs/guides/troubleshooting/{hmr.mdx → hmr.md} +5 -9
- package/docs/guides/upgrade/{config.mdx → config.md} +8 -5
- package/docs/guides/upgrade/{entry.mdx → entry.md} +6 -6
- package/docs/guides/upgrade/{other.mdx → other.md} +8 -8
- package/docs/guides/upgrade/{overview.mdx → overview.md} +4 -4
- package/docs/guides/upgrade/{tailwindcss.mdx → tailwindcss.md} +0 -1
- package/docs/guides/upgrade/web-server.md +11 -11
- package/docs/index.md +33 -4
- package/docs/llms.txt +290 -0
- package/docs/plugin/cli-plugins/api.md +573 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +152 -0
- package/docs/plugin/official/cli-plugins/plugin-bff.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +5 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +5 -0
- package/docs/plugin/official/cli-plugins.md +4 -0
- package/docs/plugin/plugin-system.md +238 -0
- package/docs/plugin/runtime-plugins/api.md +194 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +209 -0
- package/docs/plugin/server-plugins/life-cycle.md +13 -0
- package/docs/tutorials/examples/csr-auth.md +9 -0
- package/docs/tutorials/foundations/introduction.md +16 -0
- package/package.json +32 -14
- package/docs/_nav.json +0 -36
- package/docs/apis/_meta.json +0 -13
- package/docs/apis/app/hooks/_meta.json +0 -28
- package/docs/apis/app/hooks/config/_meta.json +0 -1
- package/docs/apis/app/runtime/_meta.json +0 -32
- package/docs/components/auto-upgrade.mdx +0 -0
- package/docs/components/build-output.mdx +0 -45
- package/docs/components/bundler.mdx +0 -3
- package/docs/components/convention-routing-motivation.mdx +0 -0
- package/docs/components/debug-app.mdx +0 -15
- package/docs/components/default-browserslist.mdx +0 -7
- package/docs/components/deploy-command.mdx +0 -14
- package/docs/components/deploy.mdx +0 -1
- package/docs/components/enable-bff-caution.mdx +0 -3
- package/docs/components/enable-bff.mdx +0 -56
- package/docs/components/enable-ssg.mdx +0 -49
- package/docs/components/entry-mode.mdx +0 -0
- package/docs/components/entry-scan-logic.mdx +0 -7
- package/docs/components/extend-bff-function.mdx +0 -3
- package/docs/components/hono.mdx +0 -120
- package/docs/components/init-app.mdx +0 -93
- package/docs/components/init-rspack-app.mdx +0 -5
- package/docs/components/internal-metrics.mdx +0 -20
- package/docs/components/international/custom-instance-code.mdx +0 -16
- package/docs/components/international/init-options-desc.mdx +0 -1
- package/docs/components/international/install-command.mdx +0 -10
- package/docs/components/international/instance-code.mdx +0 -16
- package/docs/components/international/introduce.mdx +0 -5
- package/docs/components/international/platform-support.mdx +0 -0
- package/docs/components/language-config.mdx +0 -9
- package/docs/components/micro-frontend.mdx +0 -6
- package/docs/components/micro-master-manifest-config.mdx +0 -15
- package/docs/components/micro-runtime-config.mdx +0 -17
- package/docs/components/new-entry-tooltip.mdx +0 -0
- package/docs/components/nodeVersion.mdx +0 -28
- package/docs/components/other-plugins.mdx +0 -0
- package/docs/components/output-asset-prefix-extend.mdx +0 -0
- package/docs/components/output-distpath-warning.mdx +0 -0
- package/docs/components/output-polyfill-extend.mdx +0 -1
- package/docs/components/prerequisites.mdx +0 -18
- package/docs/components/release-note.mdx +0 -1
- package/docs/components/routes-practice.mdx +0 -0
- package/docs/components/rsbuild-config-tooltip.mdx +0 -5
- package/docs/components/rsbuild.mdx +0 -3
- package/docs/components/rsc-deploy-tip.mdx +0 -1
- package/docs/components/rspack.mdx +0 -3
- package/docs/components/rspackTip.mdx +0 -7
- package/docs/components/runtime-cli-config.mdx +0 -0
- package/docs/components/serve-command.mdx +0 -22
- package/docs/components/ssr-monitor.mdx +0 -3
- package/docs/components/stream-ssr-performance.mdx +0 -0
- package/docs/components/swc.mdx +0 -3
- package/docs/components/tech-stack-node-framework.mdx +0 -1
- package/docs/components/turtorials-example-list.mdx +0 -2
- package/docs/components/ua-polyfill.mdx +0 -44
- package/docs/components/upgrade-browserslist.mdx +0 -0
- package/docs/components/upgrade-config-deploy.mdx +0 -0
- package/docs/components/upgrade-faq.mdx +0 -0
- package/docs/configure/_meta.json +0 -78
- package/docs/configure/app/dev/hmr.mdx +0 -14
- package/docs/configure/app/dev/live-reload.mdx +0 -14
- package/docs/configure/app/dev/progress-bar.mdx +0 -23
- package/docs/configure/app/html/inject.mdx +0 -14
- package/docs/configure/app/html/output-structure.mdx +0 -14
- package/docs/configure/app/html/script-loading.mdx +0 -14
- package/docs/configure/app/html/template.mdx +0 -14
- package/docs/configure/app/html/title.mdx +0 -22
- package/docs/configure/app/output/asset-prefix.mdx +0 -18
- package/docs/configure/app/output/filename-hash.mdx +0 -14
- package/docs/configure/app/output/inject-styles.mdx +0 -14
- package/docs/configure/app/output/polyfill.mdx +0 -18
- package/docs/configure/app/performance/preconnect.mdx +0 -20
- package/docs/configure/app/performance/profile.mdx +0 -14
- package/docs/configure/app/performance/remove-console.mdx +0 -14
- package/docs/configure/app/performance/remove-moment-locale.mdx +0 -14
- package/docs/configure/app/resolve/alias.mdx +0 -13
- package/docs/configure/app/server/ssr.mdx +0 -85
- package/docs/configure/app/source/enable-async-entry.mdx +0 -54
- package/docs/configure/app/tools/rspack.mdx +0 -14
- package/docs/configure/app/tools/style-loader.mdx +0 -14
- package/docs/guides/_meta.json +0 -37
- package/docs/guides/advanced-features/_meta.json +0 -32
- package/docs/guides/advanced-features/bff/_meta.json +0 -10
- package/docs/guides/advanced-features/bff/frameworks.mdx +0 -131
- package/docs/guides/advanced-features/bff/upload.mdx +0 -7
- package/docs/guides/advanced-features/international/_meta.json +0 -10
- package/docs/guides/advanced-features/international/configuration.mdx +0 -222
- package/docs/guides/advanced-features/international.mdx +0 -29
- package/docs/guides/advanced-features/page-performance/_meta.json +0 -1
- package/docs/guides/advanced-features/server-monitor/_meta.json +0 -1
- package/docs/guides/advanced-features/server-monitor/logger.mdx +0 -19
- package/docs/guides/advanced-features/server-monitor/metrics.mdx +0 -41
- package/docs/guides/basic-features/_meta.json +0 -49
- package/docs/guides/basic-features/css/_meta.json +0 -1
- package/docs/guides/basic-features/data/_meta.json +0 -1
- package/docs/guides/basic-features/debug/_meta.json +0 -1
- package/docs/guides/basic-features/render/_meta.json +0 -1
- package/docs/guides/basic-features/render/overview.mdx +0 -51
- package/docs/guides/basic-features/routes/_meta.json +0 -1
- package/docs/guides/basic-features/static-assets/_meta.json +0 -1
- package/docs/guides/basic-features/testing/_meta.json +0 -1
- package/docs/guides/concept/_meta.json +0 -1
- package/docs/guides/get-started/_meta.json +0 -9
- package/docs/guides/get-started/glossary.mdx +0 -63
- package/docs/guides/get-started/quick-start.mdx +0 -92
- package/docs/guides/topic-detail/_meta.json +0 -8
- package/docs/guides/topic-detail/module-federation/_meta.json +0 -1
- package/docs/guides/troubleshooting/_meta.json +0 -1
- package/docs/guides/upgrade/_meta.json +0 -1
- package/scripts/copy-main-doc.mjs +0 -50
- /package/docs/guides/advanced-features/bff/{sdk.mdx → sdk.md} +0 -0
- /package/docs/guides/advanced-features/page-performance/{react-compiler.mdx → react-compiler.md} +0 -0
- /package/docs/guides/basic-features/css/{tailwindcss.mdx → tailwindcss.md} +0 -0
- /package/docs/guides/basic-features/debug/{rsdoctor.mdx → rsdoctor.md} +0 -0
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 15
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Deploy Application
|
|
6
2
|
|
|
7
3
|
Currently, Modern.js offers two deployment way:
|
|
@@ -165,8 +161,7 @@ Assuming the directory structure of the Monorepo repository is as follows:
|
|
|
165
161
|
|
|
166
162
|
You need to configure Base directory on the netlify platform as `packages/app`:
|
|
167
163
|
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+

|
|
170
165
|
Add the following script in `packages/app/package.json`, before executing the deployment command of the `app` repository, first execute the build of other repositories in the workspace:
|
|
171
166
|
|
|
172
167
|
```json
|
|
@@ -220,8 +215,7 @@ Add the following content to `vercel.json`:
|
|
|
220
215
|
|
|
221
216
|
Commit your project to git, select Framework Preset as `Other` on the Vercel platform and deploy.
|
|
222
217
|
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+

|
|
225
219
|
:::info
|
|
226
220
|
You can refer to the [deployment project examples](https://github.com/web-infra-dev/modern.js/tree/main/examples/modern-js-deploy-csr).
|
|
227
221
|
|
|
@@ -265,8 +259,7 @@ Assuming the directory structure of the Monorepo repository is as follows:
|
|
|
265
259
|
|
|
266
260
|
First, you need to configure the **Root Directory** as `packages/app` on the Vercel platform:
|
|
267
261
|
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+

|
|
270
263
|
Specify Node.js runtime as `20.x`:
|
|
271
264
|
|
|
272
265
|
```json title="package.json"
|
|
@@ -370,9 +363,26 @@ app.listen(3000);
|
|
|
370
363
|
|
|
371
364
|
Now, you can add some code to include the logic for accessing static resources and HTML files in `server.js`. We need to use the `mime-types` package to get the MIME types of static resources, so let's install the dependency first:
|
|
372
365
|
|
|
373
|
-
import { PackageManagerTabs } from '@theme';
|
|
374
366
|
|
|
375
|
-
|
|
367
|
+
```sh [npm]
|
|
368
|
+
npm add mime-types
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
```sh [yarn]
|
|
372
|
+
yarn add mime-types
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
```sh [pnpm]
|
|
376
|
+
pnpm add mime-types
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```sh [bun]
|
|
380
|
+
bun add mime-types
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
```sh [deno]
|
|
384
|
+
deno add npm:mime-types
|
|
385
|
+
```
|
|
376
386
|
|
|
377
387
|
```ts title="server.js"
|
|
378
388
|
const Koa = require('koa');
|
|
@@ -402,7 +412,7 @@ The above code is a basic example. Your application might have multiple entry po
|
|
|
402
412
|
|
|
403
413
|
Please note that if your project uses Modern.js conventional routing or if you have set up client-side routing with React Router, you must access HTML files through the correct `baseURL`.
|
|
404
414
|
|
|
405
|
-
In Modern.js, the default `baseURL` is `'/'`. You can configure it by modifying [`server.baseUrl`](/configure/app/server/base-url) in `modern.config.ts`.
|
|
415
|
+
In Modern.js, the default `baseURL` is `'/'`. You can configure it by modifying [`server.baseUrl`](/configure/app/server/base-url.md) in `modern.config.ts`.
|
|
406
416
|
|
|
407
417
|
:::danger
|
|
408
418
|
For projects with client-side routing, you can never access HTML files through the `/index.html` path.
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 7
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Environment Variables
|
|
6
2
|
|
|
7
3
|
Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
|
|
8
4
|
|
|
9
5
|
## Built-in Environment Variables
|
|
10
6
|
|
|
11
|
-
###
|
|
7
|
+
### ASSET\_PREFIX
|
|
12
8
|
|
|
13
9
|
The current path prefix of the asset, which is a read-only environment variable.
|
|
14
10
|
|
|
15
|
-
###
|
|
11
|
+
### NODE\_ENV
|
|
16
12
|
|
|
17
13
|
The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
|
|
18
14
|
|
|
19
15
|
- `production`: Default value when running `modern build` or `modern serve`.
|
|
20
16
|
- `development`: Default value when running `modern dev`, also the default value in other cases.
|
|
21
17
|
|
|
22
|
-
###
|
|
18
|
+
### MODERN\_ENV
|
|
23
19
|
|
|
24
|
-
Set the current execution environment manually. In addition to the values in the
|
|
20
|
+
Set the current execution environment manually. In addition to the values in the NODE\_ENV, custom environment names are supported here, such as `staging`, `boe`, etc.
|
|
25
21
|
|
|
26
22
|
:::tip
|
|
27
|
-
|
|
23
|
+
MODERN\_ENV priority is higher than NODE\_ENV.
|
|
28
24
|
|
|
29
25
|
:::
|
|
30
26
|
|
|
31
|
-
###
|
|
27
|
+
### MODERN\_TARGET
|
|
32
28
|
|
|
33
29
|
When using `@modern-js/runtime`, Modern.js will automatically inject `MODERN_TARGET` to distinguish between SSR and CSR environments.
|
|
34
30
|
|
|
@@ -136,7 +132,7 @@ In custom HTML templates, you can also use such environment variables directly.
|
|
|
136
132
|
|
|
137
133
|
### Any Other Names
|
|
138
134
|
|
|
139
|
-
If you need to use environment variables with any other names in your code, you can configure them in [`source.globalVars`](/configure/app/source/global-vars). For example:
|
|
135
|
+
If you need to use environment variables with any other names in your code, you can configure them in [`source.globalVars`](/configure/app/source/global-vars.md). For example:
|
|
140
136
|
|
|
141
137
|
```ts title="modern.config.ts"
|
|
142
138
|
export default defineConfig({
|
|
@@ -178,4 +174,4 @@ const foo = TWO;
|
|
|
178
174
|
const foo = 1 + 1;
|
|
179
175
|
```
|
|
180
176
|
|
|
181
|
-
In most cases, `source.globalVars` is already sufficient to replace variables. But the values passed in by `source.globalVars` will be serialized by JSON by default. So it cannot be replaced like `1 + 1` in the example above, at this time, we need to use [`source.define`](/configure/app/source/define).
|
|
177
|
+
In most cases, `source.globalVars` is already sufficient to replace variables. But the values passed in by `source.globalVars` will be serialized by JSON by default. So it cannot be replaced like `1 + 1` in the example above, at this time, we need to use [`source.define`](/configure/app/source/define.md).
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 9
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# HTML Template
|
|
6
2
|
|
|
7
3
|
Modern.js provides **JSX syntax** and **HTML(EJS) syntax** to customize the HTML template.
|
|
@@ -29,7 +25,7 @@ For example, consider the following directory structure:
|
|
|
29
25
|
If not found, default template will be used.
|
|
30
26
|
|
|
31
27
|
:::tip
|
|
32
|
-
`Document.tsx` is compiled at build time by the Modern.js Document plugin using a dedicated Rspack child compiler targeting Node.js, and is rendered to a string with `renderToStaticMarkup` as the HTML template content, similar to [Static Site Generation](/guides/basic-features/render/ssg.
|
|
28
|
+
`Document.tsx` is compiled at build time by the Modern.js Document plugin using a dedicated Rspack child compiler targeting Node.js, and is rendered to a string with `renderToStaticMarkup` as the HTML template content, similar to [Static Site Generation](/guides/basic-features/render/ssg.md). The HTML template module is not part of the page bundler compilation, so React Hooks in the component will not run in the browser runtime, and non-JavaScript assets such as images cannot be resolved or imported.
|
|
33
29
|
:::
|
|
34
30
|
|
|
35
31
|
### HTML Components
|
|
@@ -214,7 +210,7 @@ For example, to insert an external script in `body.html`:
|
|
|
214
210
|
```
|
|
215
211
|
|
|
216
212
|
:::info
|
|
217
|
-
The implementation of custom HTML fragments is to merge the fragments with the built-in template. Since the `<title>` already exists in the default template, the title tag in the custom HTML template will not take effect. Please use [html.title](/configure/app/html/title) to modify the page title.
|
|
213
|
+
The implementation of custom HTML fragments is to merge the fragments with the built-in template. Since the `<title>` already exists in the default template, the title tag in the custom HTML template will not take effect. Please use [html.title](/configure/app/html/title.md) to modify the page title.
|
|
218
214
|
|
|
219
215
|
:::
|
|
220
216
|
|
|
@@ -236,7 +232,7 @@ The default HTML template can be viewed in `node_modules/.modern-js/${entryName}
|
|
|
236
232
|
|
|
237
233
|
### Template Parameters
|
|
238
234
|
|
|
239
|
-
The parameters used in the template can be defined by the [html.templateParameters](/configure/app/html/template-parameters) configuration.
|
|
235
|
+
The parameters used in the template can be defined by the [html.templateParameters](/configure/app/html/template-parameters.md) configuration.
|
|
240
236
|
|
|
241
237
|
### Config By Entry
|
|
242
238
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 10
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# Output Files
|
|
6
2
|
|
|
7
3
|
This chapter will introduces the directory structure of output files and how to control the output directory of different types of files.
|
|
@@ -44,11 +40,11 @@ In the filename, `[name]` represents the entry name corresponding to this file,
|
|
|
44
40
|
|
|
45
41
|
Modern.js provides some configs to modify the directory or filename, you can:
|
|
46
42
|
|
|
47
|
-
- Modify the filename through [output.filename](/configure/app/output/filename).
|
|
48
|
-
- Modify the output path of through [output.distPath](/configure/app/output/dist-path).
|
|
49
|
-
- Modify the license file through [output.legalComments](/configure/app/output/legal-comments).
|
|
50
|
-
- Remove Source Map file through [output.sourceMap](/configure/app/output/source-map).
|
|
51
|
-
- Remove the folder corresponding to the HTML files through [html.outputStructure](/configure/app/html/output-structure).
|
|
43
|
+
- Modify the filename through [output.filename](/configure/app/output/filename.md).
|
|
44
|
+
- Modify the output path of through [output.distPath](/configure/app/output/dist-path.md).
|
|
45
|
+
- Modify the license file through [output.legalComments](/configure/app/output/legal-comments.md).
|
|
46
|
+
- Remove Source Map file through [output.sourceMap](/configure/app/output/source-map.md).
|
|
47
|
+
- Remove the folder corresponding to the HTML files through [html.outputStructure](/configure/app/html/output-structure.md).
|
|
52
48
|
|
|
53
49
|
## Static Assets
|
|
54
50
|
|
|
@@ -70,7 +66,7 @@ dist
|
|
|
70
66
|
└── qux.[hash].mp4
|
|
71
67
|
```
|
|
72
68
|
|
|
73
|
-
You can use the [output.distPath](/configure/app/output/dist-path) config to uniformly input these static assets into a directory, for example, output to the `assets` directory:
|
|
69
|
+
You can use the [output.distPath](/configure/app/output/dist-path.md) config to uniformly input these static assets into a directory, for example, output to the `assets` directory:
|
|
74
70
|
|
|
75
71
|
```ts
|
|
76
72
|
export default {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Render Preprocessing
|
|
2
2
|
|
|
3
|
-
In certain scenarios, applications need to perform preprocessing operations before rendering. Modern.js recommends using **[Runtime Plugins](/plugin/introduction.
|
|
3
|
+
In certain scenarios, applications need to perform preprocessing operations before rendering. Modern.js recommends using **[Runtime Plugins](/plugin/introduction.md#runtime-plugins)** to implement this type of logic.
|
|
4
4
|
|
|
5
5
|
## Defining a Runtime Plugin
|
|
6
6
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Rendering Mode Overview
|
|
2
|
+
|
|
3
|
+
Modern.js supports multiple rendering modes, and different rendering modes are suitable for different scenarios. Choosing the right rendering mode can significantly improve application performance and user experience.
|
|
4
|
+
|
|
5
|
+
## Rendering Mode Quick Reference
|
|
6
|
+
|
|
7
|
+
| Rendering Mode | Characteristics | Use Cases |
|
|
8
|
+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
9
|
+
| **CSR** | Executes JavaScript in the browser to render pages | Applications with strong interactivity and low SEO requirements |
|
|
10
|
+
| **SSR** | Pre-renders complete HTML pages on the server | Websites with high requirements for first-screen performance and SEO |
|
|
11
|
+
| **Streaming SSR** | Renders and returns progressively, displaying initial UI faster | Applications requiring faster first-screen perception speed (**Default SSR mode**) |
|
|
12
|
+
| **RSC** | Components render on the server, reducing client JS size; high cohesion between data and component logic, reducing state passing | Projects pursuing optimal performance and needing to reduce client-side code |
|
|
13
|
+
| **SSG** | Generates static pages at build time, can be cached by CDN | Websites with relatively static content, such as blogs and documentation sites |
|
|
14
|
+
|
|
15
|
+
## Performance Comparison
|
|
16
|
+
|
|
17
|
+
| Rendering Technology | Core Advantages | Main Bottlenecks |
|
|
18
|
+
| ----------------------- | ------------------------------------------------------ | ------------------------------------------------ |
|
|
19
|
+
| **SSR** | Server-side pre-rendering, beneficial for SEO | Must wait for all data to load before responding |
|
|
20
|
+
| **Streaming SSR** | Renders and returns progressively, faster first screen | JS bundle size is still large |
|
|
21
|
+
| **Streaming SSR + RSC** | Reduces client JS size | - |
|
|
22
|
+
|
|
23
|
+
## How to Choose
|
|
24
|
+
|
|
25
|
+
### Quick Decision Guide
|
|
26
|
+
|
|
27
|
+
- **Static Content + SEO Required** → **SSG**
|
|
28
|
+
- **SEO Required + First Screen Performance** → **Streaming SSR** (default)
|
|
29
|
+
- **Pursuing Optimal Performance** → **Streaming SSR + RSC**
|
|
30
|
+
- **CSR Project Gradual Optimization** → **CSR + RSC**
|
|
31
|
+
- **Highly Interactive + No SEO Needed** → **CSR**
|
|
32
|
+
|
|
33
|
+
### Combining Modes
|
|
34
|
+
|
|
35
|
+
Modern.js supports combining multiple rendering modes:
|
|
36
|
+
|
|
37
|
+
- **Streaming SSR + RSC**: Streaming rendering + reduced client-side code
|
|
38
|
+
- **SSG + SSR**: Some pages static, some pages dynamic
|
|
39
|
+
- **CSR + RSC**: Client-side rendering + partial Server Components
|
|
40
|
+
|
|
41
|
+
## Related Documentation
|
|
42
|
+
|
|
43
|
+
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr.md)
|
|
44
|
+
- [Streaming Server-Side Rendering (Streaming SSR)](/guides/basic-features/render/streaming-ssr.md)
|
|
45
|
+
- [React Server Components (RSC)](/guides/basic-features/render/rsc.md)
|
|
46
|
+
- [Static Site Generation (SSG)](/guides/basic-features/render/ssg.md)
|
|
47
|
+
- [Rendering Cache](/guides/basic-features/render/ssr-cache.md)
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: React Server Components (RSC)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
# React Server Components (RSC)
|
|
6
2
|
|
|
7
3
|
React Server Components (RSC) is a new component type that allows components to be rendered in a server environment, bringing better performance and developer experience to modern web applications.
|
|
@@ -36,7 +32,7 @@ npm install react-server-dom-rspack@0.0.2
|
|
|
36
32
|
|
|
37
33
|
:::
|
|
38
34
|
|
|
39
|
-
3. Set [`server.rsc`](/configure/app/server/rsc) to `true`:
|
|
35
|
+
3. Set [`server.rsc`](/configure/app/server/rsc.md) to `true`:
|
|
40
36
|
|
|
41
37
|
```ts title="modern.config.ts"
|
|
42
38
|
import { defineConfig } from '@modern-js/app-tools';
|
|
@@ -235,16 +231,16 @@ For example, if `layout.tsx` is a Client Component (requiring client-side intera
|
|
|
235
231
|
|
|
236
232
|
## Server Component and Data Loader
|
|
237
233
|
|
|
238
|
-
In RSC projects, you have two ways to fetch data: directly in Server Components, or using [Data Loader](/guides/basic-features/data/data-fetch). Both approaches have their advantages, and you can choose flexibly based on your scenario.
|
|
234
|
+
In RSC projects, you have two ways to fetch data: directly in Server Components, or using [Data Loader](/guides/basic-features/data/data-fetch.md). Both approaches have their advantages, and you can choose flexibly based on your scenario.
|
|
239
235
|
|
|
240
236
|
### Comparison of Two Data Fetching Approaches
|
|
241
237
|
|
|
242
|
-
| Feature
|
|
243
|
-
|
|
|
244
|
-
| Avoid Request Waterfall | Requires manual optimization
|
|
245
|
-
| Component Cohesion
|
|
246
|
-
| Maintainability
|
|
247
|
-
| Type Safety
|
|
238
|
+
| Feature | Fetching in Server Component | Fetching in Data Loader |
|
|
239
|
+
| ----------------------- | ----------------------------------- | ---------------------------------------- |
|
|
240
|
+
| Avoid Request Waterfall | Requires manual optimization | ✅ Automatically parallel execution |
|
|
241
|
+
| Component Cohesion | ✅ Data and UI in the same place | Data logic separated into separate files |
|
|
242
|
+
| Maintainability | ✅ Easier to understand and maintain | Requires maintaining additional files |
|
|
243
|
+
| Type Safety | ✅ Natural type inference | Requires manual type management |
|
|
248
244
|
|
|
249
245
|
**Generally, we recommend fetching data in Server Components**, because waterfall requests have less performance impact on the server, and this approach makes components more cohesive, with data fetching logic and UI rendering in the same place, making it easier to understand and maintain. However, if your page has multiple independent data sources and you want to completely avoid request waterfall issues, Data Loader's parallel execution feature will be more advantageous.
|
|
250
246
|
|
|
@@ -389,7 +385,7 @@ function NonCriticalUI({ p }: { p: Promise<string> }) {
|
|
|
389
385
|
|
|
390
386
|
1. Whether it's an SSR or RSC project, it's recommended to use the `cache` function provided by Modern.js for data fetching logic executed on the server by default. This ensures that for each server-side render, no matter how many times the function is called, it will only execute once.
|
|
391
387
|
|
|
392
|
-
> This is also the recommended usage by React.js, which provides the [cache](https://react.dev/reference/react/cache) function. Modern.js's [cache](/guides/basic-features/data/data-cache.
|
|
388
|
+
> This is also the recommended usage by React.js, which provides the [cache](https://react.dev/reference/react/cache) function. Modern.js's [cache](/guides/basic-features/data/data-cache.md) can be considered a superset of it.
|
|
393
389
|
|
|
394
390
|
```typescript
|
|
395
391
|
import { cache } from '@modern-js/runtime/cache';
|
|
@@ -513,10 +509,6 @@ export default function ProfilePage() {
|
|
|
513
509
|
|
|
514
510
|
When using React 19, you no longer need to use Helmet. We recommend directly using the [components](https://react.dev/reference/react-dom/components) provided by React.
|
|
515
511
|
|
|
516
|
-
import DeployTip from '@site-docs/components/rsc-deploy-tip';
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
<DeployTip />
|
|
520
512
|
|
|
521
513
|
## Common Issues
|
|
522
514
|
|
|
@@ -528,6 +520,6 @@ The project's bundle has introduced a non-19 React version, commonly seen in mon
|
|
|
528
520
|
|
|
529
521
|
- [React Server Components Official Documentation](https://react.dev/reference/rsc/server-components)
|
|
530
522
|
- [React Server Functions Documentation](https://react.dev/reference/rsc/server-functions)
|
|
531
|
-
- [Data Cache](/guides/basic-features/data/data-cache)
|
|
532
|
-
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr)
|
|
533
|
-
- [Streaming SSR](/guides/basic-features/render/streaming-ssr)
|
|
523
|
+
- [Data Cache](/guides/basic-features/data/data-cache.md)
|
|
524
|
+
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr.md)
|
|
525
|
+
- [Streaming SSR](/guides/basic-features/render/streaming-ssr.md)
|
|
@@ -1,15 +1,58 @@
|
|
|
1
|
-
---
|
|
2
|
-
---
|
|
3
|
-
|
|
4
1
|
# Static Site Generation
|
|
5
2
|
|
|
6
3
|
SSG (Static Site Generation) is a technical solution that generates complete static web pages at build time based on data and templates. This means that in a production environment, pages are pre-rendered with content and can be cached by a CDN. SSG can offer better performance and higher security for pages that do not require dynamic data.
|
|
7
4
|
|
|
8
5
|
## Enabling SSG
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
To enable SSG functionality in a Modern.js project, follow these steps to modify the code:
|
|
8
|
+
|
|
9
|
+
1. Install SSG plugin dependencies
|
|
10
|
+
|
|
11
|
+
If the SSG plugin is not yet installed in your project, install it first:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @modern-js/plugin-ssg
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
:::tip Version Consistency
|
|
18
|
+
|
|
19
|
+
Make sure the version of `@modern-js/plugin-ssg` matches the version of `@modern-js/app-tools` in your project. All Modern.js official packages are released with a uniform version number, and version mismatches may cause compatibility issues.
|
|
20
|
+
|
|
21
|
+
Check the version of `@modern-js/app-tools` first, then install the same version of `@modern-js/plugin-ssg`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Check the current version of @modern-js/app-tools
|
|
25
|
+
pnpm list @modern-js/app-tools
|
|
26
|
+
|
|
27
|
+
# Install the same version of @modern-js/plugin-ssg
|
|
28
|
+
pnpm add @modern-js/plugin-ssg@<version>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
2. Configure modern.config.ts
|
|
11
34
|
|
|
12
|
-
|
|
35
|
+
Import and add the SSG plugin in the `modern.config.ts` file, and configure `output.ssg`:
|
|
36
|
+
|
|
37
|
+
```ts title="modern.config.ts"
|
|
38
|
+
import { defineConfig, appTools } from '@modern-js/app-tools';
|
|
39
|
+
import { ssgPlugin } from '@modern-js/plugin-ssg';
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
plugins: [appTools(), ssgPlugin()],
|
|
43
|
+
output: {
|
|
44
|
+
ssg: true,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
:::info Scope of Application
|
|
50
|
+
|
|
51
|
+
- Use `output.ssg` for single-entry apps.
|
|
52
|
+
- Use `output.ssgByEntries` for multi-entry apps.
|
|
53
|
+
- When only `output.ssg: true` is set and `output.ssgByEntries` is not configured, all routes under all entries will be treated as SSG routes.
|
|
54
|
+
|
|
55
|
+
:::
|
|
13
56
|
|
|
14
57
|
## Development Debugging
|
|
15
58
|
|
|
@@ -50,7 +93,7 @@ The above file directory will generate the following three routes:
|
|
|
50
93
|
- `/user/profile`
|
|
51
94
|
|
|
52
95
|
:::tip
|
|
53
|
-
If you are not familiar with the rules of conventional routing, refer to the [Routing Solution](/guides/basic-features/routes/routes) first.
|
|
96
|
+
If you are not familiar with the rules of conventional routing, refer to the [Routing Solution](/guides/basic-features/routes/routes.md) first.
|
|
54
97
|
|
|
55
98
|
:::
|
|
56
99
|
|
|
@@ -76,9 +119,27 @@ After running `pnpm run serve` to start the project, inspect the returned docume
|
|
|
76
119
|
|
|
77
120
|
For example, consider the following code with multiple routes. By setting `output.ssg` to `true`, it will only render the entry route (`/`) by default.
|
|
78
121
|
|
|
79
|
-
|
|
122
|
+
```tsx title="src/App.tsx"
|
|
123
|
+
import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
|
|
124
|
+
import { StaticRouter } from '@modern-js/runtime/router/server';
|
|
125
|
+
import { use } from 'react';
|
|
126
|
+
import { RuntimeContext } from '@modern-js/runtime';
|
|
80
127
|
|
|
81
|
-
|
|
128
|
+
const Router = typeof window === 'undefined' ? StaticRouter : BrowserRouter;
|
|
129
|
+
|
|
130
|
+
export default () => {
|
|
131
|
+
const context = use(RuntimeContext);
|
|
132
|
+
const pathname = context?.request?.pathname;
|
|
133
|
+
return (
|
|
134
|
+
<Router location={pathname}>
|
|
135
|
+
<Routes>
|
|
136
|
+
<Route index element={<div>index</div>} />
|
|
137
|
+
<Route path="about" element={<div>about</div>} />
|
|
138
|
+
</Routes>
|
|
139
|
+
</Router>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
```
|
|
82
143
|
|
|
83
144
|
If you want to enable SSG for `/about` as well, you can configure `output.ssg`:
|
|
84
145
|
|
|
@@ -97,7 +158,7 @@ After running `pnpm run build`, you will see a new `main/about/index.html` file
|
|
|
97
158
|
After running `pnpm run serve` to start the project, inspect the returned document in the Network tab of the browser's development tools. The document includes the fully rendered content from the component.
|
|
98
159
|
|
|
99
160
|
:::info
|
|
100
|
-
The above example introduces single-entry scenarios. For more information, refer to the [API Documentation](/configure/app/output/ssg).
|
|
161
|
+
The above example introduces single-entry scenarios. For more information, refer to the [API Documentation](/configure/app/output/ssg.md).
|
|
101
162
|
:::
|
|
102
163
|
|
|
103
164
|
## Adding Dynamic Routes
|
|
@@ -132,7 +193,7 @@ export default defineConfig({
|
|
|
132
193
|
```
|
|
133
194
|
|
|
134
195
|
:::info
|
|
135
|
-
See API details: [output.ssgByEntries](/configure/app/output/ssgByEntries)
|
|
196
|
+
See API details: [output.ssgByEntries](/configure/app/output/ssgByEntries.md)
|
|
136
197
|
:::
|
|
137
198
|
|
|
138
199
|
## Configuring Request Headers for Rendering
|
|
@@ -193,9 +193,9 @@ When rendering cache is enabled, Modern.js identifies the cache status of the cu
|
|
|
193
193
|
|
|
194
194
|
The `x-render-cache` header can have the following values:
|
|
195
195
|
|
|
196
|
-
| Name | Description
|
|
197
|
-
| ------- |
|
|
198
|
-
| hit | Cache hit, returned cache content
|
|
196
|
+
| Name | Description |
|
|
197
|
+
| ------- | ----------------------------------------------------------------------------------- |
|
|
198
|
+
| hit | Cache hit, returned cache content |
|
|
199
199
|
| stale | Cache hit, but data is stale, returned cache content and re-rendered asynchronously |
|
|
200
|
-
| expired | Cache expired, re-rendered and returned new content
|
|
201
|
-
| miss | Cache missed
|
|
200
|
+
| expired | Cache expired, re-rendered and returned new content |
|
|
201
|
+
| miss | Cache missed |
|
|
@@ -11,7 +11,7 @@ Server-Side Rendering (SSR) generates complete HTML pages on the server and send
|
|
|
11
11
|
:::info Default Rendering Mode
|
|
12
12
|
Modern.js SSR **uses streaming rendering (Streaming SSR) by default**, allowing pages to be returned progressively as they render, so users can see initial content faster.
|
|
13
13
|
|
|
14
|
-
For detailed usage, refer to the [Streaming SSR](/guides/basic-features/render/streaming-ssr) documentation.
|
|
14
|
+
For detailed usage, refer to the [Streaming SSR](/guides/basic-features/render/streaming-ssr.md) documentation.
|
|
15
15
|
|
|
16
16
|
To switch to traditional SSR mode (waiting for all data to load before returning at once), you can configure:
|
|
17
17
|
|
|
@@ -31,7 +31,7 @@ export default defineConfig({
|
|
|
31
31
|
|
|
32
32
|
## Enabling SSR
|
|
33
33
|
|
|
34
|
-
Enabling SSR in Modern.js is straightforward. Simply set [`server.ssr`](/configure/app/server/ssr) to `true`:
|
|
34
|
+
Enabling SSR in Modern.js is straightforward. Simply set [`server.ssr`](/configure/app/server/ssr.md) to `true`:
|
|
35
35
|
|
|
36
36
|
```ts title="modern.config.ts"
|
|
37
37
|
import { defineConfig } from '@modern-js/app-tools';
|
|
@@ -48,7 +48,7 @@ export default defineConfig({
|
|
|
48
48
|
Modern.js provides Data Loader, enabling developers to fetch data isomorphically under both SSR and CSR. Each route module (such as `layout.tsx` and `page.tsx`) can define its own Data Loader:
|
|
49
49
|
|
|
50
50
|
:::tip Learn More
|
|
51
|
-
The following approach will not have streaming rendering effects. To achieve streaming rendering effects, refer to [Streaming SSR](/guides/basic-features/render/streaming-ssr).
|
|
51
|
+
The following approach will not have streaming rendering effects. To achieve streaming rendering effects, refer to [Streaming SSR](/guides/basic-features/render/streaming-ssr.md).
|
|
52
52
|
|
|
53
53
|
:::
|
|
54
54
|
|
|
@@ -105,11 +105,10 @@ In Modern.js, if an application encounters an error during SSR, it automatically
|
|
|
105
105
|
|
|
106
106
|
By default, if the `loader` function for a route throws an error, the framework renders the `<ErrorBoundary>` component directly on the server, displaying the error message. This is the default behavior of most frameworks.
|
|
107
107
|
|
|
108
|
-
Modern.js also supports customizing the fallback strategy through the `loaderFailureMode` field in the [`server.ssr`](/configure/app/server/ssr) configuration. Setting this field to `clientRender` immediately falls back to CSR mode and re-fetches the data.
|
|
108
|
+
Modern.js also supports customizing the fallback strategy through the `loaderFailureMode` field in the [`server.ssr`](/configure/app/server/ssr.md) configuration. Setting this field to `clientRender` immediately falls back to CSR mode and re-fetches the data.
|
|
109
109
|
|
|
110
110
|
If a Client Loader is defined for the route, it will be used to re-fetch the data. If re-rendering fails again, the `<ErrorBoundary>` component will be displayed.
|
|
111
111
|
|
|
112
|
-
{/* Todo Add a diagram */}
|
|
113
112
|
|
|
114
113
|
### Component Rendering Error
|
|
115
114
|
|
|
@@ -141,17 +140,16 @@ In this case, Modern.js will fallback the page to CSR and use the existing data
|
|
|
141
140
|
The behavior of component rendering errors is unaffected by `loaderFailureMode` and will not execute the Client Loader on the browser side.
|
|
142
141
|
:::
|
|
143
142
|
|
|
144
|
-
{/* Todo Add a diagram */}
|
|
145
143
|
|
|
146
144
|
## Logging and Monitoring
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
:::tip
|
|
147
|
+
SSR monitoring has been integrated into the Monitors module, see [Monitors](/guides/advanced-features/server-monitor/monitors.md) for details.
|
|
148
|
+
:::
|
|
151
149
|
|
|
152
150
|
## Page Caching
|
|
153
151
|
|
|
154
|
-
Modern.js has built-in caching capabilities. Refer to [Rendering Cache](/guides/basic-features/render/ssr-cache) for details.
|
|
152
|
+
Modern.js has built-in caching capabilities. Refer to [Rendering Cache](/guides/basic-features/render/ssr-cache.md) for details.
|
|
155
153
|
|
|
156
154
|
## Differences in Runtime Environment
|
|
157
155
|
|
|
@@ -202,7 +200,7 @@ if (true) {
|
|
|
202
200
|
```
|
|
203
201
|
|
|
204
202
|
:::note
|
|
205
|
-
For more information, see [Environment Variables](/guides/basic-features/env-vars).
|
|
203
|
+
For more information, see [Environment Variables](/guides/basic-features/env-vars.md).
|
|
206
204
|
:::
|
|
207
205
|
|
|
208
206
|
### Side Effects in Dependencies
|
|
@@ -291,7 +289,7 @@ Wrap elements that should not be server-side rendered with the `NoSSR` component
|
|
|
291
289
|
|
|
292
290
|
After modifying the code, refresh the page and notice that the previous warning has disappeared. Open the browser's developer tools and check the Network tab. The returned HTML document will not contain the content wrapped by the `NoSSR` component.
|
|
293
291
|
|
|
294
|
-
In practical scenarios, some UI displays might be affected by the user's device, such as [UA](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) information. Modern.js also provides APIs like `use(RuntimeContext)`, allowing components to access complete request information and maintaining SSR and CSR rendering consistency. For detailed usage, please refer to [Runtime Context](/guides/basic-features/render/before-render#runtime-context).
|
|
292
|
+
In practical scenarios, some UI displays might be affected by the user's device, such as [UA](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) information. Modern.js also provides APIs like `use(RuntimeContext)`, allowing components to access complete request information and maintaining SSR and CSR rendering consistency. For detailed usage, please refer to [Runtime Context](/guides/basic-features/render/before-render.md#runtime-context).
|
|
295
293
|
|
|
296
294
|
### Attention to Memory Leaks
|
|
297
295
|
|
|
@@ -7,7 +7,7 @@ In traditional SSR rendering, the page is rendered all at once, requiring all da
|
|
|
7
7
|
:::info Default Mode
|
|
8
8
|
**Streaming SSR is the default rendering mode for Modern.js SSR**. When you enable SSR, streaming rendering is available without additional configuration.
|
|
9
9
|
|
|
10
|
-
If you need to switch to traditional SSR mode (waiting for all data to load before returning at once), you can configure `server.ssr.mode` to `'string'`. For detailed information, refer to the [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr) documentation.
|
|
10
|
+
If you need to switch to traditional SSR mode (waiting for all data to load before returning at once), you can configure `server.ssr.mode` to `'string'`. For detailed information, refer to the [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr.md) documentation.
|
|
11
11
|
:::
|
|
12
12
|
|
|
13
13
|
Compared to traditional SSR rendering:
|
|
@@ -254,14 +254,11 @@ export const middleware = async (ctx, next) => {
|
|
|
254
254
|
};
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
import StreamSSRPerformance from '@site-docs-en/components/stream-ssr-performance';
|
|
258
|
-
|
|
259
|
-
<StreamSSRPerformance />
|
|
260
257
|
|
|
261
258
|
## Related Documentation
|
|
262
259
|
|
|
263
|
-
- [Rendering Mode Overview](/guides/basic-features/render/overview)
|
|
264
|
-
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr)
|
|
265
|
-
- [Rendering Cache](/guides/basic-features/render/ssr-cache)
|
|
266
|
-
- [React Server Components (RSC)](/guides/basic-features/render/rsc) - Use with Streaming SSR
|
|
260
|
+
- [Rendering Mode Overview](/guides/basic-features/render/overview.md)
|
|
261
|
+
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr.md)
|
|
262
|
+
- [Rendering Cache](/guides/basic-features/render/ssr-cache.md)
|
|
263
|
+
- [React Server Components (RSC)](/guides/basic-features/render/rsc.md) - Use with Streaming SSR
|
|
267
264
|
- [New Suspense SSR Architecture in React 18](https://github.com/reactwg/react-18/discussions/37) - React 18 Architecture Overview
|