@firebase/util 1.7.0 → 1.7.1-20221010203322
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/CHANGELOG.md +8 -0
- package/dist/index.esm2017.js +28 -19
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +28 -19
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +28 -18
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +28 -19
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/defaults.d.ts +8 -0
- package/dist/node-esm/test/defaults.test.d.ts +1 -0
- package/dist/src/defaults.d.ts +8 -0
- package/dist/test/defaults.test.d.ts +1 -0
- package/dist/util-public.d.ts +9 -0
- package/dist/util.d.ts +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @firebase/util
|
|
2
2
|
|
|
3
|
+
## 1.7.1-20221010203322
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`171b78b76`](https://github.com/firebase/firebase-js-sdk/commit/171b78b762826a640d267dd4dd172ad9459c4561) [#6673](https://github.com/firebase/firebase-js-sdk/pull/6673) - Handle IPv6 addresses in emulator autoinit.
|
|
8
|
+
|
|
9
|
+
* [`29d034072`](https://github.com/firebase/firebase-js-sdk/commit/29d034072c20af394ce384e42aa10a37d5dfcb18) [#6665](https://github.com/firebase/firebase-js-sdk/pull/6665) (fixes [#6660](https://github.com/firebase/firebase-js-sdk/issues/6660)) - Remove `__FIREBASE_DEFAULTS_PATH__` option for now, as the current implementation causes Webpack warnings. Also fix `process.env` check to work in environments where `process` exists but `process.env` does not.
|
|
10
|
+
|
|
3
11
|
## 1.7.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/index.esm2017.js
CHANGED
|
@@ -645,30 +645,13 @@ const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
|
|
|
645
645
|
* process.env.__FIREBASE_DEFAULTS_PATH__
|
|
646
646
|
*/
|
|
647
647
|
const getDefaultsFromEnvVariable = () => {
|
|
648
|
-
if (typeof process === 'undefined') {
|
|
648
|
+
if (typeof process === 'undefined' || typeof process.env === 'undefined') {
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
651
|
const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__;
|
|
652
|
-
const defaultsJsonPath = process.env.__FIREBASE_DEFAULTS_PATH__;
|
|
653
652
|
if (defaultsJsonString) {
|
|
654
|
-
if (defaultsJsonPath) {
|
|
655
|
-
console.warn(`Values were provided for both __FIREBASE_DEFAULTS__ ` +
|
|
656
|
-
`and __FIREBASE_DEFAULTS_PATH__. __FIREBASE_DEFAULTS_PATH__ ` +
|
|
657
|
-
`will be ignored.`);
|
|
658
|
-
}
|
|
659
653
|
return JSON.parse(defaultsJsonString);
|
|
660
654
|
}
|
|
661
|
-
if (defaultsJsonPath && typeof require !== 'undefined') {
|
|
662
|
-
try {
|
|
663
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
664
|
-
const json = require(defaultsJsonPath);
|
|
665
|
-
return json;
|
|
666
|
-
}
|
|
667
|
-
catch (e) {
|
|
668
|
-
console.warn(`Unable to read defaults from file provided to ` +
|
|
669
|
-
`__FIREBASE_DEFAULTS_PATH__: ${defaultsJsonPath}`);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
655
|
};
|
|
673
656
|
const getDefaultsFromCookie = () => {
|
|
674
657
|
if (typeof document === 'undefined') {
|
|
@@ -690,9 +673,35 @@ const getDefaults = () => getDefaultsFromGlobal() ||
|
|
|
690
673
|
/**
|
|
691
674
|
* Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
|
|
692
675
|
* for the given product.
|
|
676
|
+
* @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
|
|
693
677
|
* @public
|
|
694
678
|
*/
|
|
695
679
|
const getDefaultEmulatorHost = (productName) => { var _a, _b; return (_b = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.emulatorHosts) === null || _b === void 0 ? void 0 : _b[productName]; };
|
|
680
|
+
/**
|
|
681
|
+
* Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
|
|
682
|
+
* for the given product.
|
|
683
|
+
* @returns a pair of hostname and port like `["::1", 4000]` if available
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
const getDefaultEmulatorHostnameAndPort = (productName) => {
|
|
687
|
+
const host = getDefaultEmulatorHost(productName);
|
|
688
|
+
if (!host) {
|
|
689
|
+
return undefined;
|
|
690
|
+
}
|
|
691
|
+
const separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.
|
|
692
|
+
if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {
|
|
693
|
+
throw new Error(`Invalid host ${host} with no separate hostname and port!`);
|
|
694
|
+
}
|
|
695
|
+
// eslint-disable-next-line no-restricted-globals
|
|
696
|
+
const port = parseInt(host.substring(separatorIndex + 1), 10);
|
|
697
|
+
if (host[0] === '[') {
|
|
698
|
+
// Bracket-quoted `[ipv6addr]:port` => return "ipv6addr" (without brackets).
|
|
699
|
+
return [host.substring(1, separatorIndex - 1), port];
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
return [host.substring(0, separatorIndex), port];
|
|
703
|
+
}
|
|
704
|
+
};
|
|
696
705
|
/**
|
|
697
706
|
* Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
|
|
698
707
|
* @public
|
|
@@ -2033,5 +2042,5 @@ function getModularInstance(service) {
|
|
|
2033
2042
|
}
|
|
2034
2043
|
}
|
|
2035
2044
|
|
|
2036
|
-
export { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
2045
|
+
export { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
2037
2046
|
//# sourceMappingURL=index.esm2017.js.map
|