@angular/fire 7.5.0 → 7.6.0-canary.60943d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -72
- package/bundles/angular-fire.umd.js +1 -1
- package/bundles/angular-fire.umd.js.map +1 -1
- package/compat/firestore/interfaces.d.ts +4 -4
- package/docs/analytics.md +67 -0
- package/docs/app-check.md +53 -0
- package/docs/auth.md +165 -0
- package/docs/{analytics → compat/analytics}/getting-started.md +2 -0
- package/docs/{auth → compat/auth}/getting-started.md +2 -0
- package/docs/{auth → compat/auth}/router-guards.md +2 -0
- package/docs/{emulators → compat/emulators}/emulators.md +2 -0
- package/docs/{firestore → compat/firestore}/collections.md +2 -0
- package/docs/{firestore → compat/firestore}/documents.md +2 -0
- package/docs/{firestore → compat/firestore}/offline-data.md +2 -0
- package/docs/{firestore → compat/firestore}/querying-collections.md +2 -0
- package/docs/{functions → compat/functions}/functions.md +2 -0
- package/docs/{messaging → compat/messaging}/messaging.md +2 -0
- package/docs/{performance → compat/performance}/getting-started.md +2 -0
- package/docs/{remote-config → compat/remote-config}/getting-started.md +2 -0
- package/docs/{rtdb → compat/rtdb}/lists.md +2 -0
- package/docs/{rtdb → compat/rtdb}/objects.md +2 -0
- package/docs/{rtdb → compat/rtdb}/querying-lists.md +2 -0
- package/docs/{storage → compat/storage}/storage.md +2 -0
- package/docs/compat.md +70 -0
- package/docs/database.md +175 -0
- package/docs/firestore.md +148 -0
- package/docs/functions.md +52 -0
- package/docs/images/analytics-illo_1x.png +0 -0
- package/docs/images/auth-illo_1x.png +0 -0
- package/docs/images/cloud-messaging-illo_1x.png +0 -0
- package/docs/images/database-illo_1x.png +0 -0
- package/docs/images/firestore-illo_1x.png +0 -0
- package/docs/images/functions-illo_1x.png +0 -0
- package/docs/images/hosting-illo_1x.png +0 -0
- package/docs/images/performance-illo_1x.png +0 -0
- package/docs/images/reCAPTCHA-logo@1x.png +0 -0
- package/docs/images/remote-config-illo_1x.png +0 -0
- package/docs/images/storage-illo_1x.png +0 -0
- package/docs/install-and-setup.md +39 -86
- package/docs/install-firebase-tools.md +78 -0
- package/docs/messaging.md +25 -0
- package/docs/performance.md +57 -0
- package/docs/remote-config.md +53 -0
- package/docs/storage.md +90 -0
- package/docs/universal/cloud-functions.md +27 -6
- package/docs/universal/getting-started.md +9 -134
- package/esm2015/compat/firestore/interfaces.js +1 -1
- package/esm2015/core.js +1 -1
- package/fesm2015/angular-fire.js +1 -1
- package/fesm2015/angular-fire.js.map +1 -1
- package/package.json +9 -10
- package/schematics/deploy/actions.js +8 -3
- package/schematics/deploy/builder.js +2 -2
- package/schematics/firebaseTools.js +4 -2
- package/schematics/setup/index.js +58 -29
- package/schematics/setup/prompts.js +18 -46
- package/schematics/utils.js +32 -28
- package/docs/ionic/authentication.md +0 -104
- package/docs/ionic/cli.md +0 -218
- package/docs/ionic/v2.md +0 -531
- package/docs/ionic/v3.md +0 -705
- package/schematics/setup/ssr.js +0 -100
- package/schematics/setup/static.js +0 -78
|
@@ -7,147 +7,22 @@ Server-side rendering (SSR) is the process of converting a JavaScript app to pla
|
|
|
7
7
|
- @angular/cli >= v6.0
|
|
8
8
|
- @angular/fire >= v5.0.0
|
|
9
9
|
|
|
10
|
-
## 1.
|
|
10
|
+
## 1. Add Angular Universal to your project
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Follow the steps from the [Angular Universal Tutorial](https://angular.io/guide/universal) to add Universal to your
|
|
13
|
+
project.
|
|
13
14
|
|
|
14
15
|
```
|
|
15
|
-
ng
|
|
16
|
+
ng add @nguniversal/express-engine
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
This will create all the files you need and setup all the configurations for Universal rendering for your application.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## 2. Next Steps
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
npm install --save-dev @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader express webpack-cli ts-loader ws xhr2
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Create a file called `server.ts` in the root of you project.
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
// These are important and needed before anything else
|
|
30
|
-
import 'zone.js/dist/zone-node';
|
|
31
|
-
import 'reflect-metadata';
|
|
32
|
-
|
|
33
|
-
import { enableProdMode } from '@angular/core';
|
|
34
|
-
import { ngExpressEngine } from '@nguniversal/express-engine';
|
|
35
|
-
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
|
|
36
|
-
|
|
37
|
-
import * as express from 'express';
|
|
38
|
-
import { join } from 'path';
|
|
39
|
-
import { readFileSync } from 'fs';
|
|
40
|
-
|
|
41
|
-
// Polyfills required for Firebase
|
|
42
|
-
(global as any).WebSocket = require('ws');
|
|
43
|
-
(global as any).XMLHttpRequest = require('xhr2');
|
|
44
|
-
|
|
45
|
-
// Faster renders in prod mode
|
|
46
|
-
enableProdMode();
|
|
47
|
-
|
|
48
|
-
// Export our express server
|
|
49
|
-
export const app = express();
|
|
50
|
-
|
|
51
|
-
const DIST_FOLDER = join(process.cwd(), 'dist');
|
|
52
|
-
const APP_NAME = 'YOUR_PROJECT_NAME'; // TODO: replace me!
|
|
53
|
-
|
|
54
|
-
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require(`./dist/${APP_NAME}-server/main`);
|
|
55
|
-
|
|
56
|
-
// index.html template
|
|
57
|
-
const template = readFileSync(join(DIST_FOLDER, APP_NAME, 'index.html')).toString();
|
|
58
|
-
|
|
59
|
-
app.engine('html', ngExpressEngine({
|
|
60
|
-
bootstrap: AppServerModuleNgFactory,
|
|
61
|
-
providers: [
|
|
62
|
-
provideModuleMap(LAZY_MODULE_MAP)
|
|
63
|
-
]
|
|
64
|
-
}));
|
|
65
|
-
|
|
66
|
-
app.set('view engine', 'html');
|
|
67
|
-
app.set('views', join(DIST_FOLDER, APP_NAME));
|
|
68
|
-
|
|
69
|
-
// Serve static files
|
|
70
|
-
app.get('*.*', express.static(join(DIST_FOLDER, APP_NAME)));
|
|
71
|
-
|
|
72
|
-
// All regular routes use the Universal engine
|
|
73
|
-
app.get('*', (req, res) => {
|
|
74
|
-
res.render(join(DIST_FOLDER, APP_NAME, 'index.html'), { req });
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// If we're not in the Cloud Functions environment, spin up a Node server
|
|
78
|
-
if (!process.env.FUNCTION_NAME) {
|
|
79
|
-
const PORT = process.env.PORT || 4000;
|
|
80
|
-
app.listen(PORT, () => {
|
|
81
|
-
console.log(`Node server listening on http://localhost:${PORT}`);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## 3. Add a Webpack Config for the Express Server
|
|
87
|
-
|
|
88
|
-
Create a new file named `webpack.server.config.js` to bundle the express app from previous step.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```js
|
|
92
|
-
const path = require('path');
|
|
93
|
-
const webpack = require('webpack');
|
|
94
|
-
|
|
95
|
-
const APP_NAME = 'YOUR_PROJECT_NAME'; // TODO: replace me!
|
|
96
|
-
|
|
97
|
-
module.exports = {
|
|
98
|
-
entry: { server: './server.ts' },
|
|
99
|
-
resolve: { extensions: ['.js', '.ts'] },
|
|
100
|
-
mode: 'development',
|
|
101
|
-
target: 'node',
|
|
102
|
-
externals: [
|
|
103
|
-
/* Firebase has some troubles being webpacked when in
|
|
104
|
-
in the Node environment, let's skip it.
|
|
105
|
-
Note: you may need to exclude other dependencies depending
|
|
106
|
-
on your project. */
|
|
107
|
-
/^firebase/
|
|
108
|
-
],
|
|
109
|
-
output: {
|
|
110
|
-
// Export a UMD of the webpacked server.ts & deps, for
|
|
111
|
-
// rendering in Cloud Functions
|
|
112
|
-
path: path.join(__dirname, `dist/${APP_NAME}-webpack`),
|
|
113
|
-
library: 'app',
|
|
114
|
-
libraryTarget: 'umd',
|
|
115
|
-
filename: '[name].js'
|
|
116
|
-
},
|
|
117
|
-
module: {
|
|
118
|
-
rules: [
|
|
119
|
-
{ test: /\.ts$/, loader: 'ts-loader' }
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
plugins: [
|
|
123
|
-
new webpack.ContextReplacementPlugin(
|
|
124
|
-
/(.+)?angular(\\|\/)core(.+)?/,
|
|
125
|
-
path.join(__dirname, 'src'), // location of your src
|
|
126
|
-
{} // a map of your routes
|
|
127
|
-
),
|
|
128
|
-
new webpack.ContextReplacementPlugin(
|
|
129
|
-
/(.+)?express(\\|\/)(.+)?/,
|
|
130
|
-
path.join(__dirname, 'src'),
|
|
131
|
-
{}
|
|
132
|
-
)
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## 4.0 Build Scripts
|
|
138
|
-
|
|
139
|
-
Update your `package.json` with the following build scripts, replacing `YOUR_PROJECT_NAME` with the name of your project.
|
|
140
|
-
|
|
141
|
-
```js
|
|
142
|
-
"scripts": {
|
|
143
|
-
// ... omitted
|
|
144
|
-
"build": "ng build && npm run build:ssr",
|
|
145
|
-
"build:ssr": "ng run YOUR_PROJECT_NAME:server && npm run webpack:ssr",
|
|
146
|
-
"webpack:ssr": "webpack --config webpack.server.config.js",
|
|
147
|
-
"serve:ssr": "node dist/YOUR_PROJECT_NAME-webpack/server.js"
|
|
148
|
-
},
|
|
149
|
-
```
|
|
23
|
+
Test your app locally by running `npm run dev:ssr`.
|
|
150
24
|
|
|
151
|
-
|
|
25
|
+
_Note: `dev:ssr` is a command that was added to your `package.json` by the `ng add` command that will run the dev server
|
|
26
|
+
for your Angular with Universal._
|
|
152
27
|
|
|
153
28
|
### [Next Step: Deploying your Universal application on Cloud Functions for Firebase](cloud-functions.md)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4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lzaGVyOiAnU3BvcnRzUHVibGlzaGVyJ1xuICogfSk7XG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgQXNzb2NpYXRlZFJlZmVyZW5jZTxUID0gRG9jdW1lbnREYXRhPiB7XG4gIHJlZjogQ29sbGVjdGlvblJlZmVyZW5jZTxUPjtcbiAgcXVlcnk6IFF1ZXJ5PFQ+O1xufVxuIl19
|
package/esm2015/core.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getApps } from 'firebase/app';
|
|
|
3
3
|
import { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';
|
|
4
4
|
import { isSupported as isMessagingSupported } from 'firebase/messaging';
|
|
5
5
|
import { isSupported as isAnalyticsSupported } from 'firebase/analytics';
|
|
6
|
-
export const VERSION = new Version('7.
|
|
6
|
+
export const VERSION = new Version('7.6.0-canary.60943d6');
|
|
7
7
|
const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
|
|
8
8
|
const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
|
|
9
9
|
const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
|
package/fesm2015/angular-fire.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isSupported } from 'firebase/analytics';
|
|
|
7
7
|
import { queueScheduler, asyncScheduler, Observable } from 'rxjs';
|
|
8
8
|
import { tap, observeOn, subscribeOn } from 'rxjs/operators';
|
|
9
9
|
|
|
10
|
-
const VERSION = new Version('7.
|
|
10
|
+
const VERSION = new Version('7.6.0-canary.60943d6');
|
|
11
11
|
const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
|
|
12
12
|
const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
|
|
13
13
|
const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fire.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.5.0');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","this"],"mappings":";;;;;;;;;MAOa,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAE3D,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AACvF,MAAM,kCAAkC,GAAG,oDAAoD,CAAC;AAChG,MAAM,oCAAoC,GAAG,+CAA+C,CAAC;AAC7F,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AAEvF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMA,WAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,CACpD,EAAC;AAEF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMC,aAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,CACpD,EAAC;AAEF,UAAU,CAAC,oCAAoC,MAA/C,UAAU,CAAC,oCAAoC,IAAMC,aAAuB,EAAE,CAAC,IAAI,CAAC,EAAE,IACpF,UAAU,CAAC,kCAAkC,CAAC,GAAG,EAAE,CACpD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,kCAAkC,CAAC,GAAG,KAAK,CACvD,EAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,MAAc,KACtC;iCAC+B,MAAM,0CAA0C,MAAM;gGACS,MAAM,MAAM,CAAC;MAEhG,4BAA4B,GAAG;IAC1C,KAAK,EAAE,MAAM,UAAU,CA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AC;AACX;;ACjNA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-fire.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\nimport { isSupported as isRemoteConfigSupported } from 'firebase/remote-config';\nimport { isSupported as isMessagingSupported } from 'firebase/messaging';\nimport { isSupported as isAnalyticsSupported } from 'firebase/analytics';\n\nexport const VERSION = new Version('7.6.0-canary.60943d6');\n\nconst isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';\nconst isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';\nconst isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';\nconst isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\n\nglobalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>\n globalThis[isAnalyticsSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isAnalyticsSupportedValueSymbol] = false\n);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isMessagingSupportedValueSymbol] = false\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\n).catch(() =>\n globalThis[isRemoteConfigSupportedValueSymbol] = false\n);\n\nconst isSupportedError = (module: string) =>\n `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\n\nexport const ɵisMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Messaging')); }\n return ret;\n }\n};\n\nexport const ɵisRemoteConfigSupportedFactory = {\n async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isRemoteConfigSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('RemoteConfig')); }\n return ret;\n }\n};\n\nexport const ɵisAnalyticsSupportedFactory = {\n async: () => globalThis[isAnalyticsSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isAnalyticsSupportedValueSymbol];\n if (ret === undefined) { throw new Error(isSupportedError('Analytics')); }\n return ret;\n }\n};\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nexport function ɵgetDefaultInstanceOf<T= unknown>(identifier: string, provided: T[]|undefined, defaultApp: FirebaseApp): T|undefined {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) { return provided[0]; }\n const providedUsingDefaultApp = provided.filter((it: any) => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) { return providedUsingDefaultApp[0]; }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer: FirebaseAppWithContainer = defaultApp as any;\n const provider = defaultAppWithContainer.container.getProvider(identifier as never);\n return provider.getImmediate({ optional: true });\n}\n\nexport const ɵgetAllInstancesOf = <T= unknown>(identifier: string, app?: FirebaseApp): Array<T> => {\n const apps = app ? [app] : getApps();\n const instances: Array<any> = [];\n apps.forEach((app: FirebaseAppWithContainer) => {\n const provider: any = app.container.getProvider(identifier as never);\n provider.instances.forEach((instance: any) => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\n","import { Injectable, NgZone } from '@angular/core';\nimport {\n asyncScheduler,\n Observable,\n Operator,\n queueScheduler,\n SchedulerAction,\n SchedulerLike,\n Subscriber,\n Subscription,\n TeardownLogic\n} from 'rxjs';\nimport { observeOn, subscribeOn, tap } from 'rxjs/operators';\n\nfunction noop() {\n}\n\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nexport class ɵZoneScheduler implements SchedulerLike {\n constructor(private zone: any, private delegate: any = queueScheduler) {\n }\n\n now() {\n return this.delegate.now();\n }\n\n schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function(this: SchedulerAction<any>, state: any) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n\nclass BlockUntilFirstOperator<T> implements Operator<T, T> {\n private task: MacroTask | null = null;\n\n constructor(private zone: any) {\n }\n\n call(subscriber: Subscriber<T>, source: Observable<T>): TeardownLogic {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n\n return source.pipe(\n tap({ next: unscheduleTask, complete: unscheduleTask, error: unscheduleTask })\n ).subscribe(subscriber).add(unscheduleTask);\n }\n\n private unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\n// tslint:disable-next-line:class-name\nexport class ɵAngularFireSchedulers {\n public readonly outsideAngular: ɵZoneScheduler;\n public readonly insideAngular: ɵZoneScheduler;\n\n constructor(public ngZone: NgZone) {\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n}\n\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler as ɵAngularFireSchedulers|undefined;\n if (!schedulers) {\n throw new Error(\n`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\n\nfunction runOutsideAngular<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\n\nfunction run<T>(fn: (...args: any[]) => T): T {\n return getSchedulers().ngZone.run(() => fn());\n}\n\nexport function observeOutsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\n\nexport function observeInsideAngular<T>(obs$: Observable<T>): Observable<T> {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\n\nexport function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n const scheduler = getSchedulers();\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nexport function ɵkeepUnstableUntilFirstFactory(schedulers: ɵAngularFireSchedulers) {\n return function keepUnstableUntilFirst<T>(obs$: Observable<T>): Observable<T> {\n obs$ = obs$.lift(\n new BlockUntilFirstOperator(schedulers.ngZone)\n );\n\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n\nconst zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined) => {\n const _this = this;\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\n\nexport const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n let macrotask: MacroTask | undefined;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(\n subscribeOn(schedulers.outsideAngular),\n observeOn(schedulers.insideAngular),\n );\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst) as any;\n } else if (ret instanceof Promise) {\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n // tslint:disable-next-line:only-arrow-functions\n return function() {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n } as any;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["isAnalyticsSupported","isMessagingSupported","isRemoteConfigSupported","this"],"mappings":";;;;;;;;;MAOa,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAE3D,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AACvF,MAAM,kCAAkC,GAAG,oDAAoD,CAAC;AAChG,MAAM,oCAAoC,GAAG,+CAA+C,CAAC;AAC7F,MAAM,+BAA+B,GAAG,iDAAiD,CAAC;AAC1F,MAAM,iCAAiC,GAAG,4CAA4C,CAAC;AAEvF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMA,WAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,CACpD,EAAC;AAEF,UAAU,CAAC,iCAAiC,MAA5C,UAAU,CAAC,iCAAiC,IAAMC,aAAoB,EAAE,CAAC,IAAI,CAAC,EAAE,IAC9E,UAAU,CAAC,+BAA+B,CAAC,GAAG,EAAE,CACjD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,+BAA+B,CAAC,GAAG,KAAK,CACpD,EAAC;AAEF,UAAU,CAAC,oCAAoC,MAA/C,UAAU,CAAC,oCAAoC,IAAMC,aAAuB,EAAE,CAAC,IAAI,CAAC,EAAE,IACpF,UAAU,CAAC,kCAAkC,CAAC,GAAG,EAAE,CACpD,CAAC,KAAK,CAAC,MACN,UAAU,CAAC,kCAAkC,CAAC,GAAG,KAAK,CACvD,EAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,MAAc,KACtC;iCAC+B,MAAM,0CAA0C,MAAM;gGACS,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SACH;aAAM;;YAEL,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SACvB;KACK,CAAC;AACX;;ACjNA;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@angular/fire",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.6.0-canary.60943d6",
|
|
5
5
|
"description": "The official Angular library for Firebase.",
|
|
6
6
|
"schematics": "./schematics/collection.json",
|
|
7
7
|
"builders": "./schematics/builders.json",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"author": "angular,firebase",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@angular/common": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
27
|
-
"@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
28
|
-
"@angular/platform-browser": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
29
|
-
"@angular/platform-browser-dynamic": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
26
|
+
"@angular/common": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
27
|
+
"@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
28
|
+
"@angular/platform-browser": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
29
|
+
"@angular/platform-browser-dynamic": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
30
30
|
"rxjs": "~6.6.0 || ^7.0.0",
|
|
31
|
-
"firebase-tools": "^9.9.0 || ^10.0.0 || ^11.0.0"
|
|
31
|
+
"firebase-tools": "^9.9.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
"firebase-tools": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"firebase": "^9.8.0",
|
|
40
40
|
"rxfire": "^6.0.0",
|
|
41
|
-
"@angular-devkit/schematics": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
42
|
-
"@schematics/angular": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
41
|
+
"@angular-devkit/schematics": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
42
|
+
"@schematics/angular": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
43
43
|
"tslib": "^2.0.0",
|
|
44
44
|
"fuzzy": "^0.1.3",
|
|
45
45
|
"inquirer-autocomplete-prompt": "^1.0.1",
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"node-fetch": "^2.6.1",
|
|
52
52
|
"semver": "^7.1.3",
|
|
53
53
|
"inquirer": "^8.1.1",
|
|
54
|
-
"fs-extra": "^8.0.1"
|
|
55
|
-
"file-loader": "^6.2.0"
|
|
54
|
+
"fs-extra": "^8.0.1"
|
|
56
55
|
},
|
|
57
56
|
"ng-update": {
|
|
58
57
|
"migrations": "./schematics/migration.json"
|
|
@@ -93,7 +93,7 @@ const deployToHosting = (firebaseTools, context, workspaceRoot, options, firebas
|
|
|
93
93
|
yield firebaseTools.serve({
|
|
94
94
|
port: DEFAULT_EMULATOR_PORT,
|
|
95
95
|
host: DEFAULT_EMULATOR_HOST,
|
|
96
|
-
|
|
96
|
+
only: `hosting:${siteTarget}`,
|
|
97
97
|
nonInteractive: true,
|
|
98
98
|
projectRoot: workspaceRoot,
|
|
99
99
|
});
|
|
@@ -105,6 +105,7 @@ const deployToHosting = (firebaseTools, context, workspaceRoot, options, firebas
|
|
|
105
105
|
if (!deployProject) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
+
process.env.FIREBASE_FRAMEWORKS_SKIP_BUILD = 'true';
|
|
108
109
|
}
|
|
109
110
|
return yield firebaseTools.deploy({
|
|
110
111
|
only: `hosting:${siteTarget}`,
|
|
@@ -314,11 +315,15 @@ const deployToCloudRun = (firebaseTools, context, workspaceRoot, staticBuildTarg
|
|
|
314
315
|
exports.deployToCloudRun = deployToCloudRun;
|
|
315
316
|
function deploy(firebaseTools, context, staticBuildTarget, serverBuildTarget, prerenderBuildTarget, firebaseProject, options, firebaseToken) {
|
|
316
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
-
if (!firebaseToken) {
|
|
318
|
+
if (!firebaseToken && !process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
318
319
|
yield firebaseTools.login();
|
|
319
320
|
const user = yield firebaseTools.login({ projectRoot: context.workspaceRoot });
|
|
320
321
|
console.log(`Logged into Firebase as ${user.email}.`);
|
|
321
322
|
}
|
|
323
|
+
if (!firebaseToken && process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
324
|
+
yield spawnAsync(`gcloud auth activate-service-account --key-file ${process.env.GOOGLE_APPLICATION_CREDENTIALS}`);
|
|
325
|
+
console.log(`Using Google Application Credentials.`);
|
|
326
|
+
}
|
|
322
327
|
if (prerenderBuildTarget) {
|
|
323
328
|
const run = yield context.scheduleTarget(architect_1.targetFromTargetString(prerenderBuildTarget.name), prerenderBuildTarget.options);
|
|
324
329
|
yield run.result;
|
|
@@ -364,7 +369,7 @@ function deploy(firebaseTools, context, staticBuildTarget, serverBuildTarget, pr
|
|
|
364
369
|
})
|
|
365
370
|
});
|
|
366
371
|
firebaseTools.logger.logger.add(logger);
|
|
367
|
-
if (serverBuildTarget) {
|
|
372
|
+
if ((!options.version || options.version < 2) && serverBuildTarget) {
|
|
368
373
|
if (options.ssr === 'cloud-run') {
|
|
369
374
|
yield exports.deployToCloudRun(firebaseTools, context, context.workspaceRoot, staticBuildTarget, serverBuildTarget, options, firebaseToken);
|
|
370
375
|
}
|
|
@@ -23,14 +23,14 @@ exports.default = architect_1.createBuilder((options, context) => __awaiter(void
|
|
|
23
23
|
const [defaultFirebaseProject, defulatFirebaseHostingSite] = utils_1.getFirebaseProjectNameFromFs(context.workspaceRoot, context.target.project);
|
|
24
24
|
const firebaseProject = options.firebaseProject || defaultFirebaseProject;
|
|
25
25
|
if (!firebaseProject) {
|
|
26
|
-
throw new Error('Cannot
|
|
26
|
+
throw new Error('Cannot determine the Firebase Project from your angular.json or .firebaserc');
|
|
27
27
|
}
|
|
28
28
|
if (firebaseProject !== defaultFirebaseProject) {
|
|
29
29
|
throw new Error('The Firebase Project specified by your angular.json or .firebaserc is in conflict');
|
|
30
30
|
}
|
|
31
31
|
const firebaseHostingSite = options.firebaseHostingSite || defulatFirebaseHostingSite;
|
|
32
32
|
if (!firebaseHostingSite) {
|
|
33
|
-
throw new Error(`Cannot
|
|
33
|
+
throw new Error(`Cannot determine the Firebase Hosting Site from your angular.json or .firebaserc`);
|
|
34
34
|
}
|
|
35
35
|
if (firebaseHostingSite !== defulatFirebaseHostingSite) {
|
|
36
36
|
throw new Error('The Firebase Hosting Site specified by your angular.json or .firebaserc is in conflict');
|
|
@@ -29,12 +29,14 @@ const semver = __importStar(require("semver"));
|
|
|
29
29
|
const getFirebaseTools = () => globalThis.firebaseTools ?
|
|
30
30
|
Promise.resolve(globalThis.firebaseTools) :
|
|
31
31
|
new Promise((resolve, reject) => {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = process.env).FIREBASE_CLI_EXPERIMENTS || (_a.FIREBASE_CLI_EXPERIMENTS = 'webframeworks');
|
|
32
34
|
try {
|
|
33
35
|
resolve(require('firebase-tools'));
|
|
34
36
|
}
|
|
35
37
|
catch (e) {
|
|
36
38
|
try {
|
|
37
|
-
const root = child_process_1.execSync('npm root
|
|
39
|
+
const root = child_process_1.execSync('npm root --location=global').toString().trim();
|
|
38
40
|
resolve(require(`${root}/firebase-tools`));
|
|
39
41
|
}
|
|
40
42
|
catch (e) {
|
|
@@ -42,7 +44,7 @@ const getFirebaseTools = () => globalThis.firebaseTools ?
|
|
|
42
44
|
text: `Installing firebase-tools...`,
|
|
43
45
|
discardStdin: process.platform !== 'win32',
|
|
44
46
|
}).start();
|
|
45
|
-
child_process_1.spawn('npm', ['i', '
|
|
47
|
+
child_process_1.spawn('npm', ['i', '--location=global', 'firebase-tools'], {
|
|
46
48
|
stdio: 'pipe',
|
|
47
49
|
shell: true,
|
|
48
50
|
}).on('close', (code) => {
|
|
@@ -9,16 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ngAddSetupProject = exports.setupProject = void 0;
|
|
12
|
+
exports.setupFirebase = exports.generateFirebaseJson = exports.ngAddSetupProject = exports.setupProject = void 0;
|
|
13
13
|
const core_1 = require("@angular-devkit/core");
|
|
14
14
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
15
15
|
const utils_1 = require("../utils");
|
|
16
16
|
const prompts_1 = require("./prompts");
|
|
17
|
-
const ssr_1 = require("./ssr");
|
|
18
|
-
const static_1 = require("./static");
|
|
19
17
|
const firebaseTools_1 = require("../firebaseTools");
|
|
20
18
|
const fs_1 = require("fs");
|
|
21
19
|
const path_1 = require("path");
|
|
20
|
+
const common_1 = require("../common");
|
|
22
21
|
const setupProject = (tree, context, features, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
22
|
var _a;
|
|
24
23
|
const { path: workspacePath, workspace } = utils_1.getWorkspace(tree);
|
|
@@ -53,36 +52,21 @@ ${Object.entries(config.sdkConfig).reduce((c, [k, v]) => c.concat(` ${k}: '${
|
|
|
53
52
|
firebaseApp: config.firebaseApp,
|
|
54
53
|
firebaseHostingSite: config.firebaseHostingSite,
|
|
55
54
|
sdkConfig: config.sdkConfig,
|
|
56
|
-
prerender:
|
|
55
|
+
prerender: undefined,
|
|
57
56
|
browserTarget: config.browserTarget,
|
|
58
57
|
serverTarget: config.serverTarget,
|
|
59
58
|
prerenderTarget: config.prerenderTarget,
|
|
59
|
+
ssrRegion: config.ssrRegion,
|
|
60
60
|
};
|
|
61
61
|
if (features.includes(0)) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
context,
|
|
71
|
-
project,
|
|
72
|
-
projectType: config.projectType,
|
|
73
|
-
nodeVersion: config.nodeVersion,
|
|
74
|
-
});
|
|
75
|
-
case 0:
|
|
76
|
-
return static_1.setupStaticDeployment({
|
|
77
|
-
workspace,
|
|
78
|
-
workspacePath,
|
|
79
|
-
options,
|
|
80
|
-
tree,
|
|
81
|
-
context,
|
|
82
|
-
project
|
|
83
|
-
});
|
|
84
|
-
default: throw (new schematics_1.SchematicsException(`Unimplemented PROJECT_TYPE ${config.projectType}`));
|
|
85
|
-
}
|
|
62
|
+
return exports.setupFirebase({
|
|
63
|
+
workspace,
|
|
64
|
+
workspacePath,
|
|
65
|
+
options,
|
|
66
|
+
tree,
|
|
67
|
+
context,
|
|
68
|
+
project
|
|
69
|
+
});
|
|
86
70
|
}
|
|
87
71
|
else {
|
|
88
72
|
return Promise.resolve();
|
|
@@ -105,7 +89,7 @@ const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void
|
|
|
105
89
|
const { project: ngProject, projectName: ngProjectName } = utils_1.getProject(options, host);
|
|
106
90
|
const [defaultProjectName] = utils_1.getFirebaseProjectNameFromHost(host, ngProjectName);
|
|
107
91
|
const firebaseProject = yield prompts_1.projectPrompt(defaultProjectName, { projectRoot, account: user.email });
|
|
108
|
-
let hosting = {
|
|
92
|
+
let hosting = {};
|
|
109
93
|
let firebaseHostingSite;
|
|
110
94
|
if (features.includes(0)) {
|
|
111
95
|
const results = yield prompts_1.projectTypePrompt(ngProject, ngProjectName);
|
|
@@ -124,3 +108,48 @@ const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void
|
|
|
124
108
|
}
|
|
125
109
|
});
|
|
126
110
|
exports.ngAddSetupProject = ngAddSetupProject;
|
|
111
|
+
function generateFirebaseJson(tree, path, project, region) {
|
|
112
|
+
const firebaseJson = tree.exists(path)
|
|
113
|
+
? common_1.safeReadJSON(path, tree)
|
|
114
|
+
: {};
|
|
115
|
+
const newConfig = {
|
|
116
|
+
target: project,
|
|
117
|
+
source: '.',
|
|
118
|
+
frameworksBackend: {
|
|
119
|
+
region
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
if (firebaseJson.hosting === undefined) {
|
|
123
|
+
firebaseJson.hosting = [newConfig];
|
|
124
|
+
}
|
|
125
|
+
else if (Array.isArray(firebaseJson.hosting)) {
|
|
126
|
+
const existingConfigIndex = firebaseJson.hosting.findIndex(config => config.target === newConfig.target);
|
|
127
|
+
if (existingConfigIndex > -1) {
|
|
128
|
+
firebaseJson.hosting.splice(existingConfigIndex, 1, newConfig);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
firebaseJson.hosting.push(newConfig);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
firebaseJson.hosting = [firebaseJson.hosting, newConfig];
|
|
136
|
+
}
|
|
137
|
+
common_1.overwriteIfExists(tree, path, common_1.stringifyFormatted(firebaseJson));
|
|
138
|
+
}
|
|
139
|
+
exports.generateFirebaseJson = generateFirebaseJson;
|
|
140
|
+
const setupFirebase = (config) => {
|
|
141
|
+
const { tree, workspacePath, workspace, options } = config;
|
|
142
|
+
const project = workspace.projects[options.project];
|
|
143
|
+
if (!project.architect) {
|
|
144
|
+
throw new schematics_1.SchematicsException(`Angular project "${options.project}" has a malformed angular.json`);
|
|
145
|
+
}
|
|
146
|
+
project.architect.deploy = {
|
|
147
|
+
builder: '@angular/fire:deploy',
|
|
148
|
+
options: Object.assign(Object.assign({ version: 2, browserTarget: options.browserTarget }, (options.serverTarget ? { serverTarget: options.serverTarget } : {})), (options.prerenderTarget ? { prerenderTarget: options.prerenderTarget } : {}))
|
|
149
|
+
};
|
|
150
|
+
tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2));
|
|
151
|
+
generateFirebaseJson(tree, 'firebase.json', options.project, options.ssrRegion);
|
|
152
|
+
common_1.generateFirebaseRc(tree, '.firebaserc', options.firebaseProject.projectId, options.firebaseHostingSite, options.project);
|
|
153
|
+
return tree;
|
|
154
|
+
};
|
|
155
|
+
exports.setupFirebase = setupFirebase;
|
|
@@ -243,61 +243,33 @@ const sitePrompt = ({ projectId: project }, options) => __awaiter(void 0, void 0
|
|
|
243
243
|
return (yield sites).find(it => common_1.shortSiteName(it) === siteName);
|
|
244
244
|
});
|
|
245
245
|
exports.sitePrompt = sitePrompt;
|
|
246
|
+
const DEFAULT_REGION = 'us-central1';
|
|
247
|
+
const ALLOWED_SSR_REGIONS = [
|
|
248
|
+
{ name: 'us-central1 (Iowa)', value: 'us-central1' },
|
|
249
|
+
{ name: 'us-west1 (Oregon)', value: 'us-west1' },
|
|
250
|
+
{ name: 'us-east1 (South Carolina)', value: 'us-east1' },
|
|
251
|
+
{ name: 'europe-west1 (Belgium)', value: 'europe-west1' },
|
|
252
|
+
{ name: 'asia-east1 (Taiwan)', value: 'asia-east1' },
|
|
253
|
+
];
|
|
246
254
|
const projectTypePrompt = (project, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
247
|
-
var _b, _c, _d, _e, _f, _g
|
|
248
|
-
let prerender = false;
|
|
249
|
-
let nodeVersion;
|
|
255
|
+
var _b, _c, _d, _e, _f, _g;
|
|
250
256
|
let serverTarget;
|
|
251
257
|
let browserTarget = `${name}:build:${((_c = (_b = project.architect) === null || _b === void 0 ? void 0 : _b.build) === null || _c === void 0 ? void 0 : _c.defaultConfiguration) || 'production'}`;
|
|
252
258
|
let prerenderTarget;
|
|
253
259
|
if (utils_1.isUniversalApp(project)) {
|
|
254
260
|
serverTarget = `${name}:server:${((_e = (_d = project.architect) === null || _d === void 0 ? void 0 : _d.server) === null || _e === void 0 ? void 0 : _e.defaultConfiguration) || 'production'}`;
|
|
255
261
|
browserTarget = `${name}:build:${((_g = (_f = project.architect) === null || _f === void 0 ? void 0 : _f.build) === null || _g === void 0 ? void 0 : _g.defaultConfiguration) || 'production'}`;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
type: 'confirm',
|
|
260
|
-
name: 'shouldPrerender',
|
|
261
|
-
message: 'Should we prerender before deployment?',
|
|
262
|
-
default: true
|
|
263
|
-
});
|
|
264
|
-
prerender = shouldPrerender;
|
|
265
|
-
}
|
|
266
|
-
const choices = [
|
|
267
|
-
{ name: prerender ? 'Pre-render only' : 'Don\'t render universal content', value: 0 },
|
|
268
|
-
{ name: 'Cloud Functions', value: 1 },
|
|
269
|
-
{ name: 'Cloud Run', value: 2 },
|
|
270
|
-
];
|
|
271
|
-
const { projectType } = yield inquirer.prompt({
|
|
262
|
+
const prerender = utils_1.hasPrerenderOption(project);
|
|
263
|
+
prerenderTarget = prerender && `${name}:prerender:${prerender.defaultConfiguration || 'production'}`;
|
|
264
|
+
const { ssrRegion } = yield inquirer.prompt({
|
|
272
265
|
type: 'list',
|
|
273
|
-
name: '
|
|
274
|
-
choices,
|
|
275
|
-
message: '
|
|
276
|
-
default:
|
|
266
|
+
name: 'ssrRegion',
|
|
267
|
+
choices: ALLOWED_SSR_REGIONS,
|
|
268
|
+
message: 'In which region would you like to host server-side content?',
|
|
269
|
+
default: DEFAULT_REGION,
|
|
277
270
|
});
|
|
278
|
-
|
|
279
|
-
const { newNodeVersion } = yield inquirer.prompt({
|
|
280
|
-
type: 'list',
|
|
281
|
-
name: 'newNodeVersion',
|
|
282
|
-
choices: ['12', '14', '16'],
|
|
283
|
-
message: 'What version of Node.js would you like to use?',
|
|
284
|
-
default: parseInt(process.versions.node, 10).toString(),
|
|
285
|
-
});
|
|
286
|
-
nodeVersion = newNodeVersion;
|
|
287
|
-
}
|
|
288
|
-
else if (projectType === 2) {
|
|
289
|
-
const fetch = require('node-fetch');
|
|
290
|
-
const { newNodeVersion } = yield inquirer.prompt({
|
|
291
|
-
type: 'input',
|
|
292
|
-
name: 'newNodeVersion',
|
|
293
|
-
message: 'What version of Node.js would you like to use?',
|
|
294
|
-
validate: it => fetch(`https://hub.docker.com/v2/repositories/library/node/tags/${it}-slim`).then(it => it.status === 200 || `Can't find node:${it}-slim docker image.`),
|
|
295
|
-
default: parseFloat(process.versions.node).toString(),
|
|
296
|
-
});
|
|
297
|
-
nodeVersion = newNodeVersion;
|
|
298
|
-
}
|
|
299
|
-
return { prerender, projectType, nodeVersion, browserTarget, serverTarget, prerenderTarget };
|
|
271
|
+
return { prerender, projectType: 3, ssrRegion, browserTarget, serverTarget, prerenderTarget };
|
|
300
272
|
}
|
|
301
|
-
return { projectType:
|
|
273
|
+
return { projectType: 3, browserTarget, serverTarget, prerenderTarget };
|
|
302
274
|
});
|
|
303
275
|
exports.projectTypePrompt = projectTypePrompt;
|