react-native-update-cli 1.30.4 → 1.31.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/cli.json +3 -1
- package/lib/api.js +177 -186
- package/lib/app.js +136 -114
- package/lib/bundle.js +535 -559
- package/lib/index.js +46 -49
- package/lib/package.js +132 -136
- package/lib/user.js +43 -41
- package/lib/utils/app-info-parser/apk.js +72 -71
- package/lib/utils/app-info-parser/index.js +28 -30
- package/lib/utils/app-info-parser/ipa.js +72 -80
- package/lib/utils/app-info-parser/resource-finder.js +286 -421
- package/lib/utils/app-info-parser/utils.js +106 -120
- package/lib/utils/app-info-parser/xml-parser/binary.js +539 -637
- package/lib/utils/app-info-parser/xml-parser/manifest.js +193 -215
- package/lib/utils/app-info-parser/zip.js +40 -40
- package/lib/utils/index.js +154 -149
- package/lib/versions.js +226 -178
- package/package.json +10 -9
- package/src/api.js +6 -3
- package/src/bundle.js +11 -10
- package/src/versions.js +80 -16
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
const ApkParser = require('./apk');
|
|
4
3
|
const IpaParser = require('./ipa');
|
|
5
|
-
const supportFileTypes = [
|
|
6
|
-
|
|
4
|
+
const supportFileTypes = [
|
|
5
|
+
'ipa',
|
|
6
|
+
'apk'
|
|
7
|
+
];
|
|
7
8
|
class AppInfoParser {
|
|
8
|
-
|
|
9
|
+
parse() {
|
|
10
|
+
return this.parser.parse();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
9
13
|
* parser for parsing .ipa or .apk file
|
|
10
14
|
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
break;
|
|
15
|
+
*/ constructor(file){
|
|
16
|
+
if (!file) {
|
|
17
|
+
throw new Error('Param miss: file(file\'s path in Node, instance of File or Blob in browser).');
|
|
18
|
+
}
|
|
19
|
+
const splits = (file.name || file).split('.');
|
|
20
|
+
const fileType = splits[splits.length - 1].toLowerCase();
|
|
21
|
+
if (!supportFileTypes.includes(fileType)) {
|
|
22
|
+
throw new Error('Unsupported file type, only support .ipa or .apk file.');
|
|
23
|
+
}
|
|
24
|
+
this.file = file;
|
|
25
|
+
switch(fileType){
|
|
26
|
+
case 'ipa':
|
|
27
|
+
this.parser = new IpaParser(this.file);
|
|
28
|
+
break;
|
|
29
|
+
case 'apk':
|
|
30
|
+
this.parser = new ApkParser(this.file);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
|
-
}
|
|
32
|
-
parse() {
|
|
33
|
-
return this.parser.parse();
|
|
34
|
-
}
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
module.exports = AppInfoParser;
|
|
35
|
+
module.exports = AppInfoParser;
|
|
@@ -1,96 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
5
2
|
const parsePlist = require('plist').parse;
|
|
6
3
|
const parseBplist = require('bplist-parser').parseBuffer;
|
|
7
4
|
const cgbiToPng = require('cgbi-to-png');
|
|
8
|
-
|
|
9
5
|
const Zip = require('./zip');
|
|
10
6
|
const { findIpaIconPath, getBase64FromBuffer, isBrowser } = require('./utils');
|
|
11
|
-
|
|
12
7
|
const PlistName = new RegExp('payload/[^/]+?.app/info.plist$', 'i');
|
|
13
8
|
const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/;
|
|
14
|
-
|
|
15
9
|
class IpaParser extends Zip {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
resolve(plistInfo);
|
|
53
|
-
}).catch(e => {
|
|
54
|
-
reject(e);
|
|
10
|
+
parse() {
|
|
11
|
+
return new Promise((resolve, reject)=>{
|
|
12
|
+
this.getEntries([
|
|
13
|
+
PlistName,
|
|
14
|
+
ProvisionName
|
|
15
|
+
]).then((buffers)=>{
|
|
16
|
+
if (!buffers[PlistName]) {
|
|
17
|
+
throw new Error('Info.plist can\'t be found.');
|
|
18
|
+
}
|
|
19
|
+
const plistInfo = this._parsePlist(buffers[PlistName]);
|
|
20
|
+
// parse mobile provision
|
|
21
|
+
const provisionInfo = this._parseProvision(buffers[ProvisionName]);
|
|
22
|
+
plistInfo.mobileProvision = provisionInfo;
|
|
23
|
+
// find icon path and parse icon
|
|
24
|
+
const iconRegex = new RegExp(findIpaIconPath(plistInfo).toLowerCase());
|
|
25
|
+
this.getEntry(iconRegex).then((iconBuffer)=>{
|
|
26
|
+
try {
|
|
27
|
+
// In general, the ipa file's icon has been specially processed, should be converted
|
|
28
|
+
plistInfo.icon = iconBuffer ? getBase64FromBuffer(cgbiToPng.revert(iconBuffer)) : null;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (isBrowser()) {
|
|
31
|
+
// Normal conversion in other cases
|
|
32
|
+
plistInfo.icon = iconBuffer ? getBase64FromBuffer(window.btoa(String.fromCharCode(...iconBuffer))) : null;
|
|
33
|
+
} else {
|
|
34
|
+
plistInfo.icon = null;
|
|
35
|
+
console.warn('[Warning] failed to parse icon: ', err);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
resolve(plistInfo);
|
|
39
|
+
}).catch((e)=>{
|
|
40
|
+
reject(e);
|
|
41
|
+
});
|
|
42
|
+
}).catch((e)=>{
|
|
43
|
+
reject(e);
|
|
44
|
+
});
|
|
55
45
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
62
48
|
* Parse plist
|
|
63
49
|
* @param {Buffer} buffer // plist file's buffer
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
*/ _parsePlist(buffer) {
|
|
51
|
+
let result;
|
|
52
|
+
const bufferType = buffer[0];
|
|
53
|
+
if (bufferType === 60 || bufferType === '<' || bufferType === 239) {
|
|
54
|
+
result = parsePlist(buffer.toString());
|
|
55
|
+
} else if (bufferType === 98) {
|
|
56
|
+
result = parseBplist(buffer)[0];
|
|
57
|
+
} else {
|
|
58
|
+
throw new Error('Unknown plist buffer type.');
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
74
61
|
}
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
62
|
+
/**
|
|
78
63
|
* parse provision
|
|
79
64
|
* @param {Buffer} buffer // provision file's buffer
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
*/ _parseProvision(buffer) {
|
|
66
|
+
let info = {};
|
|
67
|
+
if (buffer) {
|
|
68
|
+
let content = buffer.toString('utf-8');
|
|
69
|
+
const firstIndex = content.indexOf('<?xml');
|
|
70
|
+
const endIndex = content.indexOf('</plist>');
|
|
71
|
+
content = content.slice(firstIndex, endIndex + 8);
|
|
72
|
+
if (content) {
|
|
73
|
+
info = parsePlist(content);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return info;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* parser for parsing .ipa file
|
|
80
|
+
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
|
81
|
+
*/ constructor(file){
|
|
82
|
+
super(file);
|
|
83
|
+
if (!(this instanceof IpaParser)) {
|
|
84
|
+
return new IpaParser(file);
|
|
85
|
+
}
|
|
91
86
|
}
|
|
92
|
-
return info;
|
|
93
|
-
}
|
|
94
87
|
}
|
|
95
|
-
|
|
96
|
-
module.exports = IpaParser;
|
|
88
|
+
module.exports = IpaParser;
|