refactor(NgZone): use zone.js v0.5 from npm
This commit is contained in:
+11
-7
@@ -752,19 +752,23 @@ gulp.task('bundle.js.sfx.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'));
|
||||
['node_modules/zone.js/dist/zone-microtask.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'));
|
||||
['node_modules/zone.js/dist/zone-microtask.js', 'dist/build/angular2.min.js'],
|
||||
'angular2.min.js'
|
||||
).pipe(gulp.dest('dist/bundle'));
|
||||
});
|
||||
|
||||
var JS_DEV_DEPS = ['node_modules/zone.js/zone.js',
|
||||
'node_modules/zone.js/long-stack-trace-zone.js',
|
||||
'node_modules/reflect-metadata/Reflect.js'];
|
||||
var JS_DEV_DEPS = [
|
||||
'node_modules/zone.js/dist/zone-microtask.js',
|
||||
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
||||
'node_modules/reflect-metadata/Reflect.js'
|
||||
];
|
||||
|
||||
gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() {
|
||||
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js')
|
||||
|
||||
+3
-2
@@ -12,8 +12,9 @@ module.exports = function(config) {
|
||||
// Loaded through the es6-module-loader, in `test-main.js`.
|
||||
{pattern: 'dist/js/dev/es5/**', included: false, watched: false},
|
||||
|
||||
'zone/zone-microtask.js',
|
||||
'zone/long-stack-trace-zone.js',
|
||||
// zone-microtask must be included first as it contains a Promise monkey patch
|
||||
'node_modules/zone.js/dist/zone-microtask.js',
|
||||
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
||||
|
||||
'node_modules/traceur/bin/traceur-runtime.js',
|
||||
'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
|
||||
|
||||
@@ -9483,7 +9483,7 @@
|
||||
}
|
||||
},
|
||||
"zone.js": {
|
||||
"version": "0.4.4"
|
||||
"version": "0.5.0"
|
||||
}
|
||||
},
|
||||
"name": "angular",
|
||||
|
||||
Generated
+56
-56
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -36,7 +36,7 @@
|
||||
"systemjs": "^0.9.1",
|
||||
"traceur": "0.0.87",
|
||||
"which": "~1",
|
||||
"zone.js": "0.4.4"
|
||||
"zone.js": "0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular": "1.3.5",
|
||||
|
||||
@@ -78,8 +78,8 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||
|
||||
var vendorScriptsTree = flatten(new Funnel('.', {
|
||||
files: [
|
||||
'zone/zone-microtask.js',
|
||||
'zone/long-stack-trace-zone.js',
|
||||
'node_modules/zone.js/dist/zone-microtask.js',
|
||||
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
||||
'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',
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Wrapped stacktrace
|
||||
*
|
||||
* We need this because in some implementations, constructing a trace is slow
|
||||
* and so we want to defer accessing the trace for as long as possible
|
||||
*/
|
||||
Zone.Stacktrace = function (e) {
|
||||
this._e = e;
|
||||
};
|
||||
Zone.Stacktrace.prototype.get = function () {
|
||||
if (zone.stackFramesFilter) {
|
||||
return this._e.stack.
|
||||
split('\n').
|
||||
filter(zone.stackFramesFilter).
|
||||
join('\n');
|
||||
}
|
||||
return this._e.stack;
|
||||
}
|
||||
|
||||
Zone.getStacktrace = function () {
|
||||
function getStacktraceWithUncaughtError () {
|
||||
return new Zone.Stacktrace(new Error());
|
||||
}
|
||||
|
||||
function getStacktraceWithCaughtError () {
|
||||
try {
|
||||
throw new Error();
|
||||
} catch (e) {
|
||||
return new Zone.Stacktrace(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Some implementations of exception handling don't create a stack trace if the exception
|
||||
// isn't thrown, however it's faster not to actually throw the exception.
|
||||
var stack = getStacktraceWithUncaughtError();
|
||||
if (stack && stack._e.stack) {
|
||||
Zone.getStacktrace = getStacktraceWithUncaughtError;
|
||||
return stack;
|
||||
} else {
|
||||
Zone.getStacktrace = getStacktraceWithCaughtError;
|
||||
return Zone.getStacktrace();
|
||||
}
|
||||
};
|
||||
|
||||
Zone.longStackTraceZone = {
|
||||
getLongStacktrace: function (exception) {
|
||||
var trace = [];
|
||||
var zone = this;
|
||||
if (exception) {
|
||||
if (zone.stackFramesFilter) {
|
||||
trace.push(exception.stack.split('\n').
|
||||
filter(zone.stackFramesFilter).
|
||||
join('\n'));
|
||||
} else {
|
||||
trace.push(exception.stack);
|
||||
}
|
||||
}
|
||||
var now = Date.now();
|
||||
while (zone && zone.constructedAtException) {
|
||||
trace.push(
|
||||
'--- ' + (Date(zone.constructedAtTime)).toString() +
|
||||
' - ' + (now - zone.constructedAtTime) + 'ms ago',
|
||||
zone.constructedAtException.get());
|
||||
zone = zone.parent;
|
||||
}
|
||||
return trace.join('\n');
|
||||
},
|
||||
|
||||
stackFramesFilter: function (line) {
|
||||
return line.indexOf('zone.js') === -1;
|
||||
},
|
||||
|
||||
onError: function (exception) {
|
||||
var reporter = this.reporter || console.log.bind(console);
|
||||
reporter(exception.toString());
|
||||
reporter(this.getLongStacktrace(exception));
|
||||
},
|
||||
|
||||
fork: function (locals) {
|
||||
var newZone = this._fork(locals);
|
||||
newZone.constructedAtException = Zone.getStacktrace();
|
||||
newZone.constructedAtTime = Date.now();
|
||||
return newZone;
|
||||
},
|
||||
|
||||
_fork: zone.fork
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user