diff --git a/gulpfile.js b/gulpfile.js
index 97066e0e1e..3c91ed3193 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -35,13 +35,14 @@ var _COMPILER_CONFIG_JS_DEFAULT = {
};
var _HTLM_DEFAULT_SCRIPTS_JS = [
- {src: '../../traceur-runtime.js', mimeType: 'text/javascript'},
- {src: '../../es6-module-loader-sans-promises.src.js', mimeType: 'text/javascript'},
- {src: '../../zone.js', mimeType: 'text/javascript'},
- {src: '../../long-stack-trace-zone.js', mimeType: 'text/javascript'},
- {src: '../../system.src.js', mimeType: 'text/javascript'},
- {src: '../../extension-register.js', mimeType: 'text/javascript'},
- {src: '../../runtime_paths.js', mimeType: 'text/javascript'},
+ {src: gulpTraceur.RUNTIME_PATH, mimeType: 'text/javascript', copy: true},
+ {src: 'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
+ mimeType: 'text/javascript', copy: true},
+ {src: 'node_modules/zone.js/zone.js', mimeType: 'text/javascript', copy: true},
+ {src: 'node_modules/zone.js/long-stack-trace-zone.js', mimeType: 'text/javascript', copy: true},
+ {src: 'node_modules/systemjs/dist/system.src.js', mimeType: 'text/javascript', copy: true},
+ {src: 'node_modules/systemjs/lib/extension-register.js', mimeType: 'text/javascript', copy: true},
+ {src: 'tools/build/snippets/runtime_paths.js', mimeType: 'text/javascript', copy: true},
{
inline: 'System.import(\'$MODULENAME$\').then(function(m) { m.main(); }, console.error.bind(console))',
mimeType: 'text/javascript'
@@ -87,18 +88,6 @@ var SRC_FOLDER_INSERTION = {
}
};
-var ES5_DEPS = [
- gulpTraceur.RUNTIME_PATH,
- 'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
- 'node_modules/systemjs/dist/system.src.js',
- 'node_modules/systemjs/lib/extension-register.js',
- 'node_modules/zone.js/zone.js',
- 'node_modules/zone.js/long-stack-trace-zone.js',
- 'tools/build/snippets/runtime_paths.js',
- 'tools/build/snippets/url_params_to_form.js',
- 'node_modules/angular/angular.js'
-];
-
var CONFIG = {
dest: {
js: {
@@ -194,26 +183,13 @@ var CONFIG = {
es6: {
src: ['tools/build/es5build.js'],
pipes: {}
- },
- es5: {
- src: ES5_DEPS,
- pipes: {}
}
},
prod: {
es6: {
src: ['tools/build/es5build.js'],
pipes: {}
- },
- es5: {
- src: ES5_DEPS,
- pipes: {}
}
- },
- dart2js: {
- src: ['tools/build/snippets/url_params_to_form.js'],
- exclude: ['rtts_assert/'],
- pipes: {}
}
},
dart: {
@@ -232,19 +208,19 @@ var CONFIG = {
'**': _HTLM_DEFAULT_SCRIPTS_JS,
'benchmarks/**':
[
- { src: '../../url_params_to_form.js', mimeType: 'text/javascript' }
+ { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true }
].concat(_HTLM_DEFAULT_SCRIPTS_JS),
'benchmarks_external/**':
[
- { src: '../../angular.js', mimeType: 'text/javascript' },
- { src: '../../url_params_to_form.js', mimeType: 'text/javascript' }
+ { src: 'node_modules/angular/angular.js', mimeType: 'text/javascript', copy: true },
+ { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true }
].concat(_HTLM_DEFAULT_SCRIPTS_JS)
},
dart: {
'**': _HTML_DEFAULT_SCRIPTS_DART,
'benchmarks*/**':
[
- { src: '../../url_params_to_form.js', mimeType: 'text/javascript' }
+ { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true }
].concat(_HTML_DEFAULT_SCRIPTS_DART)
}
}
@@ -407,13 +383,6 @@ gulp.task('build/multicopy.js.dev.es6', copy.multicopy(gulp, gulpPlugins, {
dest: CONFIG.dest.js.dev.es6
}));
-gulp.task('build/multicopy.js.dev.es5', copy.multicopy(gulp, gulpPlugins, {
- src: CONFIG.multicopy.js.dev.es5.src,
- pipes: CONFIG.multicopy.js.dev.es5.pipes,
- exclude: CONFIG.multicopy.js.dev.es5.exclude,
- dest: CONFIG.dest.js.dev.es5
-}));
-
gulp.task('build/multicopy.js.prod.es6', copy.multicopy(gulp, gulpPlugins, {
src: CONFIG.multicopy.js.prod.es6.src,
pipes: CONFIG.multicopy.js.prod.es6.pipes,
@@ -421,13 +390,6 @@ gulp.task('build/multicopy.js.prod.es6', copy.multicopy(gulp, gulpPlugins, {
dest: CONFIG.dest.js.prod.es6
}));
-gulp.task('build/multicopy.js.prod.es5', copy.multicopy(gulp, gulpPlugins, {
- src: CONFIG.multicopy.js.prod.es5.src,
- pipes: CONFIG.multicopy.js.prod.es5.pipes,
- exclude: CONFIG.multicopy.js.prod.es5.exclude,
- dest: CONFIG.dest.js.prod.es5
-}));
-
gulp.task('build/multicopy.dart', copy.multicopy(gulp, gulpPlugins, {
src: CONFIG.multicopy.dart.src,
pipes: CONFIG.multicopy.dart.pipes,
@@ -435,14 +397,6 @@ gulp.task('build/multicopy.dart', copy.multicopy(gulp, gulpPlugins, {
dest: CONFIG.dest.dart
}));
-gulp.task('build/multicopy.js.dart2js', copy.multicopy(gulp, gulpPlugins, {
- src: CONFIG.multicopy.js.dart2js.src,
- pipes: CONFIG.multicopy.js.dart2js.pipes,
- exclude: CONFIG.multicopy.js.dart2js.exclude,
- dest: CONFIG.dest.js.dart2js
-}));
-
-
// ------------
// pubspec
@@ -640,23 +594,20 @@ gulp.task('build.dart', function(done) {
'build/packages.dart',
'build/analyze.dart',
'build/pubbuild.dart',
- // Note: pubbuild.dart will clear the dart2js folder, so we need to copy
- // our files after this :-(
- 'build/multicopy.js.dart2js',
done
);
});
gulp.task('build.js.dev', function(done) {
runSequence(
- ['build/transpile.js.dev', 'build/html.js.dev', 'build/copy.js.dev', 'build/multicopy.js.dev.es6', 'build/multicopy.js.dev.es5'],
+ ['build/transpile.js.dev', 'build/html.js.dev', 'build/copy.js.dev', 'build/multicopy.js.dev.es6'],
done
);
});
gulp.task('build.js.prod', function(done) {
runSequence(
- ['build/transpile.js.prod', 'build/html.js.prod', 'build/copy.js.prod', 'build/multicopy.js.prod.es6', 'build/multicopy.js.prod.es5'],
+ ['build/transpile.js.prod', 'build/html.js.prod', 'build/copy.js.prod', 'build/multicopy.js.prod.es6'],
done
);
});
diff --git a/package.json b/package.json
index 3f4ee20984..1b62ce1c22 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
"selenium-webdriver": "2.x.x"
},
"devDependencies": {
- "temp": "^0.8.1",
"angular": "1.3.5",
"bower": "^1.3.12",
"canonical-path": "0.0.2",
@@ -68,8 +67,10 @@
"run-sequence": "^0.3.6",
"source-map": "^0.3.0",
"sprintf-js": "1.0.*",
+ "temp": "^0.8.1",
"ternary-stream": "^1.2.3",
"through2": "^0.6.1",
+ "vinyl": "^0.4.6",
"yargs": "2.3.*"
}
}
diff --git a/tools/build/html.js b/tools/build/html.js
index 61c9f12419..d41a2bf280 100644
--- a/tools/build/html.js
+++ b/tools/build/html.js
@@ -2,6 +2,8 @@ var util = require('./util');
var file2moduleName = require('./file2modulename');
var through2 = require('through2');
var path = require('path');
+var fs = require('fs');
+var VinylFile = require('vinyl');
module.exports = function(gulp, plugins, config) {
return function() {
@@ -11,10 +13,21 @@ module.exports = function(gulp, plugins, config) {
var fileName = file.relative;
var moduleName = file2moduleName(fileName);
var moduleNameWithoutPath = path.basename(moduleName);
+ var self = this;
var scripts = util.filterByFile(config.scriptsPerFolder, fileName).map(function(script) {
var scriptTag;
- if (script.src) {
- scriptTag = '';
+ var scriptSrc = script.src;
+ if (script.copy) {
+ scriptSrc = path.basename(script.src);
+ self.push(new VinylFile({
+ cwd: file.cwd,
+ base: file.base,
+ path: path.join(path.dirname(file.path), scriptSrc),
+ contents: fs.readFileSync(script.src)
+ }));
+ };
+ if (scriptSrc) {
+ scriptTag = '';
} else {
scriptTag = '';
}