feat(core): drop support for zone.js 0.10.x (#40823)
With this change we drop support for zone.js 0.10.x. This is needed because in version 12 the CLI will only work with `~0.11.4`. See angular/angular-cli#20034. BREAKING CHANGE: Minimum supported `zone.js` version is `0.11.4` PR Close #40823
This commit is contained in:
parent
c362205882
commit
aaf9b31fb4
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
// import zone.js from npm here because integration test will load zone.js
|
// import zone.js from npm here because integration test will load zone.js
|
||||||
// from built npm_package instead of source
|
// from built npm_package instead of source
|
||||||
import 'zone.js/dist/zone-node';
|
import 'zone.js/node';
|
||||||
import 'zone.js/dist/zone-testing';
|
import 'zone.js/testing';
|
||||||
// Only needed to satisfy the check in core/src/util/decorators.ts
|
// Only needed to satisfy the check in core/src/util/decorators.ts
|
||||||
// TODO(alexeagle): maybe remove that check?
|
// TODO(alexeagle): maybe remove that check?
|
||||||
require('reflect-metadata');
|
require('reflect-metadata');
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"rxjs": "^6.5.3",
|
"rxjs": "^6.5.3",
|
||||||
"zone.js": "^0.10.2 || ^0.11.3"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -199,7 +199,7 @@ export class Testability implements PublicTestability {
|
||||||
if (updateCb && !this.taskTrackingZone) {
|
if (updateCb && !this.taskTrackingZone) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Task tracking zone is required when passing an update callback to ' +
|
'Task tracking zone is required when passing an update callback to ' +
|
||||||
'whenStable(). Is "zone.js/dist/task-tracking.js" loaded?');
|
'whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
|
||||||
}
|
}
|
||||||
// These arguments are 'Function' above to keep the public API simple.
|
// These arguments are 'Function' above to keep the public API simple.
|
||||||
this.addCallback(doneCb as DoneCallback, timeout, updateCb as UpdateCallback);
|
this.addCallback(doneCb as DoneCallback, timeout, updateCb as UpdateCallback);
|
||||||
|
|
|
@ -28,7 +28,7 @@ export function waitForAsync(fn: Function): (done: any) => any {
|
||||||
return function() {
|
return function() {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
'Zone is needed for the waitForAsync() test helper but could not be found. ' +
|
'Zone is needed for the waitForAsync() test helper but could not be found. ' +
|
||||||
'Please make sure that your environment includes zone.js/dist/zone.js');
|
'Please make sure that your environment includes zone.js');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const asyncTest = _Zone && _Zone[_Zone.__symbol__('asyncTest')];
|
const asyncTest = _Zone && _Zone[_Zone.__symbol__('asyncTest')];
|
||||||
|
@ -38,7 +38,7 @@ export function waitForAsync(fn: Function): (done: any) => any {
|
||||||
return function() {
|
return function() {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
'zone-testing.js is needed for the async() test helper but could not be found. ' +
|
'zone-testing.js is needed for the async() test helper but could not be found. ' +
|
||||||
'Please make sure that your environment includes zone.js/dist/zone-testing.js');
|
'Please make sure that your environment includes zone.js/testing');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ const fakeAsyncTestModule = _Zone && _Zone[_Zone.__symbol__('fakeAsyncTest')];
|
||||||
|
|
||||||
const fakeAsyncTestModuleNotLoadedErrorMessage =
|
const fakeAsyncTestModuleNotLoadedErrorMessage =
|
||||||
`zone-testing.js is needed for the fakeAsync() test helper but could not be found.
|
`zone-testing.js is needed for the fakeAsync() test helper but could not be found.
|
||||||
Please make sure that your environment includes zone.js/dist/zone-testing.js`;
|
Please make sure that your environment includes zone.js/testing`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the shared fake async zone for a test.
|
* Clears out the shared fake async zone for a test.
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('ng-add schematic', () => {
|
||||||
`/***************************************************************************************************
|
`/***************************************************************************************************
|
||||||
* Zone JS is required by default for Angular itself.
|
* Zone JS is required by default for Angular itself.
|
||||||
*/
|
*/
|
||||||
import 'zone.js/dist/zone';`;
|
import 'zone.js';`;
|
||||||
const mainServerContent = `import { enableProdMode } from '@angular/core';
|
const mainServerContent = `import { enableProdMode } from '@angular/core';
|
||||||
import { environment } from './environments/environment';
|
import { environment } from './environments/environment';
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
|
|
|
@ -85,12 +85,12 @@ you can do like this.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
<script src="../dist/zone.js"></script>
|
<script src="../bundles/zone.umd.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
- Error
|
- Error
|
||||||
|
|
||||||
By default, `zone.js/dist/zone-error` will not be loaded for performance concern.
|
By default, `zone.js/plugins/zone-error` will not be loaded for performance concern.
|
||||||
This package will provide following functionality.
|
This package will provide following functionality.
|
||||||
|
|
||||||
1. Error inherit: handle `extend Error` issue.
|
1. Error inherit: handle `extend Error` issue.
|
||||||
|
@ -125,13 +125,13 @@ This package will provide following functionality.
|
||||||
The second feature will slow down the `Error` performance, so `zone.js` provide a flag to let you be able to control the behavior.
|
The second feature will slow down the `Error` performance, so `zone.js` provide a flag to let you be able to control the behavior.
|
||||||
The flag is `__Zone_Error_ZoneJsInternalStackFrames_policy`. And the available options is:
|
The flag is `__Zone_Error_ZoneJsInternalStackFrames_policy`. And the available options is:
|
||||||
|
|
||||||
1. default: this is the default one, if you load `zone.js/dist/zone-error` without
|
1. default: this is the default one, if you load `zone.js/plugins/zone-error` without
|
||||||
setting the flag, `default` will be used, and `ZoneJsInternalStackFrames` will be available
|
setting the flag, `default` will be used, and `ZoneJsInternalStackFrames` will be available
|
||||||
when `new Error()`, you can get a `error.stack` which is `zone stack free`. But this
|
when `new Error()`, you can get a `error.stack` which is `zone stack free`. But this
|
||||||
will slow down `new Error()` a little bit.
|
will slow down `new Error()` a little bit.
|
||||||
|
|
||||||
2. disable: this will disable `ZoneJsInternalStackFrames` feature, and if you load
|
2. disable: this will disable `ZoneJsInternalStackFrames` feature, and if you load
|
||||||
`zone.js/dist/zone-error`, you will only get a `wrapped Error` which can handle
|
`zone.js/plugins/zone-error`, you will only get a `wrapped Error` which can handle
|
||||||
`Error inherit` issue.
|
`Error inherit` issue.
|
||||||
|
|
||||||
3. lazy: this is a feature to let you be able to get `ZoneJsInternalStackFrames` feature,
|
3. lazy: this is a feature to let you be able to get `ZoneJsInternalStackFrames` feature,
|
||||||
|
|
|
@ -14,7 +14,6 @@ But there are still a lot of non-standard APIs that are not patched by default,
|
||||||
* webcomponents
|
* webcomponents
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
```
|
```
|
||||||
<script src="webcomponents-lite.js"></script>
|
<script src="webcomponents-lite.js"></script>
|
||||||
<script src="node_modules/zone.js/bundles/zone.umd.js"></script>
|
<script src="node_modules/zone.js/bundles/zone.umd.js"></script>
|
||||||
|
@ -45,8 +44,8 @@ Angular Usage:
|
||||||
in polyfills.ts, import the `zone-bluebird` package.
|
in polyfills.ts, import the `zone-bluebird` package.
|
||||||
|
|
||||||
```
|
```
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
import 'zone.js'; // Included with Angular CLI.
|
||||||
import 'zone.js/dist/zone-bluebird';
|
import 'zone.js/plugins/zone-bluebird';
|
||||||
```
|
```
|
||||||
|
|
||||||
in main.ts, patch bluebird.
|
in main.ts, patch bluebird.
|
||||||
|
@ -67,7 +66,7 @@ Node Sample Usage:
|
||||||
```
|
```
|
||||||
require('zone.js');
|
require('zone.js');
|
||||||
const Bluebird = require('bluebird');
|
const Bluebird = require('bluebird');
|
||||||
require('zone.js/dist/zone-bluebird');
|
require('zone.js/plugins/zone-bluebird');
|
||||||
Zone[Zone['__symbol__']('bluebird')](Bluebird);
|
Zone[Zone['__symbol__']('bluebird')](Bluebird);
|
||||||
Zone.current.fork({
|
Zone.current.fork({
|
||||||
name: 'bluebird'
|
name: 'bluebird'
|
||||||
|
@ -178,7 +177,7 @@ is patched, so each asynchronous call will run in the correct zone.
|
||||||
For example, in an Angular application, you can load this patch in your `app.module.ts`.
|
For example, in an Angular application, you can load this patch in your `app.module.ts`.
|
||||||
|
|
||||||
```
|
```
|
||||||
import 'zone.js/dist/zone-patch-rxjs';
|
import 'zone.js/plugins/zone-patch-rxjs';
|
||||||
```
|
```
|
||||||
|
|
||||||
* electron
|
* electron
|
||||||
|
@ -194,9 +193,9 @@ In electron, we patched the following APIs with `zone.js`
|
||||||
add following line into `polyfill.ts` after loading zone-mix.
|
add following line into `polyfill.ts` after loading zone-mix.
|
||||||
|
|
||||||
```
|
```
|
||||||
//import 'zone.js/dist/zone'; // originally added by angular-cli, comment it out
|
//import 'zone.js'; // originally added by angular-cli, comment it out
|
||||||
import 'zone.js/dist/zone-mix'; // add zone-mix to patch both Browser and Nodejs
|
import 'zone.js/mix'; // add zone-mix to patch both Browser and Nodejs
|
||||||
import 'zone.js/dist/zone-patch-electron'; // add zone-patch-electron to patch Electron native API
|
import 'zone.js/plugins/zone-patch-electron'; // add zone-patch-electron to patch Electron native API
|
||||||
```
|
```
|
||||||
|
|
||||||
there is a sampel repo [zone-electron](https://github.com/JiaLiPassion/zone-electron).
|
there is a sampel repo [zone-electron](https://github.com/JiaLiPassion/zone-electron).
|
||||||
|
@ -207,8 +206,8 @@ user need to patch `io` themselves just like following code.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
<script src="socket.io-client/dist/socket.io.js"></script>
|
<script src="socket.io-client/dist/socket.io.js"></script>
|
||||||
<script src="zone.js/dist/zone.js"></script>
|
<script src="zone.js/bundles/zone.umd.js"></script>
|
||||||
<script src="zone.js/dist/zone-patch-socket-io.js"></script>
|
<script src="zone.js/bundles/zone-patch-socket-io.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// patch io here
|
// patch io here
|
||||||
Zone[Zone.__symbol__('socketio')](io);
|
Zone[Zone.__symbol__('socketio')](io);
|
||||||
|
@ -229,7 +228,7 @@ there is a sampel repo [zone-jsonp](https://github.com/JiaLiPassion/test-zone-js
|
||||||
sample usage is:
|
sample usage is:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import 'zone.js/dist/zone-patch-jsonp';
|
import 'zone.js/plugins/zone-patch-jsonp';
|
||||||
Zone['__zone_symbol__jsonp']({
|
Zone['__zone_symbol__jsonp']({
|
||||||
jsonp: getJSONP,
|
jsonp: getJSONP,
|
||||||
sendFuncName: 'send',
|
sendFuncName: 'send',
|
||||||
|
@ -243,8 +242,8 @@ Currently only `Chrome 64` native support this feature.
|
||||||
you can add the following line into `polyfill.ts` after loading `zone.js`.
|
you can add the following line into `polyfill.ts` after loading `zone.js`.
|
||||||
|
|
||||||
```
|
```
|
||||||
import 'zone.js/dist/zone';
|
import 'zone.js';
|
||||||
import 'zone.js/dist/zone-patch-resize-observer';
|
import 'zone.js/plugins/zone-patch-resize-observer';
|
||||||
```
|
```
|
||||||
|
|
||||||
there is a sample repo [zone-resize-observer](https://github.com/JiaLiPassion/zone-resize-observer) here
|
there is a sample repo [zone-resize-observer](https://github.com/JiaLiPassion/zone-resize-observer) here
|
||||||
|
|
|
@ -194,7 +194,7 @@ Zone.__load_patch('asynctest', (global: any, Zone: ZoneType, api: _ZonePrivate)
|
||||||
if (AsyncTestZoneSpec === undefined) {
|
if (AsyncTestZoneSpec === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'AsyncTestZoneSpec is needed for the async() test helper but could not be found. ' +
|
'AsyncTestZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||||
'Please make sure that your environment includes zone.js/dist/async-test.js');
|
'Please make sure that your environment includes zone.js/plugins/async-test');
|
||||||
}
|
}
|
||||||
const ProxyZoneSpec = (Zone as any)['ProxyZoneSpec'] as {
|
const ProxyZoneSpec = (Zone as any)['ProxyZoneSpec'] as {
|
||||||
get(): {setDelegate(spec: ZoneSpec): void; getDelegate(): ZoneSpec;};
|
get(): {setDelegate(spec: ZoneSpec): void; getDelegate(): ZoneSpec;};
|
||||||
|
@ -203,7 +203,7 @@ Zone.__load_patch('asynctest', (global: any, Zone: ZoneType, api: _ZonePrivate)
|
||||||
if (!ProxyZoneSpec) {
|
if (!ProxyZoneSpec) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||||
'Please make sure that your environment includes zone.js/dist/proxy.js');
|
'Please make sure that your environment includes zone.js/plugins/proxy');
|
||||||
}
|
}
|
||||||
const proxyZoneSpec = ProxyZoneSpec.get();
|
const proxyZoneSpec = ProxyZoneSpec.get();
|
||||||
ProxyZoneSpec.assertPresent();
|
ProxyZoneSpec.assertPresent();
|
||||||
|
|
|
@ -756,7 +756,7 @@ Zone.__load_patch('fakeasync', (global: any, Zone: ZoneType, api: _ZonePrivate)
|
||||||
if (!ProxyZoneSpec) {
|
if (!ProxyZoneSpec) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
|
||||||
'Please make sure that your environment includes zone.js/dist/proxy.js');
|
'Please make sure that your environment includes zone.js/plugins/proxy');
|
||||||
}
|
}
|
||||||
const proxyZoneSpec = ProxyZoneSpec.assertPresent();
|
const proxyZoneSpec = ProxyZoneSpec.assertPresent();
|
||||||
if (Zone.current.get('FakeAsyncTestZoneSpec')) {
|
if (Zone.current.get('FakeAsyncTestZoneSpec')) {
|
||||||
|
|
Loading…
Reference in New Issue