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 util = require('./tools/build/util');
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.
@ -801,56 +802,58 @@ var bundleConfig = {
// production build
gulp.task('bundle.js.prod', ['build.js.prod'], function() {
return bundler.bundle(
bundleConfig,
'angular2/angular2',
'./dist/build/angular2.js',
{
sourceMaps: true
});
});
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'));
bundleConfig,
'angular2/angular2',
'./dist/build/angular2.js',
{
sourceMaps: true
});
});
// minified production build
// TODO: minify zone.js?
// TODO: minify zone.js
gulp.task('bundle.js.min', ['build.js.prod'], function() {
return bundler.bundle(
bundleConfig,
'angular2/angular2',
'./dist/build/angular2.min.js',
{
sourceMaps: true,
minify: true
});
});
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'));
bundleConfig,
'angular2/angular2',
'./dist/build/angular2.min.js',
{
sourceMaps: true,
minify: true
});
});
// development build
gulp.task('bundle.js.dev', ['build.js.dev'], function() {
return bundler.bundle(
merge(true, bundleConfig, {
"*": "dist/js/dev/es6/*.es6"
}),
'angular2/angular2',
'./dist/build/angular2.dev.js',
{
sourceMaps: true
});
merge(true, bundleConfig, {
"*": "dist/js/dev/es6/*.es6"
}),
'angular2/angular2',
'./dist/build/angular2.dev.js',
{
sourceMaps: true
});
});
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() {
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.dev.js'])
.pipe(concat('angular2.dev.js'))
.pipe(gulp.dest('dist/bundle'));
return bundler.modify(
['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'));
});
gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundle.js.deps']);

View File

@ -26,14 +26,17 @@
},
"dependencies": {
"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",
"selenium-webdriver": "2.45.1",
"systemjs": "^0.9.1",
"traceur": "0.0.87",
"which": "~1",
"zone.js": "0.4.2",
"googleapis": "1.0.x",
"node-uuid": "1.4.x",
"selenium-webdriver": "2.45.1"
"zone.js": "0.4.2"
},
"devDependencies": {
"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){
// loading it earlier interfers with custom traceur.
var Builder = require('systemjs-builder');
@ -5,3 +10,11 @@ module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConf
builder.config(buildConfig);
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
}