Skip to content

Commit aaf9b31

Browse files
alan-agius4atscott
authored andcommitted
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
1 parent c362205 commit aaf9b31

File tree

10 files changed

+27
-28
lines changed

10 files changed

+27
-28
lines changed

packages/compiler-cli/integrationtest/test/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
// import zone.js from npm here because integration test will load zone.js
1010
// from built npm_package instead of source
11-
import 'zone.js/dist/zone-node';
12-
import 'zone.js/dist/zone-testing';
11+
import 'zone.js/node';
12+
import 'zone.js/testing';
1313
// Only needed to satisfy the check in core/src/util/decorators.ts
1414
// TODO(alexeagle): maybe remove that check?
1515
require('reflect-metadata');

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"peerDependencies": {
1111
"rxjs": "^6.5.3",
12-
"zone.js": "^0.10.2 || ^0.11.3"
12+
"zone.js": "~0.11.4"
1313
},
1414
"repository": {
1515
"type": "git",

packages/core/src/testability/testability.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class Testability implements PublicTestability {
199199
if (updateCb && !this.taskTrackingZone) {
200200
throw new Error(
201201
'Task tracking zone is required when passing an update callback to ' +
202-
'whenStable(). Is "zone.js/dist/task-tracking.js" loaded?');
202+
'whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
203203
}
204204
// These arguments are 'Function' above to keep the public API simple.
205205
this.addCallback(doneCb as DoneCallback, timeout, updateCb as UpdateCallback);

packages/core/testing/src/async.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function waitForAsync(fn: Function): (done: any) => any {
2828
return function() {
2929
return Promise.reject(
3030
'Zone is needed for the waitForAsync() test helper but could not be found. ' +
31-
'Please make sure that your environment includes zone.js/dist/zone.js');
31+
'Please make sure that your environment includes zone.js');
3232
};
3333
}
3434
const asyncTest = _Zone && _Zone[_Zone.__symbol__('asyncTest')];
@@ -38,7 +38,7 @@ export function waitForAsync(fn: Function): (done: any) => any {
3838
return function() {
3939
return Promise.reject(
4040
'zone-testing.js is needed for the async() test helper but could not be found. ' +
41-
'Please make sure that your environment includes zone.js/dist/zone-testing.js');
41+
'Please make sure that your environment includes zone.js/testing');
4242
};
4343
}
4444

packages/core/testing/src/fake_async.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const fakeAsyncTestModule = _Zone && _Zone[_Zone.__symbol__('fakeAsyncTest')];
1010

1111
const fakeAsyncTestModuleNotLoadedErrorMessage =
1212
`zone-testing.js is needed for the fakeAsync() test helper but could not be found.
13-
Please make sure that your environment includes zone.js/dist/zone-testing.js`;
13+
Please make sure that your environment includes zone.js/testing`;
1414

1515
/**
1616
* Clears out the shared fake async zone for a test.

packages/localize/schematics/ng-add/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('ng-add schematic', () => {
2222
`/***************************************************************************************************
2323
* Zone JS is required by default for Angular itself.
2424
*/
25-
import 'zone.js/dist/zone';`;
25+
import 'zone.js';`;
2626
const mainServerContent = `import { enableProdMode } from '@angular/core';
2727
import { environment } from './environments/environment';
2828
if (environment.production) {

packages/zone.js/MODULE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ you can do like this.
8585
}
8686
];
8787
</script>
88-
<script src="../dist/zone.js"></script>
88+
<script src="../bundles/zone.umd.js"></script>
8989
```
9090

9191
- Error
9292

93-
By default, `zone.js/dist/zone-error` will not be loaded for performance concern.
93+
By default, `zone.js/plugins/zone-error` will not be loaded for performance concern.
9494
This package will provide following functionality.
9595

9696
1. Error inherit: handle `extend Error` issue.
@@ -125,13 +125,13 @@ This package will provide following functionality.
125125
The second feature will slow down the `Error` performance, so `zone.js` provide a flag to let you be able to control the behavior.
126126
The flag is `__Zone_Error_ZoneJsInternalStackFrames_policy`. And the available options is:
127127
128-
1. default: this is the default one, if you load `zone.js/dist/zone-error` without
128+
1. default: this is the default one, if you load `zone.js/plugins/zone-error` without
129129
setting the flag, `default` will be used, and `ZoneJsInternalStackFrames` will be available
130130
when `new Error()`, you can get a `error.stack` which is `zone stack free`. But this
131131
will slow down `new Error()` a little bit.
132132
133133
2. disable: this will disable `ZoneJsInternalStackFrames` feature, and if you load
134-
`zone.js/dist/zone-error`, you will only get a `wrapped Error` which can handle
134+
`zone.js/plugins/zone-error`, you will only get a `wrapped Error` which can handle
135135
`Error inherit` issue.
136136
137137
3. lazy: this is a feature to let you be able to get `ZoneJsInternalStackFrames` feature,

packages/zone.js/NON-STANDARD-APIS.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ But there are still a lot of non-standard APIs that are not patched by default,
1414
* webcomponents
1515

1616
Usage:
17-
1817
```
1918
<script src="webcomponents-lite.js"></script>
2019
<script src="node_modules/zone.js/bundles/zone.umd.js"></script>
@@ -45,8 +44,8 @@ Angular Usage:
4544
in polyfills.ts, import the `zone-bluebird` package.
4645

4746
```
48-
import 'zone.js/dist/zone'; // Included with Angular CLI.
49-
import 'zone.js/dist/zone-bluebird';
47+
import 'zone.js'; // Included with Angular CLI.
48+
import 'zone.js/plugins/zone-bluebird';
5049
```
5150

5251
in main.ts, patch bluebird.
@@ -67,7 +66,7 @@ Node Sample Usage:
6766
```
6867
require('zone.js');
6968
const Bluebird = require('bluebird');
70-
require('zone.js/dist/zone-bluebird');
69+
require('zone.js/plugins/zone-bluebird');
7170
Zone[Zone['__symbol__']('bluebird')](Bluebird);
7271
Zone.current.fork({
7372
name: 'bluebird'
@@ -178,7 +177,7 @@ is patched, so each asynchronous call will run in the correct zone.
178177
For example, in an Angular application, you can load this patch in your `app.module.ts`.
179178

180179
```
181-
import 'zone.js/dist/zone-patch-rxjs';
180+
import 'zone.js/plugins/zone-patch-rxjs';
182181
```
183182

184183
* electron
@@ -194,9 +193,9 @@ In electron, we patched the following APIs with `zone.js`
194193
add following line into `polyfill.ts` after loading zone-mix.
195194

196195
```
197-
//import 'zone.js/dist/zone'; // originally added by angular-cli, comment it out
198-
import 'zone.js/dist/zone-mix'; // add zone-mix to patch both Browser and Nodejs
199-
import 'zone.js/dist/zone-patch-electron'; // add zone-patch-electron to patch Electron native API
196+
//import 'zone.js'; // originally added by angular-cli, comment it out
197+
import 'zone.js/mix'; // add zone-mix to patch both Browser and Nodejs
198+
import 'zone.js/plugins/zone-patch-electron'; // add zone-patch-electron to patch Electron native API
200199
```
201200

202201
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.
207206

208207
```javascript
209208
<script src="socket.io-client/dist/socket.io.js"></script>
210-
<script src="zone.js/dist/zone.js"></script>
211-
<script src="zone.js/dist/zone-patch-socket-io.js"></script>
209+
<script src="zone.js/bundles/zone.umd.js"></script>
210+
<script src="zone.js/bundles/zone-patch-socket-io.js"></script>
212211
<script>
213212
// patch io here
214213
Zone[Zone.__symbol__('socketio')](io);
@@ -229,7 +228,7 @@ there is a sampel repo [zone-jsonp](https://github.com/JiaLiPassion/test-zone-js
229228
sample usage is:
230229

231230
```javascript
232-
import 'zone.js/dist/zone-patch-jsonp';
231+
import 'zone.js/plugins/zone-patch-jsonp';
233232
Zone['__zone_symbol__jsonp']({
234233
jsonp: getJSONP,
235234
sendFuncName: 'send',
@@ -243,8 +242,8 @@ Currently only `Chrome 64` native support this feature.
243242
you can add the following line into `polyfill.ts` after loading `zone.js`.
244243

245244
```
246-
import 'zone.js/dist/zone';
247-
import 'zone.js/dist/zone-patch-resize-observer';
245+
import 'zone.js';
246+
import 'zone.js/plugins/zone-patch-resize-observer';
248247
```
249248

250249
there is a sample repo [zone-resize-observer](https://github.com/JiaLiPassion/zone-resize-observer) here

packages/zone.js/lib/zone-spec/async-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Zone.__load_patch('asynctest', (global: any, Zone: ZoneType, api: _ZonePrivate)
194194
if (AsyncTestZoneSpec === undefined) {
195195
throw new Error(
196196
'AsyncTestZoneSpec is needed for the async() test helper but could not be found. ' +
197-
'Please make sure that your environment includes zone.js/dist/async-test.js');
197+
'Please make sure that your environment includes zone.js/plugins/async-test');
198198
}
199199
const ProxyZoneSpec = (Zone as any)['ProxyZoneSpec'] as {
200200
get(): {setDelegate(spec: ZoneSpec): void; getDelegate(): ZoneSpec;};
@@ -203,7 +203,7 @@ Zone.__load_patch('asynctest', (global: any, Zone: ZoneType, api: _ZonePrivate)
203203
if (!ProxyZoneSpec) {
204204
throw new Error(
205205
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
206-
'Please make sure that your environment includes zone.js/dist/proxy.js');
206+
'Please make sure that your environment includes zone.js/plugins/proxy');
207207
}
208208
const proxyZoneSpec = ProxyZoneSpec.get();
209209
ProxyZoneSpec.assertPresent();

packages/zone.js/lib/zone-spec/fake-async-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ Zone.__load_patch('fakeasync', (global: any, Zone: ZoneType, api: _ZonePrivate)
756756
if (!ProxyZoneSpec) {
757757
throw new Error(
758758
'ProxyZoneSpec is needed for the async() test helper but could not be found. ' +
759-
'Please make sure that your environment includes zone.js/dist/proxy.js');
759+
'Please make sure that your environment includes zone.js/plugins/proxy');
760760
}
761761
const proxyZoneSpec = ProxyZoneSpec.assertPresent();
762762
if (Zone.current.get('FakeAsyncTestZoneSpec')) {

0 commit comments

Comments
 (0)