• Stars
    star
    433
  • Rank 96,589 (Top 2 %)
  • Language
  • Created almost 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

✍️ Tracking the status of Babel's implementation of TC39 proposals (may be out of date)

Babel progress on ECMAScript proposals

Official TC39 Proposals Repo

TC39 Proposals Process Document

Proposals

For the official list, check the TC39 repo. This list only contains all proposals higher than Stage 0 that are compilable by Babel. (If Stage 4, it will be in preset-env)

Proposal Link Current Stage Status
Dynamic Import 4 3
RegExp Unicode Property Escapes 4 3
RegExp Named Capture Groups 4 3
RegExp DotAll Flag 4 3
Class Fields 3 2
function.sent 2 2
Class and Property Decorators 2 1
BigInt 4 Parsable
import.meta 3 Parsable
export * as ns from "mod"; 4 1
export v from "mod"; 1 1
Generator Arrow Functions 1 N/A
Optional Chaining 4 1
do Expressions 1 1
Numeric Separator 3 1
Function Bind 0 0
Pattern matching 1 0

Implemented

Dynamic Import

TC39 Champion: Domenic Denicola
Preset: babel-preset-stage-3
Plugins: babel-plugin-syntax-dynamic-import

Webpack 1: https://github.com/airbnb/babel-plugin-dynamic-import-webpack
Webpack 2: supports this by default (just needs Babel to parse)
Node: https://www.npmjs.com/package/babel-plugin-dynamic-import-node

Code Example
import('test-module').then(() => (
  import('test-module-2');
));

RegExp Unicode Property Escapes

TC39 Champion: Brian Terlson, Daniel Ehrenberg, Mathias Bynens
Preset: babel-preset-stage-3
Plugins: babel-plugin-transform-unicode-property-regex

Code Example
const a = /^\p{Decimal_Number}+$/u;
const b = /\p{Script_Extensions=Greek}/u;

RegExp Named Capture Groups

TC39 Champion: Daniel Ehrenberg, Brian Terlson
Preset: N/A
Plugins: babel-plugin-transform-modern-regexp (with namedCapturingGroups flag)

Code Example
let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;

let result = re.exec('2015-01-02');
// result.groups.year === '2015';
// result.groups.month === '01';
// result.groups.day === '02';

// result[0] === '2015-01-02';
// result[1] === '2015';
// result[2] === '01';
// result[3] === '02';

Regexp DotAll Flag

TC39 Champion: Daniel Ehrenberg, Jeff Morrison Preset: N/A
Plugins: babel-plugin-transform-dotall-regex, babel-plugin-transform-modern-regexp (with dotAll flag)

Code Example
/./s; // /[\0-\uFFFF]/;

Class Fields

TC39 Champion: Daniel Ehrenberg, Jeff Morrison

Stage 2

Preset: WIP
Plugins: WIP
First Pull Request: babel/babylon#608 by @diervo
Babylon Label: Spec: Class Fields

Stage 1

Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-class-properties

Code Example
class Bork {
  instanceProperty = "bork";
  boundFunction = () => {
    return this.instanceProperty;
  }

  static staticProperty = "babelIsCool";
  static staticFunction = function() {
    return Bork.staticProperty;
  }
}

Class and Property Decorators

TC39 Champion: Yehuda Katz and Brian Terlson

Stage 2

Preset: WIP
Plugins: WIP

Stage 1

Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-decorators, babel-plugin-transform-decorators-legacy
First Pull Request: babel/babylon#587 by @peey
Babylon Label: Spec: Decorators

Code Example
@frozen class Foo {
  @configurable(false) @enumerable(true) method() {}
}
function frozen(constructor, parent, elements) {
  return {
    constructor,
    elements,
    finisher(constructor) {
      Object.freeze(constructor.prototype)
      Object.freeze(constructor)
    }
  }
}
function configurable(configurable) {
  return decorator;
  function decorator(previousDescriptor) {
    return {
      ...previousDescriptor,
      descriptor: {
        ...previousDescriptor.descriptor,
        configurable
      }
    }
  }
}
function enumerable(enumerable) {
  return decorator;
  function decorator(previousDescriptor) {
    return {
      ...previousDescriptor,
      descriptor: {
        ...previousDescriptor.descriptor,
        enumerable
      }
    }
  }
}

Export Extensions

This proposal was split into 2:
https://github.com/tc39/proposal-export-ns-from
https://github.com/tc39/ecmascript-export-default-from

TC39 Champion: Lee Byron
Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-export-extensions

Code Example
export * as ns from 'mod'; // export-ns-from
export v from 'mod'; // export default from

Optional Chaining

TC39 Champion: Gabriel Isenberg
Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-optional-chaining

Code Example
obj?.prop       // optional property access
obj?.[expr]     // optional property access
func?.(...args) // optional function or method call

a?.b = 42; // a == null ? undefined : a.b = 42;

do Expressions

TC39 Champion: Dave Herman
Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-do-expressions

Code Example
let a = do {
  if (x > 10) {
    'big';
  } else {
    'small';
  }
};

// let a = x > 10 ? 'big' : 'small';

Numeric Separator

TC39 Champion: Sam Goto
Preset: babel-preset-stage-1
Plugins: babel-plugin-transform-numeric-separator
First Pull Request: babel/babylon#541 by @rwaldron
Babylon Label: Spec: Numeric Separator

Code Example
// Decimal Literals
let budget = 1_000_000_000_000;
// Binary Literals
let nibbles = 0b1010_0001_1000_0101;
// Hex Literal
let message = 0xA0_B0_C0;

Function Bind

TC39 Champion: Brian Terlson & Matthew Podwysocki
Preset: babel-preset-stage-0
Plugins: babel-plugin-transform-function-bind

Code Example
obj::func
// is equivalent to:
func.bind(obj)

obj::func(val)
// is equivalent to:
func.call(obj, val)

::obj.func(val)
// is equivalent to:
func.call(obj, val)

function.sent

TC39 Champion: Allen Wirfs-Brock
Preset: babel-preset-stage-2
Plugins: babel-plugin-transform-function-sent

Code Example
function* generator() {
  console.log("Sent", function.sent);
  console.log("Yield", yield);
}

const iterator = generator();
iterator.next(1); // Logs "Sent 1"
iterator.next(2); // Logs "Yield 2"

Parser Only

BigInt

TC39 Champion: Daniel Ehrenberg
Preset: WIP
Plugins: WIP
First Pull Request: babel/babylon#588 by @wdhorton
Babylon Label: Spec: BigInt

Code Example
1n // integer
0b101n // binary
0xFF123n // hex
0o16432n // octal
9223372036854775807n // larger than floating
Invalid Example
// Invalid
1.0n // no decimals
2e9n // no exponential notation
016n // no old octal

import.meta

TC39 Champion: Domenic Denicola
Preset: babel-preset-stage-2
Plugins: babel-plugin-syntax-import-meta
First Pull Request: babel/babylon#544 by @jkrems
Babylon Label: Spec: import.meta

Code Example
import.meta.url;
import.meta.scriptElement.dataset.size;

Not Implemented

Pattern Matching

TC39 Champion: Brian Terlson (Microsoft, @bterlson), Sebastian Markbåge (Facebook, @sebmarkbage)
Preset: WIP
Plugins: WIP
Babylon Label: Spec: pattern matching
First Pull Request: babel/babylon#635 by @krzkaczor

Code Example
const length = vector => {
  case (vector) {
    when { x, y, z } -> return Math.sqrt(x ** 2 + y ** 2 + z ** 2)
    when { x, y } ->   return Math.sqrt(x ** 2 + y ** 2)
    when [...etc] ->     return vector.length
  }
}
const isVerbose = config => {
   case (config) {
    when {output: { verbose: true }} -> return true
    when config -> return false
    }
}
const res = await fetch(jsonService)
case (res) {
  when {status: 200, headers: {'Content-Length': s}} ->
    console.log(`size is ${s}`)
  when {status: 404} ->
    console.log('JSON not found')
  when {status} if (status >= 400) -> {
    throw new RequestError(res)
  }
}

Generator Arrow Functions

TC39 Champion: Brendan Eich, Domenic Denicola
Preset: N/A
Plugins: N/A

Code Example
()=>*{}

FAQ

When does Babel implement new features?

Babel will accept any PR for a proposal that is intended to go through the TC39 Proposal Process. This just means that we could implement and release a proposal starting at Stage 0. However this doesn't mean that we will implement it ourselves, but that we will work with both TC39 Champions and the community to get an implementation in. (And sometimes we have to wait for Summer of Code for that to happen).

It's our intention (and one of our main goals) as a project to help TC39 get feedback from the community through using the new syntax in their codebases. There is however a balance between supporting new proposals and informing users that any proposal is still just a proposal and subject to change. In order to move the community forward, we will continuously make changes to adhere to the spec as patches. If bigger changes require a major version, we will deprecate older versions of plugins, document those changes, and see if we can automate the upgrade via a codemod. This way everyone is moving towards Stage 4 and closer to what will be in the spec if the proposal makes it to the end.

This means we will also include proposals in this repo that haven't been presented to the committee yet if they are concrete enough and someone on TC39 is planning on presenting it (and marked appropriately).

More Repositories

1

babel

🐠 Babel is a compiler for writing next generation JavaScript.
TypeScript
42,835
star
2

babel-loader

📦 Babel loader for webpack
JavaScript
4,794
star
3

minify

✂️ An ES6+ aware minifier based on the Babel toolchain (beta)
JavaScript
4,375
star
4

babel-preset-env

PSA: this repo has been moved into babel/babel -->
JavaScript
3,502
star
5

babel-sublime

Syntax definitions for ES6 JavaScript with React JSX extensions.
JavaScript
3,260
star
6

babel-eslint

🗼 A wrapper for Babel's parser used for ESLint (renamed to @babel/eslint-parser)
JavaScript
2,970
star
7

example-node-server

Example Node Server w/ Babel
JavaScript
2,842
star
8

babylon

PSA: moved into babel/babel as @babel/parser -->
JavaScript
1,714
star
9

babelify

Browserify transform for Babel
JavaScript
1,680
star
10

gulp-babel

Gulp plugin for Babel
JavaScript
1,322
star
11

babel-upgrade

⬆️ A tool for upgrading Babel versions (to v7): `npx babel-upgrade`
JavaScript
1,308
star
12

awesome-babel

😎A list of awesome Babel plugins, presets, etc.
857
star
13

babel-standalone

🎮 Now located in the Babel repo! Standalone build of Babel for use in non-Node.js environments, including browsers.
JavaScript
821
star
14

preset-modules

A Babel preset that targets modern browsers by fixing engine bugs (will be merged into preset-env eventually)
JavaScript
740
star
15

website

🌐 The Babel documentation website
TypeScript
740
star
16

kneden

Transpile ES2017 async/await to vanilla ES6 Promise chains: a Babel plugin
JavaScript
514
star
17

grunt-babel

Grunt plugin for Babel
JavaScript
438
star
18

eslint-plugin-babel

An ESlint rule plugin companion to babel-eslint
JavaScript
390
star
19

generator-babel-boilerplate

A Yeoman generator to author libraries in ES2015 (and beyond!) for Node and the browser.
JavaScript
381
star
20

babel-time-travel

Time travel through babel transformations one by one (implemented in the Babel REPL now)
JavaScript
345
star
21

babel-polyfills

A set of Babel plugins that enable injecting different polyfills with different strategies in your compiled code.
TypeScript
321
star
22

babel-sublime-snippets

Next generation JavaScript and React snippets for Sublime
264
star
23

karma-babel-preprocessor

Karma plugin for Babel
JavaScript
167
star
24

ruby-babel-transpiler

Ruby Babel is a bridge to the JS Babel transpiler.
Ruby
158
star
25

babel-jest

Jest plugin for Babel (moved) ->
139
star
26

notes

♬ Notes from the @Babel Team (discuss in PRs)
121
star
27

generator-babel-plugin

Babel Plugin generator for Yeoman
JavaScript
118
star
28

babel-bridge

A placeholder package that bridges babel-core to @babel/core.
JavaScript
94
star
29

babel-bot

🤖 A helpful bot to automate common tasks on Babel Issues/PRs
JavaScript
75
star
30

babel-brunch

Brunch plugin for Babel
JavaScript
69
star
31

broccoli-babel-transpiler

Broccoli plugin for Babel
JavaScript
58
star
32

jade-babel

Jade plugin for Babel
JavaScript
40
star
33

sandboxes

Babel repl-like codesandbox: check out link =>
JavaScript
39
star
34

jekyll-babel

A Babel converter for Jekyll.
Ruby
34
star
35

acorn-to-esprima

(unmaintained) Converts acorn tokens to esprima tokens
JavaScript
33
star
36

babel-connect

Connect plugin for Babel
JavaScript
27
star
37

podcast.babeljs.io

The Babel Podcast site!
JavaScript
25
star
38

phabricator-to-github

A tool to migrate phabricator issues to github
JavaScript
24
star
39

actions

Babel specific github actions 🤖
JavaScript
24
star
40

rfcs

RFCs for changes to Babel
21
star
41

metalsmith-babel

A Metalsmith plugin to compile JavaScript with Babel
JavaScript
20
star
42

babel-configuration-examples

WIP
JavaScript
18
star
43

duo-babel

Duo plugin for Babel
JavaScript
16
star
44

logo

Babel logo
15
star
45

parser_performance

JavaScript
13
star
46

babel-standalone-bower

Bower build of babel-standalone. See https://github.com/Daniel15/babel-standalone
JavaScript
10
star
47

gobble-babel

Gobble plugin for Babel
JavaScript
9
star
48

eslint-config-babel

ESLint config for all Babel repos
JavaScript
9
star
49

eslint-plugin-babel-plugin

A set of eslint rules to enforce best practices in the development of Babel plugins.
JavaScript
8
star
50

flavortown

what else?
7
star
51

.github

Community health files for the Babel organization
7
star
52

babel-archive

🗑 Packages that are deprecated or don't need to be updated
JavaScript
6
star
53

babel-test262-runner

Run test262 tests on Node 0.10 using Babel 7 and `core-js@3`.
JavaScript
6
star
54

babel-plugin-proposal-private-property-in-object

@babel/plugin-proposal-private-property-in-object, with an added warning for when depending on this package without explicitly listing it in dependencies or devDependencies
JavaScript
6
star
55

phabricator-redirects

↩️ Redirects for old phabricator urls
HTML
5
star
56

babel-plugin-transform-async-functions

https://github.com/MatAtBread/fast-async/issues/46
4
star
57

slack-invite-link

Source of slack.babeljs.io
1
star