react-native-update-cli 2.28.2 → 2.28.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/package.js CHANGED
@@ -154,6 +154,11 @@ async function uploadNativePackage(filePath, options, config) {
154
154
  // against the client-reported bundleHash to decide pdiff applicability.
155
155
  // Old servers strip unknown fields, so this is forward-compatible.
156
156
  ...(bundleHash ? { bundleHash } : {}),
157
+ // HBC version of the embedded bundle (0 = plain JS), so the server
158
+ // offers this package as hermes base only to a matching compile
159
+ ...(bundleFile
160
+ ? { bytecodeVersion: (0, hermes_base_1.reportedBytecodeVersion)(bundleFile) }
161
+ : {}),
157
162
  ...bundleLocation,
158
163
  deps: (0, dep_versions_1.getDepVersions)(),
159
164
  commit: await (0, git_1.getCommitInfo)(),
@@ -16,6 +16,14 @@ export declare class HbcVersionMismatchError extends PermanentBaseError {
16
16
  readonly expected: number;
17
17
  constructor(version: number | null, expected: number);
18
18
  }
19
+ /**
20
+ * `bytecodeVersion` reported for a bundle that is not Hermes bytecode, so the
21
+ * server can tell "plain JS" from "not reported" (NULL) and never offers it
22
+ * as a base.
23
+ */
24
+ export declare const PLAIN_JS_BYTECODE_VERSION = 0;
25
+ /** the `bytecodeVersion` to report for `bundle` at publish / upload time */
26
+ export declare function reportedBytecodeVersion(bundle: Buffer): number;
19
27
  export interface HermesBaseSelection {
20
28
  /** path of the bundle (HBC) handed to hermesc as -base-bytecode */
21
29
  path: string;
@@ -46,7 +46,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
46
46
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
47
  };
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.LITERAL_SEPARATOR = exports.DEFAULT_CACHE_MAX_FILES = exports.DEFAULT_CACHE_MAX_BYTES = exports.BUNDLE_ENTRY_NAMES = exports.MIN_HERMES_COMPILER_COMMITLY_DATE = exports.MIN_HERMES_COMPILER_BUILD = exports.HERMES_BASE_DETAIL_MAX_CHARS = exports.HbcVersionMismatchError = exports.BundleHashMismatchError = exports.PermanentBaseError = void 0;
49
+ exports.LITERAL_SEPARATOR = exports.DEFAULT_CACHE_MAX_FILES = exports.DEFAULT_CACHE_MAX_BYTES = exports.BUNDLE_ENTRY_NAMES = exports.MIN_HERMES_COMPILER_COMMITLY_DATE = exports.MIN_HERMES_COMPILER_BUILD = exports.HERMES_BASE_DETAIL_MAX_CHARS = exports.PLAIN_JS_BYTECODE_VERSION = exports.HbcVersionMismatchError = exports.BundleHashMismatchError = exports.PermanentBaseError = void 0;
50
+ exports.reportedBytecodeVersion = reportedBytecodeVersion;
50
51
  exports.classifyHermesCommand = classifyHermesCommand;
51
52
  exports.sha256Hex = sha256Hex;
52
53
  exports.sha256File = sha256File;
@@ -110,12 +111,25 @@ class HbcVersionMismatchError extends PermanentBaseError {
110
111
  version;
111
112
  expected;
112
113
  constructor(version, expected) {
113
- super(`downloaded base is HBC ${version ?? 'n/a'}, need ${expected}`);
114
+ super(`downloaded base is ${version == null ? 'plain JS' : `HBC ${version}`}, need ${expected}`);
114
115
  this.version = version;
115
116
  this.expected = expected;
116
117
  }
117
118
  }
118
119
  exports.HbcVersionMismatchError = HbcVersionMismatchError;
120
+ /**
121
+ * `bytecodeVersion` reported for a bundle that is not Hermes bytecode, so the
122
+ * server can tell "plain JS" from "not reported" (NULL) and never offers it
123
+ * as a base.
124
+ */
125
+ exports.PLAIN_JS_BYTECODE_VERSION = 0;
126
+ /** the `bytecodeVersion` to report for `bundle` at publish / upload time */
127
+ function reportedBytecodeVersion(bundle) {
128
+ return (0, hbcTransform_1.getHbcVersion)(bundle) ?? exports.PLAIN_JS_BYTECODE_VERSION;
129
+ }
130
+ const describeBytecodeVersion = (version) => version === exports.PLAIN_JS_BYTECODE_VERSION
131
+ ? 'plain JS'
132
+ : `HBC ${version ?? 'n/a'}`;
119
133
  /** bytes `getHbcVersion` needs to read the version */
120
134
  const HBC_HEAD_BYTES = 128;
121
135
  /** time allowed for a response to start (headers) */
@@ -744,7 +758,7 @@ async function resolveHermesBase(params) {
744
758
  if (record.bytecodeVersion != null &&
745
759
  record.bytecodeVersion !== bytecodeVersion) {
746
760
  log((0, i18n_1.t)('hermesBaseNone', {
747
- reason: `server base is HBC ${record.bytecodeVersion}, need ${bytecodeVersion}`,
761
+ reason: `server base is ${describeBytecodeVersion(record.bytecodeVersion)}, need ${bytecodeVersion}`,
748
762
  }));
749
763
  return null;
750
764
  }
package/lib/versions.js CHANGED
@@ -17,7 +17,6 @@ const package_1 = require("./package");
17
17
  const utils_1 = require("./utils");
18
18
  const dep_versions_1 = require("./utils/dep-versions");
19
19
  const git_1 = require("./utils/git");
20
- const hbcTransform_1 = require("./utils/hbcTransform");
21
20
  const hermes_base_1 = require("./utils/hermes-base");
22
21
  const i18n_1 = require("./utils/i18n");
23
22
  const options_1 = require("./utils/options");
@@ -344,9 +343,8 @@ async function describePpkBundle(ppkPath, base) {
344
343
  if (bundle) {
345
344
  const bundleHash = (0, hermes_base_1.sha256Hex)(bundle);
346
345
  meta.bundleHash = bundleHash;
347
- const hbcVersion = (0, hbcTransform_1.getHbcVersion)(bundle) ?? base?.bytecodeVersion;
348
- if (hbcVersion != null)
349
- meta.bytecodeVersion = hbcVersion;
346
+ // 0 for plain JS: the server then never offers it as a Hermes base
347
+ meta.bytecodeVersion = (0, hermes_base_1.reportedBytecodeVersion)(bundle);
350
348
  await (0, hermes_base_1.cachePut)(bundle, undefined, bundleHash).catch(() => { });
351
349
  Object.assign(meta, (0, zip_range_1.bundleLocationFields)(found?.location));
352
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.28.2",
3
+ "version": "2.28.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",