宣布 Babel 8 测试版
自从第一次 Babel 8 alpha 版本发布(8.0.0-alpha.0)几乎两年后,我们终于准备好了。
🌐 After almost two years since the first Babel 8 alpha release (8.0.0-alpha.0), we are finally ready.
我们计划在 Babel 8 中包含的所有重大更改都已经完成,而且我们也清理了多年来积累的许多技术债务,这些债务在 Babel 7 的生命周期内无法移除。
🌐 All the breaking changes we were planning to include in Babel 8 are done, and we have removed a lot of the technical debt we've accumulated over the years and were unable to remove during Babel 7's lifetime.
我们现在需要在真实项目中测试它,以确保我们没出错。我们从早期 alpha 版本开始就已经用 Babel 8 转译自己的代码了,但只有一个预发布用户还不够。😉
🌐 We now need to test it in real projects to make sure we got everything right. We have been transpiling our own code using Babel 8 since early alpha versions, but one prerelease user is not enough. 😉
Babel 8 测试版:亮点
🌐 Babel 8 Beta: highlights
那么,Babel 8 即将带来哪些主要变化呢?我们有一个真正精彩的变化清单,不过遗憾的是这个博客的边距太窄,放不下它们。
我们引入重大变更的一个指导原则是,升级到 Babel 8 应该很简单:其中大部分在 Babel 7 中已经以可选项的形式引入了,所以你可以在正式升级前开始调整你的代码。
🌐 A guiding principle for the breaking changes we've introduced is that updating to Babel 8 should be easy: most of them have been already introduced in Babel 7 behind an option, so that you can start adapting your code before actually performing the update.
我们准备了一些很棒的资源,帮你了解从 Babel 7 升级到 Babel 8 所需的步骤:
🌐 We've prepared some great resources to navigate through what's needed to upgrade from Babel 7 to Babel 8:
- 一个 Babel 用户迁移指南;
- 一个面向使用 Babel API 的开发者的迁移指南,比如 Babel 插件作者或直接使用我们 AST 的用户;
- Babel 8 文档的网站,目前托管在 https://next.babeljs.io/,直到 Babel 8 稳定为止。
有很多重大变化,希望不会影响我们的用户,但我们对此非常兴奋:一个例子是 Babel 8 将作为 ESM 专用包发布。我们已经尝试了很长时间去弄清楚如何实现这一点,最终随着 Node.js 20 中 require(esm) 的支持,我们对不提供 CommonJS 版本感到放心。
🌐 There are many breaking changes that hopefully will not impact our users, but of which we are incredibly excited about: an example is that Babel 8 will ship as an ESM-only package. We've been trying to figure out how to make this work for very long time, and finally with the require(esm) support shipped in Node.js 20 we are comfortable with not providing a CommonJS alternative.
你也可以在 GitHub 上阅读每个 Babel 8 Alpha 版本的完整更新日志。
🌐 You can also read the full changelog of each Babel 8 Alpha release on GitHub.
接下来做什么?
🌐 What's next?
显然,测试版发布并不是终点,而是道路上的一个里程碑。在发布 Babel 8 稳定版(或候选发布版)之前,我们计划:
🌐 A beta release is obviously not a finish line, but a milestone along the path. Before releasing Babel 8 stable (or a release candidate), we're planning to:
- 与集成 Babel 的主要项目合作,确保他们的用户可以轻松升级到 Babel 8
- 把我们的 Babel 8 代码和 Babel 7 代码分开。它们现在在同一个分支里,每个版本特有的代码都是通过编译时的功能标志来控制的,但还是有一些任务无法用这种方式完成
显然……修复我们引入的漏洞!如果可以的话,请测试 Babel 8 测试版,并通过报告 GitHub 问题 给我们反馈。
🌐 And obviously... fix the bugs we introduced! If you can, please test Babel 8 beta, and give us feedback by reporting bugs as GitHub issues.