Babel (transcompiler)

{{Short description|Backwards compatible JavaScript compiler}}

{{Infobox software

| name = Babel

| logo = File:Babel Logo.svg

| author = Sebastian McKenzie

| developer = [https://github.com/babel/babel/graphs/contributors Contributors]

| released = {{Start date and age|2014|09|28}}{{cite web|url=https://github.com/babel/babel/commit/c97696c224d718d96848df9e1577f337b45464be| title= first commit |website= Babel Github |access-date = 2021-01-26}}

| latest release version = {{wikidata|property|reference|edit|P348}}

| latest release date = {{Start date and age|{{wikidata|qualifier|P348|P577}}}}

| programming language = JavaScript

| operating system = Linux, macOS, Solaris, FreeBSD, OpenBSD, AIX, Microsoft Windows

| genre = Compiler

| license = MIT{{cite web|title=babel/LICENSE at master|url=https://github.com/babel/babel/blob/master/LICENSE|website=GitHub|accessdate=12 May 2018}}

| website = {{URL|https://babeljs.io/}}

}}

Babel is a free and open-source JavaScript transcompiler that is mainly used to convert ECMAScript 2015+ (ES6+) code into backwards-compatible JavaScript code that can be run by older JavaScript engines. It allows web developers to take advantage of the newest features of the language.{{Cite web|url=https://www.thoughtworks.com/radar/tools/babel|title=Technology Radar {{!}} Emerging Technology Trends for 2017 {{!}} ThoughtWorks|website=www.thoughtworks.com|access-date=2018-05-12}}

Developers can use new JavaScript language features by using Babel to convert their source code into versions of JavaScript that a Web browser can process.{{Cite web|url=https://codemix.com/blog/why-babel-matters/|title=Why Babel Matters {{!}} codemix|website=codemix.com|access-date=2018-05-12}} Babel can also be used to compile TypeScript into JavaScript.[https://www.typescriptlang.org/docs/handbook/babel-with-typescript.html Using Babel with TypeScript], TypeScript official website The core version of Babel was downloaded 5 million times a month in 2016, and this increased to 16 million times a week in 2019.{{Cite web|url=https://babeljs.io/blog/2016/12/07/the-state-of-babel|title=The State of Babel · Babel|website=babeljs.io|access-date=2018-05-12}}{{Cite web|url=https://babeljs.io/blog/2019/11/08/babels-funding-plans|title=Babel's Funding Plans · Babel|website=babeljs.io|access-date=2020-08-01}}

Babel plugins transform syntax that is not widely supported into a backward-compatible version. For example, arrow functions, which are specified in ES6, are converted into regular function declarations.{{cite web |title=Plugins · Babel |url=https://babeljs.io/docs/en/plugins |website=babeljs.io |accessdate=5 July 2019 }} Non-standard JavaScript syntax such as JSX can also be transformed.{{Cite web|url=https://reactjs.org/docs/introducing-jsx.html|title=Introducing JSX - React|website=reactjs.org|access-date=2018-05-12}}{{Cite news|url=https://blogs.msdn.microsoft.com/uk_faculty_connection/2017/07/21/using-react-and-building-a-web-site-on-azure/|title=Using React and building a web site on Azure|work=Microsoft Faculty Connection|access-date=2018-05-12}}

Babel can automatically inject polyfills provided by core-js{{cite web |title=core-js |website=GitHub |url=https://github.com/zloirock/core-js }} for support features that are missing entirely from JavaScript environments. For example, static methods such as Array.from and built-ins such as Promise are available only in ES6 and above, but they can be used in older environments if core-js is used.

See also

{{Portal|Computer programming|Free and open-source software}}

References

{{Reflist}}