@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.97 → 3.5.0-ultramodern.99
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/dist/cjs/builder/generator/createBuilderProviderConfig.js +5 -1
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +7 -0
- package/dist/cjs/commands/build.js +2 -1
- package/dist/cjs/commands/deploy.js +4 -2
- package/dist/cjs/commands/index.js +0 -4
- package/dist/cjs/config/default.js +2 -0
- package/dist/cjs/index.js +56 -15
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +3 -2
- package/dist/cjs/plugins/initialize/index.js +4 -3
- package/dist/cjs/plugins/serverBuild.js +3 -2
- package/dist/esm/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +7 -0
- package/dist/esm/commands/build.mjs +2 -1
- package/dist/esm/commands/deploy.mjs +4 -2
- package/dist/esm/commands/index.mjs +0 -4
- package/dist/esm/config/default.mjs +2 -0
- package/dist/esm/index.mjs +15 -1
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +3 -2
- package/dist/esm/plugins/initialize/index.mjs +4 -3
- package/dist/esm/plugins/serverBuild.mjs +3 -2
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +7 -0
- package/dist/esm-node/commands/build.mjs +2 -1
- package/dist/esm-node/commands/deploy.mjs +4 -2
- package/dist/esm-node/commands/index.mjs +0 -4
- package/dist/esm-node/config/default.mjs +2 -0
- package/dist/esm-node/index.mjs +15 -1
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +3 -2
- package/dist/esm-node/plugins/initialize/index.mjs +4 -3
- package/dist/esm-node/plugins/serverBuild.mjs +3 -2
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/types/config/dev.d.ts +6 -0
- package/docs/_nav.json +36 -0
- package/docs/apis/_meta.json +13 -0
- package/docs/apis/app/commands.mdx +205 -0
- package/docs/apis/app/hooks/_meta.json +28 -0
- package/docs/apis/app/hooks/api/lambda.mdx +13 -0
- package/docs/apis/app/hooks/config/_meta.json +1 -0
- package/docs/apis/app/hooks/config/favicon.mdx +29 -0
- package/docs/apis/app/hooks/config/html.mdx +9 -0
- package/docs/apis/app/hooks/config/icon.mdx +29 -0
- package/docs/apis/app/hooks/config/mock.mdx +10 -0
- package/docs/apis/app/hooks/config/public.mdx +30 -0
- package/docs/apis/app/hooks/config/upload.mdx +54 -0
- package/docs/apis/app/hooks/modern-config.mdx +9 -0
- package/docs/apis/app/hooks/server/server.mdx +10 -0
- package/docs/apis/app/hooks/shared.mdx +7 -0
- package/docs/apis/app/hooks/src/app.mdx +30 -0
- package/docs/apis/app/hooks/src/entry.mdx +39 -0
- package/docs/apis/app/hooks/src/entry.server.mdx +56 -0
- package/docs/apis/app/hooks/src/modern.runtime.mdx +9 -0
- package/docs/apis/app/hooks/src/routes.mdx +90 -0
- package/docs/apis/app/hooks/src/server.mdx +7 -0
- package/docs/apis/app/runtime/_meta.json +32 -0
- package/docs/apis/app/runtime/bff/use-backend-context.mdx +30 -0
- package/docs/apis/app/runtime/core/create-root.mdx +22 -0
- package/docs/apis/app/runtime/core/render.mdx +42 -0
- package/docs/apis/app/runtime/core/runtime-context.mdx +160 -0
- package/docs/apis/app/runtime/router/router.mdx +288 -0
- package/docs/apis/app/runtime/ssr/no-ssr.mdx +38 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.mdx +71 -0
- package/docs/apis/app/runtime/ssr/renderString.mdx +64 -0
- package/docs/apis/app/runtime/ssr/requestHandler.mdx +48 -0
- package/docs/apis/app/runtime/utility/css-in-js.mdx +44 -0
- package/docs/apis/app/runtime/utility/head.mdx +38 -0
- package/docs/apis/app/runtime/utility/loadable.mdx +85 -0
- package/docs/components/auto-upgrade.mdx +0 -0
- package/docs/components/bff-upload.mdx +97 -0
- package/docs/components/build-output.mdx +45 -0
- package/docs/components/bundler.mdx +3 -0
- package/docs/components/convention-routing-motivation.mdx +0 -0
- package/docs/components/debug-app.mdx +15 -0
- package/docs/components/default-browserslist.mdx +7 -0
- package/docs/components/deploy-command.mdx +14 -0
- package/docs/components/deploy.mdx +1 -0
- package/docs/components/enable-bff-caution.mdx +3 -0
- package/docs/components/enable-bff.mdx +56 -0
- package/docs/components/enable-ssg.mdx +49 -0
- package/docs/components/entry-mode.mdx +0 -0
- package/docs/components/entry-scan-logic.mdx +7 -0
- package/docs/components/extend-bff-function.mdx +3 -0
- package/docs/components/hono.mdx +120 -0
- package/docs/components/init-app.mdx +93 -0
- package/docs/components/init-rspack-app.mdx +5 -0
- package/docs/components/internal-logger.mdx +25 -0
- package/docs/components/internal-metrics.mdx +20 -0
- package/docs/components/international/custom-instance-code.mdx +16 -0
- package/docs/components/international/init-options-desc.mdx +1 -0
- package/docs/components/international/install-command.mdx +10 -0
- package/docs/components/international/instance-code.mdx +16 -0
- package/docs/components/international/introduce.mdx +5 -0
- package/docs/components/international/platform-support.mdx +0 -0
- package/docs/components/language-config.mdx +9 -0
- package/docs/components/micro-frontend.mdx +6 -0
- package/docs/components/micro-master-manifest-config.mdx +15 -0
- package/docs/components/micro-runtime-config.mdx +17 -0
- package/docs/components/module-federation.mdx +7 -0
- package/docs/components/new-entry-tooltip.mdx +0 -0
- package/docs/components/nodeVersion.mdx +28 -0
- 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 +1 -0
- package/docs/components/prerequisites.mdx +18 -0
- package/docs/components/release-note.mdx +1 -0
- package/docs/components/routes-practice.mdx +0 -0
- package/docs/components/rsbuild-config-tooltip.mdx +5 -0
- package/docs/components/rsbuild.mdx +3 -0
- package/docs/components/rsc-deploy-tip.mdx +1 -0
- package/docs/components/rspack.mdx +3 -0
- package/docs/components/rspackTip.mdx +7 -0
- package/docs/components/runtime-cli-config.mdx +0 -0
- package/docs/components/serve-command.mdx +22 -0
- package/docs/components/ssr-monitor.mdx +3 -0
- package/docs/components/stream-ssr-performance.mdx +0 -0
- package/docs/components/swc.mdx +3 -0
- package/docs/components/tech-stack-node-framework.mdx +1 -0
- package/docs/components/turtorials-example-list.mdx +2 -0
- package/docs/components/ua-polyfill.mdx +44 -0
- 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 +78 -0
- package/docs/configure/app/bff/cross-project.mdx +24 -0
- package/docs/configure/app/bff/effect.mdx +319 -0
- package/docs/configure/app/bff/prefix.mdx +33 -0
- package/docs/configure/app/bff/runtime-framework.mdx +30 -0
- package/docs/configure/app/builder-plugins.mdx +70 -0
- package/docs/configure/app/dev/asset-prefix.mdx +18 -0
- package/docs/configure/app/dev/before-start-url.mdx +21 -0
- package/docs/configure/app/dev/client.mdx +45 -0
- package/docs/configure/app/dev/hmr.mdx +14 -0
- package/docs/configure/app/dev/host.mdx +22 -0
- package/docs/configure/app/dev/https.mdx +81 -0
- package/docs/configure/app/dev/lazy-compilation.mdx +45 -0
- package/docs/configure/app/dev/live-reload.mdx +14 -0
- package/docs/configure/app/dev/mock-dir.mdx +35 -0
- package/docs/configure/app/dev/progress-bar.mdx +23 -0
- package/docs/configure/app/dev/server.mdx +128 -0
- package/docs/configure/app/dev/setup-middlewares.mdx +36 -0
- package/docs/configure/app/dev/start-url.mdx +53 -0
- package/docs/configure/app/dev/watch-files.mdx +31 -0
- package/docs/configure/app/dev/write-to-disk.mdx +14 -0
- package/docs/configure/app/experiments/source-build.mdx +33 -0
- package/docs/configure/app/html/app-icon.mdx +32 -0
- package/docs/configure/app/html/crossorigin.mdx +14 -0
- package/docs/configure/app/html/favicon.mdx +20 -0
- package/docs/configure/app/html/inject.mdx +14 -0
- package/docs/configure/app/html/meta.mdx +28 -0
- package/docs/configure/app/html/mount-id.mdx +14 -0
- package/docs/configure/app/html/output-structure.mdx +14 -0
- package/docs/configure/app/html/script-loading.mdx +14 -0
- package/docs/configure/app/html/tags.mdx +19 -0
- package/docs/configure/app/html/template-parameters.mdx +37 -0
- package/docs/configure/app/html/template.mdx +14 -0
- package/docs/configure/app/html/title.mdx +22 -0
- package/docs/configure/app/output/asset-prefix.mdx +18 -0
- package/docs/configure/app/output/assets-retry.mdx +81 -0
- package/docs/configure/app/output/charset.mdx +14 -0
- package/docs/configure/app/output/clean-dist-path.mdx +20 -0
- package/docs/configure/app/output/convert-to-rem.mdx +83 -0
- package/docs/configure/app/output/copy.mdx +14 -0
- package/docs/configure/app/output/css-modules.mdx +52 -0
- package/docs/configure/app/output/data-uri-limit.mdx +30 -0
- package/docs/configure/app/output/disable-css-module-extension.mdx +59 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.mdx +45 -0
- package/docs/configure/app/output/disable-svgr.mdx +22 -0
- package/docs/configure/app/output/disable-ts-checker.mdx +53 -0
- package/docs/configure/app/output/dist-path.mdx +51 -0
- package/docs/configure/app/output/enable-asset-manifest.mdx +40 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.mdx +32 -0
- package/docs/configure/app/output/enable-inline-route-manifests.mdx +20 -0
- package/docs/configure/app/output/externals.mdx +24 -0
- package/docs/configure/app/output/filename-hash.mdx +14 -0
- package/docs/configure/app/output/filename.mdx +59 -0
- package/docs/configure/app/output/inject-styles.mdx +14 -0
- package/docs/configure/app/output/inline-scripts.mdx +33 -0
- package/docs/configure/app/output/inline-styles.mdx +33 -0
- package/docs/configure/app/output/legal-comments.mdx +22 -0
- package/docs/configure/app/output/minify.mdx +26 -0
- package/docs/configure/app/output/override-browserslist.mdx +26 -0
- package/docs/configure/app/output/polyfill.mdx +18 -0
- package/docs/configure/app/output/source-map.mdx +34 -0
- package/docs/configure/app/output/split-route-chunks.mdx +20 -0
- package/docs/configure/app/output/ssg.mdx +85 -0
- package/docs/configure/app/output/ssgByEntries.mdx +93 -0
- package/docs/configure/app/output/svg-default-export.mdx +34 -0
- package/docs/configure/app/output/temp-dir.mdx +24 -0
- package/docs/configure/app/performance/build-cache.mdx +48 -0
- package/docs/configure/app/performance/chunk-split.mdx +44 -0
- package/docs/configure/app/performance/dns-prefetch.mdx +19 -0
- package/docs/configure/app/performance/preconnect.mdx +20 -0
- package/docs/configure/app/performance/prefetch.mdx +25 -0
- package/docs/configure/app/performance/preload.mdx +27 -0
- package/docs/configure/app/performance/print-file-size.mdx +44 -0
- package/docs/configure/app/performance/profile.mdx +14 -0
- package/docs/configure/app/performance/remove-console.mdx +14 -0
- package/docs/configure/app/performance/remove-moment-locale.mdx +14 -0
- package/docs/configure/app/performance/rsdoctor.mdx +42 -0
- package/docs/configure/app/plugins.mdx +59 -0
- package/docs/configure/app/resolve/alias-strategy.mdx +14 -0
- package/docs/configure/app/resolve/alias.mdx +13 -0
- package/docs/configure/app/resolve/condition-names.mdx +18 -0
- package/docs/configure/app/resolve/dedupe.mdx +13 -0
- package/docs/configure/app/resolve/extensions.mdx +18 -0
- package/docs/configure/app/runtime/0-intro.mdx +61 -0
- package/docs/configure/app/runtime/plugins.mdx +58 -0
- package/docs/configure/app/runtime/router.mdx +39 -0
- package/docs/configure/app/security/check-syntax.mdx +73 -0
- package/docs/configure/app/security/nonce.mdx +19 -0
- package/docs/configure/app/security/sri.mdx +24 -0
- package/docs/configure/app/server/base-url.mdx +30 -0
- package/docs/configure/app/server/port.mdx +22 -0
- package/docs/configure/app/server/public-routes.mdx +26 -0
- package/docs/configure/app/server/routes.mdx +90 -0
- package/docs/configure/app/server/rsc.mdx +30 -0
- package/docs/configure/app/server/ssr-by-entries.mdx +29 -0
- package/docs/configure/app/server/ssr.mdx +85 -0
- package/docs/configure/app/server/tsconfig-path.mdx +63 -0
- package/docs/configure/app/source/alias-strategy.mdx +18 -0
- package/docs/configure/app/source/alias.mdx +27 -0
- package/docs/configure/app/source/config-dir.mdx +24 -0
- package/docs/configure/app/source/decorators.mdx +29 -0
- package/docs/configure/app/source/define.mdx +20 -0
- package/docs/configure/app/source/disable-default-entries.mdx +32 -0
- package/docs/configure/app/source/enable-async-entry.mdx +54 -0
- package/docs/configure/app/source/enable-async-pre-entry.mdx +30 -0
- package/docs/configure/app/source/entries-dir.mdx +39 -0
- package/docs/configure/app/source/entries.mdx +183 -0
- package/docs/configure/app/source/exclude.mdx +14 -0
- package/docs/configure/app/source/global-vars.mdx +110 -0
- package/docs/configure/app/source/include.mdx +40 -0
- package/docs/configure/app/source/main-entry-name.mdx +28 -0
- package/docs/configure/app/source/pre-entry.mdx +14 -0
- package/docs/configure/app/source/react-compiler.mdx +72 -0
- package/docs/configure/app/source/transform-import.mdx +31 -0
- package/docs/configure/app/split-chunks.mdx +17 -0
- package/docs/configure/app/tools/autoprefixer.mdx +48 -0
- package/docs/configure/app/tools/bundler-chain.mdx +30 -0
- package/docs/configure/app/tools/css-extract.mdx +37 -0
- package/docs/configure/app/tools/css-loader.mdx +21 -0
- package/docs/configure/app/tools/dev-server.mdx +117 -0
- package/docs/configure/app/tools/html-plugin.mdx +45 -0
- package/docs/configure/app/tools/less.mdx +85 -0
- package/docs/configure/app/tools/lightningcss-loader.mdx +39 -0
- package/docs/configure/app/tools/minify-css.mdx +57 -0
- package/docs/configure/app/tools/postcss.mdx +38 -0
- package/docs/configure/app/tools/rspack.mdx +14 -0
- package/docs/configure/app/tools/sass.mdx +82 -0
- package/docs/configure/app/tools/style-loader.mdx +14 -0
- package/docs/configure/app/tools/swc.mdx +69 -0
- package/docs/configure/app/tools/ts-checker.mdx +103 -0
- package/docs/configure/app/usage.mdx +276 -0
- package/docs/guides/_meta.json +37 -0
- package/docs/guides/advanced-features/_meta.json +32 -0
- package/docs/guides/advanced-features/bff/_meta.json +10 -0
- package/docs/guides/advanced-features/bff/cross-project.mdx +110 -0
- package/docs/guides/advanced-features/bff/data-platform.mdx +120 -0
- package/docs/guides/advanced-features/bff/extend-server.mdx +120 -0
- package/docs/guides/advanced-features/bff/frameworks.mdx +131 -0
- package/docs/guides/advanced-features/bff/function.mdx +265 -0
- package/docs/guides/advanced-features/bff/operators.mdx +629 -0
- package/docs/guides/advanced-features/bff/sdk.mdx +116 -0
- package/docs/guides/advanced-features/bff/upload.mdx +7 -0
- package/docs/guides/advanced-features/bff.mdx +22 -0
- package/docs/guides/advanced-features/build-performance.mdx +134 -0
- package/docs/guides/advanced-features/compatibility.mdx +81 -0
- package/docs/guides/advanced-features/international/_meta.json +10 -0
- package/docs/guides/advanced-features/international/advanced.mdx +132 -0
- package/docs/guides/advanced-features/international/api.mdx +271 -0
- package/docs/guides/advanced-features/international/best-practices.mdx +290 -0
- package/docs/guides/advanced-features/international/configuration.mdx +222 -0
- package/docs/guides/advanced-features/international/locale-detection.mdx +130 -0
- package/docs/guides/advanced-features/international/quick-start.mdx +112 -0
- package/docs/guides/advanced-features/international/resource-loading.mdx +158 -0
- package/docs/guides/advanced-features/international/routing.mdx +177 -0
- package/docs/guides/advanced-features/international.mdx +29 -0
- package/docs/guides/advanced-features/low-level.mdx +50 -0
- package/docs/guides/advanced-features/page-performance/_meta.json +1 -0
- package/docs/guides/advanced-features/page-performance/code-split.mdx +81 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.mdx +163 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.mdx +101 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.mdx +51 -0
- package/docs/guides/advanced-features/server-monitor/_meta.json +1 -0
- package/docs/guides/advanced-features/server-monitor/logger.mdx +19 -0
- package/docs/guides/advanced-features/server-monitor/metrics.mdx +41 -0
- package/docs/guides/advanced-features/server-monitor/monitors.mdx +242 -0
- package/docs/guides/advanced-features/source-build.mdx +168 -0
- package/docs/guides/advanced-features/web-server.mdx +296 -0
- package/docs/guides/basic-features/_meta.json +49 -0
- package/docs/guides/basic-features/alias.mdx +106 -0
- package/docs/guides/basic-features/css/_meta.json +1 -0
- package/docs/guides/basic-features/css/css-in-js.mdx +69 -0
- package/docs/guides/basic-features/css/css-modules.mdx +212 -0
- package/docs/guides/basic-features/css/css.mdx +31 -0
- package/docs/guides/basic-features/css/tailwindcss.mdx +27 -0
- package/docs/guides/basic-features/data/_meta.json +1 -0
- package/docs/guides/basic-features/data/data-cache.mdx +515 -0
- package/docs/guides/basic-features/data/data-fetch.mdx +419 -0
- package/docs/guides/basic-features/data/data-write.mdx +230 -0
- package/docs/guides/basic-features/debug/_meta.json +1 -0
- package/docs/guides/basic-features/debug/mock.mdx +113 -0
- package/docs/guides/basic-features/debug/proxy.mdx +25 -0
- package/docs/guides/basic-features/debug/rsdoctor.mdx +47 -0
- package/docs/guides/basic-features/debug/using-storybook.mdx +100 -0
- package/docs/guides/basic-features/deploy.mdx +448 -0
- package/docs/guides/basic-features/env-vars.mdx +181 -0
- package/docs/guides/basic-features/html.mdx +259 -0
- package/docs/guides/basic-features/output-files.mdx +145 -0
- package/docs/guides/basic-features/render/_meta.json +1 -0
- package/docs/guides/basic-features/render/before-render.mdx +108 -0
- package/docs/guides/basic-features/render/overview.mdx +51 -0
- package/docs/guides/basic-features/render/rsc.mdx +533 -0
- package/docs/guides/basic-features/render/ssg.mdx +167 -0
- package/docs/guides/basic-features/render/ssr-cache.mdx +201 -0
- package/docs/guides/basic-features/render/ssr.mdx +323 -0
- package/docs/guides/basic-features/render/streaming-ssr.mdx +267 -0
- package/docs/guides/basic-features/routes/_meta.json +1 -0
- package/docs/guides/basic-features/routes/config-routes.mdx +427 -0
- package/docs/guides/basic-features/routes/routes.mdx +532 -0
- package/docs/guides/basic-features/static-assets/_meta.json +1 -0
- package/docs/guides/basic-features/static-assets/json-files.mdx +124 -0
- package/docs/guides/basic-features/static-assets/svg-assets.mdx +172 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.mdx +66 -0
- package/docs/guides/basic-features/static-assets.mdx +164 -0
- package/docs/guides/basic-features/testing/_meta.json +1 -0
- package/docs/guides/basic-features/testing/playwright.mdx +111 -0
- package/docs/guides/basic-features/testing/rstest.mdx +192 -0
- package/docs/guides/concept/_meta.json +1 -0
- package/docs/guides/concept/builder.mdx +60 -0
- package/docs/guides/concept/entries.mdx +325 -0
- package/docs/guides/concept/server.mdx +35 -0
- package/docs/guides/get-started/_meta.json +9 -0
- package/docs/guides/get-started/ai-coding-agents.mdx +63 -0
- package/docs/guides/get-started/glossary.mdx +63 -0
- package/docs/guides/get-started/introduction.mdx +45 -0
- package/docs/guides/get-started/quick-start.mdx +92 -0
- package/docs/guides/get-started/tech-stack.mdx +97 -0
- package/docs/guides/get-started/ultramodern.mdx +433 -0
- package/docs/guides/get-started/upgrade.mdx +114 -0
- package/docs/guides/topic-detail/_meta.json +8 -0
- package/docs/guides/topic-detail/module-federation/_meta.json +1 -0
- package/docs/guides/topic-detail/module-federation/application.mdx +116 -0
- package/docs/guides/topic-detail/module-federation/deploy.mdx +104 -0
- package/docs/guides/topic-detail/module-federation/i18n.mdx +670 -0
- package/docs/guides/topic-detail/module-federation/introduce.mdx +36 -0
- package/docs/guides/topic-detail/module-federation/ssr.mdx +177 -0
- package/docs/guides/topic-detail/module-federation/usage.mdx +202 -0
- package/docs/guides/troubleshooting/_meta.json +1 -0
- package/docs/guides/troubleshooting/builder.mdx +114 -0
- package/docs/guides/troubleshooting/cli.mdx +39 -0
- package/docs/guides/troubleshooting/dependencies.mdx +123 -0
- package/docs/guides/troubleshooting/hmr.mdx +148 -0
- package/docs/guides/upgrade/_meta.json +1 -0
- package/docs/guides/upgrade/config.mdx +951 -0
- package/docs/guides/upgrade/entry.mdx +463 -0
- package/docs/guides/upgrade/other.mdx +183 -0
- package/docs/guides/upgrade/overview.mdx +33 -0
- package/docs/guides/upgrade/tailwindcss.mdx +92 -0
- package/docs/guides/upgrade/web-server.md +109 -0
- package/docs/index.md +4 -0
- package/package.json +43 -20
- package/scripts/copy-main-doc.mjs +50 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## manifest
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
interface Manifest {
|
|
5
|
+
getAppList?: () => Array<AppInfo>;
|
|
6
|
+
}
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
### getAppList?
|
|
10
|
+
|
|
11
|
+
Through the `getAppList` configuration, you can customize how to get remote list data
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
type GetAppList = () => Promise<Array<AppInfo>>;
|
|
15
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
```ts title="src/modern.runtime.ts"
|
|
2
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
|
3
|
+
|
|
4
|
+
export default defineRuntimeConfig({
|
|
5
|
+
masterApp: {
|
|
6
|
+
apps: [{
|
|
7
|
+
name: 'Table',
|
|
8
|
+
entry: 'http://localhost:8081',
|
|
9
|
+
// activeWhen: '/table'
|
|
10
|
+
}, {
|
|
11
|
+
name: 'Dashboard',
|
|
12
|
+
entry: 'http://localhost:8082'
|
|
13
|
+
// activeWhen: '/dashboard'
|
|
14
|
+
}]
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Module Federation (MF) is a technology solution that allows multiple JavaScript applications to share code and resources. Similar to microservices architecture on the server side, it allows you to split large applications into multiple independent smaller applications that can be developed, tested, and deployed independently, while dynamically loading modules from other applications at runtime.
|
|
2
|
+
|
|
3
|
+
Module Federation solves the problem of code duplication across multiple frontend applications. In the traditional approach, if multiple applications need to use the same components or utility functions, you would need to duplicate this code in each application, leading to code duplication, high maintenance costs, and larger application sizes. With Module Federation, you can place common code in one application and have other applications load it dynamically as needed, enabling code sharing and reducing duplication.
|
|
4
|
+
|
|
5
|
+
Module Federation 2.0 supports [Rspack](https://rspack.rs/) build tools, and provides enhanced features such as dynamic type hints, Manifest, Federation Runtime, runtime plugin system, and Chrome Devtools support for better development experience and debugging capabilities. You can visit the [Module Federation official documentation](https://module-federation.io/) to learn more.
|
|
6
|
+
|
|
7
|
+
Modern.js provides an example project for Module Federation. Please refer to [module-federation-examples - modernjs](https://github.com/module-federation/module-federation-examples/tree/db5bdbeee56f779999a2c591fc553eb94eb20b36/modernjs).
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Before getting started, you will need to install [Node.js](https://nodejs.org/), and ensure that your Node.js version is not lower than v20.19.5. **We recommend using the LTS version of Node.js 22.**
|
|
2
|
+
|
|
3
|
+
You can check the currently used Node.js version with the following command:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
node -v
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
If you do not have Node.js installed in your current environment, or the installed version is lower than v20.19.5, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install the required version.
|
|
10
|
+
|
|
11
|
+
Here is an example of how to install the Node.js 22 LTS version via nvm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install the long-term support version of Node.js 22
|
|
15
|
+
nvm install 22 --lts
|
|
16
|
+
|
|
17
|
+
# Make the newly installed Node.js 22 as the default version
|
|
18
|
+
nvm alias default 22
|
|
19
|
+
|
|
20
|
+
# Switch to the newly installed Node.js 22
|
|
21
|
+
nvm use 22
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
:::tip nvm and fnm
|
|
25
|
+
Both nvm and fnm are Node.js version management tools. Relatively speaking, nvm is more mature and stable, while fnm is implemented using Rust, which provides better performance than nvm.
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
Additionally, after installing nvm or fnm, when there is a `.nvmrc` file containing `lts/jod` in the repository's root directory, the system will automatically install or switch to the correct Node.js version upon entering the repository.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Modern.js also provides a runtime Polyfill solution based on browser [UA](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/User-Agent) information. For detailed usage instructions, please refer to [Polyfill At Runtime](https://modernjs.dev/en/guides/advanced-features/compatibility.html#polyfill-at-runtime).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
### Node.js
|
|
2
|
+
|
|
3
|
+
import NodeVersion from '@site-docs-en/components/nodeVersion.mdx';
|
|
4
|
+
|
|
5
|
+
<NodeVersion />
|
|
6
|
+
|
|
7
|
+
### pnpm
|
|
8
|
+
|
|
9
|
+
It is recommended to use [pnpm](https://pnpm.io/installation) to manage dependencies:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mise use pnpm@11.17.0
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
:::note
|
|
16
|
+
Modern.js also supports dependency management with `yarn` and `npm`.
|
|
17
|
+
|
|
18
|
+
:::
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
According to the [Release Note](https://github.com/web-infra-dev/modern.js/releases) on the official website, developers can also manually upgrade the project to the desired version.
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[Rsbuild](https://v2.rsbuild.rs/) is an Rspack-based build tool for the web. The main goal of Rsbuild is to provide out-of-the-box build capabilities for Rspack users, allowing developers to start a web project with zero configuration.
|
|
2
|
+
|
|
3
|
+
Rsbuild integrates high-performance Rust-based tools from the community, including Rspack and SWC, to provide first-class build speed and development experience.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[Rspack](https://rspack.rs/) is a high performance JavaScript bundler written in Rust. It offers strong compatibility with the webpack ecosystem, allowing for seamless replacement of webpack, and provides lightning fast build speeds.
|
|
2
|
+
|
|
3
|
+
Compared to webpack, Rspack has significantly improved build performance, thanks not only to the language advantages brought by Rust, but also to its parallel architecture and incremental compilation features. Benchmarking has shown that Rspack can provide 5-10 times better compilation performance.
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## modern serve
|
|
2
|
+
|
|
3
|
+
The `modern serve` command is used to start an UltraModern.js project in the production environment. It can also be used to preview the artifacts built for the production environment locally. Please note that you need to execute the [`build`](/apis/app/commands#modern-build) command beforehand to generate the corresponding artifacts.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
Usage: modern serve [options]
|
|
7
|
+
|
|
8
|
+
Options:
|
|
9
|
+
-c --config <config> specify the configuration file, which can be a relative or absolute path
|
|
10
|
+
-h, --help show command help
|
|
11
|
+
--api-only only run API service
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
By default, the project will run in `localhost:8080`, you can modify the server port number with `server.port`:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
server: {
|
|
19
|
+
port: 8081,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[SWC](https://SWC.rs/) (Speedy Web Compiler) is a transformer and minimizer for JavaScript and TypeScript based on `Rust`. SWC can provide the same abilities with Babel, and it's more than 10x faster than Babel.
|
|
2
|
+
|
|
3
|
+
Modern.js has a out-of-box plugin for SWC, power your Web application with Polyfill and minification, we also port some common used Babel plugins to SWC.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Modern.js Server uses [Hono.js](https://hono.dev/) as the server runtime framework. For BFF, `bff.runtimeFramework` defaults to `effect`, while `hono` remains an explicit compatibility runtime. Effect and Hono BFF runtimes are strict modes (no implicit fallback). You can extend the Server based on the Hono.js ecosystem; refer to [Custom Web Server](/guides/advanced-features/web-server.html).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
### Polyfill At Runtime
|
|
2
|
+
|
|
3
|
+
Modern.js also provides a runtime Polyfill solution based on browser [UA](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/User-Agent) information, which has the following advantages over Babel:
|
|
4
|
+
|
|
5
|
+
- It will not be inserted into the code, and only delivers Polyfill code on-demand based on the device accessing the page, reducing the overall code size.
|
|
6
|
+
- The same browser will share a Polyfill code. Therefore, with more and more projects, the UA-based Polyfill code will be delivered faster and faster, with overall speed exceeding conventional solutions.
|
|
7
|
+
|
|
8
|
+
Modern.js provides the `@modern-js/plugin-polyfill` plugin to implement this feature. You can enable it by installing the plugin:
|
|
9
|
+
|
|
10
|
+
import { PackageManagerTabs } from '@theme';
|
|
11
|
+
|
|
12
|
+
<PackageManagerTabs
|
|
13
|
+
command={{
|
|
14
|
+
npm: 'npm install @modern-js/plugin-polyfill',
|
|
15
|
+
yarn: 'yarn add @modern-js/plugin-polyfill',
|
|
16
|
+
pnpm: 'pnpm add @modern-js/plugin-polyfill',
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
Then register the Polyfill plugin in `modern.config.ts`:
|
|
21
|
+
|
|
22
|
+
```ts title="modern.config.ts"
|
|
23
|
+
import { polyfillPlugin } from '@modern-js/plugin-polyfill';
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
plugins: [..., polyfillPlugin()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
After configuring `output.polyfill` as `ua` and executing `pnpm run build && pnpm run serve` to start the server, visiting the page can see that the HTML artifacts contains the following script:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
<script src="/__polyfill__" crossorigin></script>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
When accessing the page on Chrome 51, you can see the content returned by `http://localhost:8080/__polyfill__` as follows:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
:::caution
|
|
41
|
+
This feature only works when using Modern.js built-in Web Server.
|
|
42
|
+
|
|
43
|
+
If you need to customize the HTML template, please refer to [HTML Template](/guides/basic-features/html.html). Manually modifying the template through `html.template` or `tools.html` may cause this feature to not work correctly.
|
|
44
|
+
:::
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[
|
|
2
|
+
"app/usage",
|
|
3
|
+
{
|
|
4
|
+
"type": "dir",
|
|
5
|
+
"name": "app/dev",
|
|
6
|
+
"label": "dev",
|
|
7
|
+
"collapsed": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "dir",
|
|
11
|
+
"name": "app/bff",
|
|
12
|
+
"label": "bff",
|
|
13
|
+
"collapsed": true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "dir",
|
|
17
|
+
"name": "app/html",
|
|
18
|
+
"label": "html",
|
|
19
|
+
"collapsed": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "dir",
|
|
23
|
+
"name": "app/tools",
|
|
24
|
+
"label": "tools",
|
|
25
|
+
"collapsed": true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "dir",
|
|
29
|
+
"name": "app/source",
|
|
30
|
+
"label": "source",
|
|
31
|
+
"collapsed": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "dir",
|
|
35
|
+
"name": "app/resolve",
|
|
36
|
+
"label": "resolve",
|
|
37
|
+
"collapsed": true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "dir",
|
|
41
|
+
"name": "app/server",
|
|
42
|
+
"label": "server",
|
|
43
|
+
"collapsed": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "dir",
|
|
47
|
+
"name": "app/output",
|
|
48
|
+
"label": "output",
|
|
49
|
+
"collapsed": true
|
|
50
|
+
},
|
|
51
|
+
"app/plugins",
|
|
52
|
+
{
|
|
53
|
+
"type": "dir",
|
|
54
|
+
"name": "app/security",
|
|
55
|
+
"label": "security",
|
|
56
|
+
"collapsed": true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "dir",
|
|
60
|
+
"name": "app/runtime",
|
|
61
|
+
"label": "runtime",
|
|
62
|
+
"collapsed": true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "dir",
|
|
66
|
+
"name": "app/performance",
|
|
67
|
+
"label": "performance",
|
|
68
|
+
"collapsed": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "dir",
|
|
72
|
+
"name": "app/experiments",
|
|
73
|
+
"label": "experiments",
|
|
74
|
+
"collapsed": true
|
|
75
|
+
},
|
|
76
|
+
"app/builder-plugins",
|
|
77
|
+
"app/split-chunks"
|
|
78
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: crossProject
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# bff.crossProject
|
|
6
|
+
|
|
7
|
+
- **Type:** `boolean`
|
|
8
|
+
- **Default:** `false`
|
|
9
|
+
|
|
10
|
+
import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution";
|
|
11
|
+
|
|
12
|
+
<EnableBFFCaution />
|
|
13
|
+
|
|
14
|
+
This configuration is used to enable BFF cross-project invocation functionality. When enabled, the current project can be used as a BFF producer, generating an SDK that can be directly called by other projects.
|
|
15
|
+
|
|
16
|
+
```ts title="modern.config.ts"
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
bff: {
|
|
19
|
+
crossProject: true,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For detailed configuration and usage of BFF cross-project invocation, please refer to the [BFF Cross-Project Invocation Guide](/guides/advanced-features/bff/cross-project.html).
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: effect
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# bff.effect
|
|
6
|
+
|
|
7
|
+
- **Type:**
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type BffEffectUserConfig = {
|
|
11
|
+
entry?: string;
|
|
12
|
+
strictEffectApproach?: true;
|
|
13
|
+
openapi?: boolean | { path?: string };
|
|
14
|
+
dataPlatform?: {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
requireEnvelope?: boolean;
|
|
17
|
+
envelopeHeader?: string;
|
|
18
|
+
expectedNamespace?: string;
|
|
19
|
+
validateOrigin?: boolean;
|
|
20
|
+
requireTraceContext?: boolean;
|
|
21
|
+
selection?: {
|
|
22
|
+
maxDepth?: number;
|
|
23
|
+
maxFields?: number;
|
|
24
|
+
allowedLeafPaths?: string[];
|
|
25
|
+
};
|
|
26
|
+
batch?: {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
endpoint?: `/${string}`;
|
|
29
|
+
maxBatchSize?: number;
|
|
30
|
+
maxBatchBytes?: number;
|
|
31
|
+
flushIntervalMs?: number;
|
|
32
|
+
maxConcurrency?: number;
|
|
33
|
+
requestTimeoutMs?: number;
|
|
34
|
+
allowedMethods?: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **Default:** `{}`
|
|
41
|
+
|
|
42
|
+
import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution";
|
|
43
|
+
|
|
44
|
+
<EnableBFFCaution />
|
|
45
|
+
|
|
46
|
+
`bff.effect` is only effective when `bff.runtimeFramework` is set to `'effect'`.
|
|
47
|
+
|
|
48
|
+
:::caution Install the Effect peers yourself
|
|
49
|
+
`effect` and `@effect/opentelemetry` are **optional exact peer dependencies** of
|
|
50
|
+
`@modern-js/plugin-bff`, not dependencies. The plugin no longer bundles a copy —
|
|
51
|
+
Effect 4 derives `Context` / `Service` keys per module instance, so a bundled copy
|
|
52
|
+
would give your app a second Effect identity. Before setting
|
|
53
|
+
`runtimeFramework: 'effect'` or importing `@modern-js/plugin-bff/effect`,
|
|
54
|
+
`/effect-server`, `/effect-edge` or `/effect-client`, install the exact cohort:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pnpm add effect@4.0.0-beta.102 @effect/opentelemetry@4.0.0-beta.102
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The pin is exact because UltraModern ships Effect as one lockstep cohort. Apps
|
|
61
|
+
using only `runtimeFramework: 'hono'` or the `./data-platform` lane need neither
|
|
62
|
+
package.
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
Generated UltraModern workspaces use this runtime as the only generated HTTP API
|
|
66
|
+
path. The API contract lives at `shared/api.ts`, the server runtime lives at
|
|
67
|
+
`api/index.ts`, clients live under `src/api/*-client.ts`, and generated checks
|
|
68
|
+
reject `api/effect`, `api/lambda`, `shared/effect`, `src/effect`, Hono server
|
|
69
|
+
imports, raw request handlers, manual request parsing, and manual `Response`
|
|
70
|
+
construction in API modules.
|
|
71
|
+
|
|
72
|
+
For Effect v4, TypeScript should use export-map aware module resolution.
|
|
73
|
+
|
|
74
|
+
```json title="tsconfig.json"
|
|
75
|
+
{
|
|
76
|
+
"compilerOptions": {
|
|
77
|
+
"module": "ESNext",
|
|
78
|
+
"moduleResolution": "Bundler"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## bff.effect.entry
|
|
84
|
+
|
|
85
|
+
- **Type:** `string`
|
|
86
|
+
- **Default:** `<apiDirectory>/index`
|
|
87
|
+
|
|
88
|
+
Specifies the entry module for Effect HttpApi runtime.
|
|
89
|
+
|
|
90
|
+
```ts title="modern.config.ts"
|
|
91
|
+
export default defineConfig({
|
|
92
|
+
bff: {
|
|
93
|
+
runtimeFramework: 'effect',
|
|
94
|
+
effect: {
|
|
95
|
+
entry: './api/index',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## bff.effect.strictEffectApproach
|
|
102
|
+
|
|
103
|
+
- **Type:** `true`
|
|
104
|
+
- **Default:** `true`
|
|
105
|
+
|
|
106
|
+
Effect BFF modules must expose the strict Effect API surface
|
|
107
|
+
(`defineEffectBff(...)` or `{ api, layer }`) and raw request handlers are
|
|
108
|
+
rejected. Generated UltraModern apps write this marker explicitly and pair it
|
|
109
|
+
with source checks that reject Hono server imports, manual request parsing, and
|
|
110
|
+
manual `Response` construction in generated API modules.
|
|
111
|
+
|
|
112
|
+
## bff.effect.openapi
|
|
113
|
+
|
|
114
|
+
- **Type:** `boolean | { path?: string }`
|
|
115
|
+
- **Default:** `false`
|
|
116
|
+
|
|
117
|
+
Enable OpenAPI endpoint generation for Effect HttpApi runtime.
|
|
118
|
+
|
|
119
|
+
```ts title="modern.config.ts"
|
|
120
|
+
export default defineConfig({
|
|
121
|
+
bff: {
|
|
122
|
+
runtimeFramework: 'effect',
|
|
123
|
+
effect: {
|
|
124
|
+
openapi: {
|
|
125
|
+
path: '/openapi.json',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## bff.effect.dataPlatform
|
|
133
|
+
|
|
134
|
+
- **Type:**
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
{
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
requireEnvelope?: boolean;
|
|
140
|
+
envelopeHeader?: string;
|
|
141
|
+
expectedNamespace?: string;
|
|
142
|
+
validateOrigin?: boolean;
|
|
143
|
+
requireTraceContext?: boolean;
|
|
144
|
+
selection?: {
|
|
145
|
+
maxDepth?: number;
|
|
146
|
+
maxFields?: number;
|
|
147
|
+
allowedLeafPaths?: string[];
|
|
148
|
+
};
|
|
149
|
+
batch?: {
|
|
150
|
+
enabled?: boolean;
|
|
151
|
+
endpoint?: `/${string}`;
|
|
152
|
+
maxBatchSize?: number;
|
|
153
|
+
maxBatchBytes?: number;
|
|
154
|
+
flushIntervalMs?: number;
|
|
155
|
+
maxConcurrency?: number;
|
|
156
|
+
requestTimeoutMs?: number;
|
|
157
|
+
allowedMethods?: string[];
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- **Default:**
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
{
|
|
166
|
+
enabled: true,
|
|
167
|
+
requireEnvelope: false,
|
|
168
|
+
envelopeHeader: 'x-modernjs-data-envelope',
|
|
169
|
+
validateOrigin: true,
|
|
170
|
+
requireTraceContext: false,
|
|
171
|
+
batch: {
|
|
172
|
+
enabled: true,
|
|
173
|
+
endpoint: '/_data/batch',
|
|
174
|
+
maxBatchSize: 16,
|
|
175
|
+
maxBatchBytes: 64 * 1024,
|
|
176
|
+
flushIntervalMs: 8,
|
|
177
|
+
maxConcurrency: 4,
|
|
178
|
+
requestTimeoutMs: 10000,
|
|
179
|
+
allowedMethods: ['GET'],
|
|
180
|
+
},
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Configure request-envelope validation for Effect runtime.
|
|
185
|
+
|
|
186
|
+
Generated Effect client requests batching against `${bff.prefix}${batch.endpoint}` (for example, `/bff-api/_data/batch`).
|
|
187
|
+
|
|
188
|
+
Envelope validation is enabled by default but optional: requests without an envelope pass unless `requireEnvelope` is `true`. If an envelope is present, runtime validates it against the configured namespace, origin, trace, and selection policy. `expectedNamespace` is unset by default, and `selection` has no default limits unless configured.
|
|
189
|
+
|
|
190
|
+
Origin validation is enabled by default. Runtime compares envelope origin with request `Origin` header first, then falls back to request URL origin; set `validateOrigin: false` to disable that comparison.
|
|
191
|
+
|
|
192
|
+
```ts title="modern.config.ts"
|
|
193
|
+
export default defineConfig({
|
|
194
|
+
bff: {
|
|
195
|
+
runtimeFramework: 'effect',
|
|
196
|
+
effect: {
|
|
197
|
+
dataPlatform: {
|
|
198
|
+
requireEnvelope: true,
|
|
199
|
+
expectedNamespace: 'my-app',
|
|
200
|
+
selection: {
|
|
201
|
+
maxDepth: 6,
|
|
202
|
+
maxFields: 200,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`batch.flushIntervalMs` controls the client-side micro-batch window in the generated Effect client. `maxConcurrency` and `requestTimeoutMs` are applied by the server batch gateway when dispatching items.
|
|
211
|
+
|
|
212
|
+
The generated `api.client.*` API only exists for loader-materialized `@api/index` imports. Directly importing the server entry (`api/index`) exposes the Effect BFF definition; its `client` property is a placeholder that fails on operation access.
|
|
213
|
+
|
|
214
|
+
## Effect cohort
|
|
215
|
+
|
|
216
|
+
UltraModern-generated workspaces pin the framework-compatible Effect cohort
|
|
217
|
+
through `pnpm-workspace.yaml` overrides. For the current UltraModern cohort,
|
|
218
|
+
generated apps use:
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
minimumReleaseAgeExclude:
|
|
222
|
+
- 'effect@4.0.0-beta.102'
|
|
223
|
+
- '@effect/opentelemetry@4.0.0-beta.102'
|
|
224
|
+
|
|
225
|
+
trustPolicyExclude:
|
|
226
|
+
- 'effect@4.0.0-beta.102'
|
|
227
|
+
- '@effect/opentelemetry@4.0.0-beta.102'
|
|
228
|
+
|
|
229
|
+
overrides:
|
|
230
|
+
'@effect/opentelemetry': 4.0.0-beta.102
|
|
231
|
+
'@effect/vitest': 4.0.0-beta.102
|
|
232
|
+
effect: 4.0.0-beta.102
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Do not add a different direct `effect` version in an app package. A mismatched
|
|
236
|
+
Effect beta can fail while building layers or HTTP middleware because runtime
|
|
237
|
+
services come from different package instances. Keep the generated
|
|
238
|
+
policy exclusion entries with the same Effect cohort; they handle the
|
|
239
|
+
framework-selected Effect beta versions before the 24-hour maturity window and
|
|
240
|
+
the `effect`/`@effect/opentelemetry` trusted-publisher to provenance metadata
|
|
241
|
+
transition without weakening UltraModern API architecture checks.
|
|
242
|
+
|
|
243
|
+
## Contract tests
|
|
244
|
+
|
|
245
|
+
Strict Effect APIs should test the declared `HttpApi` contract, not a raw
|
|
246
|
+
request handler. Edge-compatible tests can use the framework helper:
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import { createEffectBffTestHandler } from '@modern-js/plugin-bff/effect-edge';
|
|
250
|
+
import apiModule from '../api/index';
|
|
251
|
+
|
|
252
|
+
const testApi = await createEffectBffTestHandler({
|
|
253
|
+
module: apiModule,
|
|
254
|
+
prefix: '/api',
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const response = await testApi.handler(new Request('http://localhost/api/ping'));
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
If you manually compose an Effect web handler in a low-level proof, provide the
|
|
261
|
+
platform services explicitly:
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import {
|
|
265
|
+
HttpApiBuilder,
|
|
266
|
+
HttpRouter,
|
|
267
|
+
HttpServer,
|
|
268
|
+
Layer,
|
|
269
|
+
} from '@modern-js/plugin-bff/effect-server';
|
|
270
|
+
|
|
271
|
+
const handler = HttpRouter.toWebHandler(
|
|
272
|
+
HttpApiBuilder.layer(api).pipe(
|
|
273
|
+
Layer.provide(apiGroupLayer),
|
|
274
|
+
Layer.provide(HttpServer.layerServices),
|
|
275
|
+
),
|
|
276
|
+
).handler;
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Prefer the generated helper unless the test needs to inspect the low-level
|
|
280
|
+
Effect router composition.
|
|
281
|
+
|
|
282
|
+
## Dynamic CORS
|
|
283
|
+
|
|
284
|
+
For dynamic origin predicates, use Effect HTTP middleware as a layer. In the
|
|
285
|
+
current Effect v4 beta cohort, `HttpRouter.middleware(...)` returns a `Layer`
|
|
286
|
+
directly:
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
import {
|
|
290
|
+
Effect,
|
|
291
|
+
HttpApiBuilder,
|
|
292
|
+
HttpMiddleware,
|
|
293
|
+
HttpRouter,
|
|
294
|
+
Layer,
|
|
295
|
+
} from '@modern-js/plugin-bff/effect-server';
|
|
296
|
+
|
|
297
|
+
const corsLayer = HttpRouter.middleware(
|
|
298
|
+
Effect.succeed(
|
|
299
|
+
HttpMiddleware.cors({
|
|
300
|
+
allowedOrigins: origin =>
|
|
301
|
+
origin.endsWith('.example.com') ? origin : undefined,
|
|
302
|
+
}),
|
|
303
|
+
),
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
const layer = HttpApiBuilder.layer(api).pipe(
|
|
307
|
+
Layer.provide(apiGroupLayer),
|
|
308
|
+
Layer.provide(corsLayer),
|
|
309
|
+
);
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Do not read a `.layer` property from `HttpRouter.middleware(...)`.
|
|
313
|
+
|
|
314
|
+
## Other transports
|
|
315
|
+
|
|
316
|
+
`strictEffectApproach` governs generated HTTP API modules. Effect RPC,
|
|
317
|
+
WebSockets, and other transports remain valid when they are modeled as explicit
|
|
318
|
+
transport surfaces with typed Effect programs. They do not make raw HTTP
|
|
319
|
+
request handlers valid inside generated UltraModern API modules.
|