react-native-update-cli 2.29.1 → 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 +26 -44
- 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 +25 -27
- package/lib/bundle-runner.js +55 -54
- package/lib/bundle.js +18 -26
- package/lib/diff.js +32 -91
- 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 +20 -60
- package/lib/package.d.ts +6 -1
- package/lib/package.js +50 -70
- 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 +87 -192
- 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 -26
- package/lib/utils/app-info-parser/resource-finder.js +41 -183
- 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 +5 -0
- package/lib/utils/fs-helpers.js +19 -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 +93 -156
- 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/zip-entries.d.ts +23 -0
- package/lib/utils/zip-entries.js +125 -102
- package/lib/utils/zip-options.js +29 -56
- package/lib/utils/zip-range.js +25 -65
- package/lib/versions.d.ts +5 -0
- package/lib/versions.js +86 -153
- package/package.json +1 -3
- 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 -31
package/lib/bundle.js
CHANGED
|
@@ -152,14 +152,15 @@ exports.bundleCommands = {
|
|
|
152
152
|
]);
|
|
153
153
|
const sourcemapOutput = path_1.default.join(normalized.intermediaDir, `${normalized.bundleName}.map`);
|
|
154
154
|
const realOutput = normalized.output.replace(/\$\{time\}/g, `${Date.now()}`);
|
|
155
|
-
|
|
155
|
+
const sourcemap = normalized.sourcemap || bundleParams.sourcemap;
|
|
156
|
+
console.log((0, i18n_1.t)('bundlingWithRN', { version: (0, dep_versions_1.getDepVersion)('react-native') }));
|
|
156
157
|
const hermesResult = await (0, bundle_runner_1.runReactNativeBundleCommand)({
|
|
157
158
|
bundleName: normalized.bundleName,
|
|
158
159
|
dev: normalized.dev,
|
|
159
160
|
entryFile: normalized.entryFile,
|
|
160
161
|
outputFolder: normalized.intermediaDir,
|
|
161
162
|
platform,
|
|
162
|
-
sourcemapOutput:
|
|
163
|
+
sourcemapOutput: sourcemap ? sourcemapOutput : '',
|
|
163
164
|
forceHermes: normalized.hermes,
|
|
164
165
|
hermesBase: hermesBase ? { ...hermesBase, appId } : undefined,
|
|
165
166
|
resetCache: normalized.resetCache,
|
|
@@ -177,9 +178,20 @@ exports.bundleCommands = {
|
|
|
177
178
|
detail: hermesResult.outcomeDetail,
|
|
178
179
|
})
|
|
179
180
|
: undefined;
|
|
180
|
-
|
|
181
|
+
const publishAndUploadSentry = async (payload = {}) => {
|
|
181
182
|
await publishBundleVersion(realOutput, platform, {
|
|
182
183
|
appId: await getAppId(),
|
|
184
|
+
hermesBase: baseMeta,
|
|
185
|
+
sourcemap: sourcemap ? sourcemapOutput : undefined,
|
|
186
|
+
...payload,
|
|
187
|
+
});
|
|
188
|
+
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
189
|
+
sentryRelease: normalized.sentryRelease,
|
|
190
|
+
sentryDist: normalized.sentryDist,
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
if (normalized.name) {
|
|
194
|
+
await publishAndUploadSentry({
|
|
183
195
|
name: normalized.name,
|
|
184
196
|
description: normalized.description,
|
|
185
197
|
metaInfo: normalized.metaInfo,
|
|
@@ -190,32 +202,12 @@ exports.bundleCommands = {
|
|
|
190
202
|
packageVersionRange: normalized.packageVersionRange,
|
|
191
203
|
rollout: normalized.rollout,
|
|
192
204
|
dryRun: normalized.dryRun,
|
|
193
|
-
hermesBase: baseMeta,
|
|
194
|
-
sourcemap: normalized.sourcemap || bundleParams.sourcemap
|
|
195
|
-
? sourcemapOutput
|
|
196
|
-
: undefined,
|
|
197
|
-
});
|
|
198
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
199
|
-
sentryRelease: normalized.sentryRelease,
|
|
200
|
-
sentryDist: normalized.sentryDist,
|
|
201
205
|
});
|
|
202
206
|
return;
|
|
203
207
|
}
|
|
204
|
-
if (!(0, options_1.getBooleanOption)(options, 'no-interactive', false)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
await publishBundleVersion(realOutput, platform, {
|
|
208
|
-
appId: await getAppId(),
|
|
209
|
-
hermesBase: baseMeta,
|
|
210
|
-
sourcemap: normalized.sourcemap || bundleParams.sourcemap
|
|
211
|
-
? sourcemapOutput
|
|
212
|
-
: undefined,
|
|
213
|
-
});
|
|
214
|
-
await uploadSentryArtifactsIfNeeded(bundleParams.sentry, normalized.bundleName, normalized.intermediaDir, sourcemapOutput, platform, {
|
|
215
|
-
sentryRelease: normalized.sentryRelease,
|
|
216
|
-
sentryDist: normalized.sentryDist,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
208
|
+
if (!(0, options_1.getBooleanOption)(options, 'no-interactive', false) &&
|
|
209
|
+
(await (0, utils_1.question)((0, i18n_1.t)('uploadBundlePrompt'))).toLowerCase() === 'y') {
|
|
210
|
+
await publishAndUploadSentry();
|
|
219
211
|
}
|
|
220
212
|
},
|
|
221
213
|
};
|
package/lib/diff.js
CHANGED
|
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.diffCommands = exports.readEntry = exports.enumZipEntries = void 0;
|
|
7
7
|
exports.zipEntryContentKey = zipEntryContentKey;
|
|
8
8
|
exports.zipEntriesHaveSameContent = zipEntriesHaveSameContent;
|
|
9
|
-
const node_crypto_1 = require("node:crypto");
|
|
10
9
|
const fs_1 = __importDefault(require("fs"));
|
|
11
10
|
const global_dirs_1 = require("global-dirs");
|
|
12
11
|
const os_1 = __importDefault(require("os"));
|
|
13
12
|
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const yazl_1 = require("yazl");
|
|
15
13
|
const native_package_1 = require("./native-package");
|
|
16
14
|
const utils_1 = require("./utils");
|
|
17
15
|
const constants_1 = require("./utils/constants");
|
|
18
|
-
const
|
|
16
|
+
const hash_1 = require("./utils/hash");
|
|
19
17
|
const hbcTransform_1 = require("./utils/hbcTransform");
|
|
20
18
|
const i18n_1 = require("./utils/i18n");
|
|
21
19
|
const zip_entries_1 = require("./utils/zip-entries");
|
|
@@ -51,43 +49,12 @@ function basename(fn) {
|
|
|
51
49
|
const m = /^(.+\/)[^/]+\/?$/.exec(fn);
|
|
52
50
|
return m?.[1];
|
|
53
51
|
}
|
|
54
|
-
function createOutputZip(output) {
|
|
55
|
-
(0, fs_helpers_1.ensureDirSync)(path_1.default.dirname(output));
|
|
56
|
-
const zipfile = new yazl_1.ZipFile();
|
|
57
|
-
const writeStream = fs_1.default.createWriteStream(output);
|
|
58
|
-
const writePromise = new Promise((resolve, reject) => {
|
|
59
|
-
zipfile.outputStream.on('error', reject);
|
|
60
|
-
// without this, a full disk / read-only target left the promise pending
|
|
61
|
-
writeStream.on('error', reject);
|
|
62
|
-
zipfile.outputStream.pipe(writeStream).on('close', () => {
|
|
63
|
-
resolve(void 0);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
// 失败时释放输出 fd 并删掉半成品,避免残留一个截断的 patch 包
|
|
67
|
-
const abort = async () => {
|
|
68
|
-
writePromise.catch(() => { });
|
|
69
|
-
zipfile.outputStream.unpipe(writeStream);
|
|
70
|
-
// yazl 的 outputStream 类型声明缺 destroy,运行时是 PassThrough
|
|
71
|
-
zipfile.outputStream.destroy();
|
|
72
|
-
if (!writeStream.closed) {
|
|
73
|
-
// 等 fd 真正关闭再删文件,避免 Windows 上删除被占用文件失败
|
|
74
|
-
await new Promise((resolve) => {
|
|
75
|
-
writeStream.once('close', () => resolve());
|
|
76
|
-
if (!writeStream.destroyed) {
|
|
77
|
-
writeStream.destroy();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
await fs_1.default.promises.rm(output, { force: true });
|
|
82
|
-
};
|
|
83
|
-
return { zipfile, writePromise, abort };
|
|
84
|
-
}
|
|
85
52
|
/**
|
|
86
53
|
* 打开输出包,执行 build 填充条目并返回 manifest,最后写入 __diff.json
|
|
87
54
|
* 收尾。build 或收尾任何一步失败都会关闭输出流、删除半成品并重新抛出。
|
|
88
55
|
*/
|
|
89
56
|
async function writeDiffZip(output, build) {
|
|
90
|
-
const { zipfile, writePromise, abort } = createOutputZip(output);
|
|
57
|
+
const { zipfile, writePromise, abort } = (0, zip_entries_1.createOutputZip)(output);
|
|
91
58
|
try {
|
|
92
59
|
const manifest = await build(zipfile);
|
|
93
60
|
await finishDiffZip(zipfile, writePromise, manifest);
|
|
@@ -117,13 +84,6 @@ async function bundleSourceFile(source, outputPath) {
|
|
|
117
84
|
await fs_1.default.promises.writeFile(outputPath, source.data);
|
|
118
85
|
return outputPath;
|
|
119
86
|
}
|
|
120
|
-
async function hashFile(filePath) {
|
|
121
|
-
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
122
|
-
for await (const chunk of fs_1.default.createReadStream(filePath)) {
|
|
123
|
-
hash.update(chunk);
|
|
124
|
-
}
|
|
125
|
-
return hash.digest('hex');
|
|
126
|
-
}
|
|
127
87
|
async function filesEqual(leftPath, rightPath) {
|
|
128
88
|
const [leftStat, rightStat] = await Promise.all([
|
|
129
89
|
fs_1.default.promises.stat(leftPath),
|
|
@@ -133,8 +93,8 @@ async function filesEqual(leftPath, rightPath) {
|
|
|
133
93
|
return false;
|
|
134
94
|
}
|
|
135
95
|
const [leftHash, rightHash] = await Promise.all([
|
|
136
|
-
|
|
137
|
-
|
|
96
|
+
(0, hash_1.sha256File)(leftPath),
|
|
97
|
+
(0, hash_1.sha256File)(rightPath),
|
|
138
98
|
]);
|
|
139
99
|
return leftHash === rightHash;
|
|
140
100
|
}
|
|
@@ -232,16 +192,32 @@ async function buildStreamBundlePatch(originSource, newSource, options, workRoot
|
|
|
232
192
|
...(chosenPair ? { hbcTransform: chosenPair.meta } : {}),
|
|
233
193
|
};
|
|
234
194
|
}
|
|
195
|
+
/** origin 与 new 中较大者达到流式阈值时走流式 diff */
|
|
196
|
+
function exceedsStreamThreshold(options, originSource, newSize) {
|
|
197
|
+
return (!!options.streamThresholdBytes &&
|
|
198
|
+
!!originSource &&
|
|
199
|
+
Math.max(bundleSourceSize(originSource), newSize) >=
|
|
200
|
+
options.streamThresholdBytes);
|
|
201
|
+
}
|
|
202
|
+
/** 把 zip 条目落盘到 workRoot 下的临时目录,作为文件型 BundleSource */
|
|
203
|
+
async function materializeEntry(entry, zipFile, workRoot, prefix) {
|
|
204
|
+
const filePath = path_1.default.join(fs_1.default.mkdtempSync(path_1.default.join(workRoot, prefix)), 'bundle.bin');
|
|
205
|
+
const startedAt = performance.now();
|
|
206
|
+
await (0, zip_entries_1.writeEntry)(entry, zipFile, filePath);
|
|
207
|
+
return {
|
|
208
|
+
kind: 'file',
|
|
209
|
+
path: filePath,
|
|
210
|
+
size: entry.uncompressedSize,
|
|
211
|
+
materializeDurationMs: performance.now() - startedAt,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
235
214
|
/**
|
|
236
215
|
* 生成 bundle patch:默认现状路径;开启 hbcTransform 时对 Hermes bundle
|
|
237
216
|
* 做双候选择优(baseline vs 变换域 + 元数据开销),且变换候选必须通过
|
|
238
217
|
* 本地 round-trip 还原自检才会被采用——收益永不为负,未知格式天然安全。
|
|
239
218
|
*/
|
|
240
219
|
async function buildBundlePatch(diffFn, originSource, newSource, options, workRoot) {
|
|
241
|
-
if (options
|
|
242
|
-
originSource &&
|
|
243
|
-
Math.max(bundleSourceSize(originSource), bundleSourceSize(newSource)) >=
|
|
244
|
-
options.streamThresholdBytes) {
|
|
220
|
+
if (exceedsStreamThreshold(options, originSource, bundleSourceSize(newSource))) {
|
|
245
221
|
return buildStreamBundlePatch(originSource, newSource, options, workRoot);
|
|
246
222
|
}
|
|
247
223
|
const [originBuffer, newBuffer] = await Promise.all([
|
|
@@ -285,26 +261,9 @@ async function buildBundlePatch(diffFn, originSource, newSource, options, workRo
|
|
|
285
261
|
}
|
|
286
262
|
}
|
|
287
263
|
async function addBundlePatch(zipfile, entry, nextZipfile, diffFn, originSource, bundleOptions, hbcTransformMetas, workRoot) {
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
bundleOptions.streamThresholdBytes;
|
|
292
|
-
let newSource;
|
|
293
|
-
if (shouldStream) {
|
|
294
|
-
const nextRoot = fs_1.default.mkdtempSync(path_1.default.join(workRoot, 'next-'));
|
|
295
|
-
const nextPath = path_1.default.join(nextRoot, 'bundle.bin');
|
|
296
|
-
const startedAt = performance.now();
|
|
297
|
-
await (0, zip_entries_1.writeEntry)(entry, nextZipfile, nextPath);
|
|
298
|
-
newSource = {
|
|
299
|
-
kind: 'file',
|
|
300
|
-
path: nextPath,
|
|
301
|
-
size: entry.uncompressedSize,
|
|
302
|
-
materializeDurationMs: performance.now() - startedAt,
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
newSource = { kind: 'buffer', data: await (0, zip_entries_1.readEntry)(entry, nextZipfile) };
|
|
307
|
-
}
|
|
264
|
+
const newSource = exceedsStreamThreshold(bundleOptions, originSource, entry.uncompressedSize)
|
|
265
|
+
? await materializeEntry(entry, nextZipfile, workRoot, 'next-')
|
|
266
|
+
: { kind: 'buffer', data: await (0, zip_entries_1.readEntry)(entry, nextZipfile) };
|
|
308
267
|
const { patch, hbcTransform } = await buildBundlePatch(diffFn, originSource, newSource, bundleOptions, workRoot);
|
|
309
268
|
const patchEntryName = `${entry.fileName}.patch`;
|
|
310
269
|
if (hbcTransform) {
|
|
@@ -321,33 +280,15 @@ async function readOriginBundleSource(entry, zipFile, bundleOptions, workRoot) {
|
|
|
321
280
|
if (!bundleOptions.streamThresholdBytes) {
|
|
322
281
|
return { kind: 'buffer', data: await (0, zip_entries_1.readEntry)(entry, zipFile) };
|
|
323
282
|
}
|
|
324
|
-
|
|
325
|
-
const originPath = path_1.default.join(originRoot, 'bundle.bin');
|
|
326
|
-
const startedAt = performance.now();
|
|
327
|
-
await (0, zip_entries_1.writeEntry)(entry, zipFile, originPath);
|
|
328
|
-
return {
|
|
329
|
-
kind: 'file',
|
|
330
|
-
path: originPath,
|
|
331
|
-
size: entry.uncompressedSize,
|
|
332
|
-
materializeDurationMs: performance.now() - startedAt,
|
|
333
|
-
};
|
|
283
|
+
return materializeEntry(entry, zipFile, workRoot, 'origin-');
|
|
334
284
|
}
|
|
335
285
|
async function addFileFromZipEntry(zipfile, entry, nextZipfile) {
|
|
336
286
|
const entryPrefix = await (0, zip_entries_1.readEntryPrefix)(entry, nextZipfile, zip_options_1.ZIP_ENTRY_SNIFF_BYTES);
|
|
287
|
+
const readStream = await (0, zip_entries_1.openEntryStream)(entry, nextZipfile);
|
|
337
288
|
await new Promise((resolve, reject) => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
if (!readStream) {
|
|
343
|
-
return reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
344
|
-
}
|
|
345
|
-
zipfile.addReadStream(readStream, entry.fileName, (0, zip_options_1.zipOptionsForPayloadEntry)(entry.fileName, entryPrefix));
|
|
346
|
-
readStream.on('error', reject);
|
|
347
|
-
readStream.on('end', () => {
|
|
348
|
-
resolve(void 0);
|
|
349
|
-
});
|
|
350
|
-
});
|
|
289
|
+
zipfile.addReadStream(readStream, entry.fileName, (0, zip_options_1.zipOptionsForPayloadEntry)(entry.fileName, entryPrefix));
|
|
290
|
+
readStream.on('error', reject);
|
|
291
|
+
readStream.on('end', () => resolve());
|
|
351
292
|
});
|
|
352
293
|
}
|
|
353
294
|
function finishDiffZip(zipfile, writePromise, manifest) {
|
package/lib/locales/en.d.ts
CHANGED
|
@@ -3,18 +3,10 @@ declare const _default: {
|
|
|
3
3
|
accountUnknown: string;
|
|
4
4
|
accountNoExpiry: string;
|
|
5
5
|
accountRenewalWarning: string;
|
|
6
|
-
accountLookupFailed: string;
|
|
7
6
|
addedToGitignore: string;
|
|
8
7
|
androidCrunchPngsWarning: string;
|
|
9
|
-
aabOpenApksFailed: string;
|
|
10
|
-
aabReadUniversalApkFailed: string;
|
|
11
8
|
aabUniversalApkNotFound: string;
|
|
12
9
|
aabBundletoolDownloadHint: string;
|
|
13
|
-
aabManifestNotFound: string;
|
|
14
|
-
aabParseResourcesWarning: string;
|
|
15
|
-
aabParseFailed: string;
|
|
16
|
-
aabParseManifestError: string;
|
|
17
|
-
aabParseResourcesError: string;
|
|
18
10
|
appId: string;
|
|
19
11
|
appIdMismatchApk: string;
|
|
20
12
|
appIdMismatchApp: string;
|
|
@@ -86,7 +78,6 @@ declare const _default: {
|
|
|
86
78
|
pausedStatus: string;
|
|
87
79
|
platform: string;
|
|
88
80
|
platformQuestion: string;
|
|
89
|
-
pluginDetectionError: string;
|
|
90
81
|
pluginDetected: string;
|
|
91
82
|
publishUsage: string;
|
|
92
83
|
sourceMapNotFound: string;
|
|
@@ -130,7 +121,6 @@ declare const _default: {
|
|
|
130
121
|
unnamed: string;
|
|
131
122
|
dryRun: string;
|
|
132
123
|
usingCustomVersion: string;
|
|
133
|
-
confirmDeletePackage: string;
|
|
134
124
|
deletePackageSuccess: string;
|
|
135
125
|
deletePackagesSuccess: string;
|
|
136
126
|
deletePackageError: string;
|
package/lib/locales/en.js
CHANGED
|
@@ -5,18 +5,10 @@ exports.default = {
|
|
|
5
5
|
accountUnknown: 'Unknown',
|
|
6
6
|
accountNoExpiry: 'No expiry specified',
|
|
7
7
|
accountRenewalWarning: '[Notice] Your Pushy paid plan expires in {{days}} days. Renew soon to avoid service disruption: {{url}}',
|
|
8
|
-
accountLookupFailed: '[Warning] Unable to retrieve account information. Continuing with the command.',
|
|
9
8
|
addedToGitignore: 'Added {{line}} to .gitignore',
|
|
10
9
|
androidCrunchPngsWarning: 'The crunchPngs option of android seems not disabled (Please ignore this warning if already disabled), which may cause abnormal consumption of mobile network traffic. Please refer to https://cresc.dev/docs/getting-started#disable-crunchpngs-on-android \n',
|
|
11
|
-
aabOpenApksFailed: 'Failed to open generated .apks file',
|
|
12
|
-
aabReadUniversalApkFailed: 'Failed to read universal.apk',
|
|
13
10
|
aabUniversalApkNotFound: 'universal.apk not found in generated .apks',
|
|
14
11
|
aabBundletoolDownloadHint: 'bundletool not found. Downloading node-bundletool via npx (first run may take a while).',
|
|
15
|
-
aabManifestNotFound: "AndroidManifest.xml can't be found in AAB base/manifest/",
|
|
16
|
-
aabParseResourcesWarning: '[Warning] Failed to parse resources.arsc: {{error}}',
|
|
17
|
-
aabParseFailed: 'Failed to parse AAB: {{error}}',
|
|
18
|
-
aabParseManifestError: 'Parse AndroidManifest.xml error: {{error}}',
|
|
19
|
-
aabParseResourcesError: 'Parser resources.arsc error: {{error}}',
|
|
20
12
|
appId: 'App ID',
|
|
21
13
|
appIdMismatchApk: 'App ID mismatch! Current APK: {{appIdInPkg}}, current {{- source}}: {{appId}}',
|
|
22
14
|
appIdMismatchApp: 'App ID mismatch! Current APP: {{appIdInPkg}}, current {{- source}}: {{appId}}',
|
|
@@ -94,7 +86,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
94
86
|
pausedStatus: '(Paused)',
|
|
95
87
|
platform: 'Platform',
|
|
96
88
|
platformQuestion: 'Platform(ios/android/harmony):',
|
|
97
|
-
pluginDetectionError: 'error while detecting {{name}} plugin: {{error}}',
|
|
98
89
|
pluginDetected: 'detected {{name}} plugin',
|
|
99
90
|
publishUsage: 'Usage: pushy publish <ppk file> --platform ios|android|harmony',
|
|
100
91
|
sourceMapNotFound: 'Source map not found: {{path}}',
|
|
@@ -138,7 +129,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
138
129
|
unnamed: '(Unnamed)',
|
|
139
130
|
dryRun: 'Below is the dry-run result, no actual operation will be performed:',
|
|
140
131
|
usingCustomVersion: 'Using custom version: {{version}}',
|
|
141
|
-
confirmDeletePackage: 'Confirm delete native package {{packageId}}? This operation cannot be undone (Y/N):',
|
|
142
132
|
deletePackageSuccess: 'Native package {{packageId}} deleted successfully',
|
|
143
133
|
deletePackagesSuccess: 'Deleted {{count}} native packages: {{packageIds}}',
|
|
144
134
|
deletePackageError: 'Failed to delete native package {{packageId}}: {{error}}',
|
package/lib/locales/zh.d.ts
CHANGED
|
@@ -3,18 +3,10 @@ declare const _default: {
|
|
|
3
3
|
accountUnknown: string;
|
|
4
4
|
accountNoExpiry: string;
|
|
5
5
|
accountRenewalWarning: string;
|
|
6
|
-
accountLookupFailed: string;
|
|
7
6
|
addedToGitignore: string;
|
|
8
7
|
androidCrunchPngsWarning: string;
|
|
9
|
-
aabOpenApksFailed: string;
|
|
10
|
-
aabReadUniversalApkFailed: string;
|
|
11
8
|
aabUniversalApkNotFound: string;
|
|
12
9
|
aabBundletoolDownloadHint: string;
|
|
13
|
-
aabManifestNotFound: string;
|
|
14
|
-
aabParseResourcesWarning: string;
|
|
15
|
-
aabParseFailed: string;
|
|
16
|
-
aabParseManifestError: string;
|
|
17
|
-
aabParseResourcesError: string;
|
|
18
10
|
appId: string;
|
|
19
11
|
appIdMismatchApk: string;
|
|
20
12
|
appIdMismatchApp: string;
|
|
@@ -86,7 +78,6 @@ declare const _default: {
|
|
|
86
78
|
pausedStatus: string;
|
|
87
79
|
platform: string;
|
|
88
80
|
platformQuestion: string;
|
|
89
|
-
pluginDetectionError: string;
|
|
90
81
|
pluginDetected: string;
|
|
91
82
|
sourceMapNotFound: string;
|
|
92
83
|
sourceMapMissingWarning: string;
|
|
@@ -130,7 +121,6 @@ declare const _default: {
|
|
|
130
121
|
unnamed: string;
|
|
131
122
|
dryRun: string;
|
|
132
123
|
usingCustomVersion: string;
|
|
133
|
-
confirmDeletePackage: string;
|
|
134
124
|
deletePackageSuccess: string;
|
|
135
125
|
deletePackagesSuccess: string;
|
|
136
126
|
deletePackageError: string;
|
package/lib/locales/zh.js
CHANGED
|
@@ -5,18 +5,10 @@ exports.default = {
|
|
|
5
5
|
accountUnknown: '未知',
|
|
6
6
|
accountNoExpiry: '未设置有效期',
|
|
7
7
|
accountRenewalWarning: '[注意] 您的 Pushy 付费套餐将在 {{days}} 天内到期,请及时续费,以免影响服务:{{url}}',
|
|
8
|
-
accountLookupFailed: '[警告] 暂时无法获取账号信息,将继续执行命令。',
|
|
9
8
|
addedToGitignore: '已将 {{line}} 添加到 .gitignore',
|
|
10
9
|
androidCrunchPngsWarning: 'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
|
|
11
|
-
aabOpenApksFailed: '无法打开生成的 .apks 文件',
|
|
12
|
-
aabReadUniversalApkFailed: '无法读取 universal.apk',
|
|
13
10
|
aabUniversalApkNotFound: '在生成的 .apks 中未找到 universal.apk',
|
|
14
11
|
aabBundletoolDownloadHint: '未找到 bundletool,正在通过 npx 下载 node-bundletool(首次下载可能需要一些时间)。',
|
|
15
|
-
aabManifestNotFound: '在 AAB 的 base/manifest/ 中找不到 AndroidManifest.xml',
|
|
16
|
-
aabParseResourcesWarning: '[警告] 解析 resources.arsc 失败:{{error}}',
|
|
17
|
-
aabParseFailed: '解析 AAB 失败:{{error}}',
|
|
18
|
-
aabParseManifestError: '解析 AndroidManifest.xml 出错:{{error}}',
|
|
19
|
-
aabParseResourcesError: '解析 resources.arsc 出错:{{error}}',
|
|
20
12
|
appId: '应用 id',
|
|
21
13
|
appIdMismatchApk: 'appId不匹配!当前apk: {{appIdInPkg}}, 当前{{- source}}: {{appId}}',
|
|
22
14
|
appIdMismatchApp: 'appId不匹配!当前app: {{appIdInPkg}}, 当前{{- source}}: {{appId}}',
|
|
@@ -94,7 +86,6 @@ exports.default = {
|
|
|
94
86
|
pausedStatus: '(已暂停)',
|
|
95
87
|
platform: '平台',
|
|
96
88
|
platformQuestion: '平台(ios/android/harmony):',
|
|
97
|
-
pluginDetectionError: '检测 {{name}} 插件时出错:{{error}}',
|
|
98
89
|
pluginDetected: '检测到 {{name}} 插件',
|
|
99
90
|
sourceMapNotFound: '找不到 source map:{{path}}',
|
|
100
91
|
sourceMapMissingWarning: '本版本没有归档 source map,之后的崩溃堆栈将无法还原。请用默认的 --sourcemap 打包,或在 publish 时传 --sourcemap <文件>。',
|
|
@@ -138,7 +129,6 @@ exports.default = {
|
|
|
138
129
|
unnamed: '(未命名)',
|
|
139
130
|
dryRun: '以下是 dry-run 模拟运行结果,不会实际执行任何操作:',
|
|
140
131
|
usingCustomVersion: '使用自定义版本:{{version}}',
|
|
141
|
-
confirmDeletePackage: '确认删除原生包 {{packageId}}? 此操作不可撤销 (Y/N):',
|
|
142
132
|
deletePackageSuccess: '原生包 {{packageId}} 删除成功',
|
|
143
133
|
deletePackagesSuccess: '已删除 {{count}} 个原生包:{{packageIds}}',
|
|
144
134
|
deletePackageError: '删除原生包 {{packageId}} 失败: {{error}}',
|
package/lib/native-package.js
CHANGED
|
@@ -9,8 +9,8 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const yauzl_1 = require("yauzl");
|
|
12
|
-
const yazl_1 = require("yazl");
|
|
13
12
|
const fs_helpers_1 = require("./utils/fs-helpers");
|
|
13
|
+
const zip_entries_1 = require("./utils/zip-entries");
|
|
14
14
|
const zip_raw_writer_1 = require("./utils/zip-raw-writer");
|
|
15
15
|
const nativePackageRules = {
|
|
16
16
|
android: {
|
|
@@ -65,16 +65,11 @@ class RawCopySink {
|
|
|
65
65
|
constructor(output) {
|
|
66
66
|
this.writer = new zip_raw_writer_1.RawZipWriter(output);
|
|
67
67
|
}
|
|
68
|
-
copyEntry(sourceZip, entry) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (error || !readStream) {
|
|
72
|
-
reject(error ?? new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
this.writer.addRawEntry(entry, readStream).then(resolve, reject);
|
|
76
|
-
});
|
|
68
|
+
async copyEntry(sourceZip, entry) {
|
|
69
|
+
const readStream = await (0, zip_entries_1.openEntryStream)(entry, sourceZip, {
|
|
70
|
+
decodeFileData: false,
|
|
77
71
|
});
|
|
72
|
+
await this.writer.addRawEntry(entry, readStream);
|
|
78
73
|
}
|
|
79
74
|
addFile(filePath, fileName, like) {
|
|
80
75
|
// a nested slim archive is a zip of deflated entries: storing it as-is
|
|
@@ -91,48 +86,32 @@ class RawCopySink {
|
|
|
91
86
|
/** Re-deflates every kept entry through yazl; only for sources that need zip64. */
|
|
92
87
|
class RepackSink {
|
|
93
88
|
output;
|
|
94
|
-
outputZip = new yazl_1.ZipFile();
|
|
95
|
-
writePromise;
|
|
96
89
|
constructor(output) {
|
|
97
|
-
this.output = output;
|
|
98
|
-
this.writePromise = new Promise((resolve, reject) => {
|
|
99
|
-
this.outputZip.outputStream.once('error', reject);
|
|
100
|
-
this.outputZip.outputStream
|
|
101
|
-
.pipe(fs_1.default.createWriteStream(output))
|
|
102
|
-
.once('error', reject)
|
|
103
|
-
.once('close', () => resolve());
|
|
104
|
-
});
|
|
90
|
+
this.output = (0, zip_entries_1.createOutputZip)(output);
|
|
105
91
|
}
|
|
106
|
-
copyEntry(sourceZip, entry) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
readStream.once('end', () => resolve());
|
|
115
|
-
this.outputZip.addReadStream(readStream, entry.fileName, {
|
|
116
|
-
compress: entry.compressionMethod !== 0,
|
|
117
|
-
mtime: entry.getLastModDate(),
|
|
118
|
-
});
|
|
92
|
+
async copyEntry(sourceZip, entry) {
|
|
93
|
+
const readStream = await (0, zip_entries_1.openEntryStream)(entry, sourceZip);
|
|
94
|
+
await new Promise((resolve, reject) => {
|
|
95
|
+
readStream.once('error', reject);
|
|
96
|
+
readStream.once('end', () => resolve());
|
|
97
|
+
this.output.zipfile.addReadStream(readStream, entry.fileName, {
|
|
98
|
+
compress: entry.compressionMethod !== 0,
|
|
99
|
+
mtime: entry.getLastModDate(),
|
|
119
100
|
});
|
|
120
101
|
});
|
|
121
102
|
}
|
|
122
103
|
async addFile(filePath, fileName, like) {
|
|
123
|
-
this.
|
|
104
|
+
this.output.zipfile.addFile(filePath, fileName, {
|
|
124
105
|
compress: like.compressionMethod !== 0,
|
|
125
106
|
mtime: like.getLastModDate(),
|
|
126
107
|
});
|
|
127
108
|
}
|
|
128
109
|
async end() {
|
|
129
|
-
this.
|
|
130
|
-
await this.writePromise;
|
|
110
|
+
this.output.zipfile.end();
|
|
111
|
+
await this.output.writePromise;
|
|
131
112
|
}
|
|
132
|
-
|
|
133
|
-
this.
|
|
134
|
-
await this.writePromise.catch(() => { });
|
|
135
|
-
await (0, fs_helpers_1.remove)(this.output).catch(() => { });
|
|
113
|
+
abort() {
|
|
114
|
+
return this.output.abort();
|
|
136
115
|
}
|
|
137
116
|
}
|
|
138
117
|
function openZip(source) {
|
|
@@ -146,25 +125,6 @@ function openZip(source) {
|
|
|
146
125
|
});
|
|
147
126
|
});
|
|
148
127
|
}
|
|
149
|
-
function extractEntryToFile(sourceZip, entry, outputPath) {
|
|
150
|
-
return new Promise((resolve, reject) => {
|
|
151
|
-
sourceZip.openReadStream(entry, (error, readStream) => {
|
|
152
|
-
if (error) {
|
|
153
|
-
reject(error);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (!readStream) {
|
|
157
|
-
reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const writeStream = fs_1.default.createWriteStream(outputPath);
|
|
161
|
-
readStream.once('error', reject);
|
|
162
|
-
writeStream.once('error', reject);
|
|
163
|
-
writeStream.once('close', () => resolve());
|
|
164
|
-
readStream.pipe(writeStream);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
128
|
async function filterNativePackageArchive(source, output, platform, options) {
|
|
169
129
|
await (0, fs_helpers_1.ensureDir)(path_1.default.dirname(output));
|
|
170
130
|
const scratchDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'rnu-native-package-entry-'));
|
|
@@ -211,7 +171,7 @@ async function filterNativePackageArchive(source, output, platform, options) {
|
|
|
211
171
|
const index = nestedArchiveIndex++;
|
|
212
172
|
const nestedSource = path_1.default.join(scratchDir, `${index}.source.hap`);
|
|
213
173
|
const nestedOutput = path_1.default.join(scratchDir, `${index}.slim.hap`);
|
|
214
|
-
await
|
|
174
|
+
await (0, zip_entries_1.writeEntry)(entry, sourceZip, nestedSource);
|
|
215
175
|
const nestedResult = await filterNativePackageArchive(nestedSource, nestedOutput, platform, options);
|
|
216
176
|
if (nestedResult.entries > 0) {
|
|
217
177
|
await sink.addFile(nestedOutput, entry.fileName, entry);
|
package/lib/package.d.ts
CHANGED
|
@@ -12,7 +12,12 @@ type PackageCommandOptions = Record<string, unknown> & {
|
|
|
12
12
|
splits?: string;
|
|
13
13
|
output?: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function toNumericIds(ids: string[]): number[];
|
|
16
|
+
/**
|
|
17
|
+
* Delete versions or packages of an app: one id through
|
|
18
|
+
* `DELETE /app/:appId/<kind>/:id`, several in one `DELETE /app/:appId/<kind>`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function deleteByIds(appId: string | number, kind: 'version' | 'package', ids: string[]): Promise<void>;
|
|
16
21
|
/**
|
|
17
22
|
* Print the app's native packages. Pass `packages` when the caller already
|
|
18
23
|
* fetched them (every page of the list), to skip fetching them again.
|