react-native-update-cli 2.22.4 → 2.22.5

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.
@@ -73,6 +73,14 @@ export declare function resolveHermesCommand(projectRoot?: string): string;
73
73
  * simply stays in the intermediate directory (never packed into the ppk) so
74
74
  * `address at` stack frames can still be symbolicated later.
75
75
  */
76
+ /**
77
+ * hermesc echoes every diagnostic as three lines (header, the offending source
78
+ * line, a caret line). Minified bundles put a whole module on one line, so a
79
+ * single warning can be 100k+ characters and blindly keeping the tail of stderr
80
+ * buries the actual error under warning noise. Keep the diagnostic headers,
81
+ * prefer errors over warnings, and cap the length of whatever survives.
82
+ */
83
+ export declare function summarizeHermescStderr(stderr: string): string;
76
84
  export declare function buildHermescArgs(bundlePath: string): string[];
77
85
  export declare function copyDebugidForSentry(bundleName: string, outputFolder: string, sourcemapOutput: string): Promise<void>;
78
86
  export declare function prepareSentryUploadArtifacts(bundleName: string, outputFolder: string, platform: string): Promise<SentryUploadArtifacts>;
@@ -40,6 +40,7 @@ exports.hasProjectDependency = hasProjectDependency;
40
40
  exports.resolveExpoCli = resolveExpoCli;
41
41
  exports.runReactNativeBundleCommand = runReactNativeBundleCommand;
42
42
  exports.resolveHermesCommand = resolveHermesCommand;
43
+ exports.summarizeHermescStderr = summarizeHermescStderr;
43
44
  exports.buildHermescArgs = buildHermescArgs;
44
45
  exports.copyDebugidForSentry = copyDebugidForSentry;
45
46
  exports.prepareSentryUploadArtifacts = prepareSentryUploadArtifacts;
@@ -388,6 +389,38 @@ async function checkGradleConfig() {
388
389
  * simply stays in the intermediate directory (never packed into the ppk) so
389
390
  * `address at` stack frames can still be symbolicated later.
390
391
  */
392
+ /**
393
+ * hermesc echoes every diagnostic as three lines (header, the offending source
394
+ * line, a caret line). Minified bundles put a whole module on one line, so a
395
+ * single warning can be 100k+ characters and blindly keeping the tail of stderr
396
+ * buries the actual error under warning noise. Keep the diagnostic headers,
397
+ * prefer errors over warnings, and cap the length of whatever survives.
398
+ */
399
+ function summarizeHermescStderr(stderr) {
400
+ const raw = String(stderr ?? '').split(/\r?\n/);
401
+ const kept = [];
402
+ for (let i = 0; i < raw.length; i++) {
403
+ const line = raw[i].trim();
404
+ if (!line)
405
+ continue;
406
+ if (/^\^~*$/.test(line))
407
+ continue; // caret line
408
+ // the line before a caret is the echoed source, never the message
409
+ const next = raw[i + 1]?.trim();
410
+ if (next && /^\^~*$/.test(next))
411
+ continue;
412
+ kept.push(line.length > 300 ? `${line.slice(0, 300)}…` : line);
413
+ }
414
+ if (kept.length === 0)
415
+ return '';
416
+ const isError = (line) => /(?::\s*|^)(?:fatal error|error)\b/i.test(line) ||
417
+ /^(?:Assertion|Stack dump|PLEASE submit a bug report)/i.test(line);
418
+ const errors = kept.filter(isError);
419
+ if (errors.length > 0)
420
+ return errors.slice(-3).join(' ');
421
+ const notWarnings = kept.filter((line) => !/:\s*(?:warning|note):/i.test(line));
422
+ return (notWarnings.length > 0 ? notWarnings : kept).slice(-3).join(' ');
423
+ }
391
424
  function buildHermescArgs(bundlePath) {
392
425
  return [
393
426
  '-emit-binary',
@@ -428,12 +461,20 @@ async function compileHermesByteCode(bundleName, outputFolder, sourcemapOutput,
428
461
  usedBase = true;
429
462
  }
430
463
  else {
431
- const stderr = attempt.stderr
432
- ? String(attempt.stderr).trim().split('\n').slice(-3).join(' ')
433
- : '';
464
+ const fullStderr = attempt.stderr ? String(attempt.stderr) : '';
465
+ const reason = summarizeHermescStderr(fullStderr);
434
466
  console.warn((0, i18n_1.t)('hermesBaseCompileFailed', {
435
- reason: stderr || `exit ${attempt.status}`,
467
+ reason: reason || `exit ${attempt.status}`,
436
468
  }));
469
+ if (fullStderr.trim()) {
470
+ // the summary drops warning noise; keep everything for bug reports
471
+ const logPath = path_1.default.join(outputFolder, 'hermes-base-error.log');
472
+ try {
473
+ fs.writeFileSync(logPath, fullStderr);
474
+ console.warn((0, i18n_1.t)('hermesBaseCompileFailedLog', { file: logPath }));
475
+ }
476
+ catch { }
477
+ }
437
478
  fs.copyFileSync(jsBackup, bundlePath);
438
479
  }
439
480
  }
@@ -161,6 +161,7 @@ declare const _default: {
161
161
  hermesBaseUsing: string;
162
162
  hermesBaseDownloading: string;
163
163
  hermesBaseCompileFailed: string;
164
+ hermesBaseCompileFailedLog: string;
164
165
  hermesBaseVerified: string;
165
166
  hermesBaseVerifyFailed: string;
166
167
  cacheCleaned: string;
package/lib/locales/en.js CHANGED
@@ -169,6 +169,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
169
169
  hermesBaseUsing: 'Hermes base: {{- source}} (HBC v{{version}})',
170
170
  hermesBaseDownloading: 'Hermes base: downloading {{- url}}',
171
171
  hermesBaseCompileFailed: 'Hermes base compile failed ({{- reason}}); retrying without -base-bytecode',
172
+ hermesBaseCompileFailedLog: 'Hermes base: full compiler output written to {{- file}}',
172
173
  hermesBaseVerified: 'Hermes base: bytecode verified equivalent to a plain compile',
173
174
  hermesBaseVerifyFailed: 'Hermes base: bytecode differs from a plain compile; dropping the base and recompiling',
174
175
  cacheCleaned: 'Removed {{count}} cached bundle(s)',
@@ -160,6 +160,7 @@ declare const _default: {
160
160
  hermesBaseUsing: string;
161
161
  hermesBaseDownloading: string;
162
162
  hermesBaseCompileFailed: string;
163
+ hermesBaseCompileFailedLog: string;
163
164
  hermesBaseVerified: string;
164
165
  hermesBaseVerifyFailed: string;
165
166
  cacheCleaned: string;
package/lib/locales/zh.js CHANGED
@@ -168,6 +168,7 @@ exports.default = {
168
168
  hermesBaseUsing: 'Hermes base:{{- source}}(HBC v{{version}})',
169
169
  hermesBaseDownloading: 'Hermes base:下载 {{- url}}',
170
170
  hermesBaseCompileFailed: 'Hermes base 编译失败({{- reason}}),改为不带 -base-bytecode 重编',
171
+ hermesBaseCompileFailedLog: 'Hermes base:完整编译错误已写入 {{- file}}',
171
172
  hermesBaseVerified: 'Hermes base:字节码与普通编译等价,校验通过',
172
173
  hermesBaseVerifyFailed: 'Hermes base:字节码与普通编译不等价,放弃 base 重新编译',
173
174
  cacheCleaned: '已清理 {{count}} 个缓存 bundle',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.22.4",
3
+ "version": "2.22.5",
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",
@@ -552,6 +552,37 @@ async function checkGradleConfig(): Promise<GradleConfig> {
552
552
  * simply stays in the intermediate directory (never packed into the ppk) so
553
553
  * `address at` stack frames can still be symbolicated later.
554
554
  */
555
+ /**
556
+ * hermesc echoes every diagnostic as three lines (header, the offending source
557
+ * line, a caret line). Minified bundles put a whole module on one line, so a
558
+ * single warning can be 100k+ characters and blindly keeping the tail of stderr
559
+ * buries the actual error under warning noise. Keep the diagnostic headers,
560
+ * prefer errors over warnings, and cap the length of whatever survives.
561
+ */
562
+ export function summarizeHermescStderr(stderr: string): string {
563
+ const raw = String(stderr ?? '').split(/\r?\n/);
564
+ const kept: string[] = [];
565
+ for (let i = 0; i < raw.length; i++) {
566
+ const line = raw[i].trim();
567
+ if (!line) continue;
568
+ if (/^\^~*$/.test(line)) continue; // caret line
569
+ // the line before a caret is the echoed source, never the message
570
+ const next = raw[i + 1]?.trim();
571
+ if (next && /^\^~*$/.test(next)) continue;
572
+ kept.push(line.length > 300 ? `${line.slice(0, 300)}…` : line);
573
+ }
574
+ if (kept.length === 0) return '';
575
+ const isError = (line: string) =>
576
+ /(?::\s*|^)(?:fatal error|error)\b/i.test(line) ||
577
+ /^(?:Assertion|Stack dump|PLEASE submit a bug report)/i.test(line);
578
+ const errors = kept.filter(isError);
579
+ if (errors.length > 0) return errors.slice(-3).join(' ');
580
+ const notWarnings = kept.filter(
581
+ (line) => !/:\s*(?:warning|note):/i.test(line),
582
+ );
583
+ return (notWarnings.length > 0 ? notWarnings : kept).slice(-3).join(' ');
584
+ }
585
+
555
586
  export function buildHermescArgs(bundlePath: string): string[] {
556
587
  return [
557
588
  '-emit-binary',
@@ -604,14 +635,21 @@ async function compileHermesByteCode(
604
635
  if (attempt.status === 0) {
605
636
  usedBase = true;
606
637
  } else {
607
- const stderr = attempt.stderr
608
- ? String(attempt.stderr).trim().split('\n').slice(-3).join(' ')
609
- : '';
638
+ const fullStderr = attempt.stderr ? String(attempt.stderr) : '';
639
+ const reason = summarizeHermescStderr(fullStderr);
610
640
  console.warn(
611
641
  t('hermesBaseCompileFailed', {
612
- reason: stderr || `exit ${attempt.status}`,
642
+ reason: reason || `exit ${attempt.status}`,
613
643
  }),
614
644
  );
645
+ if (fullStderr.trim()) {
646
+ // the summary drops warning noise; keep everything for bug reports
647
+ const logPath = path.join(outputFolder, 'hermes-base-error.log');
648
+ try {
649
+ fs.writeFileSync(logPath, fullStderr);
650
+ console.warn(t('hermesBaseCompileFailedLog', { file: logPath }));
651
+ } catch {}
652
+ }
615
653
  fs.copyFileSync(jsBackup, bundlePath);
616
654
  }
617
655
  }
package/src/locales/en.ts CHANGED
@@ -220,6 +220,8 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
220
220
  hermesBaseDownloading: 'Hermes base: downloading {{- url}}',
221
221
  hermesBaseCompileFailed:
222
222
  'Hermes base compile failed ({{- reason}}); retrying without -base-bytecode',
223
+ hermesBaseCompileFailedLog:
224
+ 'Hermes base: full compiler output written to {{- file}}',
223
225
  hermesBaseVerified:
224
226
  'Hermes base: bytecode verified equivalent to a plain compile',
225
227
  hermesBaseVerifyFailed:
package/src/locales/zh.ts CHANGED
@@ -203,6 +203,7 @@ export default {
203
203
  hermesBaseDownloading: 'Hermes base:下载 {{- url}}',
204
204
  hermesBaseCompileFailed:
205
205
  'Hermes base 编译失败({{- reason}}),改为不带 -base-bytecode 重编',
206
+ hermesBaseCompileFailedLog: 'Hermes base:完整编译错误已写入 {{- file}}',
206
207
  hermesBaseVerified: 'Hermes base:字节码与普通编译等价,校验通过',
207
208
  hermesBaseVerifyFailed:
208
209
  'Hermes base:字节码与普通编译不等价,放弃 base 重新编译',