react-native-update-cli 2.22.6 → 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.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/cli.json +5 -0
- package/lib/api.d.ts +7 -0
- package/lib/api.js +106 -38
- package/lib/app.js +3 -2
- package/lib/bin.js +16 -2
- package/lib/bundle-runner.d.ts +35 -2
- package/lib/bundle-runner.js +313 -128
- package/lib/bundle.d.ts +1 -0
- package/lib/bundle.js +2 -0
- package/lib/diff.d.ts +9 -0
- package/lib/diff.js +162 -120
- 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/package.d.ts +7 -3
- package/lib/package.js +31 -12
- package/lib/types.d.ts +2 -0
- package/lib/utils/dep-versions.d.ts +7 -0
- package/lib/utils/dep-versions.js +66 -31
- package/lib/utils/hbcTransform.d.ts +21 -0
- package/lib/utils/hbcTransform.js +146 -5
- package/lib/utils/hermes-base.d.ts +31 -7
- package/lib/utils/hermes-base.js +284 -76
- package/lib/utils/http-helper.d.ts +6 -1
- package/lib/utils/http-helper.js +23 -11
- package/lib/utils/index.d.ts +30 -1
- package/lib/utils/index.js +98 -24
- package/lib/utils/latest-version/index.d.ts +11 -8
- package/lib/utils/latest-version/index.js +63 -18
- package/lib/utils/zip-entries.js +20 -15
- package/lib/utils/zip-options.d.ts +2 -0
- package/lib/utils/zip-options.js +9 -4
- package/lib/utils/zip-range.d.ts +84 -13
- package/lib/utils/zip-range.js +363 -63
- package/lib/versions.js +30 -23
- package/package.json +11 -11
- package/src/api.ts +126 -46
- package/src/app.ts +3 -2
- package/src/bin.ts +17 -2
- package/src/bundle-runner.ts +419 -171
- package/src/bundle.ts +3 -0
- package/src/diff.ts +210 -153
- package/src/locales/en.ts +2 -0
- package/src/locales/zh.ts +2 -0
- package/src/package.ts +42 -14
- package/src/types.ts +2 -0
- package/src/utils/dep-versions.ts +76 -33
- package/src/utils/hbcTransform.ts +194 -5
- package/src/utils/hermes-base.ts +311 -81
- package/src/utils/http-helper.ts +24 -13
- package/src/utils/index.ts +136 -26
- package/src/utils/latest-version/index.ts +82 -29
- package/src/utils/zip-entries.ts +18 -16
- package/src/utils/zip-options.ts +8 -3
- package/src/utils/zip-range.ts +436 -67
- package/src/versions.ts +34 -26
package/src/versions.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { compare, satisfies } from 'compare-versions';
|
|
3
|
-
import Table from 'tty-table';
|
|
4
3
|
import { doDelete, get, getAllPackages, post, put, uploadFile } from './api';
|
|
5
4
|
import { getPlatform, getSelectedApp } from './app';
|
|
6
5
|
import { choosePackage } from './package';
|
|
7
6
|
import type { Package, Platform, Version } from './types';
|
|
8
|
-
import { isNonInteractive, question } from './utils';
|
|
9
|
-
import {
|
|
7
|
+
import { isNonInteractive, loadTtyTable, question } from './utils';
|
|
8
|
+
import { getDepVersions } from './utils/dep-versions';
|
|
10
9
|
import { getCommitInfo } from './utils/git';
|
|
11
10
|
import { getHbcVersion } from './utils/hbcTransform';
|
|
12
11
|
import {
|
|
@@ -18,7 +17,10 @@ import {
|
|
|
18
17
|
} from './utils/hermes-base';
|
|
19
18
|
import { t } from './utils/i18n';
|
|
20
19
|
import { getBooleanOption, getStringListOption } from './utils/options';
|
|
21
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
bundleLocationFields,
|
|
22
|
+
readZipEntryWithLocation,
|
|
23
|
+
} from './utils/zip-range';
|
|
22
24
|
|
|
23
25
|
interface VersionCommandOptions {
|
|
24
26
|
[key: string]: unknown;
|
|
@@ -231,6 +233,8 @@ function printDepsChangesForPackage({
|
|
|
231
233
|
),
|
|
232
234
|
);
|
|
233
235
|
console.log(summaryText);
|
|
236
|
+
// tty-table is ~25 ms to load; only pay for it when a table is rendered
|
|
237
|
+
const Table = loadTtyTable();
|
|
234
238
|
console.log(Table(header, rows).render());
|
|
235
239
|
console.log(chalk.yellow(t('depsChangeRiskWarning')));
|
|
236
240
|
return true;
|
|
@@ -476,27 +480,22 @@ async function describePpkBundle(
|
|
|
476
480
|
// server version — strict, tolerant or too old to know the field — accepts.
|
|
477
481
|
const meta: Record<string, unknown> = {};
|
|
478
482
|
try {
|
|
479
|
-
|
|
483
|
+
// one pass over the ppk: the bundle itself plus where its compressed
|
|
484
|
+
// bytes live, so the next build can fetch just them with one HTTP Range
|
|
485
|
+
// request
|
|
486
|
+
const found = ppkPath.toLowerCase().endsWith('.ppk')
|
|
487
|
+
? await readZipEntryWithLocation(ppkPath, (name) =>
|
|
488
|
+
BUNDLE_ENTRY_NAMES.includes(name),
|
|
489
|
+
).catch(() => null)
|
|
490
|
+
: null;
|
|
491
|
+
const bundle = found?.data ?? (await extractBundleFromArchive(ppkPath));
|
|
480
492
|
if (bundle) {
|
|
481
|
-
|
|
493
|
+
const bundleHash = sha256Hex(bundle);
|
|
494
|
+
meta.bundleHash = bundleHash;
|
|
482
495
|
const hbcVersion = getHbcVersion(bundle) ?? base?.bytecodeVersion;
|
|
483
496
|
if (hbcVersion != null) meta.bytecodeVersion = hbcVersion;
|
|
484
|
-
await cachePut(bundle).catch(() => {});
|
|
485
|
-
|
|
486
|
-
// build can fetch just them with one HTTP Range request
|
|
487
|
-
const location = await locateZipEntry(ppkPath, (name) =>
|
|
488
|
-
BUNDLE_ENTRY_NAMES.includes(name),
|
|
489
|
-
).catch(() => null);
|
|
490
|
-
if (
|
|
491
|
-
location &&
|
|
492
|
-
location.compressedSize > 0 &&
|
|
493
|
-
(location.compressionMethod === ZIP_STORED ||
|
|
494
|
-
location.compressionMethod === ZIP_DEFLATED)
|
|
495
|
-
) {
|
|
496
|
-
meta.bundleOffset = location.dataOffset;
|
|
497
|
-
meta.bundleCompressedSize = location.compressedSize;
|
|
498
|
-
meta.bundleCompression = location.compressionMethod;
|
|
499
|
-
}
|
|
497
|
+
await cachePut(bundle, undefined, bundleHash).catch(() => {});
|
|
498
|
+
Object.assign(meta, bundleLocationFields(found?.location));
|
|
500
499
|
}
|
|
501
500
|
} catch {
|
|
502
501
|
// best effort: metadata never blocks a publish
|
|
@@ -534,8 +533,16 @@ export const versionCommands = {
|
|
|
534
533
|
const nonInteractive =
|
|
535
534
|
getBooleanOption(options, 'no-interactive', false) || isNonInteractive();
|
|
536
535
|
|
|
537
|
-
|
|
538
|
-
|
|
536
|
+
// Hashing/caching the bundle and asking git for the commit are independent
|
|
537
|
+
// of the upload, so they overlap with it instead of running afterwards.
|
|
538
|
+
// describePpkBundle never rejects (best effort); a failed upload still
|
|
539
|
+
// fails the publish exactly as before.
|
|
540
|
+
const [{ hash }, bundleMeta, commit] = await Promise.all([
|
|
541
|
+
uploadFile(fn, undefined, appId),
|
|
542
|
+
describePpkBundle(fn, options.hermesBase),
|
|
543
|
+
getCommitInfo(),
|
|
544
|
+
]);
|
|
545
|
+
const depVersions = getDepVersions();
|
|
539
546
|
|
|
540
547
|
const versionName =
|
|
541
548
|
name ||
|
|
@@ -551,7 +558,7 @@ export const versionCommands = {
|
|
|
551
558
|
metaInfo ??
|
|
552
559
|
(nonInteractive ? '' : await question(t('versionMetaInfoQuestion'))),
|
|
553
560
|
deps: depVersions,
|
|
554
|
-
commit
|
|
561
|
+
commit,
|
|
555
562
|
// Hermes delta-mode chain metadata (old servers drop unknown fields)
|
|
556
563
|
...bundleMeta,
|
|
557
564
|
});
|
|
@@ -731,7 +738,8 @@ export const versionCommands = {
|
|
|
731
738
|
if (nonInteractive) {
|
|
732
739
|
throw new Error(t('packageIdRequired'));
|
|
733
740
|
}
|
|
734
|
-
|
|
741
|
+
// the package list was already fetched above: no second round trip
|
|
742
|
+
pkgId = String((await choosePackage(String(appId), allPkgs)).id);
|
|
735
743
|
}
|
|
736
744
|
|
|
737
745
|
if (!pkgId) {
|