Skip to content

gpittarelli/babel-backwards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-backwards

Babel port of lebab--a project for transforming ES5 code to use features introduced in ES2015 and beyond.

This project aims to provide ports of lebab's transforms packaged as babel presets (eg babel-preset-5to6-commonjs); that way this project's CLI could be wholly replaced by just passing the right options to babel. It also provides babel-backwards, a CLI similar to lebab (not quite a drop-in replacement though, for example specifying multiple transforms will run all of them).

Why recreate lebab in the Babel ecosystem? A few reasons: (inspired by lebab/lebab#138)

  • babel already has really nice error handling and similar tooling worked out, allowing the actual transforms to just be implemented by themselves.
  • lebab is based on the espree JS parser, which doesn't support as many features as babylon; so it doesn't support the (admittedly awkward) case of upgrading files that already use some experimental features.

Many thanks to hzoo for making this possible (see lebab/lebab#138)

Usage

npm i -g babel-backwards
echo '"use strict";1 + 1;' | babel-backwards -t no-strict
# => 1 + 1;

Development

git clone https://github.com/gpittarelli/babel-backwards
npm i
npm run bootstrap
npm watch &
./packages/babel-backwards/bin/babel-backwards --help

License

Released under the MIT License. See the LICENSE file for full text

Copyright © 2017 George Pittarelli

About

Upgrade ES5 code, ala lebab, implemented via babel plugins

Resources

License

Stars

Watchers

Forks

Packages

No packages published