react-native-update-cli 2.22.7 → 2.22.8

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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/cli.json +5 -0
  4. package/lib/api.d.ts +7 -0
  5. package/lib/api.js +106 -38
  6. package/lib/app.js +3 -2
  7. package/lib/bin.js +16 -2
  8. package/lib/bundle-runner.d.ts +11 -4
  9. package/lib/bundle-runner.js +176 -90
  10. package/lib/bundle.d.ts +1 -0
  11. package/lib/bundle.js +2 -0
  12. package/lib/diff.d.ts +9 -0
  13. package/lib/diff.js +162 -120
  14. package/lib/locales/en.d.ts +1 -0
  15. package/lib/locales/en.js +1 -0
  16. package/lib/locales/zh.d.ts +1 -0
  17. package/lib/locales/zh.js +1 -0
  18. package/lib/package.d.ts +7 -3
  19. package/lib/package.js +22 -12
  20. package/lib/types.d.ts +2 -0
  21. package/lib/utils/dep-versions.d.ts +7 -0
  22. package/lib/utils/dep-versions.js +66 -31
  23. package/lib/utils/hbcTransform.d.ts +21 -0
  24. package/lib/utils/hbcTransform.js +146 -5
  25. package/lib/utils/hermes-base.d.ts +21 -4
  26. package/lib/utils/hermes-base.js +146 -37
  27. package/lib/utils/http-helper.d.ts +6 -1
  28. package/lib/utils/http-helper.js +23 -11
  29. package/lib/utils/index.d.ts +30 -1
  30. package/lib/utils/index.js +98 -24
  31. package/lib/utils/latest-version/index.d.ts +11 -8
  32. package/lib/utils/latest-version/index.js +63 -18
  33. package/lib/utils/zip-entries.js +20 -15
  34. package/lib/utils/zip-options.d.ts +2 -0
  35. package/lib/utils/zip-options.js +9 -4
  36. package/lib/utils/zip-range.d.ts +47 -15
  37. package/lib/utils/zip-range.js +192 -83
  38. package/lib/versions.js +19 -9
  39. package/package.json +11 -11
  40. package/src/api.ts +126 -46
  41. package/src/app.ts +3 -2
  42. package/src/bin.ts +17 -2
  43. package/src/bundle-runner.ts +225 -113
  44. package/src/bundle.ts +3 -0
  45. package/src/diff.ts +210 -153
  46. package/src/locales/en.ts +2 -0
  47. package/src/locales/zh.ts +2 -0
  48. package/src/package.ts +26 -13
  49. package/src/types.ts +2 -0
  50. package/src/utils/dep-versions.ts +76 -33
  51. package/src/utils/hbcTransform.ts +194 -5
  52. package/src/utils/hermes-base.ts +156 -45
  53. package/src/utils/http-helper.ts +24 -13
  54. package/src/utils/index.ts +136 -26
  55. package/src/utils/latest-version/index.ts +82 -29
  56. package/src/utils/zip-entries.ts +18 -16
  57. package/src/utils/zip-options.ts +8 -3
  58. package/src/utils/zip-range.ts +244 -88
  59. package/src/versions.ts +17 -7
@@ -43,6 +43,7 @@ exports.resolveHermesCommand = resolveHermesCommand;
43
43
  exports.summarizeHermescStderr = summarizeHermescStderr;
44
44
  exports.buildHermescArgs = buildHermescArgs;
45
45
  exports.compileHermesByteCode = compileHermesByteCode;
46
+ exports.hermesBaseErrorLogPath = hermesBaseErrorLogPath;
46
47
  exports.startHermesBaseSelection = startHermesBaseSelection;
47
48
  exports.copyDebugidForSentry = copyDebugidForSentry;
48
49
  exports.prepareSentryUploadArtifacts = prepareSentryUploadArtifacts;
@@ -125,7 +126,7 @@ function resolveExpoCli(projectRoot = process.cwd()) {
125
126
  };
126
127
  }
127
128
  }
128
- async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, hermesBase, cli, isSentry, }) {
129
+ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, hermesBase, resetCache = true, cli, isSentry, }) {
129
130
  let gradleConfig = {};
130
131
  if (platform === 'android') {
131
132
  gradleConfig = await checkGradleConfig();
@@ -213,7 +214,9 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
213
214
  }
214
215
  reactNativeBundleArgs.push(cliPath, bundleCommand, '--assets-dest', outputFolder, '--bundle-output', path_1.default.join(outputFolder, bundleName));
215
216
  if (platform !== 'harmony') {
216
- reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
217
+ reactNativeBundleArgs.push('--platform', platform);
218
+ if (resetCache)
219
+ reactNativeBundleArgs.push('--reset-cache');
217
220
  }
218
221
  if (cli.taro) {
219
222
  reactNativeBundleArgs.push('--type', 'rn');
@@ -230,12 +233,14 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
230
233
  // Decide about Hermes before Metro runs so the base lookup (server query,
231
234
  // Range download, cache) overlaps the bundling instead of following it.
232
235
  const hermesEnabled = await detectHermesEnabled(platform, forceHermes, gradleConfig);
233
- const pendingBase = hermesEnabled && hermesBase
234
- ? startHermesBaseSelection(hermesBase)
235
- : undefined;
236
236
  const jsRuntime = (0, runtime_1.getJavaScriptRuntime)();
237
237
  const reactNativeBundleProcess = (0, runtime_1.spawnJavaScript)(reactNativeBundleArgs);
238
238
  console.log(`Running bundle command: ${jsRuntime} ${reactNativeBundleArgs.join(' ')}`);
239
+ // Metro is running; the synchronous head of the selection (hermesc lookup,
240
+ // HBC version probe) now overlaps it instead of delaying its start.
241
+ const pendingBase = hermesEnabled && hermesBase
242
+ ? startHermesBaseSelection(hermesBase)
243
+ : undefined;
239
244
  let hermesResult = null;
240
245
  await new Promise((resolve, reject) => {
241
246
  reactNativeBundleProcess.stdout.on('data', (data) => {
@@ -437,24 +442,45 @@ function summarizeHermescStderr(stderr) {
437
442
  const notWarnings = kept.filter((line) => !/:\s*(?:warning|note):/i.test(line));
438
443
  return (notWarnings.length > 0 ? notWarnings : kept).slice(-3).join(' ');
439
444
  }
440
- function buildHermescArgs(bundlePath) {
445
+ /** hermesc arguments writing `bundlePath` from `input` (in place by default) */
446
+ function buildHermescArgs(bundlePath, input = bundlePath) {
441
447
  return [
442
448
  '-emit-binary',
443
449
  '-out',
444
450
  bundlePath,
445
- bundlePath,
451
+ input,
446
452
  '-O',
447
453
  '-output-source-map',
448
454
  ];
449
455
  }
456
+ /** captured stderr is bounded to this much head and this much tail */
457
+ const STDERR_KEEP_BYTES = 512 * 1024;
450
458
  /** spawn without blocking the event loop, so two hermesc runs can overlap */
451
459
  function runProcess(command, args, captureStderr) {
452
460
  return new Promise((resolve) => {
453
461
  const child = (0, child_process_1.spawn)(command, args, {
454
462
  stdio: ['ignore', 'ignore', captureStderr ? 'pipe' : 'ignore'],
455
463
  });
456
- const chunks = [];
457
- child.stderr?.on('data', (chunk) => chunks.push(chunk));
464
+ // hermesc echoes whole (minified) source lines per diagnostic: keep the
465
+ // head and the tail, never an unbounded transcript
466
+ const head = [];
467
+ const tail = [];
468
+ let headBytes = 0;
469
+ let tailBytes = 0;
470
+ let dropped = false;
471
+ child.stderr?.on('data', (chunk) => {
472
+ if (headBytes < STDERR_KEEP_BYTES) {
473
+ head.push(chunk);
474
+ headBytes += chunk.length;
475
+ return;
476
+ }
477
+ tail.push(chunk);
478
+ tailBytes += chunk.length;
479
+ while (tail.length > 1 && tailBytes > STDERR_KEEP_BYTES) {
480
+ tailBytes -= tail.shift().length;
481
+ dropped = true;
482
+ }
483
+ });
458
484
  let settled = false;
459
485
  const finish = (outcome) => {
460
486
  if (settled)
@@ -463,22 +489,89 @@ function runProcess(command, args, captureStderr) {
463
489
  resolve(outcome);
464
490
  };
465
491
  child.once('error', (error) => finish({ status: null, signal: null, stderr: '', error }));
466
- child.once('close', (status, signal) => finish({ status, signal, stderr: Buffer.concat(chunks).toString() }));
492
+ child.once('close', (status, signal) => finish({
493
+ status,
494
+ signal,
495
+ stderr: Buffer.concat(head).toString() +
496
+ (dropped ? '\n[... output truncated ...]\n' : '') +
497
+ Buffer.concat(tail).toString(),
498
+ }));
467
499
  });
468
500
  }
501
+ /** how long the compile phase waits for a base that is still being fetched */
502
+ const HERMES_BASE_WAIT_MS = 60_000;
503
+ /**
504
+ * The selection runs while Metro bundles; when Metro is done first, wait a
505
+ * bounded time for it — a stalled download must never hold up the compile.
506
+ */
507
+ async function awaitPendingBase(pending) {
508
+ const waitMs = Number(process.env.PUSHY_HERMES_BASE_WAIT_MS) || HERMES_BASE_WAIT_MS;
509
+ let timer;
510
+ const gaveUp = new Promise((resolve) => {
511
+ timer = setTimeout(() => resolve({
512
+ base: null,
513
+ bytecodeVersion: null,
514
+ logs: [
515
+ (0, i18n_1.t)('hermesBaseNone', {
516
+ reason: `base not ready after ${Math.round(waitMs / 1000)}s`,
517
+ }),
518
+ ],
519
+ }), waitMs);
520
+ });
521
+ try {
522
+ return await Promise.race([pending, gaveUp]);
523
+ }
524
+ finally {
525
+ clearTimeout(timer);
526
+ }
527
+ }
528
+ /** plain compile of `input` into `out`; throws when hermesc fails */
529
+ async function compilePlain(hermesCommand, out, input = out) {
530
+ const args = buildHermescArgs(out, input);
531
+ console.log((0, i18n_1.t)('runningHermesc', { command: hermesCommand, args: args.join(' ') }));
532
+ assertSuccessfulSyncProcess(await runProcess(hermesCommand, args, false), hermesCommand);
533
+ }
534
+ /**
535
+ * Merge the packager map with the hermes map into `sourcemapOutput` (which is
536
+ * normally the hermes map's own path). Resolves false when React Native's
537
+ * composer cannot be found; throws when it fails.
538
+ */
539
+ async function composeSourceMaps(packagerMap, hermesMap, sourcemapOutput) {
540
+ let composerPath;
541
+ try {
542
+ // resolve through the project so hoisted node_modules (monorepos) work
543
+ composerPath = require.resolve('react-native/scripts/compose-source-maps.js', { paths: [process.cwd()] });
544
+ }
545
+ catch {
546
+ console.warn((0, i18n_1.t)('composeSourceMapsNotFound'));
547
+ return false;
548
+ }
549
+ console.log((0, i18n_1.t)('composingSourceMap'));
550
+ assertSuccessfulSyncProcess(await runProcess((0, runtime_1.getJavaScriptRuntime)(), [composerPath, packagerMap, hermesMap, '-o', sourcemapOutput], false), composerPath);
551
+ return true;
552
+ }
469
553
  async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput, shouldCleanSourcemap, baseRequest, pendingBase, hermesCommand = resolveHermesCommand(), }) {
470
554
  console.log((0, i18n_1.t)('hermesEnabledCompiling'));
471
555
  const bundlePath = path_1.default.join(outputFolder, bundleName);
472
- const plainArgs = buildHermescArgs(bundlePath);
556
+ const hermesMap = `${bundlePath}.map`;
557
+ const packagerMap = path_1.default.join(outputFolder, `${bundleName}.txt.map`);
473
558
  if (sourcemapOutput) {
474
- fs.copyFileSync(sourcemapOutput, path_1.default.join(outputFolder, `${bundleName}.txt.map`));
559
+ // hermesc is about to write its own map at `<bundle>.map`, which is where
560
+ // the packager map normally sits: move it aside (copy only when elsewhere)
561
+ if (path_1.default.resolve(sourcemapOutput) === path_1.default.resolve(hermesMap)) {
562
+ fs.renameSync(sourcemapOutput, packagerMap);
563
+ }
564
+ else {
565
+ fs.copyFileSync(sourcemapOutput, packagerMap);
566
+ }
475
567
  }
476
568
  else {
477
- console.log((0, i18n_1.t)('hermesSourcemapKept', { file: `${bundlePath}.map` }));
569
+ console.log((0, i18n_1.t)('hermesSourcemapKept', { file: hermesMap }));
478
570
  }
479
- let selection = pendingBase ? await pendingBase : null;
571
+ let selection = pendingBase ? await awaitPendingBase(pendingBase) : null;
572
+ const command = hermesCommand ?? selection?.hermesCommand ?? resolveHermesCommand();
480
573
  if (!selection || selection.commandUnavailable) {
481
- selection = await selectHermesBase(hermesCommand, baseRequest);
574
+ selection = await selectHermesBase(command, baseRequest);
482
575
  }
483
576
  for (const line of selection.logs)
484
577
  console.log(line);
@@ -487,28 +580,30 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
487
580
  base: null,
488
581
  };
489
582
  const base = selection.base;
490
- if (base) {
491
- // hermesc reads its input in full before writing, so compiling in place is
492
- // safe; keep the JS bundle aside while a base compile may still fail or be
493
- // rejected by the equivalence check. With verification on, the plain
494
- // compile the check needs runs concurrently in a sibling directory (same
495
- // file name, so its sourcemap looks identical) and simply becomes the
496
- // result when the base is rejected — no third compile.
497
- const jsBackup = `${bundlePath}.js.bak`;
498
- fs.copyFileSync(bundlePath, jsBackup);
499
- const plainDir = path_1.default.join(outputFolder, '.hermes-plain');
500
- const plainPath = path_1.default.join(plainDir, bundleName);
583
+ // the packager + hermes maps merged into sourcemapOutput
584
+ let composed = false;
585
+ if (!base) {
586
+ await compilePlain(command, bundlePath);
587
+ }
588
+ else {
589
+ // The JS bundle moves into a work dir and both hermesc runs read it there
590
+ // (no copies); the base compile writes the real output, and with
591
+ // verification on the plain compile the check needs runs concurrently
592
+ // into `plain/` — it simply becomes the result when the base is rejected,
593
+ // so a rejected base never costs a third compile.
594
+ const workDir = path_1.default.join(outputFolder, '.hermes-base');
595
+ const jsSource = path_1.default.join(workDir, bundleName);
596
+ const plainPath = path_1.default.join(workDir, 'plain', bundleName);
501
597
  const wantPlain = Boolean(baseRequest?.verify);
502
- if (wantPlain) {
503
- fs.ensureDirSync(plainDir);
504
- fs.copyFileSync(bundlePath, plainPath);
505
- }
506
- const args = (0, hermes_base_1.hermescArgsWithBase)(plainArgs, base.path);
507
- console.log((0, i18n_1.t)('runningHermesc', { command: hermesCommand, args: args.join(' ') }));
598
+ fs.ensureDirSync(path_1.default.dirname(plainPath));
599
+ fs.renameSync(bundlePath, jsSource);
600
+ const args = (0, hermes_base_1.hermescArgsWithBase)(buildHermescArgs(bundlePath, jsSource), base.path);
601
+ console.log((0, i18n_1.t)('runningHermesc', { command, args: args.join(' ') }));
508
602
  const [attempt, plain] = await Promise.all([
509
- runProcess(hermesCommand, args, true),
603
+ // -w: warnings only bloat the captured stderr, errors still print
604
+ runProcess(command, [...args, '-w'], true),
510
605
  wantPlain
511
- ? runProcess(hermesCommand, buildHermescArgs(plainPath), false)
606
+ ? runProcess(command, buildHermescArgs(plainPath, jsSource), false)
512
607
  : Promise.resolve(null),
513
608
  ]);
514
609
  let usedBase = attempt.status === 0 && !attempt.error;
@@ -521,8 +616,9 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
521
616
  reason: reason || `exit ${attempt.status}`,
522
617
  }));
523
618
  if (fullStderr.trim()) {
524
- // the summary drops warning noise; keep everything for bug reports
525
- const logPath = path_1.default.join(outputFolder, 'hermes-base-error.log');
619
+ // the summary drops noise; keep everything for bug reports — next to
620
+ // the intermediate dir, never inside it (its content is packed)
621
+ const logPath = hermesBaseErrorLogPath(outputFolder);
526
622
  try {
527
623
  fs.writeFileSync(logPath, fullStderr);
528
624
  console.warn((0, i18n_1.t)('hermesBaseCompileFailedLog', { file: logPath }));
@@ -531,83 +627,71 @@ async function compileHermesByteCode({ bundleName, outputFolder, sourcemapOutput
531
627
  }
532
628
  }
533
629
  const plainOk = plain !== null && plain.status === 0 && !plain.error;
630
+ // compose the base output's map while the disassembly compare runs; it is
631
+ // redone from the plain map in the rare case the base is rejected
632
+ const speculativeCompose = usedBase && sourcemapOutput
633
+ ? composeSourceMaps(packagerMap, hermesMap, sourcemapOutput)
634
+ : null;
534
635
  if (usedBase && wantPlain) {
535
- // compare disassembly, keep whichever is right
536
- let ok = plainOk;
537
- if (ok) {
636
+ if (!plainOk) {
637
+ // the check could not run; that is not a verification failure
638
+ console.warn((0, i18n_1.t)('hermesBasePlainCompileFailed', {
639
+ reason: (plain?.error && String(plain.error.message ?? plain.error)) ||
640
+ `exit ${plain?.status}`,
641
+ }));
642
+ }
643
+ else {
644
+ let ok;
538
645
  try {
539
- ok = await (0, hermes_base_1.verifyHermesBaseEquivalence)(hermesCommand, bundlePath, plainPath);
646
+ ok = await (0, hermes_base_1.verifyHermesBaseEquivalence)(command, bundlePath, plainPath);
540
647
  }
541
648
  catch {
542
649
  ok = false;
543
650
  }
651
+ result.verified = ok;
652
+ if (ok) {
653
+ console.log((0, i18n_1.t)('hermesBaseVerified'));
654
+ }
655
+ else {
656
+ console.warn((0, i18n_1.t)('hermesBaseVerifyFailed'));
657
+ usedBase = false;
658
+ }
544
659
  }
545
- result.verified = ok;
546
- if (ok) {
547
- console.log((0, i18n_1.t)('hermesBaseVerified'));
548
- }
549
- else {
550
- console.warn((0, i18n_1.t)('hermesBaseVerifyFailed'));
551
- usedBase = false;
552
- }
660
+ }
661
+ if (speculativeCompose) {
662
+ const done = await speculativeCompose.catch((error) => {
663
+ if (usedBase)
664
+ throw error;
665
+ return false;
666
+ });
667
+ composed = usedBase && done;
553
668
  }
554
669
  if (!usedBase) {
555
670
  if (plainOk) {
556
671
  fs.moveSync(plainPath, bundlePath, { overwrite: true });
557
672
  if (fs.existsSync(`${plainPath}.map`)) {
558
- fs.moveSync(`${plainPath}.map`, `${bundlePath}.map`, {
559
- overwrite: true,
560
- });
673
+ fs.moveSync(`${plainPath}.map`, hermesMap, { overwrite: true });
561
674
  }
562
675
  }
563
676
  else {
564
- fs.copyFileSync(jsBackup, bundlePath);
565
- console.log((0, i18n_1.t)('runningHermesc', {
566
- command: hermesCommand,
567
- args: plainArgs.join(' '),
568
- }));
569
- assertSuccessfulSyncProcess((0, child_process_1.spawnSync)(hermesCommand, plainArgs, { stdio: 'ignore' }), hermesCommand);
677
+ await compilePlain(command, bundlePath, jsSource);
570
678
  }
571
679
  }
572
- fs.removeSync(jsBackup);
573
- fs.removeSync(plainDir);
680
+ fs.removeSync(workDir);
574
681
  result.base = usedBase ? base : null;
575
682
  }
576
- else {
577
- console.log((0, i18n_1.t)('runningHermesc', {
578
- command: hermesCommand,
579
- args: plainArgs.join(' '),
580
- }));
581
- assertSuccessfulSyncProcess((0, child_process_1.spawnSync)(hermesCommand, plainArgs, {
582
- stdio: 'ignore',
583
- }), hermesCommand);
584
- }
585
- if (sourcemapOutput) {
586
- let composerPath;
587
- try {
588
- // resolve through the project so hoisted node_modules (monorepos) work
589
- composerPath = require.resolve('react-native/scripts/compose-source-maps.js', { paths: [process.cwd()] });
590
- }
591
- catch {
592
- console.warn((0, i18n_1.t)('composeSourceMapsNotFound'));
593
- return result;
594
- }
595
- console.log((0, i18n_1.t)('composingSourceMap'));
596
- assertSuccessfulSyncProcess((0, runtime_1.spawnJavaScriptSync)([
597
- composerPath,
598
- path_1.default.join(outputFolder, `${bundleName}.txt.map`),
599
- path_1.default.join(outputFolder, `${bundleName}.map`),
600
- '-o',
601
- sourcemapOutput,
602
- ], {
603
- stdio: 'ignore',
604
- }), composerPath);
683
+ if (sourcemapOutput && !composed) {
684
+ await composeSourceMaps(packagerMap, hermesMap, sourcemapOutput);
605
685
  }
606
686
  if (shouldCleanSourcemap) {
607
- fs.removeSync(path_1.default.join(outputFolder, `${bundleName}.txt.map`));
687
+ fs.removeSync(packagerMap);
608
688
  }
609
689
  return result;
610
690
  }
691
+ /** where a failed base attempt's full hermesc output goes (never packed) */
692
+ function hermesBaseErrorLogPath(outputFolder) {
693
+ return path_1.default.join(path_1.default.dirname(path_1.default.resolve(outputFolder)), 'hermes-base-error.log');
694
+ }
611
695
  /**
612
696
  * Begin resolving the base right away (before Metro); the compile phase awaits
613
697
  * the result. Never rejects: any failure is reported there instead.
@@ -636,6 +720,7 @@ function startHermesBaseSelection(request) {
636
720
  logs: [
637
721
  (0, i18n_1.t)('hermesBaseNone', { reason: error?.message ?? String(error) }),
638
722
  ],
723
+ hermesCommand,
639
724
  };
640
725
  }
641
726
  })();
@@ -646,6 +731,7 @@ async function selectHermesBase(hermesCommand, request) {
646
731
  base: null,
647
732
  bytecodeVersion,
648
733
  logs,
734
+ hermesCommand,
649
735
  });
650
736
  if (!request || request.option === 'none') {
651
737
  if (request) {
@@ -673,7 +759,7 @@ async function selectHermesBase(hermesCommand, request) {
673
759
  fetchBase: api_1.getHermesBase,
674
760
  log: (message) => logs.push(message),
675
761
  });
676
- return { base, bytecodeVersion, logs };
762
+ return { base, bytecodeVersion, logs, hermesCommand };
677
763
  }
678
764
  catch (error) {
679
765
  logs.push((0, i18n_1.t)('hermesBaseNone', { reason: error?.message ?? String(error) }));
package/lib/bundle.d.ts CHANGED
@@ -11,6 +11,7 @@ type NormalizedBundleOptions = {
11
11
  hermes: boolean;
12
12
  hermesBase: string;
13
13
  verifyHermesBase: boolean;
14
+ resetCache: boolean;
14
15
  cacheMaxMb?: number;
15
16
  name?: string;
16
17
  description?: string;
package/lib/bundle.js CHANGED
@@ -44,6 +44,7 @@ function normalizeBundleOptions(translatedOptions, platform) {
44
44
  hermes: (0, options_1.getBooleanOption)(translatedOptions, 'hermes', false),
45
45
  hermesBase: (0, options_1.getStringOption)(translatedOptions, 'hermesBase', 'auto'),
46
46
  verifyHermesBase: (0, options_1.getBooleanOption)(translatedOptions, 'verifyHermesBase', true),
47
+ resetCache: (0, options_1.getBooleanOption)(translatedOptions, 'resetCache', true),
47
48
  cacheMaxMb: parseCacheMaxMb(translatedOptions.cacheMaxMb),
48
49
  name: (0, options_1.getOptionalStringOption)(translatedOptions, 'name'),
49
50
  description: (0, options_1.getOptionalStringOption)(translatedOptions, 'description'),
@@ -123,6 +124,7 @@ exports.bundleCommands = {
123
124
  verify: normalized.verifyHermesBase,
124
125
  cacheMaxMb: normalized.cacheMaxMb,
125
126
  },
127
+ resetCache: normalized.resetCache,
126
128
  cli: {
127
129
  taro: normalized.taro,
128
130
  expo: normalized.expo,
package/lib/diff.d.ts CHANGED
@@ -1,6 +1,15 @@
1
+ import type { Entry } from 'yauzl';
1
2
  import type { CommandContext } from './types';
2
3
  import { enumZipEntries, readEntry } from './utils/zip-entries';
4
+ type ZipEntryContent = Pick<Entry, 'crc32' | 'uncompressedSize'>;
3
5
  export { enumZipEntries, readEntry };
6
+ /**
7
+ * 判定两个 zip entry 内容相同的键:crc32 单独并不足以证明内容一致(32 位
8
+ * 校验和碰撞并不罕见,尤其是长度不同的文件),必须同时要求解压后长度相等。
9
+ * 仅用于生成端匹配,manifest 里的 copies / copiesCrc 格式不变。
10
+ */
11
+ export declare function zipEntryContentKey(entry: ZipEntryContent): string;
12
+ export declare function zipEntriesHaveSameContent(left: ZipEntryContent, right: ZipEntryContent): boolean;
4
13
  export declare const diffCommands: {
5
14
  hdiff: ({ args, options }: CommandContext) => Promise<void>;
6
15
  hdiffFromApk: ({ args, options }: CommandContext) => Promise<void>;