es6-module-transpiler
Advanced tools
Comparing version 0.9.0 to 0.9.1
/* jshint node:true, undef:true, unused:true */ | ||
var assert = require('assert'); | ||
var Path = require('path'); | ||
var Rewriter = require('./rewriter'); | ||
var Writer = require('./writer'); | ||
var recast = require('recast'); | ||
@@ -157,2 +159,32 @@ /** @typedef {{resolveModule: function(string, Module, Container): Module}} */ | ||
/** | ||
* Translate and return the contents of this container. | ||
* | ||
* @return {{filename: string, code: string, map: object}[]} | ||
*/ | ||
Container.prototype.transform = function() { | ||
if (!this._convertResult) { | ||
this._convertResult = this.convert(); | ||
} | ||
var files = this._convertResult; | ||
var codes = []; | ||
files.forEach(function(file) { | ||
var rendered = recast.print(file, { | ||
sourceMapName: Path.basename(file.filename) | ||
}); | ||
var code = rendered.code; | ||
var map = rendered.map; | ||
codes.push({ | ||
filename: file.filename, | ||
code: code, | ||
map: map | ||
}); | ||
}); | ||
return codes; | ||
}; | ||
/** | ||
* Converts the contents of this container using the current formatter. | ||
@@ -159,0 +191,0 @@ * |
{ | ||
"name": "es6-module-transpiler", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "es6-module-transpiler is an experimental compiler that allows you to write your JavaScript using a subset of the current ES6 module syntax, and compile it into various formats.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://esnext.github.io/es6-module-transpiler", |
# ES6 Module Transpiler [![Build Status](https://travis-ci.org/esnext/es6-module-transpiler.png)](https://travis-ci.org/esnext/es6-module-transpiler) | ||
ES6 Module Transpiler is an experimental compiler that allows you to write your | ||
JavaScript using a subset of the current ES6 module syntax, and compile it into | ||
JavaScript using a subset of the ES6 module syntax, and compile it into | ||
AMD or CommonJS modules. | ||
**WARNING: The ES6 module syntax is still undergoing a lot of churn, and will | ||
likely change before final approval.** | ||
**ES6 Module Transpiler will track ES6 syntax, and not attempt to maintain | ||
backwards compatibility with syntax that ultimately did not succeed as part of | ||
ES6.** | ||
This compiler provides a way to experiment with ES6 syntax in real world | ||
@@ -40,3 +33,3 @@ scenarios to see how the syntax holds up. It also provides a nicer, more | ||
$ npm install -g es6-module-transpiler | ||
$ compile-modules convert < foo.js | ||
$ compile-modules convert foo.js | ||
``` | ||
@@ -71,5 +64,2 @@ | ||
Again, this syntax is in flux and is closely tracking the module work being | ||
done by TC39. | ||
### Named Exports | ||
@@ -180,6 +170,6 @@ | ||
to write this library. Thanks to [Domenic | ||
Denicola](https://twitter.com/domenic) & [Thomas | ||
Boyt](https://twitter.com/thomasaboyt) for their efforts to make this project | ||
even better. And finally thanks to the JavaScript community at Square for | ||
helping to write and release this library. | ||
Denicola](https://twitter.com/domenic), [Jo Liss](https://twitter.com/jo_liss), | ||
& [Thomas Boyt](https://twitter.com/thomasaboyt) for their efforts to make this | ||
project even better. And finally thanks to the JavaScript community at Square | ||
for helping to write and release this library. | ||
@@ -201,3 +191,3 @@ ## Contributing | ||
When you have a change you'd like to see in the master repository, [send a pull | ||
request](https://github.com/square/es6-module-transpiler/pulls). Before we merge | ||
request](https://github.com/esnext/es6-module-transpiler/pulls). Before we merge | ||
your request, we'll make sure you're in the list of people who have signed a | ||
@@ -204,0 +194,0 @@ CLA. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114600
3533
193