react-native-update-cli 2.14.1 → 2.15.0
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/lib/diff.js +12 -1
- package/package.json +1 -1
- package/src/api.ts +1 -2
- package/src/diff.ts +12 -1
- package/src/locales/en.ts +2 -1
- package/src/locales/zh.ts +2 -1
package/lib/diff.js
CHANGED
|
@@ -210,6 +210,12 @@ async function diffFromPackage(origin, next, output, diffFn, originBundleName, t
|
|
|
210
210
|
const originEntries = {};
|
|
211
211
|
const originMap = {};
|
|
212
212
|
let originSource;
|
|
213
|
+
// Content checksum (CRC32) for entries that are copied from a *different*
|
|
214
|
+
// path in the origin package ("moved" entries). On Android these are the
|
|
215
|
+
// res/ drawables (images), whose on-device path differs between an APK
|
|
216
|
+
// baseline and an AAB(split-apk) install due to resource path shortening,
|
|
217
|
+
// so the client cannot locate them by path and must fall back to content.
|
|
218
|
+
const copiesCrc = {};
|
|
213
219
|
await (0, _zipentries.enumZipEntries)(origin, async (entry, zipFile)=>{
|
|
214
220
|
if (!/\/$/.test(entry.fileName)) {
|
|
215
221
|
const fn = transformPackagePath(entry.fileName);
|
|
@@ -257,6 +263,10 @@ async function diffFromPackage(origin, next, output, diffFn, originBundleName, t
|
|
|
257
263
|
const movedFrom = originMap[entry.crc32];
|
|
258
264
|
if (movedFrom) {
|
|
259
265
|
copies[entry.fileName] = movedFrom;
|
|
266
|
+
// Record the content checksum so the client can locate this file by
|
|
267
|
+
// content when the origin path does not exist verbatim on device
|
|
268
|
+
// (APK baseline -> AAB install path shortening).
|
|
269
|
+
copiesCrc[entry.fileName] = entry.crc32;
|
|
260
270
|
return;
|
|
261
271
|
}
|
|
262
272
|
const entryPrefix = await (0, _zipentries.readEntryPrefix)(entry, nextZipfile, _zipoptions.ZIP_ENTRY_SNIFF_BYTES);
|
|
@@ -278,7 +288,8 @@ async function diffFromPackage(origin, next, output, diffFn, originBundleName, t
|
|
|
278
288
|
}
|
|
279
289
|
});
|
|
280
290
|
const diffManifest = Buffer.from(JSON.stringify({
|
|
281
|
-
copies
|
|
291
|
+
copies,
|
|
292
|
+
copiesCrc
|
|
282
293
|
}));
|
|
283
294
|
zipfile.addBuffer(diffManifest, '__diff.json', (0, _zipoptions.zipOptionsForManifestEntry)(diffManifest.length));
|
|
284
295
|
zipfile.end();
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -262,8 +262,7 @@ export async function uploadFile(fn: string, key?: string) {
|
|
|
262
262
|
});
|
|
263
263
|
} catch (error) {
|
|
264
264
|
if (isProxyRelatedError(error)) {
|
|
265
|
-
const rawMessage =
|
|
266
|
-
error instanceof Error ? error.message : String(error);
|
|
265
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
267
266
|
throw new Error(
|
|
268
267
|
`${rawMessage}\n\n${t('proxyNetworkError')}\n${t('proxyNetworkErrorTips')}`,
|
|
269
268
|
);
|
package/src/diff.ts
CHANGED
|
@@ -223,6 +223,13 @@ async function diffFromPackage(
|
|
|
223
223
|
|
|
224
224
|
let originSource: Buffer | undefined;
|
|
225
225
|
|
|
226
|
+
// Content checksum (CRC32) for entries that are copied from a *different*
|
|
227
|
+
// path in the origin package ("moved" entries). On Android these are the
|
|
228
|
+
// res/ drawables (images), whose on-device path differs between an APK
|
|
229
|
+
// baseline and an AAB(split-apk) install due to resource path shortening,
|
|
230
|
+
// so the client cannot locate them by path and must fall back to content.
|
|
231
|
+
const copiesCrc: Record<string, number> = {};
|
|
232
|
+
|
|
226
233
|
await enumZipEntries(origin, async (entry, zipFile) => {
|
|
227
234
|
if (!/\/$/.test(entry.fileName)) {
|
|
228
235
|
const fn = transformPackagePath(entry.fileName);
|
|
@@ -281,6 +288,10 @@ async function diffFromPackage(
|
|
|
281
288
|
const movedFrom = originMap[entry.crc32];
|
|
282
289
|
if (movedFrom) {
|
|
283
290
|
copies[entry.fileName] = movedFrom;
|
|
291
|
+
// Record the content checksum so the client can locate this file by
|
|
292
|
+
// content when the origin path does not exist verbatim on device
|
|
293
|
+
// (APK baseline -> AAB install path shortening).
|
|
294
|
+
copiesCrc[entry.fileName] = entry.crc32;
|
|
284
295
|
return;
|
|
285
296
|
}
|
|
286
297
|
|
|
@@ -313,7 +324,7 @@ async function diffFromPackage(
|
|
|
313
324
|
}
|
|
314
325
|
});
|
|
315
326
|
|
|
316
|
-
const diffManifest = Buffer.from(JSON.stringify({ copies }));
|
|
327
|
+
const diffManifest = Buffer.from(JSON.stringify({ copies, copiesCrc }));
|
|
317
328
|
zipfile.addBuffer(
|
|
318
329
|
diffManifest,
|
|
319
330
|
'__diff.json',
|
package/src/locales/en.ts
CHANGED
|
@@ -184,5 +184,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
184
184
|
apkExtracted: 'APK extracted to {{output}}',
|
|
185
185
|
proxyNetworkError:
|
|
186
186
|
'Network error — likely caused by a proxy/VPN. Please try disabling your proxy and retry.',
|
|
187
|
-
proxyNetworkErrorTips:
|
|
187
|
+
proxyNetworkErrorTips:
|
|
188
|
+
'Common fixes:\n1. Disable system proxy or VPN\n2. Check HTTP_PROXY / HTTPS_PROXY environment variables\n3. Check proxy settings in .npmrc',
|
|
188
189
|
};
|
package/src/locales/zh.ts
CHANGED
|
@@ -170,5 +170,6 @@ export default {
|
|
|
170
170
|
apkExtracted: 'APK 已提取到 {{output}}',
|
|
171
171
|
proxyNetworkError:
|
|
172
172
|
'网络连接异常,可能是代理/VPN 导致。请尝试关闭代理后重试。',
|
|
173
|
-
proxyNetworkErrorTips:
|
|
173
|
+
proxyNetworkErrorTips:
|
|
174
|
+
'常见解决方法:\n1. 关闭系统代理或 VPN\n2. 检查 HTTP_PROXY / HTTPS_PROXY 环境变量\n3. 检查 .npmrc 中的 proxy 配置',
|
|
174
175
|
};
|