@bleedingdev/modern-js-main-doc 3.5.0-ultramodern.2 → 3.5.0-ultramodern.21
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/configure/app/bff/effect.mdx +18 -5
- package/docs/en/configure/app/performance/build-cache.mdx +5 -0
- package/docs/en/guides/get-started/ultramodern.mdx +59 -13
- package/docs/zh/configure/app/bff/effect.mdx +16 -4
- package/docs/zh/configure/app/performance/build-cache.mdx +4 -0
- package/docs/zh/guides/get-started/ultramodern.mdx +51 -11
- package/package.json +2 -2
|
@@ -197,18 +197,31 @@ The generated `api.client.*` API only exists for loader-materialized `@api/index
|
|
|
197
197
|
## Effect cohort
|
|
198
198
|
|
|
199
199
|
UltraModern-generated workspaces pin the framework-compatible Effect cohort
|
|
200
|
-
through `pnpm-workspace.yaml` overrides. For
|
|
201
|
-
apps use:
|
|
200
|
+
through `pnpm-workspace.yaml` overrides. For the current UltraModern cohort,
|
|
201
|
+
generated apps use:
|
|
202
202
|
|
|
203
203
|
```yaml
|
|
204
|
+
minimumReleaseAgeExclude:
|
|
205
|
+
- 'effect@4.0.0-beta.92'
|
|
206
|
+
- '@effect/opentelemetry@4.0.0-beta.92'
|
|
207
|
+
|
|
208
|
+
trustPolicyExclude:
|
|
209
|
+
- 'effect@4.0.0-beta.92'
|
|
210
|
+
- '@effect/opentelemetry@4.0.0-beta.92'
|
|
211
|
+
|
|
204
212
|
overrides:
|
|
205
|
-
'@effect/
|
|
206
|
-
effect: 4.0.0-beta.
|
|
213
|
+
'@effect/opentelemetry': 4.0.0-beta.92
|
|
214
|
+
'@effect/vitest': 4.0.0-beta.92
|
|
215
|
+
effect: 4.0.0-beta.92
|
|
207
216
|
```
|
|
208
217
|
|
|
209
218
|
Do not add a different direct `effect` version in an app package. A mismatched
|
|
210
219
|
Effect beta can fail while building layers or HTTP middleware because runtime
|
|
211
|
-
services come from different package instances.
|
|
220
|
+
services come from different package instances. Keep the generated
|
|
221
|
+
policy exclusion entries with the same Effect cohort; they handle the
|
|
222
|
+
framework-selected Effect beta versions before the 24-hour maturity window and
|
|
223
|
+
the `effect`/`@effect/opentelemetry` trusted-publisher to provenance metadata
|
|
224
|
+
transition without weakening UltraModern API architecture checks.
|
|
212
225
|
|
|
213
226
|
## Contract tests
|
|
214
227
|
|
|
@@ -28,6 +28,11 @@ type BuildCacheConfig =
|
|
|
28
28
|
|
|
29
29
|
Controls the caching behavior during the build process.
|
|
30
30
|
|
|
31
|
+
When persistent Rspack cache is enabled, Modern.js treats `cacheDirectory` as a
|
|
32
|
+
base directory and stores each Rsbuild/Rspack environment in its own child
|
|
33
|
+
directory, such as `client`, `server`, or `workerSSR`. This avoids concurrent
|
|
34
|
+
environment compilers writing to the same filesystem cache root.
|
|
35
|
+
|
|
31
36
|
Modern.js will enable build cache by default to improve the compile speed. You can disable the build cache by setting it to `false`:
|
|
32
37
|
|
|
33
38
|
```js
|
|
@@ -78,33 +78,78 @@ mise exec -- pnpm check
|
|
|
78
78
|
mise exec -- pnpm build
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
### Migrating to `3.5.0-ultramodern.18`
|
|
82
|
+
|
|
83
|
+
Use `3.5.0-ultramodern.18` or newer for localized Cloudflare SSR workspaces.
|
|
84
|
+
This cohort moves bare locale-root redirects into the framework-owned
|
|
85
|
+
Cloudflare Worker entry and the i18n server runtime. A request for `/` is
|
|
86
|
+
redirected server-side with `302` to the negotiated locale path, for example
|
|
87
|
+
`/cs` for `Accept-Language: cs-CZ` or `/en` for English and fallback traffic.
|
|
88
|
+
|
|
89
|
+
Existing generated workspaces should upgrade the whole BleedingDev Modern
|
|
90
|
+
package cohort together:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.18 ultramodern \
|
|
94
|
+
migrate-strict-effect --version 3.5.0-ultramodern.18
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm check
|
|
97
|
+
pnpm build
|
|
98
|
+
pnpm cloudflare:build
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For deployed Cloudflare Workers, redeploy after the cohort update and verify
|
|
102
|
+
the root response before accepting the migration:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
curl -I -H 'Accept-Language: cs-CZ,cs;q=0.9,en;q=0.1' https://<worker-host>/
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The expected response is `302` with `Location: /cs` or the matching locale,
|
|
109
|
+
`Cache-Control: private, no-store`, and `Vary` covering the locale detection
|
|
110
|
+
headers. Following the redirect should return the SSR locale page with the
|
|
111
|
+
matching document language and i18n SSR data.
|
|
112
|
+
|
|
113
|
+
Do not fix older root `404` responses by adding app-owned root route files,
|
|
114
|
+
client-side redirects, custom navigation wrappers, Cloudflare Worker
|
|
115
|
+
postprocessing, generated output edits, or local redirect shims. If `/` still
|
|
116
|
+
returns `404` after upgrading, confirm the production build log shows
|
|
117
|
+
`Modern.js Framework v3.5.0-ultramodern.18` or newer and redeploy the Worker.
|
|
118
|
+
|
|
119
|
+
Strict generated API migration requires `3.5.0-ultramodern.10` or newer.
|
|
82
120
|
`3.4.0-ultramodern.20` and earlier cohorts do not include this full direct
|
|
83
121
|
`api/index.ts` generator, generated `.mts` checks, strict Oxlint boundary rule
|
|
84
122
|
set, Effect cohort overrides, and strict Effect migration command. Agents that
|
|
85
123
|
cannot install that BleedingDev cohort yet should use the local Modern.js
|
|
86
|
-
workspace for migration validation; otherwise pin `3.5.0-ultramodern.
|
|
124
|
+
workspace for migration validation; otherwise pin `3.5.0-ultramodern.10` or
|
|
87
125
|
newer with `--ultramodern-package-version`.
|
|
88
126
|
|
|
89
127
|
Before hand-editing package aliases or generated metadata, run the framework
|
|
90
128
|
migration command from the target workspace:
|
|
91
129
|
|
|
92
130
|
```bash
|
|
93
|
-
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.
|
|
94
|
-
migrate-strict-effect --version 3.5.0-ultramodern.
|
|
131
|
+
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.10 ultramodern \
|
|
132
|
+
migrate-strict-effect --version 3.5.0-ultramodern.10
|
|
95
133
|
pnpm api:check
|
|
96
134
|
pnpm contract:check
|
|
97
135
|
```
|
|
98
136
|
|
|
99
137
|
The command updates `.modernjs/ultramodern.json`, root
|
|
100
|
-
`modernjs.packageSource`, generated Modern package aliases,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
138
|
+
`modernjs.packageSource`, generated Modern package aliases, framework-owned
|
|
139
|
+
toolchain pins, direct topology API metadata, strict Effect pnpm
|
|
140
|
+
overrides/trust policy, and the pnpm lockfile. Remaining failures are source
|
|
141
|
+
migration work: move code to `shared/api.ts`, `api/index.ts`, and
|
|
142
|
+
`src/api/*-client.ts`, then delete `api/effect`, `api/lambda`, `shared/effect`,
|
|
143
|
+
and `src/effect`.
|
|
104
144
|
|
|
105
145
|
Generated strict Effect workspaces pin the compatible Effect cohort with pnpm
|
|
106
|
-
overrides: `effect@4.0.0-beta.
|
|
107
|
-
add app-local direct Effect
|
|
146
|
+
overrides: `effect@4.0.0-beta.92`, `@effect/opentelemetry@4.0.0-beta.92`,
|
|
147
|
+
and `@effect/vitest@4.0.0-beta.92`. Do not add app-local direct Effect
|
|
148
|
+
versions that disagree with those overrides. They also carry generated pnpm
|
|
149
|
+
policy exclusions for `effect@4.0.0-beta.92` and
|
|
150
|
+
`@effect/opentelemetry@4.0.0-beta.92` so the framework-selected Effect beta
|
|
151
|
+
cohort is not blocked by the 24-hour age gate or trusted-publisher to
|
|
152
|
+
provenance metadata transition.
|
|
108
153
|
|
|
109
154
|
Gradual migration means old, unmigrated Modern.js apps can keep their existing
|
|
110
155
|
runtime until they are converted. Once a surface is generated or migrated as
|
|
@@ -183,9 +228,10 @@ instead of patching generated output by hand.
|
|
|
183
228
|
Cloudflare D1 bindings are first-class on `deploy.worker.d1Databases`; use that
|
|
184
229
|
config instead of app-local postprocessing when a generated app owns D1
|
|
185
230
|
migrations. Cloudflare public output excludes server-only `api` and `shared`
|
|
186
|
-
directories by default, and generated Modern/Rspack
|
|
187
|
-
and
|
|
188
|
-
|
|
231
|
+
directories by default, and generated Modern/Rspack output roots, temp
|
|
232
|
+
directories, and caches are isolated per app, build target, and Rspack
|
|
233
|
+
environment so local `build`, `cloudflare:build`, and multi-environment
|
|
234
|
+
compilers do not share mutable build state.
|
|
189
235
|
|
|
190
236
|
## Human Workflow
|
|
191
237
|
|
|
@@ -195,16 +195,28 @@ export default defineConfig({
|
|
|
195
195
|
## Effect 版本组
|
|
196
196
|
|
|
197
197
|
UltraModern 生成的 workspace 会通过 `pnpm-workspace.yaml` overrides 锁定与框架兼容的
|
|
198
|
-
Effect
|
|
198
|
+
Effect 版本组。当前 UltraModern 版本组使用:
|
|
199
199
|
|
|
200
200
|
```yaml
|
|
201
|
+
minimumReleaseAgeExclude:
|
|
202
|
+
- 'effect@4.0.0-beta.92'
|
|
203
|
+
- '@effect/opentelemetry@4.0.0-beta.92'
|
|
204
|
+
|
|
205
|
+
trustPolicyExclude:
|
|
206
|
+
- 'effect@4.0.0-beta.92'
|
|
207
|
+
- '@effect/opentelemetry@4.0.0-beta.92'
|
|
208
|
+
|
|
201
209
|
overrides:
|
|
202
|
-
'@effect/
|
|
203
|
-
effect: 4.0.0-beta.
|
|
210
|
+
'@effect/opentelemetry': 4.0.0-beta.92
|
|
211
|
+
'@effect/vitest': 4.0.0-beta.92
|
|
212
|
+
effect: 4.0.0-beta.92
|
|
204
213
|
```
|
|
205
214
|
|
|
206
215
|
不要在应用包里添加不同版本的直接 `effect` 依赖。Effect beta 不一致时,Layer 或 HTTP
|
|
207
|
-
middleware 构建可能因为运行时 service
|
|
216
|
+
middleware 构建可能因为运行时 service 来自不同包实例而失败。保留生成的 policy
|
|
217
|
+
exclusion 条目并让它跟随同一个 Effect 版本组;它用于处理框架选定 Effect beta 版本在
|
|
218
|
+
24 小时成熟期内的安装,以及 `effect` 和 `@effect/opentelemetry` 从 trusted-publisher
|
|
219
|
+
metadata 迁移到 provenance attestation 时的 pnpm no-downgrade 检查。
|
|
208
220
|
|
|
209
221
|
## 契约测试
|
|
210
222
|
|
|
@@ -28,6 +28,10 @@ type BuildCacheConfig =
|
|
|
28
28
|
|
|
29
29
|
控制 Modern.js 在构建过程中的缓存行为。
|
|
30
30
|
|
|
31
|
+
启用 Rspack 持久化缓存时,Modern.js 会把 `cacheDirectory` 视为基础目录,并为每个
|
|
32
|
+
Rsbuild/Rspack environment 写入独立子目录,例如 `client`、`server` 或
|
|
33
|
+
`workerSSR`。这样可以避免并发 environment compiler 写入同一个文件系统 cache 根目录。
|
|
34
|
+
|
|
31
35
|
在构建时,Modern.js 默认会开启构建缓存来提升二次构建的速度。如果不希望缓存,你可以将 `buildCache` 置为 `false` 将其禁用掉:
|
|
32
36
|
|
|
33
37
|
```js
|
|
@@ -71,30 +71,69 @@ mise exec -- pnpm check
|
|
|
71
71
|
mise exec -- pnpm build
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
### 迁移到 `3.5.0-ultramodern.18`
|
|
75
|
+
|
|
76
|
+
本地化 Cloudflare SSR workspace 应使用 `3.5.0-ultramodern.18` 或更新版本。这个
|
|
77
|
+
cohort 将裸 locale root 重定向移动到框架拥有的 Cloudflare Worker entry 和 i18n
|
|
78
|
+
server runtime 中。请求 `/` 时,框架会按语言协商在服务端返回 `302`,例如
|
|
79
|
+
`Accept-Language: cs-CZ` 会跳转到 `/cs`,英语或 fallback 流量会跳转到 `/en`。
|
|
80
|
+
|
|
81
|
+
既有生成 workspace 应整体升级同一个 BleedingDev Modern package cohort:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.18 ultramodern \
|
|
85
|
+
migrate-strict-effect --version 3.5.0-ultramodern.18
|
|
86
|
+
pnpm install
|
|
87
|
+
pnpm check
|
|
88
|
+
pnpm build
|
|
89
|
+
pnpm cloudflare:build
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Cloudflare Workers 已部署环境需要在 cohort 更新后重新部署,并在接受迁移前验证 root
|
|
93
|
+
响应:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
curl -I -H 'Accept-Language: cs-CZ,cs;q=0.9,en;q=0.1' https://<worker-host>/
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
期望响应是 `302`,并带有 `Location: /cs` 或匹配的 locale、
|
|
100
|
+
`Cache-Control: private, no-store`,以及覆盖语言检测 Header 的 `Vary`。继续跟随该
|
|
101
|
+
redirect 后,应返回匹配语言的 SSR 页面,文档语言和 i18n SSR 数据也应一致。
|
|
102
|
+
|
|
103
|
+
不要通过 app 自有 root route、客户端 redirect、自定义导航 wrapper、Cloudflare Worker
|
|
104
|
+
postprocess、生成产物编辑或本地 redirect shim 来修复旧版本的 root `404`。如果升级后
|
|
105
|
+
`/` 仍然返回 `404`,先确认生产构建日志显示
|
|
106
|
+
`Modern.js Framework v3.5.0-ultramodern.18` 或更新版本,然后重新部署 Worker。
|
|
107
|
+
|
|
108
|
+
严格生成 API 迁移要求 `3.5.0-ultramodern.10` 或更新版本。
|
|
75
109
|
`3.4.0-ultramodern.20` 及更早 cohort 还没有这套完整的直接
|
|
76
110
|
`api/index.ts` 生成器、生成的 `.mts` 检查、严格 Oxlint 边界规则、Effect 版本组
|
|
77
111
|
overrides 和严格 Effect 迁移命令。还不能安装该 BleedingDev cohort 的 agent 应使用本地
|
|
78
112
|
Modern.js workspace 做迁移校验;否则用 `--ultramodern-package-version` 固定
|
|
79
|
-
`3.5.0-ultramodern.
|
|
113
|
+
`3.5.0-ultramodern.10` 或更新版本。
|
|
80
114
|
|
|
81
115
|
手写 package alias 或生成 metadata 之前,先在目标 workspace 运行框架迁移命令:
|
|
82
116
|
|
|
83
117
|
```bash
|
|
84
|
-
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.
|
|
85
|
-
migrate-strict-effect --version 3.5.0-ultramodern.
|
|
118
|
+
pnpm dlx @bleedingdev/modern-js-create@3.5.0-ultramodern.10 ultramodern \
|
|
119
|
+
migrate-strict-effect --version 3.5.0-ultramodern.10
|
|
86
120
|
pnpm api:check
|
|
87
121
|
pnpm contract:check
|
|
88
122
|
```
|
|
89
123
|
|
|
90
124
|
该命令会更新 `.modernjs/ultramodern.json`、根 `modernjs.packageSource`、生成的
|
|
91
|
-
Modern package alias、直接 topology API metadata
|
|
92
|
-
|
|
93
|
-
`api
|
|
125
|
+
Modern package alias、框架拥有的 toolchain pin、直接 topology API metadata、严格 Effect
|
|
126
|
+
pnpm overrides/trust policy 和 pnpm lockfile。剩余失败就是源码迁移:把代码移到
|
|
127
|
+
`shared/api.ts`、`api/index.ts` 和 `src/api/*-client.ts`,再删除 `api/effect`、
|
|
128
|
+
`api/lambda`、`shared/effect` 和 `src/effect`。
|
|
94
129
|
|
|
95
130
|
严格 Effect 生成 workspace 会通过 pnpm overrides 固定兼容版本组:
|
|
96
|
-
`effect@4.0.0-beta.
|
|
97
|
-
overrides 冲突的 app 本地直接
|
|
131
|
+
`effect@4.0.0-beta.92`、`@effect/opentelemetry@4.0.0-beta.92` 和
|
|
132
|
+
`@effect/vitest@4.0.0-beta.92`。不要添加与这些 overrides 冲突的 app 本地直接
|
|
133
|
+
Effect 版本。生成的 pnpm policy 还会为 `effect@4.0.0-beta.92` 和
|
|
134
|
+
`@effect/opentelemetry@4.0.0-beta.92` 添加例外,避免框架选定的 Effect beta
|
|
135
|
+
版本组被 24 小时成熟期检查,或从 trusted-publisher metadata 迁移到 provenance
|
|
136
|
+
attestation 时被 no-downgrade 检查误拦截。
|
|
98
137
|
|
|
99
138
|
渐进迁移意味着尚未迁移的旧 Modern.js app 可以保留现有 runtime,直到被转换为
|
|
100
139
|
UltraModern。一个 surface 一旦生成为或迁移为 UltraModern HTTP API,就只能使用
|
|
@@ -157,8 +196,9 @@ Federation 冲突,都应在对应归属文件中修复,不要手写补丁覆
|
|
|
157
196
|
|
|
158
197
|
Cloudflare D1 绑定使用一等配置 `deploy.worker.d1Databases`;生成 app 拥有 D1
|
|
159
198
|
migration 时不要再用 app 本地 postprocess。Cloudflare public output 默认排除服务端
|
|
160
|
-
`api` 和 `shared` 目录,并且生成的 Modern/Rspack
|
|
161
|
-
|
|
199
|
+
`api` 和 `shared` 目录,并且生成的 Modern/Rspack 输出根目录、temp 目录和 cache
|
|
200
|
+
会按 app、构建目标和 Rspack environment 隔离,避免本地 `build`、`cloudflare:build`
|
|
201
|
+
以及多 environment compiler 共享可变构建状态。
|
|
162
202
|
|
|
163
203
|
## 人类工作流
|
|
164
204
|
|
package/package.json
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"modern.js",
|
|
20
20
|
"ultramodern.js"
|
|
21
21
|
],
|
|
22
|
-
"version": "3.5.0-ultramodern.
|
|
22
|
+
"version": "3.5.0-ultramodern.21",
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"registry": "https://registry.npmjs.org/",
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"mermaid": "^11.16.0",
|
|
29
|
-
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.5.0-ultramodern.
|
|
29
|
+
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.5.0-ultramodern.21"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rsbuild/plugin-sass": "2.0.0",
|