react-native-update-cli 2.22.7 → 2.22.9
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 +11 -4
- package/lib/bundle-runner.js +176 -90
- 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/native-package.d.ts +5 -1
- package/lib/native-package.js +145 -84
- package/lib/package.d.ts +7 -3
- package/lib/package.js +22 -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 +21 -4
- package/lib/utils/hermes-base.js +146 -37
- 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 +91 -25
- 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 +47 -15
- package/lib/utils/zip-range.js +192 -83
- package/lib/utils/zip-raw-writer.d.ts +47 -0
- package/lib/utils/zip-raw-writer.js +204 -0
- package/lib/versions.js +19 -9
- package/package.json +10 -12
- package/src/api.ts +126 -46
- package/src/app.ts +3 -2
- package/src/bin.ts +17 -2
- package/src/bundle-runner.ts +225 -113
- 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/native-package.ts +186 -96
- package/src/package.ts +26 -13
- 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 +156 -45
- package/src/utils/http-helper.ts +24 -13
- package/src/utils/index.ts +136 -26
- package/src/utils/latest-version/index.ts +109 -33
- package/src/utils/zip-entries.ts +18 -16
- package/src/utils/zip-options.ts +8 -3
- package/src/utils/zip-range.ts +244 -88
- package/src/utils/zip-raw-writer.ts +247 -0
- package/src/versions.ts +17 -7
package/lib/diff.js
CHANGED
|
@@ -37,6 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.diffCommands = exports.readEntry = exports.enumZipEntries = void 0;
|
|
40
|
+
exports.zipEntryContentKey = zipEntryContentKey;
|
|
41
|
+
exports.zipEntriesHaveSameContent = zipEntriesHaveSameContent;
|
|
40
42
|
const node_crypto_1 = require("node:crypto");
|
|
41
43
|
const fs = __importStar(require("fs-extra"));
|
|
42
44
|
const global_dirs_1 = require("global-dirs");
|
|
@@ -52,6 +54,18 @@ const zip_entries_1 = require("./utils/zip-entries");
|
|
|
52
54
|
Object.defineProperty(exports, "enumZipEntries", { enumerable: true, get: function () { return zip_entries_1.enumZipEntries; } });
|
|
53
55
|
Object.defineProperty(exports, "readEntry", { enumerable: true, get: function () { return zip_entries_1.readEntry; } });
|
|
54
56
|
const zip_options_1 = require("./utils/zip-options");
|
|
57
|
+
/**
|
|
58
|
+
* 判定两个 zip entry 内容相同的键:crc32 单独并不足以证明内容一致(32 位
|
|
59
|
+
* 校验和碰撞并不罕见,尤其是长度不同的文件),必须同时要求解压后长度相等。
|
|
60
|
+
* 仅用于生成端匹配,manifest 里的 copies / copiesCrc 格式不变。
|
|
61
|
+
*/
|
|
62
|
+
function zipEntryContentKey(entry) {
|
|
63
|
+
return `${entry.crc32}:${entry.uncompressedSize}`;
|
|
64
|
+
}
|
|
65
|
+
function zipEntriesHaveSameContent(left, right) {
|
|
66
|
+
return (left.crc32 === right.crc32 &&
|
|
67
|
+
left.uncompressedSize === right.uncompressedSize);
|
|
68
|
+
}
|
|
55
69
|
const loadModule = (pkgName) => {
|
|
56
70
|
const nodePathDirs = (process.env.NODE_PATH || '')
|
|
57
71
|
.split(path_1.default.delimiter)
|
|
@@ -72,16 +86,48 @@ function basename(fn) {
|
|
|
72
86
|
function createOutputZip(output) {
|
|
73
87
|
fs.ensureDirSync(path_1.default.dirname(output));
|
|
74
88
|
const zipfile = new yazl_1.ZipFile();
|
|
89
|
+
const writeStream = fs.createWriteStream(output);
|
|
75
90
|
const writePromise = new Promise((resolve, reject) => {
|
|
76
91
|
zipfile.outputStream.on('error', reject);
|
|
77
|
-
const writeStream = fs.createWriteStream(output);
|
|
78
92
|
// without this, a full disk / read-only target left the promise pending
|
|
79
93
|
writeStream.on('error', reject);
|
|
80
94
|
zipfile.outputStream.pipe(writeStream).on('close', () => {
|
|
81
95
|
resolve(void 0);
|
|
82
96
|
});
|
|
83
97
|
});
|
|
84
|
-
|
|
98
|
+
// 失败时释放输出 fd 并删掉半成品,避免残留一个截断的 patch 包
|
|
99
|
+
const abort = async () => {
|
|
100
|
+
writePromise.catch(() => { });
|
|
101
|
+
zipfile.outputStream.unpipe(writeStream);
|
|
102
|
+
// yazl 的 outputStream 类型声明缺 destroy,运行时是 PassThrough
|
|
103
|
+
zipfile.outputStream.destroy();
|
|
104
|
+
if (!writeStream.closed) {
|
|
105
|
+
// 等 fd 真正关闭再删文件,避免 Windows 上删除被占用文件失败
|
|
106
|
+
await new Promise((resolve) => {
|
|
107
|
+
writeStream.once('close', () => resolve());
|
|
108
|
+
if (!writeStream.destroyed) {
|
|
109
|
+
writeStream.destroy();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
await fs.rm(output, { force: true });
|
|
114
|
+
};
|
|
115
|
+
return { zipfile, writePromise, abort };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 打开输出包,执行 build 填充条目并返回 manifest,最后写入 __diff.json
|
|
119
|
+
* 收尾。build 或收尾任何一步失败都会关闭输出流、删除半成品并重新抛出。
|
|
120
|
+
*/
|
|
121
|
+
async function writeDiffZip(output, build) {
|
|
122
|
+
const { zipfile, writePromise, abort } = createOutputZip(output);
|
|
123
|
+
try {
|
|
124
|
+
const manifest = await build(zipfile);
|
|
125
|
+
await finishDiffZip(zipfile, writePromise, manifest);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
await abort();
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
85
131
|
}
|
|
86
132
|
// baseline patch 小于该值时跳过变换尝试:节省一次 diff 的 CPU,
|
|
87
133
|
// 且此时变换收益上限(~25%)也抵不过元数据开销
|
|
@@ -125,10 +171,10 @@ async function filesEqual(leftPath, rightPath) {
|
|
|
125
171
|
return leftHash === rightHash;
|
|
126
172
|
}
|
|
127
173
|
/**
|
|
128
|
-
* 大 bundle
|
|
129
|
-
* 避免 old/new/restored 的整块 Buffer 副本。HBC
|
|
130
|
-
*
|
|
131
|
-
*
|
|
174
|
+
* 大 bundle 流式路径:bundle 直接从 ZIP entry 落盘后传入 native,
|
|
175
|
+
* 避免 old/new/restored 的整块 Buffer 副本。HBC 变换 T/T⁻¹ 也在文件上
|
|
176
|
+
* 按段定位改写(transformHbcFile),全程不持有整个 bundle。native 已
|
|
177
|
+
* 自校验的普通产物不再重复 patch;自定义/变换路径仍保留 round-trip 校验。
|
|
132
178
|
*/
|
|
133
179
|
async function buildStreamBundlePatch(originSource, newSource, options, workRoot) {
|
|
134
180
|
const diffStreamFn = options.diffStreamFn;
|
|
@@ -143,23 +189,12 @@ async function buildStreamBundlePatch(originSource, newSource, options, workRoot
|
|
|
143
189
|
let phaseStartedAt = performance.now();
|
|
144
190
|
const rawOldFile = await bundleSourceFile(originSource, path_1.default.join(tempRoot, 'old.bin'));
|
|
145
191
|
const rawNewFile = await bundleSourceFile(newSource, path_1.default.join(tempRoot, 'new.bin'));
|
|
146
|
-
|
|
147
|
-
? await bundleSourceBuffer(originSource)
|
|
148
|
-
: null;
|
|
149
|
-
const newBuffer = options.hbcTransform
|
|
150
|
-
? await bundleSourceBuffer(newSource)
|
|
151
|
-
: null;
|
|
152
|
-
const pair = originBuffer && newBuffer
|
|
153
|
-
? (0, hbcTransform_1.tryTransformPair)(originBuffer, newBuffer)
|
|
154
|
-
: null;
|
|
192
|
+
// 变换走文件版 T:只读头部选布局、按段定位改写,不把 bundle 读进内存
|
|
155
193
|
const transformedOldFile = path_1.default.join(tempRoot, 'old-transformed.bin');
|
|
156
194
|
const transformedNewFile = path_1.default.join(tempRoot, 'new-transformed.bin');
|
|
157
|
-
|
|
158
|
-
await
|
|
159
|
-
|
|
160
|
-
fs.writeFile(transformedNewFile, pair.tNew),
|
|
161
|
-
]);
|
|
162
|
-
}
|
|
195
|
+
const pair = options.hbcTransform
|
|
196
|
+
? await (0, hbcTransform_1.tryTransformPairFiles)(rawOldFile, rawNewFile, transformedOldFile, transformedNewFile)
|
|
197
|
+
: null;
|
|
163
198
|
reportDiffPhase(options, {
|
|
164
199
|
phase: 'materialize',
|
|
165
200
|
durationMs: extractionDurationMs + performance.now() - phaseStartedAt,
|
|
@@ -197,11 +232,10 @@ async function buildStreamBundlePatch(originSource, newSource, options, workRoot
|
|
|
197
232
|
const restoredFile = path_1.default.join(tempRoot, 'restored.bin');
|
|
198
233
|
await patchStreamFn(chosenPair ? transformedOldFile : rawOldFile, patchFile, restoredFile);
|
|
199
234
|
if (chosenPair) {
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Buffer.compare(restored, newBuffer) !== 0) {
|
|
235
|
+
// T⁻¹ 同样在文件上按段改写,再以流式哈希比对,内存与 bundle 大小无关
|
|
236
|
+
const restoredRawFile = path_1.default.join(tempRoot, 'restored-raw.bin');
|
|
237
|
+
const inverted = await (0, hbcTransform_1.transformHbcFile)(restoredFile, restoredRawFile, chosenPair.layout, true);
|
|
238
|
+
if (!inverted || !(await filesEqual(restoredRawFile, rawNewFile))) {
|
|
205
239
|
throw new Error('stream diff round-trip verification failed');
|
|
206
240
|
}
|
|
207
241
|
}
|
|
@@ -265,9 +299,10 @@ async function buildBundlePatch(diffFn, originSource, newSource, options, workRo
|
|
|
265
299
|
if (candidate.length + metaOverhead >= baseline.length) {
|
|
266
300
|
return { patch: { kind: 'buffer', data: baseline } };
|
|
267
301
|
}
|
|
302
|
+
// patched 是 patchFn 新返回的 Buffer,原地做 T⁻¹ 省去一次整块拷贝
|
|
268
303
|
const patched = options.patchFn(pair.tOld, candidate);
|
|
269
|
-
|
|
270
|
-
|
|
304
|
+
if (!(0, hbcTransform_1.transformHbcWithLayoutInPlace)(patched, pair.layout, true) ||
|
|
305
|
+
Buffer.compare(patched, newBuffer) !== 0) {
|
|
271
306
|
console.warn((0, i18n_1.t)('hbcTransformRoundTripFailed'));
|
|
272
307
|
return { patch: { kind: 'buffer', data: baseline } };
|
|
273
308
|
}
|
|
@@ -360,7 +395,7 @@ async function diffFromPPK(origin, next, output, diffFn, bundleOptions, workRoot
|
|
|
360
395
|
originEntries[entry.fileName] = entry;
|
|
361
396
|
if (!/\/$/.test(entry.fileName)) {
|
|
362
397
|
// isFile
|
|
363
|
-
originMap[entry
|
|
398
|
+
originMap[zipEntryContentKey(entry)] = entry.fileName;
|
|
364
399
|
if ((0, constants_1.isPPKBundleFileName)(entry.fileName)) {
|
|
365
400
|
// This is source.
|
|
366
401
|
originSource = await readOriginBundleSource(entry, zipFile, bundleOptions, workRoot);
|
|
@@ -371,74 +406,77 @@ async function diffFromPPK(origin, next, output, diffFn, bundleOptions, workRoot
|
|
|
371
406
|
throw new Error((0, i18n_1.t)('bundleFileNotFound'));
|
|
372
407
|
}
|
|
373
408
|
const copies = {};
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
addedEntry[fn] = true;
|
|
382
|
-
const base = basename(fn);
|
|
383
|
-
if (base) {
|
|
384
|
-
addEntry(base);
|
|
385
|
-
}
|
|
386
|
-
zipfile.addEmptyDirectory(fn);
|
|
387
|
-
}
|
|
388
|
-
const newEntries = {};
|
|
389
|
-
const hbcTransformMetas = {};
|
|
390
|
-
await (0, zip_entries_1.enumZipEntries)(next, async (entry, nextZipfile) => {
|
|
391
|
-
newEntries[entry.fileName] = entry;
|
|
392
|
-
if (/\/$/.test(entry.fileName)) {
|
|
393
|
-
// Directory
|
|
394
|
-
if (!originEntries[entry.fileName]) {
|
|
395
|
-
addEntry(entry.fileName);
|
|
409
|
+
const bundleSource = originSource;
|
|
410
|
+
await writeDiffZip(output, async (zipfile) => {
|
|
411
|
+
const addedEntry = {};
|
|
412
|
+
function addEntry(fn) {
|
|
413
|
+
//console.log(fn);
|
|
414
|
+
if (!fn || addedEntry[fn]) {
|
|
415
|
+
return;
|
|
396
416
|
}
|
|
417
|
+
addedEntry[fn] = true;
|
|
418
|
+
const base = basename(fn);
|
|
419
|
+
if (base) {
|
|
420
|
+
addEntry(base);
|
|
421
|
+
}
|
|
422
|
+
zipfile.addEmptyDirectory(fn);
|
|
397
423
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
424
|
+
const newEntries = {};
|
|
425
|
+
const hbcTransformMetas = {};
|
|
426
|
+
await (0, zip_entries_1.enumZipEntries)(next, async (entry, nextZipfile) => {
|
|
427
|
+
newEntries[entry.fileName] = entry;
|
|
428
|
+
if (/\/$/.test(entry.fileName)) {
|
|
429
|
+
// Directory
|
|
430
|
+
if (!originEntries[entry.fileName]) {
|
|
431
|
+
addEntry(entry.fileName);
|
|
432
|
+
}
|
|
407
433
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
434
|
+
else if ((0, constants_1.isPPKBundleFileName)(entry.fileName)) {
|
|
435
|
+
await addBundlePatch(zipfile, entry, nextZipfile, diffFn, bundleSource, bundleOptions, hbcTransformMetas, workRoot);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
// If same file.
|
|
439
|
+
const originEntry = originEntries[entry.fileName];
|
|
440
|
+
if (originEntry && zipEntriesHaveSameContent(originEntry, entry)) {
|
|
441
|
+
// ignore
|
|
442
|
+
return;
|
|
414
443
|
}
|
|
415
|
-
|
|
416
|
-
|
|
444
|
+
// If moved from other place
|
|
445
|
+
const movedFrom = originMap[zipEntryContentKey(entry)];
|
|
446
|
+
if (movedFrom) {
|
|
447
|
+
const base = basename(entry.fileName);
|
|
448
|
+
if (base && !originEntries[base]) {
|
|
449
|
+
addEntry(base);
|
|
450
|
+
}
|
|
451
|
+
copies[entry.fileName] = movedFrom;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// New file.
|
|
455
|
+
const basePath = basename(entry.fileName);
|
|
456
|
+
if (basePath) {
|
|
457
|
+
addEntry(basePath);
|
|
458
|
+
}
|
|
459
|
+
await addFileFromZipEntry(zipfile, entry, nextZipfile);
|
|
417
460
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
461
|
+
});
|
|
462
|
+
const deletes = {};
|
|
463
|
+
for (const k in originEntries) {
|
|
464
|
+
if (!newEntries[k]) {
|
|
465
|
+
console.log((0, i18n_1.t)('deleteFile', { file: k }));
|
|
466
|
+
deletes[k] = 1;
|
|
422
467
|
}
|
|
423
|
-
await addFileFromZipEntry(zipfile, entry, nextZipfile);
|
|
424
468
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
await finishDiffZip(zipfile, writePromise, {
|
|
434
|
-
copies,
|
|
435
|
-
deletes,
|
|
436
|
-
...(Object.keys(hbcTransformMetas).length
|
|
437
|
-
? { hbcTransform: hbcTransformMetas }
|
|
438
|
-
: {}),
|
|
469
|
+
return {
|
|
470
|
+
copies,
|
|
471
|
+
deletes,
|
|
472
|
+
...(Object.keys(hbcTransformMetas).length
|
|
473
|
+
? { hbcTransform: hbcTransformMetas }
|
|
474
|
+
: {}),
|
|
475
|
+
};
|
|
439
476
|
});
|
|
440
477
|
}
|
|
441
478
|
async function diffFromPackage(origin, next, output, diffFn, platform, bundleOptions, workRoot) {
|
|
479
|
+
// 路径 → 内容键(crc32 + 解压后长度)
|
|
442
480
|
const originEntries = {};
|
|
443
481
|
const originMap = {};
|
|
444
482
|
let originSource;
|
|
@@ -460,8 +498,9 @@ async function diffFromPackage(origin, next, output, diffFn, platform, bundleOpt
|
|
|
460
498
|
const fn = resolvedEntry.diffPath;
|
|
461
499
|
//console.log(fn);
|
|
462
500
|
// isFile
|
|
463
|
-
|
|
464
|
-
|
|
501
|
+
const contentKey = zipEntryContentKey(entry);
|
|
502
|
+
originEntries[fn] = contentKey;
|
|
503
|
+
originMap[contentKey] = fn;
|
|
465
504
|
if (resolvedEntry.kind === 'bundle') {
|
|
466
505
|
// This is source.
|
|
467
506
|
originSource = await readOriginBundleSource(entry, zipFile, bundleOptions, workRoot);
|
|
@@ -472,39 +511,42 @@ async function diffFromPackage(origin, next, output, diffFn, platform, bundleOpt
|
|
|
472
511
|
throw new Error((0, i18n_1.t)('bundleFileNotFound'));
|
|
473
512
|
}
|
|
474
513
|
const copies = {};
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
else if ((0, constants_1.isPPKBundleFileName)(entry.fileName)) {
|
|
483
|
-
await addBundlePatch(zipfile, entry, nextZipfile, diffFn, originSource, bundleOptions, hbcTransformMetas, workRoot);
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
// If same file.
|
|
487
|
-
if (originEntries[entry.fileName] === entry.crc32) {
|
|
488
|
-
copies[entry.fileName] = '';
|
|
489
|
-
copiesCrc[entry.fileName] = entry.crc32;
|
|
490
|
-
return;
|
|
514
|
+
const bundleSource = originSource;
|
|
515
|
+
await writeDiffZip(output, async (zipfile) => {
|
|
516
|
+
const hbcTransformMetas = {};
|
|
517
|
+
await (0, zip_entries_1.enumZipEntries)(next, async (entry, nextZipfile) => {
|
|
518
|
+
if (/\/$/.test(entry.fileName)) {
|
|
519
|
+
// Directory
|
|
520
|
+
zipfile.addEmptyDirectory(entry.fileName);
|
|
491
521
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (movedFrom) {
|
|
495
|
-
copies[entry.fileName] = movedFrom;
|
|
496
|
-
copiesCrc[entry.fileName] = entry.crc32;
|
|
497
|
-
return;
|
|
522
|
+
else if ((0, constants_1.isPPKBundleFileName)(entry.fileName)) {
|
|
523
|
+
await addBundlePatch(zipfile, entry, nextZipfile, diffFn, bundleSource, bundleOptions, hbcTransformMetas, workRoot);
|
|
498
524
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
525
|
+
else {
|
|
526
|
+
// If same file.
|
|
527
|
+
const contentKey = zipEntryContentKey(entry);
|
|
528
|
+
if (originEntries[entry.fileName] === contentKey) {
|
|
529
|
+
copies[entry.fileName] = '';
|
|
530
|
+
copiesCrc[entry.fileName] = entry.crc32;
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
// If moved from other place
|
|
534
|
+
const movedFrom = originMap[contentKey];
|
|
535
|
+
if (movedFrom) {
|
|
536
|
+
copies[entry.fileName] = movedFrom;
|
|
537
|
+
copiesCrc[entry.fileName] = entry.crc32;
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
await addFileFromZipEntry(zipfile, entry, nextZipfile);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
return {
|
|
544
|
+
copies,
|
|
545
|
+
copiesCrc,
|
|
546
|
+
...(Object.keys(hbcTransformMetas).length
|
|
547
|
+
? { hbcTransform: hbcTransformMetas }
|
|
548
|
+
: {}),
|
|
549
|
+
};
|
|
508
550
|
});
|
|
509
551
|
}
|
|
510
552
|
function resolveDiffImplementation(options) {
|
package/lib/locales/en.d.ts
CHANGED
|
@@ -164,6 +164,7 @@ declare const _default: {
|
|
|
164
164
|
hermesBaseRangeFallback: string;
|
|
165
165
|
hermesBaseCompileFailed: string;
|
|
166
166
|
hermesBaseCompileFailedLog: string;
|
|
167
|
+
hermesBasePlainCompileFailed: string;
|
|
167
168
|
hermesBaseVerified: string;
|
|
168
169
|
hermesBaseVerifyFailed: string;
|
|
169
170
|
cacheCleaned: string;
|
package/lib/locales/en.js
CHANGED
|
@@ -172,6 +172,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
172
172
|
hermesBaseRangeFallback: 'Hermes base: partial download unavailable ({{- reason}}); downloading the whole package',
|
|
173
173
|
hermesBaseCompileFailed: 'Hermes base compile failed ({{- reason}}); retrying without -base-bytecode',
|
|
174
174
|
hermesBaseCompileFailedLog: 'Hermes base: full compiler output written to {{- file}}',
|
|
175
|
+
hermesBasePlainCompileFailed: 'Hermes base: the plain compile used for verification failed ({{- reason}}); keeping the base compile unverified',
|
|
175
176
|
hermesBaseVerified: 'Hermes base: bytecode verified equivalent to a plain compile',
|
|
176
177
|
hermesBaseVerifyFailed: 'Hermes base: bytecode differs from a plain compile; dropping the base and recompiling',
|
|
177
178
|
cacheCleaned: 'Removed {{count}} cached bundle(s)',
|
package/lib/locales/zh.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ declare const _default: {
|
|
|
163
163
|
hermesBaseRangeFallback: string;
|
|
164
164
|
hermesBaseCompileFailed: string;
|
|
165
165
|
hermesBaseCompileFailedLog: string;
|
|
166
|
+
hermesBasePlainCompileFailed: string;
|
|
166
167
|
hermesBaseVerified: string;
|
|
167
168
|
hermesBaseVerifyFailed: string;
|
|
168
169
|
cacheCleaned: string;
|
package/lib/locales/zh.js
CHANGED
|
@@ -171,6 +171,7 @@ exports.default = {
|
|
|
171
171
|
hermesBaseRangeFallback: 'Hermes base:无法按需下载({{- reason}}),改为下载整包',
|
|
172
172
|
hermesBaseCompileFailed: 'Hermes base 编译失败({{- reason}}),改为不带 -base-bytecode 重编',
|
|
173
173
|
hermesBaseCompileFailedLog: 'Hermes base:完整编译错误已写入 {{- file}}',
|
|
174
|
+
hermesBasePlainCompileFailed: 'Hermes base:用于校验的普通编译失败({{- reason}}),保留 base 编译结果但未校验',
|
|
174
175
|
hermesBaseVerified: 'Hermes base:字节码与普通编译等价,校验通过',
|
|
175
176
|
hermesBaseVerifyFailed: 'Hermes base:字节码与普通编译不等价,放弃 base 重新编译',
|
|
176
177
|
cacheCleaned: '已清理 {{count}} 个缓存 bundle',
|
package/lib/native-package.d.ts
CHANGED
|
@@ -10,8 +10,12 @@ export type NativePackageEntry = {
|
|
|
10
10
|
* considered by the local diff implementation (or vice versa).
|
|
11
11
|
*/
|
|
12
12
|
export declare function resolveNativePackageEntry(platform: Platform, entryName: string): NativePackageEntry | undefined;
|
|
13
|
+
export interface SlimPackageOptions {
|
|
14
|
+
/** re-deflate through yazl even when a raw copy would do (tests) */
|
|
15
|
+
repack?: boolean;
|
|
16
|
+
}
|
|
13
17
|
/**
|
|
14
18
|
* Repack a native package with only the bundle and resources required by
|
|
15
19
|
* package-origin diffs. Entry names and nested Harmony HAP structure are kept.
|
|
16
20
|
*/
|
|
17
|
-
export declare function createSlimNativePackage(source: string, output: string, platform: Platform): Promise<void>;
|
|
21
|
+
export declare function createSlimNativePackage(source: string, output: string, platform: Platform, options?: SlimPackageOptions): Promise<void>;
|