feat(build): transpile to es6

Transpile all sources first to es6 which we can publish and then
to es5. Also merge the generated source maps into once map.
This commit is contained in:
Tobias Bosch
2015-02-06 21:04:43 -08:00
parent 4b24734855
commit 69bba9b5df
5 changed files with 139 additions and 17 deletions

View File

@ -34,7 +34,7 @@ function gulpTraceur(options, resolveModuleName) {
if (sourceMap) {
var sourceMapFile = cloneFile(file, {
path: file.path.replace(/\.js$/, '.map'),
path: file.path.replace(/\.\w+$/, '.map'),
contents: JSON.stringify(sourceMap)
});

View File

@ -4,6 +4,7 @@ var fs = require('fs');
var glob = require('glob');
var path = require('path');
var traceur = require('traceur');
var assert = require('assert');
exports.RUNTIME_PATH = traceur.RUNTIME_PATH;
var TRACEUR_PATH = traceur.RUNTIME_PATH.replace('traceur-runtime.js', 'traceur.js');
@ -55,6 +56,11 @@ exports.compile = function compile(options, paths, source) {
result.sourceMap = JSON.parse(sourceMapString);
}
if (localOptions.outputLanguage === 'es6' && source.indexOf('$traceurRuntime') === -1) {
assert(result.js.indexOf('$traceurRuntime') === -1,
'Transpile to ES6 must not add references to $traceurRuntime, '
+ inputPath + ' is transpiled to:\n' + result.js);
}
return result;
};