react-native-update-cli 2.29.0 → 2.29.2
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/account.js +2 -4
- package/lib/api.d.ts +1 -1
- package/lib/api.js +35 -73
- package/lib/app.js +13 -27
- package/lib/auto-update.d.ts +1 -1
- package/lib/auto-update.js +6 -16
- package/lib/bin.js +4 -6
- package/lib/bundle-pack.js +26 -60
- package/lib/bundle-runner.js +89 -119
- package/lib/bundle.js +18 -26
- package/lib/diff.js +43 -133
- package/lib/locales/en.d.ts +0 -10
- package/lib/locales/en.js +0 -10
- package/lib/locales/zh.d.ts +0 -10
- package/lib/locales/zh.js +0 -10
- package/lib/native-package.js +27 -99
- package/lib/package.d.ts +6 -1
- package/lib/package.js +56 -108
- package/lib/provider.js +3 -5
- package/lib/symbolicate.js +1 -16
- package/lib/utils/add-gitignore.js +0 -1
- package/lib/utils/app-info-parser/aab.d.ts +5 -22
- package/lib/utils/app-info-parser/aab.js +89 -226
- package/lib/utils/app-info-parser/apk.d.ts +12 -13
- package/lib/utils/app-info-parser/apk.js +28 -78
- package/lib/utils/app-info-parser/ipa.d.ts +2 -14
- package/lib/utils/app-info-parser/ipa.js +9 -70
- package/lib/utils/app-info-parser/resource-finder.d.ts +1 -34
- package/lib/utils/app-info-parser/resource-finder.js +95 -234
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +6 -55
- package/lib/utils/app-info-parser/xml-parser/binary.js +152 -556
- package/lib/utils/app-info-parser/zip.d.ts +6 -24
- package/lib/utils/app-info-parser/zip.js +19 -86
- package/lib/utils/check-plugin.d.ts +7 -5
- package/lib/utils/check-plugin.js +15 -25
- package/lib/utils/dep-versions.d.ts +0 -6
- package/lib/utils/dep-versions.js +2 -27
- package/lib/utils/failure-fingerprint.js +3 -4
- package/lib/utils/fs-helpers.d.ts +18 -0
- package/lib/utils/fs-helpers.js +84 -0
- package/lib/utils/git.d.ts +0 -1
- package/lib/utils/git.js +0 -8
- package/lib/utils/hash.d.ts +3 -0
- package/lib/utils/hash.js +19 -0
- package/lib/utils/hbcTransform.d.ts +9 -2
- package/lib/utils/hbcTransform.js +41 -70
- package/lib/utils/hermes-base.d.ts +1 -5
- package/lib/utils/hermes-base.js +136 -196
- package/lib/utils/hermes-literals.d.ts +5 -3
- package/lib/utils/hermes-literals.js +30 -53
- package/lib/utils/hermes-raw.d.ts +7 -0
- package/lib/utils/hermes-raw.js +26 -9
- package/lib/utils/http-helper.d.ts +0 -1
- package/lib/utils/http-helper.js +0 -20
- package/lib/utils/i18n.js +0 -2
- package/lib/utils/index.d.ts +5 -19
- package/lib/utils/index.js +95 -189
- package/lib/utils/latest-version.d.ts +19 -0
- package/lib/utils/latest-version.js +137 -0
- package/lib/utils/options.d.ts +2 -1
- package/lib/utils/options.js +5 -7
- package/lib/utils/runtime.d.ts +1 -1
- package/lib/utils/runtime.js +2 -10
- package/lib/utils/upload-request.d.ts +33 -0
- package/lib/utils/upload-request.js +120 -0
- package/lib/utils/zip-entries.d.ts +23 -0
- package/lib/utils/zip-entries.js +130 -139
- package/lib/utils/zip-options.js +29 -56
- package/lib/utils/zip-range.js +29 -69
- package/lib/utils/zip-raw-writer.js +6 -5
- package/lib/versions.d.ts +5 -0
- package/lib/versions.js +86 -153
- package/package.json +1 -9
- package/lib/utils/app-info-parser/app.d.ts +0 -4
- package/lib/utils/app-info-parser/app.js +0 -10
- package/lib/utils/app-info-parser/index.d.ts +0 -16
- package/lib/utils/app-info-parser/index.js +0 -46
- package/lib/utils/app-info-parser/utils.d.ts +0 -31
- package/lib/utils/app-info-parser/utils.js +0 -135
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +0 -10
- package/lib/utils/app-info-parser/xml-parser/manifest.js +0 -202
- package/lib/utils/latest-version/index.d.ts +0 -149
- package/lib/utils/latest-version/index.js +0 -326
- package/lib/utils/plugin-config.d.ts +0 -9
- package/lib/utils/plugin-config.js +0 -61
|
@@ -25,10 +25,12 @@ export type LiteralBuffers = {
|
|
|
25
25
|
shapes: Buffer;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* The literal buffers of an HBC file's bytes, as views into them. Null for a
|
|
29
|
+
* file whose layout is unknown: the caller then falls back to comparing the
|
|
30
|
+
* dumped buffers as a whole.
|
|
31
31
|
*/
|
|
32
|
+
export declare function literalBuffersFromBytes(bytes: Buffer): LiteralBuffers | null;
|
|
33
|
+
/** {@link literalBuffersFromBytes} for a file. */
|
|
32
34
|
export declare function readLiteralBuffers(file: string): Promise<LiteralBuffers | null>;
|
|
33
35
|
/**
|
|
34
36
|
* Decode `count` literal values starting at byte `offset`. Null when the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LiteralResolver = void 0;
|
|
4
|
+
exports.literalBuffersFromBytes = literalBuffersFromBytes;
|
|
4
5
|
exports.readLiteralBuffers = readLiteralBuffers;
|
|
5
6
|
exports.decodeSerializedLiterals = decodeSerializedLiterals;
|
|
6
7
|
exports.renderLiteral = renderLiteral;
|
|
@@ -30,7 +31,7 @@ exports.renderLiteral = renderLiteral;
|
|
|
30
31
|
* - HBC v87–96 (`split`): arrayBuffer, objKeyBuffer, objValueBuffer.
|
|
31
32
|
* `NewArrayWithBuffer dst, sizeHint, count, arrayOffset`;
|
|
32
33
|
* `NewObjectWithBuffer dst, sizeHint, count, keyOffset, valueOffset`.
|
|
33
|
-
* - HBC v98 (`shaped`): literalValueBuffer (array elements and object values
|
|
34
|
+
* - HBC v98 and v99 (`shaped`): literalValueBuffer (array elements and object values
|
|
34
35
|
* alike), objKeyBuffer, objShapeTable (8-byte entries: keyOffset u32,
|
|
35
36
|
* numProps u32). `NewArrayWithBuffer dst, sizeHint, count, valueOffset`;
|
|
36
37
|
* `NewObjectWithBuffer dst, shapeIndex, valueOffset` and
|
|
@@ -38,7 +39,6 @@ exports.renderLiteral = renderLiteral;
|
|
|
38
39
|
*/
|
|
39
40
|
const promises_1 = require("node:fs/promises");
|
|
40
41
|
const hbcTransform_1 = require("./hbcTransform");
|
|
41
|
-
const HBC_HEADER_SIZE = 128;
|
|
42
42
|
const TAG_TYPE_MASK = 0x70;
|
|
43
43
|
const TAG_LENGTH_CONTINUES = 0x80;
|
|
44
44
|
const TAG_LENGTH_LOW = 0x0f;
|
|
@@ -56,61 +56,38 @@ var Tag;
|
|
|
56
56
|
})(Tag || (Tag = {}));
|
|
57
57
|
const SHAPE_ENTRY_SIZE = 8;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* The literal buffers of an HBC file's bytes, as views into them. Null for a
|
|
60
|
+
* file whose layout is unknown: the caller then falls back to comparing the
|
|
61
|
+
* dumped buffers as a whole.
|
|
62
62
|
*/
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
const ranges = names.map((name) => resolved.sections.get(name));
|
|
78
|
-
if (ranges.some((r) => !r))
|
|
79
|
-
return null;
|
|
80
|
-
const bufs = await Promise.all(ranges.map(async (r) => {
|
|
81
|
-
const buf = Buffer.alloc(r.size);
|
|
82
|
-
if (r.size === 0)
|
|
83
|
-
return buf;
|
|
84
|
-
const { bytesRead } = await handle.read(buf, 0, r.size, r.start);
|
|
85
|
-
return bytesRead === r.size ? buf : null;
|
|
86
|
-
}));
|
|
87
|
-
return bufs.some((b) => !b) ? null : bufs;
|
|
88
|
-
};
|
|
89
|
-
const { version } = resolved;
|
|
90
|
-
if (resolved.sections.has('objShapeTable')) {
|
|
91
|
-
const bufs = await readRanges([
|
|
92
|
-
'literalValueBuffer',
|
|
93
|
-
'objKeyBuffer',
|
|
94
|
-
'objShapeTable',
|
|
95
|
-
]);
|
|
96
|
-
if (!bufs)
|
|
97
|
-
return null;
|
|
98
|
-
const [values, objectKeys, shapes] = bufs;
|
|
99
|
-
return { layout: 'shaped', version, values, objectKeys, shapes };
|
|
100
|
-
}
|
|
101
|
-
const bufs = await readRanges([
|
|
102
|
-
'arrayBuffer',
|
|
103
|
-
'objKeyBuffer',
|
|
104
|
-
'objValueBuffer',
|
|
105
|
-
]);
|
|
63
|
+
function literalBuffersFromBytes(bytes) {
|
|
64
|
+
const resolved = (0, hbcTransform_1.resolveHbcSections)(bytes, bytes.length);
|
|
65
|
+
if (!resolved)
|
|
66
|
+
return null;
|
|
67
|
+
// resolveHbcSections keeps every section inside the file
|
|
68
|
+
const views = (names) => {
|
|
69
|
+
const ranges = names.map((name) => resolved.sections.get(name));
|
|
70
|
+
return ranges.every(Boolean)
|
|
71
|
+
? ranges.map((r) => bytes.subarray(r.start, r.start + r.size))
|
|
72
|
+
: null;
|
|
73
|
+
};
|
|
74
|
+
const { version } = resolved;
|
|
75
|
+
if (resolved.sections.has('objShapeTable')) {
|
|
76
|
+
const bufs = views(['literalValueBuffer', 'objKeyBuffer', 'objShapeTable']);
|
|
106
77
|
if (!bufs)
|
|
107
78
|
return null;
|
|
108
|
-
const [
|
|
109
|
-
return { layout: '
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
await handle.close();
|
|
79
|
+
const [values, objectKeys, shapes] = bufs;
|
|
80
|
+
return { layout: 'shaped', version, values, objectKeys, shapes };
|
|
113
81
|
}
|
|
82
|
+
const bufs = views(['arrayBuffer', 'objKeyBuffer', 'objValueBuffer']);
|
|
83
|
+
if (!bufs)
|
|
84
|
+
return null;
|
|
85
|
+
const [array, objectKeys, objectValues] = bufs;
|
|
86
|
+
return { layout: 'split', version, array, objectKeys, objectValues };
|
|
87
|
+
}
|
|
88
|
+
/** {@link literalBuffersFromBytes} for a file. */
|
|
89
|
+
async function readLiteralBuffers(file) {
|
|
90
|
+
return literalBuffersFromBytes(await (0, promises_1.readFile)(file));
|
|
114
91
|
}
|
|
115
92
|
/**
|
|
116
93
|
* Decode `count` literal values starting at byte `offset`. Null when the
|
|
@@ -26,6 +26,13 @@ export interface HermesSemanticData {
|
|
|
26
26
|
}
|
|
27
27
|
/** Read exact strings (including UTF-16 code units) and function identities. */
|
|
28
28
|
export declare function readHermesSemanticData(file: string): Promise<HermesSemanticData>;
|
|
29
|
+
/** {@link readHermesSemanticData} for HBC bytes already in memory. */
|
|
30
|
+
export declare function hermesSemanticData(bytes: Buffer): HermesSemanticData;
|
|
31
|
+
/** Remove encoding-width suffixes; operand values remain part of the audit. */
|
|
32
|
+
/** The opcode without its operand-width suffix (`GetByIdLong` → `GetById`). */
|
|
33
|
+
export declare function foldWidthSuffix(opcode: string): string;
|
|
34
|
+
/** The first line of a function in either dump. */
|
|
35
|
+
export declare function isFunctionHeader(line: string): boolean;
|
|
29
36
|
/** Canonicalize one complete function; addresses become instruction ordinals. */
|
|
30
37
|
export declare function normalizeRawHermesFunction(lines: string[], data: HermesSemanticData, functionIndex: number, buffers: LiteralBuffers): string[];
|
|
31
38
|
export interface RawAuditResult {
|
package/lib/utils/hermes-raw.js
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.UnverifiableHermesBytecode = void 0;
|
|
13
13
|
exports.readHermesSemanticData = readHermesSemanticData;
|
|
14
|
+
exports.hermesSemanticData = hermesSemanticData;
|
|
15
|
+
exports.foldWidthSuffix = foldWidthSuffix;
|
|
16
|
+
exports.isFunctionHeader = isFunctionHeader;
|
|
14
17
|
exports.normalizeRawHermesFunction = normalizeRawHermesFunction;
|
|
15
18
|
exports.auditRawHermesBytecode = auditRawHermesBytecode;
|
|
16
19
|
const promises_1 = require("node:fs/promises");
|
|
@@ -41,7 +44,10 @@ function checkedSlice(data, start, length) {
|
|
|
41
44
|
}
|
|
42
45
|
/** Read exact strings (including UTF-16 code units) and function identities. */
|
|
43
46
|
async function readHermesSemanticData(file) {
|
|
44
|
-
|
|
47
|
+
return hermesSemanticData(await (0, promises_1.readFile)(file));
|
|
48
|
+
}
|
|
49
|
+
/** {@link readHermesSemanticData} for HBC bytes already in memory. */
|
|
50
|
+
function hermesSemanticData(bytes) {
|
|
45
51
|
const resolved = requireValue((0, hbcTransform_1.resolveHbcSections)(bytes, bytes.length), 'unsupported or unreadable HBC layout');
|
|
46
52
|
// A newly added diff-transform layout must not silently opt into semantic
|
|
47
53
|
// parsing: function header and operand schemas need an independent review.
|
|
@@ -50,7 +56,7 @@ async function readHermesSemanticData(file) {
|
|
|
50
56
|
resolved.version === 99)) {
|
|
51
57
|
throw new UnverifiableHermesBytecode('unsupported semantic HBC version');
|
|
52
58
|
}
|
|
53
|
-
const layout =
|
|
59
|
+
const { layout } = resolved;
|
|
54
60
|
const section = (name) => {
|
|
55
61
|
const r = requireValue(resolved.sections.get(name), `missing ${name}`);
|
|
56
62
|
return checkedSlice(bytes, r.start, r.size);
|
|
@@ -232,8 +238,18 @@ const STRING_OPERANDS = {
|
|
|
232
238
|
CreateRegExp: [1, 2],
|
|
233
239
|
};
|
|
234
240
|
/** Remove encoding-width suffixes; operand values remain part of the audit. */
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
/** The opcode without its operand-width suffix (`GetByIdLong` → `GetById`). */
|
|
242
|
+
function foldWidthSuffix(opcode) {
|
|
243
|
+
for (const suffix of ['LongIndex', 'Long', 'Short']) {
|
|
244
|
+
if (opcode.length > suffix.length && opcode.endsWith(suffix)) {
|
|
245
|
+
return opcode.slice(0, -suffix.length);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return opcode;
|
|
249
|
+
}
|
|
250
|
+
/** The first line of a function in either dump. */
|
|
251
|
+
function isFunctionHeader(line) {
|
|
252
|
+
return /^(?:Function|NCFunction|Constructor)</.test(line);
|
|
237
253
|
}
|
|
238
254
|
/**
|
|
239
255
|
* Read raw operand boundaries and verify integer values against the HBC bytes.
|
|
@@ -304,7 +320,7 @@ function normalizeRawHermesFunction(lines, data, functionIndex, buffers) {
|
|
|
304
320
|
const literal = new hermes_literals_1.LiteralResolver(buffers, data.strings);
|
|
305
321
|
const output = [fn.metadata];
|
|
306
322
|
for (const inst of instructions) {
|
|
307
|
-
const op =
|
|
323
|
+
const op = foldWidthSuffix(inst.opcode);
|
|
308
324
|
const values = inst.operands.map((o) => o.value);
|
|
309
325
|
const refs = STRING_OPERANDS[op] ?? [];
|
|
310
326
|
const operands = inst.operands.map((operand, i) => {
|
|
@@ -437,15 +453,16 @@ async function auditRawHermesBytecode(command, files, data, buffers, signal) {
|
|
|
437
453
|
const functions = async function* (side) {
|
|
438
454
|
let lines = null;
|
|
439
455
|
let index = 0;
|
|
456
|
+
const normalize = (body) => normalizeRawHermesFunction(body, data[side], index++, buffers[side]);
|
|
440
457
|
for await (const line of linesOf(children[side].stdout)) {
|
|
441
|
-
if (
|
|
458
|
+
if (isFunctionHeader(line)) {
|
|
442
459
|
if (lines)
|
|
443
|
-
yield
|
|
460
|
+
yield normalize(lines);
|
|
444
461
|
lines = [];
|
|
445
462
|
}
|
|
446
463
|
else if (/^(?:RegExp Bytecodes:|Debug |Textified callees table)/.test(line)) {
|
|
447
464
|
if (lines)
|
|
448
|
-
yield
|
|
465
|
+
yield normalize(lines);
|
|
449
466
|
lines = null;
|
|
450
467
|
}
|
|
451
468
|
else if (lines) {
|
|
@@ -453,7 +470,7 @@ async function auditRawHermesBytecode(command, files, data, buffers, signal) {
|
|
|
453
470
|
}
|
|
454
471
|
}
|
|
455
472
|
if (lines)
|
|
456
|
-
yield
|
|
473
|
+
yield normalize(lines);
|
|
457
474
|
const error = await exits[side];
|
|
458
475
|
if (error)
|
|
459
476
|
throw new UnverifiableHermesBytecode(`${side === 0 ? 'base' : 'plain'} raw dump: ${error}`);
|
package/lib/utils/http-helper.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBaseUrl = exports.testUrls = exports.ping = void 0;
|
|
4
|
-
exports.promiseAny = promiseAny;
|
|
5
4
|
const constants_1 = require("./constants");
|
|
6
5
|
const runtime_1 = require("./runtime");
|
|
7
|
-
// const baseUrl = `http://localhost:9000`;
|
|
8
|
-
// let baseUrl = SERVER.main[0];
|
|
9
|
-
// const baseUrl = `https://p.reactnative.cn/api`;
|
|
10
|
-
function promiseAny(promises) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
let count = 0;
|
|
13
|
-
for (const promise of promises) {
|
|
14
|
-
Promise.resolve(promise)
|
|
15
|
-
.then(resolve)
|
|
16
|
-
.catch(() => {
|
|
17
|
-
count++;
|
|
18
|
-
if (count === promises.length) {
|
|
19
|
-
reject(new Error('All promises were rejected'));
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
6
|
const ping = async (url, signal) => {
|
|
26
7
|
let timer;
|
|
27
8
|
try {
|
|
@@ -123,7 +104,6 @@ async function resolveBaseUrl() {
|
|
|
123
104
|
// remove /status
|
|
124
105
|
baseUrl = ret.replace('/status', '');
|
|
125
106
|
}
|
|
126
|
-
// console.log('baseUrl', baseUrl);
|
|
127
107
|
return baseUrl;
|
|
128
108
|
}
|
|
129
109
|
/**
|
package/lib/utils/i18n.js
CHANGED
|
@@ -23,8 +23,6 @@ function resolveLanguage(env = process.env, isCresc = constants_1.IS_CRESC) {
|
|
|
23
23
|
}
|
|
24
24
|
i18next_1.default.init({
|
|
25
25
|
lng: resolveLanguage(),
|
|
26
|
-
// debug: process.env.NODE_ENV !== 'production',
|
|
27
|
-
// debug: true,
|
|
28
26
|
resources: {
|
|
29
27
|
en: {
|
|
30
28
|
translation: en_1.default,
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -7,27 +7,13 @@ export declare function loadTtyTable(): typeof import('tty-table');
|
|
|
7
7
|
/** True when prompts cannot or must not be shown. */
|
|
8
8
|
export declare function isNonInteractive(env?: NodeJS.ProcessEnv, stdinIsTTY?: boolean | undefined, globalFlag?: boolean | undefined): boolean;
|
|
9
9
|
export declare function question(query: string, password?: boolean): Promise<string>;
|
|
10
|
-
|
|
10
|
+
/** Expand `${name}` placeholders in string options from other options or the environment. */
|
|
11
|
+
export declare function translateOptions<T extends Record<string, unknown>>(options: T): T & Record<string, unknown>;
|
|
11
12
|
export declare const ApkBundleFileName: RegExp;
|
|
12
|
-
export declare function getApkInfo(fn: string): Promise<
|
|
13
|
-
|
|
14
|
-
buildTime: number;
|
|
15
|
-
bundleHash: string;
|
|
16
|
-
bundleFile: Blob | Buffer<ArrayBufferLike>;
|
|
17
|
-
}>;
|
|
18
|
-
export declare function getAppInfo(fn: string): Promise<{
|
|
19
|
-
versionName: string | undefined;
|
|
20
|
-
buildTime: number;
|
|
21
|
-
bundleHash: string;
|
|
22
|
-
bundleFile: Buffer<ArrayBufferLike>;
|
|
23
|
-
}>;
|
|
13
|
+
export declare function getApkInfo(fn: string): Promise<any>;
|
|
14
|
+
export declare function getAppInfo(fn: string): Promise<any>;
|
|
24
15
|
export declare const IpaBundleFileName: RegExp;
|
|
25
|
-
export declare function getIpaInfo(fn: string): Promise<
|
|
26
|
-
versionName: string;
|
|
27
|
-
buildTime: string;
|
|
28
|
-
bundleHash: string;
|
|
29
|
-
bundleFile: Blob | Buffer<ArrayBufferLike>;
|
|
30
|
-
}>;
|
|
16
|
+
export declare function getIpaInfo(fn: string): Promise<any>;
|
|
31
17
|
export declare function getAabInfo(fn: string): Promise<{
|
|
32
18
|
versionName: string;
|
|
33
19
|
buildTime: number;
|