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
|
@@ -16,22 +16,24 @@
|
|
|
16
16
|
* (只要两侧使用同一份描述表)。
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.HBC_TRANSFORM_VERSION = exports.HBC_LAYOUTS = void 0;
|
|
19
|
+
exports.HBC_TRANSFORM_VERSION = exports.HBC_LAYOUTS = exports.HBC_HEADER_SIZE = exports.HBC_MAGIC = void 0;
|
|
20
20
|
exports.compileLayoutToWire = compileLayoutToWire;
|
|
21
21
|
exports.getHbcVersion = getHbcVersion;
|
|
22
22
|
exports.findLayouts = findLayouts;
|
|
23
23
|
exports.resolveHbcSections = resolveHbcSections;
|
|
24
24
|
exports.transformHbc = transformHbc;
|
|
25
|
-
exports.pickLayout = pickLayout;
|
|
26
25
|
exports.transformHbcWithLayout = transformHbcWithLayout;
|
|
27
26
|
exports.transformHbcWithLayoutInPlace = transformHbcWithLayoutInPlace;
|
|
27
|
+
exports.readHbcFileHeader = readHbcFileHeader;
|
|
28
28
|
exports.transformHbcFile = transformHbcFile;
|
|
29
29
|
exports.tryTransformPair = tryTransformPair;
|
|
30
30
|
exports.tryTransformPairFiles = tryTransformPairFiles;
|
|
31
31
|
const promises_1 = require("node:fs/promises");
|
|
32
|
-
|
|
32
|
+
exports.HBC_MAGIC = Buffer.from([
|
|
33
|
+
0xc6, 0x1f, 0xbc, 0x03, 0xc1, 0x03, 0x19, 0x1f,
|
|
34
|
+
]);
|
|
33
35
|
const HEADER_COUNTS_OFFSET = 32; // magic(8) + version(4) + sourceHash(20)
|
|
34
|
-
|
|
36
|
+
exports.HBC_HEADER_SIZE = 128;
|
|
35
37
|
const FUNC_OFFSET_25 = { byte: 0, bit: 0, bits: 25 };
|
|
36
38
|
const STRING_OFFSET_23 = { byte: 0, bit: 1, bits: 23 };
|
|
37
39
|
const PAIR_OFFSET_32 = { byte: 0, bit: 0, bits: 32 };
|
|
@@ -205,16 +207,10 @@ exports.HBC_LAYOUTS = [
|
|
|
205
207
|
// 多一个 numStringSwitchImms 槽(hermes static_h 在不 bump 版本号的
|
|
206
208
|
// 情况下插入,同一版本号 98 因此存在两种布局,依结构校验区分)。
|
|
207
209
|
// 段布局与早期 v98 相同。
|
|
208
|
-
|
|
209
|
-
maxVersion: 98,
|
|
210
|
-
headerFields: V98_LATE_HEADER_FIELDS,
|
|
211
|
-
sections: V98_SECTIONS,
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
// Hermes V1 v99(hermes-compiler 260318099,RN 0.88+):文件头与段布局
|
|
210
|
+
// Hermes V1 v99(hermes-compiler 260318099,RN 0.88+)文件头与段布局
|
|
215
211
|
// 同晚期 v98,只改了函数头内部位域(去 NumCacheNewObject)与操作码表,
|
|
216
212
|
// 二者都不在本变换触及的范围内。
|
|
217
|
-
minVersion:
|
|
213
|
+
minVersion: 98,
|
|
218
214
|
maxVersion: 99,
|
|
219
215
|
headerFields: V98_LATE_HEADER_FIELDS,
|
|
220
216
|
sections: V98_SECTIONS,
|
|
@@ -226,27 +222,7 @@ exports.HBC_LAYOUTS = [
|
|
|
226
222
|
// arrayBufferSize 更名 literalValueBufferSize(槽位不变)。
|
|
227
223
|
minVersion: 98,
|
|
228
224
|
maxVersion: 98,
|
|
229
|
-
headerFields:
|
|
230
|
-
'fileLength',
|
|
231
|
-
'globalCodeIndex',
|
|
232
|
-
'functionCount',
|
|
233
|
-
'stringKindCount',
|
|
234
|
-
'identifierCount',
|
|
235
|
-
'stringCount',
|
|
236
|
-
'overflowStringCount',
|
|
237
|
-
'stringStorageSize',
|
|
238
|
-
'bigIntCount',
|
|
239
|
-
'bigIntStorageSize',
|
|
240
|
-
'regExpCount',
|
|
241
|
-
'regExpStorageSize',
|
|
242
|
-
'literalValueBufferSize',
|
|
243
|
-
'objKeyBufferSize',
|
|
244
|
-
'objShapeTableCount',
|
|
245
|
-
'segmentID',
|
|
246
|
-
'cjsModuleCount',
|
|
247
|
-
'functionSourceCount',
|
|
248
|
-
'debugInfoOffset',
|
|
249
|
-
],
|
|
225
|
+
headerFields: V98_LATE_HEADER_FIELDS.filter((field) => field !== 'numStringSwitchImms'),
|
|
250
226
|
sections: V98_SECTIONS,
|
|
251
227
|
},
|
|
252
228
|
];
|
|
@@ -265,9 +241,9 @@ function compileLayoutToWire(layout) {
|
|
|
265
241
|
};
|
|
266
242
|
}
|
|
267
243
|
function getHbcVersion(buf) {
|
|
268
|
-
if (buf.length < HBC_HEADER_SIZE)
|
|
244
|
+
if (buf.length < exports.HBC_HEADER_SIZE)
|
|
269
245
|
return null;
|
|
270
|
-
if (!buf.subarray(0, 8).equals(HBC_MAGIC))
|
|
246
|
+
if (!buf.subarray(0, 8).equals(exports.HBC_MAGIC))
|
|
271
247
|
return null;
|
|
272
248
|
return buf.readUInt32LE(8);
|
|
273
249
|
}
|
|
@@ -290,9 +266,9 @@ function resolveSections(buf, layout) {
|
|
|
290
266
|
*/
|
|
291
267
|
function resolveSectionsFromHeader(header, fileLength, layout) {
|
|
292
268
|
const headerEnd = HEADER_COUNTS_OFFSET + layout.headerFields.length * 4;
|
|
293
|
-
if (header.length < HBC_HEADER_SIZE ||
|
|
294
|
-
fileLength < HBC_HEADER_SIZE ||
|
|
295
|
-
headerEnd > HBC_HEADER_SIZE) {
|
|
269
|
+
if (header.length < exports.HBC_HEADER_SIZE ||
|
|
270
|
+
fileLength < exports.HBC_HEADER_SIZE ||
|
|
271
|
+
headerEnd > exports.HBC_HEADER_SIZE) {
|
|
296
272
|
return null;
|
|
297
273
|
}
|
|
298
274
|
const counts = {};
|
|
@@ -303,12 +279,12 @@ function resolveSectionsFromHeader(header, fileLength, layout) {
|
|
|
303
279
|
return null;
|
|
304
280
|
const debugInfoOffset = counts.debugInfoOffset;
|
|
305
281
|
if (!Number.isInteger(debugInfoOffset) ||
|
|
306
|
-
debugInfoOffset < HBC_HEADER_SIZE ||
|
|
282
|
+
debugInfoOffset < exports.HBC_HEADER_SIZE ||
|
|
307
283
|
debugInfoOffset > fileLength) {
|
|
308
284
|
return null;
|
|
309
285
|
}
|
|
310
286
|
const resolved = [];
|
|
311
|
-
let off = HBC_HEADER_SIZE;
|
|
287
|
+
let off = exports.HBC_HEADER_SIZE;
|
|
312
288
|
for (const desc of layout.sections) {
|
|
313
289
|
const count = counts[desc.countField];
|
|
314
290
|
if (count === undefined || count > 0x0fffffff)
|
|
@@ -346,6 +322,7 @@ function resolveHbcSections(header, fileLength) {
|
|
|
346
322
|
if (resolved) {
|
|
347
323
|
return {
|
|
348
324
|
version,
|
|
325
|
+
layout,
|
|
349
326
|
sections: new Map(resolved.map((s) => [s.desc.name, { start: s.start, size: s.size }])),
|
|
350
327
|
};
|
|
351
328
|
}
|
|
@@ -426,9 +403,9 @@ function applyDeltaSections(out, sections, inverse) {
|
|
|
426
403
|
/** 读取文件头 128 字节与总长;文件过短或非 HBC 时返回 null。 */
|
|
427
404
|
async function readHbcFileHeader(filePath) {
|
|
428
405
|
const { size } = await (0, promises_1.stat)(filePath);
|
|
429
|
-
if (size < HBC_HEADER_SIZE)
|
|
406
|
+
if (size < exports.HBC_HEADER_SIZE)
|
|
430
407
|
return null;
|
|
431
|
-
const header = Buffer.alloc(HBC_HEADER_SIZE);
|
|
408
|
+
const header = Buffer.alloc(exports.HBC_HEADER_SIZE);
|
|
432
409
|
const handle = await (0, promises_1.open)(filePath, 'r');
|
|
433
410
|
try {
|
|
434
411
|
await readExact(handle, header, 0);
|
|
@@ -498,31 +475,34 @@ async function transformHbcFile(src, dst, layout, inverse) {
|
|
|
498
475
|
return true;
|
|
499
476
|
}
|
|
500
477
|
exports.HBC_TRANSFORM_VERSION = 1;
|
|
478
|
+
/** 两侧共同的 HBC 版本;任一侧不是 HBC 或版本不同时为 null */
|
|
479
|
+
function sharedHbcVersion(oldHeader, newHeader) {
|
|
480
|
+
const version = getHbcVersion(newHeader);
|
|
481
|
+
return version !== null && getHbcVersion(oldHeader) === version
|
|
482
|
+
? version
|
|
483
|
+
: null;
|
|
484
|
+
}
|
|
485
|
+
function transformMeta(hbcVersion, layout) {
|
|
486
|
+
return {
|
|
487
|
+
v: exports.HBC_TRANSFORM_VERSION,
|
|
488
|
+
hbcVersion,
|
|
489
|
+
layout: compileLayoutToWire(layout),
|
|
490
|
+
};
|
|
491
|
+
}
|
|
501
492
|
/**
|
|
502
493
|
* 若 old/new 均为同版本且存在两侧都通过结构校验的候选布局,返回变换结果、
|
|
503
494
|
* 选中布局与写入 __diff.json 的元数据;否则返回 null。
|
|
504
495
|
*/
|
|
505
496
|
function tryTransformPair(oldBuf, newBuf) {
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
if (oldVersion === null || newVersion === null || oldVersion !== newVersion) {
|
|
497
|
+
const version = sharedHbcVersion(oldBuf, newBuf);
|
|
498
|
+
if (version === null)
|
|
509
499
|
return null;
|
|
510
|
-
|
|
511
|
-
for (const layout of findLayouts(newVersion)) {
|
|
500
|
+
for (const layout of findLayouts(version)) {
|
|
512
501
|
const tOld = transformHbcWithLayout(oldBuf, layout, false);
|
|
513
502
|
const tNew = transformHbcWithLayout(newBuf, layout, false);
|
|
514
503
|
if (!tOld || !tNew)
|
|
515
504
|
continue;
|
|
516
|
-
return {
|
|
517
|
-
tOld,
|
|
518
|
-
tNew,
|
|
519
|
-
layout,
|
|
520
|
-
meta: {
|
|
521
|
-
v: exports.HBC_TRANSFORM_VERSION,
|
|
522
|
-
hbcVersion: newVersion,
|
|
523
|
-
layout: compileLayoutToWire(layout),
|
|
524
|
-
},
|
|
525
|
-
};
|
|
505
|
+
return { tOld, tNew, layout, meta: transformMeta(version, layout) };
|
|
526
506
|
}
|
|
527
507
|
return null;
|
|
528
508
|
}
|
|
@@ -538,12 +518,10 @@ async function tryTransformPairFiles(oldPath, newPath, tOldPath, tNewPath) {
|
|
|
538
518
|
]);
|
|
539
519
|
if (!oldInfo || !newInfo)
|
|
540
520
|
return null;
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
if (oldVersion === null || newVersion === null || oldVersion !== newVersion) {
|
|
521
|
+
const version = sharedHbcVersion(oldInfo.header, newInfo.header);
|
|
522
|
+
if (version === null)
|
|
544
523
|
return null;
|
|
545
|
-
|
|
546
|
-
for (const layout of findLayouts(newVersion)) {
|
|
524
|
+
for (const layout of findLayouts(version)) {
|
|
547
525
|
if (!resolveSectionsFromHeader(oldInfo.header, oldInfo.size, layout) ||
|
|
548
526
|
!resolveSectionsFromHeader(newInfo.header, newInfo.size, layout)) {
|
|
549
527
|
continue;
|
|
@@ -554,14 +532,7 @@ async function tryTransformPairFiles(oldPath, newPath, tOldPath, tNewPath) {
|
|
|
554
532
|
]);
|
|
555
533
|
if (!tOld || !tNew)
|
|
556
534
|
continue;
|
|
557
|
-
return {
|
|
558
|
-
layout,
|
|
559
|
-
meta: {
|
|
560
|
-
v: exports.HBC_TRANSFORM_VERSION,
|
|
561
|
-
hbcVersion: newVersion,
|
|
562
|
-
layout: compileLayoutToWire(layout),
|
|
563
|
-
},
|
|
564
|
-
};
|
|
535
|
+
return { layout, meta: transformMeta(version, layout) };
|
|
565
536
|
}
|
|
566
537
|
return null;
|
|
567
538
|
}
|
|
@@ -80,9 +80,6 @@ export declare function classifyHermesCommand(hermesCommand: string): {
|
|
|
80
80
|
version?: string;
|
|
81
81
|
reason?: string;
|
|
82
82
|
};
|
|
83
|
-
export declare function sha256Hex(data: Buffer): string;
|
|
84
|
-
/** sha256 of a file, streamed (a cached base can be tens of MB) */
|
|
85
|
-
export declare function sha256File(file: string): Promise<string>;
|
|
86
83
|
/** HBC version from the first bytes of a file, without reading the rest */
|
|
87
84
|
export declare function readFileHbcVersion(file: string): Promise<number | null>;
|
|
88
85
|
/**
|
|
@@ -176,7 +173,6 @@ interface FetchedBaseBundle {
|
|
|
176
173
|
export declare function fetchBaseBundle(record: HermesBaseServerRecord, artifactType: BaseArtifactType, archive: string, log?: (message: string) => void, expectHbcVersion?: number): Promise<FetchedBaseBundle>;
|
|
177
174
|
export interface ResolveHermesBaseParams {
|
|
178
175
|
option: HermesBaseOption;
|
|
179
|
-
hermesCommand: string;
|
|
180
176
|
bytecodeVersion: number;
|
|
181
177
|
appId?: string;
|
|
182
178
|
cacheMaxMb?: number;
|
|
@@ -223,7 +219,7 @@ export interface HermesEquivalenceResult {
|
|
|
223
219
|
functions: number;
|
|
224
220
|
/**
|
|
225
221
|
* `instruction`: literals decoded from the binary buffers at each
|
|
226
|
-
* New*WithBuffer instruction (HBC v87–96 and
|
|
222
|
+
* New*WithBuffer instruction (HBC v87–96, v98 and v99); `buffer`: the dumped
|
|
227
223
|
* buffers compared as a whole (unknown layout)
|
|
228
224
|
*/
|
|
229
225
|
literals?: 'instruction' | 'buffer';
|