react-native-update-cli 2.9.5 → 2.9.7
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/api.js +22 -19
- package/lib/app.js +9 -9
- package/lib/bundle-pack.js +1 -1
- package/lib/bundle-runner.js +16 -16
- package/lib/diff.js +14 -91
- package/lib/exports.d.ts +8 -8
- package/lib/exports.js +23 -23
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -3
- package/lib/module-manager.js +3 -3
- package/lib/modules/app-module.js +1 -1
- package/lib/modules/index.d.ts +3 -3
- package/lib/modules/index.js +7 -7
- package/lib/package.js +9 -9
- package/lib/utils/app-info-parser/aab.js +8 -8
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/resource-finder.js +7 -7
- package/lib/utils/app-info-parser/utils.d.ts +1 -1
- package/lib/utils/app-info-parser/utils.js +10 -10
- package/lib/utils/app-info-parser/xml-parser/binary.js +2 -2
- package/lib/utils/command-result.js +3 -3
- package/lib/utils/constants.js +10 -10
- package/lib/utils/git.js +1 -1
- package/lib/utils/http-helper.js +5 -5
- package/lib/utils/index.js +13 -13
- package/lib/utils/latest-version/cli.js +2 -2
- package/lib/utils/latest-version/index.d.ts +1 -1
- package/lib/utils/latest-version/index.js +12 -12
- package/lib/utils/options.js +5 -5
- package/lib/utils/plugin-config.js +2 -2
- package/lib/utils/zip-entries.js +28 -11
- package/lib/utils/zip-options.d.ts +2 -1
- package/lib/utils/zip-options.js +17 -8
- package/lib/versions.d.ts +1 -1
- package/lib/versions.js +9 -13
- package/package.json +22 -19
- package/src/api.ts +11 -6
- package/src/app.ts +5 -4
- package/src/bundle-pack.ts +1 -1
- package/src/bundle-runner.ts +2 -2
- package/src/diff.ts +9 -161
- package/src/exports.ts +17 -20
- package/src/index.ts +2 -2
- package/src/modules/index.ts +3 -3
- package/src/package.ts +1 -1
- package/src/utils/app-info-parser/aab.ts +1 -1
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +5 -5
- package/src/utils/git.ts +1 -1
- package/src/utils/index.ts +4 -5
- package/src/utils/latest-version/cli.ts +4 -4
- package/src/utils/latest-version/index.ts +5 -6
- package/src/utils/zip-entries.ts +26 -8
- package/src/utils/zip-options.ts +7 -7
- package/src/versions.ts +11 -18
package/lib/utils/zip-options.js
CHANGED
|
@@ -5,28 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
12
|
+
get MANIFEST_COMPRESSION_THRESHOLD_BYTES () {
|
|
13
|
+
return MANIFEST_COMPRESSION_THRESHOLD_BYTES;
|
|
14
|
+
},
|
|
15
|
+
get ZIP_ENTRY_SNIFF_BYTES () {
|
|
13
16
|
return ZIP_ENTRY_SNIFF_BYTES;
|
|
14
17
|
},
|
|
15
|
-
zipOptionsForManifestEntry
|
|
18
|
+
get zipOptionsForManifestEntry () {
|
|
16
19
|
return zipOptionsForManifestEntry;
|
|
17
20
|
},
|
|
18
|
-
zipOptionsForPatchEntry
|
|
21
|
+
get zipOptionsForPatchEntry () {
|
|
19
22
|
return zipOptionsForPatchEntry;
|
|
20
23
|
},
|
|
21
|
-
zipOptionsForPayloadEntry
|
|
24
|
+
get zipOptionsForPayloadEntry () {
|
|
22
25
|
return zipOptionsForPayloadEntry;
|
|
23
26
|
},
|
|
24
|
-
zipOptionsForPayloadFile
|
|
27
|
+
get zipOptionsForPayloadFile () {
|
|
25
28
|
return zipOptionsForPayloadFile;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
29
31
|
const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
32
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
30
33
|
function _interop_require_default(obj) {
|
|
31
34
|
return obj && obj.__esModule ? obj : {
|
|
32
35
|
default: obj
|
|
@@ -74,6 +77,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
74
77
|
return newObj;
|
|
75
78
|
}
|
|
76
79
|
const ZIP_ENTRY_SNIFF_BYTES = 64;
|
|
80
|
+
const MANIFEST_COMPRESSION_THRESHOLD_BYTES = 256;
|
|
77
81
|
const alreadyCompressedExtensions = new Set([
|
|
78
82
|
'.7z',
|
|
79
83
|
'.aab',
|
|
@@ -236,7 +240,12 @@ function zipOptionsForPatchEntry() {
|
|
|
236
240
|
compress: false
|
|
237
241
|
};
|
|
238
242
|
}
|
|
239
|
-
function zipOptionsForManifestEntry() {
|
|
243
|
+
function zipOptionsForManifestEntry(byteLength = 0) {
|
|
244
|
+
if (byteLength >= MANIFEST_COMPRESSION_THRESHOLD_BYTES) {
|
|
245
|
+
return {
|
|
246
|
+
compressionLevel: 9
|
|
247
|
+
};
|
|
248
|
+
}
|
|
240
249
|
return {
|
|
241
250
|
compress: false
|
|
242
251
|
};
|
package/lib/versions.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const versionCommands: {
|
|
|
36
36
|
updateVersionInfo: ({ options, }: {
|
|
37
37
|
options: VersionCommandOptions;
|
|
38
38
|
}) => Promise<void>;
|
|
39
|
-
deleteVersion: ({ options
|
|
39
|
+
deleteVersion: ({ options }: {
|
|
40
40
|
options: VersionCommandOptions;
|
|
41
41
|
}) => Promise<void>;
|
|
42
42
|
};
|
package/lib/versions.js
CHANGED
|
@@ -5,27 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
bindVersionToPackages
|
|
12
|
+
get bindVersionToPackages () {
|
|
13
13
|
return bindVersionToPackages;
|
|
14
14
|
},
|
|
15
|
-
versionCommands
|
|
15
|
+
get versionCommands () {
|
|
16
16
|
return versionCommands;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _api = require("./api");
|
|
20
|
-
const _utils = require("./utils");
|
|
21
|
-
const _i18n = require("./utils/i18n");
|
|
22
19
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
23
20
|
const _compareversions = require("compare-versions");
|
|
24
21
|
const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
|
|
22
|
+
const _api = require("./api");
|
|
25
23
|
const _app = require("./app");
|
|
26
24
|
const _package = require("./package");
|
|
25
|
+
const _utils = require("./utils");
|
|
27
26
|
const _depversions = require("./utils/dep-versions");
|
|
28
27
|
const _git = require("./utils/git");
|
|
28
|
+
const _i18n = require("./utils/i18n");
|
|
29
29
|
function _interop_require_default(obj) {
|
|
30
30
|
return obj && obj.__esModule ? obj : {
|
|
31
31
|
default: obj
|
|
@@ -375,14 +375,10 @@ const versionCommands = {
|
|
|
375
375
|
let minPkgVersion = options.minPackageVersion;
|
|
376
376
|
let maxPkgVersion = options.maxPackageVersion;
|
|
377
377
|
let packageVersionRange = options.packageVersionRange;
|
|
378
|
-
let rollout
|
|
378
|
+
let rollout;
|
|
379
379
|
if (options.rollout !== undefined) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
} catch (e) {
|
|
383
|
-
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
384
|
-
}
|
|
385
|
-
if (rollout < 1 || rollout > 100) {
|
|
380
|
+
rollout = Number.parseInt(options.rollout, 10);
|
|
381
|
+
if (Number.isNaN(rollout) || rollout < 1 || rollout > 100) {
|
|
386
382
|
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
387
383
|
}
|
|
388
384
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.7",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "lib/exports.js",
|
|
6
6
|
"types": "lib/exports.d.ts",
|
|
@@ -37,9 +37,12 @@
|
|
|
37
37
|
"cli.json"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "rm -rf lib && swc src -d lib --strip-leading-paths &&
|
|
41
|
-
"prepublishOnly": "bun
|
|
42
|
-
"
|
|
40
|
+
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build",
|
|
41
|
+
"prepublishOnly": "bun run build && chmod +x lib/index.js",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"typecheck:build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"lint": "bun run typecheck && biome check .",
|
|
45
|
+
"lint:fix": "bun run typecheck && biome check --write .",
|
|
43
46
|
"test": "bun test",
|
|
44
47
|
"test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov"
|
|
45
48
|
},
|
|
@@ -70,12 +73,12 @@
|
|
|
70
73
|
"commander": "^13",
|
|
71
74
|
"compare-versions": "^6.1.1",
|
|
72
75
|
"filesize-parser": "^1.5.1",
|
|
73
|
-
"form-data": "^4.0.
|
|
76
|
+
"form-data": "^4.0.5",
|
|
74
77
|
"fs-extra": "8",
|
|
75
78
|
"global-dirs": "^4.0.0",
|
|
76
79
|
"gradle-to-js": "^2.0.1",
|
|
77
|
-
"i18next": "^
|
|
78
|
-
"isomorphic-git": "^1.
|
|
80
|
+
"i18next": "^26.0.4",
|
|
81
|
+
"isomorphic-git": "^1.37.5",
|
|
79
82
|
"isomorphic-unzip": "^1.1.5",
|
|
80
83
|
"node-fetch": "^2.6.1",
|
|
81
84
|
"plist": "^3.1.0",
|
|
@@ -83,31 +86,31 @@
|
|
|
83
86
|
"properties": "^1.2.1",
|
|
84
87
|
"protobufjs": "^7.5.4",
|
|
85
88
|
"read": "^4.1.0",
|
|
86
|
-
"registry-auth-token": "^5.1.
|
|
87
|
-
"semver": "^7.7.
|
|
89
|
+
"registry-auth-token": "^5.1.1",
|
|
90
|
+
"semver": "^7.7.4",
|
|
88
91
|
"tcp-ping": "^0.1.1",
|
|
89
|
-
"tty-table": "
|
|
90
|
-
"yauzl": "^3.
|
|
92
|
+
"tty-table": "5.0",
|
|
93
|
+
"yauzl": "^3.3.0",
|
|
91
94
|
"yazl": "3.3.1"
|
|
92
95
|
},
|
|
93
96
|
"engines": {
|
|
94
97
|
"node": ">= 14"
|
|
95
98
|
},
|
|
96
99
|
"devDependencies": {
|
|
97
|
-
"@biomejs/biome": "^
|
|
98
|
-
"@swc/cli": "0.
|
|
99
|
-
"@swc/core": "^1.
|
|
100
|
-
"@types/bun": "^1.3.
|
|
100
|
+
"@biomejs/biome": "^2.4.11",
|
|
101
|
+
"@swc/cli": "0.8.1",
|
|
102
|
+
"@swc/core": "^1.15.24",
|
|
103
|
+
"@types/bun": "^1.3.12",
|
|
101
104
|
"@types/filesize-parser": "^1.5.3",
|
|
102
105
|
"@types/fs-extra": "^11.0.4",
|
|
103
|
-
"@types/node": "^
|
|
104
|
-
"@types/node-fetch": "^2.6.
|
|
106
|
+
"@types/node": "^25.6.0",
|
|
107
|
+
"@types/node-fetch": "^2.6.13",
|
|
105
108
|
"@types/progress": "^2.0.7",
|
|
106
|
-
"@types/semver": "^7.7.
|
|
109
|
+
"@types/semver": "^7.7.1",
|
|
107
110
|
"@types/tcp-ping": "^0.1.6",
|
|
108
111
|
"@types/yauzl": "^2.10.3",
|
|
109
112
|
"@types/yazl": "^2.4.6",
|
|
110
|
-
"typescript": "^
|
|
113
|
+
"typescript": "^6.0.2"
|
|
111
114
|
},
|
|
112
115
|
"trustedDependencies": [
|
|
113
116
|
"@biomejs/biome",
|
package/src/api.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import util from 'util';
|
|
4
1
|
import filesizeParser from 'filesize-parser';
|
|
5
2
|
import FormData from 'form-data';
|
|
3
|
+
import fs from 'fs';
|
|
6
4
|
import fetch from 'node-fetch';
|
|
5
|
+
import path from 'path';
|
|
7
6
|
import ProgressBar from 'progress';
|
|
8
7
|
import tcpp from 'tcp-ping';
|
|
8
|
+
import util from 'util';
|
|
9
9
|
import { getBaseUrl } from 'utils/http-helper';
|
|
10
10
|
import packageJson from '../package.json';
|
|
11
11
|
import type { Package, Session } from './types';
|
|
12
|
-
import {
|
|
12
|
+
import { credentialFile, IS_CRESC, pricingPageUrl } from './utils/constants';
|
|
13
13
|
import { t } from './utils/i18n';
|
|
14
14
|
|
|
15
15
|
const tcpPing = util.promisify(tcpp.ping);
|
|
@@ -98,7 +98,13 @@ async function query(url: string, options: fetch.RequestInit) {
|
|
|
98
98
|
let json: any;
|
|
99
99
|
try {
|
|
100
100
|
json = JSON.parse(text);
|
|
101
|
-
} catch (e) {
|
|
101
|
+
} catch (e) {
|
|
102
|
+
if (resp.status === 200 && text) {
|
|
103
|
+
console.warn(
|
|
104
|
+
`Warning: API returned 200 with non-JSON body (${text.length} bytes)`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
|
|
103
109
|
if (resp.status !== 200) {
|
|
104
110
|
const message = json?.message || resp.statusText || `HTTP ${resp.status}`;
|
|
@@ -157,7 +163,6 @@ export async function uploadFile(fn: string, key?: string) {
|
|
|
157
163
|
});
|
|
158
164
|
let realUrl = url;
|
|
159
165
|
if (backupUrl) {
|
|
160
|
-
// @ts-ignore
|
|
161
166
|
if (global.USE_ACC_OSS) {
|
|
162
167
|
realUrl = backupUrl;
|
|
163
168
|
} else {
|
package/src/app.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import Table from 'tty-table';
|
|
3
|
-
import { question } from './utils';
|
|
4
|
-
|
|
5
3
|
import { doDelete, get, post } from './api';
|
|
6
4
|
import type { Platform } from './types';
|
|
5
|
+
import { question } from './utils';
|
|
7
6
|
import { t } from './utils/i18n';
|
|
8
7
|
|
|
9
8
|
interface AppSummary {
|
|
@@ -112,7 +111,7 @@ export const appCommands = {
|
|
|
112
111
|
options: { platform: Platform };
|
|
113
112
|
}) => {
|
|
114
113
|
const { platform } = options;
|
|
115
|
-
const id = args[0] || chooseApp(platform);
|
|
114
|
+
const id = args[0] || (await chooseApp(platform)).id;
|
|
116
115
|
if (!id) {
|
|
117
116
|
console.log(t('cancelled'));
|
|
118
117
|
}
|
|
@@ -139,7 +138,9 @@ export const appCommands = {
|
|
|
139
138
|
Record<Platform, { appId: number; appKey: string }>
|
|
140
139
|
> = {};
|
|
141
140
|
try {
|
|
142
|
-
updateInfo = JSON.parse(
|
|
141
|
+
updateInfo = JSON.parse(
|
|
142
|
+
await fs.promises.readFile('update.json', 'utf8'),
|
|
143
|
+
);
|
|
143
144
|
} catch (e: any) {
|
|
144
145
|
if (e.code !== 'ENOENT') {
|
|
145
146
|
console.error(t('failedToParseUpdateJson'));
|
package/src/bundle-pack.ts
CHANGED
package/src/bundle-runner.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn, spawnSync } from 'child_process';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import path from 'path';
|
|
4
2
|
import { satisfies } from 'compare-versions';
|
|
5
3
|
import * as fs from 'fs-extra';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
6
|
import { t } from './utils/i18n';
|
|
7
7
|
|
|
8
8
|
const g2js = require('gradle-to-js/lib/parser');
|
package/src/diff.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import * as fs from 'fs-extra';
|
|
3
2
|
import { npm, yarn } from 'global-dirs';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import { ZipFile as YazlZipFile } from 'yazl';
|
|
5
5
|
import type { CommandContext } from './types';
|
|
6
6
|
import { translateOptions } from './utils';
|
|
@@ -19,41 +19,12 @@ import {
|
|
|
19
19
|
} from './utils/zip-options';
|
|
20
20
|
|
|
21
21
|
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
|
22
|
-
type HpatchCover = {
|
|
23
|
-
oldPos: number | string | bigint;
|
|
24
|
-
newPos: number | string | bigint;
|
|
25
|
-
len: number | string | bigint;
|
|
26
|
-
};
|
|
27
|
-
type HpatchCompatiblePlan = {
|
|
28
|
-
covers?: HpatchCover[];
|
|
29
|
-
};
|
|
30
|
-
type HdiffWithCoversOptions = {
|
|
31
|
-
mode?: 'replace' | 'merge' | 'native-coalesce';
|
|
32
|
-
};
|
|
33
22
|
type HdiffModule = {
|
|
34
23
|
diff?: Diff;
|
|
35
|
-
diffWithCovers?: (
|
|
36
|
-
oldSource: Buffer,
|
|
37
|
-
newSource: Buffer,
|
|
38
|
-
covers: HpatchCover[],
|
|
39
|
-
options?: HdiffWithCoversOptions,
|
|
40
|
-
) => { diff?: Buffer };
|
|
41
24
|
};
|
|
42
25
|
type BsdiffModule = {
|
|
43
26
|
diff?: Diff;
|
|
44
27
|
};
|
|
45
|
-
type ChiffModule = {
|
|
46
|
-
hpatchCompatiblePlanResult?: (
|
|
47
|
-
oldSource: Buffer,
|
|
48
|
-
newSource: Buffer,
|
|
49
|
-
) => HpatchCompatiblePlan;
|
|
50
|
-
hpatchApproximatePlanResult?: (
|
|
51
|
-
oldSource: Buffer,
|
|
52
|
-
newSource: Buffer,
|
|
53
|
-
) => HpatchCompatiblePlan;
|
|
54
|
-
};
|
|
55
|
-
type ChiffHpatchPolicy = 'off' | 'costed';
|
|
56
|
-
type ChiffHpatchExactPolicy = 'off' | 'on';
|
|
57
28
|
type EntryMap = Record<string, { crc32: number; fileName: string }>;
|
|
58
29
|
type CrcMap = Record<number, string>;
|
|
59
30
|
type CopyMap = Record<string, string>;
|
|
@@ -86,124 +57,9 @@ const loadModule = <T>(pkgName: string): T | undefined => {
|
|
|
86
57
|
|
|
87
58
|
const hdiff = loadModule<HdiffModule>('node-hdiffpatch');
|
|
88
59
|
const bsdiff = loadModule<BsdiffModule>('node-bsdiff');
|
|
89
|
-
const chiff = loadModule<ChiffModule>('@chiff/node');
|
|
90
|
-
|
|
91
|
-
// Structured covers are experimental and can be expensive on real Hermes input.
|
|
92
|
-
// Keep native hdiff as the default unless the server explicitly opts in.
|
|
93
|
-
function resolveChiffHpatchPolicy(policy?: unknown): ChiffHpatchPolicy {
|
|
94
|
-
const value = String(
|
|
95
|
-
policy ?? process.env.RNU_CHIFF_HPATCH_POLICY ?? 'off',
|
|
96
|
-
).toLowerCase();
|
|
97
|
-
if (
|
|
98
|
-
value === 'costed' ||
|
|
99
|
-
value === 'on' ||
|
|
100
|
-
value === 'true' ||
|
|
101
|
-
value === '1'
|
|
102
|
-
) {
|
|
103
|
-
return 'costed';
|
|
104
|
-
}
|
|
105
|
-
return 'off';
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function resolveChiffHpatchMinNativeBytes(value?: unknown): number {
|
|
109
|
-
const raw = value ?? process.env.RNU_CHIFF_HPATCH_MIN_NATIVE_BYTES ?? 4096;
|
|
110
|
-
const parsed = Number(raw);
|
|
111
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
112
|
-
return 4096;
|
|
113
|
-
}
|
|
114
|
-
return Math.floor(parsed);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function resolveChiffHpatchExactPolicy(policy?: unknown): ChiffHpatchExactPolicy {
|
|
118
|
-
const value = String(
|
|
119
|
-
policy ?? process.env.RNU_CHIFF_HPATCH_EXACT_COVERS ?? 'off',
|
|
120
|
-
).toLowerCase();
|
|
121
|
-
if (value === 'on' || value === 'true' || value === '1') {
|
|
122
|
-
return 'on';
|
|
123
|
-
}
|
|
124
|
-
return 'off';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function createChiffAwareHdiff(
|
|
128
|
-
hdiffModule: HdiffModule,
|
|
129
|
-
chiffModule: ChiffModule | undefined,
|
|
130
|
-
policy: ChiffHpatchPolicy,
|
|
131
|
-
minNativeBytes: number,
|
|
132
|
-
exactPolicy: ChiffHpatchExactPolicy,
|
|
133
|
-
): Diff {
|
|
134
|
-
const baseDiff = hdiffModule.diff;
|
|
135
|
-
if (!baseDiff) {
|
|
136
|
-
throw new Error(t('nodeHdiffpatchRequired', { scriptName }));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (policy === 'off') {
|
|
140
|
-
return baseDiff;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return (oldSource?: Buffer, newSource?: Buffer) => {
|
|
144
|
-
const nativeDiff = baseDiff(oldSource, newSource);
|
|
145
|
-
if (!oldSource || !newSource || !hdiffModule.diffWithCovers) {
|
|
146
|
-
return nativeDiff;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let bestDiff = nativeDiff;
|
|
150
|
-
const tryDiffWithCovers = (
|
|
151
|
-
covers: HpatchCover[],
|
|
152
|
-
mode: 'replace' | 'merge' | 'native-coalesce',
|
|
153
|
-
) => {
|
|
154
|
-
try {
|
|
155
|
-
const result = hdiffModule.diffWithCovers?.(
|
|
156
|
-
oldSource,
|
|
157
|
-
newSource,
|
|
158
|
-
covers,
|
|
159
|
-
{ mode },
|
|
160
|
-
);
|
|
161
|
-
if (
|
|
162
|
-
Buffer.isBuffer(result?.diff) &&
|
|
163
|
-
result.diff.length < bestDiff.length
|
|
164
|
-
) {
|
|
165
|
-
bestDiff = result.diff;
|
|
166
|
-
}
|
|
167
|
-
} catch {}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
tryDiffWithCovers([], 'native-coalesce');
|
|
171
|
-
|
|
172
|
-
if (nativeDiff.length < minNativeBytes) {
|
|
173
|
-
return bestDiff;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const approximatePlan = chiffModule?.hpatchApproximatePlanResult?.(
|
|
178
|
-
oldSource,
|
|
179
|
-
newSource,
|
|
180
|
-
);
|
|
181
|
-
if (Array.isArray(approximatePlan?.covers)) {
|
|
182
|
-
tryDiffWithCovers(approximatePlan.covers, 'merge');
|
|
183
|
-
}
|
|
184
|
-
} catch {}
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
exactPolicy === 'off' ||
|
|
188
|
-
!chiffModule?.hpatchCompatiblePlanResult
|
|
189
|
-
) {
|
|
190
|
-
return bestDiff;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
try {
|
|
194
|
-
const plan = chiffModule.hpatchCompatiblePlanResult(oldSource, newSource);
|
|
195
|
-
if (Array.isArray(plan.covers)) {
|
|
196
|
-
tryDiffWithCovers(plan.covers, 'replace');
|
|
197
|
-
tryDiffWithCovers(plan.covers, 'merge');
|
|
198
|
-
}
|
|
199
|
-
} catch {}
|
|
200
|
-
|
|
201
|
-
return bestDiff;
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
60
|
|
|
205
61
|
function basename(fn: string): string | undefined {
|
|
206
|
-
const m = /^(.+\/)[
|
|
62
|
+
const m = /^(.+\/)[^/]+\/?$/.exec(fn);
|
|
207
63
|
return m?.[1];
|
|
208
64
|
}
|
|
209
65
|
|
|
@@ -347,10 +203,11 @@ async function diffFromPPK(
|
|
|
347
203
|
}
|
|
348
204
|
|
|
349
205
|
//console.log({copies, deletes});
|
|
206
|
+
const diffManifest = Buffer.from(JSON.stringify({ copies, deletes }));
|
|
350
207
|
zipfile.addBuffer(
|
|
351
|
-
|
|
208
|
+
diffManifest,
|
|
352
209
|
'__diff.json',
|
|
353
|
-
zipOptionsForManifestEntry(),
|
|
210
|
+
zipOptionsForManifestEntry(diffManifest.length),
|
|
354
211
|
);
|
|
355
212
|
zipfile.end();
|
|
356
213
|
await writePromise;
|
|
@@ -461,10 +318,11 @@ async function diffFromPackage(
|
|
|
461
318
|
}
|
|
462
319
|
});
|
|
463
320
|
|
|
321
|
+
const diffManifest = Buffer.from(JSON.stringify({ copies }));
|
|
464
322
|
zipfile.addBuffer(
|
|
465
|
-
|
|
323
|
+
diffManifest,
|
|
466
324
|
'__diff.json',
|
|
467
|
-
zipOptionsForManifestEntry(),
|
|
325
|
+
zipOptionsForManifestEntry(diffManifest.length),
|
|
468
326
|
);
|
|
469
327
|
zipfile.end();
|
|
470
328
|
await writePromise;
|
|
@@ -473,10 +331,6 @@ async function diffFromPackage(
|
|
|
473
331
|
type DiffCommandOptions = {
|
|
474
332
|
customDiff?: Diff;
|
|
475
333
|
customHdiffModule?: HdiffModule;
|
|
476
|
-
customChiffModule?: ChiffModule;
|
|
477
|
-
chiffHpatchPolicy?: ChiffHpatchPolicy;
|
|
478
|
-
chiffHpatchMinNativeBytes?: number | string;
|
|
479
|
-
chiffHpatchExactCovers?: ChiffHpatchExactPolicy | boolean | string | number;
|
|
480
334
|
[key: string]: any;
|
|
481
335
|
};
|
|
482
336
|
|
|
@@ -493,13 +347,7 @@ function resolveDiffImplementation(
|
|
|
493
347
|
if (!hdiffModule?.diff) {
|
|
494
348
|
throw new Error(t('nodeHdiffpatchRequired', { scriptName }));
|
|
495
349
|
}
|
|
496
|
-
return
|
|
497
|
-
hdiffModule,
|
|
498
|
-
options.customChiffModule ?? chiff,
|
|
499
|
-
resolveChiffHpatchPolicy(options.chiffHpatchPolicy),
|
|
500
|
-
resolveChiffHpatchMinNativeBytes(options.chiffHpatchMinNativeBytes),
|
|
501
|
-
resolveChiffHpatchExactPolicy(options.chiffHpatchExactCovers),
|
|
502
|
-
);
|
|
350
|
+
return hdiffModule.diff;
|
|
503
351
|
}
|
|
504
352
|
|
|
505
353
|
if (!bsdiff?.diff) {
|
package/src/exports.ts
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
+
export { getSession, loadSession } from './api';
|
|
2
|
+
export { getPlatform, getSelectedApp } from './app';
|
|
3
|
+
export { diffCommands } from './diff';
|
|
1
4
|
export { moduleManager } from './module-manager';
|
|
5
|
+
export { builtinModules } from './modules';
|
|
6
|
+
export { appModule } from './modules/app-module';
|
|
7
|
+
export { bundleModule } from './modules/bundle-module';
|
|
8
|
+
export { packageModule } from './modules/package-module';
|
|
9
|
+
export { userModule } from './modules/user-module';
|
|
10
|
+
export { versionModule } from './modules/version-module';
|
|
2
11
|
export { CLIProviderImpl } from './provider';
|
|
3
|
-
|
|
4
12
|
export type {
|
|
5
|
-
|
|
13
|
+
BundleOptions,
|
|
6
14
|
CLIModule,
|
|
7
|
-
|
|
8
|
-
CustomWorkflow,
|
|
9
|
-
WorkflowStep,
|
|
15
|
+
CLIProvider,
|
|
10
16
|
CommandContext,
|
|
17
|
+
CommandDefinition,
|
|
11
18
|
CommandResult,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
UploadOptions,
|
|
19
|
+
CustomWorkflow,
|
|
20
|
+
Package,
|
|
15
21
|
Platform,
|
|
22
|
+
PublishOptions,
|
|
16
23
|
Session,
|
|
24
|
+
UploadOptions,
|
|
17
25
|
Version,
|
|
18
|
-
|
|
26
|
+
WorkflowStep,
|
|
19
27
|
} from './types';
|
|
20
|
-
|
|
21
|
-
export { builtinModules } from './modules';
|
|
22
|
-
export { bundleModule } from './modules/bundle-module';
|
|
23
|
-
export { versionModule } from './modules/version-module';
|
|
24
|
-
export { appModule } from './modules/app-module';
|
|
25
|
-
export { userModule } from './modules/user-module';
|
|
26
|
-
export { packageModule } from './modules/package-module';
|
|
27
|
-
|
|
28
|
-
export { loadSession, getSession } from './api';
|
|
29
|
-
export { getPlatform, getSelectedApp } from './app';
|
|
30
|
-
export { diffCommands } from './diff';
|
|
31
28
|
export { question, saveToLocal } from './utils';
|
package/src/index.ts
CHANGED
|
@@ -146,14 +146,14 @@ async function run() {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export { moduleManager };
|
|
150
149
|
export { CLIProviderImpl } from './provider';
|
|
151
150
|
export type {
|
|
152
|
-
CLIProvider,
|
|
153
151
|
CLIModule,
|
|
152
|
+
CLIProvider,
|
|
154
153
|
CommandDefinition,
|
|
155
154
|
CustomWorkflow,
|
|
156
155
|
WorkflowStep,
|
|
157
156
|
} from './types';
|
|
157
|
+
export { moduleManager };
|
|
158
158
|
|
|
159
159
|
run();
|
package/src/modules/index.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { packageModule } from './package-module';
|
|
|
4
4
|
import { userModule } from './user-module';
|
|
5
5
|
import { versionModule } from './version-module';
|
|
6
6
|
|
|
7
|
-
export { bundleModule } from './bundle-module';
|
|
8
|
-
export { versionModule } from './version-module';
|
|
9
7
|
export { appModule } from './app-module';
|
|
10
|
-
export {
|
|
8
|
+
export { bundleModule } from './bundle-module';
|
|
11
9
|
export { packageModule } from './package-module';
|
|
10
|
+
export { userModule } from './user-module';
|
|
11
|
+
export { versionModule } from './version-module';
|
|
12
12
|
|
|
13
13
|
export const builtinModules = [
|
|
14
14
|
bundleModule,
|
package/src/package.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
|
+
import fs from 'fs-extra';
|
|
2
3
|
import os from 'os';
|
|
3
4
|
import path from 'path';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
5
|
import { open as openZipFile } from 'yauzl';
|
|
6
6
|
import { t } from '../i18n';
|
|
7
7
|
import { ResourceFinder } from './resource-finder';
|
|
@@ -5,7 +5,7 @@ const cgbiToPng = require('cgbi-to-png');
|
|
|
5
5
|
import { findIpaIconPath, getBase64FromBuffer, isBrowser } from './utils';
|
|
6
6
|
import { Zip } from './zip';
|
|
7
7
|
|
|
8
|
-
const PlistName = /payload\/[
|
|
8
|
+
const PlistName = /payload\/[^/]+?.app\/info.plist$/i;
|
|
9
9
|
const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/;
|
|
10
10
|
|
|
11
11
|
export class IpaParser extends Zip {
|
|
@@ -149,13 +149,13 @@ const decodeNullUnicode = (value: string | RegExp) => {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export {
|
|
152
|
+
decodeNullUnicode,
|
|
153
|
+
findApkIconPath,
|
|
154
|
+
findIpaIconPath,
|
|
155
|
+
getBase64FromBuffer,
|
|
152
156
|
isArray,
|
|
157
|
+
isBrowser,
|
|
153
158
|
isObject,
|
|
154
159
|
isPrimitive,
|
|
155
|
-
isBrowser,
|
|
156
160
|
mapInfoResource,
|
|
157
|
-
findApkIconPath,
|
|
158
|
-
findIpaIconPath,
|
|
159
|
-
getBase64FromBuffer,
|
|
160
|
-
decodeNullUnicode,
|
|
161
161
|
};
|