@angular/fire 7.1.0-rc.3 → 7.1.1

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.
Files changed (183) hide show
  1. package/analytics/analytics.module.d.ts +9 -6
  2. package/analytics/firebase.d.ts +2 -2
  3. package/analytics/overrides.d.ts +1 -0
  4. package/analytics/public_api.d.ts +2 -0
  5. package/analytics/screen-tracking.service.d.ts +40 -0
  6. package/analytics/user-tracking.service.d.ts +11 -0
  7. package/app/app.module.d.ts +3 -3
  8. package/app-check/app-check.module.d.ts +3 -3
  9. package/auth/auth.module.d.ts +3 -3
  10. package/auth-guard/angular-fire-auth-guard.d.ts +5 -0
  11. package/auth-guard/auth-guard.d.ts +29 -0
  12. package/auth-guard/auth-guard.module.d.ts +7 -0
  13. package/auth-guard/package.json +11 -0
  14. package/auth-guard/public_api.d.ts +2 -0
  15. package/bundles/angular-fire-analytics.umd.js +548 -41
  16. package/bundles/angular-fire-analytics.umd.js.map +1 -1
  17. package/bundles/angular-fire-app-check.umd.js +336 -18
  18. package/bundles/angular-fire-app-check.umd.js.map +1 -1
  19. package/bundles/angular-fire-app.umd.js +323 -3
  20. package/bundles/angular-fire-app.umd.js.map +1 -1
  21. package/bundles/angular-fire-auth-guard.umd.js +109 -0
  22. package/bundles/angular-fire-auth-guard.umd.js.map +1 -0
  23. package/bundles/angular-fire-auth.umd.js +324 -9
  24. package/bundles/angular-fire-auth.umd.js.map +1 -1
  25. package/bundles/angular-fire-compat-analytics.umd.js +16 -112
  26. package/bundles/angular-fire-compat-analytics.umd.js.map +1 -1
  27. package/bundles/angular-fire-compat-auth.umd.js +1 -1
  28. package/bundles/angular-fire-compat-auth.umd.js.map +1 -1
  29. package/bundles/angular-fire-compat-database.umd.js +1 -1
  30. package/bundles/angular-fire-compat-database.umd.js.map +1 -1
  31. package/bundles/angular-fire-compat-firestore.umd.js +1 -1
  32. package/bundles/angular-fire-compat-firestore.umd.js.map +1 -1
  33. package/bundles/angular-fire-compat-functions.umd.js +1 -1
  34. package/bundles/angular-fire-compat-functions.umd.js.map +1 -1
  35. package/bundles/angular-fire-compat-messaging.umd.js +5 -5
  36. package/bundles/angular-fire-compat-messaging.umd.js.map +1 -1
  37. package/bundles/angular-fire-compat-performance.umd.js +5 -5
  38. package/bundles/angular-fire-compat-performance.umd.js.map +1 -1
  39. package/bundles/angular-fire-compat-remote-config.umd.js +5 -5
  40. package/bundles/angular-fire-compat-remote-config.umd.js.map +1 -1
  41. package/bundles/angular-fire-compat-storage.umd.js +2 -1
  42. package/bundles/angular-fire-compat-storage.umd.js.map +1 -1
  43. package/bundles/angular-fire-compat.umd.js +38 -2
  44. package/bundles/angular-fire-compat.umd.js.map +1 -1
  45. package/bundles/angular-fire-database.umd.js +323 -6
  46. package/bundles/angular-fire-database.umd.js.map +1 -1
  47. package/bundles/angular-fire-firestore-lite.umd.js +327 -9
  48. package/bundles/angular-fire-firestore-lite.umd.js.map +1 -1
  49. package/bundles/angular-fire-firestore.umd.js +323 -8
  50. package/bundles/angular-fire-firestore.umd.js.map +1 -1
  51. package/bundles/angular-fire-functions.umd.js +323 -6
  52. package/bundles/angular-fire-functions.umd.js.map +1 -1
  53. package/bundles/angular-fire-messaging.umd.js +339 -24
  54. package/bundles/angular-fire-messaging.umd.js.map +1 -1
  55. package/bundles/angular-fire-performance.umd.js +339 -11
  56. package/bundles/angular-fire-performance.umd.js.map +1 -1
  57. package/bundles/angular-fire-remote-config.umd.js +342 -6
  58. package/bundles/angular-fire-remote-config.umd.js.map +1 -1
  59. package/bundles/angular-fire-storage.umd.js +324 -7
  60. package/bundles/angular-fire-storage.umd.js.map +1 -1
  61. package/bundles/angular-fire.umd.js +43 -371
  62. package/bundles/angular-fire.umd.js.map +1 -1
  63. package/compat/analytics/screen-tracking.service.d.ts +2 -2
  64. package/compat/cache.d.ts +1 -0
  65. package/compat/public_api.d.ts +1 -0
  66. package/compat/storage/interfaces.d.ts +1 -0
  67. package/compat/storage/ref.d.ts +2 -1
  68. package/core.d.ts +13 -3
  69. package/database/database.module.d.ts +3 -3
  70. package/docs/deploy/getting-started.md +62 -1
  71. package/docs/version-7-upgrade.md +1 -1
  72. package/esm2015/analytics/analytics.module.js +33 -27
  73. package/esm2015/analytics/firebase.js +3 -3
  74. package/esm2015/analytics/overrides.js +3 -0
  75. package/esm2015/analytics/public_api.js +3 -1
  76. package/esm2015/analytics/screen-tracking.service.js +139 -0
  77. package/esm2015/analytics/user-tracking.service.js +43 -0
  78. package/esm2015/app/app.module.js +12 -7
  79. package/esm2015/app-check/app-check.js +1 -2
  80. package/esm2015/app-check/app-check.module.js +19 -14
  81. package/esm2015/auth/auth.js +1 -2
  82. package/esm2015/auth/auth.module.js +10 -9
  83. package/esm2015/auth-guard/angular-fire-auth-guard.js +5 -0
  84. package/esm2015/auth-guard/auth-guard.js +49 -0
  85. package/esm2015/auth-guard/auth-guard.module.js +20 -0
  86. package/esm2015/auth-guard/public_api.js +3 -0
  87. package/esm2015/compat/analytics/analytics.js +2 -3
  88. package/esm2015/compat/analytics/screen-tracking.service.js +11 -100
  89. package/esm2015/compat/auth/auth.js +2 -3
  90. package/esm2015/compat/cache.js +32 -0
  91. package/esm2015/compat/database/database.js +2 -3
  92. package/esm2015/compat/firestore/firestore.js +2 -3
  93. package/esm2015/compat/functions/functions.js +2 -3
  94. package/esm2015/compat/messaging/messaging.js +3 -3
  95. package/esm2015/compat/performance/performance.js +2 -3
  96. package/esm2015/compat/public_api.js +2 -1
  97. package/esm2015/compat/remote-config/remote-config.js +4 -5
  98. package/esm2015/compat/storage/interfaces.js +1 -1
  99. package/esm2015/compat/storage/ref.js +2 -1
  100. package/esm2015/compat/storage/storage.js +3 -3
  101. package/esm2015/core.js +44 -52
  102. package/esm2015/database/database.module.js +9 -7
  103. package/esm2015/firestore/firestore.module.js +9 -9
  104. package/esm2015/firestore/lite/lite.module.js +11 -7
  105. package/esm2015/functions/functions.module.js +9 -7
  106. package/esm2015/messaging/firebase.js +3 -3
  107. package/esm2015/messaging/messaging.module.js +19 -21
  108. package/esm2015/messaging/overrides.js +3 -0
  109. package/esm2015/performance/performance.module.js +22 -8
  110. package/esm2015/remote-config/firebase.js +2 -1
  111. package/esm2015/remote-config/overrides.js +3 -0
  112. package/esm2015/remote-config/remote-config.module.js +25 -7
  113. package/esm2015/storage/storage.module.js +10 -8
  114. package/esm2015/zones.js +3 -2
  115. package/fesm2015/angular-fire-analytics.js +209 -40
  116. package/fesm2015/angular-fire-analytics.js.map +1 -1
  117. package/fesm2015/angular-fire-app-check.js +18 -14
  118. package/fesm2015/angular-fire-app-check.js.map +1 -1
  119. package/fesm2015/angular-fire-app.js +11 -6
  120. package/fesm2015/angular-fire-app.js.map +1 -1
  121. package/fesm2015/angular-fire-auth-guard.js +72 -0
  122. package/fesm2015/angular-fire-auth-guard.js.map +1 -0
  123. package/fesm2015/angular-fire-auth.js +9 -9
  124. package/fesm2015/angular-fire-auth.js.map +1 -1
  125. package/fesm2015/angular-fire-compat-analytics.js +10 -98
  126. package/fesm2015/angular-fire-compat-analytics.js.map +1 -1
  127. package/fesm2015/angular-fire-compat-auth.js +2 -2
  128. package/fesm2015/angular-fire-compat-auth.js.map +1 -1
  129. package/fesm2015/angular-fire-compat-database.js +2 -2
  130. package/fesm2015/angular-fire-compat-database.js.map +1 -1
  131. package/fesm2015/angular-fire-compat-firestore.js +2 -2
  132. package/fesm2015/angular-fire-compat-firestore.js.map +1 -1
  133. package/fesm2015/angular-fire-compat-functions.js +2 -2
  134. package/fesm2015/angular-fire-compat-functions.js.map +1 -1
  135. package/fesm2015/angular-fire-compat-messaging.js +2 -2
  136. package/fesm2015/angular-fire-compat-messaging.js.map +1 -1
  137. package/fesm2015/angular-fire-compat-performance.js +2 -2
  138. package/fesm2015/angular-fire-compat-performance.js.map +1 -1
  139. package/fesm2015/angular-fire-compat-remote-config.js +4 -4
  140. package/fesm2015/angular-fire-compat-remote-config.js.map +1 -1
  141. package/fesm2015/angular-fire-compat-storage.js +3 -2
  142. package/fesm2015/angular-fire-compat-storage.js.map +1 -1
  143. package/fesm2015/angular-fire-compat.js +34 -3
  144. package/fesm2015/angular-fire-compat.js.map +1 -1
  145. package/fesm2015/angular-fire-database.js +8 -6
  146. package/fesm2015/angular-fire-database.js.map +1 -1
  147. package/fesm2015/angular-fire-firestore-lite.js +10 -6
  148. package/fesm2015/angular-fire-firestore-lite.js.map +1 -1
  149. package/fesm2015/angular-fire-firestore.js +8 -8
  150. package/fesm2015/angular-fire-firestore.js.map +1 -1
  151. package/fesm2015/angular-fire-functions.js +8 -6
  152. package/fesm2015/angular-fire-functions.js.map +1 -1
  153. package/fesm2015/angular-fire-messaging.js +22 -22
  154. package/fesm2015/angular-fire-messaging.js.map +1 -1
  155. package/fesm2015/angular-fire-performance.js +21 -7
  156. package/fesm2015/angular-fire-performance.js.map +1 -1
  157. package/fesm2015/angular-fire-remote-config.js +27 -7
  158. package/fesm2015/angular-fire-remote-config.js.map +1 -1
  159. package/fesm2015/angular-fire-storage.js +9 -7
  160. package/fesm2015/angular-fire-storage.js.map +1 -1
  161. package/fesm2015/angular-fire.js +46 -53
  162. package/fesm2015/angular-fire.js.map +1 -1
  163. package/firestore/firestore.module.d.ts +3 -3
  164. package/firestore/lite/lite.module.d.ts +3 -3
  165. package/functions/functions.module.d.ts +3 -3
  166. package/messaging/firebase.d.ts +2 -2
  167. package/messaging/messaging.module.d.ts +4 -4
  168. package/messaging/overrides.d.ts +1 -0
  169. package/package.json +9 -3
  170. package/performance/performance.module.d.ts +4 -4
  171. package/remote-config/firebase.d.ts +1 -0
  172. package/remote-config/overrides.d.ts +1 -0
  173. package/remote-config/remote-config.module.d.ts +3 -3
  174. package/schematics/deploy/actions.js +40 -26
  175. package/schematics/deploy/schema.json +4 -0
  176. package/schematics/firebaseTools.js +22 -2
  177. package/schematics/setup/index.js +9 -2
  178. package/schematics/setup/prompts.js +1 -1
  179. package/schematics/setup/ssr.js +7 -1
  180. package/schematics/setup/static.js +9 -3
  181. package/schematics/utils.js +1 -1
  182. package/schematics/versions.json +1 -1
  183. package/storage/storage.module.d.ts +3 -3
@@ -1,63 +1,55 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Version, isDevMode, Injectable } from '@angular/core';
2
+ import { Version, Injectable } from '@angular/core';
3
3
  import { getApps } from 'firebase/app';
4
+ import { isSupported as isSupported$2 } from 'firebase/remote-config';
5
+ import { isSupported as isSupported$1 } from 'firebase/messaging';
6
+ import { isSupported } from 'firebase/analytics';
4
7
  import { queueScheduler, asyncScheduler, Observable } from 'rxjs';
5
8
  import { tap, observeOn, subscribeOn } from 'rxjs/operators';
6
9
 
7
- var _a, _b, _c;
8
- const VERSION = new Version('7.1.0-rc.3');
9
- const IS_HMR = !!module.hot;
10
- const log = (level, ...args) => {
11
- if (isDevMode() && typeof console !== 'undefined') {
12
- console[level](...args);
10
+ const VERSION = new Version('7.1.1');
11
+ const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue';
12
+ const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported';
13
+ const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue';
14
+ const isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported';
15
+ const isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';
16
+ const isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';
17
+ globalThis[isAnalyticsSupportedPromiseSymbol] || (globalThis[isAnalyticsSupportedPromiseSymbol] = isSupported().then(it => globalThis[isAnalyticsSupportedValueSymbol] = it));
18
+ globalThis[isMessagingSupportedPromiseSymbol] || (globalThis[isMessagingSupportedPromiseSymbol] = isSupported$1().then(it => globalThis[isMessagingSupportedValueSymbol] = it));
19
+ globalThis[isRemoteConfigSupportedPromiseSymbol] || (globalThis[isRemoteConfigSupportedPromiseSymbol] = isSupported$2().then(it => globalThis[isRemoteConfigSupportedValueSymbol] = it));
20
+ const isSupportedError = (module) => `The APP_INITIALIZER that is "making" isSupported() sync for the sake of convenient DI has not resolved in this
21
+ context. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling
22
+ \`await isSupported()\`, then retrieve the instance from the injector manually \`injector.get(${module})\`.`;
23
+ const ɵisMessagingSupportedFactory = {
24
+ async: () => globalThis[isMessagingSupportedPromiseSymbol],
25
+ sync: () => {
26
+ const ret = globalThis[isMessagingSupportedValueSymbol];
27
+ if (ret === undefined) {
28
+ throw new Error(isSupportedError('Messaging'));
29
+ }
30
+ return ret;
13
31
  }
14
32
  };
15
- function ɵcacheInstance(cacheKey, moduleName, appName, fn, deps) {
16
- const [, instance, cachedDeps] = globalThis.ɵAngularfireInstanceCache.find((it) => it[0] === cacheKey) || [];
17
- if (instance) {
18
- if (!matchDep(deps, cachedDeps)) {
19
- log('error', `${moduleName} was already initialized on the ${appName} Firebase App with different settings.${IS_HMR ? ' You may need to reload as Firebase is not HMR aware.' : ''}`);
20
- log('warn', { is: deps, was: cachedDeps });
33
+ const ɵisRemoteConfigSupportedFactory = {
34
+ async: () => globalThis[isRemoteConfigSupportedPromiseSymbol],
35
+ sync: () => {
36
+ const ret = globalThis[isRemoteConfigSupportedValueSymbol];
37
+ if (ret === undefined) {
38
+ throw new Error(isSupportedError('RemoteConfig'));
21
39
  }
22
- return instance;
23
- }
24
- else {
25
- const newInstance = fn();
26
- globalThis.ɵAngularfireInstanceCache.push([cacheKey, newInstance, deps]);
27
- return newInstance;
28
- }
29
- }
30
- globalThis.ɵAngularfireInstanceCache || (globalThis.ɵAngularfireInstanceCache = []);
31
- // HACK HACK HACK
32
- // AppCheck stuff, here so we can get a jump on it. It's too late in the evaluation
33
- // if we do this in the app-check module. globalThis.ngDevMode allows me to test if
34
- // Angular is in DevMode before Angular initializes.
35
- if (typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.FIREBASE_APPCHECK_DEBUG_TOKEN)) {
36
- (_b = globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN) !== null && _b !== void 0 ? _b : (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.FIREBASE_APPCHECK_DEBUG_TOKEN);
37
- }
38
- else if (globalThis.ngDevMode) {
39
- (_c = globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN) !== null && _c !== void 0 ? _c : (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = true);
40
- }
41
- function ɵmemoizeInstance(fn, zone) {
42
- const [, instance] = globalThis.ɵAngularfireInstanceCache.find((it) => matchDep(it[0], fn)) || [];
43
- if (instance) {
44
- return instance;
45
- }
46
- else {
47
- // TODO catch and add HMR warning
48
- const instance = zone.runOutsideAngular(() => fn());
49
- globalThis.ɵAngularfireInstanceCache.push([fn, instance]);
50
- return instance;
40
+ return ret;
51
41
  }
52
- }
53
- function matchDep(a, b) {
54
- try {
55
- return a.toString() === b.toString();
56
- }
57
- catch (_) {
58
- return a === b;
42
+ };
43
+ const ɵisAnalyticsSupportedFactory = {
44
+ async: () => globalThis[isAnalyticsSupportedPromiseSymbol],
45
+ sync: () => {
46
+ const ret = globalThis[isAnalyticsSupportedValueSymbol];
47
+ if (ret === undefined) {
48
+ throw new Error(isSupportedError('Analytics'));
49
+ }
50
+ return ret;
59
51
  }
60
- }
52
+ };
61
53
  function ɵgetDefaultInstanceOf(identifier, provided, defaultApp) {
62
54
  if (provided) {
63
55
  // Was provide* only called once? If so grab that
@@ -73,7 +65,7 @@ function ɵgetDefaultInstanceOf(identifier, provided, defaultApp) {
73
65
  // Grab the default instance from the defaultApp
74
66
  const defaultAppWithContainer = defaultApp;
75
67
  const provider = defaultAppWithContainer.container.getProvider(identifier);
76
- return provider.getImmediate();
68
+ return provider.getImmediate({ optional: true });
77
69
  }
78
70
  const ɵgetAllInstancesOf = (identifier, app) => {
79
71
  const apps = app ? [app] : getApps();
@@ -159,7 +151,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImpor
159
151
  function getSchedulers() {
160
152
  const schedulers = globalThis.ɵAngularFireScheduler;
161
153
  if (!schedulers) {
162
- throw new Error('AngularFireModule has not been provided');
154
+ throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
155
+ provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);
163
156
  }
164
157
  return schedulers;
165
158
  }
@@ -269,5 +262,5 @@ const ɵzoneWrap = (it, blockUntilFirst) => {
269
262
  * Generated bundle index. Do not edit.
270
263
  */
271
264
 
272
- export { VERSION, keepUnstableUntilFirst, observeInsideAngular, observeOutsideAngular, ɵAngularFireSchedulers, ɵZoneScheduler, ɵcacheInstance, ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, ɵkeepUnstableUntilFirstFactory, ɵmemoizeInstance, ɵzoneWrap };
265
+ export { VERSION, keepUnstableUntilFirst, observeInsideAngular, observeOutsideAngular, ɵAngularFireSchedulers, ɵZoneScheduler, ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, ɵisAnalyticsSupportedFactory, ɵisMessagingSupportedFactory, ɵisRemoteConfigSupportedFactory, ɵkeepUnstableUntilFirstFactory, ɵzoneWrap };
273
266
  //# sourceMappingURL=angular-fire.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"angular-fire.js","sources":["../../../src/core.ts","../../../src/zones.ts","../../../src/angular-fire.ts"],"sourcesContent":["import { isDevMode, NgZone, Version } from '@angular/core';\nimport { FirebaseApp, getApps } from 'firebase/app';\nimport { ComponentContainer } from '@firebase/component';\n\nexport const VERSION = new Version('7.1.0-rc.3');\n\n// TODO is there a better way to get at the internal types?\ninterface FirebaseAppWithContainer extends FirebaseApp {\n container: ComponentContainer;\n}\n\nconst IS_HMR = !!(module as any).hot;\n\nconst log = (level: 'log'|'error'|'info'|'warn', ...args: any) => {\n if (isDevMode() && typeof console !== 'undefined') {\n console[level](...args);\n }\n};\n\nexport function ɵcacheInstance<T>(cacheKey: any, moduleName: string, appName: string, fn: () => T, deps: any): T {\n const [, instance, cachedDeps] = globalThis.ɵAngularfireInstanceCache.find((it: any) => it[0] === cacheKey) || [];\n if (instance) {\n if (!matchDep(deps, cachedDeps)) {\n log('error', `${moduleName} was already initialized on the ${appName} Firebase App with different settings.${IS_HMR ? ' You may need to reload as Firebase is not HMR aware.' : ''}`);\n log('warn', {is: deps, was: cachedDeps});\n }\n return instance;\n } else {\n const newInstance = fn();\n globalThis.ɵAngularfireInstanceCache.push([cacheKey, newInstance, deps]);\n return newInstance;\n }\n}\n\nglobalThis.ɵAngularfireInstanceCache ||= [];\n\n// HACK HACK HACK\n// AppCheck stuff, here so we can get a jump on it. It's too late in the evaluation\n// if we do this in the app-check module. globalThis.ngDevMode allows me to test if\n// Angular is in DevMode before Angular initializes.\nif (typeof process !== 'undefined' && process.env?.FIREBASE_APPCHECK_DEBUG_TOKEN) {\n globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN ??= process.env.FIREBASE_APPCHECK_DEBUG_TOKEN;\n} else if (globalThis.ngDevMode) {\n globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN ??= true;\n}\n\nexport function ɵmemoizeInstance<T>(fn: () => T, zone: NgZone): T {\n const [, instance] = globalThis.ɵAngularfireInstanceCache.find((it: any) => matchDep(it[0], fn)) || [];\n if (instance) {\n return instance as T;\n } else {\n // TODO catch and add HMR warning\n const instance = zone.runOutsideAngular(() => fn());\n globalThis.ɵAngularfireInstanceCache.push([fn, instance]);\n return instance;\n }\n}\n\nfunction matchDep(a: any, b: any) {\n try {\n return a.toString() === b.toString();\n } catch (_) {\n return a === b;\n }\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();\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) { throw new Error('AngularFireModule has not been provided'); }\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 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 // 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":["this"],"mappings":";;;;;;;MAIa,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAO3D,MAAM,MAAM,GAAG,CAAC,CAAE,MAAc,CAAC,GAAG,CAAC;AAErC,MAAM,GAAG,GAAG,CAAC,KAAkC,EAAE,GAAG,IAAS;IAC3D,IAAI,SAAS,EAAE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QACjD,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;KACzB;AACH,CAAC,CAAC;SAEc,cAAc,CAAI,QAAa,EAAE,UAAkB,EAAE,OAAe,EAAE,EAAW,EAAE,IAAS;IAC1G,MAAM,GAAG,QAAQ,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,EAAO,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;IAClH,IAAI,QAAQ,EAAE;QACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;YAC/B,GAAG,CAAC,OAAO,EAAE,GAAG,UAAU,mCAAmC,OAAO,yCAAyC,MAAM,GAAG,uDAAuD,GAAG,EAAE,EAAE,CAAC,CAAC;YACtL,GAAG,CAAC,MAAM,EAAE,EAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAC,CAAC,CAAC;S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,CAAC,CAAC,CAAC;SACjI;aAAM,IAAI,OAAO,GAAG,KAAK,UAAU,IAAI,SAAS,EAAE;;;;YAIjD,OAAO;gBACL,UAAU,CAAC;oBACT,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE;wBAChD,SAAS,CAAC,MAAM,EAAE,CAAC;qBACpB;iBACF,EAAE,EAAE,CAAC,CAAC;gBACP,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;aACnC,CAAC;SACH;aAAM;;YAEL,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SACvB;KACK,CAAC;AACX;;AC3MA;;;;;;"}
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.1.1');\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);\n\nglobalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>\n globalThis[isMessagingSupportedValueSymbol] = it\n);\n\nglobalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>\n globalThis[isRemoteConfigSupportedValueSymbol] = it\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 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 // 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,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,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,EAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,MAAc,KACtC;iCAC+B,MAAM,0C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AAC;SACvB;KACK,CAAC;AACX;;AC/MA;;;;;;"}
@@ -1,15 +1,15 @@
1
- import { NgZone, InjectionToken, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, InjectionToken, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { Firestore as FirebaseFirestore } from 'firebase/firestore';
3
3
  import { Firestore } from './firestore';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const PROVIDED_FIRESTORE_INSTANCES: InjectionToken<Firestore[]>;
7
7
  export declare function defaultFirestoreInstanceFactory(provided: FirebaseFirestore[] | undefined, defaultApp: FirebaseApp): Firestore;
8
- export declare function firestoreInstanceFactory(fn: () => FirebaseFirestore): (zone: NgZone) => Firestore;
8
+ export declare function firestoreInstanceFactory(fn: (injector: Injector) => FirebaseFirestore): (zone: NgZone, injector: Injector) => Firestore;
9
9
  export declare class FirestoreModule {
10
10
  constructor();
11
11
  static ɵfac: i0.ɵɵFactoryDeclaration<FirestoreModule, never>;
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<FirestoreModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<FirestoreModule>;
14
14
  }
15
- export declare function provideFirestore(fn: () => FirebaseFirestore): ModuleWithProviders<FirestoreModule>;
15
+ export declare function provideFirestore(fn: (injector: Injector) => FirebaseFirestore, ...deps: any[]): ModuleWithProviders<FirestoreModule>;
@@ -1,15 +1,15 @@
1
- import { NgZone, InjectionToken, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, InjectionToken, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { Firestore as FirebaseFirestore } from 'firebase/firestore/lite';
3
3
  import { Firestore } from './lite';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const PROVIDED_FIRESTORE_INSTANCES: InjectionToken<Firestore[]>;
7
7
  export declare function defaultFirestoreInstanceFactory(provided: FirebaseFirestore[] | undefined, defaultApp: FirebaseApp): Firestore;
8
- export declare function firestoreInstanceFactory(fn: () => FirebaseFirestore): (zone: NgZone) => Firestore;
8
+ export declare function firestoreInstanceFactory(fn: (injector: Injector) => FirebaseFirestore): (zone: NgZone, injector: Injector) => Firestore;
9
9
  export declare class FirestoreModule {
10
10
  constructor();
11
11
  static ɵfac: i0.ɵɵFactoryDeclaration<FirestoreModule, never>;
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<FirestoreModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<FirestoreModule>;
14
14
  }
15
- export declare function provideFirestore(fn: () => FirebaseFirestore): ModuleWithProviders<FirestoreModule>;
15
+ export declare function provideFirestore(fn: (injector: Injector) => FirebaseFirestore, ...deps: any[]): ModuleWithProviders<FirestoreModule>;
@@ -1,15 +1,15 @@
1
- import { NgZone, InjectionToken, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, InjectionToken, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { Functions as FirebaseFunctions } from 'firebase/functions';
3
3
  import { Functions } from './functions';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const PROVIDED_FUNCTIONS_INSTANCES: InjectionToken<Functions[]>;
7
7
  export declare function defaultFunctionsInstanceFactory(provided: FirebaseFunctions[] | undefined, defaultApp: FirebaseApp): Functions;
8
- export declare function functionsInstanceFactory(fn: () => FirebaseFunctions): (zone: NgZone) => Functions;
8
+ export declare function functionsInstanceFactory(fn: (injector: Injector) => FirebaseFunctions): (zone: NgZone, injector: Injector) => Functions;
9
9
  export declare class FunctionsModule {
10
10
  constructor();
11
11
  static ɵfac: i0.ɵɵFactoryDeclaration<FunctionsModule, never>;
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<FunctionsModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<FunctionsModule>;
14
14
  }
15
- export declare function provideFunctions(fn: () => FirebaseFunctions): ModuleWithProviders<FunctionsModule>;
15
+ export declare function provideFunctions(fn: () => FirebaseFunctions, ...deps: any[]): ModuleWithProviders<FunctionsModule>;
@@ -1,7 +1,7 @@
1
1
  export * from 'firebase/messaging';
2
- import { deleteToken as _deleteToken, getMessaging as _getMessaging, getToken as _getToken, isSupported as _isSupported, onMessage as _onMessage } from 'firebase/messaging';
2
+ import { deleteToken as _deleteToken, getMessaging as _getMessaging, getToken as _getToken, onMessage as _onMessage } from 'firebase/messaging';
3
+ export { isSupported } from './overrides';
3
4
  export declare const deleteToken: typeof _deleteToken;
4
5
  export declare const getMessaging: typeof _getMessaging;
5
6
  export declare const getToken: typeof _getToken;
6
- export declare const isSupported: typeof _isSupported;
7
7
  export declare const onMessage: typeof _onMessage;
@@ -1,14 +1,14 @@
1
- import { NgZone, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { Messaging as FirebaseMessaging } from 'firebase/messaging';
3
3
  import { Messaging } from './messaging';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
- export declare function defaultMessagingInstanceFactory(isSupported: boolean, provided: FirebaseMessaging[] | undefined, defaultApp: FirebaseApp): Messaging;
7
- export declare function messagingInstanceFactory(fn: () => FirebaseMessaging): (zone: NgZone, isSupported: boolean) => Messaging;
6
+ export declare function defaultMessagingInstanceFactory(provided: FirebaseMessaging[] | undefined, defaultApp: FirebaseApp): Messaging;
7
+ export declare function messagingInstanceFactory(fn: (injector: Injector) => FirebaseMessaging): (zone: NgZone, injector: Injector) => Messaging;
8
8
  export declare class MessagingModule {
9
9
  constructor();
10
10
  static ɵfac: i0.ɵɵFactoryDeclaration<MessagingModule, never>;
11
11
  static ɵmod: i0.ɵɵNgModuleDeclaration<MessagingModule, never, never, never>;
12
12
  static ɵinj: i0.ɵɵInjectorDeclaration<MessagingModule>;
13
13
  }
14
- export declare function provideMessaging(fn: () => FirebaseMessaging): ModuleWithProviders<MessagingModule>;
14
+ export declare function provideMessaging(fn: () => FirebaseMessaging, ...deps: any[]): ModuleWithProviders<MessagingModule>;
@@ -0,0 +1 @@
1
+ export declare const isSupported: () => any;
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.1.0-rc.3",
4
+ "version": "7.1.1",
5
5
  "description": "The official Angular library for Firebase.",
6
6
  "schematics": "./schematics/collection.json",
7
7
  "builders": "./schematics/builders.json",
@@ -30,9 +30,15 @@
30
30
  "@angular-devkit/schematics": "^12.0.0",
31
31
  "@angular-devkit/architect": "> 0.1200.0 < 0.1300.0",
32
32
  "@schematics/angular": "^12.0.0",
33
- "firebase": "^9.0.0",
33
+ "firebase": "^9.1.0",
34
34
  "rxfire": "^6.0.0",
35
- "rxjs": "~6.6.0"
35
+ "rxjs": "~6.6.0 || ^7.0.0",
36
+ "firebase-tools": "^9.9.0"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "firebase-tools": {
40
+ "optional": true
41
+ }
36
42
  },
37
43
  "dependencies": {
38
44
  "tslib": "^2.0.0",
@@ -1,15 +1,15 @@
1
- import { NgZone, InjectionToken, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, InjectionToken, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { FirebasePerformance } from 'firebase/performance';
3
3
  import { Performance } from './performance';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const PROVIDED_PERFORMANCE_INSTANCES: InjectionToken<Performance[]>;
7
- export declare function defaultPerformanceInstanceFactory(provided: FirebasePerformance[] | undefined, defaultApp: FirebaseApp): Performance;
8
- export declare function performanceInstanceFactory(fn: () => FirebasePerformance): (zone: NgZone) => Performance;
7
+ export declare function defaultPerformanceInstanceFactory(provided: FirebasePerformance[] | undefined, defaultApp: FirebaseApp, platform: Object): Performance;
8
+ export declare function performanceInstanceFactory(fn: (injector: Injector) => FirebasePerformance): (zone: NgZone, platform: Object, injector: Injector) => Performance;
9
9
  export declare class PerformanceModule {
10
10
  constructor();
11
11
  static ɵfac: i0.ɵɵFactoryDeclaration<PerformanceModule, never>;
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<PerformanceModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<PerformanceModule>;
14
14
  }
15
- export declare function providePerformance(fn: () => FirebasePerformance): ModuleWithProviders<PerformanceModule>;
15
+ export declare function providePerformance(fn: () => FirebasePerformance, ...deps: any[]): ModuleWithProviders<PerformanceModule>;
@@ -1,5 +1,6 @@
1
1
  export * from 'firebase/remote-config';
2
2
  import { activate as _activate, ensureInitialized as _ensureInitialized, fetchAndActivate as _fetchAndActivate, fetchConfig as _fetchConfig, getAll as _getAll, getBoolean as _getBoolean, getNumber as _getNumber, getRemoteConfig as _getRemoteConfig, getString as _getString, getValue as _getValue, setLogLevel as _setLogLevel } from 'firebase/remote-config';
3
+ export { isSupported } from './overrides';
3
4
  export declare const activate: typeof _activate;
4
5
  export declare const ensureInitialized: typeof _ensureInitialized;
5
6
  export declare const fetchAndActivate: typeof _fetchAndActivate;
@@ -0,0 +1 @@
1
+ export declare const isSupported: () => any;
@@ -1,15 +1,15 @@
1
- import { NgZone, InjectionToken, ModuleWithProviders } from '@angular/core';
1
+ import { NgZone, InjectionToken, ModuleWithProviders, Injector } from '@angular/core';
2
2
  import { RemoteConfig as FirebaseRemoteConfig } from 'firebase/remote-config';
3
3
  import { RemoteConfig } from './remote-config';
4
4
  import { FirebaseApp } from '@angular/fire/app';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare const PROVIDED_REMOTE_CONFIG_INSTANCES: InjectionToken<RemoteConfig[]>;
7
7
  export declare function defaultRemoteConfigInstanceFactory(provided: FirebaseRemoteConfig[] | undefined, defaultApp: FirebaseApp): RemoteConfig;
8
- export declare function remoteConfigInstanceFactory(fn: () => FirebaseRemoteConfig): (zone: NgZone) => RemoteConfig;
8
+ export declare function remoteConfigInstanceFactory(fn: (injector: Injector) => FirebaseRemoteConfig): (zone: NgZone, injector: Injector) => RemoteConfig;
9
9
  export declare class RemoteConfigModule {
10
10
  constructor();
11
11
  static ɵfac: i0.ɵɵFactoryDeclaration<RemoteConfigModule, never>;
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<RemoteConfigModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<RemoteConfigModule>;
14
14
  }
15
- export declare function provideRemoteConfig(fn: () => FirebaseRemoteConfig): ModuleWithProviders<RemoteConfigModule>;
15
+ export declare function provideRemoteConfig(fn: () => FirebaseRemoteConfig, ...deps: any[]): ModuleWithProviders<RemoteConfigModule>;
@@ -87,11 +87,13 @@ const moveSync = (src, dest) => {
87
87
  fs_extra_1.removeSync(src);
88
88
  };
89
89
  const deployToHosting = (firebaseTools, context, workspaceRoot, options, firebaseToken) => __awaiter(void 0, void 0, void 0, function* () {
90
+ var _a;
91
+ const siteTarget = (_a = options.target) !== null && _a !== void 0 ? _a : context.target.project;
90
92
  if (options.preview) {
91
93
  yield firebaseTools.serve({
92
94
  port: DEFAULT_EMULATOR_PORT,
93
95
  host: DEFAULT_EMULATOR_HOST,
94
- targets: [`hosting:${context.target.project}`],
96
+ targets: [`hosting:${siteTarget}`],
95
97
  nonInteractive: true,
96
98
  projectRoot: workspaceRoot,
97
99
  });
@@ -105,7 +107,7 @@ const deployToHosting = (firebaseTools, context, workspaceRoot, options, firebas
105
107
  }
106
108
  }
107
109
  return yield firebaseTools.deploy({
108
- only: 'hosting:' + context.target.project,
110
+ only: `hosting:${siteTarget}`,
109
111
  cwd: workspaceRoot,
110
112
  token: firebaseToken,
111
113
  nonInteractive: true,
@@ -118,13 +120,14 @@ const defaultFsHost = {
118
120
  renameSync: fs_1.renameSync,
119
121
  copySync: fs_extra_1.copySync,
120
122
  removeSync: fs_extra_1.removeSync,
123
+ existsSync: fs_1.existsSync,
121
124
  };
122
- const findPackageVersion = (name) => {
123
- const match = child_process_1.execSync(`npm list ${name}`).toString().match(` ${escapeRegExp(name)}@.+\\w`);
124
- return match ? match[0].split(`${name}@`)[1].split(/\s/)[0] : null;
125
+ const findPackageVersion = (packageManager, name) => {
126
+ const match = child_process_1.execSync(`${packageManager} list ${name}`).toString().match(`[^|\s]${escapeRegExp(name)}[@| ][^\s]+(\s.+)?$`);
127
+ return match ? match[0].split(new RegExp(`${escapeRegExp(name)}[@| ]`))[1].split(/\s/)[0] : null;
125
128
  };
126
129
  const getPackageJson = (context, workspaceRoot, options, main) => {
127
- var _a, _b, _c;
130
+ var _a, _b, _c, _d, _e;
128
131
  const dependencies = {};
129
132
  const devDependencies = {};
130
133
  if (options.ssr !== 'cloud-run') {
@@ -135,12 +138,13 @@ const getPackageJson = (context, workspaceRoot, options, main) => {
135
138
  }
136
139
  if (fs_1.existsSync(path_1.join(workspaceRoot, 'angular.json'))) {
137
140
  const angularJson = JSON.parse(fs_1.readFileSync(path_1.join(workspaceRoot, 'angular.json')).toString());
141
+ const packageManager = (_b = (_a = angularJson.cli) === null || _a === void 0 ? void 0 : _a.packageManager) !== null && _b !== void 0 ? _b : 'npm';
138
142
  const server = angularJson.projects[context.target.project].architect.server;
139
- const externalDependencies = ((_a = server === null || server === void 0 ? void 0 : server.options) === null || _a === void 0 ? void 0 : _a.externalDependencies) || [];
140
- const bundleDependencies = (_c = (_b = server === null || server === void 0 ? void 0 : server.options) === null || _b === void 0 ? void 0 : _b.bundleDependencies) !== null && _c !== void 0 ? _c : true;
143
+ const externalDependencies = ((_c = server === null || server === void 0 ? void 0 : server.options) === null || _c === void 0 ? void 0 : _c.externalDependencies) || [];
144
+ const bundleDependencies = (_e = (_d = server === null || server === void 0 ? void 0 : server.options) === null || _d === void 0 ? void 0 : _d.bundleDependencies) !== null && _e !== void 0 ? _e : true;
141
145
  if (bundleDependencies) {
142
146
  externalDependencies.forEach(externalDependency => {
143
- const packageVersion = findPackageVersion(externalDependency);
147
+ const packageVersion = findPackageVersion(packageManager, externalDependency);
144
148
  if (packageVersion) {
145
149
  dependencies[externalDependency] = packageVersion;
146
150
  }
@@ -158,6 +162,7 @@ const getPackageJson = (context, workspaceRoot, options, main) => {
158
162
  return functions_templates_1.defaultPackage(dependencies, devDependencies, options, main);
159
163
  };
160
164
  const deployToFunction = (firebaseTools, context, workspaceRoot, staticBuildTarget, serverBuildTarget, options, firebaseToken, fsHost = defaultFsHost) => __awaiter(void 0, void 0, void 0, function* () {
165
+ var _b;
161
166
  const staticBuildOptions = yield context.getTargetOptions(architect_1.targetFromTargetString(staticBuildTarget.name));
162
167
  if (!staticBuildOptions.outputPath || typeof staticBuildOptions.outputPath !== 'string') {
163
168
  throw new Error(`Cannot read the output path option of the Angular project '${staticBuildTarget.name}' in angular.json`);
@@ -166,12 +171,12 @@ const deployToFunction = (firebaseTools, context, workspaceRoot, staticBuildTarg
166
171
  if (!serverBuildOptions.outputPath || typeof serverBuildOptions.outputPath !== 'string') {
167
172
  throw new Error(`Cannot read the output path option of the Angular project '${serverBuildTarget.name}' in angular.json`);
168
173
  }
169
- const staticOut = staticBuildOptions.outputPath;
170
- const serverOut = serverBuildOptions.outputPath;
171
- const functionsOut = options.outputPath || path_1.dirname(serverOut);
174
+ const staticOut = path_1.join(workspaceRoot, staticBuildOptions.outputPath);
175
+ const serverOut = path_1.join(workspaceRoot, serverBuildOptions.outputPath);
176
+ const functionsOut = options.outputPath ? path_1.join(workspaceRoot, options.outputPath) : path_1.dirname(serverOut);
172
177
  const functionName = options.functionName || functions_templates_1.DEFAULT_FUNCTION_NAME;
173
- const newStaticOut = path_1.join(functionsOut, staticOut);
174
- const newServerOut = path_1.join(functionsOut, serverOut);
178
+ const newStaticOut = path_1.join(functionsOut, staticBuildOptions.outputPath);
179
+ const newServerOut = path_1.join(functionsOut, serverBuildOptions.outputPath);
175
180
  if (options.outputPath) {
176
181
  fsHost.removeSync(functionsOut);
177
182
  fsHost.copySync(staticOut, newStaticOut);
@@ -186,20 +191,27 @@ const deployToFunction = (firebaseTools, context, workspaceRoot, staticBuildTarg
186
191
  if (!semver_1.satisfies(process.versions.node, nodeVersion.toString())) {
187
192
  context.logger.warn(`⚠️ Your Node.js version (${process.versions.node}) does not match the Firebase Functions runtime (${nodeVersion}).`);
188
193
  }
189
- fsHost.writeFileSync(path_1.join(functionsOut, 'package.json'), JSON.stringify(packageJson, null, 2));
190
- fsHost.writeFileSync(path_1.join(functionsOut, 'index.js'), functions_templates_1.defaultFunction(serverOut, options, functionName));
194
+ const functionsPackageJsonPath = path_1.join(functionsOut, 'package.json');
195
+ fsHost.writeFileSync(functionsPackageJsonPath, JSON.stringify(packageJson, null, 2));
196
+ fsHost.writeFileSync(path_1.join(functionsOut, 'index.js'), functions_templates_1.defaultFunction(serverBuildOptions.outputPath, options, functionName));
191
197
  if (!options.prerender) {
192
198
  try {
193
199
  fsHost.renameSync(path_1.join(newStaticOut, 'index.html'), path_1.join(newStaticOut, 'index.original.html'));
194
200
  }
195
201
  catch (e) { }
196
202
  }
197
- const project = context.target.project;
203
+ const siteTarget = (_b = options.target) !== null && _b !== void 0 ? _b : context.target.project;
204
+ if (fsHost.existsSync(functionsPackageJsonPath)) {
205
+ child_process_1.execSync(`npm --prefix ${functionsOut} install`);
206
+ }
207
+ else {
208
+ console.error(`No package.json exists at ${functionsOut}`);
209
+ }
198
210
  if (options.preview) {
199
211
  yield firebaseTools.serve({
200
212
  port: DEFAULT_EMULATOR_PORT,
201
213
  host: DEFAULT_EMULATOR_HOST,
202
- targets: [`hosting:${project}`, `functions:${functionName}`],
214
+ targets: [`hosting:${siteTarget}`, `functions:${functionName}`],
203
215
  nonInteractive: true,
204
216
  projectRoot: workspaceRoot,
205
217
  });
@@ -213,7 +225,7 @@ const deployToFunction = (firebaseTools, context, workspaceRoot, staticBuildTarg
213
225
  }
214
226
  }
215
227
  return yield firebaseTools.deploy({
216
- only: `hosting:${project},functions:${functionName}`,
228
+ only: `hosting:${siteTarget},functions:${functionName}`,
217
229
  cwd: workspaceRoot,
218
230
  token: firebaseToken,
219
231
  nonInteractive: true,
@@ -222,6 +234,7 @@ const deployToFunction = (firebaseTools, context, workspaceRoot, staticBuildTarg
222
234
  });
223
235
  exports.deployToFunction = deployToFunction;
224
236
  const deployToCloudRun = (firebaseTools, context, workspaceRoot, staticBuildTarget, serverBuildTarget, options, firebaseToken, fsHost = defaultFsHost) => __awaiter(void 0, void 0, void 0, function* () {
237
+ var _c;
225
238
  const staticBuildOptions = yield context.getTargetOptions(architect_1.targetFromTargetString(staticBuildTarget.name));
226
239
  if (!staticBuildOptions.outputPath || typeof staticBuildOptions.outputPath !== 'string') {
227
240
  throw new Error(`Cannot read the output path option of the Angular project '${staticBuildTarget.name}' in angular.json`);
@@ -230,16 +243,16 @@ const deployToCloudRun = (firebaseTools, context, workspaceRoot, staticBuildTarg
230
243
  if (!serverBuildOptions.outputPath || typeof serverBuildOptions.outputPath !== 'string') {
231
244
  throw new Error(`Cannot read the output path option of the Angular project '${serverBuildTarget.name}' in angular.json`);
232
245
  }
233
- const staticOut = staticBuildOptions.outputPath;
234
- const serverOut = serverBuildOptions.outputPath;
235
- const cloudRunOut = options.outputPath || staticBuildOptions.outputPath.replace('/browser', '/run');
246
+ const staticOut = path_1.join(workspaceRoot, staticBuildOptions.outputPath);
247
+ const serverOut = path_1.join(workspaceRoot, serverBuildOptions.outputPath);
248
+ const cloudRunOut = options.outputPath ? path_1.join(workspaceRoot, options.outputPath) : path_1.join(path_1.dirname(serverOut), 'run');
236
249
  const serviceId = options.functionName || functions_templates_1.DEFAULT_FUNCTION_NAME;
237
- const newStaticOut = path_1.join(cloudRunOut, staticOut);
238
- const newServerOut = path_1.join(cloudRunOut, serverOut);
250
+ const newStaticOut = path_1.join(cloudRunOut, staticBuildOptions.outputPath);
251
+ const newServerOut = path_1.join(cloudRunOut, serverBuildOptions.outputPath);
239
252
  fsHost.removeSync(cloudRunOut);
240
253
  fsHost.copySync(staticOut, newStaticOut);
241
254
  fsHost.copySync(serverOut, newServerOut);
242
- const packageJson = getPackageJson(context, workspaceRoot, options, path_1.join(serverOut, 'main.js'));
255
+ const packageJson = getPackageJson(context, workspaceRoot, options, path_1.join(serverBuildOptions.outputPath, 'main.js'));
243
256
  const nodeVersion = packageJson.engines.node;
244
257
  if (!semver_1.satisfies(process.versions.node, nodeVersion.toString())) {
245
258
  context.logger.warn(`⚠️ Your Node.js version (${process.versions.node}) does not match the Cloud Run runtime (${nodeVersion}).`);
@@ -284,8 +297,9 @@ const deployToCloudRun = (firebaseTools, context, workspaceRoot, staticBuildTarg
284
297
  context.logger.info(`📦 Deploying to Cloud Run`);
285
298
  yield spawnAsync(`gcloud builds submit ${cloudRunOut} --tag gcr.io/${options.firebaseProject}/${serviceId} --project ${options.firebaseProject} --quiet`);
286
299
  yield spawnAsync(`gcloud run deploy ${serviceId} --image gcr.io/${options.firebaseProject}/${serviceId} --project ${options.firebaseProject} ${deployArguments.join(' ')} --platform managed --allow-unauthenticated --region=${options.region} --quiet`);
300
+ const siteTarget = (_c = options.target) !== null && _c !== void 0 ? _c : context.target.project;
287
301
  return yield firebaseTools.deploy({
288
- only: `hosting:${context.target.project}`,
302
+ only: `hosting:${siteTarget}`,
289
303
  cwd: workspaceRoot,
290
304
  token: firebaseToken,
291
305
  nonInteractive: true,
@@ -41,6 +41,10 @@
41
41
  "type": "string",
42
42
  "description": "The Firebase project name or project alias to use when deploying"
43
43
  },
44
+ "target": {
45
+ "type": "string",
46
+ "description": "The Firebase hosting target in firebase.json for multi-site"
47
+ },
44
48
  "firebaseHostingSite": {
45
49
  "type": "string",
46
50
  "description": "The Firebase Hosting site to deploy to"