diff --git a/.gitmodules b/.gitmodules index 0da44a23f6..a5db2dc3bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "tools/rtts-assert"] path = tools/rtts-assert url = git@github.com:angular/assert.git -[submodule "tools/traceur"] - path = tools/traceur - url = git@github.com:google/traceur-compiler.git diff --git a/gulpfile.js b/gulpfile.js index 007242932a..597ab31cae 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,11 +10,11 @@ var glob = require('glob'); var ejs = require('gulp-ejs'); var path = require('path'); -// import js2dart and traceur build tasks +// import js2dart build tasks var js2dartTasks = require('./tools/js2dart/gulp-tasks'); js2dartTasks.install(gulp); -var traceurJsOptions = { +var js2es5Options = { annotations: true, // parse annotations types: true, // parse types script: false, // parse as a module @@ -24,15 +24,39 @@ var traceurJsOptions = { moduleName: true }; +var js2dartOptions = { + annotations: true, // parse annotations + types: true, // parse types + script: false, // parse as a module + outputLanguage: 'dart', + moduleName: true +}; + var traceur = require('./tools/js2dart/gulp-traceur'); -var js2dart = require('./tools/js2dart/gulp-js2dart'); + +// --------- +// rtts-assert and traceur runtime + +gulp.task('jsRuntime/build', function() { + return jsRuntime(false); +}); + +function jsRuntime(isWatch) { + var srcFn = isWatch ? watch : gulp.src.bind(gulp); + var rttsAssert = srcFn('tools/rtts-assert/src/assert.js') + .pipe(traceur(js2es5Options)) + .pipe(gulp.dest('build/js')); + var traceurRuntime = srcFn('tools/js2dart/node_modules/traceur/bin/traceur-runtime.js') + .pipe(gulp.dest('build/js')); + return mergeStreams(rttsAssert, traceurRuntime); +} // ----------------------- // modules var sourceTypeConfigs = { dart: { compiler: function() { - return js2dart({replace: true}); + return traceur(js2dartOptions, true); }, transpileSrc: ['modules/**/*.es6d'], htmlSrc: ['modules/*/src/**/*.html'], @@ -43,11 +67,11 @@ var sourceTypeConfigs = { }, js: { compiler: function() { - return traceur(traceurJsOptions); + return traceur(js2es5Options, true); }, - transpileSrc: ['modules/**/*.es*', 'tools/rtts-assert/src/assert.js'], + transpileSrc: ['modules/**/*.es*'], htmlSrc: ['modules/*/src/**/*.html'], - copySrc: ['tools/traceur/bin/traceur-runtime.js'], + copySrc: ['modules/**/*.js'], outputDir: 'build/js', outputExt: 'js' } @@ -102,37 +126,28 @@ gulp.task('serve', connect.server({ // -------------- // general targets -gulp.task('clean', function(done) { - return runSequence(['traceur/clean', 'js2dart/clean', 'modules/clean'], done); -}); +gulp.task('clean', ['js2dart/clean', 'modules/clean']); gulp.task('build', function() { return runSequence( // sequential - 'traceur/build', 'js2dart/build', + 'js2dart/build', // parallel - ['modules/build.dart', 'modules/build.js'] + ['jsRuntime/build', 'modules/build.dart', 'modules/build.js'] ); }); gulp.task('watch', function() { - var traceurWatch = watch(js2dartTasks.paths.traceurSrc, function(_, done) { - runSequence( - // sequential - 'traceur/build', 'js2dart/build', 'js2dart/test', - // parallel - ['modules/build.dart', 'modules/build.js'], - done); - }); + runSequence('js2dart/test/watch'); var js2dartWatch = watch(js2dartTasks.paths.js2dartSrc, function(_, done) { runSequence( // sequential 'js2dart/build', 'js2dart/test', // parallel - ['modules/build.dart', 'modules/build.js'], + ['jsRuntime/build', 'modules/build.dart', 'modules/build.js'], done); }); var dartModuleWatch = createModuleTask(sourceTypeConfigs.dart, true)(); var jsModuleWatch = createModuleTask(sourceTypeConfigs.js, true)(); - return mergeStreams(traceurWatch, js2dartWatch, dartModuleWatch, jsModuleWatch); + return mergeStreams(js2dartWatch, dartModuleWatch, jsModuleWatch, jsRuntime(true)); }); diff --git a/modules/core/src/compiler/compiler.es6d b/modules/core/src/compiler/compiler.es6d index 3ebc08fbe1..32089af724 100644 --- a/modules/core/src/compiler/compiler.es6d +++ b/modules/core/src/compiler/compiler.es6d @@ -4,13 +4,13 @@ import {ProtoView} from './proto_view'; export class Compiler { /** * # Why future? - * - compilation will load templates. Instantiating views before templates are loaded will + * - compilation will load templates. Instantiating views before templates are loaded will * complicate the Directive code. BENEFIT: view instantiation become synchrnous. * # Why result that is independent of injector? * - don't know about injector in deserialization * - compile does not need the injector, only the ViewFactory does */ - @of(ProtoView) Future compile(TemplateElement element) { + @of(ProtoView) compile(element:TemplateElement):Future { } } \ No newline at end of file diff --git a/modules/core/src/compiler/proto_view.es6d b/modules/core/src/compiler/proto_view.es6d deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/core/src/facade.dart b/modules/core/src/facade.dart deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/core/src/facade.es6 b/modules/core/src/facade.es6 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/examples/src/todo/app.es6d b/modules/examples/src/todo/app.es6d index d4e594239d..c51bf74975 100644 --- a/modules/examples/src/todo/app.es6d +++ b/modules/examples/src/todo/app.es6d @@ -13,5 +13,6 @@ export class App { var html = DOM.getInnerHTML(this.list); html += '
  • '+this.input.value+'
  • '; DOM.setInnerHTML(this.list, html); + this.input.value = ''; } } diff --git a/modules/examples/src/todo/index.html b/modules/examples/src/todo/index.html index 71b1c6a9fe..62023f7dd5 100644 --- a/modules/examples/src/todo/index.html +++ b/modules/examples/src/todo/index.html @@ -8,13 +8,13 @@ <% if(type === 'dart') { %> <% } else { %> - - + + + - + + <% } %> \ No newline at end of file diff --git a/modules/examples/src/todo/main.js b/modules/examples/src/todo/main.js new file mode 100644 index 0000000000..4cfc7e3fa9 --- /dev/null +++ b/modules/examples/src/todo/main.js @@ -0,0 +1 @@ +new (System.get("examples/src/todo/app").App)().run(); diff --git a/postinstall.sh b/postinstall.sh index 3ce07b44f0..13d054afe6 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -1,12 +1,7 @@ #! /bin/sh git submodule init && git submodule update -rm node_modules/traceur -ln -s ../tools/traceur node_modules/traceur - rm node_modules/js2dart ln -s ../tools/js2dart node_modules/js2dart -(cd tools/traceur; npm install) - (cd tools/js2dart; npm install) diff --git a/tools/js2dart b/tools/js2dart index 3f5e00b6be..19b058e6f4 160000 --- a/tools/js2dart +++ b/tools/js2dart @@ -1 +1 @@ -Subproject commit 3f5e00b6be9ba8c2920732a08e2eb113f1485631 +Subproject commit 19b058e6f45325999cc55a4ba1cb670e8431cd89 diff --git a/tools/traceur b/tools/traceur deleted file mode 160000 index 573ac4091b..0000000000 --- a/tools/traceur +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 573ac4091b79167532ef929993e82fda96325718