7.1.0 Released: Decorators, Private Static Fields
There's already another release! 7.1.0 includes support for Stage 2 Decorators and adds support for Stage 3 Private Static Fields as well as some various bug fixes.
If you didn't see earlier, we released 7.0!
Decorators (Stage 2)
class MyClass {
@decorator
method() {}
}
It's been many years in the making, but thanks to the amazing work by Nicolò, this release includes initial support for Stage 2 decorators (via @babel/plugin-proposal-decorators
). Shoutout to Peeyush for implementing parser support (and initial transform work) during Google Summer of Code last year and thanks to many members of TC39 including Daniel, Kevin, and Diego for their reviews. Keep in mind that since the proposal is Stage 2, it's still subject to major changes. Since there is a lot of the ecosystem on the previous versions of the proposal, we can attempt a codemod for some simple automated transformations to upgrade code with help from the community.
Please check out our separate blog post for more information regarding some history, changes from the previous proposal, and what's next!
Private Static Fields (Stage 3)
https://github.com/babel/babel/pull/8205, by Bloomberg
class C {
static #foo = "bar";
}
Thanks to Rob, Robin, Robert, Tim, Kubilay and the team at @Bloomberg for implementing this new feature and Justin for the review! I believe this is the first time we've had a company sponsor implementation work for a proposal and looking forward to more from them! If you want to see proposals improve, move forward, or have implementation experience in the wild then consider sponsoring work on it for Babel in addition to just going to TC39.
Private Class Methods support is WIP!
Better Monorepo Support
We're introducing a new option: rootMode
for babel.config.js
files to better support the various ways monorepos are used. The default just checks root
but you can change it to look up directories.
Check the rootMode
docs for more information.