特性时间表我们在每个 Babel 版本中引入了哪些主要的新特性?此页面包含每个次要版本的非常简短的摘要,或者你可以阅读完整的更新日志 在 GitHub 上!此外,使用此时间线来跟踪其他一些重要的工作,例如 babel-polyfills 项目。
¥Which major new features did we introduce in each Babel version? This page includes a very short summary for each minor release, or you can read the full changelog on GitHub!
Additionally, use this timeline to track some other important efforts, such as the babel-polyfills project.
Babel 7.28.0博文
¥blog post
默认启用 明确的资源管理 提案。
¥Enable the explicit resource management proposal by default
支持 放弃绑定 第 2 阶段提案
¥Support for the discard binding Stage 2 proposal
Babel 7.26.0博文
¥blog post
默认启用 正则表达式修饰符 Stage 4 提案
¥Enable the regular expression modifiers Stage 4 proposal by default
默认启用对 导入属性 第 4 阶段提案的解析
¥Enable parsing of the import attributes Stage 4 proposal by default
Babel 7.25.0博文
¥blog post
默认启用 Stage 4 重复命名的捕获组 提案
¥Enable the Stage 4 duplicated named capturing groups proposal by default
Babel 7.24.0博文
¥blog post
支持 JSON 模块 Stage 3 提案
¥Support for the JSON modules Stage 3 proposal
Babel 7.23.0博文
¥blog post
支持 装饰器元数据 Stage 3 提案
¥Support for the Decorator Metadata Stage 3 proposal
支持 源阶段导入 Stage 3 提案
¥Support for the Source Phase Import Stage 3 proposal
支持 延迟导入评估 第 2 阶段提案
¥Support for the Deferred Import Evaluation Stage 2 proposal
支持 可选的链接分配 提案
¥Support for the Optional Chaining Assignment proposal
支持在导入中重写 .ts 扩展
¥Support for rewriting .ts extensions in imports
Babel 7.22.0博文
¥blog post
默认启用 Stage 4 正则表达式 v 标志 提案
¥Enable the Stage 4 RegExp v flag proposal by default
支持 明确的资源管理 提案 Stage 3 提案,包括 异步版本
¥Support for the explicit resource management proposal Stage 3 proposal, including the async version
JavaScript{ await using db = connect(databaseURL); let user = await db.getUserById(userId); await db.createPost(user.name, "Hi! :)");} // Automatically close the db
支持更新 2023 年 3 月和 2023 年 5 月 TC39 会议达成共识的 decorators 提案
¥Support for the updates of the decorators proposal that reached consensus in the March 2023 and May 2023 TC39 meetings
对 Stage 3 导入属性 提案(以前称为 "导入断言")的解析支持
¥Parsing support for the Stage 3 import attributes proposal, previously known as "import assertions"
JavaScriptimport data from "./data.json" with { type: "json" };
Babel 7.21.0博文
¥blog post
TypeScript 5.0 支持
¥TypeScript 5.0 support
支持更新 2023 年 1 月 TC39 会议达成共识的 decorators 提案
¥Support for the updates of the decorators proposal that reached consensus in the January 2023 TC39 meeting
支持 内联 RegExp 修饰符 Stage 3 提案
¥Support for the inline RegExp modifiers Stage 3 proposal
JavaScript/(?i-m:a.)/m.exec("a\nAb"); // ["Ab"]
Babel 7.20.0博文
¥blog post
TypeScript 4.9 支持
¥TypeScript 4.9 support
对 明确的资源管理 Stage 2 提案的解析器支持
¥Parser support for the explicit resource management Stage 2 proposal
JavaScript{ using handle = openFile(name, "w+"); write(handle, "Hi!\n"); write(handle, ":)\n");} // Automatically close the file
对 导入反射 Stage 2 提案的解析器支持
¥Parser support for the import reflection Stage 2 proposal
JavaScriptimport module mod from "./mod.js";// later ...import(mod);
babel-loader 9.0.0release
Babel 7.19.0博文
¥blog post
支持 decorators 提案的第 3 阶段版本
¥Support for the Stage 3 version of the decorators proposal
转变对 重复的命名捕获组 Stage 3 提案的支持
¥Transform support for the duplicate named capturing groups Stage 3 proposal
JavaScript/(?
Babel 7.18.0博文
¥blog post
TypeScript 4.7 支持
¥TypeScript 4.7 support
转变对 私有解构 Stage 2 提案的支持
¥Transform support for the Private destructuring Stage 2 proposal
JavaScriptclass A { #x = 2; method() { const { #x: x } = this; }}
编译生成器时不再需要手动包含 regenerator-runtime 助手
¥No more need to manually include the regenerator-runtime helper when compiling generators
Babel 7.17.0博文
¥blog post
支持新版 decorators Stage 2 提案
¥Support for the new version of the decorators Stage 2 proposal
JavaScriptclass A { @reactive #x = 2; @logger method() { this.#x++; }}
支持 RegExp 设置符号和字符串的属性 第 2 阶段提案
¥Support for the RegExp set notation and properties of strings Stage 2 proposal
JavaScript/[\p{RGI_Emoji}&&[\0-\uFFFF]]/v;
对 私有解构 Stage 2 提案的解析器支持
¥Parser support for the private destructuring Stage 2 proposal
JavaScriptclass A { #x = 2; method() { const { #x: x } = this; }}
Babel 7.16.0博文
¥blog post
默认启用 类静态块 Stage 4 提案
¥Enable the class static blocks Stage 4 proposal by default
JavaScriptclass A { static { initialize(A); }}
TypeScript 4.5 支持
¥TypeScript 4.5 support
在 @babel/eslint-parser 中支持 ESLint 8。
¥Support ESLint 8 in @babel/eslint-parser.
Babel 7.15.0博文
¥blog post
默认启用解析 顶层 await Stage 4 提案
¥Enable parsing for the top-level await Stage 4 proposal by default
JavaScriptimport db from "db";await db.connect();
默认启用 私有品牌检查 Stage 4 提案
¥Enable the Private Brand Checks Stage 4 proposal by default
JavaScriptclass A { static { initialize(A); } // static block #field; is(obj) { return #field in obj; // private brand check }}
支持 "黑客风格" 管道运算符 Stage 2 提案
¥Support the "Hack-style" pipeline operator Stage 2 proposal
JavaScriptconst result = "World" |> `Hello, ${%}!` |> alert(%);
TypeScript 4.4 支持
¥TypeScript 4.4 support
Babel 7.14.0博文
¥blog post
默认启用 类字段、私有方法 和 静态类特性 Stage 4 提案
¥Enable the Class Fields,
Private Methods and Static Class Features Stage 4 proposals by default
将 私有品牌检查 和 静态类块 提案添加到 @babel/preset-env 的 shippedProposals
¥Add the Private Brand Checks and Static Class Blocks proposals to @babel/preset-env's shippedProposals
JavaScriptclass A { static { initialize(A); } // static block #field; is(obj) { return #field in obj; // private brand check }}
支持 async do 表达式 提案
¥Support for the async do expressions proposal
JavaScriptlet valP = async do { 2 + await computeIt();};
支持 @babel/plugin-transform-modules-commonjs 中的 importInterop: "node" 选项,以使 Babel 与 Node.js 行为一致
¥Support for the importInterop: "node" option in @babel/plugin-transform-modules-commonjs, to aligh Babel with the Node.js behavior
TypeScript 4.3 支持
¥TypeScript 4.3 support
Babel 7.13.0博文
¥blog post
顶层 targets 选项 (RFC)
¥Top-level targets option (RFC)
粒度编译器假设(docs、RFC)
¥Granular compiler assumptions (docs, RFC)
支持 记录和元组 提案
¥Support for the Records and Tuples proposals
JavaScriptlet rec = #{ x: 1 };let tup = #[1, 2, 3];
TypeScript 4.2 支持
¥TypeScript 4.2 support
Babel 7.12.0博文
¥blog post
支持 类静态块 提案
¥Support for the class static blocks proposal
JavaScriptclass A { static { initialize(A); }}
支持 导入和导出字符串名称
¥Support for imports and exports string names
JavaScriptlet happy = "wooo!";export { happy as "😃" };
导入断言 提案的解析器支持
¥Parser support for the Import Assertions proposal
JavaScriptimport json from "./foo.json" assert { type: "json" };
TypeScript 4.1 支持
¥TypeScript 4.1 support
Babel 7.11.0博文
¥blog post
默认启用 逻辑赋值 和 数字分隔符 Stage 4 提案
¥Enable the Logical Assignment and
Numeric Separator Stage 4 proposals by default
十进制 提案的解析器支持
¥Parser support for the Decimal proposal
JavaScriptconsole.assert(0.1m + 0.2m === 0.3m);
TypeScript 4.0 支持
¥TypeScript 4.0 support
@babel/eslint-parser博文
¥blog post
Babel 7.10.0博文
¥blog post
默认启用对 import.meta Stage 4 提案的解析器支持
¥Enable parser support for the import.meta Stage 4 proposal by default
支持 私有字段的人机工程学品牌检查 提案
¥Support for the Ergonomic brand checks for Private Fields proposal
JavaScriptclass Car { #plate; race(other) { if (#plate in other) console.log("Racing against another car!"); }}
babel-polyfillsrepository
Babel 7.9.0博文
¥blog post
@babel/preset-env 中的 bugfixes 选项,用于解决浏览器错误而不是编译整个功能
¥bugfixes option in @babel/preset-env, to workaround browsers bugs rather than compiling whole Features
TypeScript 3.8 支持
¥TypeScript 3.8 support
支持 Flow declare 类字段
¥Support for Flow declare class fields
支持 automatic JSX 运行时
¥Support for the automatic JSX runtime
Babel 7.8.0博文
¥blog post
默认启用 可选链接 和 无效合并 Stage 4 提案
¥Enable the Optional Chaining and the
Nullish Coalescing Stage 4 proposals by default
支持 .mjs 配置文件
¥Support .mjs configuration files
Babel 7.7.0博文
¥blog post
顶层 await 提案的解析器支持
¥Parser support for the top-level await proposal
JavaScriptimport db from "./database.js";await db.connect();
为 @babel/parser 中的早期错误添加错误恢复支持
¥Add error recovery support for Early Errors in @babel/parser
支持 .json 和 .cjs 配置文件
¥Support .json and .cjs configuration files
TypeScript 3.7 支持
¥TypeScript 3.7 support
Babel 7.6.0博文
¥blog post
支持静态私有访问器,静态类特性 提案的一部分
¥Support for static private accessors, part of the
static class features proposal
JavaScriptclass Dog { static get #className() { return "Dog"; }}
Babel 7.5.0博文
¥blog post
支持 F# 管道运算符 提案
¥Support for the F# pipeline operator proposal
JavaScriptnum |> add(2) |> double
TypeScript namespace 支持
¥TypeScript namespace support
Babel 7.4.0博文
¥blog post
支持注入 core-js@3 polyfill
¥Support for injecting core-js@3 polyfills
支持 部分应用 提案
¥Support for the Partial Application proposal
JavaScriptstrings.map(parseInt(?));
支持静态私有方法,静态类特性 提案的一部分
¥Support for static private methods, part of the
static class features proposal
JavaScriptclass Dog { static #register() { /* ... */ }}
TypeScript 3.4 支持
¥TypeScript 3.4 support
Babel 7.3.0博文
¥blog post
支持实例私有访问器,私有方法 提案的一部分
¥Support for instance private accessors, part of the
private methods proposal
JavaScriptclass Dog { get #randomId() { return Math.random(); }}
支持 智能管道运算符 提案
¥Support for the smart pipeline operator proposal
JavaScriptnum |> add(2, #) |> double
支持正则表达式中的 命名捕获组
¥Support for
named capturing groups
in regular expressions
JavaScriptstr.match({String.raw`/^(?
TypeScript 3.2 和 2.9 支持
¥TypeScript 3.2 and 2.9 support
Babel 7.2.0博文
¥blog post
支持实例私有方法,私有方法 提案的一部分
¥Support for instance private methods, part of the private methods proposal
JavaScriptclass Dog { #bark() { console.log("Mew!") }}
Babel 7.1.0博文
¥blog post
支持 2018 年 9 月指定的 decorators 提案
¥Support for the decorators proposal, as it was specified in September 2018
JavaScriptclass Person { @autoIncrement age;}
支持静态私有字段,静态类特性 提案的一部分
¥Support for static private fields, part of the static class features proposal
JavaScriptclass Person { static #classId = 3;}
Babel 7博文
¥blog post
自从它是 2 年的预发布以来,这有更多的变化。
¥This has a lot more changes since it was 2 years of pre-releases.
放弃对未维护节点版本的支持:0.10, 0.12, 4, 5
¥Drop support for un-maintained Node versions: 0.10, 0.12, 4, 5
切换到范围包(babel-core 到 @babel/core)
¥Switch to scoped packages (babel-core to @babel/core)
删除年度预设 (@babel/preset-es2015) 和阶段预设 (@babel/preset-stage-0) (博文)。
¥Remove yearly presets (@babel/preset-es2015) and Stage presets (@babel/preset-stage-0) (blog post).
在某些情况下添加了 "pure" (/*#__PURE__*/ ) 注释支持。(后来实现为 @babel/helper-annotate-as-pure
¥Added "pure" (/*#__PURE__*/ ) annotation support in certain cases. (Implemented later as @babel/helper-annotate-as-pure
添加项目范围的 babel.config.js 配置文件 (docs) 和 overrides 配置选项。
¥Add project-wide babel.config.js config file (docs) and overrides config option.
将 "useBuiltIns: "usage" 添加到 @babel/preset-env
¥Added "useBuiltIns: "usage" to @babel/preset-env
通过 @babel/preset-typescript 支持 TypeScript
¥Support TypeScript via @babel/preset-typescript
支持 JSX 片段 <>>
¥Support JSX Fragments <>>
支持大量 TC39 提案:
¥Support a ton of TC39 proposals:
Unicode 属性正则表达式
¥Unicode Property Regex
JSON 超集
¥JSON Superset
new.target
类私有实例字段(class A { #b = 2 })
¥Class Private Instance Fields (class A { #b = 2 })
可选的捕捉绑定 try { throw 0 } catch { do() }
¥Optional Catch Binding try { throw 0 } catch { do() }
BigInt(仅语法)
¥BigInt (syntax only)
import.meta(仅限语法)(import.meta.url)
¥import.meta (syntax only) (import.meta.url)
数字分隔符(1_000)
¥Numeric Separators (1_000)
function.sent
可选链接(a?.b)
¥Optional Chaining (a?.b)
逻辑赋值运算符(a &&= b; a ||= b)
¥Logical Assignment Operators (a &&= b; a ||= b)
无效合并运算符(a ?? b)
¥Nullish Coalescing Operator (a ?? b)
管道运算符(a |> b)
¥Pipeline Operator (a |> b)
抛出表达式(() => throw new Error("a"))
¥Throw Expressions (() => throw new Error("a"))
