Skip to content

v3.10.2

Choose a tag to compare

@caohuilin caohuilin released this 22 Oct 00:14

What's Changed

Performance Improvements ⚡

  • perf: skip body parsing for GET and HEAD BFF requests and reuse per-route param names by @deepcoldy in #9004
  • perf: skip importing html-minifier-terser when HTML minification is disabled, such as in development by @deepcoldy in #9005
  • perf: reuse the static handler of data loader requests and match the entry without sorting the server routes on every request by @deepcoldy in #9011
  • perf: load ndepe lazily in deploy presets so CLI startup no longer pays for it on every command by @deepcoldy in #9003
  • perf: calculate the size of Buffer and string values in the memory cache without JSON.stringify, binary files are now counted by their real size, so the default 256 MB cache can hold up to 256 MB of them instead of about 71 MB by @deepcoldy in #9013
  • perf: skip parsing nested route data files that cannot export action when generating routes by @deepcoldy in #9008
  • perf: collect public folder routes in linear time without a stat call per file by @deepcoldy in #9007
  • perf: write Node.js response bodies with a stream reader loop instead of pipeTo(Writable.toWeb(res)), sendResponse now resolves once res.end() is called by @deepcoldy in #9014
  • perf: trim per-request work in the render path and set Server-Timing with a single header update by @deepcoldy in #9015
  • perf: cache the inlined css and js assets read during SSR instead of reading them on every request by @deepcoldy in #9010
  • perf: create the public middleware once without sorting the shared routes on every request, and stat static files only once per request by @deepcoldy in #9006
  • perf: search only newly streamed text for the shell end marker in streaming SSR instead of re-decoding and re-scanning the whole buffered shell for every chunk by @deepcoldy in #9012
  • perf: skip HTML tokenizing of streaming SSR output when no deferred resolver script can be inserted, and skip the end tag search inside inline script and style text until a < shows up by @deepcoldy in #9016
  • perf: apply the template replacements before inserting the app html in string SSR by @deepcoldy in #9009

Bug Fixes 🐞

  • fix: preserve literal characters when registering page render routes with Hono by @GiveMe-A-Name in #8998
  • fix(app-tools): scope streaming HTML script rewriting to each entry so CSR and string SSR pages retain their script order and injection settings in mixed applications. by @byte-lyh in #9033

更新内容

性能优化 ⚡

  • perf: BFF 的 GET 和 HEAD 请求跳过请求体解析,并复用每个路由的参数名 由 @deepcoldy 实现, 详情可查看 #9004
  • perf: 在 HTML 压缩未启用时(例如开发模式)跳过加载 html-minifier-terser 由 @deepcoldy 实现, 详情可查看 #9005
  • perf: 数据加载请求复用 static handler,并且匹配入口时不再在每次请求时排序服务端路由 由 @deepcoldy 实现, 详情可查看 #9011
  • perf: 部署预设中按需加载 ndepe,避免每个 CLI 命令启动时都加载它 由 @deepcoldy 实现, 详情可查看 #9003
  • perf: 内存缓存计算 Buffer 和字符串大小时不再使用 JSON.stringify 序列化,二进制文件按真实大小计算,默认 256 MB 缓存可以存放约 256 MB 的文件,而不是原来的约 71 MB 由 @deepcoldy 实现, 详情可查看 #9013
  • perf: 生成路由时跳过不可能导出 action 的 data 文件的解析 由 @deepcoldy 实现, 详情可查看 #9008
  • perf: 以线性时间收集 public 目录路由,不再对每个文件调用 stat 由 @deepcoldy 实现, 详情可查看 #9007
  • perf: 使用流读取循环代替 pipeTo(Writable.toWeb(res)) 写入 Node.js 响应体,sendResponse 在调用 res.end() 后即完成 由 @deepcoldy 实现, 详情可查看 #9014
  • perf: 减少渲染链路中每个请求的额外开销,并一次性写入 Server-Timing 响应头 由 @deepcoldy 实现, 详情可查看 #9015
  • perf: SSR 内联 CSS 和 JS 资源时缓存文件内容,不再在每次请求时读取文件 由 @deepcoldy 实现, 详情可查看 #9010
  • perf: public 中间件只创建一次,不再在每次请求时排序共享的路由数组,静态文件每次请求只调用一次 stat 由 @deepcoldy 实现, 详情可查看 #9006
  • perf: 流式 SSR 查找 shell 结束标记时只搜索新到达的内容,不再为每个 chunk 重新解码并扫描整个已缓冲的 shell 由 @deepcoldy 实现, 详情可查看 #9012
  • perf: 流式 SSR 在不会插入任何 deferred resolver 脚本时跳过对输出的 HTML 逐字符解析,并且在内联 script 和 style 文本中遇到 < 之前不再进行结束标签匹配 由 @deepcoldy 实现, 详情可查看 #9016
  • perf: 字符串 SSR 在插入应用 HTML 之前完成模板替换,避免反复扫描和复制完整文档 由 @deepcoldy 实现, 详情可查看 #9009

Bug 修复 🐞

  • fix: 向 Hono 注册页面渲染路由时保留路径中的字面字符,修复 HTML 路径及渲染中间件匹配失败 由 @GiveMe-A-Name 实现, 详情可查看 #8998
  • fix(app-tools): 按入口处理流式 HTML 脚本改写,避免混用应用中的 CSR 和字符串 SSR 页面丢失脚本执行顺序或插入位置配置。 由 @byte-lyh 实现, 详情可查看 #9033