react-native-update-cli 2.22.3 → 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.
- package/lib/bundle-runner.d.ts +8 -0
- package/lib/bundle-runner.js +45 -4
- package/lib/locales/en.d.ts +1 -0
- package/lib/locales/en.js +1 -0
- package/lib/locales/zh.d.ts +1 -0
- package/lib/locales/zh.js +1 -0
- package/lib/utils/hermes-base.js +11 -3
- package/package.json +1 -1
- package/src/bundle-runner.ts +42 -4
- package/src/locales/en.ts +2 -0
- package/src/locales/zh.ts +1 -0
- package/src/utils/hermes-base.ts +10 -3
package/lib/bundle-runner.d.ts
CHANGED
|
@@ -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>;
|
package/lib/bundle-runner.js
CHANGED
|
@@ -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
|
|
432
|
-
|
|
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:
|
|
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
|
}
|
package/lib/locales/en.d.ts
CHANGED
|
@@ -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)',
|
package/lib/locales/zh.d.ts
CHANGED
|
@@ -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/lib/utils/hermes-base.js
CHANGED
|
@@ -555,9 +555,17 @@ function normalizeDisassemblyLine(line, strings) {
|
|
|
555
555
|
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
556
556
|
if (m)
|
|
557
557
|
line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
558
|
-
//
|
|
559
|
-
// the table header hermesc prints for them) moves with instruction widths
|
|
560
|
-
|
|
558
|
+
// Switch jump tables sit after the instructions; their relative offset (and
|
|
559
|
+
// the table header hermesc prints for them) moves with instruction widths.
|
|
560
|
+
// The two switch instructions carry that offset in different operands:
|
|
561
|
+
// StringSwitchImm rX, <id>, <jtOffset>, <defaultLabel>, <count>
|
|
562
|
+
// UIntSwitchImm rX, <jtOffset>, <defaultLabel>, <min>, <max>
|
|
563
|
+
// Folding only the first shape let a shifted UIntSwitchImm offset read as a
|
|
564
|
+
// real difference and drop an otherwise good delta build.
|
|
565
|
+
m = /^(\s*StringSwitchImm r\d+, \d+, )\d+(, L\d+, \d+)$/.exec(line);
|
|
566
|
+
if (m)
|
|
567
|
+
line = `${m[1]}<jt>${m[2]}`;
|
|
568
|
+
m = /^(\s*UIntSwitchImm r\d+, )\d+(, L\d+, \d+, \d+)$/.exec(line);
|
|
561
569
|
if (m)
|
|
562
570
|
line = `${m[1]}<jt>${m[2]}`;
|
|
563
571
|
if (/^\s*offset \d+$/.test(line))
|
package/package.json
CHANGED
package/src/bundle-runner.ts
CHANGED
|
@@ -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
|
|
608
|
-
|
|
609
|
-
: '';
|
|
638
|
+
const fullStderr = attempt.stderr ? String(attempt.stderr) : '';
|
|
639
|
+
const reason = summarizeHermescStderr(fullStderr);
|
|
610
640
|
console.warn(
|
|
611
641
|
t('hermesBaseCompileFailed', {
|
|
612
|
-
reason:
|
|
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 重新编译',
|
package/src/utils/hermes-base.ts
CHANGED
|
@@ -643,9 +643,16 @@ export function normalizeDisassemblyLine(
|
|
|
643
643
|
// wider form. Fold the suffix and the column padding that follows it.
|
|
644
644
|
m = /^(\s*)([A-Za-z]+?)(?:LongIndex|Long|Short)?(\s+.*|)$/.exec(line);
|
|
645
645
|
if (m) line = `${m[1]}${m[2]}${m[3].replace(/\s+/g, ' ')}`;
|
|
646
|
-
//
|
|
647
|
-
// the table header hermesc prints for them) moves with instruction widths
|
|
648
|
-
|
|
646
|
+
// Switch jump tables sit after the instructions; their relative offset (and
|
|
647
|
+
// the table header hermesc prints for them) moves with instruction widths.
|
|
648
|
+
// The two switch instructions carry that offset in different operands:
|
|
649
|
+
// StringSwitchImm rX, <id>, <jtOffset>, <defaultLabel>, <count>
|
|
650
|
+
// UIntSwitchImm rX, <jtOffset>, <defaultLabel>, <min>, <max>
|
|
651
|
+
// Folding only the first shape let a shifted UIntSwitchImm offset read as a
|
|
652
|
+
// real difference and drop an otherwise good delta build.
|
|
653
|
+
m = /^(\s*StringSwitchImm r\d+, \d+, )\d+(, L\d+, \d+)$/.exec(line);
|
|
654
|
+
if (m) line = `${m[1]}<jt>${m[2]}`;
|
|
655
|
+
m = /^(\s*UIntSwitchImm r\d+, )\d+(, L\d+, \d+, \d+)$/.exec(line);
|
|
649
656
|
if (m) line = `${m[1]}<jt>${m[2]}`;
|
|
650
657
|
if (/^\s*offset \d+$/.test(line)) line = line.replace(/\d+$/, '<jt>');
|
|
651
658
|
return line;
|