Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Standalone fork hand crafted for use in GJS environment.

License

Notifications You must be signed in to change notification settings

WebReflection/babel-standalone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-standalone

babel-standalone is a standalone build of Babel for use in non-Node.js environments, including browsers. It's bundled with all the standard Babel plugins and presets.

This fork

The current version of babel-standalone used in this specific fork is jsgtk oriented. I have manually removed from the original uncompressed source all warnings generated and shown via GJS env.

The minified version drops mostly only spaces and put back double (pointless) pharentesuis with assignments. The result is visible in jsgtk where user modules can use ES6 syntax witohut warnings and within gjs executable.

But why?!

It's true that using Babel through Webpack, Browserify or Gulp should be sufficient for most use cases. However, there are some valid use cases for babel-standalone:

  • Sites like JSFiddle, JS Bin, the REPL on the Babel site, etc. These sites compile user-provided JavaScript in real-time.
  • Apps that embed a JavaScript engine such as V8 directly, and want to use Babel for compilation
  • Apps that want to use JavaScript as a scripting language for extending the app itself, including all the goodies that ES2015 provides.
  • Integration of Babel into a non-Node.js environment (ReactJS.NET, ruby-babel-transpiler, php-babel-transpiler, etc).

Installation

There are several ways to get a copy of babel-standalone. Pick whichever one you like:

Usage

Load babel.js or babel.min.js in your environment. This will expose Babel's API in a Babel object:

var input = 'const getMessage = () => "Hello World";';
var output = Babel.transform(input, { presets: ['es2015'] }).code;

Note that .babelrc doesn't work in babel-standalone, as no file system access is available. The presets and/or plugins to use must be specified in the options passed to Babel.transform.

Changelog

6.4.4 - 17th January 2016

  • Made version number consistent with Babel's.
  • #2 - Added 2015-loose preset.

1.0 - 5th December 2015

  • Initial release.

About

Standalone fork hand crafted for use in GJS environment.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.9%
  • HTML 0.1%