Skip to content

Commit 6d4a022

Browse files
committed
partial compilation mode and updating sample-compat
1 parent 25e48ca commit 6d4a022

21 files changed

+3000
-2916
lines changed

sample-compat/.browserslistrc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
# For additional information regarding the format and rule options, please see:
33
# https://github.com/browserslist/browserslist#queries
44

5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
58
# You can see what browsers were selected by your queries by running:
69
# npx browserslist
710

8-
> 0.5%
9-
last 2 versions
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
1016
Firefox ESR
11-
not dead
12-
not IE 9-10
13-
IE 11
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

sample-compat/package.json

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"start": "ng serve",
77
"start:emulated": "concurrently -n ng,firebase -c red,yellow \"ng serve -c emulated\" \"firebase emulators:start\"",
88
"build": "ng build --stats-json",
9-
"analyze": "webpack-bundle-analyzer dist/sample/stats.json",
9+
"build:prod": "ng build --configuration production --stats-json",
10+
"analyze": "webpack-bundle-analyzer dist/sample/browser/stats.json",
1011
"test": "ng test",
1112
"lint": "ng lint",
1213
"deploy": "ng deploy",
@@ -18,35 +19,35 @@
1819
},
1920
"private": true,
2021
"dependencies": {
21-
"@angular/animations": "~11.0.0",
22-
"@angular/common": "~11.0.0",
23-
"@angular/compiler": "~11.0.0",
24-
"@angular/core": "~11.0.0",
22+
"@angular/animations": "~12.0.0-rc.0",
23+
"@angular/common": "~12.0.0-rc.0",
24+
"@angular/compiler": "~12.0.0-rc.0",
25+
"@angular/core": "~12.0.0-rc.0",
2526
"@angular/fire": "../dist/packages-dist",
26-
"@angular/forms": "~11.0.0",
27-
"@angular/platform-browser": "~11.0.0",
28-
"@angular/platform-browser-dynamic": "~11.0.0",
29-
"@angular/platform-server": "~11.0.0",
30-
"@angular/router": "~11.0.0",
31-
"@angular/service-worker": "^11.0.0",
32-
"@nguniversal/express-engine": "~10.1.0",
27+
"@angular/forms": "~12.0.0-rc.0",
28+
"@angular/platform-browser": "~12.0.0-rc.0",
29+
"@angular/platform-browser-dynamic": "~12.0.0-rc.0",
30+
"@angular/platform-server": "~12.0.0-rc.0",
31+
"@angular/router": "~12.0.0-rc.0",
32+
"@angular/service-worker": "~12.0.0-rc.0",
33+
"@nguniversal/express-engine": "~12.0.0-next.1",
3334
"core-js": "^3.6.5",
34-
"firebase": "^8.0.0",
35+
"firebase": "^9.0.0-beta.1",
3536
"first-input-delay": "^0.1.3",
3637
"proxy-polyfill": "^0.3.2",
37-
"rxjs": "~6.6.3",
38-
"tslib": "^2.0.1",
38+
"rxjs": "~6.6.0",
39+
"tslib": "^2.1.0",
3940
"whatwg-fetch": "^3.4.1",
40-
"zone.js": "0.10.3"
41+
"zone.js": "~0.11.4"
4142
},
4243
"devDependencies": {
43-
"@angular-devkit/architect": "~0.1001.3",
44-
"@angular-devkit/build-angular": "~0.1100.0",
45-
"@angular/cli": "~11.0.0",
46-
"@angular/compiler-cli": "~11.0.0",
47-
"@angular/language-service": "~11.0.0",
44+
"@angular-devkit/architect": "~0.1200.0-rc.0",
45+
"@angular-devkit/build-angular": "~12.0.0-rc.0",
46+
"@angular/cli": "~12.0.0-rc.0",
47+
"@angular/compiler-cli": "~12.0.0-rc.0",
48+
"@angular/language-service": "~12.0.0-rc.0",
4849
"@firebase/app-types": "^0.6.1",
49-
"@nguniversal/builders": "^10.1.0",
50+
"@nguniversal/builders": "~12.0.0-next.1",
5051
"@types/jasmine": "~3.5.0",
5152
"@types/jasminewd2": "~2.0.3",
5253
"codelyzer": "^6.0.0",
@@ -70,7 +71,7 @@
7071
"karma-jasmine-html-reporter": "^1.5.0",
7172
"ts-node": "~9.0.0",
7273
"tslint": "~6.1.3",
73-
"typescript": "~4.0.5",
74+
"typescript": "~4.2.3",
7475
"webpack-bundle-analyzer": "^4.4.1"
7576
}
7677
}

sample-compat/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
33
import { HomeComponent } from './home/home.component';
44
import { ProtectedComponent } from './protected/protected.component';
5-
import { AngularFireAuthGuard, canActivate, isNotAnonymous } from '@angular/fire/auth-guard';
5+
import { AngularFireAuthGuard, canActivate, isNotAnonymous } from '@angular/fire/compat/auth-guard';
66
import { SecondaryComponent } from './secondary/secondary.component';
77

88
const routes: Routes = [

sample-compat/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ApplicationRef, Component } from '@angular/core';
2-
import { FirebaseApp } from '@angular/fire';
2+
import { FirebaseApp } from '@angular/fire/compat';
33
import { debounceTime } from 'rxjs/operators';
44

55
@Component({

sample-compat/src/app/app.module.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AppComponent } from './app.component';
66
import { ServiceWorkerModule } from '@angular/service-worker';
77
import { environment } from '../environments/environment';
88

9-
import { AngularFireModule } from '@angular/fire';
9+
import { AngularFireModule } from '@angular/fire/compat';
1010

1111
import {
1212
AngularFireAnalyticsModule,
@@ -16,18 +16,18 @@ import {
1616
ScreenTrackingService,
1717
UserTrackingService,
1818
COLLECTION_ENABLED
19-
} from '@angular/fire/analytics';
19+
} from '@angular/fire/compat/analytics';
2020

2121
import { FirestoreComponent } from './firestore/firestore.component';
22-
import { AngularFireDatabaseModule, USE_EMULATOR as USE_DATABASE_EMULATOR } from '@angular/fire/database';
23-
import { AngularFirestoreModule, USE_EMULATOR as USE_FIRESTORE_EMULATOR, SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/firestore';
24-
import { AngularFireStorageModule } from '@angular/fire/storage';
25-
import { AngularFireAuthModule, USE_DEVICE_LANGUAGE, USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/auth';
26-
import { AngularFireMessagingModule, SERVICE_WORKER, VAPID_KEY } from '@angular/fire/messaging';
27-
import { AngularFireFunctionsModule, USE_EMULATOR as USE_FUNCTIONS_EMULATOR, ORIGIN as FUNCTIONS_ORIGIN, NEW_ORIGIN_BEHAVIOR } from '@angular/fire/functions';
28-
import { AngularFireRemoteConfigModule, SETTINGS as REMOTE_CONFIG_SETTINGS, DEFAULTS as REMOTE_CONFIG_DEFAULTS } from '@angular/fire/remote-config';
29-
import { AngularFirePerformanceModule, PerformanceMonitoringService } from '@angular/fire/performance';
30-
import { AngularFireAuthGuardModule } from '@angular/fire/auth-guard';
22+
import { AngularFireDatabaseModule, USE_EMULATOR as USE_DATABASE_EMULATOR } from '@angular/fire/compat/database';
23+
import { AngularFirestoreModule, USE_EMULATOR as USE_FIRESTORE_EMULATOR, SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/compat/firestore';
24+
import { AngularFireStorageModule } from '@angular/fire/compat/storage';
25+
import { AngularFireAuthModule, USE_DEVICE_LANGUAGE, USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/compat/auth';
26+
import { AngularFireMessagingModule, SERVICE_WORKER, VAPID_KEY } from '@angular/fire/compat/messaging';
27+
import { AngularFireFunctionsModule, USE_EMULATOR as USE_FUNCTIONS_EMULATOR, ORIGIN as FUNCTIONS_ORIGIN } from '@angular/fire/compat/functions';
28+
import { AngularFireRemoteConfigModule, SETTINGS as REMOTE_CONFIG_SETTINGS, DEFAULTS as REMOTE_CONFIG_DEFAULTS } from '@angular/fire/compat/remote-config';
29+
import { AngularFirePerformanceModule, PerformanceMonitoringService } from '@angular/fire/compat/performance';
30+
import { AngularFireAuthGuardModule } from '@angular/fire/compat/auth-guard';
3131
import { DatabaseComponent } from './database/database.component';
3232
import { StorageComponent } from './storage/storage.component';
3333
import { RemoteConfigComponent } from './remote-config/remote-config.component';
@@ -82,7 +82,6 @@ import { UpboatsComponent } from './upboats/upboats.component';
8282
{ provide: USE_DATABASE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9000] : undefined },
8383
{ provide: USE_FIRESTORE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 8080] : undefined },
8484
{ provide: USE_FUNCTIONS_EMULATOR, useValue: environment.useEmulators ? ['localhost', 5001] : undefined },
85-
{ provide: NEW_ORIGIN_BEHAVIOR, useValue: true },
8685
{ provide: FUNCTIONS_ORIGIN, useFactory: () => isDevMode() || typeof location === 'undefined' ? undefined : location.origin },
8786
{ provide: REMOTE_CONFIG_SETTINGS, useFactory: () => isDevMode() ? { minimumFetchIntervalMillis: 10_000 } : {} },
8887
{ provide: REMOTE_CONFIG_DEFAULTS, useValue: { background_color: 'red' } },

sample-compat/src/app/auth/auth.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, OnInit, OnDestroy, PLATFORM_ID } from '@angular/core';
2-
import { AngularFireAuth } from '@angular/fire/auth';
3-
import firebase from 'firebase/app';
2+
import { AngularFireAuth } from '@angular/fire/compat/auth';
3+
import firebase from 'firebase/compat/app';
44
import { Subscription } from 'rxjs';
55
import { map } from 'rxjs/operators';
6-
import { trace } from '@angular/fire/performance';
6+
import { trace } from '@angular/fire/compat/performance';
77
import { Inject } from '@angular/core';
88
import { isPlatformServer } from '@angular/common';
99

sample-compat/src/app/database/database.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
2-
import { AngularFireDatabase } from '@angular/fire/database';
2+
import { AngularFireDatabase } from '@angular/fire/compat/database';
33
import { EMPTY, Observable } from 'rxjs';
44
import { makeStateKey, TransferState } from '@angular/platform-browser';
55
import { startWith, tap } from 'rxjs/operators';
6-
import { trace } from '@angular/fire/performance';
6+
import { trace } from '@angular/fire/compat/performance';
77
import { isPlatformServer } from '@angular/common';
88

99
@Component({
@@ -26,7 +26,7 @@ export class DatabaseComponent implements OnInit {
2626
} else {
2727
const doc = database.object('test');
2828
const key = makeStateKey(doc.query.toString());
29-
const existing = state.get(key, undefined);
29+
const existing = state.get<any>(key, undefined);
3030
this.testObjectValue$ = doc.valueChanges().pipe(
3131
trace('database'),
3232
existing ? startWith(existing) : tap(it => state.set(key, it))

sample-compat/src/app/firestore-offline/firestore-offline.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFirestore } from '@angular/fire/firestore';
2+
import { AngularFirestore } from '@angular/fire/compat/firestore';
33
import { Observable } from 'rxjs';
44
import { startWith, tap } from 'rxjs/operators';
55
import { makeStateKey, TransferState } from '@angular/platform-browser';
6-
import { trace } from '@angular/fire/performance';
6+
import { trace } from '@angular/fire/compat/performance';
77
import { AngularFirestoreOffline } from './firestore-offline.module';
88

99
@Component({
@@ -23,7 +23,7 @@ export class FirestoreOfflineComponent implements OnInit {
2323
constructor(state: TransferState, firestore: AngularFirestoreOffline) {
2424
const doc = firestore.doc('test/1');
2525
const key = makeStateKey(doc.ref.path);
26-
const existing = state.get(key, undefined);
26+
const existing = state.get<any>(key, undefined);
2727
this.testDocValue$ = firestore.doc('test/1').valueChanges().pipe(
2828
trace('firestore'),
2929
existing ? startWith(existing) : tap(it => state.set(key, it))

sample-compat/src/app/firestore-offline/firestore-offline.module.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Inject, Injectable, InjectionToken, NgModule, NgZone, Optional, PLATFORM_ID } from '@angular/core';
2-
import { FirebaseOptions, FIREBASE_OPTIONS } from '@angular/fire';
3-
import { USE_EMULATOR } from '@angular/fire/firestore';
4-
import { AngularFirestore, SETTINGS, Settings } from '@angular/fire/firestore';
5-
import { USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/auth';
2+
import { FIREBASE_OPTIONS } from '@angular/fire/compat';
3+
import { FirebaseOptions } from 'firebase/app';
4+
import { USE_EMULATOR } from '@angular/fire/compat/firestore';
5+
import { AngularFirestore, SETTINGS, Settings } from '@angular/fire/compat/firestore';
6+
import { USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/compat/auth';
67

78
export const FIRESTORE_OFFLINE = new InjectionToken<AngularFirestore>('my.firestore');
89

@@ -15,9 +16,8 @@ export class AngularFirestoreOffline extends AngularFirestore {
1516
@Inject(PLATFORM_ID) platformId: Object,
1617
zone: NgZone,
1718
@Optional() @Inject(USE_EMULATOR) useEmulator: any,
18-
@Optional() @Inject(USE_AUTH_EMULATOR) useAuthEmulator: any,
1919
) {
20-
super(options, 'offline', true, settings, platformId, zone, { synchronizeTabs: true }, useEmulator, useAuthEmulator);
20+
super(options, 'offline', true, settings, platformId, zone, { synchronizeTabs: true }, useEmulator);
2121
}
2222
}
2323

sample-compat/src/app/firestore/firestore.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFirestore } from '@angular/fire/firestore';
2+
import { AngularFirestore } from '@angular/fire/compat/firestore';
33
import { Observable } from 'rxjs';
44
import { startWith, tap } from 'rxjs/operators';
55
import { makeStateKey, TransferState } from '@angular/platform-browser';
6-
import { trace } from '@angular/fire/performance';
6+
import { trace } from '@angular/fire/compat/performance';
77

88
@Component({
99
selector: 'app-firestore',
@@ -22,7 +22,7 @@ export class FirestoreComponent implements OnInit {
2222
constructor(state: TransferState, firestore: AngularFirestore) {
2323
const doc = firestore.doc('test/1');
2424
const key = makeStateKey(doc.ref.path);
25-
const existing = state.get(key, undefined);
25+
const existing = state.get<any>(key, undefined);
2626
this.testDocValue$ = firestore.doc('test/1').valueChanges().pipe(
2727
trace('firestore'),
2828
existing ? startWith(existing) : tap(it => state.set(key, it))

sample-compat/src/app/functions/functions.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFireFunctions } from '@angular/fire/functions';
2+
import { AngularFireFunctions } from '@angular/fire/compat/functions';
33
import { EMPTY, Observable } from 'rxjs';
44

55
@Component({

sample-compat/src/app/home/home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import { FirebaseApp } from '@angular/fire';
2+
import { FirebaseApp } from '@angular/fire/compat';
33

44
@Component({
55
selector: 'app-home',

sample-compat/src/app/messaging/messaging.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFireMessaging } from '@angular/fire/messaging';
3-
import { trace } from '@angular/fire/performance';
2+
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
3+
import { trace } from '@angular/fire/compat/performance';
44
import { Observable } from 'rxjs';
55
import { tap } from 'rxjs/operators';
66

sample-compat/src/app/protected-lazy/protected-lazy.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { DocumentChangeAction } from '@angular/fire/firestore';
2+
import { DocumentChangeAction } from '@angular/fire/compat/firestore';
33
import { Observable } from 'rxjs';
44
import { AngularFirestoreOffline } from '../firestore-offline/firestore-offline.module';
55

sample-compat/src/app/remote-config/remote-config.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFireRemoteConfig, mapToObject } from '@angular/fire/remote-config';
3-
import { trace } from '@angular/fire/performance';
2+
import { AngularFireRemoteConfig, mapToObject } from '@angular/fire/compat/remote-config';
3+
import { trace } from '@angular/fire/compat/performance';
44
import { Observable } from 'rxjs';
55

66
@Component({

sample-compat/src/app/storage/storage.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AngularFireStorage } from '@angular/fire/storage';
2+
import { AngularFireStorage } from '@angular/fire/compat/storage';
33
import { Observable, of } from 'rxjs';
44
import { startWith, tap } from 'rxjs/operators';
55
import { makeStateKey, TransferState } from '@angular/platform-browser';
6-
import { trace } from '@angular/fire/performance';
6+
import { trace } from '@angular/fire/compat/performance';
77

88
const TRANSPARENT_PNG
99
= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
@@ -26,7 +26,7 @@ export class StorageComponent implements OnInit {
2626
constructor(storage: AngularFireStorage, state: TransferState) {
2727
const icon = storage.ref('google-g.png');
2828
const key = makeStateKey('google-icon-url');
29-
const existing = state.get(key, undefined);
29+
const existing = state.get<string>(key, undefined);
3030
this.downloadUrl$ = existing ? of(existing) : icon.getDownloadURL().pipe(
3131
trace('storage'),
3232
tap(it => state.set(key, it)),

sample-compat/src/app/upboats/upboats.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core';
22
import { Observable } from 'rxjs';
33
import { map, startWith, tap } from 'rxjs/operators';
44
import { AngularFirestoreOffline } from '../firestore-offline/firestore-offline.module';
5-
import firebase from 'firebase/app';
5+
import firebase from 'firebase/compat/app';
66
import { makeStateKey, TransferState } from '@angular/platform-browser';
7-
import { trace } from '@angular/fire/performance';
7+
import { trace } from '@angular/fire/compat/performance';
88

99
type Animal = { name: string, upboats: number, id: string, hasPendingWrites: boolean };
1010

@@ -22,15 +22,15 @@ export class UpboatsComponent implements OnInit {
2222
ref.orderBy('upboats', 'desc').orderBy('updatedAt', 'desc')
2323
);
2424
const key = makeStateKey(collection.ref.path);
25-
const existing = state.get(key, undefined);
25+
const existing = state.get<Animal[]>(key, undefined);
2626
this.animals = collection.snapshotChanges().pipe(
2727
trace('animals'),
2828
map(it => it.map(change => ({
2929
...change.payload.doc.data(),
3030
id: change.payload.doc.id,
3131
hasPendingWrites: change.payload.doc.metadata.hasPendingWrites
3232
}))),
33-
existing ? startWith(existing) : tap(it => state.set(key, it))
33+
existing ? startWith(existing) : tap(it => state.set<Animal[]>(key, it))
3434
);
3535
}
3636

sample-compat/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"moduleResolution": "node",
1212
"importHelpers": true,
1313
"target": "es2015",
14+
"skipLibCheck": true,
1415
"lib": [
1516
"es2018",
1617
"dom"

0 commit comments

Comments
 (0)