mirai
run the future of javascript today. write and use ES6 and ES7 code within node.
mirai
was previously called es6inode
.
getting started
npm install mirai
activating mirai
is as simple as requiring the module. mirai
will then alter the module loading system to transpile new .js
and .es6
files.
example
/* bootstrap.js */ ;;
/* program.es6 */ ; ;;;
/* actions.es6 */ ; var { let message = `[announcement] -- `; console;} var { let text = fs; console;}
node bootstrap.js=> [announcement] mirai is a success! -- system=> [announcement] greetings! -- foxy=> greetings, commoner.
configuration
simply requiring mirai
will activate it with the default parameters found in options.js
. however, you can manually activate mirai
with customized parameters.
instead of calling require("mirai")
which automatically activates mirai
, we can require a version that can be configured before activation:
var mirai = ; mirai; // the default options are displayed above. the full reference can be found at https://github.com/astralfoxy/mirai/blob/master/src/options.js
require() importing
you can also access an es6 module's exports from es5 code with require
- named exports by their name, the default export by "default".
/* program.js */ var foxy = ; foxy// => [object] foxydefault// => function foxyversion// => "infinity" foxyboolean// => true
/* foxy.es6 */ { return "definitely awesome";} var boolean = true; var version = "infinity";
license
mit licensed. use it however you want.