react-native-update 10.58.0 → 10.58.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.
package/harmony/pushy.har CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.58.0",
3
+ "version": "10.58.1",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "types": "src/index.ts",
package/src/client.ts CHANGED
@@ -742,8 +742,8 @@ export class Pushy {
742
742
  let timer: ReturnType<typeof setTimeout> | undefined;
743
743
  await Promise.race([
744
744
  this.loggerPromise.promise,
745
- new Promise((resolve) => {
746
- timer = setTimeout(resolve, 10 * 1000);
745
+ new Promise<void>((resolve) => {
746
+ timer = setTimeout(() => resolve(), 10 * 1000);
747
747
  }),
748
748
  ]);
749
749
  clearTimeout(timer);
@@ -977,8 +977,9 @@ export class Pushy {
977
977
  ) => {
978
978
  const resp = await fetchWithTimeout(
979
979
  this.getCheckUrl(endpoint),
980
- signal ? { ...fetchPayload, signal } : fetchPayload,
981
- DEFAULT_FETCH_TIMEOUT_MS
980
+ fetchPayload,
981
+ DEFAULT_FETCH_TIMEOUT_MS,
982
+ signal
982
983
  );
983
984
 
984
985
  if (!resp.ok) {
@@ -1532,7 +1533,7 @@ export class Pushy {
1532
1533
  (0.75 + Math.random() * 0.5)
1533
1534
  );
1534
1535
  log(`retry attempt ${attempt}/${maxRetries}, waiting ${backoffMs}ms`);
1535
- await new Promise((r) => setTimeout(r, backoffMs));
1536
+ await new Promise<void>((r) => setTimeout(() => r(), backoffMs));
1536
1537
  errorMessages.length = 0;
1537
1538
  errorMessages.push(...exhaustedStrategies.values());
1538
1539
  lastError = undefined;
package/src/core.ts CHANGED
@@ -3,6 +3,12 @@ import { UpdateError } from './error';
3
3
  import i18n from './i18n';
4
4
  import { emptyModule, error, log } from './utils';
5
5
 
6
+ // RN's JS global object. Declared locally because RN 0.87's own typings no
7
+ // longer define `global` (only @types/node did), and this source is
8
+ // type-checked in consumer projects; the module-scoped declaration also
9
+ // shadows @types/node's without conflicting.
10
+ declare const global: any;
11
+
6
12
  /* eslint-disable @react-native/no-deep-imports */
7
13
  const {
8
14
  version: v,
@@ -10,7 +16,7 @@ const {
10
16
  const RNVersion = `${v.major}.${v.minor}.${v.patch}`;
11
17
  const isTurboModuleEnabled =
12
18
  // https://github.com/facebook/react-native/pull/48362
13
- (global as any).__turboModuleProxy || (global as any).RN$Bridgeless;
19
+ global.__turboModuleProxy || global.RN$Bridgeless;
14
20
 
15
21
  const isWebPlatform = Platform.OS === 'web';
16
22
 
package/src/utils.ts CHANGED
@@ -132,7 +132,11 @@ export const computeProgress = (received: number, total: number): number =>
132
132
  export const fetchWithTimeout = (
133
133
  url: string,
134
134
  params: Parameters<typeof fetch>[1],
135
- timeoutMs = DEFAULT_FETCH_TIMEOUT_MS
135
+ timeoutMs = DEFAULT_FETCH_TIMEOUT_MS,
136
+ // Taken apart from params: merging it into the RequestInit only type-checks
137
+ // when the global AbortSignal and fetch's RequestInit come from the same
138
+ // declarations, which RN 0.87 globals mixed with DOM/Node/bun types break.
139
+ signal?: AbortSignal
136
140
  ): Promise<Response> => {
137
141
  // AbortController landed in the RN fetch polyfill around 0.60; we support
138
142
  // older peers, so fall back to a plain timer race when it is unavailable
@@ -161,7 +165,8 @@ export const fetchWithTimeout = (
161
165
  // The timeout controller replaces params.signal on the fetch call, so a
162
166
  // caller-provided signal (e.g. the hedged endpoint race cancelling losers)
163
167
  // must be chained onto it manually.
164
- const externalSignal = (params as any)?.signal as AbortSignal | undefined;
168
+ const externalSignal =
169
+ signal ?? ((params as any)?.signal as AbortSignal | undefined);
165
170
  const onExternalAbort = () => controller.abort();
166
171
  if (externalSignal?.aborted) {
167
172
  controller.abort();