Skip to content

Releases: web-infra-dev/modern.js

v3.9.0

Choose a tag to compare

@caohuilin caohuilin released this 03 Sep 02:25

What's Changed

Bug Fixes 🐞

  • fix(app-tools): fix BFF ts-node-loader compatibility with ESM in #8692

Other Changes ✨

  • chore: prepare the 3.9.0 minor release. in #8840
  • Remove the server plugin fallback hook. SSR-to-CSR fallback events are now reported directly through request monitors as a warning and an ssr-fallback counter. in #8836

更新内容

Bug 修复 🐞

  • fix(plugin-runtime): fix document CLI compatibility with ESM lib format
    fix(app-tools): 修复 BFF ts-node-loader 在 ESM 构建格式下的兼容性问题
    fix(plugin-runtime): 修复 document CLI 在 ESM 构建格式下的兼容性问题, 详情可查看 #8692

v3.8.3

Choose a tag to compare

@caohuilin caohuilin released this 28 Aug 03:24

What's Changed

Bug Fixes 🐞

  • fix: stop writing the ESM loader files twice in #8819
  • fix: upgrade @rsbuild/plugin-styled-components to v1.7.0 for Rsbuild 2.2 compatibility in #8821

Other Changes ✨

  • chore: upgrade Rsbuild to v2.2.0-rc.0 and the SWC plugin to the latest version in #8818
  • chore: upgrade Rsbuild dependencies to the latest versions in #8814

Rsbuild Update 📦

  • Upgrade @rsbuild/core from v2.1.0 to v2.2.0-rc.0. See v2.2.0-rc.0 for details.

更新内容

Bug 修复 🐞

  • fix: 修复 ESM loader 文件被重复写入的问题, 详情可查看 #8819
  • fix: 将 @rsbuild/plugin-styled-components 升级至 v1.7.0,以兼容 Rsbuild 2.2, 详情可查看 #8821

其他变更 ✨

  • chore: 升级 Rsbuild 至 v2.2.0-rc.0,并将 SWC 插件升级至最新版本, 详情可查看 #8818
  • chore: 升级 Rsbuild 相关依赖至最新版本, 详情可查看 #8814

Rsbuild 更新 📦

  • 升级 @rsbuild/core 从 v2.1.0 到 v2.2.0-rc.0,查看 v2.2.0-rc.0 了解详情。

v3.8.2

Choose a tag to compare

@caohuilin caohuilin released this 13 Aug 07:03

What's Changed

Bug Fixes 🐞

  • fix: make published crossProject BFF client declarations resolvable in consumers in #8797

更新内容

Bug 修复 🐞

  • fix: 修复发布后的 crossProject BFF 客户端声明在消费方项目中无法解析类型的问题, 详情可查看 #8797

v3.8.1

Choose a tag to compare

@caohuilin caohuilin released this 07 Aug 07:56

What's Changed

Other Changes ✨

  • chore(app-tools): bump the package version for release in #8798

更新内容

其他变更 ✨

  • chore(app-tools): 更新包版本以发布新版本, 详情可查看 #8798

v3.8.0

Choose a tag to compare

@caohuilin caohuilin released this 06 Aug 06:15

What's Changed

New Features 🎉

  • feat: bundle version-matched docs into @modern-js/app-tools and generate AGENTS.md / CLAUDE.md pointing at them, so AI coding agents read docs matching the installed version in #8781
  • feat: agent knowledge supply — bundle version-matched English docs into the app-tools tarball (docs/) on publish, and generate AGENTS.md / CLAUDE.md in new projects created by @modern-js/create (skip with --no-agents-md). Existing projects can run npx @modern-js/create --agents-md-only to add or idempotently refresh these files after an upgrade (managed marker block is updated in place, user content is preserved). Also fixes boolean flags swallowing the following positional argument (e.g. create --sub my-app). in #8781
  • feat: support configuring the Mock directory through dev.mockDir in #8780

Bug Fixes 🐞

  • fix: guard language detector process access for edge runtimes in #8751
  • fix: type render route misses explicitly in #8754
  • fix(server-core): share the hono request context storage across duplicated module copies via a process-global AsyncLocalStorage, so BFF handlers no longer fail with "Can't call useContext out of server scope" when the host and plugin resolve different server-core instances in #8776
  • fix: make custom server output runnable under native ESM (pass moduleType, resolve .tsx / .jsx entries, transform JSX) in #8784
  • fix: respect output.module for service-worker environment output in #8752

Other Changes ✨

  • Export the programmatic deploy API and make it own the build, server plugin in #8783
  • Export closeServer from the package root. Programmatic dev and start in #8783
  • Export the programmatic build API and its options from the package root, initialize the builder when build is supplied through the app-context command, and close completed non-watch builds before returning. The onPrepare dist cleanup now also recognizes the programmatic appContext.command, so programmatic dev/build clean stale output the same way the CLI does (still honoring output.cleanDistPath and running before nestedRoutes.json is generated). in #8783

更新内容

新特性 🎉

  • feat: 随包分发与安装版本一致的文档,并生成指向它的 AGENTS.md / CLAUDE.md,让 AI 编码助手读到与所装版本匹配的文档, 详情可查看 #8781
  • feat: Agent 知识供给 —— 发布时将版本匹配的英文文档打进 app-tools tarball(docs/),并在 @modern-js/create 新建项目时默认生成 AGENTS.md / CLAUDE.md--no-agents-md 可跳过)。已有项目可运行 npx @modern-js/create --agents-md-only 在升级后补齐或幂等更新这两个文件(就地更新托管标记块,保留用户自定义内容)。同时修复布尔参数吞掉后续位置参数的问题(如 create --sub my-app)。, 详情可查看 #8781
  • feat: 支持通过 dev.mockDir 配置 Mock 目录, 详情可查看 #8780

Bug 修复 🐞

  • fix: 修复语言检测器在 Edge 运行时访问 process 的问题, 详情可查看 #8751
  • fix: 明确渲染路由未命中的类型, 详情可查看 #8754
  • fix(server-core): 通过进程级 AsyncLocalStorage 让 hono 请求上下文在重复加载的模块副本间共享,宿主与插件解析到不同 server-core 实例时 BFF 不再报 "Can't call useContext out of server scope", 详情可查看 #8776
  • fix: 修复自定义 Server 在原生 ESM 下的产物不可运行问题(透传 moduleType、支持 .tsx / .jsx 入口解析、编译 JSX), 详情可查看 #8784
  • fix: 在 service-worker 环境中遵循 output.module 输出配置, 详情可查看 #8752

其他变更 ✨

  • loading, and deploy hook lifecycle., 详情可查看 #8783
  • initialization now uses the app-context command when no CLI build command is
    present, including occupied port selection., 详情可查看 #8783
  • 从包根导出程序化 build API 及其选项,在通过 app-context command 传入 build 时初始化 builder,并在返回前关闭已完成的非 watch 构建。onPrepare 的 dist 清理现在也识别程序化的 appContext.command,使程序化 dev/build 与 CLI 一样清理陈旧产物(仍遵循 output.cleanDistPath,并在生成 nestedRoutes.json 之前执行)。, 详情可查看 #8783

v3.7.0

Choose a tag to compare

@caohuilin caohuilin released this 16 Jul 03:34

What's Changed

New Features 🎉

  • feat(builder): add source.reactCompiler to enable React Compiler via Rspack's built-in SWC implementation in #8763

Bug Fixes 🐞

  • fix(runtime): exclude the SSR hydration runtime from CSR bundles in #8762
  • fix(runtime): exclude the RSC client runtime from web bundles when server.rsc is disabled in #8762

更新内容

新特性 🎉

  • feat(builder): 新增 source.reactCompiler 配置,基于 Rspack 内置 SWC 的 Rust 版 React Compiler 提供一键开启能力, 详情可查看 #8763

v3.6.0

Choose a tag to compare

@caohuilin caohuilin released this 09 Jul 10:36

What's Changed

New Features 🎉

  • feat(server): unified dev-server runtime hot reload, replacing the BFF-local hot update in #8720

Bug Fixes 🐞

  • fix: prevent path traversal in static asset middleware in #8749

Other Changes ✨

  • refactor: drop React 17 support and import react-dom/client statically in the browser runtime in #8750

更新内容

新特性 🎉

  • feat(server): 统一 dev-server 运行时热更新,替换 BFF 本地热更, 详情可查看 #8720

Bug 修复 🐞

  • fix: 修复静态资源中间件的路径穿越问题, 详情可查看 #8749

其他变更 ✨

  • refactor: 浏览器运行时移除 React 17 支持,并改为静态引入 react-dom/client, 详情可查看 #8750

v2.71.1

Choose a tag to compare

@caohuilin caohuilin released this 06 Jul 06:53

What's Changed

Bug Fixes 🐞

  • fix(runtime): string-mode SSR no longer drops a route's stylesheet when the same CSS is referenced by a non-stylesheet <link> (e.g. <link rel="prefetch">) by @deepcoldy in #8689
  • fix(runtime): streaming SSR no longer skips route stylesheets when the same CSS URL already appears as a non-stylesheet <link> such as rel="prefetch" by @yimingjfe in #8695

更新内容

Bug 修复 🐞

  • LoadableCollector.emitStyleAssets (string SSR) deduped injected route stylesheets against every <link href> in the template, so a <link rel="prefetch"> for the same css URL (e.g. from performance.prefetch) made the real <link rel="stylesheet"> be skipped and the route rendered unstyled. It now reuses the shared hasStylesheetLink helper (also used by streaming SSR), which only matches existing <link rel="stylesheet"> tags. 由 @deepcoldy 实现, 详情可查看 #8689
  • fix(runtime): 流式 SSR 不再因为同一 CSS URL 已作为 rel="prefetch" 等非 stylesheet <link> 出现在模板中而跳过路由样式注入 由 @yimingjfe 实现, 详情可查看 #8695

v3.5.0

Choose a tag to compare

@caohuilin caohuilin released this 26 Jun 10:45

What's Changed

New Features 🎉

  • feat(app-tools): add modifyBuilderEnvironments hook to transform the builder environments map before the builder is created in #8717
  • feat(builder): upgrade rsbuild version to 2.1.0 in #8721

Bug Fixes 🐞

  • fix(runtime): use the final HTML template parameters when rendering custom Document in #8715

Other Changes ✨

  • chore(ai-infra): repo-level AI coding agents infrastructure (AGENTS.md / CLAUDE.md, skills docs, AI Coding Agents guide). in #8651
  • chore(builder): upgrade @rsbuild/plugin-type-check to 1.5.0 in #8725

Rsbuild Update 📦

  • Upgrade @rsbuild/core from v2.0.10 to v2.1.0. See v2.1.0 for details.

更新内容

新特性 🎉

  • A new additive app-tools hook modifyBuilderEnvironments runs in generateBuilder after the framework's static environment merge and before createBuilder. It mirrors modifyEntrypoints as a transform-object async hook: each tapped callback receives { environments } and may return a replacement map that chains to the next callback; tapping nothing leaves the environments byte-identical, so the change is fully backward compatible. This lets frameworks programmatically add environments (e.g. a custom browser worker environment), set per-environment output/distPath/ordering, or otherwise adjust the resolved environments map instead of being limited to a config-static merge.
    feat(app-tools): 新增 modifyBuilderEnvironments hook,可在创建 builder 前变换 builder 环境表
    新增的 app-tools hook modifyBuilderEnvironmentsgenerateBuilder 中、框架静态环境合并之后、createBuilder 之前执行。它与 modifyEntrypoints 一致,是 transform-object 异步 hook:每个回调收到 { environments },可返回替换后的环境表并链式传给下一个回调;不挂载任何回调时环境表字节不变,完全向后兼容。框架可借此以编程方式新增环境(如自定义浏览器 worker 环境)、设置 per-environment 的 output/distPath/顺序,或调整已解析的环境表,而不再局限于静态配置合并。, 详情可查看 #8717
  • feat(builder): 更新 Rsbuild 版本到 2.1.0, 详情可查看 #8721

Bug 修复 🐞

  • fix(runtime): 渲染自定义 Document 时使用最终的 HTML 模板参数, 详情可查看 #8715

其他变更 ✨

  • No package release needed: this PR only adds repo-level files and docs content; it makes no change to any published package's runtime (@modern-js/create has zero net diff). Empty changeset added to satisfy the changeset bot without triggering a version bump., 详情可查看 #8651
  • chore(builder): 升级 @rsbuild/plugin-type-check 到 1.5.0, 详情可查看 #8725

Rsbuild 更新 📦

  • 升级 @rsbuild/core 从 v2.0.10 到 v2.1.0,查看 v2.1.0 了解详情。

v3.4.0

Choose a tag to compare

@caohuilin caohuilin released this 18 Jun 09:18
9827555

What's Changed

New Features 🎉

  • feat(server-core): pass request and monitors context to server plugin fallback hooks in #8678
  • feat(builder): support customizing RSC server/client environment names via server.rsc.environments in #8691

Bug Fixes 🐞

  • fix(plugin-i18n): keep browser backend locale paths independent from assetPrefix in #8679
  • fix(plugin-i18n): align SSR backend with detected public locales directory in #8679
  • fix(runtime): string-mode SSR no longer drops a route's stylesheet when the same CSS is referenced by a non-stylesheet <link> (e.g. <link rel="prefetch">) in #8699
  • fix(runtime,app-tools): inject CSS of React.lazy descendants into streaming SSR shell to prevent FOUC; slim inline route manifest to only chunkIds when RSC is disabled in #8677
  • fix(runtime): split streaming SSR chunk at SHELL_STREAM_END_MARK so suspense boundary content is not swallowed before shellAfter in #8676

更新内容

新特性 🎉

  • feat(server-core): 为 server 插件 fallback hook 传递 request 和 monitors 上下文, 详情可查看 #8678
  • server.rsc now accepts an object form { environments?: { server?: string; client?: string } } in addition to a boolean. This forwards the existing environments option of rsbuild-plugin-rsc, letting frameworks that declare their own Rsbuild environments map RSC onto them instead of having the plugin create new empty server/client environments (which otherwise fall back to the default ./src entry and fail to resolve in non-convention setups). Passing true/false keeps the previous default behavior, so the change is fully backward compatible.
    feat(builder): 支持通过 server.rsc.environments 自定义 RSC server/client 环境名
    server.rsc 在原有 boolean 之外新增对象形式 { environments?: { server?: string; client?: string } },透传 rsbuild-plugin-rsc 已有的 environments 选项,使已声明自有 Rsbuild 环境的框架可将 RSC 映射到这些环境,而不必让插件新建空的 server/client 环境(否则会回落到默认入口 ./src 而无法解析)。传 true/false 时行为不变,完全向后兼容。, 详情可查看 #8691

Bug 修复 🐞

  • fix(plugin-i18n): 浏览器端 backend 加载本地语言资源时不再拼接 assetPrefix, 详情可查看 #8679
  • fix(plugin-i18n): SSR backend 跟随检测到的 public locales 目录,避免与根 locales 目录读取不一致, 详情可查看 #8679
  • LoadableCollector.emitStyleAssets (string SSR) deduped injected route stylesheets against every <link href> in the template, so a <link rel="prefetch"> for the same css URL (e.g. from performance.prefetch) made the real <link rel="stylesheet"> be skipped and the route rendered unstyled. It now reuses the shared hasStylesheetLink helper (also used by streaming SSR), which only matches existing <link rel="stylesheet"> tags., 详情可查看 #8699
  • fix(runtime,app-tools): 流式 SSR 注入 React.lazy 子 chunk 的 CSS 到首屏 shell, 避免懒加载组件出现样式闪烁; 非 RSC 场景下 inline 路由 manifest 仅保留 chunkIds, 减少 HTML 体积, 详情可查看 #8677
  • fix(runtime): 流式 SSR 在 SHELL_STREAM_END_MARK 位置切分 chunk,避免 suspense 兑现内容被夹在 shellAfter 之前, 详情可查看 #8676