Skip to content

Commit 8294d2d

Browse files
committed
Cleanup
1 parent 3a34ae2 commit 8294d2d

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

common/api-review/storage.api.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { FirebaseApp } from '@firebase/app';
1111
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
1212
import { FirebaseError } from '@firebase/util';
1313
import { _FirebaseService } from '@firebase/app';
14-
import { getDefaultEmulatorHost } from '@firebase/util';
1514
import { NextFn } from '@firebase/util';
1615
import { Provider } from '@firebase/component';
1716
import { Subscribe } from '@firebase/util';
@@ -123,8 +122,6 @@ export function getBytes(ref: StorageReference, maxDownloadSizeBytes?: number):
123122
// @internal (undocumented)
124123
export function _getChild(ref: StorageReference, childPath: string): _Reference;
125124

126-
export { getDefaultEmulatorHost }
127-
128125
// @public
129126
export function getDownloadURL(ref: StorageReference): Promise<string>;
130127

common/api-review/util.api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
55
```ts
66

7+
// Warning: (ae-missing-release-tag) "__PRIVATE_getDefaultEmulatorHost" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
8+
//
9+
// @public (undocumented)
10+
export const __PRIVATE_getDefaultEmulatorHost: (name: string) => string | undefined;
11+
712
// Warning: (ae-missing-release-tag) "areCookiesEnabled" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
813
//
914
// @public

packages/app/src/api.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ export function initializeApp(
199199
* @public
200200
*/
201201
export function getApp(name: string = DEFAULT_ENTRY_NAME): FirebaseApp {
202-
return _apps.get(name) || initializeApp();
202+
const app = _apps.get(name);
203+
if (!app && name === DEFAULT_ENTRY_NAME) return initializeApp();
204+
if (!app) {
205+
throw ERROR_FACTORY.create(AppError.NO_APP, { appName: name });
206+
}
207+
208+
return app;
203209
}
204210

205211
/**

packages/storage/src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ import {
5151
getBytesInternal
5252
} from './reference';
5353
import { STORAGE_TYPE } from './constants';
54-
import { EmulatorMockTokenOptions, getModularInstance } from '@firebase/util';
54+
import { EmulatorMockTokenOptions, getModularInstance, getDefaultEmulatorHost } from '@firebase/util';
5555
import { StringFormat } from './implementation/string';
5656

57-
export { EmulatorMockTokenOptions, getDefaultEmulatorHost } from '@firebase/util';
57+
export { EmulatorMockTokenOptions } from '@firebase/util';
5858

5959
/**
6060
* Public types.

packages/util/src/defaults.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import { base64Decode } from "./crypt";
23
import { getGlobal } from "./environment";
34

@@ -11,9 +12,7 @@ declare global {
1112
var __FIREBASE_DEFAULTS__: FirebaseDefaults|undefined;
1213
}
1314

14-
const getDefaultsFromGlobal = (): FirebaseDefaults|undefined => {
15-
return getGlobal().__FIREBASE_DEFAULTS__;
16-
};
15+
const getDefaultsFromGlobal = (): FirebaseDefaults|undefined => getGlobal().__FIREBASE_DEFAULTS__;
1716

1817
const getDefaultsFromEnvVariable = (): FirebaseDefaults|undefined => {
1918
if (typeof process === 'undefined') return;
@@ -38,14 +37,16 @@ const getDefaultsFromCookie = (): FirebaseDefaults|undefined => {
3837
}
3938
};
4039

41-
const getDefaults = () => {
42-
return getDefaultsFromGlobal() ||
43-
getDefaultsFromEnvVariable() ||
44-
getDefaultsFromCookie();
45-
};
40+
const getDefaults = () => getDefaultsFromGlobal() ||
41+
getDefaultsFromEnvVariable() ||
42+
getDefaultsFromCookie();
4643

4744
export const getDefaultEmulatorHost = (name:string) => getDefaults()?.emulatorHosts?.[name];
4845

46+
// I don't know why I can't get firestore to reconigze this in the externs...
47+
// adding the __PRIVATE_ prefix for now
48+
export const __PRIVATE_getDefaultEmulatorHost = getDefaultEmulatorHost;
49+
4950
export const getDefaultAppConfig = () => getDefaults()?.config;
5051

5152
// TODO fix the type

0 commit comments

Comments
 (0)