@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.98 → 3.8.1-ultramodern.1
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/createBuilderProviderConfig.js +5 -1
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +80 -11
- package/dist/cjs/bundleDocs.js +114 -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/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/plugins/initialize/index.js +4 -3
- package/dist/cjs/plugins/serverBuild.js +3 -2
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +109 -57
- package/dist/esm/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +70 -10
- package/dist/esm/bundleDocs.mjs +62 -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/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/plugins/initialize/index.mjs +4 -3
- package/dist/esm/plugins/serverBuild.mjs +3 -2
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +107 -58
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.mjs +5 -1
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +70 -10
- package/dist/esm-node/bundleDocs.mjs +63 -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/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/plugins/initialize/index.mjs +4 -3
- package/dist/esm-node/plugins/serverBuild.mjs +3 -2
- 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/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/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/types/config/dev.d.ts +6 -0
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +1 -0
- package/docs/apis/app/commands.md +231 -0
- package/docs/apis/app/hooks/api/lambda.md +9 -0
- package/docs/apis/app/hooks/config/favicon.md +24 -0
- package/docs/apis/app/hooks/config/html.md +5 -0
- package/docs/apis/app/hooks/config/icon.md +24 -0
- package/docs/apis/app/hooks/config/mock.md +6 -0
- package/docs/apis/app/hooks/config/public.md +26 -0
- package/docs/apis/app/hooks/config/upload.md +50 -0
- package/docs/apis/app/hooks/modern-config.md +5 -0
- package/docs/apis/app/hooks/server/server.md +5 -0
- package/docs/apis/app/hooks/shared.md +3 -0
- package/docs/apis/app/hooks/src/app.md +30 -0
- package/docs/apis/app/hooks/src/entry.md +34 -0
- package/docs/apis/app/hooks/src/entry.server.md +51 -0
- package/docs/apis/app/hooks/src/modern.runtime.md +5 -0
- package/docs/apis/app/hooks/src/routes.md +86 -0
- package/docs/apis/app/hooks/src/server.md +3 -0
- package/docs/apis/app/runtime/bff/use-backend-context.md +27 -0
- package/docs/apis/app/runtime/core/create-root.md +19 -0
- package/docs/apis/app/runtime/core/render.md +39 -0
- package/docs/apis/app/runtime/core/runtime-context.md +156 -0
- package/docs/apis/app/runtime/router/router.md +283 -0
- package/docs/apis/app/runtime/ssr/no-ssr.md +35 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.md +67 -0
- package/docs/apis/app/runtime/ssr/renderString.md +60 -0
- package/docs/apis/app/runtime/ssr/requestHandler.md +44 -0
- package/docs/apis/app/runtime/utility/css-in-js.md +40 -0
- package/docs/apis/app/runtime/utility/head.md +35 -0
- package/docs/apis/app/runtime/utility/loadable.md +82 -0
- 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.md +20 -0
- package/docs/configure/app/bff/effect.md +313 -0
- package/docs/configure/app/bff/prefix.md +29 -0
- package/docs/configure/app/bff/runtime-framework.md +26 -0
- package/docs/configure/app/builder-plugins.md +66 -0
- package/docs/configure/app/dev/asset-prefix.md +13 -0
- package/docs/configure/app/dev/before-start-url.md +17 -0
- package/docs/configure/app/dev/client.md +41 -0
- package/docs/configure/app/dev/hmr.md +10 -0
- package/docs/configure/app/dev/host.md +18 -0
- package/docs/configure/app/dev/https.md +77 -0
- package/docs/configure/app/dev/lazy-compilation.md +39 -0
- package/docs/configure/app/dev/live-reload.md +10 -0
- package/docs/configure/app/dev/mock-dir.md +31 -0
- package/docs/configure/app/dev/progress-bar.md +19 -0
- package/docs/configure/app/dev/server.md +124 -0
- package/docs/configure/app/dev/setup-middlewares.md +32 -0
- package/docs/configure/app/dev/start-url.md +48 -0
- package/docs/configure/app/dev/watch-files.md +27 -0
- package/docs/configure/app/dev/write-to-disk.md +10 -0
- package/docs/configure/app/experiments/source-build.md +31 -0
- package/docs/configure/app/html/app-icon.md +28 -0
- package/docs/configure/app/html/crossorigin.md +10 -0
- package/docs/configure/app/html/favicon.md +16 -0
- package/docs/configure/app/html/inject.md +10 -0
- package/docs/configure/app/html/meta.md +24 -0
- package/docs/configure/app/html/mount-id.md +10 -0
- 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.md +15 -0
- package/docs/configure/app/html/template-parameters.md +33 -0
- 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.md +77 -0
- package/docs/configure/app/output/charset.md +10 -0
- package/docs/configure/app/output/clean-dist-path.md +16 -0
- package/docs/configure/app/output/convert-to-rem.md +79 -0
- package/docs/configure/app/output/copy.md +10 -0
- package/docs/configure/app/output/css-modules.md +48 -0
- package/docs/configure/app/output/data-uri-limit.md +26 -0
- package/docs/configure/app/output/disable-css-module-extension.md +55 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.md +41 -0
- package/docs/configure/app/output/disable-svgr.md +18 -0
- package/docs/configure/app/output/disable-ts-checker.md +49 -0
- package/docs/configure/app/output/dist-path.md +43 -0
- package/docs/configure/app/output/enable-asset-manifest.md +36 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.md +28 -0
- package/docs/configure/app/output/enable-inline-route-manifests.md +16 -0
- package/docs/configure/app/output/externals.md +20 -0
- package/docs/configure/app/output/filename-hash.md +10 -0
- package/docs/configure/app/output/filename.md +55 -0
- package/docs/configure/app/output/inject-styles.md +10 -0
- package/docs/configure/app/output/inline-scripts.md +29 -0
- package/docs/configure/app/output/inline-styles.md +29 -0
- package/docs/configure/app/output/legal-comments.md +18 -0
- package/docs/configure/app/output/minify.md +22 -0
- package/docs/configure/app/output/override-browserslist.md +22 -0
- package/docs/configure/app/output/polyfill.md +12 -0
- package/docs/configure/app/output/source-map.md +30 -0
- package/docs/configure/app/output/split-route-chunks.md +16 -0
- package/docs/configure/app/output/ssg.md +81 -0
- package/docs/configure/app/output/ssgByEntries.md +90 -0
- package/docs/configure/app/output/svg-default-export.md +30 -0
- package/docs/configure/app/output/temp-dir.md +20 -0
- package/docs/configure/app/performance/build-cache.md +44 -0
- package/docs/configure/app/performance/chunk-split.md +40 -0
- package/docs/configure/app/performance/dns-prefetch.md +15 -0
- package/docs/configure/app/performance/preconnect.md +16 -0
- package/docs/configure/app/performance/prefetch.md +21 -0
- package/docs/configure/app/performance/preload.md +23 -0
- package/docs/configure/app/performance/print-file-size.md +40 -0
- 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.md +38 -0
- package/docs/configure/app/plugins.md +59 -0
- package/docs/configure/app/resolve/alias-strategy.md +10 -0
- package/docs/configure/app/resolve/alias.md +9 -0
- package/docs/configure/app/resolve/condition-names.md +13 -0
- package/docs/configure/app/resolve/dedupe.md +9 -0
- package/docs/configure/app/resolve/extensions.md +13 -0
- package/docs/configure/app/runtime/0-intro.md +58 -0
- package/docs/configure/app/runtime/plugins.md +58 -0
- package/docs/configure/app/runtime/router.md +35 -0
- package/docs/configure/app/security/check-syntax.md +69 -0
- package/docs/configure/app/security/nonce.md +15 -0
- package/docs/configure/app/security/sri.md +20 -0
- package/docs/configure/app/server/base-url.md +26 -0
- package/docs/configure/app/server/port.md +18 -0
- package/docs/configure/app/server/public-routes.md +22 -0
- package/docs/configure/app/server/routes.md +86 -0
- package/docs/configure/app/server/rsc.md +22 -0
- package/docs/configure/app/server/ssr-by-entries.md +25 -0
- package/docs/configure/app/server/ssr.md +80 -0
- package/docs/configure/app/server/tsconfig-path.md +59 -0
- package/docs/configure/app/source/alias-strategy.md +14 -0
- package/docs/configure/app/source/alias.md +23 -0
- package/docs/configure/app/source/config-dir.md +20 -0
- package/docs/configure/app/source/decorators.md +25 -0
- package/docs/configure/app/source/define.md +16 -0
- package/docs/configure/app/source/disable-default-entries.md +28 -0
- package/docs/configure/app/source/enable-async-entry.md +54 -0
- package/docs/configure/app/source/enable-async-pre-entry.md +26 -0
- package/docs/configure/app/source/entries-dir.md +35 -0
- package/docs/configure/app/source/entries.md +179 -0
- package/docs/configure/app/source/exclude.md +10 -0
- package/docs/configure/app/source/global-vars.md +106 -0
- package/docs/configure/app/source/include.md +36 -0
- package/docs/configure/app/source/main-entry-name.md +24 -0
- package/docs/configure/app/source/pre-entry.md +10 -0
- package/docs/configure/app/source/react-compiler.md +68 -0
- package/docs/configure/app/source/transform-import.md +27 -0
- package/docs/configure/app/split-chunks.md +17 -0
- package/docs/configure/app/tools/autoprefixer.md +44 -0
- package/docs/configure/app/tools/bundler-chain.md +26 -0
- package/docs/configure/app/tools/css-extract.md +33 -0
- package/docs/configure/app/tools/css-loader.md +17 -0
- package/docs/configure/app/tools/dev-server.md +113 -0
- package/docs/configure/app/tools/html-plugin.md +41 -0
- package/docs/configure/app/tools/less.md +81 -0
- package/docs/configure/app/tools/lightningcss-loader.md +35 -0
- package/docs/configure/app/tools/minify-css.md +53 -0
- package/docs/configure/app/tools/postcss.md +34 -0
- package/docs/configure/app/tools/rspack.md +10 -0
- package/docs/configure/app/tools/sass.md +78 -0
- package/docs/configure/app/tools/style-loader.md +10 -0
- package/docs/configure/app/tools/swc.md +65 -0
- package/docs/configure/app/tools/ts-checker.md +116 -0
- package/docs/configure/app/usage.md +276 -0
- package/docs/guides/advanced-features/bff/cross-project.md +109 -0
- package/docs/guides/advanced-features/bff/data-platform.md +116 -0
- package/docs/guides/advanced-features/bff/extend-server.md +120 -0
- package/docs/guides/advanced-features/bff/frameworks.md +243 -0
- package/docs/guides/advanced-features/bff/function.md +318 -0
- package/docs/guides/advanced-features/bff/operators.md +554 -0
- package/docs/guides/advanced-features/bff/sdk.md +116 -0
- package/docs/guides/advanced-features/bff/upload.md +101 -0
- package/docs/guides/advanced-features/bff.md +18 -0
- package/docs/guides/advanced-features/build-performance.md +130 -0
- package/docs/guides/advanced-features/compatibility.md +120 -0
- package/docs/guides/advanced-features/international/advanced.md +128 -0
- package/docs/guides/advanced-features/international/api.md +267 -0
- package/docs/guides/advanced-features/international/best-practices.md +286 -0
- package/docs/guides/advanced-features/international/configuration.md +228 -0
- package/docs/guides/advanced-features/international/locale-detection.md +126 -0
- package/docs/guides/advanced-features/international/quick-start.md +128 -0
- package/docs/guides/advanced-features/international/resource-loading.md +154 -0
- package/docs/guides/advanced-features/international/routing.md +173 -0
- package/docs/guides/advanced-features/international.md +27 -0
- package/docs/guides/advanced-features/low-level.md +46 -0
- package/docs/guides/advanced-features/page-performance/code-split.md +77 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.md +159 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.md +97 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.md +51 -0
- package/docs/guides/advanced-features/server-monitor/logger.md +41 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
- package/docs/guides/advanced-features/server-monitor/monitors.md +242 -0
- package/docs/guides/advanced-features/source-build.md +164 -0
- package/docs/guides/advanced-features/web-server.md +288 -0
- package/docs/guides/basic-features/alias.md +102 -0
- package/docs/guides/basic-features/css/css-in-js.md +72 -0
- package/docs/guides/basic-features/css/css-modules.md +212 -0
- package/docs/guides/basic-features/css/css.md +27 -0
- package/docs/guides/basic-features/css/tailwindcss.md +27 -0
- package/docs/guides/basic-features/data/data-cache.md +510 -0
- package/docs/guides/basic-features/data/data-fetch.md +415 -0
- package/docs/guides/basic-features/data/data-write.md +227 -0
- package/docs/guides/basic-features/debug/mock.md +109 -0
- package/docs/guides/basic-features/debug/proxy.md +21 -0
- package/docs/guides/basic-features/debug/rsdoctor.md +47 -0
- package/docs/guides/basic-features/debug/using-storybook.md +112 -0
- package/docs/guides/basic-features/deploy.md +458 -0
- package/docs/guides/basic-features/env-vars.md +177 -0
- package/docs/guides/basic-features/html.md +255 -0
- package/docs/guides/basic-features/output-files.md +141 -0
- package/docs/guides/basic-features/render/before-render.md +108 -0
- package/docs/guides/basic-features/render/overview.md +47 -0
- package/docs/guides/basic-features/render/rsc.md +516 -0
- package/docs/guides/basic-features/render/ssg.md +228 -0
- package/docs/guides/basic-features/render/ssr-cache.md +201 -0
- package/docs/guides/basic-features/render/ssr.md +321 -0
- package/docs/guides/basic-features/render/streaming-ssr.md +264 -0
- package/docs/guides/basic-features/routes/config-routes.md +426 -0
- package/docs/guides/basic-features/routes/routes.md +524 -0
- package/docs/guides/basic-features/static-assets/json-files.md +120 -0
- package/docs/guides/basic-features/static-assets/svg-assets.md +168 -0
- package/docs/guides/basic-features/static-assets/wasm-assets.md +62 -0
- package/docs/guides/basic-features/static-assets.md +160 -0
- package/docs/guides/basic-features/testing/playwright.md +120 -0
- package/docs/guides/basic-features/testing/rstest.md +251 -0
- package/docs/guides/concept/builder.md +37 -0
- package/docs/guides/concept/entries.md +319 -0
- package/docs/guides/concept/server.md +35 -0
- package/docs/guides/get-started/ai-coding-agents.md +58 -0
- package/docs/guides/get-started/glossary.md +63 -0
- package/docs/guides/get-started/introduction.md +40 -0
- package/docs/guides/get-started/quick-start.md +269 -0
- package/docs/guides/get-started/tech-stack.md +91 -0
- package/docs/guides/get-started/ultramodern.md +440 -0
- package/docs/guides/get-started/upgrade.md +118 -0
- package/docs/guides/topic-detail/module-federation/application.md +116 -0
- package/docs/guides/topic-detail/module-federation/deploy.md +104 -0
- package/docs/guides/topic-detail/module-federation/i18n.md +670 -0
- package/docs/guides/topic-detail/module-federation/introduce.md +35 -0
- package/docs/guides/topic-detail/module-federation/ssr.md +182 -0
- package/docs/guides/topic-detail/module-federation/usage.md +219 -0
- package/docs/guides/troubleshooting/builder.md +110 -0
- package/docs/guides/troubleshooting/cli.md +35 -0
- package/docs/guides/troubleshooting/dependencies.md +119 -0
- package/docs/guides/troubleshooting/hmr.md +144 -0
- package/docs/guides/upgrade/config.md +954 -0
- package/docs/guides/upgrade/entry.md +463 -0
- package/docs/guides/upgrade/other.md +183 -0
- package/docs/guides/upgrade/overview.md +33 -0
- package/docs/guides/upgrade/tailwindcss.md +91 -0
- package/docs/guides/upgrade/web-server.md +109 -0
- package/docs/index.md +33 -0
- 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 +63 -22
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Contributing Guide
|
|
2
|
+
|
|
3
|
+
Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines.
|
|
4
|
+
|
|
5
|
+
## Setup the Dev Environment
|
|
6
|
+
|
|
7
|
+
### Fork the Repo
|
|
8
|
+
|
|
9
|
+
[Fork](https://help.github.com/articles/fork-a-repo/) this repository to your
|
|
10
|
+
own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local.
|
|
11
|
+
|
|
12
|
+
### Install Node.js
|
|
13
|
+
|
|
14
|
+
We recommend using Node.js 22. You can check your currently used Node.js version with the following command:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node -v
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you do not have Node.js installed in your current environment, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install it.
|
|
21
|
+
|
|
22
|
+
Here is an example of how to install the Node.js 22 LTS version via nvm:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install the LTS version of Node.js 22
|
|
26
|
+
nvm install 22 --lts
|
|
27
|
+
|
|
28
|
+
# Make the newly installed Node.js 22 as the default version
|
|
29
|
+
nvm alias default 22
|
|
30
|
+
|
|
31
|
+
# Switch to the newly installed Node.js 22
|
|
32
|
+
nvm use 22
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Install pnpm
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
mise install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Install Dependencies
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pnpm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
What this will do:
|
|
48
|
+
|
|
49
|
+
- Install all dependencies
|
|
50
|
+
- Create symlinks between packages in the monorepo
|
|
51
|
+
- Run the `prepare` script to build all packages (this will take some time, but is necessary to make ensure all packages are built)
|
|
52
|
+
|
|
53
|
+
> A full rebuild of all packages is generally not required after this. If a new feature you are developing requires an updated version of another package, it is usually sufficient to build the changed dependencies.
|
|
54
|
+
|
|
55
|
+
### Set Git Email
|
|
56
|
+
|
|
57
|
+
Please make sure you have your email set up in `<https://github.com/settings/emails>`. This will be needed later when you want to submit a pull request.
|
|
58
|
+
|
|
59
|
+
Check that your git client is already configured the email:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
git config --list | grep email
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Set the email to global config:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
git config --global user.email "SOME_EMAIL@example.com"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Set the email for local repo:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
git config user.email "SOME_EMAIL@example.com"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Making Changes and Building
|
|
78
|
+
|
|
79
|
+
Once you have set up the local development environment in your forked repo, we can start development.
|
|
80
|
+
|
|
81
|
+
### Checkout A New Branch
|
|
82
|
+
|
|
83
|
+
It is recommended to develop on a new branch, as it will make things easier later when you submit a pull request:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
git checkout -b MY_BRANCH_NAME
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Build the Package
|
|
90
|
+
|
|
91
|
+
To build the package you want to change, first open the package directory, then run the `build` command:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
# Replace some-path with the path of the package you want to work on
|
|
95
|
+
cd ./packages/some-path
|
|
96
|
+
pnpm run build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Alternatively, you can build the package from the root directory of the repository using the `--filter` option:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
pnpm run --filter @modern-js/some-package build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Build all packages:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
pnpm run prepare
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If you need to clean all `node_modules/*` in the project, run the `reset` command:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
pnpm run reset
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Testing
|
|
118
|
+
|
|
119
|
+
### Add New Tests
|
|
120
|
+
|
|
121
|
+
If you've fixed a bug or added code that should be tested, then add some tests.
|
|
122
|
+
|
|
123
|
+
Modern.js uses [Rstest](https://rstest.rs/) for unit tests across the repository. You can add test cases in the `<PACKAGE_DIR>/tests` folder, using Rstest syntax.
|
|
124
|
+
|
|
125
|
+
### Run Unit Tests
|
|
126
|
+
|
|
127
|
+
Before submitting a pull request, it's important to make sure that the changes haven't introduced any regressions or bugs. You can run the unit tests for the project by executing the following command:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
pnpm run test
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Alternatively, you can run the unit tests of single package using the `--filter` option:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
pnpm run --filter @modern-js/some-package test
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Run E2E Tests
|
|
140
|
+
|
|
141
|
+
In addition to the unit tests, the Modern.js also includes end-to-end (E2E) tests, which checks the functionality of the application as a whole.
|
|
142
|
+
|
|
143
|
+
You can run the `test:e2e` command to run the E2E tests:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
pnpm run test:e2e
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
If you need to run a specified test, you can add keywords to filter:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
# Only run test cases with the copy-assets keyword
|
|
153
|
+
npx rstest copy-assets
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Linting
|
|
157
|
+
|
|
158
|
+
To help maintain consistency and readability of the codebase, we use a ESLint to lint the codes.
|
|
159
|
+
|
|
160
|
+
You can run the Linter by executing the following command:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
pnpm run lint
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Benchmarking
|
|
167
|
+
|
|
168
|
+
You can input `!bench-framework` or `!bench-module` in the comment area of the PR to do benchmarking on `@modern-js/app-tools` and `@modern-js/module-tools` respectively (you need to have Collaborator and above permissions).
|
|
169
|
+
|
|
170
|
+
You can focus on metrics related to build time and bundle size based on the comparison table output by comments to assist you in making relevant performance judgments and decisions.
|
|
171
|
+
|
|
172
|
+
Dependencies installation-related metrics base on publishing process, so the data is relatively lagging and is for reference only.
|
|
173
|
+
|
|
174
|
+
## Documentation
|
|
175
|
+
|
|
176
|
+
Currently Modern.js provides documentation in English and Chinese. If you can use Chinese, please update both documents at the same time. Otherwise, just update the English documentation.
|
|
177
|
+
|
|
178
|
+
You can find all the documentation in the `packages/document` folder:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
root
|
|
182
|
+
└─ packages
|
|
183
|
+
└─ document # Documentation for Modern.js Framework
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This website is built with Rspress, the document content can be written using markdown or mdx syntax. You can refer to the [Rspress Website](https://rspress.rs/) for detailed usage.
|
|
187
|
+
|
|
188
|
+
The source code of Rspress can be found in [this repo](https://github.com/web-infra-dev/rspress).
|
|
189
|
+
|
|
190
|
+
## Submitting Changes
|
|
191
|
+
|
|
192
|
+
### Add a Changeset
|
|
193
|
+
|
|
194
|
+
Modern.js is using [Changesets](https://github.com/changesets/changesets) to manage the versioning and changelogs.
|
|
195
|
+
|
|
196
|
+
If you've changed some packages, you need add a new changeset for the changes. Please run `change` command to select the changed packages and add the changeset info.
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
pnpm run change
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Committing your Changes
|
|
203
|
+
|
|
204
|
+
Commit your changes to your forked repo, and [create a pull request](https://help.github.com/articles/creating-a-pull-request/).
|
|
205
|
+
|
|
206
|
+
### Format of PR titles
|
|
207
|
+
|
|
208
|
+
The format of PR titles follow Conventional Commits.
|
|
209
|
+
|
|
210
|
+
An example:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
feat(plugin-swc): Add `xxx` config
|
|
214
|
+
^ ^ ^
|
|
215
|
+
| | |__ Subject
|
|
216
|
+
| |_______ Scope
|
|
217
|
+
|____________ Type
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Publishing
|
|
221
|
+
|
|
222
|
+
We use **Modern.js Monorepo Solution** to manage version and changelog.
|
|
223
|
+
|
|
224
|
+
Repository maintainers can publish a new version of all packages to npm.
|
|
225
|
+
|
|
226
|
+
Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
|
|
227
|
+
|
|
228
|
+
1. Pull latest code from the `main` branch.
|
|
229
|
+
2. Install:
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
pnpm i
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
3. Build packages:
|
|
236
|
+
|
|
237
|
+
```sh
|
|
238
|
+
pnpm run prepare
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
4. Bump version:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
pnpm run bump
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
5. Commit the version change.
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
git add .
|
|
251
|
+
git commit -m "Release va.b.c"
|
|
252
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Releases
|
|
2
|
+
|
|
3
|
+
## Changelog
|
|
4
|
+
|
|
5
|
+
Please visit [GitHub - Releases](https://github.com/web-infra-dev/modern.js/releases) to see what has changed with each release of Modern.js.
|
|
6
|
+
|
|
7
|
+
## Version Specification
|
|
8
|
+
|
|
9
|
+
Modern.js follows the [Semantic Versioning](https://semver.org) specification.
|
|
10
|
+
|
|
11
|
+
- Major version: Contains incompatible API changes.
|
|
12
|
+
- Minor version: Contains backward compatible functional changes.
|
|
13
|
+
- Patch version: Contains backwards compatible bug fixes
|
|
14
|
+
|
|
15
|
+
## Release Cycle
|
|
16
|
+
|
|
17
|
+
- Modern.js generally releases an official release every Thursday.
|
|
18
|
+
- If critical bugs appear, we will release a revised version on the same day.
|
|
19
|
+
- We expect to keep Modern.js v2 stable and compatible, there are currently no plans to release the next major version.
|
|
20
|
+
|
|
21
|
+
## Version Upgrade
|
|
22
|
+
|
|
23
|
+
Modern.js 3.0 no longer ships the `modern upgrade` command. When you need to upgrade a project, follow the manual migration steps in [Upgrade](/guides/get-started/upgrade.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Showcase
|
|
2
|
+
|
|
3
|
+
Welcome to the Modern.js showcase page! Here, we present a collection of websites that have been built using Modern.js.
|
|
4
|
+
|
|
5
|
+
If you have built a website using Modern.js, we would love for you to share it with the community. Simply reply to the GitHub discussion thread with a link to your website. We will collect content on a regular basis and display it on the current page.
|
|
6
|
+
|
|
7
|
+
## The Cases
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[UltraModern.jsFramework
|
|
11
|
+
|
|
12
|
+
bleedingdev.github.io](https://bleedingdev.github.io/ultramodern.js/)[EffectFramework
|
|
13
|
+
|
|
14
|
+
effect.website](https://effect.website/)[TanStack RouterFramework
|
|
15
|
+
|
|
16
|
+
tanstack.com](https://tanstack.com/router)[RspackBuilder
|
|
17
|
+
|
|
18
|
+
rspack.rs](https://rspack.rs/)[RspressDoc
|
|
19
|
+
|
|
20
|
+
rspress.rs](https://rspress.rs/)[Modern.jsDoc
|
|
21
|
+
|
|
22
|
+
modernjs.dev](https://modernjs.dev/en/)[Module FederationModule
|
|
23
|
+
|
|
24
|
+
module-federation.io](https://module-federation.io/)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Meet the Team
|
|
2
|
+
|
|
3
|
+
The development of Modern.js is driven by ByteDance's Modern.js team and community contributors.
|
|
4
|
+
|
|
5
|
+
## Core Team Members
|
|
6
|
+
|
|
7
|
+
The Modern.js core team members:
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## All Contributors
|
|
11
|
+
|
|
12
|
+
Thanks to the following friends for their contributions to Modern.js:
|
|
13
|
+
|
|
14
|
+
[](https://github.com/web-infra-dev/modern.js/graphs/contributors)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# bff.crossProject
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Default:** `false`
|
|
5
|
+
|
|
6
|
+
:::tip
|
|
7
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
```ts title="modern.config.ts"
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
bff: {
|
|
15
|
+
crossProject: true,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
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.md).
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# bff.effect
|
|
2
|
+
|
|
3
|
+
- **Type:**
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type BffEffectUserConfig = {
|
|
7
|
+
entry?: string;
|
|
8
|
+
strictEffectApproach?: true;
|
|
9
|
+
openapi?: boolean | { path?: string };
|
|
10
|
+
dataPlatform?: {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
requireEnvelope?: boolean;
|
|
13
|
+
envelopeHeader?: string;
|
|
14
|
+
expectedNamespace?: string;
|
|
15
|
+
validateOrigin?: boolean;
|
|
16
|
+
requireTraceContext?: boolean;
|
|
17
|
+
selection?: {
|
|
18
|
+
maxDepth?: number;
|
|
19
|
+
maxFields?: number;
|
|
20
|
+
allowedLeafPaths?: string[];
|
|
21
|
+
};
|
|
22
|
+
batch?: {
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
endpoint?: `/${string}`;
|
|
25
|
+
maxBatchSize?: number;
|
|
26
|
+
maxBatchBytes?: number;
|
|
27
|
+
flushIntervalMs?: number;
|
|
28
|
+
maxConcurrency?: number;
|
|
29
|
+
requestTimeoutMs?: number;
|
|
30
|
+
allowedMethods?: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **Default:** `{}`
|
|
37
|
+
|
|
38
|
+
:::tip
|
|
39
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
`bff.effect` is only effective when `bff.runtimeFramework` is set to `'effect'`.
|
|
43
|
+
|
|
44
|
+
:::caution Install the Effect peers yourself
|
|
45
|
+
`effect` and `@effect/opentelemetry` are **optional exact peer dependencies** of
|
|
46
|
+
`@modern-js/plugin-bff`, not dependencies. The plugin no longer bundles a copy —
|
|
47
|
+
Effect 4 derives `Context` / `Service` keys per module instance, so a bundled copy
|
|
48
|
+
would give your app a second Effect identity. Before setting
|
|
49
|
+
`runtimeFramework: 'effect'` or importing `@modern-js/plugin-bff/effect`,
|
|
50
|
+
`/effect-server`, `/effect-edge` or `/effect-client`, install the exact cohort:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pnpm add effect@4.0.0-beta.107 @effect/opentelemetry@4.0.0-beta.107
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The pin is exact because UltraModern ships Effect as one lockstep cohort. Apps
|
|
57
|
+
using only `runtimeFramework: 'hono'` or the `./data-platform` lane need neither
|
|
58
|
+
package.
|
|
59
|
+
:::
|
|
60
|
+
|
|
61
|
+
Generated UltraModern workspaces use this runtime as the only generated HTTP API
|
|
62
|
+
path. The API contract lives at `shared/api.ts`, the server runtime lives at
|
|
63
|
+
`api/index.ts`, clients live under `src/api/*-client.ts`, and generated checks
|
|
64
|
+
reject `api/effect`, `api/lambda`, `shared/effect`, `src/effect`, Hono server
|
|
65
|
+
imports, raw request handlers, manual request parsing, and manual `Response`
|
|
66
|
+
construction in API modules.
|
|
67
|
+
|
|
68
|
+
For Effect v4, TypeScript should use export-map aware module resolution.
|
|
69
|
+
|
|
70
|
+
```json title="tsconfig.json"
|
|
71
|
+
{
|
|
72
|
+
"compilerOptions": {
|
|
73
|
+
"module": "ESNext",
|
|
74
|
+
"moduleResolution": "Bundler"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## bff.effect.entry
|
|
80
|
+
|
|
81
|
+
- **Type:** `string`
|
|
82
|
+
- **Default:** `<apiDirectory>/index`
|
|
83
|
+
|
|
84
|
+
Specifies the entry module for Effect HttpApi runtime.
|
|
85
|
+
|
|
86
|
+
```ts title="modern.config.ts"
|
|
87
|
+
export default defineConfig({
|
|
88
|
+
bff: {
|
|
89
|
+
runtimeFramework: 'effect',
|
|
90
|
+
effect: {
|
|
91
|
+
entry: './api/index',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## bff.effect.strictEffectApproach
|
|
98
|
+
|
|
99
|
+
- **Type:** `true`
|
|
100
|
+
- **Default:** `true`
|
|
101
|
+
|
|
102
|
+
Effect BFF modules must expose the strict Effect API surface
|
|
103
|
+
(`defineEffectBff(...)` or `{ api, layer }`) and raw request handlers are
|
|
104
|
+
rejected. Generated UltraModern apps write this marker explicitly and pair it
|
|
105
|
+
with source checks that reject Hono server imports, manual request parsing, and
|
|
106
|
+
manual `Response` construction in generated API modules.
|
|
107
|
+
|
|
108
|
+
## bff.effect.openapi
|
|
109
|
+
|
|
110
|
+
- **Type:** `boolean | { path?: string }`
|
|
111
|
+
- **Default:** `false`
|
|
112
|
+
|
|
113
|
+
Enable OpenAPI endpoint generation for Effect HttpApi runtime.
|
|
114
|
+
|
|
115
|
+
```ts title="modern.config.ts"
|
|
116
|
+
export default defineConfig({
|
|
117
|
+
bff: {
|
|
118
|
+
runtimeFramework: 'effect',
|
|
119
|
+
effect: {
|
|
120
|
+
openapi: {
|
|
121
|
+
path: '/openapi.json',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## bff.effect.dataPlatform
|
|
129
|
+
|
|
130
|
+
- **Type:**
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
{
|
|
134
|
+
enabled?: boolean;
|
|
135
|
+
requireEnvelope?: boolean;
|
|
136
|
+
envelopeHeader?: string;
|
|
137
|
+
expectedNamespace?: string;
|
|
138
|
+
validateOrigin?: boolean;
|
|
139
|
+
requireTraceContext?: boolean;
|
|
140
|
+
selection?: {
|
|
141
|
+
maxDepth?: number;
|
|
142
|
+
maxFields?: number;
|
|
143
|
+
allowedLeafPaths?: string[];
|
|
144
|
+
};
|
|
145
|
+
batch?: {
|
|
146
|
+
enabled?: boolean;
|
|
147
|
+
endpoint?: `/${string}`;
|
|
148
|
+
maxBatchSize?: number;
|
|
149
|
+
maxBatchBytes?: number;
|
|
150
|
+
flushIntervalMs?: number;
|
|
151
|
+
maxConcurrency?: number;
|
|
152
|
+
requestTimeoutMs?: number;
|
|
153
|
+
allowedMethods?: string[];
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- **Default:**
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
{
|
|
162
|
+
enabled: true,
|
|
163
|
+
requireEnvelope: false,
|
|
164
|
+
envelopeHeader: 'x-modernjs-data-envelope',
|
|
165
|
+
validateOrigin: true,
|
|
166
|
+
requireTraceContext: false,
|
|
167
|
+
batch: {
|
|
168
|
+
enabled: true,
|
|
169
|
+
endpoint: '/_data/batch',
|
|
170
|
+
maxBatchSize: 16,
|
|
171
|
+
maxBatchBytes: 64 * 1024,
|
|
172
|
+
flushIntervalMs: 8,
|
|
173
|
+
maxConcurrency: 4,
|
|
174
|
+
requestTimeoutMs: 10000,
|
|
175
|
+
allowedMethods: ['GET'],
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Configure request-envelope validation for Effect runtime.
|
|
181
|
+
|
|
182
|
+
Generated Effect client requests batching against `${bff.prefix}${batch.endpoint}` (for example, `/bff-api/_data/batch`).
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
```ts title="modern.config.ts"
|
|
189
|
+
export default defineConfig({
|
|
190
|
+
bff: {
|
|
191
|
+
runtimeFramework: 'effect',
|
|
192
|
+
effect: {
|
|
193
|
+
dataPlatform: {
|
|
194
|
+
requireEnvelope: true,
|
|
195
|
+
expectedNamespace: 'my-app',
|
|
196
|
+
selection: {
|
|
197
|
+
maxDepth: 6,
|
|
198
|
+
maxFields: 200,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`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.
|
|
207
|
+
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
## Effect cohort
|
|
211
|
+
|
|
212
|
+
UltraModern-generated workspaces pin the framework-compatible Effect cohort
|
|
213
|
+
through `pnpm-workspace.yaml` overrides. For the current UltraModern cohort,
|
|
214
|
+
generated apps use:
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
trustPolicyExclude:
|
|
218
|
+
- 'effect@4.0.0-beta.107'
|
|
219
|
+
- '@effect/opentelemetry@4.0.0-beta.107'
|
|
220
|
+
|
|
221
|
+
overrides:
|
|
222
|
+
'@effect/opentelemetry': 4.0.0-beta.107
|
|
223
|
+
'@effect/vitest': 4.0.0-beta.107
|
|
224
|
+
effect: 4.0.0-beta.107
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Do not add a different direct `effect` version in an app package. A mismatched
|
|
228
|
+
Effect beta can fail while building layers or HTTP middleware because runtime
|
|
229
|
+
services come from different package instances. The strict 24-hour release-age
|
|
230
|
+
gate applies to installed packages; the current cohort has no Effect age
|
|
231
|
+
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
232
|
+
target. `trustPolicyExclude` is a separate policy:
|
|
233
|
+
its exact `effect` and `@effect/opentelemetry` exceptions cover their
|
|
234
|
+
trusted-publisher to provenance metadata transition and are not release-age
|
|
235
|
+
approvals.
|
|
236
|
+
|
|
237
|
+
## Contract tests
|
|
238
|
+
|
|
239
|
+
Strict Effect APIs should test the declared `HttpApi` contract, not a raw
|
|
240
|
+
request handler. Edge-compatible tests can use the framework helper:
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { createEffectBffTestHandler } from '@modern-js/plugin-bff/effect-edge';
|
|
244
|
+
import apiModule from '../api/index';
|
|
245
|
+
|
|
246
|
+
const testApi = await createEffectBffTestHandler({
|
|
247
|
+
module: apiModule,
|
|
248
|
+
prefix: '/api',
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const response = await testApi.handler(new Request('http://localhost/api/ping'));
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
If you manually compose an Effect web handler in a low-level proof, provide the
|
|
255
|
+
platform services explicitly:
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
import {
|
|
259
|
+
HttpApiBuilder,
|
|
260
|
+
HttpRouter,
|
|
261
|
+
HttpServer,
|
|
262
|
+
Layer,
|
|
263
|
+
} from '@modern-js/plugin-bff/effect-server';
|
|
264
|
+
|
|
265
|
+
const handler = HttpRouter.toWebHandler(
|
|
266
|
+
HttpApiBuilder.layer(api).pipe(
|
|
267
|
+
Layer.provide(apiGroupLayer),
|
|
268
|
+
Layer.provide(HttpServer.layerServices),
|
|
269
|
+
),
|
|
270
|
+
).handler;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Prefer the generated helper unless the test needs to inspect the low-level
|
|
274
|
+
Effect router composition.
|
|
275
|
+
|
|
276
|
+
## Dynamic CORS
|
|
277
|
+
|
|
278
|
+
For dynamic origin predicates, use Effect HTTP middleware as a layer. In the
|
|
279
|
+
current Effect v4 beta cohort, `HttpRouter.middleware(...)` returns a `Layer`
|
|
280
|
+
directly:
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
import {
|
|
284
|
+
Effect,
|
|
285
|
+
HttpApiBuilder,
|
|
286
|
+
HttpMiddleware,
|
|
287
|
+
HttpRouter,
|
|
288
|
+
Layer,
|
|
289
|
+
} from '@modern-js/plugin-bff/effect-server';
|
|
290
|
+
|
|
291
|
+
const corsLayer = HttpRouter.middleware(
|
|
292
|
+
Effect.succeed(
|
|
293
|
+
HttpMiddleware.cors({
|
|
294
|
+
allowedOrigins: origin =>
|
|
295
|
+
origin.endsWith('.example.com') ? origin : undefined,
|
|
296
|
+
}),
|
|
297
|
+
),
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
const layer = HttpApiBuilder.layer(api).pipe(
|
|
301
|
+
Layer.provide(apiGroupLayer),
|
|
302
|
+
Layer.provide(corsLayer),
|
|
303
|
+
);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Do not read a `.layer` property from `HttpRouter.middleware(...)`.
|
|
307
|
+
|
|
308
|
+
## Other transports
|
|
309
|
+
|
|
310
|
+
`strictEffectApproach` governs generated HTTP API modules. Effect RPC,
|
|
311
|
+
WebSockets, and other transports remain valid when they are modeled as explicit
|
|
312
|
+
transport surfaces with typed Effect programs. They do not make raw HTTP
|
|
313
|
+
request handlers valid inside generated UltraModern API modules.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# bff.prefix
|
|
2
|
+
|
|
3
|
+
- **Type:** `string`
|
|
4
|
+
- **Default:** `/api`
|
|
5
|
+
|
|
6
|
+
:::tip
|
|
7
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
By default, the prefix for accessing routes in the BFF API directory is `/api`, as shown in the following directory structure:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
api
|
|
14
|
+
└── hello.ts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The route corresponding to `api/hello.ts` when accessed is `localhost:8080/api/hello`.
|
|
18
|
+
|
|
19
|
+
This configuration option can modify the default route prefix:
|
|
20
|
+
|
|
21
|
+
```ts title="modern.config.ts"
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
bff: {
|
|
24
|
+
prefix: '/api-demo',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The corresponding route for `api/hello.ts` when accessed is `localhost:8080/api-demo/hello`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# bff.runtimeFramework
|
|
2
|
+
|
|
3
|
+
- **Type:** `'hono' | 'effect'`
|
|
4
|
+
- **Default:** `'effect'`
|
|
5
|
+
|
|
6
|
+
:::tip
|
|
7
|
+
Please refer to the [Enable BFF](/guides/advanced-features/bff/function.md#enable-bff) section in Basic Usage to enable BFF functionality first.
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
Controls which runtime framework Modern.js uses for BFF routing.
|
|
11
|
+
|
|
12
|
+
```ts title="modern.config.ts"
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
bff: {
|
|
15
|
+
runtimeFramework: 'effect',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Set to `'effect'` to run BFF only from `api/index` (Effect HttpApi runtime).
|
|
21
|
+
- Set to `'hono'` to run BFF only from file-convention handlers under `api/lambda/**`.
|
|
22
|
+
|
|
23
|
+
There is no implicit fallback between runtimes. Choose one runtime mode per app.
|
|
24
|
+
Generated UltraModern apps use strict Effect APIs by default and set
|
|
25
|
+
`bff.effect.strictEffectApproach: true`; `hono` and `api/lambda/**` are not
|
|
26
|
+
valid generated UltraModern HTTP API paths.
|