Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub

โ€บAll Blog Posts

All Blog Posts

  • 7.18.0 Released: Destructuring private elements and TypeScript 4.7
  • 7.17.0 Released: RegExp 'v' mode and ... ๐Ÿฅ decorators!
  • 7.16.0 Released: ESLint 8 and TypeScript 4.5
  • 7.15.0 Released: Hack-style pipelines, TypeScript const enums and Rhino target support
  • Babel is used by millions, so why are we running out of money?
  • 7.14.0 Released: New class features enabled by default, TypeScript 4.3, and better CommonJS interop
  • 7.13.0 Released: Records and Tuples, granular compiler assumptions, and top-level targets
  • 7.12.0 Released: TypeScript 4.1, strings as import/export names, and class static blocks
  • 7.11.0 Released: ECMAScript 2021 support in preset-env, TypeScript 4.0 support, printing config and the future of `babel-eslint`
  • The State of babel-eslint
  • 7.10.0 Released: Class Fields in preset-env, '#private in' checks and better React tree-shaking
  • 7.9.0 Released: Smaller preset-env output, Typescript 3.8 support and a new JSX transform
  • 7.8.0 Released: ECMAScript 2020, .mjs configuration files and @babel/cli improvements
  • Babel's Funding Plans
  • 7.7.0 Released: Error recovery and TypeScript 3.7
  • 7.6.0 Released: Private static accessors and V8 intrinsic syntax
  • 7.5.0 Released: dynamic import and F# pipelines
  • The Babel Podcast
  • 7.4.0 Released: core-js 3, static private methods and partial application
  • 7.3.0 Released: Named capturing groups, private instance accessors and smart pipelines
  • 7.2.0 Released: Private Instance Methods
  • TC39 Standards Track Decorators in Babel
  • 7.1.0 Released: Decorators, Private Static Fields
  • Babel 7 Released
  • Removing Babel's Stage Presets
  • What's Happening With the Pipeline (|>) Proposal?
  • Announcing Babel's New Partnership with trivago!
  • On Consuming (and Publishing) ES2015+ Packages
  • Nearing the 7.0 Release
  • Babel Turns Three
  • Planning for 7.0
  • Zero-config code transformation with babel-plugin-macros
  • Contributing to Babel: Three Lessons to Remember
  • Personal Experiences at Babel #1 โ€” A PR with Unusually High Number of Reviews
  • Babel and Summer of Code 2017
  • Upgrade to Babel 7 (moved)
  • Upgrade to Babel 7 for Tool Authors (WIP)
  • 6.23.0 Released
  • The State of Babel
  • 6.19.0 Released
  • 6.18.0 Released
  • 6.16.0 Released
  • Babili (babel-minify)
  • 6.14.0 Released
  • Babel Doctor
  • Setting up Babel 6
  • 6.0.0 Released
  • React on ES6+
  • Function Bind Syntax
  • 5.0.0 Released
  • Babel <3 React
  • Not Born to Die
  • 2to3
  • 6to5 + esnext

7.17.0 Released: RegExp 'v' mode and ... ๐Ÿฅ decorators!

February 2, 2022

Babel Team

We just published Babel 7.17.0!

After years of iterations, rewrites and adjustments it looks like the decorators proposal has finally stabilized again on a new design! This release includes both parse and transform support for the new proposal.

We also implemented the RegExp v flag proposal and added parsing support for destructuring private fields, both currently Stage 2. Lastly, a new experimental implementation of @babel/register.

You can read the whole changelog on GitHub.

If you or your company want to support Babel and the evolution of JavaScript, but aren't sure how, you can donate to us on our Open Collective or GitHub Sponsors and, better yet, work with us on the implementation of new ECMAScript proposals directly! As a volunteer-driven project, we rely on the community's support to fund our efforts in supporting the wide range of JavaScript users. Reach out at team@babeljs.io if you'd like to discuss more!

Highlights

Decorators (#14004, #13681)

After receiving feedback from JavaScript developers, engine developers and language experts, the decorators proposal was rewritten to take into account multiple constraints and desires. We collaborated with the current proposal author, @pzuraq to implement the new Stage 2 proposal in Babel.

The new implementation also supports decorating private class elements, as well as the new "class auto accessors" syntax:

@defineElement("button")
class Button {
  @reactive accessor enabled = true; // class auto accessors

  @event("onClick") #handleClick() { // decorator on a private method
    console.log("clicked!");
  }
}

You can enable the new proposal by passing the "version": "2021-12" option to @babel/plugin-proposal-decorators:

{
  "plugins": [
    ["@babel/plugin-proposal-decorators", {
        "version": "2021-12"
    }]
  ]
}

โš ๏ธ While the new decorators syntax is compatible with the previous proposal, the semantics are different: decorators already written for Babel "legacy", Babel older-but-not-legacy, or TypeScript will not work with the new proposal.

If you want to help move the proposal forward, you can try using it and leave feedback in their GitHub repository.

RegExp set notation and properties of strings (#14125)

Babel now supports the RegExp set notation and properties of strings proposal, which introduces three new regular expression features behind a new v flag:

  • Extended set notation, which allows computing difference, intersection and union of characters or strings sets
    /[\p{Decimal_Number}--[0-9]]/v; // Non-ASCII decimal digits
    /[\p{ASCII}&&\p{Letter}]/v; // ASCII letters
    /[[\p{ASCII}&&\p{Letter}]\p{Number}]/v; // ASCII letters, or any digit
    
  • Properties of strings, which allow using \p escapes with multi-codepoint properties
    "Did you see the ๐Ÿ‘ฉ๐Ÿฟโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘ฉ๐Ÿพ emoji?".match(/\p{RGI_Emoji}/v). // ["๐Ÿ‘ฉ๐Ÿฟโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘ฉ๐Ÿพ"]
    
  • Multi-codepoint strings in sets, using a new \q escape
    /[\r\n\q{\r\n|NEWLINE}]/v; // Matches \r, \n, \r\n or NEWLINE
    

You can enable this proposal using the @babel/plugin-proposal-unicode-sets-regex plugin:

{
  "plugins": ["@babel/plugin-proposal-unicode-sets-regex"]
}

Babel relies on different third-party packages to transform regular expressions: we are grateful to the maintainers of regjsparser, regjsgen and regexpu-core who took time to review our pull requests!

@@ and ^^ topic tokens for Hack-style pipes (#13973)

We are continuing to help the proposal authors evaluate different tokens for the pipeline operator proposal: one of the champions, J. S. Choi, added support for two new tokens that you can try with the topicToken option:

{
  "plugins": [
    ["@babel/plugin-proposal-pipeline-operator", {
      "proposal": "hack",
      "topicToken": "^^" // or "@@"
    }]
  ]
}

You can read more about the supported variations in the @babel/plugin-proposal-pipeline-operator docs.

Experimental @babel/register rewrite (#13782)

We plan to release Babel 8 as an ESM package. However, this poses a big problem: how to load and run it synchronously in CommonJS packages?

Usually most Babel consumers can run Babel asynchronously, or at least load it asynchronously. This isn't true for @babel/eslint-parser (which integrates Babel's parser with ESLint) and @babel/register (which can be used to transpile Node.js files on-the-fly), where we need to move parsing and transforming to a separate worker.

Babel 7.16.0 exposes the new experimental @babel/register implementation at @babel/register/experimental-worker: it internally runs Babel asynchronously, so it's compatible with .mjs configuration files and with .mjs Babel plugins. It will be enabled by default in Babel 8, and you can already use it as a replacement for @babel/register with a few caveats:

  • If you programmatically specify @babel/register options (using require("@babel/register")({ /* ... options */ })), you must make sure that they are serializable. This means that you cannot pass plugin functions defined inline, but you must move them to a separate ./my-plugin.js file or to a babel.config.js file.
  • The new implementation is still experimental: it should have the same features as the existing one, but there are a few improvements that we are exploring.

We already released the new experimental @babel/eslint-parser implementation in Babel 7.15.0, exposed at @babel/eslint-parser/experimental-worker.

Recent Posts
  • Highlights
    • Decorators (#14004, #13681)
    • RegExp set notation and properties of strings (#14125)
    • @@ and ^^ topic tokens for Hack-style pipes (#13973)
    • Experimental @babel/register rewrite (#13782)
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site