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:
@ -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)
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user