文章摘要
Node.js 26.0.0正式发布,主要更新包括默认启用Temporal日期时间API、V8引擎升级至14.6版本、Undici更新到8.0,同时进行了多项功能弃用和移除。该版本将在10月进入长期支持阶段,建议开发者评估新特性对应用的影响。Temporal API提供了比传统Date对象更强大的日期时间处理能力。
文章总结
以下是Node.js 26.0.0(Current版本)发布公告的中文整理:
Node.js 26.0.0(Current版本)发布
我们很高兴宣布Node.js 26的发布!本次更新的亮点包括:
- Temporal API默认启用:全新的现代日期/时间API,替代传统的Date对象
- V8引擎升级至14.6:包含Iterator sequencing等新特性
- Undici升级至8.0.2:HTTP客户端实现的重要更新
- 多项废弃和移除:包括http.writeHeader()和_stream_*等模块
该版本将在2026年10月进入长期支持(LTS)阶段,在此之前将作为"Current"版本提供6个月。建议开发者评估新特性对应用的影响。
主要变更
Temporal API
由Richard Lau贡献,提供更强大的日期时间处理能力(PR #61806)V8 14.6更新
- 新增
[Weak]Map.prototype.getOrInsert()方法 - 实现Iterator sequencing提案(PR #61898)
- 新增
废弃和移除项
- 完全移除
http.Server.prototype.writeHeader()(改用writeHead) - 移除遗留的
_stream_*模块 - 废弃
module.register()等API
- 完全移除
兼容性说明
- 最低GCC要求提升至13.2
- 不再支持Python 3.9
- Windows SDK最低要求11版本
下载资源
提供Windows/macOS/Linux等多平台安装包和源码:
- Windows 64位安装包
- macOS安装包
- 源码包
完整变更列表和校验值请参阅官方发布页。
(注:保留了核心功能更新和兼容性变更,精简了重复的提交记录和技术细节,突出了对开发者有直接影响的内容)
评论总结
以下是评论内容的总结:
- 对Temporal API的期待
- 认为日期时间处理应该原生支持,替代Moment和Luxon "I'm really looking forward to the temporal api being universally available" "sensible date/time handling ought to be baked into the platform"
- 对Node.js文档和功能的建议
- 建议增加Rust扩展文档 "expect having a section on nodejs docs about Rust addons"
- 建议添加WebSocket服务器支持 "node refuses to add websocket server support...would simplify stuff tremendously"
- 与其他技术的比较
- 认为Bun比Node.js功能更多性能更好 "bun have lot of features and is more performant than Node"
- 推荐VitePlus工具 "check out VitePlus...fan of VoidZero's consistently excellent tools"
- 对SQLite和TypeScript的关注
- 期待SQLite稳定版本 "where the built in sqlite got its experimental tag removed...one less dependency"
- 注意到TypeScript转换被移除 "release that drops typescript transforms...took me a while to find out"
- 其他技术讨论
- 指出Safari不支持Temporal API "Safari seems to be the only browser that doesn't support Temporal"
- 讨论upsert的不同定义 "Their usage of upsert appears different than I was used to"
- 幽默评论
- 玩笑称Node.js包含恶意软件 "(Now with Malware) I joke! It already had malware"
注:所有评论均无评分信息。总结保留了主要观点和代表性引用,平衡呈现了不同角度的讨论。