react-native-update-cli 2.22.9 → 2.23.0

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/README.md CHANGED
@@ -68,13 +68,14 @@ const publishResult = await provider.publish({
68
68
  - `hdiffFromApp`: Generate hdiff from APP files
69
69
  - `hdiffFromIpa`: Generate hdiff from IPA files
70
70
 
71
- Hermes projects: `bundle` always runs hermesc with `-output-source-map`, so the debug info section is stripped from the bytecode (15–40% smaller, same as React Native's own release builds). The Hermes sourcemap stays in the intermediate directory (`.pushy/intermedia/<platform>/<bundle>.map`, never packed into the ppk); with `--sourcemap` it is composed with the packager map as before. Keep it if you want to symbolicate `address at` crash stacks later.
71
+ Hermes projects: `bundle` always runs hermesc with `-output-source-map`, so the debug info section is stripped from the bytecode (15–40% smaller, same as React Native's own release builds). The Hermes sourcemap stays in the intermediate directory (`.pushy/intermedia/<platform>/<bundle>.map`, never packed into the ppk) and is composed with the packager map — `--sourcemap` is on by default since 2.23 (`--sourcemap false` opts out). When `bundle` publishes, that final map is uploaded and archived with the version (`sourceMapKey`), so `pushy symbolicate` can map crash stacks — including Hermes `address at` frames — back to source later. `pushy publish <ppk> --sourcemap <file.map>` archives a map for a ppk built elsewhere; publishing without a map prints a warning.
72
72
 
73
73
  Hermes delta mode (`-base-bytecode`): by default (`--hermesBase auto`) `bundle` compiles against the previous HBC of the same app, which keeps Hermes string IDs stable and makes hot-update patches 5–30× smaller. The base comes from the server (`GET /app/:id/hermesBase`), verified by sha256 and kept in a local cache (`.pushy/cache/<sha256>`, 500 MB / 20 files, `PUSHY_CACHE_DIR` / `--cacheMaxMb` to tune, `pushy cache [clean]` to inspect or clear). `--hermesBase none` disables it; `--hermesBase <file.hbc|.ppk|.apk|.ipa>` uses a local artifact (for example the store build). `--verifyHermesBase` (default on) additionally compiles without the base (concurrently with the base compile) and compares both disassemblies; on any mismatch or failure the CLI silently falls back to the plain compile, so the feature can never block a release. Only hermesc builds that include the upstream delta-mode fix are used (classic `react-native/sdks/hermesc`, or `hermes-compiler` ≥ 250829098). If a base compile fails, the full hermesc output is written to `hermes-base-error.log` next to the intermediate directory. `--resetCache false` skips Metro's `--reset-cache` and reuses its transform cache, which makes repeated bundles much faster.
74
74
 
75
75
  ### Version
76
76
 
77
- - `publish`: Publish a new version
77
+ - `publish`: Publish a new version (`--sourcemap <file.map>` archives the source map with it)
78
+ - `symbolicate`: Map a crash stack to source using the archived map: `pushy symbolicate stack.txt --hash <updateHash>` (`-` reads stdin, `--versionId` instead of `--hash`, `--output <file>`); the hash is `getUpdateMetadata().currentVersion` on the device
78
79
  - `versions`: List versions
79
80
  - `update`: Update version package rules
80
81
  - `updateVersionInfo`: Update version metadata
package/README.zh-CN.md CHANGED
@@ -68,13 +68,14 @@ const publishResult = await provider.publish({
68
68
  - `hdiffFromApp`: 基于 APP 文件生成 hdiff
69
69
  - `hdiffFromIpa`: 基于 IPA 文件生成 hdiff
70
70
 
71
- Hermes 工程:`bundle` 调用 hermesc 时始终带 `-output-source-map`,因此字节码不含 debug info 段(小 15%~40%,与 React Native 自身 release 构建一致)。Hermes sourcemap 保留在中间目录(`.pushy/intermedia/<platform>/<bundle>.map`,不会打进 ppk);传 `--sourcemap` 时照旧与 packager map 合成。留着它可以事后符号化 `address at` 形式的崩溃堆栈。
71
+ Hermes 工程:`bundle` 调用 hermesc 时始终带 `-output-source-map`,因此字节码不含 debug info 段(小 15%~40%,与 React Native 自身 release 构建一致)。Hermes sourcemap 保留在中间目录(`.pushy/intermedia/<platform>/<bundle>.map`,不会打进 ppk),并与 packager map 合成——自 2.23 起 `--sourcemap` 默认开启(`--sourcemap false` 关闭)。`bundle` 发布时会把这份最终 map 上传并随版本归档(`sourceMapKey`),之后用 `pushy symbolicate` 即可把崩溃堆栈(含 Hermes 的 `address at` 帧)还原到源码。别处打好的 ppk 可用 `pushy publish <ppk> --sourcemap <file.map>` 归档;不带 map 发布会打印警告。
72
72
 
73
73
  Hermes delta 模式(`-base-bytecode`):默认 `--hermesBase auto`,`bundle` 会以同一应用上一版的 HBC 为 base 编译,让 Hermes 字符串 ID 跨版本稳定,热更 patch 可缩小 5~30 倍。base 由服务端(`GET /app/:id/hermesBase`)给出、按 sha256 校验并存入本地缓存(`.pushy/cache/<sha256>`,默认 500 MB / 20 个,可用 `PUSHY_CACHE_DIR` / `--cacheMaxMb` 调整,`pushy cache [clean]` 查看或清空)。`--hermesBase none` 关闭;`--hermesBase <file.hbc|.ppk|.apk|.ipa>` 指定本地文件(比如商店包)作 base。`--verifyHermesBase`(默认开)会并行再做一次普通编译并比对两份反汇编;任何不一致或失败都静默回退到普通编译,不会阻塞发版。只有包含上游 delta 模式修复的 hermesc 才会启用(经典 `react-native/sdks/hermesc`,或 `hermes-compiler` ≥ 250829098)。base 编译失败时,完整的 hermesc 输出会写到中间目录旁边的 `hermes-base-error.log`。`--resetCache false` 可跳过 Metro 的 `--reset-cache`,复用其转换缓存,重复打包会快很多。
74
74
 
75
75
  ### Version
76
76
 
77
- - `publish`: 发布新版本
77
+ - `publish`: 发布新版本(`--sourcemap <file.map>` 随版本归档 source map)
78
+ - `symbolicate`: 用归档的 map 还原崩溃堆栈:`pushy symbolicate stack.txt --hash <热更 hash>`(`-` 读 stdin,可用 `--versionId` 代替 `--hash`,`--output <文件>` 写文件);hash 即设备上 `getUpdateMetadata().currentVersion`
78
79
  - `versions`: 列出版本
79
80
  - `update`: 更新版本包规则
80
81
  - `updateVersionInfo`: 更新版本元信息
package/cli.json CHANGED
@@ -139,6 +139,9 @@
139
139
  },
140
140
  "dryRun": {
141
141
  "default": false
142
+ },
143
+ "sourcemap": {
144
+ "hasValue": true
142
145
  }
143
146
  }
144
147
  },
@@ -248,7 +251,7 @@
248
251
  "hasValue": true
249
252
  },
250
253
  "sourcemap": {
251
- "default": false
254
+ "default": true
252
255
  },
253
256
  "taro": {
254
257
  "default": false
@@ -382,6 +385,23 @@
382
385
  "cache": {
383
386
  "description": "Inspect or clean the local bundle cache: cache [clean]",
384
387
  "options": {}
388
+ },
389
+ "symbolicate": {
390
+ "description": "Map a JS stack trace back to source using the source map archived with a published version.",
391
+ "options": {
392
+ "hash": {
393
+ "hasValue": true
394
+ },
395
+ "versionId": {
396
+ "hasValue": true
397
+ },
398
+ "platform": {
399
+ "hasValue": true
400
+ },
401
+ "output": {
402
+ "hasValue": true
403
+ }
404
+ }
385
405
  }
386
406
  },
387
407
  "globalOptions": {
package/lib/bin.js CHANGED
@@ -8,6 +8,7 @@ const cache_1 = require("./cache");
8
8
  const diff_1 = require("./diff");
9
9
  const install_1 = require("./install");
10
10
  const package_1 = require("./package");
11
+ const symbolicate_1 = require("./symbolicate");
11
12
  const user_1 = require("./user");
12
13
  const utils_1 = require("./utils");
13
14
  const i18n_1 = require("./utils/i18n");
@@ -38,6 +39,7 @@ const commandHandlers = {
38
39
  ...(0, app_1.getAppCommands)(),
39
40
  ...package_1.packageCommands,
40
41
  ...versions_1.versionCommands,
42
+ ...symbolicate_1.symbolicateCommands,
41
43
  ...install_1.installCommands,
42
44
  help: printUsage,
43
45
  };
package/lib/bundle.js CHANGED
@@ -37,7 +37,9 @@ function normalizeBundleOptions(translatedOptions, platform) {
37
37
  intermediaDir: (0, options_1.getStringOption)(translatedOptions, 'intermediaDir', `${constants_1.tempDir}/intermedia/${platform}`),
38
38
  output: (0, options_1.getStringOption)(translatedOptions, 'output', `${constants_1.tempDir}/output/${platform}.\${time}.ppk`),
39
39
  dev: (0, options_1.getBooleanOption)(translatedOptions, 'dev', false) ? 'true' : 'false',
40
- sourcemap: (0, options_1.getBooleanOption)(translatedOptions, 'sourcemap', false),
40
+ // On by default since 2.23: the map is archived with the published
41
+ // version (pushy symbolicate). --no-sourcemap / --sourcemap=false opts out.
42
+ sourcemap: (0, options_1.getBooleanOption)(translatedOptions, 'sourcemap', true),
41
43
  taro: (0, options_1.getBooleanOption)(translatedOptions, 'taro', false),
42
44
  expo: (0, options_1.getBooleanOption)(translatedOptions, 'expo', false),
43
45
  rncli: (0, options_1.getBooleanOption)(translatedOptions, 'rncli', false),
@@ -149,6 +151,9 @@ exports.bundleCommands = {
149
151
  rollout: normalized.rollout,
150
152
  dryRun: normalized.dryRun,
151
153
  hermesBase: baseMeta,
154
+ sourcemap: normalized.sourcemap || bundleParams.sourcemap
155
+ ? sourcemapOutput
156
+ : undefined,
152
157
  });
153
158
  await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
154
159
  sentryRelease: normalized.sentryRelease,
@@ -161,6 +166,9 @@ exports.bundleCommands = {
161
166
  if (v.toLowerCase() === 'y') {
162
167
  await publishBundleVersion(realOutput, platform, {
163
168
  hermesBase: baseMeta,
169
+ sourcemap: normalized.sourcemap || bundleParams.sourcemap
170
+ ? sourcemapOutput
171
+ : undefined,
164
172
  });
165
173
  await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
166
174
  sentryRelease: normalized.sentryRelease,
@@ -93,6 +93,14 @@ declare const _default: {
93
93
  processingPackage: string;
94
94
  processingStringPool: string;
95
95
  publishUsage: string;
96
+ sourceMapNotFound: string;
97
+ sourceMapMissingWarning: string;
98
+ sourceMapArchived: string;
99
+ sourceMapUploadFailedWarning: string;
100
+ symbolicateUsage: string;
101
+ symbolicateVersionNotFound: string;
102
+ symbolicateNoSourceMap: string;
103
+ symbolicateDone: string;
96
104
  rnuVersionNotFound: string;
97
105
  rolloutConfigSet: string;
98
106
  rolloutRangeError: string;
package/lib/locales/en.js CHANGED
@@ -101,6 +101,14 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
101
101
  processingPackage: 'Processing the package {{count}} ...',
102
102
  processingStringPool: 'Processing the string pool ...',
103
103
  publishUsage: 'Usage: pushy publish <ppk file> --platform ios|android|harmony',
104
+ sourceMapNotFound: 'Source map not found: {{path}}',
105
+ sourceMapMissingWarning: 'No source map was archived with this version: crashes cannot be symbolicated later. Bundle with the default --sourcemap, or pass --sourcemap <file> to publish.',
106
+ sourceMapArchived: 'Source map archived with version {{id}}',
107
+ sourceMapUploadFailedWarning: 'Source map upload failed ({{error}}); publishing without an archived map. Upgrade the update server to archive source maps.',
108
+ symbolicateUsage: 'Usage: pushy symbolicate <stack file | -> --hash <updateHash> [--platform ios|android|harmony] [--output <file>]',
109
+ symbolicateVersionNotFound: 'No published version with hash {{hash}} found for this app',
110
+ symbolicateNoSourceMap: 'Version {{id}} was published without a source map; nothing to symbolicate against',
111
+ symbolicateDone: 'Symbolicated {{count}} frame(s) against version {{id}} ({{hash}})',
104
112
  rnuVersionNotFound: 'react-native-update: Cannot get the version number. Please run the command in the project directory',
105
113
  rolloutConfigSet: 'Set {{rollout}}% rollout for OTA update {{version}} on native version(s) {{versions}}',
106
114
  rolloutRangeError: 'rollout must be an integer between 1-100',
@@ -92,6 +92,14 @@ declare const _default: {
92
92
  processingError: string;
93
93
  processingPackage: string;
94
94
  processingStringPool: string;
95
+ sourceMapNotFound: string;
96
+ sourceMapMissingWarning: string;
97
+ sourceMapArchived: string;
98
+ sourceMapUploadFailedWarning: string;
99
+ symbolicateUsage: string;
100
+ symbolicateVersionNotFound: string;
101
+ symbolicateNoSourceMap: string;
102
+ symbolicateDone: string;
95
103
  publishUsage: string;
96
104
  rnuVersionNotFound: string;
97
105
  rolloutConfigSet: string;
package/lib/locales/zh.js CHANGED
@@ -100,6 +100,14 @@ exports.default = {
100
100
  processingError: '处理文件时出错:{{error}}',
101
101
  processingPackage: '正在处理包 {{count}}...',
102
102
  processingStringPool: '正在处理字符串池...',
103
+ sourceMapNotFound: '找不到 source map:{{path}}',
104
+ sourceMapMissingWarning: '本版本没有归档 source map,之后的崩溃堆栈将无法还原。请用默认的 --sourcemap 打包,或在 publish 时传 --sourcemap <文件>。',
105
+ sourceMapArchived: 'source map 已随版本 {{id}} 归档',
106
+ sourceMapUploadFailedWarning: 'source map 上传失败({{error}}),本次发布不归档 map。升级更新服务端后可归档 source map。',
107
+ symbolicateUsage: '用法:pushy symbolicate <堆栈文件 | -> --hash <热更 hash> [--platform ios|android|harmony] [--output <文件>]',
108
+ symbolicateVersionNotFound: '当前应用下找不到 hash 为 {{hash}} 的已发布版本',
109
+ symbolicateNoSourceMap: '版本 {{id}} 发布时未归档 source map,无法还原',
110
+ symbolicateDone: '已按版本 {{id}}({{hash}})还原 {{count}} 个堆栈帧',
103
111
  publishUsage: '使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
104
112
  rnuVersionNotFound: 'react-native-update: 无法获取版本号。请在项目目录中运行命令',
105
113
  rolloutConfigSet: '已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更包 {{version}}',
package/lib/provider.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BundleOptions, CLIProvider, CommandResult, Platform, PublishOptions, Session, UpdateVersionOptions, UploadOptions } from './types';
1
+ import type { BundleOptions, CLIProvider, CommandResult, Platform, PublishOptions, Session, SymbolicateOptions, UpdateVersionOptions, UploadOptions } from './types';
2
2
  export declare class CLIProviderImpl implements CLIProvider {
3
3
  private session?;
4
4
  private sessionInitPromise?;
@@ -8,6 +8,7 @@ export declare class CLIProviderImpl implements CLIProvider {
8
8
  private runDataCommand;
9
9
  bundle(options: BundleOptions): Promise<CommandResult>;
10
10
  publish(options: PublishOptions): Promise<CommandResult>;
11
+ symbolicate(options: SymbolicateOptions): Promise<CommandResult>;
11
12
  upload(options: UploadOptions): Promise<CommandResult>;
12
13
  getSelectedApp(platform?: Platform): Promise<{
13
14
  appId: string;
package/lib/provider.js CHANGED
@@ -117,11 +117,26 @@ class CLIProviderImpl {
117
117
  ? undefined
118
118
  : String(options.rollout),
119
119
  dryRun: options.dryRun || false,
120
+ sourcemap: options.sourcemap,
120
121
  }, options.filePath ? [options.filePath] : []);
121
122
  const { versionCommands } = await Promise.resolve().then(() => __importStar(require('./versions')));
122
123
  await versionCommands.publish(context);
123
124
  }, 'Unknown error during publishing', 'Version published successfully');
124
125
  }
126
+ async symbolicate(options) {
127
+ return this.runMessageCommand(async () => {
128
+ const context = this.createContext({
129
+ hash: options.hash,
130
+ versionId: options.versionId,
131
+ platform: options.platform,
132
+ appId: options.appId,
133
+ config: options.config,
134
+ output: options.output,
135
+ }, options.stackFile ? [options.stackFile] : []);
136
+ const { symbolicateCommands } = await Promise.resolve().then(() => __importStar(require('./symbolicate')));
137
+ await symbolicateCommands.symbolicate(context);
138
+ }, 'Unknown error during symbolication', 'Stack symbolicated');
139
+ }
125
140
  async upload(options) {
126
141
  return this.runMessageCommand(async () => {
127
142
  const filePath = options.filePath;
@@ -0,0 +1,30 @@
1
+ export interface FrameConsumer {
2
+ originalPositionFor(position: {
3
+ line: number;
4
+ column: number;
5
+ }): {
6
+ source?: string | null;
7
+ line?: number | null;
8
+ column?: number | null;
9
+ name?: string | null;
10
+ };
11
+ }
12
+ /**
13
+ * Rewrites every bundle frame of `stack` to its original source position.
14
+ * JS engines report 1-based columns, so they are shifted to the 0-based
15
+ * columns source maps use; Hermes bytecode frames (`address at`) carry the
16
+ * bytecode offset, which the composed hermes map keys directly.
17
+ */
18
+ export declare function symbolicateStack(stack: string, consumer: FrameConsumer): {
19
+ text: string;
20
+ mapped: number;
21
+ };
22
+ export declare const symbolicateCommands: {
23
+ symbolicate: ({ args, options, }: {
24
+ args: string[];
25
+ options: Record<string, unknown>;
26
+ }) => Promise<{
27
+ versionId: string;
28
+ mapped: number;
29
+ }>;
30
+ };
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.symbolicateCommands = void 0;
7
+ exports.symbolicateStack = symbolicateStack;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const node_fetch_1 = __importDefault(require("node-fetch"));
10
+ const source_map_1 = require("source-map");
11
+ const api_1 = require("./api");
12
+ const app_1 = require("./app");
13
+ const i18n_1 = require("./utils/i18n");
14
+ const versions_1 = require("./versions");
15
+ // A frame location inside a shipped bundle: `<bundle>:<line>:<column>`. Covers
16
+ // `index.bundlejs`, `index.android.bundle`, `main.jsbundle`, `bundle.harmony.js`
17
+ // and plain `.js`/`.hbc` names; an optional `address at ` prefix marks a
18
+ // Hermes bytecode frame (column = bytecode offset, already 0-based).
19
+ const FRAME_PATTERN = /(address at )?((?:[\w.-]+\/)*[\w.-]+\.(?:bundlejs|jsbundle|bundle|hbc|js))(?:\?[^\s:)]*)?:(\d+):(\d+)/g;
20
+ /**
21
+ * Rewrites every bundle frame of `stack` to its original source position.
22
+ * JS engines report 1-based columns, so they are shifted to the 0-based
23
+ * columns source maps use; Hermes bytecode frames (`address at`) carry the
24
+ * bytecode offset, which the composed hermes map keys directly.
25
+ */
26
+ function symbolicateStack(stack, consumer) {
27
+ let mapped = 0;
28
+ const text = stack.replace(FRAME_PATTERN, (frame, hermes, _bundle, line, column) => {
29
+ const position = consumer.originalPositionFor({
30
+ line: Number(line),
31
+ column: hermes ? Number(column) : Math.max(0, Number(column) - 1),
32
+ });
33
+ if (!position.source ||
34
+ position.line === null ||
35
+ position.line === undefined) {
36
+ return frame;
37
+ }
38
+ mapped++;
39
+ const original = `${position.source}:${position.line}:${(position.column ?? 0) + 1}`;
40
+ return position.name ? `${original} (${position.name})` : original;
41
+ });
42
+ return { text, mapped };
43
+ }
44
+ async function findVersionByHash(appId, hash) {
45
+ const limit = 100;
46
+ // The list is newest-first; crashes are usually about recent versions.
47
+ for (let offset = 0; offset < 100 * limit; offset += limit) {
48
+ const page = await (0, versions_1.fetchVersions)(appId, offset, limit);
49
+ const found = page.find((version) => version.hash === hash);
50
+ if (found) {
51
+ return found;
52
+ }
53
+ if (page.length < limit) {
54
+ return undefined;
55
+ }
56
+ }
57
+ return undefined;
58
+ }
59
+ async function readStack(source) {
60
+ if (!source || source === '-') {
61
+ return new Promise((resolve, reject) => {
62
+ const chunks = [];
63
+ process.stdin.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
64
+ process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
65
+ process.stdin.on('error', reject);
66
+ });
67
+ }
68
+ return fs_1.default.readFileSync(source, 'utf8');
69
+ }
70
+ exports.symbolicateCommands = {
71
+ symbolicate: async ({ args, options, }) => {
72
+ const hash = typeof options.hash === 'string' ? options.hash : '';
73
+ const versionIdOption = typeof options.versionId === 'string' ? options.versionId : '';
74
+ if (!hash && !versionIdOption) {
75
+ throw new Error((0, i18n_1.t)('symbolicateUsage'));
76
+ }
77
+ const platform = await (0, app_1.getPlatform)(typeof options.platform === 'string'
78
+ ? options.platform
79
+ : undefined);
80
+ const appId = typeof options.appId === 'string' && options.appId
81
+ ? options.appId
82
+ : (await (0, app_1.getSelectedApp)(platform, options.config))
83
+ .appId;
84
+ let versionId = versionIdOption;
85
+ if (!versionId) {
86
+ const version = await findVersionByHash(appId, hash);
87
+ if (!version) {
88
+ throw new Error((0, i18n_1.t)('symbolicateVersionNotFound', { hash }));
89
+ }
90
+ versionId = String(version.id);
91
+ }
92
+ const located = await (0, api_1.get)(`/app/${appId}/version/${versionId}/sourceMap`);
93
+ if (!located?.url) {
94
+ throw new Error((0, i18n_1.t)('symbolicateNoSourceMap', { id: versionId }));
95
+ }
96
+ const response = await (0, node_fetch_1.default)(located.url);
97
+ if (!response.ok) {
98
+ throw new Error(`Failed to download source map: HTTP ${response.status}`);
99
+ }
100
+ const rawMap = JSON.parse(await response.text());
101
+ const consumer = new source_map_1.SourceMapConsumer(rawMap);
102
+ const stack = await readStack(args[0]);
103
+ const { text, mapped } = symbolicateStack(stack, consumer);
104
+ if (typeof options.output === 'string' && options.output) {
105
+ fs_1.default.writeFileSync(options.output, text);
106
+ }
107
+ else {
108
+ process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);
109
+ }
110
+ console.error((0, i18n_1.t)('symbolicateDone', {
111
+ count: mapped,
112
+ id: versionId,
113
+ hash: located.hash ?? hash,
114
+ }));
115
+ return { versionId, mapped };
116
+ },
117
+ };
package/lib/types.d.ts CHANGED
@@ -23,6 +23,8 @@ export interface Version {
23
23
  name: string;
24
24
  packages?: Package[];
25
25
  deps?: Record<string, string> | string | null;
26
+ /** storage key of the archived source map (absent when published without one) */
27
+ sourceMapKey?: string;
26
28
  }
27
29
  export interface CommandContext<TOptions extends Record<string, unknown> = Record<string, unknown>> {
28
30
  args: string[];
@@ -58,6 +60,8 @@ export interface BundleOptions {
58
60
  }
59
61
  export interface PublishOptions {
60
62
  filePath?: string;
63
+ /** path of the final source map to archive with the version */
64
+ sourcemap?: string;
61
65
  platform?: Platform;
62
66
  name?: string;
63
67
  description?: string;
@@ -90,9 +94,22 @@ export interface UpdateVersionOptions {
90
94
  rollout?: number | string;
91
95
  dryRun?: boolean;
92
96
  }
97
+ export interface SymbolicateOptions {
98
+ /** stack trace file ('-' for stdin) */
99
+ stackFile?: string;
100
+ /** update hash of the running version (from getUpdateMetadata().currentVersion) */
101
+ hash?: string;
102
+ versionId?: string;
103
+ platform?: Platform;
104
+ appId?: string;
105
+ config?: string;
106
+ /** write the symbolicated stack here instead of stdout */
107
+ output?: string;
108
+ }
93
109
  export interface CLIProvider {
94
110
  bundle: (options: BundleOptions) => Promise<CommandResult>;
95
111
  publish: (options: PublishOptions) => Promise<CommandResult>;
112
+ symbolicate: (options: SymbolicateOptions) => Promise<CommandResult>;
96
113
  upload: (options: UploadOptions) => Promise<CommandResult>;
97
114
  createApp: (name: string, platform: Platform) => Promise<CommandResult>;
98
115
  listApps: (platform?: Platform) => Promise<CommandResult>;
package/lib/versions.js CHANGED
@@ -8,6 +8,7 @@ exports.normalizeDeps = normalizeDeps;
8
8
  exports.fetchVersions = fetchVersions;
9
9
  const chalk_1 = __importDefault(require("chalk"));
10
10
  const compare_versions_1 = require("compare-versions");
11
+ const fs_1 = __importDefault(require("fs"));
11
12
  const api_1 = require("./api");
12
13
  const app_1 = require("./app");
13
14
  const package_1 = require("./package");
@@ -371,15 +372,46 @@ exports.versionCommands = {
371
372
  appId = (await (0, app_1.getSelectedApp)(platform, options.config)).appId;
372
373
  }
373
374
  const nonInteractive = (0, options_1.getBooleanOption)(options, 'no-interactive', false) || (0, utils_1.isNonInteractive)();
375
+ // The source map is archived with the version so `pushy symbolicate` can
376
+ // map crashes back to source. An explicit path that does not exist is a
377
+ // publish error; no path at all is a loud warning (custom pipelines that
378
+ // never produced a map keep working).
379
+ const sourcemapPath = typeof options.sourcemap === 'string' && options.sourcemap
380
+ ? options.sourcemap
381
+ : undefined;
382
+ if (sourcemapPath && !fs_1.default.existsSync(sourcemapPath)) {
383
+ throw new Error((0, i18n_1.t)('sourceMapNotFound', { path: sourcemapPath }));
384
+ }
385
+ if (!sourcemapPath) {
386
+ console.log(chalk_1.default.yellow((0, i18n_1.t)('sourceMapMissingWarning')));
387
+ }
374
388
  // Hashing/caching the bundle and asking git for the commit are independent
375
389
  // of the upload, so they overlap with it instead of running afterwards.
376
390
  // describePpkBundle never rejects (best effort); a failed upload still
377
391
  // fails the publish exactly as before.
378
- const [{ hash }, bundleMeta, commit] = await Promise.all([
392
+ // A server that predates source-map archiving (self-hosted, or a SaaS
393
+ // region not yet rolled) rejects the .map upload with 400; that must not
394
+ // fail the publish, only lose the archive.
395
+ let sourceMapUploadError;
396
+ const [{ hash }, bundleMeta, commit, sourceMapUpload] = await Promise.all([
379
397
  (0, api_1.uploadFile)(fn, undefined, appId),
380
398
  describePpkBundle(fn, options.hermesBase),
381
399
  (0, git_1.getCommitInfo)(),
400
+ sourcemapPath
401
+ ? (0, api_1.uploadFile)(sourcemapPath, undefined, appId).catch((error) => {
402
+ sourceMapUploadError = error;
403
+ return undefined;
404
+ })
405
+ : Promise.resolve(undefined),
382
406
  ]);
407
+ const sourceMapKey = sourceMapUpload?.hash;
408
+ if (sourcemapPath && !sourceMapKey) {
409
+ console.log(chalk_1.default.yellow((0, i18n_1.t)('sourceMapUploadFailedWarning', {
410
+ error: sourceMapUploadError instanceof Error
411
+ ? sourceMapUploadError.message
412
+ : String(sourceMapUploadError),
413
+ })));
414
+ }
383
415
  const depVersions = (0, dep_versions_1.getDepVersions)();
384
416
  const versionName = name ||
385
417
  (nonInteractive ? '' : await (0, utils_1.question)((0, i18n_1.t)('versionNameQuestion'))) ||
@@ -395,8 +427,13 @@ exports.versionCommands = {
395
427
  commit,
396
428
  // Hermes delta-mode chain metadata (old servers drop unknown fields)
397
429
  ...bundleMeta,
430
+ // archived source map (old servers drop unknown fields)
431
+ ...(sourceMapKey ? { sourceMapKey } : {}),
398
432
  });
399
433
  console.log((0, i18n_1.t)('packageUploadSuccess', { id }));
434
+ if (sourceMapKey) {
435
+ console.log((0, i18n_1.t)('sourceMapArchived', { id }));
436
+ }
400
437
  const { packageId, packageVersion, packageVersionRange, minPackageVersion, maxPackageVersion, rollout, dryRun, } = options;
401
438
  if (packageId ||
402
439
  packageVersion ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.22.9",
3
+ "version": "2.23.0",
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",
@@ -79,6 +79,7 @@
79
79
  "protobufjs": "^8.7.2",
80
80
  "read": "^4.1.0",
81
81
  "registry-auth-token": "^5.1.1",
82
+ "source-map": "0.6.1",
82
83
  "tty-table": "5.0",
83
84
  "yauzl": "^3.4.0",
84
85
  "yazl": "3.3.1"
package/src/bin.ts CHANGED
@@ -7,6 +7,7 @@ import { cacheCommands } from './cache';
7
7
  import { diffCommands } from './diff';
8
8
  import { installCommands } from './install';
9
9
  import { packageCommands } from './package';
10
+ import { symbolicateCommands } from './symbolicate';
10
11
  import { userCommands } from './user';
11
12
  import { printVersionCommand } from './utils';
12
13
  import { t } from './utils/i18n';
@@ -52,6 +53,7 @@ const commandHandlers: Record<string, CliCommandHandler> = {
52
53
  ...getAppCommands(),
53
54
  ...packageCommands,
54
55
  ...versionCommands,
56
+ ...symbolicateCommands,
55
57
  ...installCommands,
56
58
  help: printUsage,
57
59
  };
package/src/bundle.ts CHANGED
@@ -72,6 +72,8 @@ type PublishBundlePayload = {
72
72
  rollout?: string;
73
73
  dryRun?: boolean;
74
74
  hermesBase?: HermesBaseMeta;
75
+ /** path of the final source map to archive with the version */
76
+ sourcemap?: string;
75
77
  };
76
78
 
77
79
  function getAliasedOptionalStringOption(
@@ -108,7 +110,9 @@ export function normalizeBundleOptions(
108
110
  `${tempDir}/output/${platform}.\${time}.ppk`,
109
111
  ),
110
112
  dev: getBooleanOption(translatedOptions, 'dev', false) ? 'true' : 'false',
111
- sourcemap: getBooleanOption(translatedOptions, 'sourcemap', false),
113
+ // On by default since 2.23: the map is archived with the published
114
+ // version (pushy symbolicate). --no-sourcemap / --sourcemap=false opts out.
115
+ sourcemap: getBooleanOption(translatedOptions, 'sourcemap', true),
112
116
  taro: getBooleanOption(translatedOptions, 'taro', false),
113
117
  expo: getBooleanOption(translatedOptions, 'expo', false),
114
118
  rncli: getBooleanOption(translatedOptions, 'rncli', false),
@@ -295,6 +299,10 @@ export const bundleCommands = {
295
299
  rollout: normalized.rollout,
296
300
  dryRun: normalized.dryRun,
297
301
  hermesBase: baseMeta,
302
+ sourcemap:
303
+ normalized.sourcemap || bundleParams.sourcemap
304
+ ? sourcemapOutput
305
+ : undefined,
298
306
  });
299
307
  await uploadSentryArtifactsIfNeeded(
300
308
  bundleParams.sentry,
@@ -315,6 +323,10 @@ export const bundleCommands = {
315
323
  if (v.toLowerCase() === 'y') {
316
324
  await publishBundleVersion(realOutput, platform, {
317
325
  hermesBase: baseMeta,
326
+ sourcemap:
327
+ normalized.sourcemap || bundleParams.sourcemap
328
+ ? sourcemapOutput
329
+ : undefined,
318
330
  });
319
331
  await uploadSentryArtifactsIfNeeded(
320
332
  bundleParams.sentry,
package/src/locales/en.ts CHANGED
@@ -130,6 +130,20 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
130
130
  processingStringPool: 'Processing the string pool ...',
131
131
  publishUsage:
132
132
  'Usage: pushy publish <ppk file> --platform ios|android|harmony',
133
+ sourceMapNotFound: 'Source map not found: {{path}}',
134
+ sourceMapMissingWarning:
135
+ 'No source map was archived with this version: crashes cannot be symbolicated later. Bundle with the default --sourcemap, or pass --sourcemap <file> to publish.',
136
+ sourceMapArchived: 'Source map archived with version {{id}}',
137
+ sourceMapUploadFailedWarning:
138
+ 'Source map upload failed ({{error}}); publishing without an archived map. Upgrade the update server to archive source maps.',
139
+ symbolicateUsage:
140
+ 'Usage: pushy symbolicate <stack file | -> --hash <updateHash> [--platform ios|android|harmony] [--output <file>]',
141
+ symbolicateVersionNotFound:
142
+ 'No published version with hash {{hash}} found for this app',
143
+ symbolicateNoSourceMap:
144
+ 'Version {{id}} was published without a source map; nothing to symbolicate against',
145
+ symbolicateDone:
146
+ 'Symbolicated {{count}} frame(s) against version {{id}} ({{hash}})',
133
147
  rnuVersionNotFound:
134
148
  'react-native-update: Cannot get the version number. Please run the command in the project directory',
135
149
  rolloutConfigSet:
package/src/locales/zh.ts CHANGED
@@ -118,6 +118,17 @@ export default {
118
118
  processingError: '处理文件时出错:{{error}}',
119
119
  processingPackage: '正在处理包 {{count}}...',
120
120
  processingStringPool: '正在处理字符串池...',
121
+ sourceMapNotFound: '找不到 source map:{{path}}',
122
+ sourceMapMissingWarning:
123
+ '本版本没有归档 source map,之后的崩溃堆栈将无法还原。请用默认的 --sourcemap 打包,或在 publish 时传 --sourcemap <文件>。',
124
+ sourceMapArchived: 'source map 已随版本 {{id}} 归档',
125
+ sourceMapUploadFailedWarning:
126
+ 'source map 上传失败({{error}}),本次发布不归档 map。升级更新服务端后可归档 source map。',
127
+ symbolicateUsage:
128
+ '用法:pushy symbolicate <堆栈文件 | -> --hash <热更 hash> [--platform ios|android|harmony] [--output <文件>]',
129
+ symbolicateVersionNotFound: '当前应用下找不到 hash 为 {{hash}} 的已发布版本',
130
+ symbolicateNoSourceMap: '版本 {{id}} 发布时未归档 source map,无法还原',
131
+ symbolicateDone: '已按版本 {{id}}({{hash}})还原 {{count}} 个堆栈帧',
121
132
  publishUsage:
122
133
  '使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
123
134
  rnuVersionNotFound:
package/src/provider.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  Platform,
9
9
  PublishOptions,
10
10
  Session,
11
+ SymbolicateOptions,
11
12
  UpdateVersionOptions,
12
13
  UploadOptions,
13
14
  } from './types';
@@ -128,6 +129,7 @@ export class CLIProviderImpl implements CLIProvider {
128
129
  ? undefined
129
130
  : String(options.rollout),
130
131
  dryRun: options.dryRun || false,
132
+ sourcemap: options.sourcemap,
131
133
  },
132
134
  options.filePath ? [options.filePath] : [],
133
135
  );
@@ -140,6 +142,28 @@ export class CLIProviderImpl implements CLIProvider {
140
142
  );
141
143
  }
142
144
 
145
+ async symbolicate(options: SymbolicateOptions): Promise<CommandResult> {
146
+ return this.runMessageCommand(
147
+ async () => {
148
+ const context = this.createContext(
149
+ {
150
+ hash: options.hash,
151
+ versionId: options.versionId,
152
+ platform: options.platform,
153
+ appId: options.appId,
154
+ config: options.config,
155
+ output: options.output,
156
+ },
157
+ options.stackFile ? [options.stackFile] : [],
158
+ );
159
+ const { symbolicateCommands } = await import('./symbolicate');
160
+ await symbolicateCommands.symbolicate(context);
161
+ },
162
+ 'Unknown error during symbolication',
163
+ 'Stack symbolicated',
164
+ );
165
+ }
166
+
143
167
  async upload(options: UploadOptions): Promise<CommandResult> {
144
168
  return this.runMessageCommand(
145
169
  async () => {
@@ -0,0 +1,159 @@
1
+ import fs from 'fs';
2
+ import fetch from 'node-fetch';
3
+ import { SourceMapConsumer } from 'source-map';
4
+ import { get } from './api';
5
+ import { getPlatform, getSelectedApp } from './app';
6
+ import type { Platform, Version } from './types';
7
+ import { t } from './utils/i18n';
8
+ import { fetchVersions } from './versions';
9
+
10
+ // A frame location inside a shipped bundle: `<bundle>:<line>:<column>`. Covers
11
+ // `index.bundlejs`, `index.android.bundle`, `main.jsbundle`, `bundle.harmony.js`
12
+ // and plain `.js`/`.hbc` names; an optional `address at ` prefix marks a
13
+ // Hermes bytecode frame (column = bytecode offset, already 0-based).
14
+ const FRAME_PATTERN =
15
+ /(address at )?((?:[\w.-]+\/)*[\w.-]+\.(?:bundlejs|jsbundle|bundle|hbc|js))(?:\?[^\s:)]*)?:(\d+):(\d+)/g;
16
+
17
+ export interface FrameConsumer {
18
+ originalPositionFor(position: { line: number; column: number }): {
19
+ source?: string | null;
20
+ line?: number | null;
21
+ column?: number | null;
22
+ name?: string | null;
23
+ };
24
+ }
25
+
26
+ /**
27
+ * Rewrites every bundle frame of `stack` to its original source position.
28
+ * JS engines report 1-based columns, so they are shifted to the 0-based
29
+ * columns source maps use; Hermes bytecode frames (`address at`) carry the
30
+ * bytecode offset, which the composed hermes map keys directly.
31
+ */
32
+ export function symbolicateStack(
33
+ stack: string,
34
+ consumer: FrameConsumer,
35
+ ): { text: string; mapped: number } {
36
+ let mapped = 0;
37
+ const text = stack.replace(
38
+ FRAME_PATTERN,
39
+ (
40
+ frame,
41
+ hermes: string | undefined,
42
+ _bundle,
43
+ line: string,
44
+ column: string,
45
+ ) => {
46
+ const position = consumer.originalPositionFor({
47
+ line: Number(line),
48
+ column: hermes ? Number(column) : Math.max(0, Number(column) - 1),
49
+ });
50
+ if (
51
+ !position.source ||
52
+ position.line === null ||
53
+ position.line === undefined
54
+ ) {
55
+ return frame;
56
+ }
57
+ mapped++;
58
+ const original = `${position.source}:${position.line}:${(position.column ?? 0) + 1}`;
59
+ return position.name ? `${original} (${position.name})` : original;
60
+ },
61
+ );
62
+ return { text, mapped };
63
+ }
64
+
65
+ async function findVersionByHash(
66
+ appId: string,
67
+ hash: string,
68
+ ): Promise<Version | undefined> {
69
+ const limit = 100;
70
+ // The list is newest-first; crashes are usually about recent versions.
71
+ for (let offset = 0; offset < 100 * limit; offset += limit) {
72
+ const page = await fetchVersions(appId, offset, limit);
73
+ const found = page.find((version) => version.hash === hash);
74
+ if (found) {
75
+ return found;
76
+ }
77
+ if (page.length < limit) {
78
+ return undefined;
79
+ }
80
+ }
81
+ return undefined;
82
+ }
83
+
84
+ async function readStack(source: string | undefined): Promise<string> {
85
+ if (!source || source === '-') {
86
+ return new Promise((resolve, reject) => {
87
+ const chunks: Buffer[] = [];
88
+ process.stdin.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
89
+ process.stdin.on('end', () =>
90
+ resolve(Buffer.concat(chunks).toString('utf8')),
91
+ );
92
+ process.stdin.on('error', reject);
93
+ });
94
+ }
95
+ return fs.readFileSync(source, 'utf8');
96
+ }
97
+
98
+ export const symbolicateCommands = {
99
+ symbolicate: async ({
100
+ args,
101
+ options,
102
+ }: {
103
+ args: string[];
104
+ options: Record<string, unknown>;
105
+ }) => {
106
+ const hash = typeof options.hash === 'string' ? options.hash : '';
107
+ const versionIdOption =
108
+ typeof options.versionId === 'string' ? options.versionId : '';
109
+ if (!hash && !versionIdOption) {
110
+ throw new Error(t('symbolicateUsage'));
111
+ }
112
+ const platform = await getPlatform(
113
+ typeof options.platform === 'string'
114
+ ? (options.platform as Platform)
115
+ : undefined,
116
+ );
117
+ const appId =
118
+ typeof options.appId === 'string' && options.appId
119
+ ? options.appId
120
+ : (await getSelectedApp(platform, options.config as string | undefined))
121
+ .appId;
122
+
123
+ let versionId = versionIdOption;
124
+ if (!versionId) {
125
+ const version = await findVersionByHash(appId, hash);
126
+ if (!version) {
127
+ throw new Error(t('symbolicateVersionNotFound', { hash }));
128
+ }
129
+ versionId = String(version.id);
130
+ }
131
+
132
+ const located = await get(`/app/${appId}/version/${versionId}/sourceMap`);
133
+ if (!located?.url) {
134
+ throw new Error(t('symbolicateNoSourceMap', { id: versionId }));
135
+ }
136
+ const response = await fetch(located.url);
137
+ if (!response.ok) {
138
+ throw new Error(`Failed to download source map: HTTP ${response.status}`);
139
+ }
140
+ const rawMap = JSON.parse(await response.text());
141
+ const consumer = new SourceMapConsumer(rawMap);
142
+
143
+ const stack = await readStack(args[0]);
144
+ const { text, mapped } = symbolicateStack(stack, consumer);
145
+ if (typeof options.output === 'string' && options.output) {
146
+ fs.writeFileSync(options.output, text);
147
+ } else {
148
+ process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);
149
+ }
150
+ console.error(
151
+ t('symbolicateDone', {
152
+ count: mapped,
153
+ id: versionId,
154
+ hash: located.hash ?? hash,
155
+ }),
156
+ );
157
+ return { versionId, mapped };
158
+ },
159
+ };
package/src/types.ts CHANGED
@@ -28,6 +28,8 @@ export interface Version {
28
28
  name: string;
29
29
  packages?: Package[];
30
30
  deps?: Record<string, string> | string | null;
31
+ /** storage key of the archived source map (absent when published without one) */
32
+ sourceMapKey?: string;
31
33
  }
32
34
 
33
35
  export interface CommandContext<
@@ -69,6 +71,8 @@ export interface BundleOptions {
69
71
 
70
72
  export interface PublishOptions {
71
73
  filePath?: string;
74
+ /** path of the final source map to archive with the version */
75
+ sourcemap?: string;
72
76
  platform?: Platform;
73
77
  name?: string;
74
78
  description?: string;
@@ -104,9 +108,23 @@ export interface UpdateVersionOptions {
104
108
  dryRun?: boolean;
105
109
  }
106
110
 
111
+ export interface SymbolicateOptions {
112
+ /** stack trace file ('-' for stdin) */
113
+ stackFile?: string;
114
+ /** update hash of the running version (from getUpdateMetadata().currentVersion) */
115
+ hash?: string;
116
+ versionId?: string;
117
+ platform?: Platform;
118
+ appId?: string;
119
+ config?: string;
120
+ /** write the symbolicated stack here instead of stdout */
121
+ output?: string;
122
+ }
123
+
107
124
  export interface CLIProvider {
108
125
  bundle: (options: BundleOptions) => Promise<CommandResult>;
109
126
  publish: (options: PublishOptions) => Promise<CommandResult>;
127
+ symbolicate: (options: SymbolicateOptions) => Promise<CommandResult>;
110
128
  upload: (options: UploadOptions) => Promise<CommandResult>;
111
129
 
112
130
  createApp: (name: string, platform: Platform) => Promise<CommandResult>;
package/src/versions.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import { compare, satisfies } from 'compare-versions';
3
+ import fs from 'fs';
3
4
  import { doDelete, get, getAllPackages, post, put, uploadFile } from './api';
4
5
  import { getPlatform, getSelectedApp } from './app';
5
6
  import { choosePackage } from './package';
@@ -533,15 +534,55 @@ export const versionCommands = {
533
534
  const nonInteractive =
534
535
  getBooleanOption(options, 'no-interactive', false) || isNonInteractive();
535
536
 
537
+ // The source map is archived with the version so `pushy symbolicate` can
538
+ // map crashes back to source. An explicit path that does not exist is a
539
+ // publish error; no path at all is a loud warning (custom pipelines that
540
+ // never produced a map keep working).
541
+ const sourcemapPath =
542
+ typeof options.sourcemap === 'string' && options.sourcemap
543
+ ? options.sourcemap
544
+ : undefined;
545
+ if (sourcemapPath && !fs.existsSync(sourcemapPath)) {
546
+ throw new Error(t('sourceMapNotFound', { path: sourcemapPath }));
547
+ }
548
+ if (!sourcemapPath) {
549
+ console.log(chalk.yellow(t('sourceMapMissingWarning')));
550
+ }
551
+
536
552
  // Hashing/caching the bundle and asking git for the commit are independent
537
553
  // of the upload, so they overlap with it instead of running afterwards.
538
554
  // describePpkBundle never rejects (best effort); a failed upload still
539
555
  // fails the publish exactly as before.
540
- const [{ hash }, bundleMeta, commit] = await Promise.all([
556
+ // A server that predates source-map archiving (self-hosted, or a SaaS
557
+ // region not yet rolled) rejects the .map upload with 400; that must not
558
+ // fail the publish, only lose the archive.
559
+ let sourceMapUploadError: unknown;
560
+ const [{ hash }, bundleMeta, commit, sourceMapUpload] = await Promise.all([
541
561
  uploadFile(fn, undefined, appId),
542
562
  describePpkBundle(fn, options.hermesBase),
543
563
  getCommitInfo(),
564
+ sourcemapPath
565
+ ? uploadFile(sourcemapPath, undefined, appId).catch(
566
+ (error: unknown) => {
567
+ sourceMapUploadError = error;
568
+ return undefined;
569
+ },
570
+ )
571
+ : Promise.resolve(undefined),
544
572
  ]);
573
+ const sourceMapKey = sourceMapUpload?.hash;
574
+ if (sourcemapPath && !sourceMapKey) {
575
+ console.log(
576
+ chalk.yellow(
577
+ t('sourceMapUploadFailedWarning', {
578
+ error:
579
+ sourceMapUploadError instanceof Error
580
+ ? sourceMapUploadError.message
581
+ : String(sourceMapUploadError),
582
+ }),
583
+ ),
584
+ );
585
+ }
545
586
  const depVersions = getDepVersions();
546
587
 
547
588
  const versionName =
@@ -561,8 +602,13 @@ export const versionCommands = {
561
602
  commit,
562
603
  // Hermes delta-mode chain metadata (old servers drop unknown fields)
563
604
  ...bundleMeta,
605
+ // archived source map (old servers drop unknown fields)
606
+ ...(sourceMapKey ? { sourceMapKey } : {}),
564
607
  });
565
608
  console.log(t('packageUploadSuccess', { id }));
609
+ if (sourceMapKey) {
610
+ console.log(t('sourceMapArchived', { id }));
611
+ }
566
612
 
567
613
  const {
568
614
  packageId,