react-native-update-cli 2.22.2 → 2.22.3

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/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
- meta.bytecodeVersion = hbcVersion ?? base?.bytecodeVersion ?? null;
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
- meta.baseVersionId = base?.baseVersionId ?? null;
339
- meta.baseHash = base?.baseHash ?? null;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.22.2",
3
+ "version": "2.22.3",
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/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 ?? base?.bytecodeVersion ?? null;
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?.baseVersionId ?? null;
484
- meta.baseHash = base?.baseHash ?? null;
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,