react-native-update-cli 2.21.2 → 2.22.1

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.
@@ -97,6 +97,7 @@ declare const _default: {
97
97
  rolloutConfigSet: string;
98
98
  rolloutRangeError: string;
99
99
  runningHermesc: string;
100
+ hermesSourcemapKept: string;
100
101
  sentryReactNativeNotFound: string;
101
102
  sentryCliNotFound: string;
102
103
  sentryReleaseCreated: string;
@@ -155,5 +156,13 @@ declare const _default: {
155
156
  unsupportedPlatformForHermes: string;
156
157
  invalidManifest: string;
157
158
  failedToResolveResource: string;
159
+ hermesBaseNone: string;
160
+ hermesBaseUsing: string;
161
+ hermesBaseDownloading: string;
162
+ hermesBaseCompileFailed: string;
163
+ hermesBaseVerified: string;
164
+ hermesBaseVerifyFailed: string;
165
+ cacheCleaned: string;
166
+ cacheStats: string;
158
167
  };
159
168
  export default _default;
package/lib/locales/zh.js CHANGED
@@ -105,6 +105,7 @@ exports.default = {
105
105
  rolloutConfigSet: '已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更包 {{version}}',
106
106
  rolloutRangeError: 'rollout 必须是 1-100 的整数',
107
107
  runningHermesc: '运行 hermesc:{{- command}} {{- args}}',
108
+ hermesSourcemapKept: '字节码已剥离 debug info(与 RN release 构建一致);Hermes sourcemap 保留在 {{- file}},可用于事后符号化崩溃堆栈。',
108
109
  sentryReactNativeNotFound: '无法找到 @sentry/react-native,请确保已正确安装',
109
110
  sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
110
111
  sentryReleaseCreated: '已为版本 {{version}} 创建 Sentry release',
@@ -163,4 +164,12 @@ exports.default = {
163
164
  unsupportedPlatformForHermes: 'Hermes 不支持当前系统平台:{{platform}}',
164
165
  invalidManifest: '无效的 manifest',
165
166
  failedToResolveResource: '资源解析失败:{{error}}',
167
+ hermesBaseNone: 'Hermes base:未使用({{- reason}}),按普通方式编译',
168
+ hermesBaseUsing: 'Hermes base:{{- source}}(HBC v{{version}})',
169
+ hermesBaseDownloading: 'Hermes base:下载 {{- url}}',
170
+ hermesBaseCompileFailed: 'Hermes base 编译失败({{- reason}}),改为不带 -base-bytecode 重编',
171
+ hermesBaseVerified: 'Hermes base:字节码与普通编译等价,校验通过',
172
+ hermesBaseVerifyFailed: 'Hermes base:字节码与普通编译不等价,放弃 base 重新编译',
173
+ cacheCleaned: '已清理 {{count}} 个缓存 bundle',
174
+ cacheStats: 'bundle 缓存:{{- dir}} — {{files}} 个文件,{{mb}} MB',
166
175
  };
package/lib/package.js CHANGED
@@ -51,6 +51,7 @@ const utils_1 = require("./utils");
51
51
  const aab_1 = require("./utils/app-info-parser/aab");
52
52
  const dep_versions_1 = require("./utils/dep-versions");
53
53
  const git_1 = require("./utils/git");
54
+ const hermes_base_1 = require("./utils/hermes-base");
54
55
  const i18n_1 = require("./utils/i18n");
55
56
  const options_1 = require("./utils/options");
56
57
  function normalizeUploadBuildTime(value) {
@@ -94,6 +95,7 @@ function getVersionBinding(version) {
94
95
  async function uploadNativePackage(filePath, options, config) {
95
96
  const info = await config.getInfo(filePath);
96
97
  const { versionName: extractedVersionName, buildTime, bundleHash } = info;
98
+ const bundleFile = info.bundleFile;
97
99
  const { appId: appIdInPkg, appKey: appKeyInPkg } = info;
98
100
  const selectedApp = options.appId
99
101
  ? {
@@ -120,6 +122,11 @@ async function uploadNativePackage(filePath, options, config) {
120
122
  try {
121
123
  await (0, native_package_1.createSlimNativePackage)(filePath, slimPackagePath, config.platform);
122
124
  const { hash } = await (0, api_1.uploadFile)(slimPackagePath, undefined, appId);
125
+ if (bundleFile) {
126
+ // keep the embedded bundle locally so a later `bundle` can use it as
127
+ // hermes base without downloading it back (see hermes-base.ts)
128
+ await (0, hermes_base_1.cachePut)(bundleFile).catch(() => { });
129
+ }
123
130
  const normalizedBuildTime = config.normalizeBuildTime
124
131
  ? config.normalizeBuildTime(buildTime)
125
132
  : buildTime;
package/lib/provider.js CHANGED
@@ -89,6 +89,8 @@ class CLIProviderImpl {
89
89
  expo: options.expo || false,
90
90
  rncli: options.rncli || false,
91
91
  hermes: options.hermes || false,
92
+ hermesBase: options.hermesBase || 'auto',
93
+ verifyHermesBase: options.verifyHermesBase ?? true,
92
94
  sentryRelease: options.sentryRelease,
93
95
  sentryDist: options.sentryDist,
94
96
  });
package/lib/types.d.ts CHANGED
@@ -47,6 +47,10 @@ export interface BundleOptions {
47
47
  expo?: boolean;
48
48
  rncli?: boolean;
49
49
  hermes?: boolean;
50
+ /** 'auto' (default) | 'none' | path to a .hbc/.ppk/.apk/.ipa used as hermesc -base-bytecode */
51
+ hermesBase?: string;
52
+ /** run the disassembly equivalence check after a base compile (default true) */
53
+ verifyHermesBase?: boolean;
50
54
  sentryRelease?: string;
51
55
  sentryDist?: string;
52
56
  }
@@ -0,0 +1,109 @@
1
+ export type HermesBaseOption = 'auto' | 'none' | string;
2
+ export interface HermesBaseSelection {
3
+ /** path of the bundle (HBC) handed to hermesc as -base-bytecode */
4
+ path: string;
5
+ bytecodeVersion: number;
6
+ bundleHash: string;
7
+ /** server version id when the base came from the server */
8
+ versionId?: number;
9
+ /** server object key of the base ppk when known */
10
+ hash?: string;
11
+ source: 'cache' | 'download' | 'local' | 'latest-version';
12
+ }
13
+ /** Metadata attached to version/create so the server can track the chain. */
14
+ export interface HermesBaseMeta {
15
+ bytecodeVersion: number | null;
16
+ baseVersionId: number | null;
17
+ baseHash: string | null;
18
+ }
19
+ /**
20
+ * Hermes V1 (static_h) builds before 2025-07-11 carried a delta-mode bug when a
21
+ * delta-produced base is reused; every released `hermes-compiler` is newer, and
22
+ * classic hermesc (HBC ≤96, react-native/sdks or hermes-engine) upgrades kinds
23
+ * in place and was never affected. Anything else is refused.
24
+ */
25
+ export declare const MIN_HERMES_COMPILER_BUILD = 250829098;
26
+ export declare const MIN_HERMES_COMPILER_COMMITLY_DATE = 20250901;
27
+ export declare function classifyHermesCommand(hermesCommand: string): {
28
+ allowed: boolean;
29
+ kind: 'classic' | 'hermes-compiler' | 'unknown';
30
+ version?: string;
31
+ reason?: string;
32
+ };
33
+ export declare function sha256Hex(data: Buffer): string;
34
+ /** Compile an empty file to learn which HBC version this hermesc emits. */
35
+ export declare function probeHbcVersion(hermesCommand: string): number | null;
36
+ export declare const BUNDLE_ENTRY_NAMES: string[];
37
+ /**
38
+ * Extract the JS/HBC bundle from a local artifact: a raw bundle file, a ppk,
39
+ * or a native package (apk / ipa / harmony app). Returns null when not found.
40
+ */
41
+ export declare function extractBundleFromArchive(filePath: string): Promise<Buffer | null>;
42
+ export declare const DEFAULT_CACHE_MAX_BYTES: number;
43
+ export declare const DEFAULT_CACHE_MAX_FILES = 20;
44
+ export declare function cacheDir(): string;
45
+ export declare function tmpDir(): string;
46
+ export declare function cacheLimits(overrideMaxMb?: number): {
47
+ maxBytes: number;
48
+ maxFiles: number;
49
+ };
50
+ /** Returns the cached bundle path when present and its sha256 still matches. */
51
+ export declare function cacheLookup(bundleHash: string): Promise<string | null>;
52
+ /** Store a bundle under its sha256 (LRU-evicting to the configured limits). */
53
+ export declare function cachePut(bundle: Buffer, maxMb?: number): Promise<{
54
+ path: string;
55
+ bundleHash: string;
56
+ }>;
57
+ export declare function enforceCacheLimits(maxMb?: number, keep?: string): Promise<void>;
58
+ export declare function cleanCache(): Promise<number>;
59
+ export declare function cacheStats(): Promise<{
60
+ dir: string;
61
+ files: number;
62
+ bytes: number;
63
+ }>;
64
+ /** Remove leftovers of interrupted runs (older than 24h) from the tmp dir. */
65
+ export declare function cleanStaleTmp(maxAgeMs?: number): Promise<void>;
66
+ export declare function downloadToFile(url: string, destination: string): Promise<void>;
67
+ export interface HermesBaseServerRecord {
68
+ versionId: number;
69
+ hash: string;
70
+ bundleHash?: string | null;
71
+ bytecodeVersion?: number | null;
72
+ url: string;
73
+ }
74
+ export interface ResolveHermesBaseParams {
75
+ option: HermesBaseOption;
76
+ hermesCommand: string;
77
+ bytecodeVersion: number;
78
+ appId?: string;
79
+ cacheMaxMb?: number;
80
+ /**
81
+ * server lookup; returns null when the app has no usable base. The server
82
+ * itself falls back to the newest version when the epoch is still unknown
83
+ * (its bytecodeVersion is then null and verified here after download).
84
+ */
85
+ fetchBase: (appId: string, bytecodeVersion: number) => Promise<HermesBaseServerRecord | null>;
86
+ log?: (message: string) => void;
87
+ }
88
+ /**
89
+ * Pick and materialize the base bundle for this compile. Returns null (with
90
+ * the reason logged) whenever a base cannot be used; callers then compile
91
+ * without one.
92
+ */
93
+ export declare function resolveHermesBase(params: ResolveHermesBaseParams): Promise<HermesBaseSelection | null>;
94
+ export declare function hermescArgsWithBase(baseArgs: string[], basePath: string | null): string[];
95
+ export declare function hermesBaseMeta(selection: HermesBaseSelection | null, bytecodeVersion: number | null): HermesBaseMeta;
96
+ /**
97
+ * Normalize one disassembly line so that a delta-mode compile and a plain
98
+ * compile of the same source compare equal: string IDs are renumbered, literal
99
+ * buffers are laid out differently (offsets, short/long variants), and jump
100
+ * distances follow instruction widths. Everything else must match exactly.
101
+ */
102
+ export declare function normalizeDisassemblyLine(line: string, strings: Map<number, string>): string | null;
103
+ /**
104
+ * Compare two HBC files by disassembly (see normalizeDisassemblyLine). `-b`
105
+ * forces hermesc to treat inputs as bytecode whatever their extension. Both
106
+ * hermesc dumps are consumed as streams so the ~100 MB of text never touches
107
+ * the disk. Resolves true when equivalent.
108
+ */
109
+ export declare function verifyHermesBaseEquivalence(hermesCommand: string, withBase: string, plain: string): Promise<boolean>;