refactor(NgZone): use zone.js v0.5 from npm

This commit is contained in:
Victor Berchet 2015-05-12 09:47:17 +02:00
parent e11c20541a
commit c8a0ed40bd
8 changed files with 74 additions and 2081 deletions

View File

@ -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')

View File

@ -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',

View File

@ -9483,7 +9483,7 @@
}
},
"zone.js": {
"version": "0.4.4"
"version": "0.5.0"
}
},
"name": "angular",

112
npm-shrinkwrap.json generated
View File

@ -5793,108 +5793,108 @@
},
"gulp-clang-format": {
"version": "1.0.12",
"from": "gulp-clang-format@1.0.12",
"from": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.12.tgz",
"resolved": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.12.tgz",
"dependencies": {
"gulp-util": {
"version": "3.0.4",
"from": "gulp-util@>=3.0.4 <4.0.0",
"from": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz",
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz",
"dependencies": {
"array-differ": {
"version": "1.0.0",
"from": "array-differ@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz"
},
"array-uniq": {
"version": "1.0.2",
"from": "array-uniq@>=1.0.2 <2.0.0",
"from": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz"
},
"beeper": {
"version": "1.0.0",
"from": "beeper@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz"
},
"chalk": {
"version": "1.0.0",
"from": "chalk@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz",
"dependencies": {
"ansi-styles": {
"version": "2.0.1",
"from": "ansi-styles@>=2.0.1 <3.0.0",
"from": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz"
},
"escape-string-regexp": {
"version": "1.0.3",
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
"from": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz"
},
"has-ansi": {
"version": "1.0.3",
"from": "has-ansi@>=1.0.3 <2.0.0",
"from": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "ansi-regex@>=1.1.0 <2.0.0",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
},
"get-stdin": {
"version": "4.0.1",
"from": "get-stdin@>=4.0.1 <5.0.0",
"from": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
}
}
},
"strip-ansi": {
"version": "2.0.1",
"from": "strip-ansi@>=2.0.1 <3.0.0",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "1.1.1",
"from": "ansi-regex@>=1.1.0 <2.0.0",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz"
}
}
},
"supports-color": {
"version": "1.3.1",
"from": "supports-color@>=1.3.0 <2.0.0",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz"
}
}
},
"dateformat": {
"version": "1.0.11",
"from": "dateformat@>=1.0.11 <2.0.0",
"from": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz",
"dependencies": {
"get-stdin": {
"version": "4.0.1",
"from": "get-stdin@*",
"from": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
},
"meow": {
"version": "3.1.0",
"from": "meow@*",
"from": "https://registry.npmjs.org/meow/-/meow-3.1.0.tgz",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.1.0.tgz",
"dependencies": {
"camelcase-keys": {
"version": "1.0.0",
"from": "camelcase-keys@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz",
"dependencies": {
"camelcase": {
"version": "1.0.2",
"from": "camelcase@>=1.0.1 <2.0.0",
"from": "https://registry.npmjs.org/camelcase/-/camelcase-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.0.2.tgz"
},
"map-obj": {
"version": "1.0.1",
"from": "map-obj@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz"
}
}
@ -5905,116 +5905,116 @@
},
"lodash._reescape": {
"version": "3.0.0",
"from": "lodash._reescape@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz"
},
"lodash._reevaluate": {
"version": "3.0.0",
"from": "lodash._reevaluate@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz"
},
"lodash._reinterpolate": {
"version": "3.0.0",
"from": "lodash._reinterpolate@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz"
},
"lodash.template": {
"version": "3.5.1",
"from": "lodash.template@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.5.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.5.1.tgz",
"dependencies": {
"lodash._basecopy": {
"version": "3.0.1",
"from": "lodash._basecopy@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz"
},
"lodash._basetostring": {
"version": "3.0.0",
"from": "lodash._basetostring@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz"
},
"lodash._basevalues": {
"version": "3.0.0",
"from": "lodash._basevalues@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz"
},
"lodash._isiterateecall": {
"version": "3.0.7",
"from": "lodash._isiterateecall@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.7.tgz",
"resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.7.tgz"
},
"lodash.escape": {
"version": "3.0.0",
"from": "lodash.escape@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.0.0.tgz"
},
"lodash.isnative": {
"version": "3.0.2",
"from": "lodash.isnative@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.isnative/-/lodash.isnative-3.0.2.tgz",
"resolved": "https://registry.npmjs.org/lodash.isnative/-/lodash.isnative-3.0.2.tgz"
},
"lodash.keys": {
"version": "3.0.7",
"from": "lodash.keys@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.0.7.tgz",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.0.7.tgz",
"dependencies": {
"lodash.isarguments": {
"version": "3.0.2",
"from": "lodash.isarguments@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.0.2.tgz",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.0.2.tgz"
},
"lodash.isarray": {
"version": "3.0.2",
"from": "lodash.isarray@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.2.tgz",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.2.tgz"
}
}
},
"lodash.restparam": {
"version": "3.6.1",
"from": "lodash.restparam@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz"
},
"lodash.templatesettings": {
"version": "3.1.0",
"from": "lodash.templatesettings@>=3.0.0 <4.0.0",
"from": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.0.tgz",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.0.tgz"
}
}
},
"multipipe": {
"version": "0.1.2",
"from": "multipipe@>=0.1.2 <0.2.0",
"from": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"dependencies": {
"duplexer2": {
"version": "0.0.2",
"from": "duplexer2@0.0.2",
"from": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"dependencies": {
"readable-stream": {
"version": "1.1.13",
"from": "readable-stream@>=1.1.9 <1.2.0",
"from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
@ -6025,44 +6025,44 @@
},
"object-assign": {
"version": "2.0.0",
"from": "object-assign@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz"
},
"replace-ext": {
"version": "0.0.1",
"from": "replace-ext@0.0.1",
"from": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz"
}
}
},
"stream-equal": {
"version": "0.1.5",
"from": "stream-equal@>=0.1.5 <0.2.0",
"from": "https://registry.npmjs.org/stream-equal/-/stream-equal-0.1.5.tgz",
"resolved": "https://registry.npmjs.org/stream-equal/-/stream-equal-0.1.5.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.2 <1.1.0",
"from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
@ -6071,7 +6071,7 @@
},
"clang-format": {
"version": "1.0.12",
"from": "clang-format@>=1.0.12 <2.0.0",
"from": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.12.tgz",
"resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.12.tgz"
}
}
@ -13436,7 +13436,7 @@
},
"mime": {
"version": "1.2.11",
"from": "mime@>=1.2.9 <1.3.0",
"from": "mime@>=1.2.11 <1.3.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
},
"mimeparse": {
@ -13989,7 +13989,7 @@
},
"node-uuid": {
"version": "1.4.3",
"from": "node-uuid@>=1.4.0 <1.5.0",
"from": "node-uuid@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.3.tgz"
},
"async": {
@ -14660,9 +14660,9 @@
}
},
"zone.js": {
"version": "0.4.4",
"from": "https://registry.npmjs.org/zone.js/-/zone.js-0.4.4.tgz",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.4.4.tgz"
"version": "0.5.0",
"from": "zone.js@0.5.0",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.5.0.tgz"
}
}
}

View File

@ -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",

View File

@ -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',

View File

@ -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