react-native-update-cli 2.22.0 → 2.22.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/utils/hermes-base.d.ts +6 -5
- package/lib/utils/hermes-base.js +31 -7
- package/package.json +1 -1
- package/src/utils/hermes-base.ts +37 -12
|
@@ -6,9 +6,9 @@ export interface HermesBaseSelection {
|
|
|
6
6
|
bundleHash: string;
|
|
7
7
|
/** server version id when the base came from the server */
|
|
8
8
|
versionId?: number;
|
|
9
|
-
/** server object key of the base
|
|
9
|
+
/** server object key of the base artifact when known */
|
|
10
10
|
hash?: string;
|
|
11
|
-
source: 'cache' | 'download' | 'local' | 'latest-version';
|
|
11
|
+
source: 'cache' | 'download' | 'local' | 'latest-version' | 'native-package';
|
|
12
12
|
}
|
|
13
13
|
/** Metadata attached to version/create so the server can track the chain. */
|
|
14
14
|
export interface HermesBaseMeta {
|
|
@@ -65,8 +65,9 @@ export declare function cacheStats(): Promise<{
|
|
|
65
65
|
export declare function cleanStaleTmp(maxAgeMs?: number): Promise<void>;
|
|
66
66
|
export declare function downloadToFile(url: string, destination: string): Promise<void>;
|
|
67
67
|
export interface HermesBaseServerRecord {
|
|
68
|
-
versionId
|
|
68
|
+
versionId?: number | null;
|
|
69
69
|
hash: string;
|
|
70
|
+
artifactType?: 'ppk' | 'apk' | 'ipa' | 'app';
|
|
70
71
|
bundleHash?: string | null;
|
|
71
72
|
bytecodeVersion?: number | null;
|
|
72
73
|
url: string;
|
|
@@ -79,8 +80,8 @@ export interface ResolveHermesBaseParams {
|
|
|
79
80
|
cacheMaxMb?: number;
|
|
80
81
|
/**
|
|
81
82
|
* server lookup; returns null when the app has no usable base. The server
|
|
82
|
-
* itself falls back to the newest version
|
|
83
|
-
* (
|
|
83
|
+
* itself falls back to the newest legacy version, then the newest native
|
|
84
|
+
* package (bytecodeVersion is null and verified here after download).
|
|
84
85
|
*/
|
|
85
86
|
fetchBase: (appId: string, bytecodeVersion: number) => Promise<HermesBaseServerRecord | null>;
|
|
86
87
|
log?: (message: string) => void;
|
package/lib/utils/hermes-base.js
CHANGED
|
@@ -424,7 +424,11 @@ async function resolveHermesBase(params) {
|
|
|
424
424
|
}));
|
|
425
425
|
return null;
|
|
426
426
|
}
|
|
427
|
-
const source = record?.
|
|
427
|
+
const source = record?.artifactType && record.artifactType !== 'ppk'
|
|
428
|
+
? 'native-package'
|
|
429
|
+
: record?.bytecodeVersion == null
|
|
430
|
+
? 'latest-version'
|
|
431
|
+
: 'download';
|
|
428
432
|
if (!record) {
|
|
429
433
|
log((0, i18n_1.t)('hermesBaseNone', { reason: 'no published version yet' }));
|
|
430
434
|
return null;
|
|
@@ -441,14 +445,14 @@ async function resolveHermesBase(params) {
|
|
|
441
445
|
const hit = await cacheLookup(record.bundleHash);
|
|
442
446
|
if (hit) {
|
|
443
447
|
log((0, i18n_1.t)('hermesBaseUsing', {
|
|
444
|
-
source: `cache ${record.bundleHash.slice(0, 12)} (version ${record.versionId})`,
|
|
448
|
+
source: `cache ${record.bundleHash.slice(0, 12)}${record.versionId == null ? '' : ` (version ${record.versionId})`}`,
|
|
445
449
|
version: bytecodeVersion,
|
|
446
450
|
}));
|
|
447
451
|
return {
|
|
448
452
|
path: hit,
|
|
449
453
|
bytecodeVersion,
|
|
450
454
|
bundleHash: record.bundleHash,
|
|
451
|
-
versionId: record.versionId,
|
|
455
|
+
versionId: record.versionId ?? undefined,
|
|
452
456
|
hash: record.hash,
|
|
453
457
|
source: 'cache',
|
|
454
458
|
};
|
|
@@ -458,7 +462,10 @@ async function resolveHermesBase(params) {
|
|
|
458
462
|
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
459
463
|
const dir = tmpDir();
|
|
460
464
|
await fs_extra_1.default.ensureDir(dir);
|
|
461
|
-
const
|
|
465
|
+
const artifactType = ['ppk', 'apk', 'ipa', 'app'].includes(record.artifactType ?? '')
|
|
466
|
+
? record.artifactType
|
|
467
|
+
: 'ppk';
|
|
468
|
+
const archive = path_1.default.join(dir, `base-${process.pid}-${Date.now()}-${attempt}.${artifactType}`);
|
|
462
469
|
try {
|
|
463
470
|
log((0, i18n_1.t)('hermesBaseDownloading', { url: record.url }));
|
|
464
471
|
await downloadToFile(record.url, archive);
|
|
@@ -478,14 +485,16 @@ async function resolveHermesBase(params) {
|
|
|
478
485
|
}
|
|
479
486
|
const cached = await cachePut(bundle, params.cacheMaxMb);
|
|
480
487
|
log((0, i18n_1.t)('hermesBaseUsing', {
|
|
481
|
-
source:
|
|
488
|
+
source: record.versionId == null
|
|
489
|
+
? `native package ${record.hash.slice(0, 8)}`
|
|
490
|
+
: `version ${record.versionId} ${record.hash.slice(0, 8)}`,
|
|
482
491
|
version: bytecodeVersion,
|
|
483
492
|
}));
|
|
484
493
|
return {
|
|
485
494
|
path: cached.path,
|
|
486
495
|
bytecodeVersion,
|
|
487
496
|
bundleHash: cached.bundleHash,
|
|
488
|
-
versionId: record.versionId,
|
|
497
|
+
versionId: record.versionId ?? undefined,
|
|
489
498
|
hash: record.hash,
|
|
490
499
|
source,
|
|
491
500
|
};
|
|
@@ -537,7 +546,22 @@ function normalizeDisassemblyLine(line, strings) {
|
|
|
537
546
|
return `${m[1]} <tgt>${m[4]}`;
|
|
538
547
|
m = /^(\s*DefineOwnById\w*\s+r\d+, r\d+, \d+, )(\d+)$/.exec(line);
|
|
539
548
|
if (m)
|
|
540
|
-
|
|
549
|
+
line = `${m[1]}"${strings.get(Number(m[2])) ?? `?${m[2]}`}"`;
|
|
550
|
+
// Operand-width variants of one instruction (GetByIdShort/GetById/GetByIdLong,
|
|
551
|
+
// LoadConstString/LoadConstStringLongIndex, ...) only differ by how wide a
|
|
552
|
+
// string/function id or offset is encoded — a foreign base hands the new
|
|
553
|
+
// code's hot strings large ids, so the delta build legitimately picks the
|
|
554
|
+
// wider form. Fold the suffix and the column padding that follows it.
|
|
555
|
+
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
556
|
+
if (m)
|
|
557
|
+
line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
558
|
+
// switch jump tables sit after the instructions; their relative offset (and
|
|
559
|
+
// the table header hermesc prints for them) moves with instruction widths
|
|
560
|
+
m = /^(\s*(?:String|UInt)?SwitchImm r\d+, \d+, )\d+(, .*)$/.exec(line);
|
|
561
|
+
if (m)
|
|
562
|
+
line = `${m[1]}<jt>${m[2]}`;
|
|
563
|
+
if (/^\s*offset \d+$/.test(line))
|
|
564
|
+
line = line.replace(/\d+$/, '<jt>');
|
|
541
565
|
return line;
|
|
542
566
|
}
|
|
543
567
|
/** Split a readable stream into lines without readline (Bun's readline async iterator misbehaves when pulled manually). */
|
package/package.json
CHANGED
package/src/utils/hermes-base.ts
CHANGED
|
@@ -28,9 +28,9 @@ export interface HermesBaseSelection {
|
|
|
28
28
|
bundleHash: string;
|
|
29
29
|
/** server version id when the base came from the server */
|
|
30
30
|
versionId?: number;
|
|
31
|
-
/** server object key of the base
|
|
31
|
+
/** server object key of the base artifact when known */
|
|
32
32
|
hash?: string;
|
|
33
|
-
source: 'cache' | 'download' | 'local' | 'latest-version';
|
|
33
|
+
source: 'cache' | 'download' | 'local' | 'latest-version' | 'native-package';
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** Metadata attached to version/create so the server can track the chain. */
|
|
@@ -397,8 +397,9 @@ export async function downloadToFile(
|
|
|
397
397
|
// ---------------------------------------------------------------------------
|
|
398
398
|
|
|
399
399
|
export interface HermesBaseServerRecord {
|
|
400
|
-
versionId
|
|
400
|
+
versionId?: number | null;
|
|
401
401
|
hash: string;
|
|
402
|
+
artifactType?: 'ppk' | 'apk' | 'ipa' | 'app';
|
|
402
403
|
bundleHash?: string | null;
|
|
403
404
|
bytecodeVersion?: number | null;
|
|
404
405
|
url: string;
|
|
@@ -412,8 +413,8 @@ export interface ResolveHermesBaseParams {
|
|
|
412
413
|
cacheMaxMb?: number;
|
|
413
414
|
/**
|
|
414
415
|
* server lookup; returns null when the app has no usable base. The server
|
|
415
|
-
* itself falls back to the newest version
|
|
416
|
-
* (
|
|
416
|
+
* itself falls back to the newest legacy version, then the newest native
|
|
417
|
+
* package (bytecodeVersion is null and verified here after download).
|
|
417
418
|
*/
|
|
418
419
|
fetchBase: (
|
|
419
420
|
appId: string,
|
|
@@ -480,7 +481,11 @@ export async function resolveHermesBase(
|
|
|
480
481
|
return null;
|
|
481
482
|
}
|
|
482
483
|
const source: HermesBaseSelection['source'] =
|
|
483
|
-
record?.
|
|
484
|
+
record?.artifactType && record.artifactType !== 'ppk'
|
|
485
|
+
? 'native-package'
|
|
486
|
+
: record?.bytecodeVersion == null
|
|
487
|
+
? 'latest-version'
|
|
488
|
+
: 'download';
|
|
484
489
|
if (!record) {
|
|
485
490
|
log(t('hermesBaseNone', { reason: 'no published version yet' }));
|
|
486
491
|
return null;
|
|
@@ -502,7 +507,7 @@ export async function resolveHermesBase(
|
|
|
502
507
|
if (hit) {
|
|
503
508
|
log(
|
|
504
509
|
t('hermesBaseUsing', {
|
|
505
|
-
source: `cache ${record.bundleHash.slice(0, 12)} (version ${record.versionId})`,
|
|
510
|
+
source: `cache ${record.bundleHash.slice(0, 12)}${record.versionId == null ? '' : ` (version ${record.versionId})`}`,
|
|
506
511
|
version: bytecodeVersion,
|
|
507
512
|
}),
|
|
508
513
|
);
|
|
@@ -510,7 +515,7 @@ export async function resolveHermesBase(
|
|
|
510
515
|
path: hit,
|
|
511
516
|
bytecodeVersion,
|
|
512
517
|
bundleHash: record.bundleHash,
|
|
513
|
-
versionId: record.versionId,
|
|
518
|
+
versionId: record.versionId ?? undefined,
|
|
514
519
|
hash: record.hash,
|
|
515
520
|
source: 'cache',
|
|
516
521
|
};
|
|
@@ -520,9 +525,14 @@ export async function resolveHermesBase(
|
|
|
520
525
|
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
521
526
|
const dir = tmpDir();
|
|
522
527
|
await fs.ensureDir(dir);
|
|
528
|
+
const artifactType = ['ppk', 'apk', 'ipa', 'app'].includes(
|
|
529
|
+
record.artifactType ?? '',
|
|
530
|
+
)
|
|
531
|
+
? record.artifactType
|
|
532
|
+
: 'ppk';
|
|
523
533
|
const archive = path.join(
|
|
524
534
|
dir,
|
|
525
|
-
`base-${process.pid}-${Date.now()}-${attempt}
|
|
535
|
+
`base-${process.pid}-${Date.now()}-${attempt}.${artifactType}`,
|
|
526
536
|
);
|
|
527
537
|
try {
|
|
528
538
|
log(t('hermesBaseDownloading', { url: record.url }));
|
|
@@ -548,7 +558,10 @@ export async function resolveHermesBase(
|
|
|
548
558
|
const cached = await cachePut(bundle, params.cacheMaxMb);
|
|
549
559
|
log(
|
|
550
560
|
t('hermesBaseUsing', {
|
|
551
|
-
source:
|
|
561
|
+
source:
|
|
562
|
+
record.versionId == null
|
|
563
|
+
? `native package ${record.hash.slice(0, 8)}`
|
|
564
|
+
: `version ${record.versionId} ${record.hash.slice(0, 8)}`,
|
|
552
565
|
version: bytecodeVersion,
|
|
553
566
|
}),
|
|
554
567
|
);
|
|
@@ -556,7 +569,7 @@ export async function resolveHermesBase(
|
|
|
556
569
|
path: cached.path,
|
|
557
570
|
bytecodeVersion,
|
|
558
571
|
bundleHash: cached.bundleHash,
|
|
559
|
-
versionId: record.versionId,
|
|
572
|
+
versionId: record.versionId ?? undefined,
|
|
560
573
|
hash: record.hash,
|
|
561
574
|
source,
|
|
562
575
|
};
|
|
@@ -622,7 +635,19 @@ export function normalizeDisassemblyLine(
|
|
|
622
635
|
m = /^(\s*J[A-Za-z]+?)(Long)?\s+(L\d+|\d+)(.*)$/.exec(line);
|
|
623
636
|
if (m) return `${m[1]} <tgt>${m[4]}`;
|
|
624
637
|
m = /^(\s*DefineOwnById\w*\s+r\d+, r\d+, \d+, )(\d+)$/.exec(line);
|
|
625
|
-
if (m)
|
|
638
|
+
if (m) line = `${m[1]}"${strings.get(Number(m[2])) ?? `?${m[2]}`}"`;
|
|
639
|
+
// Operand-width variants of one instruction (GetByIdShort/GetById/GetByIdLong,
|
|
640
|
+
// LoadConstString/LoadConstStringLongIndex, ...) only differ by how wide a
|
|
641
|
+
// string/function id or offset is encoded — a foreign base hands the new
|
|
642
|
+
// code's hot strings large ids, so the delta build legitimately picks the
|
|
643
|
+
// wider form. Fold the suffix and the column padding that follows it.
|
|
644
|
+
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
645
|
+
if (m) line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
646
|
+
// switch jump tables sit after the instructions; their relative offset (and
|
|
647
|
+
// the table header hermesc prints for them) moves with instruction widths
|
|
648
|
+
m = /^(\s*(?:String|UInt)?SwitchImm r\d+, \d+, )\d+(, .*)$/.exec(line);
|
|
649
|
+
if (m) line = `${m[1]}<jt>${m[2]}`;
|
|
650
|
+
if (/^\s*offset \d+$/.test(line)) line = line.replace(/\d+$/, '<jt>');
|
|
626
651
|
return line;
|
|
627
652
|
}
|
|
628
653
|
|