Babel Adds Smart Pipelines
Written by Kay Ewbank   
Monday, 01 April 2019

Babel has been updated with support for smart pipelines and private instant accessors. The JavaScript compiler takes JavaScript ECMAScript 2015+ code and converts it into a backwards compatible version to run in older browsers. 

Babel can also convert React JSX syntax into JavaScript. The main rationale for using Babel has been reduced as fewer people rely on older browsers that don't have support for ES2015 and beyond.

babel

The most recent release (7.3) has added support for smart pipelines. Parsing support was added in version 7.2 of Babel for the Smart Pipelines Operator proposal, and this release lets you transpile it down to standard ECMAScript and try it out. The developers say the current release only supports the main proposal, and none of the additional features. The current implementation also lacks support for yield and await in pipelines.

The next improvement in this version is the ability to parse and compile private instance accessors. Babel already had support for private fields and methods for class instances. Private methods and accessors (getter/setters) have now been added, meaning any class element can be private. The addition to Babel adds support for private accessors within the current babel-plugin-class-features + babel-plugin-proposal-private-methods plugin combination. The private getter and setter functions retrieve and update a private field. 

The final main improvement to the new version is support for named capturing groups. The developers describe this as being the biggest ECMAScript 2018 feature missing in Babel - until now.  Named capture groups let you assign a name to a capture group. The way this works is that when you match a regular expression against a string, you get a match object, and can assign a name to this. After matching, you can access the captured string by using the name you assigned to it.

The current release also adds better TypeScript parsing, and a number of bug fixes. 

babel 

 

More Information

Babel On GitHub

Related Articles

Babel 7 Released With Improved TypeScript Support

Babel 6 More Than A JavaScript Modernizer

6to5 Renamed As Babel - Are You Ready For The Next Gen JavaScript?       

JavaScript 6 EcmaScript 2015 Final Approval         

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Can C++ Be As Safe As Rust?
10/04/2024

Herb Sutter is a well known and respected C++ champion and he thinks that the language only needs a few tweaks to make it as safe as Rust. Can this be true?



NVIDIA Releases Free Courses On AI
19/04/2024

NVIDIA has jumped on the AI bandwagon in a big way. Hardware aside, this means working on training material too. Several self- paced courses have been released and for free too!


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info