chore(build): Remove traceur from build.

This removes traceur from the compilation step in broccoli. Broccoli now
transpiles to es5 using the typescript compiler.
This commit is contained in:
Ian Riley 2015-08-17 13:44:31 -07:00 committed by Rado Kirov
parent df8e15cab7
commit b025f94351
3 changed files with 25 additions and 7 deletions

View File

@ -41,6 +41,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
this.tsOpts = Object.create(options); this.tsOpts = Object.create(options);
this.tsOpts.outDir = this.cachePath; this.tsOpts.outDir = this.cachePath;
this.tsOpts.target = (<any>ts).ScriptTarget[options.target]; this.tsOpts.target = (<any>ts).ScriptTarget[options.target];
this.tsOpts.module = (<any>ts).ModuleKind[options.module];
this.tsOpts.experimentalDecorators = true; this.tsOpts.experimentalDecorators = true;
this.rootFilePaths = options.rootFilePaths ? options.rootFilePaths.splice(0) : []; this.rootFilePaths = options.rootFilePaths ? options.rootFilePaths.splice(0) : [];
this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths, this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths,

View File

@ -84,6 +84,15 @@ module.exports = function makeBrowserTree(options, destinationPath) {
destDir: '/' destDir: '/'
}); });
var es5ModulesTree = new Funnel('modules', {
include: ['**/**'],
exclude: [
'**/*.cjs',
'benchmarks/e2e_test/**'
],
destDir: '/'
});
var scriptPathPatternReplacement = { var scriptPathPatternReplacement = {
match: '@@FILENAME_NO_EXT', match: '@@FILENAME_NO_EXT',
replacement: function(replacement, relativePath) { replacement: function(replacement, relativePath) {
@ -109,11 +118,19 @@ module.exports = function makeBrowserTree(options, destinationPath) {
target: 'ES6' target: 'ES6'
}); });
// Call Traceur to lower the ES6 build tree to ES5 // Use TypeScript to transpile the *.ts files to ES5
var es5Tree = transpileWithTraceur(es6Tree, { var es5Tree = compileWithTypescript(es5ModulesTree, {
destExtension: '.js', allowNonTsExtensions: false,
destSourceMapExtension: '.js.map', declaration: false,
traceurOptions: {modules: 'instantiate', sourceMaps: true} emitDecoratorMetadata: true,
experimentalDecorators: true,
mapRoot: '', // force sourcemaps to use relative path
module: 'System',
noEmitOnError: false,
rootDir: '.',
sourceMap: true,
sourceRoot: '.',
target: 'ES5'
}); });
// Now we add a few more files to the es6 tree that Traceur should not see // Now we add a few more files to the es6 tree that Traceur should not see

View File

@ -34,7 +34,7 @@ module.exports = function makeNodeTree(destinationPath) {
experimentalDecorators: true, experimentalDecorators: true,
declaration: false, declaration: false,
mapRoot: '', /* force sourcemaps to use relative path */ mapRoot: '', /* force sourcemaps to use relative path */
module: 'commonjs', module: 'CommonJS',
noEmitOnError: true, noEmitOnError: true,
rootDir: '.', rootDir: '.',
rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'], rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'],