react-native-update 10.48.1 → 10.48.3

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/src/utils.ts CHANGED
@@ -28,7 +28,7 @@ export function promiseAny<T>(promises: Promise<T>[]) {
28
28
  }
29
29
  let count = 0;
30
30
 
31
- promises.forEach(promise => {
31
+ promises.forEach((promise) => {
32
32
  Promise.resolve(promise)
33
33
  .then(resolve)
34
34
  .catch(() => {
@@ -44,25 +44,26 @@ export function promiseAny<T>(promises: Promise<T>[]) {
44
44
  export const emptyObj = {};
45
45
  export const noop = () => {};
46
46
  const emptyModuleTarget: Record<string, typeof noop> = {};
47
- export const emptyModule = new Proxy(
48
- emptyModuleTarget,
49
- {
50
- get(_target, _prop) {
51
- return noop;
52
- },
47
+ export const emptyModule = new Proxy(emptyModuleTarget, {
48
+ get(_target, _prop) {
49
+ return noop;
53
50
  },
54
- );
51
+ });
55
52
 
56
53
  const ping = isWeb
57
54
  ? Promise.resolve
58
55
  : async (url: string) => {
59
56
  try {
60
- const { status, statusText, url: finalUrl } = await fetchWithTimeout(
57
+ const {
58
+ status,
59
+ statusText,
60
+ url: finalUrl,
61
+ } = await fetchWithTimeout(
61
62
  url,
62
63
  {
63
64
  method: 'HEAD',
64
65
  },
65
- DEFAULT_FETCH_TIMEOUT_MS,
66
+ DEFAULT_FETCH_TIMEOUT_MS
66
67
  );
67
68
  if (status === 200) {
68
69
  return finalUrl;
@@ -77,7 +78,7 @@ const ping = isWeb
77
78
 
78
79
  export function joinUrls(paths: string[], fileName?: string) {
79
80
  if (fileName) {
80
- return paths.map(path => {
81
+ return paths.map((path) => {
81
82
  const normalizedPath = path.replace(/\/+$/, '');
82
83
  // Keep explicit http(s) URLs for local/self-hosted update sources.
83
84
  const baseUrl = /^[a-z][a-z0-9+.-]*:\/\//i.test(normalizedPath)
@@ -120,7 +121,7 @@ export const computeProgress = (received: number, total: number): number =>
120
121
  export const fetchWithTimeout = (
121
122
  url: string,
122
123
  params: Parameters<typeof fetch>[1],
123
- timeoutMs = DEFAULT_FETCH_TIMEOUT_MS,
124
+ timeoutMs = DEFAULT_FETCH_TIMEOUT_MS
124
125
  ): Promise<Response> => {
125
126
  // AbortController landed in the RN fetch polyfill around 0.60; we support
126
127
  // older peers, so fall back to a plain timer race when it is unavailable
@@ -151,7 +152,7 @@ export const fetchWithTimeout = (
151
152
  controller.abort();
152
153
  }, timeoutMs);
153
154
 
154
- return enhancedFetch(url, { ...params, signal: controller.signal })
155
+ return enhancedFetch(url, { ...params, signal: controller.signal as any })
155
156
  .catch((e: any) => {
156
157
  if (controller.signal.aborted) {
157
158
  throw Error(i18n.t('error_ping_timeout'));
@@ -171,22 +172,21 @@ const isIdempotentRequest = (params: Parameters<typeof fetch>[1]) => {
171
172
  export const enhancedFetch = async (
172
173
  url: string,
173
174
  params: Parameters<typeof fetch>[1],
174
- isRetry = false,
175
+ isRetry = false
175
176
  ): Promise<Response> => {
176
- return fetch(url, params)
177
- .catch(e => {
178
- log('fetch error', url, e);
179
- if (
180
- isRetry ||
181
- (params as any)?.signal?.aborted ||
182
- !url.startsWith('https:') ||
183
- // Never replay non-idempotent requests (e.g. the checkUpdate POST)
184
- // over plaintext http: the server may have processed the original.
185
- !isIdempotentRequest(params)
186
- ) {
187
- throw e;
188
- }
189
- log('trying fallback to http');
190
- return enhancedFetch(url.replace(/^https:/, 'http:'), params, true);
191
- });
177
+ return fetch(url, params).catch((e) => {
178
+ log('fetch error', url, e);
179
+ if (
180
+ isRetry ||
181
+ (params as any)?.signal?.aborted ||
182
+ !url.startsWith('https:') ||
183
+ // Never replay non-idempotent requests (e.g. the checkUpdate POST)
184
+ // over plaintext http: the server may have processed the original.
185
+ !isIdempotentRequest(params)
186
+ ) {
187
+ throw e;
188
+ }
189
+ log('trying fallback to http');
190
+ return enhancedFetch(url.replace(/^https:/, 'http:'), params, true);
191
+ });
192
192
  };
package/.eslintrc.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: '@react-native',
4
- };
package/.prettierrc.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- arrowParens: 'avoid',
3
- bracketSameLine: true,
4
- singleQuote: true,
5
- trailingComma: 'all',
6
- };