@bleedingdev/modern-js-main-doc 3.9.3-ultramodern.13 → 3.9.3-ultramodern.14

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.
@@ -91,6 +91,46 @@ source. SVG URLs remain supported. The
91
91
  defines the current preview profile and pinned dependencies. The federation,
92
92
  i18n and Cloudflare examples below describe the React profile.
93
93
 
94
+ ### Default React runtime: TanStack Redact
95
+
96
+ React applications use TanStack Redact on both the client and the server
97
+ (Node SSR and Cloudflare workerd SSR). It provides a lightweight React 19-compatible
98
+ runtime while keeping normal `react` / `react-dom` imports, JSX and types.
99
+ Upgrading the framework enables it without application edits:
100
+ `@modern-js/ultramodern-app-tools` supplies exact `@tanstack/redact` (the reviewed
101
+ `@bleedingdev/tanstack-redact@0.2.1` build) and `rsbuild-redact-plugin@0.1.0`
102
+ dependencies and resolves the runtime from its own installation. Do not install either package or register a Redact
103
+ plugin in the app. Keep the generated React and React DOM pins: they provide the
104
+ real React runtime for opt-out and RSC applications. RSC applications stay on
105
+ React on both server and client.
106
+
107
+ The top-level `redact` option is optional. Omit it for the default runtime, use
108
+ `false` for real React, or pass `{ viewTransitions: true }` to enable Redact's
109
+ experimental native View Transitions (off by default):
110
+
111
+ ```ts title="modern.config.ts"
112
+ import { defineConfig } from '@modern-js/ultramodern-app-tools';
113
+
114
+ export default defineConfig({
115
+ redact: false, // Or: { viewTransitions: true }
116
+ server: { ssr: { mode: 'stream' } },
117
+ });
118
+ ```
119
+
120
+ UltraModern requires its patched Redact 0.2.1 build. The patch fixes `useId`
121
+ identity across streamed Suspense and hydration, duplicate IDs on later client
122
+ mounts with `identifierPrefix`, streamed boundaries in table/SVG/MathML contexts,
123
+ and prefixed hexadecimal boundary/segment IDs and reveal ordering with deferred
124
+ scripts. An unpatched runtime fails the build rather than silently shipping.
125
+ The normal 24-hour third-party release-age gate still applies; neither package
126
+ has an age exemption.
127
+
128
+ Redact is experimental, not a guarantee of compatibility with every React
129
+ library. Libraries that depend on React internals may need `redact: false`.
130
+ Its stream implementation does not reproduce React's `progressiveChunkSize`
131
+ tuning or writable/Web Stream backpressure semantics; do not rely on identical
132
+ chunk sizes, buffering or scheduling.
133
+
94
134
  Localized Cloudflare SSR workspaces redirect `/` on the server to the negotiated locale. For example, `Accept-Language: cs-CZ` returns `302` with `Location: /cs`, `Cache-Control: private, no-store`, and `Vary` covering locale detection headers. Validate the deployed Worker with:
95
135
 
96
136
  ```bash
@@ -87,6 +87,40 @@ hydration 和框架管理的文件路由。使用 Node 26.7.0 或更新版本。
87
87
  列出当前预览配置及固定依赖版本。下文的 federation、i18n 和 Cloudflare 示例
88
88
  适用于 React 配置。
89
89
 
90
+ ### 默认 React 运行时:TanStack Redact
91
+
92
+ React 应用默认在客户端与服务端(Node SSR 和 Cloudflare workerd SSR)使用
93
+ TanStack Redact。它提供轻量的 React 19 兼容运行时,保留常规的 `react` /
94
+ `react-dom` 导入、JSX 和类型。升级框架即可启用,无需修改应用:
95
+ `@modern-js/ultramodern-app-tools` 自带精确依赖 `@tanstack/redact`(已审查的 `@bleedingdev/tanstack-redact@0.2.1`)
96
+ 和 `rsbuild-redact-plugin@0.1.0`,并从框架自身的安装位置解析运行时。
97
+ 不要在应用中安装这两个包或注册 Redact 插件。保留生成的 React 和 React DOM
98
+ 版本锁定,它们为显式退出和 RSC 应用提供真正的 React 运行时。
99
+ RSC 应用的服务端与客户端都继续使用 React。
100
+
101
+ 顶层 `redact` 选项可省略:省略时使用默认运行时,设为 `false` 时使用真正的
102
+ React,传入 `{ viewTransitions: true }` 时启用 Redact 实验性的原生
103
+ View Transitions(默认关闭):
104
+
105
+ ```ts title="modern.config.ts"
106
+ import { defineConfig } from '@modern-js/ultramodern-app-tools';
107
+
108
+ export default defineConfig({
109
+ redact: false, // 或:{ viewTransitions: true }
110
+ server: { ssr: { mode: 'stream' } },
111
+ });
112
+ ```
113
+
114
+ UltraModern 要求使用带补丁的 Redact 0.2.1。补丁修复了流式 Suspense 与 hydration
115
+ 之间的 `useId` 不一致、指定 `identifierPrefix` 后客户端后续挂载产生重复 ID、
116
+ 表格/SVG/MathML 上下文中的流式边界,以及带前缀的十六进制边界/片段 ID 与延迟
117
+ 脚本的揭示顺序。不带补丁的运行时会导致构建失败,不会静默发布。
118
+ 常规的第三方依赖 24 小时发布年龄限制仍然生效,这两个包都没有豁免。
119
+
120
+ Redact 仍处于实验阶段,并不保证兼容所有 React 库。依赖 React 内部实现的库可能
121
+ 需要设置 `redact: false`。它的流实现不复现 React 的 `progressiveChunkSize`
122
+ 调优或 Writable/Web Stream 背压语义;不要依赖相同的分块大小、缓冲或调度行为。
123
+
90
124
  本地化 Cloudflare SSR workspace 在服务端将 `/` 重定向到协商的语言路径。
91
125
  `Accept-Language: cs-CZ` 返回 `302`、`Location: /cs`、
92
126
  `Cache-Control: private, no-store`,以及覆盖语言检测 Header 的 `Vary`。
package/package.json CHANGED
@@ -19,13 +19,13 @@
19
19
  "modern.js",
20
20
  "ultramodern.js"
21
21
  ],
22
- "version": "3.9.3-ultramodern.13",
22
+ "version": "3.9.3-ultramodern.14",
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.9.3-ultramodern.13",
28
- "@modern-js/ultramodern-sandpack-profile": "npm:@bleedingdev/modern-js-ultramodern-sandpack-profile@3.9.3-ultramodern.13",
27
+ "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.9.3-ultramodern.14",
28
+ "@modern-js/ultramodern-sandpack-profile": "npm:@bleedingdev/modern-js-ultramodern-sandpack-profile@3.9.3-ultramodern.14",
29
29
  "mermaid": "^12.2.0"
30
30
  },
31
31
  "devDependencies": {