@bleedingdev/modern-js-main-doc 3.9.0-ultramodern.16 → 3.9.0-ultramodern.18

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.
@@ -11,6 +11,8 @@ Whether to enable [React Compiler](https://react.dev/learn/react-compiler). Reac
11
11
 
12
12
  Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's `builtin:swc-loader` (equivalent to setting SWC's `jsc.transform.reactCompiler`), reusing Rspack's built-in SWC transform chain without introducing Babel.
13
13
 
14
+ The compiler only runs for browser environments (`output.target: 'web'`). Server environments (`node`, the `web-worker` SSR worker and BFF code) render once per request and gain nothing from memoization, so they are never compiled.
15
+
14
16
  :::tip
15
17
  This option is disabled by default. It must be enabled explicitly for any React version, including React 19.
16
18
  :::
@@ -191,6 +191,7 @@ Adds additional logic when the server resets.
191
191
  - `'file-change'`: File change event
192
192
  - `event.payload`: When `type` is `'file-change'`, contains an array of file change information.
193
193
  - **Execution Phase:** When files change or repack is needed.
194
+ - **Repack Order:** On `'repack'` the dev server awaits the handlers in registration order before it purges the previous server bundle from the require cache. A rejecting handler skips the handlers after it. New requests wait until the handlers settle; requests already running keep the modules they loaded. A repack handler must not await a request to the dev server, because that request waits for the handler.
194
195
  - **Example:**
195
196
 
196
197
  ```typescript
@@ -11,6 +11,8 @@ title: reactCompiler
11
11
 
12
12
  Modern.js 基于 Rspack `builtin:swc-loader` 内置的 Rust 版 React Compiler 实现该能力(等价于设置 SWC 的 `jsc.transform.reactCompiler`),复用 Rspack 内置的 SWC 转换链,无需额外引入 Babel。
13
13
 
14
+ 该编译仅作用于浏览器环境(`output.target: 'web'`)。服务端环境(`node`、`web-worker` SSR Worker 以及 BFF 代码)每次请求只渲染一次,无法从自动记忆化中获益,因此不会被编译。
15
+
14
16
  :::tip
15
17
  该配置默认关闭,任何 React 版本下都需要显式开启,包括 React 19。
16
18
  :::
@@ -191,6 +191,7 @@ api.onPrepare(async () => {
191
191
  - `'file-change'`: 文件变化事件
192
192
  - `event.payload`: 当 `type` 为 `'file-change'` 时,包含文件变化信息数组。
193
193
  - **执行阶段:** 当文件发生变化或需要重新打包时。
194
+ - **重新打包顺序:** 对于 `'repack'`,开发服务器会按注册顺序等待处理函数完成,再从 require 缓存中清除上一代服务端产物。某个处理函数抛出错误时,其后的处理函数不再执行。新请求会等待处理函数完成;已在执行的请求继续使用已加载的模块。重新打包处理函数不能等待发往开发服务器的请求,因为该请求会等待处理函数完成。
194
195
  - **示例:**
195
196
 
196
197
  ```typescript
package/package.json CHANGED
@@ -19,13 +19,13 @@
19
19
  "modern.js",
20
20
  "ultramodern.js"
21
21
  ],
22
- "version": "3.9.0-ultramodern.16",
22
+ "version": "3.9.0-ultramodern.18",
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.0-ultramodern.16",
28
- "@modern-js/ultramodern-sandpack-profile": "npm:@bleedingdev/modern-js-ultramodern-sandpack-profile@3.9.0-ultramodern.16",
27
+ "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.9.0-ultramodern.18",
28
+ "@modern-js/ultramodern-sandpack-profile": "npm:@bleedingdev/modern-js-ultramodern-sandpack-profile@3.9.0-ultramodern.18",
29
29
  "mermaid": "^11.17.2"
30
30
  },
31
31
  "devDependencies": {