react-native-update-cli 2.22.2 → 2.22.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/lib/utils/hermes-base.js +11 -3
- package/lib/versions.d.ts +8 -0
- package/lib/versions.js +14 -5
- package/package.json +1 -1
- package/src/utils/hermes-base.ts +10 -3
- package/src/versions.ts +11 -4
package/lib/utils/hermes-base.js
CHANGED
|
@@ -555,9 +555,17 @@ function normalizeDisassemblyLine(line, strings) {
|
|
|
555
555
|
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
556
556
|
if (m)
|
|
557
557
|
line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
558
|
-
//
|
|
559
|
-
// the table header hermesc prints for them) moves with instruction widths
|
|
560
|
-
|
|
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
|
+
// The two switch instructions carry that offset in different operands:
|
|
561
|
+
// StringSwitchImm rX, <id>, <jtOffset>, <defaultLabel>, <count>
|
|
562
|
+
// UIntSwitchImm rX, <jtOffset>, <defaultLabel>, <min>, <max>
|
|
563
|
+
// Folding only the first shape let a shifted UIntSwitchImm offset read as a
|
|
564
|
+
// real difference and drop an otherwise good delta build.
|
|
565
|
+
m = /^(\s*StringSwitchImm r\d+, \d+, )\d+(, L\d+, \d+)$/.exec(line);
|
|
566
|
+
if (m)
|
|
567
|
+
line = `${m[1]}<jt>${m[2]}`;
|
|
568
|
+
m = /^(\s*UIntSwitchImm r\d+, )\d+(, L\d+, \d+, \d+)$/.exec(line);
|
|
561
569
|
if (m)
|
|
562
570
|
line = `${m[1]}<jt>${m[2]}`;
|
|
563
571
|
if (/^\s*offset \d+$/.test(line))
|
package/lib/versions.d.ts
CHANGED
|
@@ -34,6 +34,14 @@ export declare const bindVersionToPackages: ({ appId, versionId, pkgs, rollout,
|
|
|
34
34
|
rollout?: number;
|
|
35
35
|
dryRun?: boolean;
|
|
36
36
|
}) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Content identity of the ppk's bundle for the server (bundleHash, HBC version)
|
|
39
|
+
* plus the base used to compile it, and a copy of the bundle in the local
|
|
40
|
+
* cache so it can serve as a future base without a download.
|
|
41
|
+
*/
|
|
42
|
+
declare function describePpkBundle(ppkPath: string, base?: HermesBaseMeta): Promise<Record<string, unknown>>;
|
|
43
|
+
/** Exported for tests: the version/create fields derived from a ppk + base. */
|
|
44
|
+
export declare const describePpkBundleForTests: typeof describePpkBundle;
|
|
37
45
|
export declare const versionCommands: {
|
|
38
46
|
publish: ({ args, options, }: {
|
|
39
47
|
args: string[];
|
package/lib/versions.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.versionCommands = exports.bindVersionToPackages = void 0;
|
|
6
|
+
exports.versionCommands = exports.describePpkBundleForTests = exports.bindVersionToPackages = void 0;
|
|
7
7
|
exports.normalizeDeps = normalizeDeps;
|
|
8
8
|
exports.fetchVersions = fetchVersions;
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -322,23 +322,32 @@ exports.bindVersionToPackages = bindVersionToPackages;
|
|
|
322
322
|
* cache so it can serve as a future base without a download.
|
|
323
323
|
*/
|
|
324
324
|
async function describePpkBundle(ppkPath, base) {
|
|
325
|
+
// Only known values are sent: the server's optional-field parsers treat an
|
|
326
|
+
// explicit JSON null as invalid (that contract broke 2.22.0/2.22.1 publishes
|
|
327
|
+
// with "Expected baseHash string"), and omitting a field is what every
|
|
328
|
+
// server version — strict, tolerant or too old to know the field — accepts.
|
|
325
329
|
const meta = {};
|
|
326
330
|
try {
|
|
327
331
|
const bundle = await (0, hermes_base_1.extractBundleFromArchive)(ppkPath);
|
|
328
332
|
if (bundle) {
|
|
329
333
|
meta.bundleHash = (0, hermes_base_1.sha256Hex)(bundle);
|
|
330
|
-
const hbcVersion = (0, hbcTransform_1.getHbcVersion)(bundle);
|
|
331
|
-
|
|
334
|
+
const hbcVersion = (0, hbcTransform_1.getHbcVersion)(bundle) ?? base?.bytecodeVersion;
|
|
335
|
+
if (hbcVersion != null)
|
|
336
|
+
meta.bytecodeVersion = hbcVersion;
|
|
332
337
|
await (0, hermes_base_1.cachePut)(bundle).catch(() => { });
|
|
333
338
|
}
|
|
334
339
|
}
|
|
335
340
|
catch {
|
|
336
341
|
// best effort: metadata never blocks a publish
|
|
337
342
|
}
|
|
338
|
-
|
|
339
|
-
|
|
343
|
+
if (base?.baseVersionId != null)
|
|
344
|
+
meta.baseVersionId = base.baseVersionId;
|
|
345
|
+
if (base?.baseHash)
|
|
346
|
+
meta.baseHash = base.baseHash;
|
|
340
347
|
return meta;
|
|
341
348
|
}
|
|
349
|
+
/** Exported for tests: the version/create fields derived from a ppk + base. */
|
|
350
|
+
exports.describePpkBundleForTests = describePpkBundle;
|
|
342
351
|
exports.versionCommands = {
|
|
343
352
|
publish: async ({ args, options, }) => {
|
|
344
353
|
const fn = args[0];
|
package/package.json
CHANGED
package/src/utils/hermes-base.ts
CHANGED
|
@@ -643,9 +643,16 @@ export function normalizeDisassemblyLine(
|
|
|
643
643
|
// wider form. Fold the suffix and the column padding that follows it.
|
|
644
644
|
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
645
645
|
if (m) line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
646
|
-
//
|
|
647
|
-
// the table header hermesc prints for them) moves with instruction widths
|
|
648
|
-
|
|
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
|
+
// The two switch instructions carry that offset in different operands:
|
|
649
|
+
// StringSwitchImm rX, <id>, <jtOffset>, <defaultLabel>, <count>
|
|
650
|
+
// UIntSwitchImm rX, <jtOffset>, <defaultLabel>, <min>, <max>
|
|
651
|
+
// Folding only the first shape let a shifted UIntSwitchImm offset read as a
|
|
652
|
+
// real difference and drop an otherwise good delta build.
|
|
653
|
+
m = /^(\s*StringSwitchImm r\d+, \d+, )\d+(, L\d+, \d+)$/.exec(line);
|
|
654
|
+
if (m) line = `${m[1]}<jt>${m[2]}`;
|
|
655
|
+
m = /^(\s*UIntSwitchImm r\d+, )\d+(, L\d+, \d+, \d+)$/.exec(line);
|
|
649
656
|
if (m) line = `${m[1]}<jt>${m[2]}`;
|
|
650
657
|
if (/^\s*offset \d+$/.test(line)) line = line.replace(/\d+$/, '<jt>');
|
|
651
658
|
return line;
|
package/src/versions.ts
CHANGED
|
@@ -468,23 +468,30 @@ async function describePpkBundle(
|
|
|
468
468
|
ppkPath: string,
|
|
469
469
|
base?: HermesBaseMeta,
|
|
470
470
|
): Promise<Record<string, unknown>> {
|
|
471
|
+
// Only known values are sent: the server's optional-field parsers treat an
|
|
472
|
+
// explicit JSON null as invalid (that contract broke 2.22.0/2.22.1 publishes
|
|
473
|
+
// with "Expected baseHash string"), and omitting a field is what every
|
|
474
|
+
// server version — strict, tolerant or too old to know the field — accepts.
|
|
471
475
|
const meta: Record<string, unknown> = {};
|
|
472
476
|
try {
|
|
473
477
|
const bundle = await extractBundleFromArchive(ppkPath);
|
|
474
478
|
if (bundle) {
|
|
475
479
|
meta.bundleHash = sha256Hex(bundle);
|
|
476
|
-
const hbcVersion = getHbcVersion(bundle);
|
|
477
|
-
meta.bytecodeVersion = hbcVersion
|
|
480
|
+
const hbcVersion = getHbcVersion(bundle) ?? base?.bytecodeVersion;
|
|
481
|
+
if (hbcVersion != null) meta.bytecodeVersion = hbcVersion;
|
|
478
482
|
await cachePut(bundle).catch(() => {});
|
|
479
483
|
}
|
|
480
484
|
} catch {
|
|
481
485
|
// best effort: metadata never blocks a publish
|
|
482
486
|
}
|
|
483
|
-
meta.baseVersionId = base
|
|
484
|
-
meta.baseHash = base
|
|
487
|
+
if (base?.baseVersionId != null) meta.baseVersionId = base.baseVersionId;
|
|
488
|
+
if (base?.baseHash) meta.baseHash = base.baseHash;
|
|
485
489
|
return meta;
|
|
486
490
|
}
|
|
487
491
|
|
|
492
|
+
/** Exported for tests: the version/create fields derived from a ppk + base. */
|
|
493
|
+
export const describePpkBundleForTests = describePpkBundle;
|
|
494
|
+
|
|
488
495
|
export const versionCommands = {
|
|
489
496
|
publish: async ({
|
|
490
497
|
args,
|