@bleedingdev/modern-js-main-doc 3.2.0-ultramodern.8 → 3.2.0-ultramodern.80
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/docs/en/apis/app/commands.mdx +32 -32
- package/docs/en/community/blog/2022-0708-updates.md +1 -1
- package/docs/en/community/blog/2022-0910-updates.md +2 -2
- package/docs/en/community/blog/v2-release-note.mdx +5 -5
- package/docs/en/community/blog/v3-release-note.mdx +1 -1
- package/docs/en/community/contributing-guide.mdx +2 -3
- package/docs/en/community/releases.mdx +2 -2
- package/docs/en/components/build-output.mdx +1 -1
- package/docs/en/components/debug-app.mdx +1 -1
- package/docs/en/components/deploy-command.mdx +3 -3
- package/docs/en/components/init-app.mdx +38 -36
- package/docs/en/components/init-rspack-app.mdx +1 -1
- package/docs/en/components/prerequisites.mdx +1 -2
- package/docs/en/components/serve-command.mdx +3 -3
- package/docs/en/configure/app/bff/runtime-framework.mdx +1 -1
- package/docs/en/configure/app/usage.mdx +6 -6
- package/docs/en/guides/advanced-features/international/api.mdx +4 -1
- package/docs/en/guides/advanced-features/international/configuration.mdx +1 -0
- package/docs/en/guides/advanced-features/international/locale-detection.mdx +1 -1
- package/docs/en/guides/advanced-features/international/routing.mdx +43 -2
- package/docs/en/guides/basic-features/debug/using-storybook.mdx +1 -1
- package/docs/en/guides/basic-features/deploy.mdx +14 -14
- package/docs/en/guides/basic-features/env-vars.mdx +2 -2
- package/docs/en/guides/basic-features/routes/config-routes.mdx +2 -2
- package/docs/en/guides/basic-features/testing/_meta.json +1 -1
- package/docs/en/guides/concept/server.mdx +2 -2
- package/docs/en/guides/get-started/quick-start.mdx +2 -2
- package/docs/en/guides/get-started/tech-stack.mdx +10 -4
- package/docs/en/guides/get-started/ultramodern.mdx +93 -16
- package/docs/en/guides/topic-detail/module-federation/application.mdx +1 -1
- package/docs/en/guides/topic-detail/module-federation/deploy.mdx +2 -2
- package/docs/en/guides/topic-detail/module-federation/usage.mdx +5 -5
- package/docs/en/guides/troubleshooting/builder.mdx +1 -1
- package/docs/en/guides/upgrade/other.mdx +7 -7
- package/docs/zh/apis/app/commands.mdx +32 -32
- package/docs/zh/community/blog/2022-0708-updates.md +1 -1
- package/docs/zh/community/blog/2022-0910-updates.md +2 -2
- package/docs/zh/community/blog/v2-release-note.mdx +5 -5
- package/docs/zh/community/blog/v3-release-note.mdx +1 -1
- package/docs/zh/community/contributing-guide.mdx +2 -3
- package/docs/zh/community/releases.mdx +2 -2
- package/docs/zh/components/build-output.mdx +1 -1
- package/docs/zh/components/debug-app.mdx +1 -1
- package/docs/zh/components/deploy-command.mdx +3 -3
- package/docs/zh/components/init-app.mdx +36 -34
- package/docs/zh/components/init-rspack-app.mdx +1 -1
- package/docs/zh/components/prerequisites.mdx +1 -2
- package/docs/zh/components/serve-command.mdx +3 -3
- package/docs/zh/configure/app/bff/runtime-framework.mdx +1 -1
- package/docs/zh/configure/app/usage.mdx +5 -5
- package/docs/zh/guides/advanced-features/international/api.mdx +4 -1
- package/docs/zh/guides/advanced-features/international/configuration.mdx +1 -0
- package/docs/zh/guides/advanced-features/international/locale-detection.mdx +1 -1
- package/docs/zh/guides/advanced-features/international/routing.mdx +43 -2
- package/docs/zh/guides/basic-features/debug/using-storybook.mdx +1 -1
- package/docs/zh/guides/basic-features/deploy.mdx +13 -13
- package/docs/zh/guides/basic-features/env-vars.mdx +2 -2
- package/docs/zh/guides/basic-features/routes/config-routes.mdx +2 -2
- package/docs/zh/guides/basic-features/testing/_meta.json +1 -1
- package/docs/zh/guides/concept/server.mdx +2 -2
- package/docs/zh/guides/get-started/quick-start.mdx +2 -2
- package/docs/zh/guides/get-started/tech-stack.mdx +10 -4
- package/docs/zh/guides/get-started/ultramodern.mdx +90 -1
- package/docs/zh/guides/topic-detail/module-federation/application.mdx +1 -1
- package/docs/zh/guides/topic-detail/module-federation/deploy.mdx +2 -2
- package/docs/zh/guides/topic-detail/module-federation/usage.mdx +5 -5
- package/docs/zh/guides/troubleshooting/builder.mdx +1 -1
- package/docs/zh/guides/upgrade/other.md +7 -8
- package/main-doc/docs/en/guides/get-started/ultramodern.mdx +64 -14
- package/main-doc/docs/zh/guides/get-started/ultramodern.mdx +62 -3
- package/package.json +8 -8
- package/docs/en/guides/basic-features/testing/cypress.mdx +0 -95
- package/docs/en/guides/basic-features/testing/jest.mdx +0 -148
- package/docs/en/guides/basic-features/testing/vitest.mdx +0 -100
- package/docs/zh/guides/basic-features/testing/cypress.mdx +0 -95
- package/docs/zh/guides/basic-features/testing/jest.mdx +0 -148
- package/docs/zh/guides/basic-features/testing/vitest.mdx +0 -100
|
@@ -36,7 +36,7 @@ UltraModern.js 的增强能力是新 SuperApp 的默认产品面。兼容分支
|
|
|
36
36
|
| BFF 运行时选型 | Modern.js 3.0 基线仅提供 Hono 运行时路径(无内建 Effect 运行时) | 将 Effect 设为默认运行时,并采用严格运行时拆分(`effect` -> `api/effect`,`hono` -> `api/lambda`),同时补齐 Effect-Schema-first 契约与 MF failure-injection 覆盖 |
|
|
37
37
|
| Telemetry 标准化 | 可观测链路通常由业务侧自行拼装 | 增加框架级 telemetry 管线,内置 OTLP/VictoriaMetrics,支持脱敏、批处理与背压 |
|
|
38
38
|
| 应用级 MF SSR 协议 | 没有以 super-app 为重点的应用级稳定性契约开关 | 增加 `server.ssr.moduleFederationAppSSR` 配置/环境变量握手,并补齐集成级回归保障 |
|
|
39
|
-
| MF
|
|
39
|
+
| MF vertical 加载可靠性 | 重试/降级策略通常由各业务单独实现 | 增加 timeout/network/contract-error 的确定性可靠性矩阵与分布式 OTEL 连续性断言 |
|
|
40
40
|
| 模块准入治理 | 基线无模块认证证据化 gate profile | 新增模块 SDK 契约、边界反模式守卫与发布/模块认证 gate 工作流 |
|
|
41
41
|
| 路由运行时 | 默认运行时路径以 React Router 为中心 | 增加 TanStack Router 运行时/CLI 一等支持(React Router 继续可用) |
|
|
42
42
|
| 脚手架模板 | 默认 create 模板以 React Router 起步路径为中心 | 增加 TanStack-ready 与 Tailwind-ready 的 create 模板 |
|
|
@@ -58,6 +58,95 @@ UltraModern.js 的增强能力是新 SuperApp 的默认产品面。兼容分支
|
|
|
58
58
|
3. 将基线契约视为渐进式默认值,而不是一次性强制切换。`MODERN_BASELINE_ENABLE_MF_SSR`、`MODERN_BASELINE_ENABLE_BFF_REQUEST_ID` 和 `MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS` 已经提供了按应用、按环境关闭的能力,方便在收敛到目标栈之前逐步过渡。
|
|
59
59
|
4. 这套公开预设现在已经附带显式的发布 / 认证 gate。生成脚手架也会自带 `.github/workflows/ultramodern-gates.yml`,因此 `pnpm run ultramodern:check` 与 `pnpm run build` 从第一天开始就是接入契约的一部分。
|
|
60
60
|
|
|
61
|
+
## 人类工作流
|
|
62
|
+
|
|
63
|
+
公开的 BleedingDev create 包默认从简单路径开始。默认命令会创建一个
|
|
64
|
+
可上线的 UltraModern 单应用,包含 `presetUltramodern(...)`、SSR、
|
|
65
|
+
TanStack Router、Tailwind CSS v4、i18n、Effect BFF、生成质量 gate,以及
|
|
66
|
+
Cloudflare 部署基础:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
70
|
+
cd myapp
|
|
71
|
+
mise install
|
|
72
|
+
mise exec -- pnpm install
|
|
73
|
+
mise exec -- pnpm ultramodern:check
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
只有当独立归属边界有实际价值时,才创建 SuperApp workspace:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace
|
|
80
|
+
cd my-super-app
|
|
81
|
+
mise install
|
|
82
|
+
mise exec -- pnpm install
|
|
83
|
+
mise exec -- pnpm ultramodern:check
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
workspace 从 shell 和平台契约起步,不强制生成演示业务域。真实业务边界出现后,
|
|
87
|
+
再添加对应 MicroVertical:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
91
|
+
pnpm dlx @bleedingdev/modern-js-create food-delivery --vertical
|
|
92
|
+
pnpm dlx @bleedingdev/modern-js-create payments --vertical
|
|
93
|
+
pnpm dlx @bleedingdev/modern-js-create maps --vertical
|
|
94
|
+
mise exec -- pnpm ultramodern:check
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`--vertical` 会修改当前 workspace:创建 vertical 包,并更新 topology 元数据、
|
|
98
|
+
ownership 记录、shell Module Federation、开发 overlays、包依赖、生成契约、
|
|
99
|
+
端口、路由归属 i18n、CSS 隔离,以及 vertical 自己拥有的 Effect BFF/client surface。
|
|
100
|
+
|
|
101
|
+
### 运行时契约
|
|
102
|
+
|
|
103
|
+
生成应用和 vertical 沿用正常的 Modern.js SSR 路径。SuperApp workspace 在需要
|
|
104
|
+
Module Federation SSR 时会加入 `server.ssr.moduleFederationAppSSR`,但这个开关是
|
|
105
|
+
显式契约,不是所有应用的强制要求。
|
|
106
|
+
|
|
107
|
+
每个应用都会产出 `src/routes/ultramodern-route-metadata` 和
|
|
108
|
+
`ultramodernLocalisedUrls`。i18n 插件在 `localeDetection.localisedUrls` 中读取它,
|
|
109
|
+
并从 `/locales/{{lng}}/{{ns}}.json` 提供动态后端 JSON。路由 owner 需要同时维护
|
|
110
|
+
本地化路径和 locale resource JSON。
|
|
111
|
+
|
|
112
|
+
生成契约会在 `.modernjs/ultramodern-generated-contract.json` 中写入
|
|
113
|
+
`cssFederation`:
|
|
114
|
+
|
|
115
|
+
- `packages/shared-design-tokens` 拥有共享 token layer,并导出 `./tokens.css`。
|
|
116
|
+
- Shell CSS 只拥有 `[data-app-id="shell-super-app"]` 下的 shell base 和 overlay layer。
|
|
117
|
+
- 每个 vertical 拥有自己的 CSS layer,例如 `[data-app-id="vertical-transportation"]` 和应用本地 class 前缀。
|
|
118
|
+
- Tailwind CSS v4 通过 `@tailwindcss/postcss` 保持在每个生成应用内部;共享 base style 不应由 vertical 重复定义。
|
|
119
|
+
- SSR 首屏依赖 Modern/Rspack 产出共享 token CSS 和应用自己的 CSS。Vertical CSS 通过 manifest 归属加载,不复制到 shell 源码中。
|
|
120
|
+
|
|
121
|
+
版本切换必须从同一个 vertical build marker 选择 UI、Effect API、CSS、i18n JSON 与 MF manifest 证据。只切换 shell 渲染里的 UI marker 不足以证明完整版本切换。
|
|
122
|
+
|
|
123
|
+
### 校验与部署
|
|
124
|
+
|
|
125
|
+
本地 gate:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
mise exec -- pnpm ultramodern:check
|
|
129
|
+
mise exec -- pnpm build
|
|
130
|
+
mise exec -- pnpm cloudflare:build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
生成 workspace 包含 `scripts/proof-cloudflare-version.mjs`,用于 live Cloudflare 和
|
|
134
|
+
Zephyr 证据:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
|
|
138
|
+
ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
|
|
139
|
+
ULTRAMODERN_PUBLIC_URL_PAYMENTS=https://payments.example.workers.dev \
|
|
140
|
+
mise exec -- pnpm cloudflare:proof -- --require-public-urls
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Live Cloudflare 与 Zephyr 证明需要公开 Worker URL 和 Zephyr 凭据。没有这些凭据时,
|
|
144
|
+
仓库仍可校验生成契约、本地构建、本地 Cloudflare 输出、dry-run Zephyr 证据计划和
|
|
145
|
+
本地证据 schema,但不能证明由 shell 驱动的 live 版本选择。
|
|
146
|
+
|
|
147
|
+
BleedingDev 包通过 GitHub Actions trusted publishing 发布。公开发布 workflow 不使用
|
|
148
|
+
长期 npm token;不要从开发机器手动发布包。
|
|
149
|
+
|
|
61
150
|
## 基线开关(可按需关闭)
|
|
62
151
|
|
|
63
152
|
生成的 `presetUltramodern(...)` 脚手架会开启更严格的平台契约。以下环境变量会在生成的 `modern.config.ts` 中读取,可按应用或按环境关闭/覆盖:
|
|
@@ -104,7 +104,7 @@ export default RemoteApp;
|
|
|
104
104
|
|
|
105
105
|
## 启动应用
|
|
106
106
|
|
|
107
|
-
现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `
|
|
107
|
+
现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `ultramodern dev` 启动两个应用。
|
|
108
108
|
|
|
109
109
|
启动后,消费者应用访问 `/remote` 路由时,会进入生产者应用中。访问 `http://localhost:8080/remote`,可以看到页面中已经包含了生产者的远程模块的完整页面。
|
|
110
110
|
|
|
@@ -88,10 +88,10 @@ export default createModuleFederationConfig({
|
|
|
88
88
|
|
|
89
89
|
## 本地验证部署
|
|
90
90
|
|
|
91
|
-
Modern.js 提供了 `
|
|
91
|
+
Modern.js 提供了 `ultramodern deploy` 命令,可以方便生成可运行在 Node.js 环境的产物。
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
|
|
94
|
+
ultramodern deploy
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
执行命令后,可以在控制台看到以下输出:
|
|
@@ -154,7 +154,7 @@ export default Index;
|
|
|
154
154
|
|
|
155
155
|
## 启动应用
|
|
156
156
|
|
|
157
|
-
现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `
|
|
157
|
+
现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `ultramodern dev` 启动两个应用。
|
|
158
158
|
|
|
159
159
|
启动后,消费者中对生产者模块的引入,不会再出现抛错,类型已经下载到消费者应用中。
|
|
160
160
|
|
|
@@ -164,7 +164,7 @@ export default Index;
|
|
|
164
164
|
|
|
165
165
|
访问 `http://localhost:8080/remote`,可以看到页面中已经包含了生产者的远程模块 `Button` 组件。
|
|
166
166
|
|
|
167
|
-
我们也可以在本地执行 `
|
|
167
|
+
我们也可以在本地执行 `ultramodern serve` 来模拟生产环境。
|
|
168
168
|
|
|
169
169
|
因为 Module Federation 插件会自动读取 Modern.js 的 `output.assetPrefix` 配置作为远程模块的访问地址,而该值在生产环境下构建后默认是 `/`。如果不做特殊处理,消费者将从自己的域名下拉取远程模块的入口文件。我们可以添加如下配置:
|
|
170
170
|
|
|
@@ -178,7 +178,7 @@ export default defineConfig({
|
|
|
178
178
|
port: 3051,
|
|
179
179
|
},
|
|
180
180
|
output: {
|
|
181
|
-
// Now this configuration is only used in the local when you run
|
|
181
|
+
// Now this configuration is only used in the local when you run ultramodern serve command.
|
|
182
182
|
// If you want to deploy the application to the platform, use your own domain name.
|
|
183
183
|
// Module federation will automatically write it to mf-manifest.json, which influences consumer to fetch remoteEntry.js.
|
|
184
184
|
assetPrefix: 'http://127.0.0.1:3051',
|
|
@@ -187,10 +187,10 @@ export default defineConfig({
|
|
|
187
187
|
});
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
现在,在生产者中运行 `
|
|
190
|
+
现在,在生产者中运行 `ultramodern build && MODERN_MF_AUTO_CORS=true ultramodern serve`,在消费者中运行 `ultramodern build && ultramodern serve`,即可在本地模拟生产环境,访问到远程模块。
|
|
191
191
|
|
|
192
192
|
:::tip
|
|
193
|
-
在使用 `
|
|
193
|
+
在使用 `ultramodern serve` 命令时,需要在启动生产者项目时携带 `MODERN_MF_AUTO_CORS=true` 环境变量,以自动处理跨域问题,确保消费者可以正常访问生产者的远程模块资源。
|
|
194
194
|
:::
|
|
195
195
|
|
|
196
196
|
上述用例可以参考:[Modern.js & Module Federation 基础用法示例](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/module-federation/base)。
|
|
@@ -23,7 +23,7 @@ Modern.js 内部基于 [Rsbuild](https://v2.rsbuild.rs/) 封装了自身的构
|
|
|
23
23
|
Modern.js 提供 [inspect 命令](/apis/app/commands.html) 用于查看项目最终生成的 Modern.js 配置以及 Rspack 配置。
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
➜ npx
|
|
26
|
+
➜ npx ultramodern inspect
|
|
27
27
|
|
|
28
28
|
Inspect config succeed, open following files to view the content:
|
|
29
29
|
|
|
@@ -88,14 +88,14 @@ Modern.js 3.0 默认使用 React Router v7 作为路由库。React Router v7 相
|
|
|
88
88
|
|
|
89
89
|
如果需要使用 React Router v5 或 React Router v6,需要使用**自控式路由**模式。自控式路由允许你完全控制路由配置,不受 Modern.js 约定式路由的限制。
|
|
90
90
|
|
|
91
|
-
## 使用 @modern-js
|
|
91
|
+
## 使用 @bleedingdev/modern-js-create 创建 Monorepo 和 Modern.js Module
|
|
92
92
|
|
|
93
|
-
Modern.js 3.0 不再支持通过 `@modern-js
|
|
93
|
+
Modern.js 3.0 不再支持通过 `@bleedingdev/modern-js-create` 创建 Monorepo 项目和 Modern.js Module 项目。
|
|
94
94
|
|
|
95
95
|
**变更内容**:
|
|
96
96
|
|
|
97
|
-
- 在 [v2.53.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.53.0) 版本中,移除了使用 `@modern-js
|
|
98
|
-
- 在 [v2.61.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.61.0) 版本中,移除了使用 `@modern-js
|
|
97
|
+
- 在 [v2.53.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.53.0) 版本中,移除了使用 `@bleedingdev/modern-js-create` 创建 Monorepo 项目的功能
|
|
98
|
+
- 在 [v2.61.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.61.0) 版本中,移除了使用 `@bleedingdev/modern-js-create` 和 `ultramodern new` 命令创建 Modern.js Module 项目的功能
|
|
99
99
|
|
|
100
100
|
**处理方式**:
|
|
101
101
|
|
|
@@ -104,12 +104,12 @@ Modern.js 3.0 不再支持通过 `@modern-js/create` 创建 Monorepo 项目和 M
|
|
|
104
104
|
|
|
105
105
|
## new 命令和 upgrade 命令移除
|
|
106
106
|
|
|
107
|
-
Modern.js 3.0 移除了 `
|
|
107
|
+
Modern.js 3.0 移除了 `ultramodern new` 和 `ultramodern upgrade` 命令,需要按照文档手动操作。
|
|
108
108
|
|
|
109
109
|
**变更内容**:
|
|
110
110
|
|
|
111
|
-
- `
|
|
112
|
-
- `
|
|
111
|
+
- `ultramodern new` 命令在 Modern.js 3.0 中不再支持,无法通过命令添加入口或启用功能
|
|
112
|
+
- `ultramodern upgrade` 命令在 Modern.js 3.0 中不再支持,无法通过命令自动升级依赖
|
|
113
113
|
|
|
114
114
|
**处理方式**:
|
|
115
115
|
|
|
@@ -187,4 +187,3 @@ Modern.js 之前提供了 ESLint 的完整规则集,涵盖了 @modern-js(针
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
|
|
@@ -38,7 +38,7 @@ This page is the complete public difference reference for the UltraModern.js 3.0
|
|
|
38
38
|
| Metrics/trace correlation | SSR metrics tags do not parse W3C trace context | `traceparent` is parsed and emits `trace_id` / `span_id` tags | Implemented | Improves cross-system observability joins |
|
|
39
39
|
| App-level MF SSR contract flag | No dedicated app-level MF SSR stability contract switch | Adds `server.ssr.moduleFederationAppSSR` contract and auto-enables env wiring when MF SSR markers are detected | Implemented | Sets `process.env.MODERN_MF_APP_SSR` |
|
|
40
40
|
| App-level MF SSR runtime bridge | Not a stable default bridge path | V3 applies stable bridge defaults for MF SSR node output/runtime env when server rendering + MF markers are present | Implemented | Keeps explicit opt-out path via config/env |
|
|
41
|
-
| MF
|
|
41
|
+
| MF vertical loading reliability contracts | Loading fallback patterns are typically app-defined | Adds deterministic timeout/network/contract-error fallback matrix and distributed OTEL continuity assertions | Implemented | `routes-tanstack-mf` reliability suite |
|
|
42
42
|
| BFF runtime choices | Hono runtime path only in Modern.js 3.0 baseline (no built-in Effect runtime path) | Sets Effect as default runtime, enforces strict runtime split (`effect` -> `api/effect`, `hono` -> `api/lambda`), and adds Effect-Schema-only MF data contracts plus failure-injection coverage for federated data fetch | Implemented (Effect-default + strict split) | Stream is explicit about no Zod introduction |
|
|
43
43
|
| Module SDK contract artifact | No framework-level module contract artifact | Adds machine-readable module contract + typed module SDK interfaces | Implemented | `module-sdk-contracts.json` + `moduleSdk.d.ts` |
|
|
44
44
|
| Boundary anti-pattern CI guards | No dedicated boundary anti-pattern workflow | Adds profile-driven CI checks for boundary imports, required hooks, and forbidden module patterns | Implemented | `.github/workflows/boundary-anti-patterns.yml` |
|
|
@@ -239,7 +239,7 @@ UltraModern.js 3.0 shipped additional reliability work aligned to Beads stream D
|
|
|
239
239
|
|
|
240
240
|
- `@modern-js/plugin-bff` runtime path migrated to Effect v4.
|
|
241
241
|
- Effect-only MF data-fetch contract guidance (explicitly no Zod layer in this stream).
|
|
242
|
-
- MF reliability matrix includes deterministic failure injection (timeout/network/contract error).
|
|
242
|
+
- MF vertical loading reliability matrix includes deterministic failure injection (timeout/network/contract error).
|
|
243
243
|
- Distributed trace continuity checks were re-enabled for build and serve paths.
|
|
244
244
|
- Data-platform architecture defines operation identity, envelope integrity, scoped invalidation, and trace propagation contracts.
|
|
245
245
|
|
|
@@ -247,7 +247,7 @@ Reference materials:
|
|
|
247
247
|
|
|
248
248
|
- `docs/super-app-rfc-adr/ADR-0003-effect-only-mf-data-fetch-reliability.md`
|
|
249
249
|
- `packages/cli/plugin-bff/docs/data-platform-architecture.md`
|
|
250
|
-
- `
|
|
250
|
+
- `routes-tanstack-mf` reliability coverage
|
|
251
251
|
|
|
252
252
|
### 11) Release and module certification gate model
|
|
253
253
|
|
|
@@ -280,21 +280,71 @@ The following are intentionally out of scope for this public V3 preset profile:
|
|
|
280
280
|
- Forcing Effect-only data-fetch runtime as the mandatory default for every app.
|
|
281
281
|
- Forcing app-level MF SSR for every app regardless of readiness.
|
|
282
282
|
|
|
283
|
-
##
|
|
283
|
+
## Human Workflow
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
The public BleedingDev create package starts small. The default command creates
|
|
286
|
+
one production-ready UltraModern app with `presetUltramodern(...)`, SSR,
|
|
287
|
+
TanStack Router, Tailwind CSS v4, i18n, Effect BFF, generated quality gates, and
|
|
288
|
+
Cloudflare deploy basics:
|
|
286
289
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
```bash
|
|
291
|
+
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
292
|
+
cd myapp
|
|
293
|
+
mise install
|
|
294
|
+
mise exec -- pnpm install
|
|
295
|
+
mise exec -- pnpm ultramodern:check
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Create a SuperApp workspace only when independent ownership is useful:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace
|
|
302
|
+
cd my-super-app
|
|
303
|
+
mise install
|
|
304
|
+
mise exec -- pnpm install
|
|
305
|
+
mise exec -- pnpm ultramodern:check
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Add real business MicroVerticals as they become ownership boundaries:
|
|
291
309
|
|
|
292
|
-
|
|
310
|
+
```bash
|
|
311
|
+
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
312
|
+
pnpm dlx @bleedingdev/modern-js-create food-delivery --vertical
|
|
313
|
+
pnpm dlx @bleedingdev/modern-js-create payments --vertical
|
|
314
|
+
pnpm dlx @bleedingdev/modern-js-create maps --vertical
|
|
315
|
+
mise exec -- pnpm ultramodern:check
|
|
316
|
+
```
|
|
293
317
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
318
|
+
The `--vertical` command mutates the current workspace. It creates the vertical
|
|
319
|
+
package and updates topology metadata, ownership records, shell Module
|
|
320
|
+
Federation wiring, local development overlays, package dependencies, generated
|
|
321
|
+
contracts, ports, route-owned i18n, CSS isolation, and the vertical-owned Effect
|
|
322
|
+
BFF/client surface.
|
|
323
|
+
|
|
324
|
+
Generated apps and verticals keep SSR on the normal Modern.js path. SuperApp
|
|
325
|
+
workspaces add `server.ssr.moduleFederationAppSSR` when Module Federation SSR is
|
|
326
|
+
needed, but the flag remains an explicit contract rather than a requirement for
|
|
327
|
+
every app.
|
|
328
|
+
|
|
329
|
+
Each app emits `src/routes/ultramodern-route-metadata` with
|
|
330
|
+
`ultramodernLocalisedUrls`. The i18n plugin reads that map in
|
|
331
|
+
`localeDetection.localisedUrls` and serves dynamic backend JSON from
|
|
332
|
+
`/locales/{{lng}}/{{ns}}.json`.
|
|
333
|
+
|
|
334
|
+
The generated contract writes `.modernjs/ultramodern-generated-contract.json`
|
|
335
|
+
with `cssFederation`: shared design tokens stay in `packages/shared-design-tokens`,
|
|
336
|
+
shell CSS owns shell layers, each vertical owns one CSS layer with app-local
|
|
337
|
+
prefixes, and SSR first paint uses Modern/Rspack assets plus manifest-owned
|
|
338
|
+
vertical CSS.
|
|
339
|
+
|
|
340
|
+
Generated workspaces include `scripts/proof-cloudflare-version.mjs` for live
|
|
341
|
+
Cloudflare and Zephyr proof. Live proof requires public Worker URLs and Zephyr
|
|
342
|
+
credentials; local checks still validate generated contracts, builds,
|
|
343
|
+
Cloudflare output, dry-run Zephyr evidence plans, and local evidence schemas.
|
|
344
|
+
|
|
345
|
+
BleedingDev packages are published through GitHub Actions trusted publishing.
|
|
346
|
+
The public workflow is tokenless; do not publish packages manually from a
|
|
347
|
+
developer machine.
|
|
298
348
|
|
|
299
349
|
## Baseline Switches (Opt-out)
|
|
300
350
|
|
|
@@ -38,7 +38,7 @@ UltraModern.js V3 记录的是一套“更强默认值的 Modern.js 参考档案
|
|
|
38
38
|
| Metrics 与 Trace 关联 | SSR metrics 不解析 W3C trace 上下文 | 解析 `traceparent` 并注入 `trace_id` / `span_id` 标签 | 已实现 | 提升跨系统观测关联度 |
|
|
39
39
|
| 应用级 MF SSR 合约开关 | 无专门 app-level MF SSR 稳定性契约开关 | 新增 `server.ssr.moduleFederationAppSSR`,并在检测到 MF SSR 标记时自动启用环境变量握手 | 已实现 | 注入 `process.env.MODERN_MF_APP_SSR` |
|
|
40
40
|
| 应用级 MF SSR 运行时桥接 | 非稳定默认桥接路径 | V3 在「服务端渲染 + MF 标记」场景下提供稳定桥接默认行为 | 已实现 | 保留显式关闭路径 |
|
|
41
|
-
| MF
|
|
41
|
+
| MF vertical 加载可靠性契约 | 加载重试/降级策略通常由业务自管 | 新增 timeout/network/contract-error 的确定性降级矩阵与分布式 OTEL 连续性断言 | 已实现 | 对应 `routes-tanstack-mf` 可靠性套件 |
|
|
42
42
|
| BFF 运行时选型 | Modern.js V3 基线仅提供 Hono 运行时路径(无内建 Effect 运行时) | 将 Effect 设为默认运行时,并采用严格运行时拆分(`effect` -> `api/effect`,`hono` -> `api/lambda`),同时补齐 Effect-Schema-only MF 数据契约与 failure-injection 覆盖 | 已实现(Effect 默认 + 严格拆分) | 该流明确不引入 Zod |
|
|
43
43
|
| 模块 SDK 合约产物 | 无框架级模块契约产物 | 新增机器可读模块家族契约与类型化模块 SDK 接口 | 已实现 | `module-sdk-contracts.json` + `moduleSdk.d.ts` |
|
|
44
44
|
| 边界反模式 CI 守卫 | 无专门边界反模式工作流 | 新增基于 profile 的边界检查(导入边界/必需钩子/模块禁用模式) | 已实现 | `.github/workflows/boundary-anti-patterns.yml` |
|
|
@@ -239,7 +239,7 @@ UltraModern.js V3 对应 Beads Stream D 落地了额外可靠性能力:
|
|
|
239
239
|
|
|
240
240
|
- `@modern-js/plugin-bff` 运行时路径迁移到 Effect v4。
|
|
241
241
|
- MF 数据拉取契约采用 Effect-only 指导(该流明确不引入 Zod)。
|
|
242
|
-
-
|
|
242
|
+
- MF vertical 加载可靠性矩阵覆盖 timeout/network/contract error 的确定性注入场景。
|
|
243
243
|
- build 与 serve 路径重新启用分布式 trace 连续性断言。
|
|
244
244
|
- 数据平台架构补齐 operation identity、请求/水合 envelope 完整性、scope key 与失效路由契约。
|
|
245
245
|
|
|
@@ -247,7 +247,7 @@ UltraModern.js V3 对应 Beads Stream D 落地了额外可靠性能力:
|
|
|
247
247
|
|
|
248
248
|
- `docs/super-app-rfc-adr/ADR-0003-effect-only-mf-data-fetch-reliability.md`
|
|
249
249
|
- `packages/cli/plugin-bff/docs/data-platform-architecture.md`
|
|
250
|
-
- `
|
|
250
|
+
- `routes-tanstack-mf` 可靠性覆盖
|
|
251
251
|
|
|
252
252
|
### 11) 发布与模块认证 Gate 模型
|
|
253
253
|
|
|
@@ -280,6 +280,65 @@ UltraModern.js V3 对应 Beads Stream D 落地了额外可靠性能力:
|
|
|
280
280
|
- 将应用级 MF SSR 强制为所有应用的默认路径。
|
|
281
281
|
- 将 Effect-only 数据获取运行时强制为所有应用的默认路径。
|
|
282
282
|
|
|
283
|
+
## 人类工作流
|
|
284
|
+
|
|
285
|
+
公开的 BleedingDev create 包默认从简单路径开始。默认命令会创建一个
|
|
286
|
+
可上线的 UltraModern 单应用,包含 `presetUltramodern(...)`、SSR、
|
|
287
|
+
TanStack Router、Tailwind CSS v4、i18n、Effect BFF、生成质量 gate,以及
|
|
288
|
+
Cloudflare 部署基础:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
292
|
+
cd myapp
|
|
293
|
+
mise install
|
|
294
|
+
mise exec -- pnpm install
|
|
295
|
+
mise exec -- pnpm ultramodern:check
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
只有当独立归属边界有实际价值时,才创建 SuperApp workspace:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace
|
|
302
|
+
cd my-super-app
|
|
303
|
+
mise install
|
|
304
|
+
mise exec -- pnpm install
|
|
305
|
+
mise exec -- pnpm ultramodern:check
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
真实业务边界出现后,再添加对应 MicroVertical:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
312
|
+
pnpm dlx @bleedingdev/modern-js-create food-delivery --vertical
|
|
313
|
+
pnpm dlx @bleedingdev/modern-js-create payments --vertical
|
|
314
|
+
pnpm dlx @bleedingdev/modern-js-create maps --vertical
|
|
315
|
+
mise exec -- pnpm ultramodern:check
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`--vertical` 会修改当前 workspace:创建 vertical 包,并更新 topology 元数据、
|
|
319
|
+
ownership 记录、shell Module Federation、开发 overlays、包依赖、生成契约、
|
|
320
|
+
端口、路由归属 i18n、CSS 隔离,以及 vertical 自己拥有的 Effect BFF/client surface。
|
|
321
|
+
|
|
322
|
+
生成应用和 vertical 沿用正常的 Modern.js SSR 路径。SuperApp workspace 在需要
|
|
323
|
+
Module Federation SSR 时会加入 `server.ssr.moduleFederationAppSSR`,但这个开关是
|
|
324
|
+
显式契约,不是所有应用的强制要求。
|
|
325
|
+
|
|
326
|
+
每个应用都会产出 `src/routes/ultramodern-route-metadata` 和
|
|
327
|
+
`ultramodernLocalisedUrls`。i18n 插件在 `localeDetection.localisedUrls` 中读取它,
|
|
328
|
+
并从 `/locales/{{lng}}/{{ns}}.json` 提供动态后端 JSON。
|
|
329
|
+
|
|
330
|
+
生成契约会在 `.modernjs/ultramodern-generated-contract.json` 中写入
|
|
331
|
+
`cssFederation`:共享 design tokens 保留在 `packages/shared-design-tokens`,
|
|
332
|
+
shell CSS 拥有 shell layer,每个 vertical 拥有自己的 CSS layer 与应用本地前缀,
|
|
333
|
+
SSR 首屏使用 Modern/Rspack 产物和 manifest 归属的 vertical CSS。
|
|
334
|
+
|
|
335
|
+
生成 workspace 包含 `scripts/proof-cloudflare-version.mjs`,用于 live Cloudflare 和
|
|
336
|
+
Zephyr 证据。Live 证明需要公开 Worker URL 和 Zephyr 凭据;本地检查仍可校验
|
|
337
|
+
生成契约、构建、Cloudflare 输出、dry-run Zephyr 证据计划和本地证据 schema。
|
|
338
|
+
|
|
339
|
+
BleedingDev 包通过 GitHub Actions trusted publishing 发布。公开发布 workflow 不使用
|
|
340
|
+
长期 npm token;不要从开发机器手动发布包。
|
|
341
|
+
|
|
283
342
|
## 基线开关(可按需关闭)
|
|
284
343
|
|
|
285
344
|
生成的 `presetUltramodern(...)` create 模板会开启更严格的平台契约。以下环境变量会在生成的 `modern.config.ts` 中读取,可按应用或按环境关闭/覆盖:
|
package/package.json
CHANGED
|
@@ -18,24 +18,24 @@
|
|
|
18
18
|
"modern",
|
|
19
19
|
"modern.js"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.2.0-ultramodern.
|
|
21
|
+
"version": "3.2.0-ultramodern.80",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"registry": "https://registry.npmjs.org/",
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"mermaid": "^11.15.0",
|
|
28
|
-
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.2.0-ultramodern.
|
|
28
|
+
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.2.0-ultramodern.80"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rsbuild/plugin-sass": "1.5.2",
|
|
32
|
-
"@rspress/core": "2.0.
|
|
33
|
-
"@rspress/plugin-llms": "2.0.
|
|
34
|
-
"@rspress/shared": "2.0.
|
|
35
|
-
"@shikijs/transformers": "^4.0
|
|
32
|
+
"@rspress/core": "2.0.12",
|
|
33
|
+
"@rspress/plugin-llms": "2.0.12",
|
|
34
|
+
"@rspress/shared": "2.0.12",
|
|
35
|
+
"@shikijs/transformers": "^4.1.0",
|
|
36
36
|
"@types/fs-extra": "11.0.4",
|
|
37
|
-
"@types/node": "^25.
|
|
38
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
37
|
+
"@types/node": "^25.9.1",
|
|
38
|
+
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
39
39
|
"classnames": "^2.5.1",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
41
|
"fs-extra": "^11.3.5",
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Cypress
|
|
2
|
-
|
|
3
|
-
Cypress is a framework for E2E testing and component testing.
|
|
4
|
-
|
|
5
|
-
To use Cypress in Modern.js, you need to install the dependencies first. You can run the following commands:
|
|
6
|
-
|
|
7
|
-
import { PackageManagerTabs } from '@theme';
|
|
8
|
-
|
|
9
|
-
<PackageManagerTabs command={{ npm: "npm install -D cypress", yarn: "yarn add -D cypress", pnpm: "pnpm install -D cypress" }} />
|
|
10
|
-
|
|
11
|
-
Next, create a `cypress.config.ts` file and add the following content:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { defineConfig } from 'cypress'
|
|
15
|
-
|
|
16
|
-
export default defineConfig({
|
|
17
|
-
e2e: {
|
|
18
|
-
setupNodeEvents(on, config) {},
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Writing Test Cases
|
|
24
|
-
|
|
25
|
-
Now, use Cypress to write an E2E test case by first creating two Modern.js pages.
|
|
26
|
-
|
|
27
|
-
```tsx title="routes/page.tsx"
|
|
28
|
-
import { Link } from '@modern-js/runtime/router';
|
|
29
|
-
|
|
30
|
-
const Index = () => (
|
|
31
|
-
<div>
|
|
32
|
-
<h1>Home</h1>
|
|
33
|
-
<Link to="/about">About</Link>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export default Index;
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```tsx title="routes/about/page.tsx"
|
|
41
|
-
import { Link } from '@modern-js/runtime/router';
|
|
42
|
-
|
|
43
|
-
const Index = () => (
|
|
44
|
-
<div>
|
|
45
|
-
<h1>About</h1>
|
|
46
|
-
<Link to="/">Home</Link>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export default Index;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Next, create the test case file:
|
|
54
|
-
|
|
55
|
-
```ts title="cypress/e2e/app.cy.ts"
|
|
56
|
-
describe('Navigation', () => {
|
|
57
|
-
it('should navigate to the about page', () => {
|
|
58
|
-
// Start from the index page
|
|
59
|
-
cy.visit('http://localhost:8080/')
|
|
60
|
-
|
|
61
|
-
// Find a link with an href attribute containing "about" and click it
|
|
62
|
-
cy.get('a[href*="about"]').click()
|
|
63
|
-
|
|
64
|
-
// The new url should include "/about"
|
|
65
|
-
cy.url().should('include', '/about')
|
|
66
|
-
|
|
67
|
-
// The new page should contain an h1 with "About"
|
|
68
|
-
cy.get('h1').contains('About')
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The test file may lack type definitions for the API. You can refer to the [Cypress - Typescript](https://docs.cypress.io/guides/tooling/typescript-support#Configure-tsconfigjson) documentation to resolve this.
|
|
74
|
-
|
|
75
|
-
You can add the command to your `package.json`:
|
|
76
|
-
|
|
77
|
-
```json title="package.json"
|
|
78
|
-
{
|
|
79
|
-
"scripts": {
|
|
80
|
-
"test": "cypress open"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Run Test Cases
|
|
86
|
-
|
|
87
|
-
Execute the above `test` command to run the test cases:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
DevTools listening on ws://127.0.0.1:55203/devtools/browser/xxxxx
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Cypress will open a headless browser. Following the prompts, you can find the corresponding test files and automatically run the E2E tests:
|
|
94
|
-
|
|
95
|
-

|