feat(core): import AsyncStackTaggingZone if available (#46693)

Import `AsyncStackTaggingZoneSpec` if the user imported
`zone.js/plugins/async-stack-tagging` bundle. So the user can
use `console.trace` to output the `async task` information more
clearly.

PR Close #46693
This commit is contained in:
JiaLiPassion 2022-07-04 16:53:57 +09:00 committed by Jessica Janiuk
parent 848a00956e
commit 19e6d9ccd3
3 changed files with 10 additions and 5 deletions

View file

@ -12,7 +12,7 @@
"aio-local": {
"uncompressed": {
"runtime": 4325,
"main": 459842,
"main": 460353,
"polyfills": 33922,
"styles": 73640,
"light-theme": 78276,

View file

@ -2,7 +2,7 @@
"cli-hello-world": {
"uncompressed": {
"runtime": 1083,
"main": 125325,
"main": 125830,
"polyfills": 33824
}
},
@ -19,14 +19,14 @@
"cli-hello-world-ivy-compat": {
"uncompressed": {
"runtime": 1102,
"main": 132311,
"main": 132816,
"polyfills": 33957
}
},
"cli-hello-world-ivy-i18n": {
"uncompressed": {
"runtime": 926,
"main": 124982,
"main": 125487,
"polyfills": 35252
}
},
@ -55,7 +55,7 @@
"standalone-bootstrap": {
"uncompressed": {
"runtime": 1090,
"main": 83013,
"main": 83515,
"polyfills": 33945
}
},

View file

@ -138,6 +138,11 @@ export class NgZone {
self._outer = self._inner = Zone.current;
if ((Zone as any)['AsyncStackTaggingZoneSpec']) {
const AsyncStackTaggingZoneSpec = (Zone as any)['AsyncStackTaggingZoneSpec'];
self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
}
if ((Zone as any)['TaskTrackingZoneSpec']) {
self._inner = self._inner.fork(new ((Zone as any)['TaskTrackingZoneSpec'] as any));
}