feat(bundle): work-around rx.all.js bundle issue.

Adds long-stack-trace-zone into the dev build. Turn off source maps
until proper concatination of them is added.
This commit is contained in:
Rado Kirov 2015-04-02 19:53:11 -07:00
parent c0b04ca0bc
commit bcbed2812d
3 changed files with 62 additions and 43 deletions

View File

@ -30,7 +30,8 @@ var tsc = require('gulp-typescript');
var ts2dart = require('gulp-ts2dart'); var ts2dart = require('gulp-ts2dart');
var util = require('./tools/build/util'); var util = require('./tools/build/util');
var bundler = require('./tools/build/bundle'); var bundler = require('./tools/build/bundle');
var concat = require('gulp-concat'); var replace = require('gulp-replace');
var insert = require('gulp-insert');
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped. // Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
@ -809,14 +810,8 @@ gulp.task('bundle.js.prod', ['build.js.prod'], function() {
}); });
}); });
gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() {
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.js'])
.pipe(concat('angular2.js'))
.pipe(gulp.dest('dist/bundle'));
});
// minified production build // minified production build
// TODO: minify zone.js? // TODO: minify zone.js
gulp.task('bundle.js.min', ['build.js.prod'], function() { gulp.task('bundle.js.min', ['build.js.prod'], function() {
return bundler.bundle( return bundler.bundle(
bundleConfig, bundleConfig,
@ -828,12 +823,6 @@ gulp.task('bundle.js.min', ['build.js.prod'], function() {
}); });
}); });
gulp.task('bundle.js.min.deps', ['bundle.js.min'], function() {
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.min.js'])
.pipe(concat('angular2.min.js'))
.pipe(gulp.dest('dist/bundle'));
});
// development build // development build
gulp.task('bundle.js.dev', ['build.js.dev'], function() { gulp.task('bundle.js.dev', ['build.js.dev'], function() {
return bundler.bundle( return bundler.bundle(
@ -847,9 +836,23 @@ gulp.task('bundle.js.dev', ['build.js.dev'], function() {
}); });
}); });
gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() {
return bundler.modify(
['node_modules/zone.js/zone.js', 'dist/build/angular2.js'], 'angular2.js')
.pipe(gulp.dest('dist/bundle'));
});
gulp.task('bundle.js.min.deps', ['bundle.js.min'], function() {
return bundler.modify(
['node_modules/zone.js/zone.js', 'dist/build/angular2.min.js'], 'angular2.min.js')
.pipe(gulp.dest('dist/bundle'));
});
gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() { gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() {
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.dev.js']) return bundler.modify(
.pipe(concat('angular2.dev.js')) ['node_modules/zone.js/zone.js', 'node_modules/zone.js/long-stack-trace-zone.js', 'dist/build/angular2.dev.js'],
'angular2.dev.js')
.pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n'))
.pipe(gulp.dest('dist/bundle')); .pipe(gulp.dest('dist/bundle'));
}); });

View File

@ -26,14 +26,17 @@
}, },
"dependencies": { "dependencies": {
"es6-module-loader": "^0.9.2", "es6-module-loader": "^0.9.2",
"systemjs": "^0.9.1", "googleapis": "1.0.x",
"gulp-insert": "^0.4.0",
"gulp-modify": "0.0.4",
"gulp-replace": "^0.5.3",
"node-uuid": "1.4.x",
"rx": "2.4.6", "rx": "2.4.6",
"selenium-webdriver": "2.45.1",
"systemjs": "^0.9.1",
"traceur": "0.0.87", "traceur": "0.0.87",
"which": "~1", "which": "~1",
"zone.js": "0.4.2", "zone.js": "0.4.2"
"googleapis": "1.0.x",
"node-uuid": "1.4.x",
"selenium-webdriver": "2.45.1"
}, },
"devDependencies": { "devDependencies": {
"angular": "1.3.5", "angular": "1.3.5",

View File

@ -1,3 +1,8 @@
var gulp = require('gulp');
var concat = require('gulp-concat');
var replace = require('gulp-replace');
var insert = require('gulp-insert');
module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConfig){ module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConfig){
// loading it earlier interfers with custom traceur. // loading it earlier interfers with custom traceur.
var Builder = require('systemjs-builder'); var Builder = require('systemjs-builder');
@ -5,3 +10,11 @@ module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConf
builder.config(buildConfig); builder.config(buildConfig);
return builder.build(moduleName, outputFile, outputConfig); return builder.build(moduleName, outputFile, outputConfig);
} }
module.exports.modify = function(srcs, concatName) {
return gulp.src(srcs)
.pipe(concat(concatName))
.pipe(replace('use strict', '')) // remove after https://github.com/systemjs/builder/issues/123 is fixed.
.pipe(replace('sourceMappingURL', 'sourceMappingURLDisabled')) // TODO: add concat for sourceMaps
}