@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.1 → 3.9.0-ultramodern.11
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/index.js +0 -1
- package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
- package/dist/cjs/config/index.js +4 -11
- package/dist/cjs/index.js +46 -72
- package/dist/cjs/plugins/deploy/platforms/node.js +0 -13
- package/dist/cjs/plugins/deploy/utils/generator.js +1 -1
- package/dist/cjs/plugins/serverBuild.js +2 -1
- package/dist/cjs/{plugins/backendFederationBuild.js → server-plugin.js} +4 -7
- package/dist/esm/builder/generator/index.mjs +1 -2
- package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm/config/index.mjs +0 -1
- package/dist/esm/index.mjs +3 -6
- package/dist/esm/plugins/deploy/platforms/node.mjs +0 -13
- package/dist/esm/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm/plugins/serverBuild.mjs +2 -1
- package/dist/esm/server-plugin.mjs +1 -0
- package/dist/esm-node/builder/generator/index.mjs +1 -2
- package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm-node/config/index.mjs +0 -1
- package/dist/esm-node/index.mjs +3 -6
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +0 -13
- package/dist/esm-node/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm-node/plugins/serverBuild.mjs +2 -1
- package/dist/esm-node/server-plugin.mjs +2 -0
- package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
- package/dist/types/config/index.d.ts +0 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
- package/dist/types/server-plugin.d.ts +10 -0
- package/dist/types/types/config/output.d.ts +0 -9
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/plugin.d.ts +56 -2
- package/dist/types/utils/initAppContext.d.ts +3 -2
- package/docs/apis/app/commands.md +2 -0
- package/docs/apis/app/hooks/api/lambda.md +2 -0
- package/docs/apis/app/hooks/config/favicon.md +2 -0
- package/docs/apis/app/hooks/config/html.md +2 -0
- package/docs/apis/app/hooks/config/icon.md +2 -0
- package/docs/apis/app/hooks/config/mock.md +2 -0
- package/docs/apis/app/hooks/config/public.md +2 -0
- package/docs/apis/app/hooks/config/upload.md +2 -0
- package/docs/apis/app/hooks/modern-config.md +2 -0
- package/docs/apis/app/hooks/server/server.md +2 -0
- package/docs/apis/app/hooks/shared.md +2 -0
- package/docs/apis/app/hooks/src/app.md +2 -0
- package/docs/apis/app/hooks/src/entry.md +2 -0
- package/docs/apis/app/hooks/src/entry.server.md +2 -0
- package/docs/apis/app/hooks/src/modern.runtime.md +2 -0
- package/docs/apis/app/hooks/src/routes.md +2 -0
- package/docs/apis/app/hooks/src/server.md +2 -0
- package/docs/apis/app/runtime/bff/use-backend-context.md +2 -0
- package/docs/apis/app/runtime/core/create-root.md +2 -0
- package/docs/apis/app/runtime/core/render.md +2 -0
- package/docs/apis/app/runtime/core/runtime-context.md +2 -0
- package/docs/apis/app/runtime/router/router.md +2 -0
- package/docs/apis/app/runtime/ssr/no-ssr.md +2 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.md +2 -0
- package/docs/apis/app/runtime/ssr/renderString.md +2 -0
- package/docs/apis/app/runtime/ssr/requestHandler.md +2 -0
- package/docs/apis/app/runtime/utility/css-in-js.md +2 -0
- package/docs/apis/app/runtime/utility/head.md +2 -0
- package/docs/apis/app/runtime/utility/loadable.md +2 -0
- package/docs/community/blog/2022-0708-updates.md +2 -0
- package/docs/community/blog/2022-0910-updates.md +2 -0
- package/docs/community/blog/overview.md +2 -0
- package/docs/community/blog/v2-release-note.md +2 -0
- package/docs/community/blog/v3-release-note.md +2 -0
- package/docs/community/contributing-guide.md +2 -0
- package/docs/community/releases.md +2 -0
- package/docs/community/showcase.md +2 -0
- package/docs/community/team.md +2 -0
- package/docs/configure/app/bff/cross-project.md +2 -0
- package/docs/configure/app/bff/effect.md +31 -24
- package/docs/configure/app/bff/prefix.md +2 -0
- package/docs/configure/app/bff/runtime-framework.md +2 -0
- package/docs/configure/app/builder-plugins.md +2 -0
- package/docs/configure/app/dev/asset-prefix.md +2 -0
- package/docs/configure/app/dev/before-start-url.md +2 -0
- package/docs/configure/app/dev/client.md +2 -0
- package/docs/configure/app/dev/hmr.md +2 -0
- package/docs/configure/app/dev/host.md +2 -0
- package/docs/configure/app/dev/https.md +2 -0
- package/docs/configure/app/dev/lazy-compilation.md +2 -0
- package/docs/configure/app/dev/live-reload.md +2 -0
- package/docs/configure/app/dev/mock-dir.md +2 -0
- package/docs/configure/app/dev/progress-bar.md +2 -0
- package/docs/configure/app/dev/server.md +2 -0
- package/docs/configure/app/dev/setup-middlewares.md +2 -0
- package/docs/configure/app/dev/start-url.md +2 -0
- package/docs/configure/app/dev/watch-files.md +2 -0
- package/docs/configure/app/dev/write-to-disk.md +2 -0
- package/docs/configure/app/experiments/source-build.md +2 -0
- package/docs/configure/app/html/app-icon.md +2 -0
- package/docs/configure/app/html/crossorigin.md +2 -0
- package/docs/configure/app/html/favicon.md +2 -0
- package/docs/configure/app/html/inject.md +2 -0
- package/docs/configure/app/html/meta.md +2 -0
- package/docs/configure/app/html/mount-id.md +2 -0
- package/docs/configure/app/html/output-structure.md +2 -0
- package/docs/configure/app/html/script-loading.md +2 -0
- package/docs/configure/app/html/tags.md +2 -0
- package/docs/configure/app/html/template-parameters.md +2 -0
- package/docs/configure/app/html/template.md +2 -0
- package/docs/configure/app/html/title.md +2 -0
- package/docs/configure/app/output/asset-prefix.md +2 -0
- package/docs/configure/app/output/assets-retry.md +2 -0
- package/docs/configure/app/output/charset.md +2 -0
- package/docs/configure/app/output/clean-dist-path.md +2 -0
- package/docs/configure/app/output/convert-to-rem.md +2 -0
- package/docs/configure/app/output/copy.md +2 -0
- package/docs/configure/app/output/css-modules.md +2 -0
- package/docs/configure/app/output/data-uri-limit.md +2 -0
- package/docs/configure/app/output/disable-css-module-extension.md +2 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.md +2 -0
- package/docs/configure/app/output/disable-svgr.md +2 -0
- package/docs/configure/app/output/disable-ts-checker.md +2 -0
- package/docs/configure/app/output/dist-path.md +2 -0
- package/docs/configure/app/output/enable-asset-manifest.md +2 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.md +2 -0
- package/docs/configure/app/output/enable-inline-route-manifests.md +2 -0
- package/docs/configure/app/output/externals.md +2 -0
- package/docs/configure/app/output/filename-hash.md +2 -0
- package/docs/configure/app/output/filename.md +2 -0
- package/docs/configure/app/output/inject-styles.md +2 -0
- package/docs/configure/app/output/inline-scripts.md +2 -0
- package/docs/configure/app/output/inline-styles.md +2 -0
- package/docs/configure/app/output/legal-comments.md +2 -0
- package/docs/configure/app/output/minify.md +2 -0
- package/docs/configure/app/output/override-browserslist.md +2 -0
- package/docs/configure/app/output/polyfill.md +2 -0
- package/docs/configure/app/output/source-map.md +2 -0
- package/docs/configure/app/output/split-route-chunks.md +2 -0
- package/docs/configure/app/output/ssg.md +2 -0
- package/docs/configure/app/output/ssgByEntries.md +2 -0
- package/docs/configure/app/output/svg-default-export.md +2 -0
- package/docs/configure/app/output/temp-dir.md +2 -0
- package/docs/configure/app/performance/build-cache.md +2 -0
- package/docs/configure/app/performance/chunk-split.md +2 -0
- package/docs/configure/app/performance/dns-prefetch.md +2 -0
- package/docs/configure/app/performance/preconnect.md +2 -0
- package/docs/configure/app/performance/prefetch.md +2 -0
- package/docs/configure/app/performance/preload.md +2 -0
- package/docs/configure/app/performance/print-file-size.md +2 -0
- package/docs/configure/app/performance/profile.md +2 -0
- package/docs/configure/app/performance/remove-console.md +2 -0
- package/docs/configure/app/performance/remove-moment-locale.md +2 -0
- package/docs/configure/app/performance/rsdoctor.md +2 -0
- package/docs/configure/app/plugins.md +2 -0
- package/docs/configure/app/resolve/alias-strategy.md +2 -0
- package/docs/configure/app/resolve/alias.md +2 -0
- package/docs/configure/app/resolve/condition-names.md +2 -0
- package/docs/configure/app/resolve/dedupe.md +2 -0
- package/docs/configure/app/resolve/extensions.md +2 -0
- package/docs/configure/app/runtime/0-intro.md +2 -0
- package/docs/configure/app/runtime/plugins.md +2 -0
- package/docs/configure/app/runtime/router.md +2 -0
- package/docs/configure/app/security/check-syntax.md +2 -0
- package/docs/configure/app/security/nonce.md +2 -0
- package/docs/configure/app/security/sri.md +2 -0
- package/docs/configure/app/server/base-url.md +2 -0
- package/docs/configure/app/server/port.md +2 -0
- package/docs/configure/app/server/public-routes.md +2 -0
- package/docs/configure/app/server/routes.md +2 -0
- package/docs/configure/app/server/rsc.md +2 -0
- package/docs/configure/app/server/ssr-by-entries.md +2 -0
- package/docs/configure/app/server/ssr.md +2 -0
- package/docs/configure/app/server/tsconfig-path.md +2 -0
- package/docs/configure/app/source/alias-strategy.md +2 -0
- package/docs/configure/app/source/alias.md +2 -0
- package/docs/configure/app/source/config-dir.md +2 -0
- package/docs/configure/app/source/decorators.md +2 -0
- package/docs/configure/app/source/define.md +2 -0
- package/docs/configure/app/source/disable-default-entries.md +2 -0
- package/docs/configure/app/source/enable-async-entry.md +2 -0
- package/docs/configure/app/source/enable-async-pre-entry.md +2 -0
- package/docs/configure/app/source/entries-dir.md +2 -0
- package/docs/configure/app/source/entries.md +2 -0
- package/docs/configure/app/source/exclude.md +2 -0
- package/docs/configure/app/source/global-vars.md +2 -0
- package/docs/configure/app/source/include.md +2 -0
- package/docs/configure/app/source/main-entry-name.md +2 -0
- package/docs/configure/app/source/pre-entry.md +2 -0
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/configure/app/source/transform-import.md +2 -0
- package/docs/configure/app/split-chunks.md +2 -0
- package/docs/configure/app/tools/autoprefixer.md +2 -0
- package/docs/configure/app/tools/bundler-chain.md +2 -0
- package/docs/configure/app/tools/css-extract.md +2 -0
- package/docs/configure/app/tools/css-loader.md +2 -0
- package/docs/configure/app/tools/dev-server.md +2 -0
- package/docs/configure/app/tools/html-plugin.md +2 -0
- package/docs/configure/app/tools/less.md +2 -0
- package/docs/configure/app/tools/lightningcss-loader.md +2 -0
- package/docs/configure/app/tools/minify-css.md +2 -0
- package/docs/configure/app/tools/postcss.md +2 -0
- package/docs/configure/app/tools/rspack.md +2 -0
- package/docs/configure/app/tools/sass.md +2 -0
- package/docs/configure/app/tools/style-loader.md +2 -0
- package/docs/configure/app/tools/swc.md +2 -0
- package/docs/configure/app/tools/ts-checker.md +2 -0
- package/docs/configure/app/usage.md +2 -0
- package/docs/guides/advanced-features/bff/cross-project.md +2 -0
- package/docs/guides/advanced-features/bff/data-platform.md +4 -2
- package/docs/guides/advanced-features/bff/extend-server.md +2 -0
- package/docs/guides/advanced-features/bff/frameworks.md +38 -24
- package/docs/guides/advanced-features/bff/function.md +4 -2
- package/docs/guides/advanced-features/bff/operators.md +19 -17
- package/docs/guides/advanced-features/bff/sdk.md +2 -0
- package/docs/guides/advanced-features/bff/upload.md +2 -0
- package/docs/guides/advanced-features/bff.md +2 -0
- package/docs/guides/advanced-features/build-performance.md +2 -0
- package/docs/guides/advanced-features/compatibility.md +2 -0
- package/docs/guides/advanced-features/international/advanced.md +2 -0
- package/docs/guides/advanced-features/international/api.md +2 -0
- package/docs/guides/advanced-features/international/best-practices.md +2 -0
- package/docs/guides/advanced-features/international/configuration.md +2 -0
- package/docs/guides/advanced-features/international/locale-detection.md +2 -0
- package/docs/guides/advanced-features/international/quick-start.md +2 -0
- package/docs/guides/advanced-features/international/resource-loading.md +2 -0
- package/docs/guides/advanced-features/international/routing.md +2 -0
- package/docs/guides/advanced-features/international.md +2 -0
- package/docs/guides/advanced-features/low-level.md +2 -0
- package/docs/guides/advanced-features/page-performance/code-split.md +2 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.md +2 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.md +2 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.md +2 -0
- package/docs/guides/advanced-features/server-monitor/logger.md +2 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +2 -0
- package/docs/guides/advanced-features/server-monitor/monitors.md +2 -0
- package/docs/guides/advanced-features/source-build.md +2 -0
- package/docs/guides/advanced-features/web-server.md +2 -0
- package/docs/guides/basic-features/alias.md +2 -0
- package/docs/guides/basic-features/css/css-in-js.md +2 -0
- package/docs/guides/basic-features/css/css-modules.md +2 -0
- package/docs/guides/basic-features/css/css.md +2 -0
- package/docs/guides/basic-features/css/tailwindcss.md +2 -0
- package/docs/guides/basic-features/data/data-cache.md +2 -0
- package/docs/guides/basic-features/data/data-fetch.md +2 -0
- package/docs/guides/basic-features/data/data-write.md +2 -0
- package/docs/guides/basic-features/debug/mock.md +2 -0
- package/docs/guides/basic-features/debug/proxy.md +2 -0
- package/docs/guides/basic-features/debug/rsdoctor.md +2 -0
- package/docs/guides/basic-features/debug/using-storybook.md +2 -0
- package/docs/guides/basic-features/deploy.md +2 -0
- package/docs/guides/basic-features/env-vars.md +2 -0
- package/docs/guides/basic-features/html.md +2 -0
- package/docs/guides/basic-features/output-files.md +2 -0
- package/docs/guides/basic-features/render/before-render.md +2 -0
- package/docs/guides/basic-features/render/overview.md +2 -0
- package/docs/guides/basic-features/render/rsc.md +2 -0
- package/docs/guides/basic-features/render/ssg.md +2 -0
- package/docs/guides/basic-features/render/ssr-cache.md +16 -1
- package/docs/guides/basic-features/render/ssr.md +2 -0
- package/docs/guides/basic-features/render/streaming-ssr.md +2 -0
- package/docs/guides/basic-features/routes/config-routes.md +2 -0
- package/docs/guides/basic-features/routes/routes.md +2 -0
- package/docs/guides/basic-features/static-assets/json-files.md +2 -0
- package/docs/guides/basic-features/static-assets/svg-assets.md +2 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.md +2 -0
- package/docs/guides/basic-features/static-assets.md +2 -0
- package/docs/guides/basic-features/testing/playwright.md +2 -0
- package/docs/guides/basic-features/testing/rstest.md +2 -0
- package/docs/guides/concept/builder.md +2 -0
- package/docs/guides/concept/entries.md +2 -0
- package/docs/guides/concept/server.md +2 -0
- package/docs/guides/get-started/ai-coding-agents.md +2 -0
- package/docs/guides/get-started/glossary.md +2 -0
- package/docs/guides/get-started/introduction.md +2 -0
- package/docs/guides/get-started/quick-start.md +3 -5
- package/docs/guides/get-started/tech-stack.md +2 -0
- package/docs/guides/get-started/ultramodern.md +11 -90
- package/docs/guides/get-started/upgrade.md +2 -0
- package/docs/guides/topic-detail/module-federation/application.md +2 -0
- package/docs/guides/topic-detail/module-federation/deploy.md +2 -0
- package/docs/guides/topic-detail/module-federation/i18n.md +2 -0
- package/docs/guides/topic-detail/module-federation/introduce.md +2 -0
- package/docs/guides/topic-detail/module-federation/ssr.md +2 -0
- package/docs/guides/topic-detail/module-federation/usage.md +2 -0
- package/docs/guides/troubleshooting/builder.md +2 -0
- package/docs/guides/troubleshooting/cli.md +2 -0
- package/docs/guides/troubleshooting/dependencies.md +2 -0
- package/docs/guides/troubleshooting/hmr.md +2 -0
- package/docs/guides/upgrade/config.md +2 -0
- package/docs/guides/upgrade/entry.md +2 -0
- package/docs/guides/upgrade/other.md +2 -0
- package/docs/guides/upgrade/overview.md +2 -0
- package/docs/guides/upgrade/tailwindcss.md +2 -0
- package/docs/guides/upgrade/web-server.md +2 -0
- package/docs/index.md +2 -0
- package/docs/llms.txt +2 -2
- package/docs/plugin/cli-plugins/api.md +2 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +2 -0
- package/docs/plugin/official/cli-plugins/plugin-bff.md +2 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +2 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +2 -0
- package/docs/plugin/official/cli-plugins.md +2 -0
- package/docs/plugin/plugin-system.md +2 -0
- package/docs/plugin/runtime-plugins/api.md +2 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +2 -0
- package/docs/plugin/server-plugins/life-cycle.md +2 -0
- package/docs/tutorials/examples/csr-auth.md +2 -0
- package/docs/tutorials/foundations/introduction.md +2 -0
- package/package.json +30 -38
- package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
- package/dist/cjs/config/build-environment.js +0 -268
- package/dist/cjs/config/public.js +0 -46
- package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
- package/dist/cjs/plugins/backend-federation/config.js +0 -204
- package/dist/cjs/plugins/backend-federation/emit.js +0 -150
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
- package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
- package/dist/cjs/presetUltramodern.js +0 -168
- package/dist/cjs/types/config/precompress.js +0 -18
- package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
- package/dist/esm/config/build-environment.mjs +0 -224
- package/dist/esm/config/public.mjs +0 -1
- package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
- package/dist/esm/plugins/backend-federation/config.mjs +0 -128
- package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
- package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
- package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
- package/dist/esm/presetUltramodern.mjs +0 -112
- package/dist/esm/types/config/precompress.mjs +0 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
- package/dist/esm-node/config/build-environment.mjs +0 -225
- package/dist/esm-node/config/public.mjs +0 -2
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
- package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
- package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
- package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
- package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
- package/dist/esm-node/presetUltramodern.mjs +0 -113
- package/dist/esm-node/types/config/precompress.mjs +0 -1
- package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
- package/dist/types/config/build-environment.d.ts +0 -22
- package/dist/types/config/public.d.ts +0 -2
- package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
- package/dist/types/plugins/backend-federation/config.d.ts +0 -103
- package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
- package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
- package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
- package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
- package/dist/types/presetUltramodern.d.ts +0 -87
- package/dist/types/types/config/precompress.d.ts +0 -20
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { type PolicyDefaultsOptions } from '@modern-js/app-tools-extensions/policy-defaults';
|
|
1
2
|
import type { AppTools, CliPlugin } from './types/index.js';
|
|
2
3
|
import { initAppContext } from './utils/initAppContext.js';
|
|
3
4
|
export * from './defineConfig.js';
|
|
4
|
-
export
|
|
5
|
-
export declare const appTools: () => CliPlugin<AppTools>;
|
|
5
|
+
export declare const appTools: (options?: PolicyDefaultsOptions) => CliPlugin<AppTools>;
|
|
6
6
|
export { build } from './commands/build.js';
|
|
7
7
|
export { deploy } from './commands/deploy.js';
|
|
8
8
|
export { dev } from './commands/dev.js';
|
|
@@ -6,7 +6,7 @@ export declare const serverAppContextTemplate: (appContext: AppToolsContext) =>
|
|
|
6
6
|
apiDirectory: string;
|
|
7
7
|
lambdaDirectory: string;
|
|
8
8
|
metaName: string;
|
|
9
|
-
bffRuntimeFramework:
|
|
9
|
+
bffRuntimeFramework: keyof import("@modern-js/plugin/server").BffRuntimeRegistry;
|
|
10
10
|
};
|
|
11
11
|
export type PluginItem = [string, Record<string, any> | undefined];
|
|
12
12
|
export declare const genPluginImportsCode: (plugins: PluginItem[], isESM?: boolean) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fork's default server policy (localised loaders, error responses,
|
|
3
|
+
* telemetry, module-federation CSS and asset headers, static serving).
|
|
4
|
+
*
|
|
5
|
+
* It is exposed from `@modern-js/app-tools` so a plain `appTools()` app can
|
|
6
|
+
* load it by a specifier it is guaranteed to be able to resolve: every app
|
|
7
|
+
* declares `@modern-js/app-tools`, but not necessarily
|
|
8
|
+
* `@modern-js/server-runtime-extensions`.
|
|
9
|
+
*/
|
|
10
|
+
export { default } from '@modern-js/server-runtime-extensions/server-plugin';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
2
|
import type { SSGConfig, SSGMultiEntryOptions } from '@modern-js/types';
|
|
3
3
|
import type { UnwrapBuilderConfig } from '../utils.js';
|
|
4
|
-
import type { PrecompressConfig } from './precompress.js';
|
|
5
|
-
export type { PrecompressCodecOptions, PrecompressConfig } from './precompress.js';
|
|
6
4
|
export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'output'> {
|
|
7
5
|
/**
|
|
8
6
|
* Enable SSG for self-controlled routing or conventional routing.
|
|
@@ -34,12 +32,5 @@ export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'ou
|
|
|
34
32
|
* Specify the temporary directory for framework generated files.
|
|
35
33
|
*/
|
|
36
34
|
tempDir?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Generate precompressed static assets by using compression-webpack-plugin.
|
|
39
|
-
* `true` means enabling both gzip and brotli with default options.
|
|
40
|
-
* Disabled unless explicitly configured; `presetUltramodern` enables it.
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
precompress?: boolean | PrecompressConfig;
|
|
44
35
|
}
|
|
45
36
|
export type { SSGConfig, SSGMultiEntryOptions, SSGRouteOptions, SSGSingleEntryOptions, } from '@modern-js/types';
|
|
@@ -7,4 +7,4 @@ export type { CLIPluginExtends, RuntimePluginConfig, ServerPluginConfig };
|
|
|
7
7
|
export type AppUserConfig = AppToolsUserConfig;
|
|
8
8
|
export type AppNormalizedConfig = AppToolsNormalizedConfig;
|
|
9
9
|
export type AppToolsAPI = CLIPluginAPI<AppTools>;
|
|
10
|
-
export type { AppToolsContext, AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks, AppToolsHooks as AppToolsFeatureHooks, } from './plugin.js';
|
|
10
|
+
export type { AfterBffCompileFn, AppToolsContext, AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks, AppToolsHooks as AppToolsFeatureHooks, BeforeBffCompileFn, BffClientArtifact, BffClientArtifacts, BffCompilation, BffGeneratedEntries, BffGeneratedModule, BffGeneration, ModifyBffClientArtifactsFn, ModifyBffGeneratedEntriesFn, } from './plugin.js';
|
|
@@ -1,11 +1,59 @@
|
|
|
1
1
|
import type { AppContext, AsyncHook, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin';
|
|
2
2
|
import type { Hooks } from '@modern-js/plugin/cli';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BffRuntimeFramework } from '@modern-js/plugin/server';
|
|
4
|
+
import type { Entrypoint, HtmlPartials, HtmlTemplates, HttpMethodDecider, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
|
|
4
5
|
import type { EagerRouteComponentFilesByEntry } from '@modern-js/utils';
|
|
5
6
|
import type { EnvironmentConfig } from '@rsbuild/core';
|
|
6
7
|
import type { getHookRunners } from '../compat/hooks.js';
|
|
7
8
|
import type { AppTools } from './index.js';
|
|
8
9
|
import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config/index.js';
|
|
10
|
+
export interface BffCompilation {
|
|
11
|
+
readonly appDirectory: string;
|
|
12
|
+
readonly apiDirectory: string;
|
|
13
|
+
readonly sourceDirectories: readonly string[];
|
|
14
|
+
readonly outputDirectories: readonly string[];
|
|
15
|
+
readonly distDirectory: string;
|
|
16
|
+
readonly tsconfigPath?: string;
|
|
17
|
+
readonly moduleType: AppToolsContext['moduleType'];
|
|
18
|
+
}
|
|
19
|
+
export interface BffGeneration {
|
|
20
|
+
readonly appDirectory: string;
|
|
21
|
+
readonly apiDirectory: string;
|
|
22
|
+
readonly lambdaDirectory: string;
|
|
23
|
+
readonly existLambda: boolean;
|
|
24
|
+
readonly apiFiles: readonly string[];
|
|
25
|
+
readonly relativeDistPath: string;
|
|
26
|
+
readonly prefix: string;
|
|
27
|
+
readonly port?: number;
|
|
28
|
+
readonly requestId: string;
|
|
29
|
+
readonly requestCreator?: string;
|
|
30
|
+
readonly httpMethodDecider?: HttpMethodDecider;
|
|
31
|
+
}
|
|
32
|
+
export interface BffClientArtifact {
|
|
33
|
+
/** Canonical relative source path under generation.apiDirectory. */
|
|
34
|
+
readonly sourcePath: string;
|
|
35
|
+
readonly code: string;
|
|
36
|
+
readonly declaration: string;
|
|
37
|
+
}
|
|
38
|
+
export interface BffClientArtifacts {
|
|
39
|
+
readonly generation: BffGeneration;
|
|
40
|
+
additionalArtifacts: BffClientArtifact[];
|
|
41
|
+
}
|
|
42
|
+
export interface BffGeneratedModule {
|
|
43
|
+
readonly code: string;
|
|
44
|
+
readonly declaration: string;
|
|
45
|
+
}
|
|
46
|
+
export interface BffGeneratedEntries {
|
|
47
|
+
readonly generation: BffGeneration;
|
|
48
|
+
plugin: BffGeneratedModule;
|
|
49
|
+
runtime: BffGeneratedModule | null;
|
|
50
|
+
/** Direct dependencies required by the emitted SDK modules. */
|
|
51
|
+
packageDependencies: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
export type BeforeBffCompileFn = (context: BffCompilation) => void | Promise<void>;
|
|
54
|
+
export type AfterBffCompileFn = (context: BffCompilation) => void | Promise<void>;
|
|
55
|
+
export type ModifyBffClientArtifactsFn = TransformFunction<BffClientArtifacts>;
|
|
56
|
+
export type ModifyBffGeneratedEntriesFn = TransformFunction<BffGeneratedEntries>;
|
|
9
57
|
export type AfterPrepareFn = () => Promise<void> | void;
|
|
10
58
|
export type CheckEntryPointFn = TransformFunction<{
|
|
11
59
|
path: string;
|
|
@@ -64,6 +112,10 @@ export interface AppToolsExtendAPI {
|
|
|
64
112
|
useHookRunners: () => ReturnType<typeof getHookRunners>;
|
|
65
113
|
}
|
|
66
114
|
export interface AppToolsExtendHooks extends Record<string, PluginHook<(...args: any[]) => any>> {
|
|
115
|
+
onBeforeBffCompile: AsyncHook<BeforeBffCompileFn>;
|
|
116
|
+
onAfterBffCompile: AsyncHook<AfterBffCompileFn>;
|
|
117
|
+
modifyBffClientArtifacts: AsyncHook<ModifyBffClientArtifactsFn>;
|
|
118
|
+
modifyBffGeneratedEntries: AsyncHook<ModifyBffGeneratedEntriesFn>;
|
|
67
119
|
onAfterPrepare: AsyncHook<AfterPrepareFn>;
|
|
68
120
|
deploy: AsyncHook<DeplpoyFn>;
|
|
69
121
|
checkEntryPoint: AsyncHook<CheckEntryPointFn>;
|
|
@@ -88,6 +140,8 @@ export interface AppToolsExtendContext {
|
|
|
88
140
|
runtimeConfigFile: string;
|
|
89
141
|
serverPlugins: ServerPlugin[];
|
|
90
142
|
moduleType: 'module' | 'commonjs';
|
|
143
|
+
/** Exact generated files excluded from server compilation. */
|
|
144
|
+
serverCompileExcludedFiles?: string[];
|
|
91
145
|
/** Information for entry points */
|
|
92
146
|
entrypoints: Entrypoint[];
|
|
93
147
|
/** Selected entry points */
|
|
@@ -115,7 +169,7 @@ export interface AppToolsExtendContext {
|
|
|
115
169
|
* Identification for bff runtime framework
|
|
116
170
|
* @private
|
|
117
171
|
*/
|
|
118
|
-
bffRuntimeFramework?:
|
|
172
|
+
bffRuntimeFramework?: BffRuntimeFramework;
|
|
119
173
|
/**
|
|
120
174
|
* Route component files collected from the FINAL file-system routes (after all
|
|
121
175
|
* `modifyFileSystemRoutes` consumers ran), keyed by entry name. Populated by
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BffRuntimeFramework } from '@modern-js/plugin/server';
|
|
1
2
|
export declare const initAppContext: ({ metaName, appDirectory, runtimeConfigFile, options, tempDir, }: {
|
|
2
3
|
metaName: string;
|
|
3
4
|
appDirectory: string;
|
|
@@ -7,7 +8,7 @@ export declare const initAppContext: ({ metaName, appDirectory, runtimeConfigFil
|
|
|
7
8
|
apiDir?: string;
|
|
8
9
|
distDir?: string;
|
|
9
10
|
sharedDir?: string;
|
|
10
|
-
bffRuntimeFramework?:
|
|
11
|
+
bffRuntimeFramework?: BffRuntimeFramework;
|
|
11
12
|
};
|
|
12
13
|
tempDir?: string;
|
|
13
14
|
}) => {
|
|
@@ -27,5 +28,5 @@ export declare const initAppContext: ({ metaName, appDirectory, runtimeConfigFil
|
|
|
27
28
|
apiOnly: boolean;
|
|
28
29
|
internalDirAlias: string;
|
|
29
30
|
internalSrcAlias: string;
|
|
30
|
-
bffRuntimeFramework:
|
|
31
|
+
bffRuntimeFramework: keyof import("@modern-js/plugin/server").BffRuntimeRegistry;
|
|
31
32
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Commands
|
|
2
4
|
|
|
3
5
|
UltraModern.js has some built-in commands that can help you quickly start a development server, build production environment code, and more.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# lambda/\*.ts
|
|
2
4
|
|
|
3
5
|
After enabling BFF, the files under the `lambda/` directory will be registered as BFF routes according to conventions.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Favicon
|
|
2
4
|
|
|
3
5
|
When there is a `favicon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.favicon](/configure/app/html/favicon.md) configuration option for generating the favicon icon on the page:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# html/
|
|
2
4
|
|
|
3
5
|
You can inject custom HTML fragments at different locations of the default internal HTML template through the `config/html` directory.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Apple Touch Icon
|
|
2
4
|
|
|
3
5
|
When there is an `icon.*` file in the `config` directory at the root of the project, Modern.js will automatically set the file to the [html.appIcon](/configure/app/html/app-icon.md) configuration option for generating the Apple Touch Icon icon under the iOS system.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# public/
|
|
2
4
|
|
|
3
5
|
Any static assets can be placed in the `public/` directory, and the files will be deployed to the corresponding application domain by the server.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# modern.config.ts
|
|
2
4
|
|
|
3
5
|
The Modern.js configuration file. Through this file, you can personalize the configuration of various aspects of the current project.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# modern.server.ts
|
|
2
4
|
|
|
3
5
|
This file extends the Modern.js Server. In this file, you can configure [Middleware](/guides/advanced-features/web-server.md#middleware), [RenderMiddleware](/guides/advanced-features/web-server.md#rendermiddleware), or [Plugin](/guides/advanced-features/web-server.md#plugin) for the Server that starts with the Modern.js project.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# shared/
|
|
2
4
|
|
|
3
5
|
Shared source code directory. When there is common code in `api/`, `server/`, and `src/` in the project, you can put these codes in the `shared` directory instead of directly referencing them.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# App.tsx
|
|
2
4
|
|
|
3
5
|
The entry identifier when using [Self-controlled Routing](/guides/concept/entries.md#self-controlled-routing) in the application.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# entry.tsx
|
|
2
4
|
|
|
3
5
|
Normally, the [`routes/`](/apis/app/hooks/src/routes.md) and [`App.tsx`](/apis/app/hooks/src/app.md) hook files can meet our needs. When we need to add custom behavior before component rendering or take full control of the Rspack packaging entry, we can create `entry.ts` file in the src or entry directory. Here are two cases for discussion。
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# entry.server.tsx
|
|
2
4
|
|
|
3
5
|
When the project initiates `server.ssr`, Modern.js generates a default Server-Side entry. The sample code is as follows:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# modern.runtime.ts
|
|
2
4
|
|
|
3
5
|
The Modern.js Runtime configuration file allows for personalized configuration of the Runtime capabilities for the current project.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# routes/
|
|
2
4
|
|
|
3
5
|
The identifier for the entry point when the application uses [Conventional Routing](/guides/basic-features/routes/routes.md#conventional-routing).
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# \*.\[server|node].tsx
|
|
2
4
|
|
|
3
5
|
Used in the application project to place server-side code. When `*.tsx` and `*.[server|node].tsx` coexist, SSR will prefer to use the `*.[server|node].tsx` file instead of the `*.tsx` file when rendering on the server.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# createRoot
|
|
2
4
|
|
|
3
5
|
It is used to create the root component provided by Modern.js, which will automatically register Runtime plugins and complete the initialization of Runtime plugins.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# RuntimeContext
|
|
2
4
|
|
|
3
5
|
`RuntimeContext` is a React Context used to get Runtime context information in components. This Context can be accessed through React's `use` or `useContext` API.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# NoSSR
|
|
2
4
|
|
|
3
5
|
The content wrapped by NoSSR will not be rendered at the server, nor will it be rendered during the client side hydrate. it will only be rendered immediately after the entire app is rendered.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# renderStreaming
|
|
2
4
|
|
|
3
5
|
Used for `React v18` + `Streaming SSR` to render readable streams, used in conjunction with `createRequestHandler`.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Contributing Guide
|
|
2
4
|
|
|
3
5
|
Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Ecosystem
|
|
2
4
|
|
|
3
5
|
UltraModern.js builds on a focused ecosystem of frameworks and tools. These projects provide the Effect, TanStack Router, build, documentation, and Module Federation foundations used by the fork.
|
package/docs/community/team.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# bff.effect
|
|
2
4
|
|
|
3
5
|
- **Type:**
|
|
@@ -43,21 +45,33 @@ Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enabl
|
|
|
43
45
|
|
|
44
46
|
:::caution Install the Effect peers yourself
|
|
45
47
|
`effect` and `@effect/opentelemetry` are **optional exact peer dependencies** of
|
|
46
|
-
`@modern-js/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
`/effect-server`, `/effect-edge` or `/effect-client`, install the exact cohort:
|
|
48
|
+
`@modern-js/bff-effect`. Install them in the application so its API modules and
|
|
49
|
+
the framework use the same Effect instance. Before setting
|
|
50
|
+
`runtimeFramework: 'effect'` or importing `@modern-js/bff-effect/effect`,
|
|
51
|
+
`/effect-edge` or `/effect-client`, install the exact cohort:
|
|
51
52
|
|
|
52
53
|
```bash
|
|
53
54
|
pnpm add effect@4.0.0-rc.112 @effect/opentelemetry@4.0.0-rc.112
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
The pin is exact because UltraModern ships Effect as one lockstep cohort. Apps
|
|
57
|
-
using only `runtimeFramework: 'hono'` or
|
|
58
|
-
package.
|
|
58
|
+
using only native `runtimeFramework: 'hono'` or
|
|
59
|
+
`@modern-js/bff-effect/data-platform` need neither package.
|
|
59
60
|
:::
|
|
60
61
|
|
|
62
|
+
Use `bffPlugin` from `@modern-js/plugin-bff-build-extensions` to register the
|
|
63
|
+
Effect runtime. It composes the native BFF plugin. Install
|
|
64
|
+
`@modern-js/bff-effect` and `@modern-js/plugin-bff-extensions` from the same
|
|
65
|
+
framework cohort as application production dependencies, so the adapter remains
|
|
66
|
+
available after development dependencies are removed. The build plugin can be a
|
|
67
|
+
development dependency. See the [runtime configuration example](/guides/advanced-features/bff/frameworks.md).
|
|
68
|
+
|
|
69
|
+
Native `@modern-js/plugin-bff/server` exports Hono APIs. For Node Effect APIs,
|
|
70
|
+
import framework helpers such as `defineEffectBff` from
|
|
71
|
+
`@modern-js/bff-effect/effect` and namespaces from the corresponding `effect/*`
|
|
72
|
+
modules. Worker handlers and worker request context use
|
|
73
|
+
`@modern-js/bff-effect/effect-edge`.
|
|
74
|
+
|
|
61
75
|
Generated UltraModern workspaces use this runtime as the only generated HTTP API
|
|
62
76
|
path. The API contract lives at `shared/api.ts`, the server runtime lives at
|
|
63
77
|
`api/index.ts`, clients live under `src/api/*-client.ts`, and generated checks
|
|
@@ -169,7 +183,6 @@ export default defineConfig({
|
|
|
169
183
|
endpoint: '/_data/batch',
|
|
170
184
|
maxBatchSize: 16,
|
|
171
185
|
maxBatchBytes: 64 * 1024,
|
|
172
|
-
flushIntervalMs: 8,
|
|
173
186
|
maxConcurrency: 4,
|
|
174
187
|
requestTimeoutMs: 10000,
|
|
175
188
|
allowedMethods: ['GET'],
|
|
@@ -203,9 +216,9 @@ export default defineConfig({
|
|
|
203
216
|
});
|
|
204
217
|
```
|
|
205
218
|
|
|
206
|
-
`
|
|
219
|
+
`maxConcurrency` and `requestTimeoutMs` control the server batch gateway. Native `HttpApiClient` calls send individual requests; they do not automatically batch requests.
|
|
207
220
|
|
|
208
|
-
|
|
221
|
+
Import a shared `HttpApi` contract and pass it to `HttpApiClient.make` or `makeEffectHttpApiClient`. The client is fully type-inferred; `defineEffectBff` exposes server handlers and does not contain a client.
|
|
209
222
|
|
|
210
223
|
## Effect cohort
|
|
211
224
|
|
|
@@ -240,7 +253,7 @@ Strict Effect APIs should test the declared `HttpApi` contract, not a raw
|
|
|
240
253
|
request handler. Edge-compatible tests can use the framework helper:
|
|
241
254
|
|
|
242
255
|
```ts
|
|
243
|
-
import { createEffectBffTestHandler } from '@modern-js/
|
|
256
|
+
import { createEffectBffTestHandler } from '@modern-js/bff-effect/effect-edge';
|
|
244
257
|
import apiModule from '../api/index';
|
|
245
258
|
|
|
246
259
|
const testApi = await createEffectBffTestHandler({
|
|
@@ -255,12 +268,9 @@ If you manually compose an Effect web handler in a low-level proof, provide the
|
|
|
255
268
|
platform services explicitly:
|
|
256
269
|
|
|
257
270
|
```ts
|
|
258
|
-
import
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
HttpServer,
|
|
262
|
-
Layer,
|
|
263
|
-
} from '@modern-js/plugin-bff/effect-server';
|
|
271
|
+
import * as Layer from 'effect/Layer';
|
|
272
|
+
import { HttpRouter, HttpServer } from 'effect/unstable/http';
|
|
273
|
+
import { HttpApiBuilder } from 'effect/unstable/httpapi';
|
|
264
274
|
|
|
265
275
|
const handler = HttpRouter.toWebHandler(
|
|
266
276
|
HttpApiBuilder.layer(api).pipe(
|
|
@@ -280,13 +290,10 @@ current Effect v4 beta cohort, `HttpRouter.middleware(...)` returns a `Layer`
|
|
|
280
290
|
directly:
|
|
281
291
|
|
|
282
292
|
```ts
|
|
283
|
-
import
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
HttpRouter,
|
|
288
|
-
Layer,
|
|
289
|
-
} from '@modern-js/plugin-bff/effect-server';
|
|
293
|
+
import * as Effect from 'effect/Effect';
|
|
294
|
+
import * as Layer from 'effect/Layer';
|
|
295
|
+
import { HttpMiddleware, HttpRouter } from 'effect/unstable/http';
|
|
296
|
+
import { HttpApiBuilder } from 'effect/unstable/httpapi';
|
|
290
297
|
|
|
291
298
|
const corsLayer = HttpRouter.middleware(
|
|
292
299
|
Effect.succeed(
|