@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.99 → 3.8.1-ultramodern.2
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/builder/generator/getBuilderEnvironments.js +73 -11
- package/dist/cjs/bundleDocs.js +114 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +1 -1
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +94 -18
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +109 -57
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +63 -10
- package/dist/esm/bundleDocs.mjs +62 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +63 -10
- package/dist/esm-node/bundleDocs.mjs +63 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
- package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +29 -0
- package/dist/types/bundleDocs.d.ts +20 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +13 -0
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +1 -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} +16 -22
- 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.md +22 -0
- 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} +16 -33
- 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} +38 -31
- package/docs/guides/get-started/{upgrade.mdx → upgrade.md} +26 -22
- 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 +33 -15
- 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/rsc.mdx +0 -30
- 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,131 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 3
|
|
3
|
-
title: Runtime Framework
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Runtime Framework
|
|
7
|
-
|
|
8
|
-
Modern.js supports two BFF runtime frameworks:
|
|
9
|
-
|
|
10
|
-
- `effect` (default): use [Effect HttpApi](https://effect.website/) runtime from `api/index`.
|
|
11
|
-
- `hono`: use file-convention BFF handlers from `api/lambda/**`.
|
|
12
|
-
|
|
13
|
-
`effect` and `hono` are strict runtime modes. There is no automatic fallback between them.
|
|
14
|
-
|
|
15
|
-
::::info
|
|
16
|
-
This page documents generic Modern.js runtime support. Generated UltraModern
|
|
17
|
-
workspaces always use the `effect` runtime with
|
|
18
|
-
`bff.effect.strictEffectApproach: true`. Add or change generated UltraModern
|
|
19
|
-
HTTP API work through `shared/api.ts` and `api/index.ts`; do not add
|
|
20
|
-
Hono/file-convention handlers, raw request parsing, or manual `Response`
|
|
21
|
-
construction inside those workspaces.
|
|
22
|
-
::::
|
|
23
|
-
|
|
24
|
-
## Switch to Effect runtime
|
|
25
|
-
|
|
26
|
-
```ts title="modern.config.ts"
|
|
27
|
-
import { bffPlugin } from '@modern-js/plugin-bff';
|
|
28
|
-
import { defineConfig } from '@modern-js/app-tools';
|
|
29
|
-
|
|
30
|
-
export default defineConfig({
|
|
31
|
-
plugins: [bffPlugin()],
|
|
32
|
-
bff: {
|
|
33
|
-
runtimeFramework: 'effect',
|
|
34
|
-
effect: {
|
|
35
|
-
entry: './api/index',
|
|
36
|
-
strictEffectApproach: true,
|
|
37
|
-
openapi: {
|
|
38
|
-
path: '/openapi.json',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Define a shared Effect HttpApi contract (for type-safe client + server):
|
|
46
|
-
|
|
47
|
-
```ts title="shared/api.ts"
|
|
48
|
-
import {
|
|
49
|
-
HttpApi,
|
|
50
|
-
HttpApiEndpoint,
|
|
51
|
-
HttpApiGroup,
|
|
52
|
-
Schema,
|
|
53
|
-
} from '@modern-js/plugin-bff/effect-client';
|
|
54
|
-
|
|
55
|
-
export const bffApi = HttpApi.make('MyApi').add(
|
|
56
|
-
HttpApiGroup.make('hello').add(
|
|
57
|
-
HttpApiEndpoint.get('ping', '/ping', {
|
|
58
|
-
success: Schema.String,
|
|
59
|
-
}),
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Implement your Effect API entry at `api/index.ts`:
|
|
65
|
-
|
|
66
|
-
```ts title="api/index.ts"
|
|
67
|
-
import {
|
|
68
|
-
Schema,
|
|
69
|
-
Effect,
|
|
70
|
-
HttpApiBuilder,
|
|
71
|
-
defineEffectBff,
|
|
72
|
-
Layer,
|
|
73
|
-
ServiceMap,
|
|
74
|
-
} from '@modern-js/plugin-bff/effect-server';
|
|
75
|
-
import { bffApi } from '../shared/api';
|
|
76
|
-
|
|
77
|
-
class GreetingUnavailableError extends Schema.TaggedError<GreetingUnavailableError>()(
|
|
78
|
-
'GreetingUnavailableError',
|
|
79
|
-
{
|
|
80
|
-
message: Schema.String,
|
|
81
|
-
},
|
|
82
|
-
) {}
|
|
83
|
-
|
|
84
|
-
class GreetingService extends ServiceMap.Service<GreetingService>()('GreetingService', {
|
|
85
|
-
make: Effect.succeed({
|
|
86
|
-
hello: Effect.fn('GreetingService.hello')(function* () {
|
|
87
|
-
if (Date.now() < 0) {
|
|
88
|
-
return yield* Effect.fail(
|
|
89
|
-
new GreetingUnavailableError({
|
|
90
|
-
message: 'Greeting service is unavailable',
|
|
91
|
-
}),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
return yield* Effect.succeed('pong');
|
|
95
|
-
}),
|
|
96
|
-
}),
|
|
97
|
-
}) {
|
|
98
|
-
static readonly layer = Layer.effect(this, this.make);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const group = HttpApiBuilder.group(bffApi, 'hello', handlers =>
|
|
102
|
-
handlers.handle('ping', () =>
|
|
103
|
-
GreetingService.use(service => service.hello()).pipe(
|
|
104
|
-
Effect.catchTag('GreetingUnavailableError', error =>
|
|
105
|
-
Effect.succeed(error.message),
|
|
106
|
-
),
|
|
107
|
-
),
|
|
108
|
-
),
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const layer = HttpApiBuilder.layer(bffApi).pipe(
|
|
112
|
-
Layer.provide(group),
|
|
113
|
-
Layer.provide(GreetingService.layer),
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
export default defineEffectBff({ api: bffApi, layer });
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Call Effect endpoints from browser code via `@api/index`:
|
|
120
|
-
|
|
121
|
-
```ts title="src/routes/page.tsx"
|
|
122
|
-
import api from '@api/index';
|
|
123
|
-
|
|
124
|
-
const response = await api.client.hello.ping({});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
The `api.client.*` surface is materialized by the BFF loader for `@api/index` imports. Do not import `api/index` directly and expect `client` to run in server code, scripts, or tests; direct entry imports expose the server runtime definition, and `client` is only a typed placeholder there.
|
|
128
|
-
|
|
129
|
-
import Hono from '@site-docs-en/components/hono';
|
|
130
|
-
|
|
131
|
-
<Hono />
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Configuration
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Configuration
|
|
6
|
-
|
|
7
|
-
Plugin configuration is split between two files, each with a different responsibility:
|
|
8
|
-
|
|
9
|
-
| File | Purpose |
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| `modern.config.ts` | Basic plugin settings, read during build/startup |
|
|
12
|
-
| `src/modern.runtime.ts` | i18next initialization options, read at runtime |
|
|
13
|
-
|
|
14
|
-
:::warning Function values can only be configured at runtime
|
|
15
|
-
`modern.config.ts` runs at build time and cannot serialize functions. SDK loaders, custom detection functions, and similar function values must be placed in `modern.runtime.ts`.
|
|
16
|
-
:::
|
|
17
|
-
|
|
18
|
-
## Configuration Ownership
|
|
19
|
-
|
|
20
|
-
| Configuration | Where to configure |
|
|
21
|
-
| --- | --- |
|
|
22
|
-
| `localeDetection` (language detection, path redirects, etc.) | `modern.config.ts` |
|
|
23
|
-
| `backend` (resource paths, SDK declaration, etc.) | `modern.config.ts` |
|
|
24
|
-
| `i18nInstance` | `modern.runtime.ts` |
|
|
25
|
-
| `initOptions` (`fallbackLng`, `ns`, and other i18next options) | `modern.runtime.ts` |
|
|
26
|
-
| The actual `backend.sdk` loader function | `modern.runtime.ts` |
|
|
27
|
-
|
|
28
|
-
## CLI Configuration
|
|
29
|
-
|
|
30
|
-
```ts title="modern.config.ts"
|
|
31
|
-
import { appTools, defineConfig } from '@modern-js/app-tools';
|
|
32
|
-
import { i18nPlugin } from '@modern-js/plugin-i18n';
|
|
33
|
-
|
|
34
|
-
export default defineConfig({
|
|
35
|
-
plugins: [
|
|
36
|
-
appTools(),
|
|
37
|
-
i18nPlugin({
|
|
38
|
-
localeDetection: { ... },
|
|
39
|
-
backend: { ... },
|
|
40
|
-
}),
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### localeDetection Options
|
|
46
|
-
|
|
47
|
-
| Field | Type | Default | Description |
|
|
48
|
-
| --- | --- | --- | --- |
|
|
49
|
-
| `languages` | `string[]` | `[]` | Supported language list |
|
|
50
|
-
| `fallbackLanguage` | `string` | `''` | Fallback language when detection fails |
|
|
51
|
-
| `localePathRedirect` | `boolean` | `false` | Handles URL locale prefix recognition, redirects, and switching. See [Routing Integration](./routing.md#enable-locale-path-prefixes) |
|
|
52
|
-
| `localisedUrls` | `boolean \| Record<string, Record<string, string>>` | Prefix-only behavior | Localised route path map. Only a non-empty map enables translated path segments; omitted, `true`, `false`, and `{}` keep locale prefixes without translating path segments. |
|
|
53
|
-
| `i18nextDetector` | `boolean` | `false` | Enables the i18next detector (Cookie / Header, etc.) |
|
|
54
|
-
| `detection` | `LanguageDetectorOptions` | - | Detailed i18next detector configuration. See [Locale Detection](./locale-detection.md) |
|
|
55
|
-
| `ignoreRedirectRoutes` | `string[] \| Function` | - | Routes that skip redirects. See [Locale Detection](./locale-detection.md#ignoreredirectroutes) |
|
|
56
|
-
| `localeDetectionByEntry` | `Record<string, ...>` | - | Per-entry overrides for multiple entries |
|
|
57
|
-
|
|
58
|
-
**Example:**
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
i18nPlugin({
|
|
62
|
-
localeDetection: {
|
|
63
|
-
localePathRedirect: true,
|
|
64
|
-
i18nextDetector: true,
|
|
65
|
-
languages: ['zh', 'en', 'ja'],
|
|
66
|
-
fallbackLanguage: 'en',
|
|
67
|
-
detection: {
|
|
68
|
-
order: ['path', 'cookie', 'header'],
|
|
69
|
-
lookupCookie: 'i18next',
|
|
70
|
-
caches: ['cookie'],
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### backend Options
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
interface BackendOptions {
|
|
80
|
-
// Whether to enable backend resource loading.
|
|
81
|
-
// Automatically enabled when loadPath/addPath is configured, or when a locales directory exists.
|
|
82
|
-
enabled?: boolean;
|
|
83
|
-
|
|
84
|
-
// Decides which URL or local file to request for translations. Supports {{lng}} and {{ns}}.
|
|
85
|
-
// Default: '/locales/{{lng}}/{{ns}}.json'
|
|
86
|
-
loadPath?: string;
|
|
87
|
-
|
|
88
|
-
// Path for reporting missing translations (optional).
|
|
89
|
-
addPath?: string;
|
|
90
|
-
|
|
91
|
-
// Enables the custom backend SDK. The actual loader is provided in runtime config.
|
|
92
|
-
sdk?: boolean | string;
|
|
93
|
-
|
|
94
|
-
// Cache strategy for chained backend mode, effective when both loadPath and sdk are configured.
|
|
95
|
-
// 'none' - use local files and do not request the custom backend after a hit
|
|
96
|
-
// 'refresh' - continue requesting the custom backend and update cache, but not the page
|
|
97
|
-
// 'refreshAndUpdateStore' - continue requesting and update page text as well (default)
|
|
98
|
-
cacheHitMode?: 'none' | 'refresh' | 'refreshAndUpdateStore';
|
|
99
|
-
|
|
100
|
-
// Per-entry overrides for multiple-entry scenarios.
|
|
101
|
-
backendOptionsByEntry?: Record<string, BaseBackendOptions>;
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**About the `sdk` field:** In `modern.config.ts`, set it to `true` to declare that the SDK backend is enabled. Provide the actual loader in `initOptions.backend.sdk` in `modern.runtime.ts`. See [Resource Loading -> Custom Backend](./resource-loading.md#custom-backend).
|
|
106
|
-
|
|
107
|
-
**backend auto-enable rules:**
|
|
108
|
-
|
|
109
|
-
| Situation | Result |
|
|
110
|
-
| --- | --- |
|
|
111
|
-
| `loadPath` or `addPath` is configured | Automatically enabled. No need to write `enabled: true` |
|
|
112
|
-
| No backend is configured, but a `locales` directory exists and contains JSON files | Automatically enabled with the default `loadPath` |
|
|
113
|
-
| `enabled: false` is set explicitly | Disabled, and auto-detection is skipped |
|
|
114
|
-
|
|
115
|
-
Auto-detected directory locations, in priority order:
|
|
116
|
-
|
|
117
|
-
1. `{project root}/config/public/locales`
|
|
118
|
-
2. The `locales` subdirectory under the directory configured by `server.publicDir`
|
|
119
|
-
|
|
120
|
-
**Which backend should you choose?**
|
|
121
|
-
|
|
122
|
-
| Scenario | Recommended approach |
|
|
123
|
-
| --- | --- |
|
|
124
|
-
| Translation files are local to the project | Static file backend (configure `loadPath`; CSR/SSR switch automatically) |
|
|
125
|
-
| Translations come from a remote API or translation platform | Custom backend (configure `sdk: true`) |
|
|
126
|
-
| Local fallback + remote real-time updates | Chained backend (configure both `loadPath` and `sdk`) |
|
|
127
|
-
|
|
128
|
-
See [Resource Loading](./resource-loading.md) for detailed usage.
|
|
129
|
-
|
|
130
|
-
## Runtime Configuration
|
|
131
|
-
|
|
132
|
-
```ts title="src/modern.runtime.ts"
|
|
133
|
-
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
134
|
-
import i18next from 'i18next';
|
|
135
|
-
|
|
136
|
-
const i18nInstance = i18next.createInstance();
|
|
137
|
-
|
|
138
|
-
export default defineRuntimeConfig({
|
|
139
|
-
i18n: {
|
|
140
|
-
i18nInstance, // Optional. An isolated instance is recommended.
|
|
141
|
-
initOptions: {
|
|
142
|
-
fallbackLng: 'en',
|
|
143
|
-
supportedLngs: ['zh', 'en'],
|
|
144
|
-
ns: ['translation'],
|
|
145
|
-
defaultNS: 'translation',
|
|
146
|
-
interpolation: {
|
|
147
|
-
escapeValue: false, // React already escapes text; disable this to avoid double escaping.
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### i18nInstance Configuration
|
|
155
|
-
|
|
156
|
-
If you need to use a custom i18n instance, provide it in the runtime configuration:
|
|
157
|
-
|
|
158
|
-
import CustomInstanceCode from '@site-docs/components/international/custom-instance-code';
|
|
159
|
-
|
|
160
|
-
<CustomInstanceCode />
|
|
161
|
-
|
|
162
|
-
### initOptions
|
|
163
|
-
|
|
164
|
-
import Desc from '@site-docs/components/international/init-options-desc';
|
|
165
|
-
|
|
166
|
-
<Desc />
|
|
167
|
-
|
|
168
|
-
| Field | Description |
|
|
169
|
-
| --- | --- |
|
|
170
|
-
| `fallbackLng` | Which language resources i18next falls back to when a translation key is missing. Supports strings, arrays, and maps (fallback chains) |
|
|
171
|
-
| `supportedLngs` | Language list supported by i18next |
|
|
172
|
-
| `ns` | Namespace list. Default is `['translation']` |
|
|
173
|
-
| `defaultNS` | Default namespace. Default is `'translation'` |
|
|
174
|
-
| `lng` | Forces the initial language. Usually not needed because the detector decides it |
|
|
175
|
-
|
|
176
|
-
`fallbackLng` supports fallback chains, which are useful for regional language degradation:
|
|
177
|
-
|
|
178
|
-
```ts
|
|
179
|
-
initOptions: {
|
|
180
|
-
lng: 'zh-CN',
|
|
181
|
-
fallbackLng: {
|
|
182
|
-
'zh-CN': ['zh', 'en'], // If zh-CN is missing, try zh first, then en.
|
|
183
|
-
default: ['en'],
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Custom Backend Function Configuration
|
|
189
|
-
|
|
190
|
-
The actual loader function for a custom backend must be provided in runtime configuration:
|
|
191
|
-
|
|
192
|
-
```ts
|
|
193
|
-
// modern.config.ts: only declare that it is enabled.
|
|
194
|
-
i18nPlugin({
|
|
195
|
-
backend: { sdk: true },
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// modern.runtime.ts: provide the actual function.
|
|
199
|
-
import type { I18nSdkLoader } from '@modern-js/plugin-i18n/runtime';
|
|
200
|
-
|
|
201
|
-
const myLoader: I18nSdkLoader = async options => {
|
|
202
|
-
if (options.lng && options.ns) {
|
|
203
|
-
const res = await fetch(`/api/i18n/${options.lng}/${options.ns}`);
|
|
204
|
-
return res.json();
|
|
205
|
-
}
|
|
206
|
-
return {};
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export default defineRuntimeConfig({
|
|
210
|
-
i18n: {
|
|
211
|
-
initOptions: {
|
|
212
|
-
backend: { sdk: myLoader },
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
For complete usage, see [Resource Loading -> Custom Backend](./resource-loading.md#custom-backend).
|
|
219
|
-
|
|
220
|
-
## Multiple Entries
|
|
221
|
-
|
|
222
|
-
Multiple-entry projects can override configuration per entry. See [Advanced Usage -> Multiple Entries](./advanced.md#multiple-entries).
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Internationalization
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Internationalization
|
|
6
|
-
|
|
7
|
-
import I18nPluginIntroduce from '@site-docs/components/international/introduce';
|
|
8
|
-
|
|
9
|
-
<I18nPluginIntroduce />
|
|
10
|
-
|
|
11
|
-
## Where to start?
|
|
12
|
-
|
|
13
|
-
| What you want to do | Documentation |
|
|
14
|
-
| --- | --- |
|
|
15
|
-
| Integrate for the first time and run an example | [Quick Start](./international/quick-start.md) |
|
|
16
|
-
| Learn all configuration options | [Configuration](./international/configuration.md) |
|
|
17
|
-
| Detect language from URL / Cookie / Header | [Locale Detection](./international/locale-detection.md) |
|
|
18
|
-
| Implement paths with locale prefixes, such as `/en/about` | [Routing Integration](./international/routing.md) |
|
|
19
|
-
| Load translation resources from a remote service or platform | [Resource Loading -> Custom Backend](./international/resource-loading.md#custom-backend) |
|
|
20
|
-
| SSR, multiple entries, or custom instances | [Advanced Usage](./international/advanced.md) |
|
|
21
|
-
| Look up Hooks / components / type definitions | [API Reference](./international/api.md) |
|
|
22
|
-
|
|
23
|
-
## Core Capabilities
|
|
24
|
-
|
|
25
|
-
- **Locale detection**: Supports detection from URL path, Cookie, LocalStorage, request headers, browser settings, and other sources, with configurable priority.
|
|
26
|
-
- **Resource loading**: Supports HTTP static files, file system loading for SSR, custom SDK functions, and chained backend progressive loading.
|
|
27
|
-
- **Routing integration**: Automatically adds locale path prefixes such as `/en/about`, and provides the `I18nLink` component for locale-aware navigation.
|
|
28
|
-
- **SSR support**: Detects the language on the server and injects it into the page so the client can reuse it directly and avoid language flicker.
|
|
29
|
-
- **TypeScript support**: Provides complete type definitions and supports type-safe translation keys.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["code-split", "inline-assets", "optimize-bundle", "react-compiler"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["monitors", "logger", "metrics"]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Logs Events
|
|
2
|
-
|
|
3
|
-
Log events are distributed by Modern.js as events of type `log`.
|
|
4
|
-
|
|
5
|
-
## Built-in Events
|
|
6
|
-
|
|
7
|
-
Based on server-side runtime logic, Modern.js provides the following log events:
|
|
8
|
-
|
|
9
|
-
| Stage | Message | Level |
|
|
10
|
-
| --------------- | -------------------------------------------- | ----- |
|
|
11
|
-
| RENDER_HTML | App Render To HTML | error |
|
|
12
|
-
| RENDER_STREAM | An error occurs during streaming SSR | error |
|
|
13
|
-
| RENDER_SHELL | An error occurs during streaming render shell | error |
|
|
14
|
-
|
|
15
|
-
## Built-in Monitor
|
|
16
|
-
|
|
17
|
-
import InternalLogger from '@site-docs-en/components/internal-logger.mdx';
|
|
18
|
-
|
|
19
|
-
<InternalLogger />
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Metrics Events
|
|
2
|
-
|
|
3
|
-
Metric events are distributed by Monitors as events of type `timing` or `counter`.
|
|
4
|
-
|
|
5
|
-
## Built-in Events
|
|
6
|
-
|
|
7
|
-
When SSR is enabled, we need to monitor server-side phase durations and have the capability to diagnose server-side issues.
|
|
8
|
-
|
|
9
|
-
Based on server-side runtime logic, Modern.js provides the following metric events:
|
|
10
|
-
|
|
11
|
-
| Key | Description |
|
|
12
|
-
| ------------------------ | ------------------------ |
|
|
13
|
-
| server-handle-request | Modern.js Server request handling duration |
|
|
14
|
-
| ssr-render-shell | [SSR] When using Streaming SSR, React renders a shell for early streaming. This marks shell rendering completion time |
|
|
15
|
-
| ssr-render-html | [SSR] Time taken by React to render component tree to HTML (typically under 50ms) |
|
|
16
|
-
| server-middleware | Total execution time of Modern.js custom server middlewares |
|
|
17
|
-
| server-loader | Server-side Data Loader total duration |
|
|
18
|
-
| server-loader-#id | Individual Data Loader durations on server-side |
|
|
19
|
-
| server-loader-navigation | Server-side Data Loader duration during client navigation |
|
|
20
|
-
|
|
21
|
-
Modern.js server workflow diagram:
|
|
22
|
-
|
|
23
|
-

|
|
24
|
-
|
|
25
|
-
## Built-in Monitor
|
|
26
|
-
|
|
27
|
-
import InternalMetrics from '@site-docs-en/components/internal-metrics.mdx';
|
|
28
|
-
|
|
29
|
-
<InternalMetrics />
|
|
30
|
-
|
|
31
|
-
## Server-Timing
|
|
32
|
-
|
|
33
|
-
Modern.js injects phase metrics as Server-Timing headers into HTML responses.
|
|
34
|
-
|
|
35
|
-
Developers can retrieve these metrics using the [Performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance) in browsers:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
const navigation = performance.getEntriesByType('navigation')[0];
|
|
39
|
-
const serverTiming = navigation.serverTiming;
|
|
40
|
-
console.log(serverTiming);
|
|
41
|
-
```
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "dir",
|
|
4
|
-
"name": "routes",
|
|
5
|
-
"label": "Routes",
|
|
6
|
-
"collapsed": true
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"type": "dir",
|
|
10
|
-
"name": "data",
|
|
11
|
-
"label": "data-solution",
|
|
12
|
-
"collapsed": true
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"type": "dir",
|
|
16
|
-
"name": "render",
|
|
17
|
-
"label": "rendering",
|
|
18
|
-
"collapsed": true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"type": "dir",
|
|
22
|
-
"name": "css",
|
|
23
|
-
"label": "css-solution",
|
|
24
|
-
"collapsed": true
|
|
25
|
-
},
|
|
26
|
-
"html",
|
|
27
|
-
{
|
|
28
|
-
"type": "dir",
|
|
29
|
-
"name": "static-assets",
|
|
30
|
-
"label": "static-assets",
|
|
31
|
-
"collapsed": true
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "dir",
|
|
35
|
-
"name": "debug",
|
|
36
|
-
"label": "debug",
|
|
37
|
-
"collapsed": true
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"type": "dir",
|
|
41
|
-
"name": "testing",
|
|
42
|
-
"label": "testing",
|
|
43
|
-
"collapsed": true
|
|
44
|
-
},
|
|
45
|
-
"alias",
|
|
46
|
-
"env-vars",
|
|
47
|
-
"output-files",
|
|
48
|
-
"deploy"
|
|
49
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["css", "css-modules", "css-in-js", "tailwindcss"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["data-fetch", "data-write", "data-cache"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["mock", "proxy", "rsdoctor", "using-storybook"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["overview", "ssr", "streaming-ssr", "ssr-cache", "ssg", "rsc", "before-render"]
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Rendering Mode Overview
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Rendering Mode Overview
|
|
6
|
-
|
|
7
|
-
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.
|
|
8
|
-
|
|
9
|
-
## Rendering Mode Quick Reference
|
|
10
|
-
|
|
11
|
-
| Rendering Mode | Characteristics | Use Cases |
|
|
12
|
-
|----------------|-----------------|-----------|
|
|
13
|
-
| **CSR** | Executes JavaScript in the browser to render pages | Applications with strong interactivity and low SEO requirements |
|
|
14
|
-
| **SSR** | Pre-renders complete HTML pages on the server | Websites with high requirements for first-screen performance and SEO |
|
|
15
|
-
| **Streaming SSR** | Renders and returns progressively, displaying initial UI faster | Applications requiring faster first-screen perception speed (**Default SSR mode**) |
|
|
16
|
-
| **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 |
|
|
17
|
-
| **SSG** | Generates static pages at build time, can be cached by CDN | Websites with relatively static content, such as blogs and documentation sites |
|
|
18
|
-
|
|
19
|
-
## Performance Comparison
|
|
20
|
-
|
|
21
|
-
| Rendering Technology | Core Advantages | Main Bottlenecks |
|
|
22
|
-
|---------------------|-----------------|------------------|
|
|
23
|
-
| **SSR** | Server-side pre-rendering, beneficial for SEO | Must wait for all data to load before responding |
|
|
24
|
-
| **Streaming SSR** | Renders and returns progressively, faster first screen | JS bundle size is still large |
|
|
25
|
-
| **Streaming SSR + RSC** | Reduces client JS size | - |
|
|
26
|
-
|
|
27
|
-
## How to Choose
|
|
28
|
-
|
|
29
|
-
### Quick Decision Guide
|
|
30
|
-
|
|
31
|
-
- **Static Content + SEO Required** → **SSG**
|
|
32
|
-
- **SEO Required + First Screen Performance** → **Streaming SSR** (default)
|
|
33
|
-
- **Pursuing Optimal Performance** → **Streaming SSR + RSC**
|
|
34
|
-
- **CSR Project Gradual Optimization** → **CSR + RSC**
|
|
35
|
-
- **Highly Interactive + No SEO Needed** → **CSR**
|
|
36
|
-
|
|
37
|
-
### Combining Modes
|
|
38
|
-
|
|
39
|
-
Modern.js supports combining multiple rendering modes:
|
|
40
|
-
|
|
41
|
-
- **Streaming SSR + RSC**: Streaming rendering + reduced client-side code
|
|
42
|
-
- **SSG + SSR**: Some pages static, some pages dynamic
|
|
43
|
-
- **CSR + RSC**: Client-side rendering + partial Server Components
|
|
44
|
-
|
|
45
|
-
## Related Documentation
|
|
46
|
-
|
|
47
|
-
- [Server-Side Rendering (SSR)](/guides/basic-features/render/ssr)
|
|
48
|
-
- [Streaming Server-Side Rendering (Streaming SSR)](/guides/basic-features/render/streaming-ssr)
|
|
49
|
-
- [React Server Components (RSC)](/guides/basic-features/render/rsc)
|
|
50
|
-
- [Static Site Generation (SSG)](/guides/basic-features/render/ssg)
|
|
51
|
-
- [Rendering Cache](/guides/basic-features/render/ssr-cache)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["routes", "config-routes"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["json-files", "svg-assets", "wasm-assets"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["rstest", "playwright"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["entries", "builder", "server"]
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 4
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Glossary
|
|
6
|
-
|
|
7
|
-
## BFF
|
|
8
|
-
|
|
9
|
-
BFF is short for "Backend For Frontend". It is an architecture pattern that involves creating a backend service for frontend applications.
|
|
10
|
-
|
|
11
|
-
The BFF service acts as an intermediary between the frontend application and the server API, and can provide customized APIs for the frontend to use. This allows frontend developers to have more control over the data and functionality they need, without relying on the backend service to provide the corresponding capabilities.
|
|
12
|
-
|
|
13
|
-
## Bundler
|
|
14
|
-
|
|
15
|
-
import Bundler from '@site-docs-en/components/bundler.mdx';
|
|
16
|
-
|
|
17
|
-
<Bundler />
|
|
18
|
-
|
|
19
|
-
## CSR
|
|
20
|
-
|
|
21
|
-
CSR stands for "Client-Side Rendering". It means that the page is rendered in the browser using JavaScript, and logic such as data fetching, templates, and routing is completed on the client side rather than the server.
|
|
22
|
-
|
|
23
|
-
In CSR, the server sends an empty HTML shell and some JavaScript scripts to the browser, and the browser fetching data from the server's API and renders dynamic content to the page.
|
|
24
|
-
|
|
25
|
-
## Module Federation
|
|
26
|
-
|
|
27
|
-
import ModuleFederation from '@site-docs-en/components/module-federation.mdx';
|
|
28
|
-
|
|
29
|
-
<ModuleFederation />
|
|
30
|
-
|
|
31
|
-
## Rsbuild
|
|
32
|
-
|
|
33
|
-
import Rsbuild from '@site-docs-en/components/rsbuild.mdx';
|
|
34
|
-
|
|
35
|
-
<Rsbuild />
|
|
36
|
-
|
|
37
|
-
## Rspack
|
|
38
|
-
|
|
39
|
-
import Rspack from '@site-docs-en/components/rspack.mdx';
|
|
40
|
-
|
|
41
|
-
<Rspack />
|
|
42
|
-
|
|
43
|
-
## SSR
|
|
44
|
-
|
|
45
|
-
SSR stands for "Server-Side Rendering". It means that the HTML of the web page is generated by the server and sent to the client, rather than sending only an empty HTML shell and relying on JavaScript to generate the page content.
|
|
46
|
-
|
|
47
|
-
In traditional client-side rendering, the server sends an empty HTML shell and some JavaScript scripts to the client, and then fetching data from the server's API and fills the page with dynamic content. This leads to slow initial page loading times and is not conducive to user experience and SEO.
|
|
48
|
-
|
|
49
|
-
With SSR, the server generates HTML that already contains dynamic content and sends it to the client. This makes the initial page loading faster and more SEO-friendly, as search engines can crawl the rendered page.
|
|
50
|
-
|
|
51
|
-
## SSG
|
|
52
|
-
|
|
53
|
-
SSG stands for "Static Site Generation". It means that web pages are pre-rendered as static HTML and served directly to the client, without the need for the server to generate HTML in real-time.
|
|
54
|
-
|
|
55
|
-
In traditional SSR, the server generates HTML in real-time every time a user requests a page. With SSG, HTML can be generated in advance during the build process and hosted on a CDN or other static assets service.
|
|
56
|
-
|
|
57
|
-
Compared to traditional SSR, SSG can provide faster loading speeds and less server-side overhead, as there is no need to maintain a server to generate HTML in real-time. However, SSG is not suitable for websites that require dynamic content, as the HTML is generated during the build process and does not support real-time updates.
|
|
58
|
-
|
|
59
|
-
## SWC
|
|
60
|
-
|
|
61
|
-
import SWC from '@site-docs-en/components/swc.mdx';
|
|
62
|
-
|
|
63
|
-
<SWC />
|