@bleedingdev/modern-js-main-doc 3.5.0-ultramodern.3 → 3.5.0-ultramodern.31

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.
@@ -85,6 +85,6 @@ export default () => {
85
85
  ```
86
86
 
87
87
  :::note
88
- `<Outlet>` is a new API in React Router 7. For details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
88
+ `<Outlet>` is an API provided by React Router. For details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
89
89
 
90
90
  :::
@@ -6,7 +6,7 @@ sidebar_position: 1
6
6
  # router
7
7
 
8
8
  :::info
9
- The router solution based on [react-router v7](https://reactrouter.com/).
9
+ The router solution based on [react-router](https://reactrouter.com/).
10
10
 
11
11
  This page documents the React Router runtime export (`@modern-js/runtime/router`).
12
12
  If your app uses TanStack Router (`--router tanstack`), use `@modern-js/plugin-tanstack/runtime` and refer to TanStack Router API docs.
@@ -197,24 +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 `3.5.0-ultramodern.3`, generated
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
+
204
208
  trustPolicyExclude:
205
- - '@effect/opentelemetry@4.0.0-beta.91'
209
+ - 'effect@4.0.0-beta.92'
210
+ - '@effect/opentelemetry@4.0.0-beta.92'
206
211
 
207
212
  overrides:
208
- '@effect/vitest': 4.0.0-beta.91
209
- effect: 4.0.0-beta.91
213
+ '@effect/opentelemetry': 4.0.0-beta.92
214
+ '@effect/vitest': 4.0.0-beta.92
215
+ effect: 4.0.0-beta.92
210
216
  ```
211
217
 
212
218
  Do not add a different direct `effect` version in an app package. A mismatched
213
219
  Effect beta can fail while building layers or HTTP middleware because runtime
214
220
  services come from different package instances. Keep the generated
215
- `trustPolicyExclude` entry with the same Effect cohort; it handles the
216
- `@effect/opentelemetry` trusted-publisher to provenance metadata transition
217
- without weakening UltraModern API architecture checks.
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.
218
225
 
219
226
  ## Contract tests
220
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
@@ -4,7 +4,7 @@ sidebar_position: 2
4
4
 
5
5
  # Routing
6
6
 
7
- Modern.js supports conventional routing on top of both [React Router v7](https://reactrouter.com/en/main) and [TanStack Router](https://tanstack.com/router), offering file convention-based routing capabilities and supporting the industry-popular **nested routing** pattern. When an entry is recognized as [conventional routing](/guides/concept/entries.html#conventional-routing), Modern.js automatically generates the corresponding routing structure based on the file system.
7
+ Modern.js supports conventional routing on top of both [React Router](https://reactrouter.com/en/main) and [TanStack Router](https://tanstack.com/router), offering file convention-based routing capabilities and supporting the industry-popular **nested routing** pattern. When an entry is recognized as [conventional routing](/guides/concept/entries.html#conventional-routing), Modern.js automatically generates the corresponding routing structure based on the file system.
8
8
 
9
9
  :::note
10
10
 
@@ -93,7 +93,7 @@ export default () => {
93
93
 
94
94
  :::note
95
95
 
96
- `<Outlet>` is an API provided by React Router v7. For more details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
96
+ `<Outlet>` is an API provided by React Router. For more details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
97
97
 
98
98
  :::
99
99
 
@@ -156,7 +156,7 @@ If there is an `App.tsx?` file in the entry, this entry is a self-controlled rou
156
156
  │ └── App.tsx
157
157
  ```
158
158
 
159
- For the entry defined as `src/App.tsx`, Modern.js does not perform additional routing operations. Developers can use the [React Router v7](https://reactrouter.com/en/main) API to set up client-side routes, or not set up client-side routes. For example, the following code sets up client-side routes in the application:
159
+ For the entry defined as `src/App.tsx`, Modern.js does not perform additional routing operations. Developers can use the [React Router](https://reactrouter.com/en/main) API to set up client-side routes, or not set up client-side routes. For example, the following code sets up client-side routes in the application:
160
160
 
161
161
  ```tsx title="src/App.tsx"
162
162
  import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
@@ -19,7 +19,7 @@ Rsbuild supports building Vue applications. If you need to use Vue, you can refe
19
19
  Modern.js provides two first-party routing frameworks:
20
20
 
21
21
  - [TanStack Router](https://tanstack.com/router) (UltraModern default), via `@modern-js/plugin-tanstack/runtime`.
22
- - [React Router v7](https://reactrouter.com/en/main) (compatibility path), via `@modern-js/runtime/router`.
22
+ - [React Router](https://reactrouter.com/en/main), via `@modern-js/runtime/router`.
23
23
 
24
24
  When creating an UltraModern project, TanStack Router is included by default:
25
25
 
@@ -78,20 +78,58 @@ mise exec -- pnpm check
78
78
  mise exec -- pnpm build
79
79
  ```
80
80
 
81
- Strict generated API migration requires `3.5.0-ultramodern.3` or newer.
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.3` or
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.3 ultramodern \
94
- migrate-strict-effect --version 3.5.0-ultramodern.3
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
  ```
@@ -105,11 +143,13 @@ migration work: move code to `shared/api.ts`, `api/index.ts`, and
105
143
  and `src/effect`.
106
144
 
107
145
  Generated strict Effect workspaces pin the compatible Effect cohort with pnpm
108
- overrides: `effect@4.0.0-beta.91` and `@effect/vitest@4.0.0-beta.91`. Do not
109
- add app-local direct Effect versions that disagree with those overrides. They
110
- also carry a generated pnpm trust-policy exclusion for
111
- `@effect/opentelemetry@4.0.0-beta.91` so pnpm no-downgrade checks do not block
112
- the Effect beta cohort's trusted-publisher to provenance metadata transition.
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.
113
153
 
114
154
  Gradual migration means old, unmigrated Modern.js apps can keep their existing
115
155
  runtime until they are converted. Once a surface is generated or migrated as
@@ -188,9 +228,10 @@ instead of patching generated output by hand.
188
228
  Cloudflare D1 bindings are first-class on `deploy.worker.d1Databases`; use that
189
229
  config instead of app-local postprocessing when a generated app owns D1
190
230
  migrations. Cloudflare public output excludes server-only `api` and `shared`
191
- directories by default, and generated Modern/Rspack caches are isolated per app
192
- and build target so local `build` and `cloudflare:build` runs do not share the
193
- same Rspack cache directory.
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.
194
235
 
195
236
  ## Human Workflow
196
237
 
@@ -362,7 +403,7 @@ Cloudflare and Zephyr proof:
362
403
  ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
363
404
  ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
364
405
  ULTRAMODERN_PUBLIC_URL_PAYMENTS=https://payments.example.workers.dev \
365
- mise exec -- pnpm cloudflare:proof -- --require-public-urls
406
+ mise exec -- pnpm cloudflare:proof --require-public-urls
366
407
  ```
367
408
 
368
409
  Live Cloudflare and Zephyr proof requires public Worker URLs and Zephyr credentials. Without those, the repo can validate generated contracts, local builds, local Cloudflare output, dry-run Zephyr evidence plans, and local evidence schemas, but it cannot prove shell-driven live version selection.
@@ -4,7 +4,7 @@ title: Route Authorization
4
4
 
5
5
  # Route Authorization
6
6
 
7
- Modern.js defaults to the convention-based routing based on React Router v7. For more details, please refer to [Routing](/guides/basic-features/routes/routes#routing).
7
+ Modern.js defaults to the convention-based routing based on React Router. For more details, please refer to [Routing](/guides/basic-features/routes/routes#routing).
8
8
 
9
9
  In a web application, if there are multiple routes, we may need to authorize access to some of them before accessing them. For example, in the following scenario:
10
10
 
@@ -85,6 +85,6 @@ export default () => {
85
85
  ```
86
86
 
87
87
  :::note
88
- `<Outlet>` 是 React Router v7 中新的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
88
+ `<Outlet>` 是 React Router 提供的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
89
89
 
90
90
  :::
@@ -195,22 +195,28 @@ export default defineConfig({
195
195
  ## Effect 版本组
196
196
 
197
197
  UltraModern 生成的 workspace 会通过 `pnpm-workspace.yaml` overrides 锁定与框架兼容的
198
- Effect 版本组。`3.5.0-ultramodern.3` 使用:
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
+
201
205
  trustPolicyExclude:
202
- - '@effect/opentelemetry@4.0.0-beta.91'
206
+ - 'effect@4.0.0-beta.92'
207
+ - '@effect/opentelemetry@4.0.0-beta.92'
203
208
 
204
209
  overrides:
205
- '@effect/vitest': 4.0.0-beta.91
206
- effect: 4.0.0-beta.91
210
+ '@effect/opentelemetry': 4.0.0-beta.92
211
+ '@effect/vitest': 4.0.0-beta.92
212
+ effect: 4.0.0-beta.92
207
213
  ```
208
214
 
209
215
  不要在应用包里添加不同版本的直接 `effect` 依赖。Effect beta 不一致时,Layer 或 HTTP
210
- middleware 构建可能因为运行时 service 来自不同包实例而失败。保留生成的
211
- `trustPolicyExclude` 条目并让它跟随同一个 Effect 版本组;它用于处理
212
- `@effect/opentelemetry` 从 trusted-publisher metadata 迁移到 provenance attestation
213
- 时的 pnpm no-downgrade 检查。
216
+ middleware 构建可能因为运行时 service 来自不同包实例而失败。保留生成的 policy
217
+ exclusion 条目并让它跟随同一个 Effect 版本组;它用于处理框架选定 Effect beta 版本在
218
+ 24 小时成熟期内的安装,以及 `effect` 和 `@effect/opentelemetry` 从 trusted-publisher
219
+ metadata 迁移到 provenance attestation 时的 pnpm no-downgrade 检查。
214
220
 
215
221
  ## 契约测试
216
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
@@ -4,7 +4,7 @@ sidebar_position: 2
4
4
 
5
5
  # 路由基础
6
6
 
7
- Modern.js 的约定式路由支持基于 [React Router 7](https://reactrouter.com/en/main) 和 [TanStack Router](https://tanstack.com/router) 两套框架,提供基于文件约定的路由能力,并支持业界流行的约定式路由模式:**嵌套路由**。当入口被识别为 [约定式路由](/guides/concept/entries.html#约定式路由) 时,Modern.js 会自动基于文件系统,生成对应的路由结构。
7
+ Modern.js 的约定式路由支持基于 [React Router](https://reactrouter.com/en/main) 和 [TanStack Router](https://tanstack.com/router) 两套框架,提供基于文件约定的路由能力,并支持业界流行的约定式路由模式:**嵌套路由**。当入口被识别为 [约定式路由](/guides/concept/entries.html#约定式路由) 时,Modern.js 会自动基于文件系统,生成对应的路由结构。
8
8
 
9
9
  :::note
10
10
 
@@ -91,7 +91,7 @@ export default () => {
91
91
 
92
92
  :::note
93
93
 
94
- `<Outlet>` 是 React Router v7 中提供的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet)。
94
+ `<Outlet>` 是 React Router 提供的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet)。
95
95
 
96
96
  :::
97
97
 
@@ -156,7 +156,7 @@ src/
156
156
  │ └── App.tsx
157
157
  ```
158
158
 
159
- 以 `src/App.tsx` 为约定的入口,Modern.js 不会对路由做额外的操作,开发者可以使用 [React Router v7](https://reactrouter.com/en/main) 的 API 设置客户端路由,或不设置客户端路由。例如以下代码,在应用中自行设置了客户端路由:
159
+ 以 `src/App.tsx` 为约定的入口,Modern.js 不会对路由做额外的操作,开发者可以使用 [React Router](https://reactrouter.com/en/main) 的 API 设置客户端路由,或不设置客户端路由。例如以下代码,在应用中自行设置了客户端路由:
160
160
 
161
161
  ```tsx title="src/App.tsx"
162
162
  import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
@@ -19,7 +19,7 @@ Modern.js 底层的 Rsbuild 支持构建 Vue 应用,如果你需要使用 Vue
19
19
  Modern.js 提供两套一方路由方案:
20
20
 
21
21
  - 默认使用 [TanStack Router](https://tanstack.com/router),通过 `@modern-js/plugin-tanstack/runtime` 导出 API。
22
- - 兼容 [React Router 7](https://reactrouter.com/en/main),通过 `@modern-js/runtime/router` 导出 API。
22
+ - 兼容 [React Router](https://reactrouter.com/en/main),通过 `@modern-js/runtime/router` 导出 API。
23
23
 
24
24
  创建 UltraModern 项目时,默认会包含 TanStack Router:
25
25
 
@@ -71,18 +71,52 @@ mise exec -- pnpm check
71
71
  mise exec -- pnpm build
72
72
  ```
73
73
 
74
- 严格生成 API 迁移要求 `3.5.0-ultramodern.3` 或更新版本。
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.3` 或更新版本。
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.3 ultramodern \
85
- migrate-strict-effect --version 3.5.0-ultramodern.3
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
  ```
@@ -94,11 +128,12 @@ pnpm overrides/trust policy 和 pnpm lockfile。剩余失败就是源码迁移
94
128
  `api/lambda`、`shared/effect` 和 `src/effect`。
95
129
 
96
130
  严格 Effect 生成 workspace 会通过 pnpm overrides 固定兼容版本组:
97
- `effect@4.0.0-beta.91` 和 `@effect/vitest@4.0.0-beta.91`。不要添加与这些
98
- overrides 冲突的 app 本地直接 Effect 版本。生成的 pnpm policy 还会为
99
- `@effect/opentelemetry@4.0.0-beta.91` 添加 trust-policy exclusion,避免 Effect beta
100
- 版本组从 trusted-publisher metadata 迁移到 provenance attestation 时被 pnpm
101
- no-downgrade 检查误拦截。
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 检查误拦截。
102
137
 
103
138
  渐进迁移意味着尚未迁移的旧 Modern.js app 可以保留现有 runtime,直到被转换为
104
139
  UltraModern。一个 surface 一旦生成为或迁移为 UltraModern HTTP API,就只能使用
@@ -161,8 +196,9 @@ Federation 冲突,都应在对应归属文件中修复,不要手写补丁覆
161
196
 
162
197
  Cloudflare D1 绑定使用一等配置 `deploy.worker.d1Databases`;生成 app 拥有 D1
163
198
  migration 时不要再用 app 本地 postprocess。Cloudflare public output 默认排除服务端
164
- `api` 和 `shared` 目录,并且生成的 Modern/Rspack cache 会按 app 与构建目标隔离,避免
165
- 本地 `build` `cloudflare:build` 共享同一个 Rspack cache 目录。
199
+ `api` 和 `shared` 目录,并且生成的 Modern/Rspack 输出根目录、temp 目录和 cache
200
+ 会按 app、构建目标和 Rspack environment 隔离,避免本地 `build`、`cloudflare:build`
201
+ 以及多 environment compiler 共享可变构建状态。
166
202
 
167
203
  ## 人类工作流
168
204
 
@@ -320,7 +356,7 @@ Zephyr 证据:
320
356
  ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
321
357
  ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
322
358
  ULTRAMODERN_PUBLIC_URL_PAYMENTS=https://payments.example.workers.dev \
323
- mise exec -- pnpm cloudflare:proof -- --require-public-urls
359
+ mise exec -- pnpm cloudflare:proof --require-public-urls
324
360
  ```
325
361
 
326
362
  Live Cloudflare 与 Zephyr 证明需要公开 Worker URL 和 Zephyr 凭据。没有这些凭据时,
@@ -4,7 +4,7 @@ title: 路由鉴权
4
4
 
5
5
  # 路由鉴权
6
6
 
7
- Modern.js 默认提供的路由方式是基于 React Router v7 的约定式路由,具体可查看[路由方案](/guides/basic-features/routes/routes#路由方案)。
7
+ Modern.js 默认提供的路由方式是基于 React Router 的约定式路由,具体可查看[路由方案](/guides/basic-features/routes/routes#路由方案)。
8
8
 
9
9
  在一个 Web 应用中如果存在多个路由,我们可能需要对部分路由进行鉴权后才能访问。例如下面这个案例:
10
10
 
package/package.json CHANGED
@@ -19,14 +19,14 @@
19
19
  "modern.js",
20
20
  "ultramodern.js"
21
21
  ],
22
- "version": "3.5.0-ultramodern.3",
22
+ "version": "3.5.0-ultramodern.31",
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.3"
29
+ "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.5.0-ultramodern.31"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@rsbuild/plugin-sass": "2.0.0",