react-native-update-cli 2.5.0 → 2.7.0
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/cli.json +26 -0
- package/lib/api.js +45 -12
- package/lib/locales/en.js +13 -1
- package/lib/locales/zh.js +13 -1
- package/lib/package.js +53 -6
- package/lib/provider.js +3 -0
- package/lib/utils/app-info-parser/aab.js +165 -201
- package/lib/utils/app-info-parser/apk.js +25 -27
- package/lib/utils/app-info-parser/app.js +10 -11
- package/lib/utils/app-info-parser/index.js +8 -8
- package/lib/utils/app-info-parser/ipa.js +16 -21
- package/lib/utils/app-info-parser/resource-finder.js +365 -305
- package/lib/utils/app-info-parser/utils.js +78 -63
- package/lib/utils/app-info-parser/xml-parser/binary.js +57 -51
- package/lib/utils/app-info-parser/xml-parser/manifest.js +47 -39
- package/lib/utils/app-info-parser/zip.js +21 -11
- package/lib/utils/http-helper.js +1 -1
- package/package.json +1 -1
- package/src/api.ts +45 -19
- package/src/locales/en.ts +17 -0
- package/src/locales/zh.ts +15 -0
- package/src/modules/version-module.ts +1 -1
- package/src/package.ts +102 -11
- package/src/provider.ts +3 -0
- package/src/utils/app-info-parser/aab.ts +240 -0
- package/src/utils/app-info-parser/{apk.js → apk.ts} +30 -41
- package/src/utils/app-info-parser/app.ts +3 -0
- package/src/utils/app-info-parser/index.ts +4 -4
- package/src/utils/app-info-parser/{ipa.js → ipa.ts} +17 -31
- package/src/utils/app-info-parser/resource-finder.ts +508 -0
- package/src/utils/app-info-parser/utils.ts +162 -0
- package/src/utils/app-info-parser/xml-parser/{binary.js → binary.ts} +69 -61
- package/src/utils/app-info-parser/xml-parser/{manifest.js → manifest.ts} +50 -51
- package/src/utils/app-info-parser/zip.ts +86 -0
- package/src/utils/dep-versions.ts +7 -4
- package/src/utils/http-helper.ts +1 -1
- package/src/utils/latest-version/index.ts +2 -1
- package/src/versions.ts +1 -1
- package/src/utils/app-info-parser/aab.js +0 -326
- package/src/utils/app-info-parser/app.js +0 -16
- package/src/utils/app-info-parser/resource-finder.js +0 -495
- package/src/utils/app-info-parser/utils.js +0 -172
- package/src/utils/app-info-parser/zip.js +0 -66
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const Unzip = require('isomorphic-unzip');
|
|
2
|
-
const { isBrowser, decodeNullUnicode } = require('./utils');
|
|
3
|
-
const { enumZipEntries, readEntry } = require('../../bundle');
|
|
4
|
-
|
|
5
|
-
class Zip {
|
|
6
|
-
constructor(file) {
|
|
7
|
-
if (isBrowser()) {
|
|
8
|
-
if (!(file instanceof window.Blob || typeof file.size !== 'undefined')) {
|
|
9
|
-
throw new Error(
|
|
10
|
-
'Param error: [file] must be an instance of Blob or File in browser.',
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
this.file = file;
|
|
14
|
-
} else {
|
|
15
|
-
if (typeof file !== 'string') {
|
|
16
|
-
throw new Error('Param error: [file] must be file path in Node.');
|
|
17
|
-
}
|
|
18
|
-
this.file = require('path').resolve(file);
|
|
19
|
-
}
|
|
20
|
-
this.unzip = new Unzip(this.file);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* get entries by regexps, the return format is: { <filename>: <Buffer|Blob> }
|
|
25
|
-
* @param {Array} regexps // regexps for matching files
|
|
26
|
-
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
27
|
-
*/
|
|
28
|
-
getEntries(regexps, type = 'buffer') {
|
|
29
|
-
regexps = regexps.map((regex) => decodeNullUnicode(regex));
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
this.unzip.getBuffer(regexps, { type }, (err, buffers) => {
|
|
32
|
-
err ? reject(err) : resolve(buffers);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* get entry by regex, return an instance of Buffer or Blob
|
|
38
|
-
* @param {Regex} regex // regex for matching file
|
|
39
|
-
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
40
|
-
*/
|
|
41
|
-
getEntry(regex, type = 'buffer') {
|
|
42
|
-
regex = decodeNullUnicode(regex);
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
this.unzip.getBuffer([regex], { type }, (err, buffers) => {
|
|
45
|
-
// console.log(buffers);
|
|
46
|
-
err ? reject(err) : resolve(buffers[regex]);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async getEntryFromHarmonyApp(regex) {
|
|
52
|
-
try {
|
|
53
|
-
let originSource;
|
|
54
|
-
await enumZipEntries(this.file, (entry, zipFile) => {
|
|
55
|
-
if (regex.test(entry.fileName)) {
|
|
56
|
-
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return originSource;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error('Error in getEntryFromHarmonyApp:', error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = Zip;
|