react-native-update-cli 2.21.1 → 2.21.2

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 CHANGED
@@ -442,11 +442,14 @@ async function diffFromPackage(origin, next, output, diffFn, platform, bundleOpt
442
442
  const originEntries = {};
443
443
  const originMap = {};
444
444
  let originSource;
445
- // Content checksum (CRC32) for entries that are copied from a *different*
446
- // path in the origin package ("moved" entries). On Android these are the
447
- // res/ drawables (images), whose on-device path differs between an APK
448
- // baseline and an AAB(split-apk) install due to resource path shortening,
449
- // so the client cannot locate them by path and must fall back to content.
445
+ // Content checksum (CRC32) for every copied entry, keyed by target path.
446
+ // Two consumers on the client: locating a file by content when its origin
447
+ // path is not present verbatim on device (APK baseline diff applied on an
448
+ // AAB/split-apk install whose res/ paths were shortened), and verifying
449
+ // that a path-matched file still has the expected bytes before copying
450
+ // (BUNDLEHASH_MIGRATION.md §4.2.1 — a rebuilt binary may keep the path but
451
+ // drift the content; mismatch must fall back to full instead of silently
452
+ // installing a wrong resource).
450
453
  const copiesCrc = {};
451
454
  await (0, zip_entries_1.enumZipEntries)(origin, async (entry, zipFile) => {
452
455
  if (!/\/$/.test(entry.fileName)) {
@@ -483,15 +486,13 @@ async function diffFromPackage(origin, next, output, diffFn, platform, bundleOpt
483
486
  // If same file.
484
487
  if (originEntries[entry.fileName] === entry.crc32) {
485
488
  copies[entry.fileName] = '';
489
+ copiesCrc[entry.fileName] = entry.crc32;
486
490
  return;
487
491
  }
488
492
  // If moved from other place
489
493
  const movedFrom = originMap[entry.crc32];
490
494
  if (movedFrom) {
491
495
  copies[entry.fileName] = movedFrom;
492
- // Record the content checksum so the client can locate this file by
493
- // content when the origin path does not exist verbatim on device
494
- // (APK baseline -> AAB install path shortening).
495
496
  copiesCrc[entry.fileName] = entry.crc32;
496
497
  return;
497
498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.21.1",
3
+ "version": "2.21.2",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "lib/exports.js",
6
6
  "types": "lib/exports.d.ts",
package/src/diff.ts CHANGED
@@ -663,11 +663,14 @@ async function diffFromPackage(
663
663
 
664
664
  let originSource: BundleSource | undefined;
665
665
 
666
- // Content checksum (CRC32) for entries that are copied from a *different*
667
- // path in the origin package ("moved" entries). On Android these are the
668
- // res/ drawables (images), whose on-device path differs between an APK
669
- // baseline and an AAB(split-apk) install due to resource path shortening,
670
- // so the client cannot locate them by path and must fall back to content.
666
+ // Content checksum (CRC32) for every copied entry, keyed by target path.
667
+ // Two consumers on the client: locating a file by content when its origin
668
+ // path is not present verbatim on device (APK baseline diff applied on an
669
+ // AAB/split-apk install whose res/ paths were shortened), and verifying
670
+ // that a path-matched file still has the expected bytes before copying
671
+ // (BUNDLEHASH_MIGRATION.md §4.2.1 — a rebuilt binary may keep the path but
672
+ // drift the content; mismatch must fall back to full instead of silently
673
+ // installing a wrong resource).
671
674
  const copiesCrc: Record<string, number> = {};
672
675
 
673
676
  await enumZipEntries(origin, async (entry, zipFile) => {
@@ -723,15 +726,13 @@ async function diffFromPackage(
723
726
  // If same file.
724
727
  if (originEntries[entry.fileName] === entry.crc32) {
725
728
  copies[entry.fileName] = '';
729
+ copiesCrc[entry.fileName] = entry.crc32;
726
730
  return;
727
731
  }
728
732
  // If moved from other place
729
733
  const movedFrom = originMap[entry.crc32];
730
734
  if (movedFrom) {
731
735
  copies[entry.fileName] = movedFrom;
732
- // Record the content checksum so the client can locate this file by
733
- // content when the origin path does not exist verbatim on device
734
- // (APK baseline -> AAB install path shortening).
735
736
  copiesCrc[entry.fileName] = entry.crc32;
736
737
  return;
737
738
  }