@hot-updater/react-native 0.17.0 → 0.18.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/HotUpdater.podspec +7 -11
- package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +200 -0
- package/android/src/main/java/com/hotupdater/FileManagerService.kt +104 -0
- package/android/src/main/java/com/hotupdater/HotUpdater.kt +62 -305
- package/android/src/main/java/com/hotupdater/HotUpdaterFactory.kt +49 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +176 -0
- package/android/src/main/java/com/hotupdater/HttpDownloadService.kt +98 -0
- package/android/src/main/java/com/hotupdater/VersionedPreferencesService.kt +69 -0
- package/android/src/main/java/com/hotupdater/ZipFileUnzipService.kt +52 -0
- package/android/src/newarch/HotUpdaterModule.kt +31 -34
- package/android/src/oldarch/HotUpdaterModule.kt +32 -34
- package/android/src/oldarch/HotUpdaterSpec.kt +2 -9
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +593 -0
- package/ios/HotUpdater/Internal/FileManagerService.swift +97 -0
- package/ios/HotUpdater/Internal/HotUpdater-Bridging-Header.h +8 -0
- package/ios/HotUpdater/Internal/HotUpdater.mm +241 -0
- package/ios/HotUpdater/Internal/HotUpdaterFactory.swift +24 -0
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +143 -0
- package/ios/HotUpdater/Internal/NotificationExtension.swift +6 -0
- package/ios/HotUpdater/Internal/SSZipArchiveUnzipService.swift +25 -0
- package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +101 -0
- package/ios/HotUpdater/Internal/VersionedPreferencesService.swift +82 -0
- package/ios/HotUpdater/Public/HotUpdater.h +29 -0
- package/lib/commonjs/checkForUpdate.js +70 -0
- package/lib/commonjs/checkForUpdate.js.map +1 -0
- package/lib/commonjs/error.js +14 -0
- package/lib/commonjs/error.js.map +1 -0
- package/lib/commonjs/fetchUpdateInfo.js +74 -0
- package/lib/commonjs/fetchUpdateInfo.js.map +1 -0
- package/lib/commonjs/hooks/useEventCallback.js +17 -0
- package/lib/commonjs/hooks/useEventCallback.js.map +1 -0
- package/lib/commonjs/index.js +234 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native.js +132 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/runUpdateProcess.js +69 -0
- package/lib/commonjs/runUpdateProcess.js.map +1 -0
- package/lib/commonjs/specs/NativeHotUpdater.js +9 -0
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -0
- package/lib/commonjs/store.js +48 -0
- package/lib/commonjs/store.js.map +1 -0
- package/lib/commonjs/wrap.js +98 -0
- package/lib/commonjs/wrap.js.map +1 -0
- package/lib/module/checkForUpdate.js +64 -0
- package/lib/module/checkForUpdate.js.map +1 -0
- package/lib/module/error.js +9 -0
- package/lib/module/error.js.map +1 -0
- package/lib/module/fetchUpdateInfo.js +69 -0
- package/lib/module/fetchUpdateInfo.js.map +1 -0
- package/lib/module/hooks/useEventCallback.js +13 -0
- package/lib/module/hooks/useEventCallback.js.map +1 -0
- package/lib/module/index.js +211 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native.js +119 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/runUpdateProcess.js +64 -0
- package/lib/module/runUpdateProcess.js.map +1 -0
- package/lib/module/specs/NativeHotUpdater.js +5 -0
- package/lib/module/specs/NativeHotUpdater.js.map +1 -0
- package/lib/module/store.js +42 -0
- package/lib/module/store.js.map +1 -0
- package/lib/module/wrap.js +94 -0
- package/lib/module/wrap.js.map +1 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts +22 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/error.d.ts +1 -0
- package/lib/typescript/commonjs/error.d.ts.map +1 -0
- package/lib/typescript/commonjs/fetchUpdateInfo.d.ts +4 -0
- package/lib/typescript/commonjs/fetchUpdateInfo.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/hooks/useEventCallback.d.ts +1 -0
- package/lib/typescript/commonjs/hooks/useEventCallback.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/index.d.ts +38 -12
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/native.d.ts +64 -0
- package/lib/typescript/commonjs/native.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/{dist → lib/typescript/commonjs}/runUpdateProcess.d.ts +1 -0
- package/lib/typescript/commonjs/runUpdateProcess.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/specs/NativeHotUpdater.d.ts +8 -9
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/store.d.ts +1 -0
- package/lib/typescript/commonjs/store.d.ts.map +1 -0
- package/{dist → lib/typescript/commonjs}/wrap.d.ts +3 -2
- package/lib/typescript/commonjs/wrap.d.ts.map +1 -0
- package/lib/typescript/module/checkForUpdate.d.ts +22 -0
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -0
- package/lib/typescript/module/error.d.ts +4 -0
- package/lib/typescript/module/error.d.ts.map +1 -0
- package/lib/typescript/module/fetchUpdateInfo.d.ts +4 -0
- package/lib/typescript/module/fetchUpdateInfo.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useEventCallback.d.ts +5 -0
- package/lib/typescript/module/hooks/useEventCallback.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +202 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/native.d.ts +64 -0
- package/lib/typescript/module/native.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/runUpdateProcess.d.ts +49 -0
- package/lib/typescript/module/runUpdateProcess.d.ts.map +1 -0
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +19 -0
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -0
- package/lib/typescript/module/store.d.ts +11 -0
- package/lib/typescript/module/store.d.ts.map +1 -0
- package/lib/typescript/module/wrap.d.ts +51 -0
- package/lib/typescript/module/wrap.d.ts.map +1 -0
- package/package.json +59 -30
- package/src/checkForUpdate.ts +59 -9
- package/src/fetchUpdateInfo.ts +40 -12
- package/src/index.ts +37 -11
- package/src/native.ts +87 -41
- package/src/runUpdateProcess.ts +2 -2
- package/src/specs/NativeHotUpdater.ts +8 -10
- package/src/wrap.tsx +9 -13
- package/android/generated/java/com/hotupdater/NativeHotUpdaterSpec.java +0 -93
- package/android/generated/jni/CMakeLists.txt +0 -36
- package/android/generated/jni/HotUpdaterSpec-generated.cpp +0 -68
- package/android/generated/jni/HotUpdaterSpec.h +0 -31
- package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI-generated.cpp +0 -70
- package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI.h +0 -121
- package/android/src/main/java/com/hotupdater/HotUpdaterPrefs.kt +0 -42
- package/dist/checkForUpdate.d.ts +0 -12
- package/dist/fetchUpdateInfo.d.ts +0 -3
- package/dist/index.js +0 -341
- package/dist/index.mjs +0 -301
- package/dist/native.d.ts +0 -41
- package/ios/HotUpdater/HotUpdater.h +0 -15
- package/ios/HotUpdater/HotUpdater.mm +0 -468
- package/ios/HotUpdater/HotUpdater.modulemap +0 -6
- package/ios/HotUpdater/HotUpdaterPrefs.h +0 -9
- package/ios/HotUpdater/HotUpdaterPrefs.mm +0 -45
- package/ios/generated/HotUpdaterSpec/HotUpdaterSpec-generated.mm +0 -81
- package/ios/generated/HotUpdaterSpec/HotUpdaterSpec.h +0 -112
- package/ios/generated/HotUpdaterSpecJSI-generated.cpp +0 -70
- package/ios/generated/HotUpdaterSpecJSI.h +0 -121
- package/react-native.config.js +0 -12
- package/src/global.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
3
|
-
import { HotUpdaterError } from "./error";
|
|
3
|
+
import type { HotUpdaterError } from "./error";
|
|
4
4
|
import type { RunUpdateProcessResponse } from "./runUpdateProcess";
|
|
5
5
|
type UpdateStatus = "CHECK_FOR_UPDATE" | "UPDATING" | "UPDATE_PROCESS_COMPLETED";
|
|
6
6
|
export interface HotUpdaterOptions extends CheckForUpdateOptions {
|
|
@@ -30,7 +30,7 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
|
|
|
30
30
|
progress: number;
|
|
31
31
|
message: string | null;
|
|
32
32
|
}>;
|
|
33
|
-
onError?: (error: HotUpdaterError) => void;
|
|
33
|
+
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
34
34
|
onProgress?: (progress: number) => void;
|
|
35
35
|
/**
|
|
36
36
|
* When a force update exists, the app will automatically reload.
|
|
@@ -48,3 +48,4 @@ export interface HotUpdaterOptions extends CheckForUpdateOptions {
|
|
|
48
48
|
}
|
|
49
49
|
export declare function wrap<P extends React.JSX.IntrinsicAttributes = object>(options: HotUpdaterOptions): (WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
50
50
|
export {};
|
|
51
|
+
//# sourceMappingURL=wrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,KAAK,YAAY,GACb,kBAAkB,GAClB,UAAU,GACV,0BAA0B,CAAC;AAE/B,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,0BAA0B,CAAC,CAAC;QAC1D,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,GAAG,OAAO,KAAK,IAAI,CAAC;IAC7D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACzE;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAAG,MAAM,EACnE,OAAO,EAAE,iBAAiB,GACzB,CAAC,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAuGtE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AppUpdateInfo, GetBundlesArgs } from "@hot-updater/core";
|
|
2
|
+
import { type UpdateSource } from "./fetchUpdateInfo";
|
|
3
|
+
export interface CheckForUpdateOptions {
|
|
4
|
+
source: UpdateSource;
|
|
5
|
+
requestHeaders?: Record<string, string>;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
/**
|
|
8
|
+
* The timeout duration for the request.
|
|
9
|
+
* @default 5000
|
|
10
|
+
*/
|
|
11
|
+
requestTimeout?: number;
|
|
12
|
+
}
|
|
13
|
+
export type CheckForUpdateResult = AppUpdateInfo & {
|
|
14
|
+
/**
|
|
15
|
+
* Updates the bundle.
|
|
16
|
+
* This method is equivalent to `HotUpdater.updateBundle()` but with all required arguments pre-filled.
|
|
17
|
+
*/
|
|
18
|
+
updateBundle: () => Promise<boolean>;
|
|
19
|
+
};
|
|
20
|
+
export declare function checkForUpdate(options: CheckForUpdateOptions): Promise<CheckForUpdateResult | null>;
|
|
21
|
+
export declare const getUpdateSource: (baseUrl: string) => (args: GetBundlesArgs) => string;
|
|
22
|
+
//# sourceMappingURL=checkForUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkForUpdate.d.ts","sourceRoot":"","sources":["../../../src/checkForUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAUvE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD;;;OAGG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA8DtC;AAED,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,MAAM,MAAM,cAAc,WASxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AppUpdateInfo, GetBundlesArgs } from "@hot-updater/core";
|
|
2
|
+
export type UpdateSource = string | ((args: GetBundlesArgs) => Promise<AppUpdateInfo | null>) | ((args: GetBundlesArgs) => string);
|
|
3
|
+
export declare const fetchUpdateInfo: (source: UpdateSource, args: GetBundlesArgs, requestHeaders?: Record<string, string>, onError?: (error: Error) => void, requestTimeout?: number) => Promise<AppUpdateInfo | null>;
|
|
4
|
+
//# sourceMappingURL=fetchUpdateInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchUpdateInfo.d.ts","sourceRoot":"","sources":["../../../src/fetchUpdateInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,GACzD,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,MAAM,CAAC,CAAC;AAEvC,eAAO,MAAM,eAAe,GAC1B,QAAQ,YAAY,EACpB,MAAM,cAAc,EACpB,iBAAiB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,UAAU,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,uBAAqB,KACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CA+D9B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type EventCallback<Args extends unknown[], R> = ((...args: Args) => R) | undefined;
|
|
2
|
+
export declare function useEventCallback<Args extends unknown[], R>(fn: (...args: Args) => R): (...args: Args) => R;
|
|
3
|
+
export declare function useEventCallback<Args extends unknown[], R>(fn: EventCallback<Args, R>): EventCallback<Args, R>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=useEventCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEventCallback.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useEventCallback.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,IACxC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC,GACtB,SAAS,CAAC;AAEd,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,GACvB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC;AACxB,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,EAAE,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,GACzB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { checkForUpdate } from "./checkForUpdate";
|
|
2
|
+
import { updateBundle } from "./native";
|
|
3
|
+
import { wrap } from "./wrap";
|
|
4
|
+
export type { HotUpdaterOptions } from "./wrap";
|
|
5
|
+
export type { HotUpdaterEvent } from "./native";
|
|
6
|
+
export * from "./store";
|
|
7
|
+
export declare const HotUpdater: {
|
|
8
|
+
/**
|
|
9
|
+
* `HotUpdater.wrap` checks for updates at the entry point, and if there is a bundle to update, it downloads the bundle and applies the update strategy.
|
|
10
|
+
*
|
|
11
|
+
* @param {object} options - Configuration options
|
|
12
|
+
* @param {string} options.source - Update server URL
|
|
13
|
+
* @param {object} [options.requestHeaders] - Request headers
|
|
14
|
+
* @param {React.ComponentType} [options.fallbackComponent] - Component to display during updates
|
|
15
|
+
* @param {boolean} [options.reloadOnForceUpdate=true] - Whether to automatically reload the app on force updates
|
|
16
|
+
* @param {Function} [options.onUpdateProcessCompleted] - Callback after update process completes
|
|
17
|
+
* @param {Function} [options.onProgress] - Callback to track bundle download progress
|
|
18
|
+
* @returns {Function} Higher-order component that wraps the app component
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* export default HotUpdater.wrap({
|
|
23
|
+
* source: "<your-update-server-url>",
|
|
24
|
+
* requestHeaders: {
|
|
25
|
+
* "Authorization": "Bearer <your-access-token>",
|
|
26
|
+
* },
|
|
27
|
+
* })(App);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
wrap: typeof wrap;
|
|
31
|
+
/**
|
|
32
|
+
* Reloads the app.
|
|
33
|
+
*/
|
|
34
|
+
reload: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Fetches the current app version.
|
|
37
|
+
*/
|
|
38
|
+
getAppVersion: () => string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Fetches the current bundle ID of the app.
|
|
41
|
+
*/
|
|
42
|
+
getBundleId: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves the initial bundle ID based on the build time of the native app.
|
|
45
|
+
*/
|
|
46
|
+
getMinBundleId: () => string;
|
|
47
|
+
/**
|
|
48
|
+
* Fetches the current channel of the app.
|
|
49
|
+
*
|
|
50
|
+
* If no channel is specified, the app is assigned to the 'production' channel.
|
|
51
|
+
*
|
|
52
|
+
* @returns {string} The current release channel of the app
|
|
53
|
+
* @default "production"
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const channel = HotUpdater.getChannel();
|
|
57
|
+
* console.log(`Current channel: ${channel}`);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
getChannel: () => string;
|
|
61
|
+
/**
|
|
62
|
+
* The initial channel of the native app.
|
|
63
|
+
*
|
|
64
|
+
* @returns {string} The current release channel of the app
|
|
65
|
+
* @default "production"
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const channel = HotUpdater.getReleaseChannel();
|
|
69
|
+
* console.log(`Current release channel: ${channel}`);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
getReleaseChannel: () => string;
|
|
73
|
+
/**
|
|
74
|
+
* Adds a listener to HotUpdater events.
|
|
75
|
+
*
|
|
76
|
+
* @param {keyof HotUpdaterEvent} eventName - The name of the event to listen for
|
|
77
|
+
* @param {(event: HotUpdaterEvent[T]) => void} listener - The callback function to handle the event
|
|
78
|
+
* @returns {() => void} A cleanup function that removes the event listener
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const unsubscribe = HotUpdater.addListener("onProgress", ({ progress }) => {
|
|
83
|
+
* console.log(`Update progress: ${progress * 100}%`);
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // Unsubscribe when no longer needed
|
|
87
|
+
* unsubscribe();
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
addListener: <T extends keyof import("./native").HotUpdaterEvent>(eventName: T, listener: (event: import("./native").HotUpdaterEvent[T]) => void) => () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Manually checks for updates.
|
|
93
|
+
*
|
|
94
|
+
* @param {Object} config - Update check configuration
|
|
95
|
+
* @param {string} config.source - Update server URL
|
|
96
|
+
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
97
|
+
*
|
|
98
|
+
* @returns {Promise<UpdateInfo | null>} Update information or null if up to date
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const updateInfo = await HotUpdater.checkForUpdate({
|
|
103
|
+
* source: "<your-update-server-url>",
|
|
104
|
+
* requestHeaders: {
|
|
105
|
+
* Authorization: "Bearer <your-access-token>",
|
|
106
|
+
* },
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* if (!updateInfo) {
|
|
110
|
+
* console.log("App is up to date");
|
|
111
|
+
* return;
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
* await HotUpdater.updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
115
|
+
* if (updateInfo.shouldForceUpdate) {
|
|
116
|
+
* HotUpdater.reload();
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
checkForUpdate: typeof checkForUpdate;
|
|
121
|
+
/**
|
|
122
|
+
* Manually checks and applies updates for the application.
|
|
123
|
+
*
|
|
124
|
+
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
125
|
+
* @param {string} config.source - Update server URL
|
|
126
|
+
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
127
|
+
* @param {boolean} [config.reloadOnForceUpdate=false] - Whether to automatically reload on force update
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* // Auto reload on force update
|
|
132
|
+
* const result = await HotUpdater.runUpdateProcess({
|
|
133
|
+
* source: "<your-update-server-url>",
|
|
134
|
+
* requestHeaders: {
|
|
135
|
+
* // Add necessary headers
|
|
136
|
+
* },
|
|
137
|
+
* reloadOnForceUpdate: true
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* // Manually handle reload on force update
|
|
141
|
+
* const result = await HotUpdater.runUpdateProcess({
|
|
142
|
+
* source: "<your-update-server-url>",
|
|
143
|
+
* reloadOnForceUpdate: false
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
147
|
+
* HotUpdater.reload();
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
152
|
+
*/
|
|
153
|
+
runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateOptions }: import("./runUpdateProcess").RunUpdateProcessOptions) => Promise<import("./runUpdateProcess").RunUpdateProcessResponse>;
|
|
154
|
+
/**
|
|
155
|
+
* Updates the bundle of the app.
|
|
156
|
+
*
|
|
157
|
+
* @param {UpdateBundleParams} params - Parameters object required for bundle update
|
|
158
|
+
* @param {string} params.bundleId - The bundle ID of the app
|
|
159
|
+
* @param {string|null} params.fileUrl - The URL of the zip file
|
|
160
|
+
*
|
|
161
|
+
* @returns {Promise<boolean>} Whether the update was successful
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const updateInfo = await HotUpdater.checkForUpdate({
|
|
166
|
+
* source: "<your-update-server-url>",
|
|
167
|
+
* requestHeaders: {
|
|
168
|
+
* Authorization: "Bearer <your-access-token>",
|
|
169
|
+
* },
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* if (!updateInfo) {
|
|
173
|
+
* return {
|
|
174
|
+
* status: "UP_TO_DATE",
|
|
175
|
+
* };
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* await HotUpdater.updateBundle({
|
|
179
|
+
* bundleId: updateInfo.id,
|
|
180
|
+
* fileUrl: updateInfo.fileUrl
|
|
181
|
+
* });
|
|
182
|
+
* if (updateInfo.shouldForceUpdate) {
|
|
183
|
+
* HotUpdater.reload();
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
updateBundle: typeof updateBundle;
|
|
188
|
+
/**
|
|
189
|
+
* Fetches the fingerprint of the app.
|
|
190
|
+
*
|
|
191
|
+
* @returns {string} The fingerprint of the app
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const fingerprint = HotUpdater.getFingerprintHash();
|
|
196
|
+
* console.log(`Fingerprint: ${fingerprint}`);
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
getFingerprintHash: () => string | null;
|
|
200
|
+
};
|
|
201
|
+
export { getUpdateSource } from "./checkForUpdate";
|
|
202
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EASL,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,cAAc,SAAS,CAAC;AAQxB,eAAO,MAAM,UAAU;IACrB;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;;;;;;;;;;OAYG;;IAEH;;;;;;;;;;OAUG;;IAEH;;;;;;;;;;;;;;;;OAgBG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;;IAEH;;;;;;;;;;OAUG;;CAEJ,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { UpdateStatus, UpdateStrategy } from "@hot-updater/core";
|
|
2
|
+
import { type UpdateBundleParams } from "./specs/NativeHotUpdater";
|
|
3
|
+
export declare const HotUpdaterConstants: {
|
|
4
|
+
OVER_THE_AIR_CHANNEL: string | null;
|
|
5
|
+
HOT_UPDATER_BUNDLE_ID: string;
|
|
6
|
+
FINGERPRINT_HASH: string | null;
|
|
7
|
+
UPDATE_STRATEGY: UpdateStrategy;
|
|
8
|
+
};
|
|
9
|
+
export type HotUpdaterEvent = {
|
|
10
|
+
onProgress: {
|
|
11
|
+
progress: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const addListener: <T extends keyof HotUpdaterEvent>(eventName: T, listener: (event: HotUpdaterEvent[T]) => void) => () => void;
|
|
15
|
+
export type UpdateParams = UpdateBundleParams & {
|
|
16
|
+
status: UpdateStatus;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Downloads files and applies them to the app.
|
|
20
|
+
*
|
|
21
|
+
* @param {UpdateParams} params - Parameters object required for bundle update
|
|
22
|
+
* @returns {Promise<boolean>} Resolves with true if download was successful, otherwise rejects with an error.
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateBundle(params: UpdateParams): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use updateBundle(params: UpdateBundleParamsWithStatus) instead
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateBundle(bundleId: string, fileUrl: string | null): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches the current app version.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getAppVersion: () => string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Reloads the app.
|
|
35
|
+
*/
|
|
36
|
+
export declare const reload: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Fetches the minimum bundle id, which represents the initial bundle of the app
|
|
39
|
+
* since it is created at build time.
|
|
40
|
+
*
|
|
41
|
+
* @returns {string} Resolves with the minimum bundle id or null if not available.
|
|
42
|
+
*/
|
|
43
|
+
export declare const getMinBundleId: () => string;
|
|
44
|
+
/**
|
|
45
|
+
* Fetches the current bundle version id.
|
|
46
|
+
*
|
|
47
|
+
* @async
|
|
48
|
+
* @returns {Promise<string>} Resolves with the current version id or null if not available.
|
|
49
|
+
*/
|
|
50
|
+
export declare const getBundleId: () => string;
|
|
51
|
+
/**
|
|
52
|
+
* Fetches the channel for the app.
|
|
53
|
+
*
|
|
54
|
+
* @returns {string} Resolves with the channel or null if not available.
|
|
55
|
+
*/
|
|
56
|
+
export declare const getChannel: () => string;
|
|
57
|
+
export declare const getReleaseChannel: () => string;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches the fingerprint for the app.
|
|
60
|
+
*
|
|
61
|
+
* @returns {string | null} Resolves with the fingerprint hash
|
|
62
|
+
*/
|
|
63
|
+
export declare const getFingerprintHash: () => string | null;
|
|
64
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAyB,EACvB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAUlC,eAAO,MAAM,mBAAmB;;;;;CAS/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE;QACV,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,eAAe,EACzD,WAAW,CAAC,EACZ,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,eAQ9C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG;IAC9C,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC3E;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;AAqCpB;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,IAGzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,YAIlB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAO,MAGjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAO,MAI9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAO,MAM7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,MAGpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,MAAM,GAAG,IAE9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
2
|
+
export interface RunUpdateProcessResponse {
|
|
3
|
+
status: "ROLLBACK" | "UPDATE" | "UP_TO_DATE";
|
|
4
|
+
shouldForceUpdate: boolean;
|
|
5
|
+
message: string | null;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RunUpdateProcessOptions extends CheckForUpdateOptions {
|
|
9
|
+
/**
|
|
10
|
+
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
11
|
+
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
reloadOnForceUpdate?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Manually checks and applies updates for the application.
|
|
18
|
+
*
|
|
19
|
+
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
20
|
+
* @param {string} config.source - Update server URL
|
|
21
|
+
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
22
|
+
* @param {boolean} [config.reloadOnForceUpdate=true] - Whether to automatically reload on force update
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Auto reload on force update
|
|
27
|
+
* const result = await HotUpdater.runUpdateProcess({
|
|
28
|
+
* source: "<your-update-server-url>",
|
|
29
|
+
* requestHeaders: {
|
|
30
|
+
* // Add necessary headers
|
|
31
|
+
* },
|
|
32
|
+
* reloadOnForceUpdate: true
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Manually handle reload on force update
|
|
36
|
+
* const result = await HotUpdater.runUpdateProcess({
|
|
37
|
+
* source: "<your-update-server-url>",
|
|
38
|
+
* reloadOnForceUpdate: false
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
42
|
+
* HotUpdater.reload();
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
47
|
+
*/
|
|
48
|
+
export declare const runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateOptions }: RunUpdateProcessOptions) => Promise<RunUpdateProcessResponse>;
|
|
49
|
+
//# sourceMappingURL=runUpdateProcess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runUpdateProcess.d.ts","sourceRoot":"","sources":["../../../src/runUpdateProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,GAAU,mDAGpC,uBAAuB,KAAG,OAAO,CAAC,wBAAwB,CAyB5D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TurboModule } from "react-native";
|
|
2
|
+
export interface UpdateBundleParams {
|
|
3
|
+
bundleId: string;
|
|
4
|
+
fileUrl: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface Spec extends TurboModule {
|
|
7
|
+
reload(): void;
|
|
8
|
+
updateBundle(params: UpdateBundleParams): Promise<boolean>;
|
|
9
|
+
addListener(eventName: string): void;
|
|
10
|
+
removeListeners(count: number): void;
|
|
11
|
+
readonly getConstants: () => {
|
|
12
|
+
MIN_BUNDLE_ID: string;
|
|
13
|
+
APP_VERSION: string | null;
|
|
14
|
+
CHANNEL: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const _default: Spec;
|
|
18
|
+
export default _default;
|
|
19
|
+
//# sourceMappingURL=NativeHotUpdater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeHotUpdater.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeHotUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,MAAM,IAAI,IAAI,CAAC;IACf,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAG3D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;;AAED,wBAAoE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type HotUpdaterState = {
|
|
2
|
+
progress: number;
|
|
3
|
+
isBundleUpdated: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const hotUpdaterStore: {
|
|
6
|
+
getSnapshot: () => HotUpdaterState;
|
|
7
|
+
setState: (newState: Partial<HotUpdaterState>) => void;
|
|
8
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const useHotUpdaterStore: <T = HotUpdaterState>(selector?: (snapshot: HotUpdaterState) => T) => T;
|
|
11
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAsCF,eAAO,MAAM,eAAe;;yBAhBE,OAAO,CAAC,eAAe,CAAC;0BAQvB,MAAM,IAAI;CAQa,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,eAAe,EACpD,WAAU,CAAC,QAAQ,EAAE,eAAe,KAAK,CAA+B,MAQzE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
3
|
+
import type { HotUpdaterError } from "./error";
|
|
4
|
+
import type { RunUpdateProcessResponse } from "./runUpdateProcess";
|
|
5
|
+
type UpdateStatus = "CHECK_FOR_UPDATE" | "UPDATING" | "UPDATE_PROCESS_COMPLETED";
|
|
6
|
+
export interface HotUpdaterOptions extends CheckForUpdateOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Component to show while downloading a new bundle update.
|
|
9
|
+
*
|
|
10
|
+
* When an update exists and the bundle is being downloaded, this component will block access
|
|
11
|
+
* to the entry point and show download progress.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#fallback-component}
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* HotUpdater.wrap({
|
|
17
|
+
* source: "<update-server-url>",
|
|
18
|
+
* fallbackComponent: ({ progress = 0 }) => (
|
|
19
|
+
* <View style={styles.container}>
|
|
20
|
+
* <Text style={styles.text}>Updating... {progress}%</Text>
|
|
21
|
+
* </View>
|
|
22
|
+
* )
|
|
23
|
+
* })(App)
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* If not defined, the bundle will download in the background without blocking the screen.
|
|
27
|
+
*/
|
|
28
|
+
fallbackComponent?: React.FC<{
|
|
29
|
+
status: Exclude<UpdateStatus, "UPDATE_PROCESS_COMPLETED">;
|
|
30
|
+
progress: number;
|
|
31
|
+
message: string | null;
|
|
32
|
+
}>;
|
|
33
|
+
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
34
|
+
onProgress?: (progress: number) => void;
|
|
35
|
+
/**
|
|
36
|
+
* When a force update exists, the app will automatically reload.
|
|
37
|
+
* If `false`, When a force update exists, the app will not reload. `shouldForceUpdate` will be returned as `true` in `onUpdateProcessCompleted`.
|
|
38
|
+
* If `true`, When a force update exists, the app will automatically reload.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
reloadOnForceUpdate?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback function that is called when the update process is completed.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://gronxb.github.io/hot-updater/guide/hot-updater/wrap.html#onupdateprocesscompleted}
|
|
46
|
+
*/
|
|
47
|
+
onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function wrap<P extends React.JSX.IntrinsicAttributes = object>(options: HotUpdaterOptions): (WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=wrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,KAAK,YAAY,GACb,kBAAkB,GAClB,UAAU,GACV,0BAA0B,CAAC;AAE/B,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,0BAA0B,CAAC,CAAC;QAC1D,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,GAAG,OAAO,KAAK,IAAI,CAAC;IAC7D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACzE;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAAG,MAAM,EACnE,OAAO,EAAE,iBAAiB,GACzB,CAAC,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAuGtE"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "
|
|
7
|
-
"
|
|
8
|
-
"react-native": "src/index
|
|
9
|
-
"
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./lib/typescript/module/index.d.ts",
|
|
13
|
+
"default": "./lib/module/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
17
|
+
"default": "./lib/commonjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json",
|
|
21
|
+
"./app.plugin.js": "./app.plugin.js"
|
|
22
|
+
},
|
|
10
23
|
"files": [
|
|
11
24
|
"src",
|
|
12
|
-
"
|
|
25
|
+
"lib",
|
|
13
26
|
"android",
|
|
14
27
|
"ios",
|
|
15
28
|
"cpp",
|
|
16
|
-
"*.podspec",
|
|
17
29
|
"app.plugin.js",
|
|
18
30
|
"plugin/build/withHotUpdater.js",
|
|
31
|
+
"*.podspec",
|
|
19
32
|
"react-native.config.js",
|
|
20
33
|
"!ios/build",
|
|
34
|
+
"!ios/HotUpdater/Test",
|
|
35
|
+
"!ios/HotUpdater/Package.swift",
|
|
21
36
|
"!android/build",
|
|
22
37
|
"!android/gradle",
|
|
23
38
|
"!android/gradlew",
|
|
@@ -50,23 +65,35 @@
|
|
|
50
65
|
},
|
|
51
66
|
"react-native-builder-bob": {
|
|
52
67
|
"source": "src",
|
|
53
|
-
"output": "
|
|
68
|
+
"output": "lib",
|
|
54
69
|
"targets": [
|
|
55
|
-
|
|
70
|
+
[
|
|
71
|
+
"commonjs",
|
|
72
|
+
{
|
|
73
|
+
"esm": true
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"module",
|
|
78
|
+
{
|
|
79
|
+
"esm": true
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
"typescript",
|
|
84
|
+
{
|
|
85
|
+
"project": "tsconfig.build.json"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
56
88
|
]
|
|
57
89
|
},
|
|
58
90
|
"codegenConfig": {
|
|
59
91
|
"name": "HotUpdaterSpec",
|
|
60
92
|
"type": "modules",
|
|
61
|
-
"jsSrcsDir": "src
|
|
62
|
-
"outputDir": {
|
|
63
|
-
"ios": "ios/generated",
|
|
64
|
-
"android": "android/generated"
|
|
65
|
-
},
|
|
93
|
+
"jsSrcsDir": "./src",
|
|
66
94
|
"android": {
|
|
67
95
|
"javaPackageName": "com.hotupdater"
|
|
68
|
-
}
|
|
69
|
-
"includesGeneratedCode": true
|
|
96
|
+
}
|
|
70
97
|
},
|
|
71
98
|
"peerDependenciesMeta": {
|
|
72
99
|
"expo": {
|
|
@@ -74,30 +101,32 @@
|
|
|
74
101
|
}
|
|
75
102
|
},
|
|
76
103
|
"peerDependencies": {
|
|
104
|
+
"expo": ">=50.0.0",
|
|
77
105
|
"react": "*",
|
|
78
|
-
"react-native": "*"
|
|
79
|
-
"expo": ">=50.0.0"
|
|
106
|
+
"react-native": "*"
|
|
80
107
|
},
|
|
81
108
|
"devDependencies": {
|
|
82
|
-
"@react-native-community/cli": "
|
|
83
|
-
"@types/react": "
|
|
109
|
+
"@react-native-community/cli": "18.0.0",
|
|
110
|
+
"@types/react": "19.1.3",
|
|
84
111
|
"@types/use-sync-external-store": "^0.0.6",
|
|
85
112
|
"del-cli": "^6.0.0",
|
|
86
|
-
"
|
|
87
|
-
"react
|
|
88
|
-
"react-native
|
|
89
|
-
"
|
|
113
|
+
"expo": "^50.0.0",
|
|
114
|
+
"react": "19.1.0",
|
|
115
|
+
"react-native": "0.79.1",
|
|
116
|
+
"react-native-builder-bob": "^0.40.10",
|
|
117
|
+
"typescript": "^5.8.3"
|
|
90
118
|
},
|
|
91
119
|
"dependencies": {
|
|
92
|
-
"use-sync-external-store": "1.
|
|
93
|
-
"@hot-updater/
|
|
94
|
-
"@hot-updater/
|
|
120
|
+
"use-sync-external-store": "1.5.0",
|
|
121
|
+
"@hot-updater/core": "0.18.1",
|
|
122
|
+
"@hot-updater/js": "0.18.1"
|
|
95
123
|
},
|
|
96
124
|
"scripts": {
|
|
97
|
-
"build": "
|
|
125
|
+
"build": "bob build && tsc -p plugin/tsconfig.json",
|
|
98
126
|
"build:plugin": "tsc -p plugin/tsconfig.json",
|
|
99
127
|
"test:type": "tsc --noEmit",
|
|
100
128
|
"test": "vitest",
|
|
101
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib"
|
|
129
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
130
|
+
"test:ios": "swift test --package-path ios/HotUpdater"
|
|
102
131
|
}
|
|
103
132
|
}
|