@take-out/native-hot-update 0.4.3 → 0.4.4
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/dist/cjs/createHotUpdater.cjs +180 -136
- package/dist/cjs/createHotUpdater.native.js +189 -151
- package/dist/cjs/createHotUpdater.native.js.map +1 -1
- package/dist/cjs/helpers.cjs +15 -11
- package/dist/cjs/helpers.native.js +17 -13
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -12
- package/dist/cjs/index.native.js +14 -12
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/mmkv.cjs +12 -10
- package/dist/cjs/mmkv.native.js +12 -10
- package/dist/cjs/mmkv.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/createHotUpdater.mjs +152 -110
- package/dist/esm/createHotUpdater.mjs.map +1 -1
- package/dist/esm/createHotUpdater.native.js +161 -125
- package/dist/esm/createHotUpdater.native.js.map +1 -1
- package/dist/esm/helpers.mjs +3 -1
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/helpers.native.js +3 -1
- package/dist/esm/helpers.native.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,185 +4,223 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var createHotUpdater_exports = {};
|
|
35
37
|
__export(createHotUpdater_exports, {
|
|
36
38
|
createHotUpdater: () => createHotUpdater
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(createHotUpdater_exports);
|
|
39
|
-
var import_react_native = require("@hot-updater/react-native")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var import_react_native = require("@hot-updater/react-native");
|
|
42
|
+
var Application = __toESM(require("expo-application"), 1);
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
var import_react_native2 = require("react-native");
|
|
45
|
+
var INITIAL_OTA_ID = "00000000-0000-0000-0000-000000000000";
|
|
46
|
+
var BUNDLE_ID_KEY_PREFIX = "hotUpdater.bundleId";
|
|
47
|
+
var PRE_RELEASE_BUNDLE_ID_KEY = "hotUpdater.preReleaseBundleId";
|
|
46
48
|
function createHotUpdater(config) {
|
|
47
49
|
var {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
50
|
+
storage,
|
|
51
|
+
updateStrategy = "appVersion"
|
|
52
|
+
} = config;
|
|
53
|
+
var isUpdatePending = false;
|
|
54
|
+
var getAppliedOta = function () {
|
|
55
|
+
var id = import_react_native.HotUpdater.getBundleId();
|
|
56
|
+
if (id === INITIAL_OTA_ID) return null;
|
|
57
|
+
if (id === import_react_native.HotUpdater.getMinBundleId()) return null;
|
|
58
|
+
return id;
|
|
59
|
+
};
|
|
60
|
+
var getShortOtaId = function () {
|
|
61
|
+
var fullId = getAppliedOta();
|
|
62
|
+
return fullId ? fullId.slice(-12) : null;
|
|
63
|
+
};
|
|
64
|
+
var getIsUpdatePending = function () {
|
|
65
|
+
return isUpdatePending;
|
|
66
|
+
};
|
|
67
|
+
var getPreReleaseBundleId = function () {
|
|
68
|
+
return storage.get(PRE_RELEASE_BUNDLE_ID_KEY);
|
|
69
|
+
};
|
|
70
|
+
var handleUpdateDownloaded = function (id) {
|
|
71
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
72
|
+
var appVersion = Application.nativeApplicationVersion;
|
|
73
|
+
if (appVersion) {
|
|
74
|
+
storage.set(`${BUNDLE_ID_KEY_PREFIX}.${appVersion}`, id);
|
|
75
|
+
}
|
|
76
|
+
if (options.isPreRelease) {
|
|
77
|
+
storage.set(PRE_RELEASE_BUNDLE_ID_KEY, id);
|
|
78
|
+
} else {
|
|
79
|
+
storage.delete(PRE_RELEASE_BUNDLE_ID_KEY);
|
|
80
|
+
}
|
|
81
|
+
isUpdatePending = true;
|
|
82
|
+
};
|
|
83
|
+
var useOtaUpdater = function () {
|
|
84
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
85
|
+
var {
|
|
86
|
+
enabled = true,
|
|
87
|
+
onUpdateDownloaded: onUpdateDownloadedCallback,
|
|
88
|
+
onError
|
|
89
|
+
} = options;
|
|
90
|
+
var progress = (0, import_react_native.useHotUpdaterStore)(function (state) {
|
|
91
|
+
return state.progress;
|
|
92
|
+
});
|
|
93
|
+
var isUpdating = progress > 0.01;
|
|
94
|
+
var [isUserClearedForAccess, setIsUserClearedForAccess] = (0, import_react.useState)(false);
|
|
95
|
+
var isUserClearedForAccessRef = (0, import_react.useRef)(isUserClearedForAccess);
|
|
96
|
+
isUserClearedForAccessRef.current = isUserClearedForAccess;
|
|
97
|
+
(0, import_react.useEffect)(function () {
|
|
98
|
+
if (!isUpdating) {
|
|
94
99
|
var timer = setTimeout(function () {
|
|
95
|
-
isUserClearedForAccessRef.current
|
|
96
|
-
|
|
100
|
+
if (!isUserClearedForAccessRef.current) {
|
|
101
|
+
setIsUserClearedForAccess(true);
|
|
102
|
+
}
|
|
103
|
+
}, 5e3);
|
|
97
104
|
return function () {
|
|
98
105
|
return clearTimeout(timer);
|
|
99
106
|
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
}, [isUpdating]);
|
|
110
|
+
(0, import_react.useEffect)(function () {
|
|
111
|
+
var timer = setTimeout(function () {
|
|
112
|
+
if (!isUserClearedForAccessRef.current) {
|
|
113
|
+
setIsUserClearedForAccess(true);
|
|
114
|
+
}
|
|
115
|
+
}, 2e4);
|
|
116
|
+
return function () {
|
|
117
|
+
return clearTimeout(timer);
|
|
118
|
+
};
|
|
119
|
+
}, []);
|
|
120
|
+
(0, import_react.useEffect)(function () {
|
|
121
|
+
var shouldContinue = true;
|
|
122
|
+
(async function () {
|
|
123
|
+
try {
|
|
124
|
+
if (!enabled) {
|
|
125
|
+
setIsUserClearedForAccess(true);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!shouldContinue) return;
|
|
129
|
+
var updateInfo = await import_react_native.HotUpdater.checkForUpdate({
|
|
130
|
+
updateStrategy
|
|
131
|
+
});
|
|
132
|
+
if (!updateInfo) {
|
|
133
|
+
setIsUserClearedForAccess(true);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!shouldContinue) return;
|
|
137
|
+
if (updateInfo.status === "ROLLBACK") {
|
|
138
|
+
var preReleaseBundleId = getPreReleaseBundleId();
|
|
139
|
+
var currentBundleId = import_react_native.HotUpdater.getBundleId();
|
|
140
|
+
if (preReleaseBundleId && preReleaseBundleId === currentBundleId && currentBundleId > updateInfo.id) {
|
|
141
|
+
import_react_native2.Alert.alert("Update Skipped", "Skipped rollback because you are using a newer pre-release bundle.");
|
|
142
|
+
setIsUserClearedForAccess(true);
|
|
106
143
|
return;
|
|
107
144
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
145
|
+
}
|
|
146
|
+
if (!updateInfo.shouldForceUpdate) {
|
|
147
|
+
setIsUserClearedForAccess(true);
|
|
148
|
+
}
|
|
149
|
+
if (!shouldContinue) return;
|
|
150
|
+
await updateInfo.updateBundle();
|
|
151
|
+
handleUpdateDownloaded(updateInfo.id);
|
|
152
|
+
var info = {
|
|
153
|
+
id: updateInfo.id,
|
|
154
|
+
isCriticalUpdate: updateInfo.shouldForceUpdate,
|
|
155
|
+
fileUrl: updateInfo.fileUrl,
|
|
156
|
+
message: updateInfo.message
|
|
157
|
+
};
|
|
158
|
+
onUpdateDownloadedCallback === null || onUpdateDownloadedCallback === void 0 ? void 0 : onUpdateDownloadedCallback(info);
|
|
159
|
+
if (!shouldContinue) return;
|
|
160
|
+
if (updateInfo.shouldForceUpdate) {
|
|
161
|
+
if (!isUserClearedForAccessRef.current) {
|
|
162
|
+
import_react_native.HotUpdater.reload();
|
|
114
163
|
return;
|
|
115
164
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (updateInfo.shouldForceUpdate || setIsUserClearedForAccess(!0), !shouldContinue) return;
|
|
126
|
-
await updateInfo.updateBundle(), handleUpdateDownloaded(updateInfo.id);
|
|
127
|
-
var info = {
|
|
128
|
-
id: updateInfo.id,
|
|
129
|
-
isCriticalUpdate: updateInfo.shouldForceUpdate,
|
|
130
|
-
fileUrl: updateInfo.fileUrl,
|
|
131
|
-
message: updateInfo.message
|
|
132
|
-
};
|
|
133
|
-
if (onUpdateDownloadedCallback?.(info), !shouldContinue) return;
|
|
134
|
-
if (updateInfo.shouldForceUpdate) {
|
|
135
|
-
if (!isUserClearedForAccessRef.current) {
|
|
136
|
-
import_react_native.HotUpdater.reload();
|
|
137
|
-
return;
|
|
165
|
+
import_react_native2.Alert.alert("Update Downloaded", "An important update has been downloaded. Reload now to apply it?", [{
|
|
166
|
+
text: "Later",
|
|
167
|
+
style: "cancel"
|
|
168
|
+
}, {
|
|
169
|
+
text: "Reload Now",
|
|
170
|
+
onPress: function () {
|
|
171
|
+
return import_react_native.HotUpdater.reload();
|
|
138
172
|
}
|
|
139
|
-
|
|
140
|
-
text: "Later",
|
|
141
|
-
style: "cancel"
|
|
142
|
-
}, {
|
|
143
|
-
text: "Reload Now",
|
|
144
|
-
onPress: function () {
|
|
145
|
-
return import_react_native.HotUpdater.reload();
|
|
146
|
-
}
|
|
147
|
-
}]);
|
|
148
|
-
}
|
|
149
|
-
} catch (error) {
|
|
150
|
-
onError?.(error), setIsUserClearedForAccess(!0);
|
|
151
|
-
} finally {
|
|
152
|
-
isUserClearedForAccessRef.current || setIsUserClearedForAccess(!0);
|
|
173
|
+
}]);
|
|
153
174
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
} catch (error) {
|
|
176
|
+
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
177
|
+
setIsUserClearedForAccess(true);
|
|
178
|
+
} finally {
|
|
179
|
+
if (!isUserClearedForAccessRef.current) {
|
|
180
|
+
setIsUserClearedForAccess(true);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
})();
|
|
184
|
+
return function () {
|
|
185
|
+
shouldContinue = false;
|
|
161
186
|
};
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
}, [enabled, onUpdateDownloadedCallback, onError]);
|
|
188
|
+
return {
|
|
189
|
+
userClearedForAccess: isUserClearedForAccess,
|
|
190
|
+
progress,
|
|
191
|
+
isUpdatePending: getIsUpdatePending()
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
var checkForUpdate = async function () {
|
|
195
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
196
|
+
var {
|
|
197
|
+
channel,
|
|
198
|
+
isPreRelease = false
|
|
199
|
+
} = options;
|
|
200
|
+
var requestHeaders = {};
|
|
201
|
+
if (channel) {
|
|
202
|
+
requestHeaders["X-Channel"] = channel;
|
|
203
|
+
}
|
|
204
|
+
var updateInfo = await import_react_native.HotUpdater.checkForUpdate({
|
|
205
|
+
updateStrategy,
|
|
206
|
+
...(Object.keys(requestHeaders).length > 0 && {
|
|
207
|
+
requestHeaders
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
if (updateInfo) {
|
|
211
|
+
await updateInfo.updateBundle();
|
|
212
|
+
handleUpdateDownloaded(updateInfo.id, {
|
|
178
213
|
isPreRelease
|
|
179
|
-
})
|
|
214
|
+
});
|
|
215
|
+
return {
|
|
180
216
|
id: updateInfo.id,
|
|
181
217
|
isCriticalUpdate: updateInfo.shouldForceUpdate,
|
|
182
218
|
fileUrl: updateInfo.fileUrl,
|
|
183
219
|
message: updateInfo.message
|
|
184
|
-
}
|
|
185
|
-
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
};
|
|
186
224
|
return {
|
|
187
225
|
useOtaUpdater,
|
|
188
226
|
checkForUpdate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createHotUpdater_exports","__export","createHotUpdater","module","exports","import_react_native","require","Application","__toESM","import_react","import_react_native2","INITIAL_OTA_ID","BUNDLE_ID_KEY_PREFIX","PRE_RELEASE_BUNDLE_ID_KEY","config","storage","updateStrategy","isUpdatePending","getAppliedOta","id","HotUpdater","getBundleId","getMinBundleId","getShortOtaId","fullId","slice","getIsUpdatePending","getPreReleaseBundleId","get","handleUpdateDownloaded","options","arguments","length","appVersion","nativeApplicationVersion","set","isPreRelease","delete","useOtaUpdater","enabled","onUpdateDownloaded","onUpdateDownloadedCallback","onError","progress","useHotUpdaterStore","state","isUpdating","isUserClearedForAccess","setIsUserClearedForAccess","useState","isUserClearedForAccessRef","useRef","current","useEffect","timer","setTimeout","clearTimeout","shouldContinue","updateInfo","checkForUpdate","status","preReleaseBundleId","currentBundleId","Alert","alert","shouldForceUpdate","updateBundle","info","isCriticalUpdate","fileUrl","message","reload","text","style","onPress","error","userClearedForAccess","channel","requestHeaders","Object","keys"],"sources":["../../src/createHotUpdater.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createHotUpdater_exports","__export","createHotUpdater","module","exports","import_react_native","require","Application","__toESM","import_react","import_react_native2","INITIAL_OTA_ID","BUNDLE_ID_KEY_PREFIX","PRE_RELEASE_BUNDLE_ID_KEY","config","storage","updateStrategy","isUpdatePending","getAppliedOta","id","HotUpdater","getBundleId","getMinBundleId","getShortOtaId","fullId","slice","getIsUpdatePending","getPreReleaseBundleId","get","handleUpdateDownloaded","options","arguments","length","appVersion","nativeApplicationVersion","set","isPreRelease","delete","useOtaUpdater","enabled","onUpdateDownloaded","onUpdateDownloadedCallback","onError","progress","useHotUpdaterStore","state","isUpdating","isUserClearedForAccess","setIsUserClearedForAccess","useState","isUserClearedForAccessRef","useRef","current","useEffect","timer","setTimeout","clearTimeout","shouldContinue","updateInfo","checkForUpdate","status","preReleaseBundleId","currentBundleId","Alert","alert","shouldForceUpdate","updateBundle","info","isCriticalUpdate","fileUrl","message","reload","text","style","onPress","error","userClearedForAccess","channel","requestHeaders","Object","keys"],"sources":["../../src/createHotUpdater.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA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3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var helpers_exports = {};
|
|
22
24
|
__export(helpers_exports, {
|
|
@@ -28,7 +30,9 @@ var import_react_native = require("@hot-updater/react-native");
|
|
|
28
30
|
const INITIAL_OTA_ID = "00000000-0000-0000-0000-000000000000";
|
|
29
31
|
function getAppliedOta() {
|
|
30
32
|
const id = import_react_native.HotUpdater.getBundleId();
|
|
31
|
-
|
|
33
|
+
if (id === INITIAL_OTA_ID) return null;
|
|
34
|
+
if (id === import_react_native.HotUpdater.getMinBundleId()) return null;
|
|
35
|
+
return id;
|
|
32
36
|
}
|
|
33
37
|
function getShortOtaId() {
|
|
34
38
|
const fullId = getAppliedOta();
|
|
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var helpers_exports = {};
|
|
24
26
|
__export(helpers_exports, {
|
|
@@ -26,11 +28,13 @@ __export(helpers_exports, {
|
|
|
26
28
|
getShortOtaId: () => getShortOtaId
|
|
27
29
|
});
|
|
28
30
|
module.exports = __toCommonJS(helpers_exports);
|
|
29
|
-
var import_react_native = require("@hot-updater/react-native")
|
|
30
|
-
|
|
31
|
+
var import_react_native = require("@hot-updater/react-native");
|
|
32
|
+
var INITIAL_OTA_ID = "00000000-0000-0000-0000-000000000000";
|
|
31
33
|
function getAppliedOta() {
|
|
32
34
|
var id = import_react_native.HotUpdater.getBundleId();
|
|
33
|
-
|
|
35
|
+
if (id === INITIAL_OTA_ID) return null;
|
|
36
|
+
if (id === import_react_native.HotUpdater.getMinBundleId()) return null;
|
|
37
|
+
return id;
|
|
34
38
|
}
|
|
35
39
|
function getShortOtaId() {
|
|
36
40
|
var fullId = getAppliedOta();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","helpers_exports","__export","getAppliedOta","getShortOtaId","module","exports","import_react_native","require","INITIAL_OTA_ID","id","HotUpdater","getBundleId","getMinBundleId","fullId","slice"],"sources":["../../src/helpers.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","helpers_exports","__export","getAppliedOta","getShortOtaId","module","exports","import_react_native","require","INITIAL_OTA_ID","id","HotUpdater","getBundleId","getMinBundleId","fullId","slice"],"sources":["../../src/helpers.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA2B,CAAAK,eAAA;AAE3B,IAAAM,mBAAuB,GAAAC,OAAA;AAMhB,IAAAC,cAAS,yCAA+B;AAC7C,SAAMN,aAAKA,CAAA;EACX,IAAIO,EAAA,GAAAH,mBAAuB,CAAAI,UAAO,CAAAC,WAAA;EAClC,IAAIF,EAAA,KAAOD,cAAA;EACX,IAAAC,EAAA,KAAOH,mBAAA,CAAAI,UAAA,CAAAE,cAAA;EACT,OAAAH,EAAA;AAMO;AACL,SAAMN,aAASA,CAAA;EACf,IAAAU,MAAO,GAAAX,aAAgB;EACzB,OAAAW,MAAA,GAAAA,MAAA,CAAAC,KAAA","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var index_exports = {};
|
|
22
24
|
__export(index_exports, {
|
|
@@ -25,5 +27,5 @@ __export(index_exports, {
|
|
|
25
27
|
useHotUpdaterStore: () => import_react_native.useHotUpdaterStore
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var import_react_native = require("@hot-updater/react-native")
|
|
29
|
-
|
|
30
|
+
var import_react_native = require("@hot-updater/react-native");
|
|
31
|
+
var import_createHotUpdater = require("./createHotUpdater.cjs");
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var index_exports = {};
|
|
24
26
|
__export(index_exports, {
|
|
@@ -27,6 +29,6 @@ __export(index_exports, {
|
|
|
27
29
|
useHotUpdaterStore: () => import_react_native.useHotUpdaterStore
|
|
28
30
|
});
|
|
29
31
|
module.exports = __toCommonJS(index_exports);
|
|
30
|
-
var import_react_native = require("@hot-updater/react-native")
|
|
31
|
-
|
|
32
|
+
var import_react_native = require("@hot-updater/react-native");
|
|
33
|
+
var import_createHotUpdater = require("./createHotUpdater.native.js");
|
|
32
34
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","HotUpdater","import_react_native","createHotUpdater","import_createHotUpdater","useHotUpdaterStore","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","HotUpdater","import_react_native","createHotUpdater","import_createHotUpdater","useHotUpdaterStore","module","exports","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAC,mBAAA,CAAAD,UAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAC,uBAAA,CAAAD,gBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAH,mBAAA,CAAAG;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAb,YAA+C,CAAAK,aAAA;AAG/C,IAAAG,mBAAA,GAAAM,OAAiC","ignoreList":[]}
|