Comparing version 0.2.0 to 0.3.0
var fs = require('fs'); | ||
var through = require('through'); | ||
var es6templates = require('es6-templates'); | ||
var es6arrowfn = require('es6-arrow-function'); | ||
@@ -57,2 +59,6 @@ var es6class = require('es6-class'); | ||
if (options.templates !== false) { | ||
ast = es6templates.transform(ast); | ||
} | ||
if (options.arrowFunction !== false) { | ||
@@ -110,2 +116,14 @@ ast = es6arrowfn.transform(ast); | ||
exports.compile = compile; | ||
module.exports = function () { | ||
var data = ''; | ||
return through(write, end); | ||
function write (buf) { data += buf; } | ||
function end () { | ||
this.queue(module.exports.compile(data).code); | ||
this.queue(null); | ||
} | ||
}; | ||
module.exports.compile = compile; | ||
module.exports.transform = transform; |
{ | ||
"name": "esnext", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Transform next-generation JavaScript to today's JavaScript.", | ||
@@ -30,4 +30,7 @@ "main": "lib/index.js", | ||
"esprima": "git://github.com/ariya/esprima.git#harmony", | ||
"recast": "^0.5.14" | ||
"recast": "^0.5.14", | ||
"through": "^2.3.4", | ||
"es6-templates": "^0.0.2", | ||
"ast-types": "^0.3.23" | ||
} | ||
} |
@@ -33,2 +33,3 @@ # esnext | ||
* arrow functions (via [es6-arrow-function][es6-arrow-function]) | ||
* template strings (via [es6-templates][es6-templates]) | ||
@@ -44,6 +45,6 @@ ### TODO | ||
Any omissions here are not intentional and we'd love to integrate support for | ||
more future JavaScript syntax. See the Contributing section below. Keep in mind | ||
that, as of right now, this project is intended to support new JavaScript | ||
*syntax* only. Any new APIs should be handled using polyfills. This may change | ||
in the future. | ||
more future JavaScript syntax (see [es6features][es6features] for a more | ||
complete list). See the Contributing section below. Keep in mind that, as of | ||
right now, this project is intended to support new JavaScript *syntax* only. | ||
Any new APIs should be handled using polyfills. This may change in the future. | ||
@@ -107,2 +108,4 @@ ## Usage | ||
[es6-module-transpiler]: https://github.com/square/es6-module-transpiler | ||
[es6-templates]: https://github.com/square/es6-templates | ||
[es6features]: https://github.com/lukehoban/es6features | ||
[recast]: https://github.com/benjamn/recast | ||
@@ -109,0 +112,0 @@ [regenerator]: http://facebook.github.io/regenerator/ |
@@ -19,2 +19,6 @@ /* jshint esnext:true */ | ||
} | ||
toString() { | ||
return `[Counter count=${this.count}]`; | ||
} | ||
} | ||
@@ -44,1 +48,2 @@ | ||
assert.equal(counter.count, 13); | ||
assert.equal(counter.toString(), '[Counter count=13]'); |
10648
11
198
112
8
+ Addedast-types@^0.3.23
+ Addedes6-templates@^0.0.2
+ Addedthrough@^2.3.4
+ Addedes6-templates@0.0.2(transitive)