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,224 +1,202 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// From https://github.com/openstf/adbkit-apkreader
|
|
2
|
+
"use strict";
|
|
4
3
|
const BinaryXmlParser = require('./binary');
|
|
5
|
-
|
|
6
4
|
const INTENT_MAIN = 'android.intent.action.MAIN';
|
|
7
5
|
const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER';
|
|
8
|
-
|
|
9
6
|
class ManifestParser {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const collapsed = Object.create(null);
|
|
17
|
-
for (let attr of Array.from(element.attributes)) {
|
|
18
|
-
collapsed[attr.name] = attr.typedValue.value;
|
|
7
|
+
collapseAttributes(element) {
|
|
8
|
+
const collapsed = Object.create(null);
|
|
9
|
+
for (let attr of Array.from(element.attributes)){
|
|
10
|
+
collapsed[attr.name] = attr.typedValue.value;
|
|
11
|
+
}
|
|
12
|
+
return collapsed;
|
|
19
13
|
}
|
|
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
|
-
target.intentFilters.push(intentFilter);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
case 'meta-data':
|
|
55
|
-
target.metaData.push(this.collapseAttributes(element));
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
parseApplication(element) {
|
|
62
|
-
const app = this.collapseAttributes(element);
|
|
63
|
-
|
|
64
|
-
app.activities = [];
|
|
65
|
-
app.activityAliases = [];
|
|
66
|
-
app.launcherActivities = [];
|
|
67
|
-
app.services = [];
|
|
68
|
-
app.receivers = [];
|
|
69
|
-
app.providers = [];
|
|
70
|
-
app.usesLibraries = [];
|
|
71
|
-
app.metaData = [];
|
|
72
|
-
|
|
73
|
-
element.childNodes.forEach(element => {
|
|
74
|
-
switch (element.nodeName) {
|
|
75
|
-
case 'activity':
|
|
76
|
-
{
|
|
77
|
-
const activity = this.collapseAttributes(element);
|
|
78
|
-
this.parseIntents(element, activity);
|
|
79
|
-
app.activities.push(activity);
|
|
80
|
-
if (this.isLauncherActivity(activity)) {
|
|
81
|
-
app.launcherActivities.push(activity);
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'activity-alias':
|
|
86
|
-
{
|
|
87
|
-
const activityAlias = this.collapseAttributes(element);
|
|
88
|
-
this.parseIntents(element, activityAlias);
|
|
89
|
-
app.activityAliases.push(activityAlias);
|
|
90
|
-
if (this.isLauncherActivity(activityAlias)) {
|
|
91
|
-
app.launcherActivities.push(activityAlias);
|
|
14
|
+
parseIntents(element, target) {
|
|
15
|
+
target.intentFilters = [];
|
|
16
|
+
target.metaData = [];
|
|
17
|
+
return element.childNodes.forEach((element)=>{
|
|
18
|
+
switch(element.nodeName){
|
|
19
|
+
case 'intent-filter':
|
|
20
|
+
{
|
|
21
|
+
const intentFilter = this.collapseAttributes(element);
|
|
22
|
+
intentFilter.actions = [];
|
|
23
|
+
intentFilter.categories = [];
|
|
24
|
+
intentFilter.data = [];
|
|
25
|
+
element.childNodes.forEach((element)=>{
|
|
26
|
+
switch(element.nodeName){
|
|
27
|
+
case 'action':
|
|
28
|
+
intentFilter.actions.push(this.collapseAttributes(element));
|
|
29
|
+
break;
|
|
30
|
+
case 'category':
|
|
31
|
+
intentFilter.categories.push(this.collapseAttributes(element));
|
|
32
|
+
break;
|
|
33
|
+
case 'data':
|
|
34
|
+
intentFilter.data.push(this.collapseAttributes(element));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
target.intentFilters.push(intentFilter);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'meta-data':
|
|
42
|
+
target.metaData.push(this.collapseAttributes(element));
|
|
43
|
+
break;
|
|
92
44
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
parseApplication(element) {
|
|
48
|
+
const app = this.collapseAttributes(element);
|
|
49
|
+
app.activities = [];
|
|
50
|
+
app.activityAliases = [];
|
|
51
|
+
app.launcherActivities = [];
|
|
52
|
+
app.services = [];
|
|
53
|
+
app.receivers = [];
|
|
54
|
+
app.providers = [];
|
|
55
|
+
app.usesLibraries = [];
|
|
56
|
+
app.metaData = [];
|
|
57
|
+
element.childNodes.forEach((element)=>{
|
|
58
|
+
switch(element.nodeName){
|
|
59
|
+
case 'activity':
|
|
60
|
+
{
|
|
61
|
+
const activity = this.collapseAttributes(element);
|
|
62
|
+
this.parseIntents(element, activity);
|
|
63
|
+
app.activities.push(activity);
|
|
64
|
+
if (this.isLauncherActivity(activity)) {
|
|
65
|
+
app.launcherActivities.push(activity);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'activity-alias':
|
|
70
|
+
{
|
|
71
|
+
const activityAlias = this.collapseAttributes(element);
|
|
72
|
+
this.parseIntents(element, activityAlias);
|
|
73
|
+
app.activityAliases.push(activityAlias);
|
|
74
|
+
if (this.isLauncherActivity(activityAlias)) {
|
|
75
|
+
app.launcherActivities.push(activityAlias);
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case 'service':
|
|
80
|
+
{
|
|
81
|
+
const service = this.collapseAttributes(element);
|
|
82
|
+
this.parseIntents(element, service);
|
|
83
|
+
app.services.push(service);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case 'receiver':
|
|
87
|
+
{
|
|
88
|
+
const receiver = this.collapseAttributes(element);
|
|
89
|
+
this.parseIntents(element, receiver);
|
|
90
|
+
app.receivers.push(receiver);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 'provider':
|
|
94
|
+
{
|
|
95
|
+
const provider = this.collapseAttributes(element);
|
|
96
|
+
provider.grantUriPermissions = [];
|
|
97
|
+
provider.metaData = [];
|
|
98
|
+
provider.pathPermissions = [];
|
|
99
|
+
element.childNodes.forEach((element)=>{
|
|
100
|
+
switch(element.nodeName){
|
|
101
|
+
case 'grant-uri-permission':
|
|
102
|
+
provider.grantUriPermissions.push(this.collapseAttributes(element));
|
|
103
|
+
break;
|
|
104
|
+
case 'meta-data':
|
|
105
|
+
provider.metaData.push(this.collapseAttributes(element));
|
|
106
|
+
break;
|
|
107
|
+
case 'path-permission':
|
|
108
|
+
provider.pathPermissions.push(this.collapseAttributes(element));
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
app.providers.push(provider);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case 'uses-library':
|
|
116
|
+
app.usesLibraries.push(this.collapseAttributes(element));
|
|
117
|
+
break;
|
|
122
118
|
case 'meta-data':
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
break;
|
|
206
|
-
case 'compatible-screens':
|
|
207
|
-
element.childNodes.forEach(screen => {
|
|
208
|
-
return manifest.compatibleScreens.push(this.collapseAttributes(screen));
|
|
209
|
-
});
|
|
210
|
-
break;
|
|
211
|
-
case 'supports-gl-texture':
|
|
212
|
-
manifest.supportsGlTextures.push(this.collapseAttributes(element));
|
|
213
|
-
break;
|
|
214
|
-
case 'application':
|
|
215
|
-
manifest.application = this.parseApplication(element);
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
return manifest;
|
|
221
|
-
}
|
|
119
|
+
app.metaData.push(this.collapseAttributes(element));
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return app;
|
|
124
|
+
}
|
|
125
|
+
isLauncherActivity(activity) {
|
|
126
|
+
return activity.intentFilters.some(function(filter) {
|
|
127
|
+
const hasMain = filter.actions.some((action)=>action.name === INTENT_MAIN);
|
|
128
|
+
if (!hasMain) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return filter.categories.some((category)=>category.name === CATEGORY_LAUNCHER);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
parse() {
|
|
135
|
+
const document = this.xmlParser.parse();
|
|
136
|
+
const manifest = this.collapseAttributes(document);
|
|
137
|
+
manifest.usesPermissions = [];
|
|
138
|
+
manifest.usesPermissionsSDK23 = [];
|
|
139
|
+
manifest.permissions = [];
|
|
140
|
+
manifest.permissionTrees = [];
|
|
141
|
+
manifest.permissionGroups = [];
|
|
142
|
+
manifest.instrumentation = null;
|
|
143
|
+
manifest.usesSdk = null;
|
|
144
|
+
manifest.usesConfiguration = null;
|
|
145
|
+
manifest.usesFeatures = [];
|
|
146
|
+
manifest.supportsScreens = null;
|
|
147
|
+
manifest.compatibleScreens = [];
|
|
148
|
+
manifest.supportsGlTextures = [];
|
|
149
|
+
manifest.application = Object.create(null);
|
|
150
|
+
document.childNodes.forEach((element)=>{
|
|
151
|
+
switch(element.nodeName){
|
|
152
|
+
case 'uses-permission':
|
|
153
|
+
manifest.usesPermissions.push(this.collapseAttributes(element));
|
|
154
|
+
break;
|
|
155
|
+
case 'uses-permission-sdk-23':
|
|
156
|
+
manifest.usesPermissionsSDK23.push(this.collapseAttributes(element));
|
|
157
|
+
break;
|
|
158
|
+
case 'permission':
|
|
159
|
+
manifest.permissions.push(this.collapseAttributes(element));
|
|
160
|
+
break;
|
|
161
|
+
case 'permission-tree':
|
|
162
|
+
manifest.permissionTrees.push(this.collapseAttributes(element));
|
|
163
|
+
break;
|
|
164
|
+
case 'permission-group':
|
|
165
|
+
manifest.permissionGroups.push(this.collapseAttributes(element));
|
|
166
|
+
break;
|
|
167
|
+
case 'instrumentation':
|
|
168
|
+
manifest.instrumentation = this.collapseAttributes(element);
|
|
169
|
+
break;
|
|
170
|
+
case 'uses-sdk':
|
|
171
|
+
manifest.usesSdk = this.collapseAttributes(element);
|
|
172
|
+
break;
|
|
173
|
+
case 'uses-configuration':
|
|
174
|
+
manifest.usesConfiguration = this.collapseAttributes(element);
|
|
175
|
+
break;
|
|
176
|
+
case 'uses-feature':
|
|
177
|
+
manifest.usesFeatures.push(this.collapseAttributes(element));
|
|
178
|
+
break;
|
|
179
|
+
case 'supports-screens':
|
|
180
|
+
manifest.supportsScreens = this.collapseAttributes(element);
|
|
181
|
+
break;
|
|
182
|
+
case 'compatible-screens':
|
|
183
|
+
element.childNodes.forEach((screen)=>{
|
|
184
|
+
return manifest.compatibleScreens.push(this.collapseAttributes(screen));
|
|
185
|
+
});
|
|
186
|
+
break;
|
|
187
|
+
case 'supports-gl-texture':
|
|
188
|
+
manifest.supportsGlTextures.push(this.collapseAttributes(element));
|
|
189
|
+
break;
|
|
190
|
+
case 'application':
|
|
191
|
+
manifest.application = this.parseApplication(element);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return manifest;
|
|
196
|
+
}
|
|
197
|
+
constructor(buffer, options = {}){
|
|
198
|
+
this.buffer = buffer;
|
|
199
|
+
this.xmlParser = new BinaryXmlParser(this.buffer, options);
|
|
200
|
+
}
|
|
222
201
|
}
|
|
223
|
-
|
|
224
|
-
module.exports = ManifestParser;
|
|
202
|
+
module.exports = ManifestParser;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
3
2
|
const Unzip = require('isomorphic-unzip');
|
|
4
3
|
const { isBrowser, decodeNullUnicode } = require('./utils');
|
|
5
|
-
|
|
6
4
|
class Zip {
|
|
7
|
-
|
|
8
|
-
if (isBrowser()) {
|
|
9
|
-
if (!(file instanceof window.Blob || typeof file.size !== 'undefined')) {
|
|
10
|
-
throw new Error('Param error: [file] must be an instance of Blob or File in browser.');
|
|
11
|
-
}
|
|
12
|
-
this.file = file;
|
|
13
|
-
} else {
|
|
14
|
-
if (typeof file !== 'string') {
|
|
15
|
-
throw new Error('Param error: [file] must be file path in Node.');
|
|
16
|
-
}
|
|
17
|
-
this.file = require('path').resolve(file);
|
|
18
|
-
}
|
|
19
|
-
this.unzip = new Unzip(this.file);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
5
|
+
/**
|
|
23
6
|
* get entries by regexps, the return format is: { <filename>: <Buffer|Blob> }
|
|
24
7
|
* @param {Array} regexps // regexps for matching files
|
|
25
8
|
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
*/ getEntries(regexps, type = 'buffer') {
|
|
10
|
+
regexps = regexps.map((regex)=>decodeNullUnicode(regex));
|
|
11
|
+
return new Promise((resolve, reject)=>{
|
|
12
|
+
this.unzip.getBuffer(regexps, {
|
|
13
|
+
type
|
|
14
|
+
}, (err, buffers)=>{
|
|
15
|
+
err ? reject(err) : resolve(buffers);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
36
20
|
* get entry by regex, return an instance of Buffer or Blob
|
|
37
21
|
* @param {Regex} regex // regex for matching file
|
|
38
22
|
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
*/ getEntry(regex, type = 'buffer') {
|
|
24
|
+
regex = decodeNullUnicode(regex);
|
|
25
|
+
return new Promise((resolve, reject)=>{
|
|
26
|
+
this.unzip.getBuffer([
|
|
27
|
+
regex
|
|
28
|
+
], {
|
|
29
|
+
type
|
|
30
|
+
}, (err, buffers)=>{
|
|
31
|
+
err ? reject(err) : resolve(buffers[regex]);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
constructor(file){
|
|
36
|
+
if (isBrowser()) {
|
|
37
|
+
if (!(file instanceof window.Blob || typeof file.size !== 'undefined')) {
|
|
38
|
+
throw new Error('Param error: [file] must be an instance of Blob or File in browser.');
|
|
39
|
+
}
|
|
40
|
+
this.file = file;
|
|
41
|
+
} else {
|
|
42
|
+
if (typeof file !== 'string') {
|
|
43
|
+
throw new Error('Param error: [file] must be file path in Node.');
|
|
44
|
+
}
|
|
45
|
+
this.file = require('path').resolve(file);
|
|
46
|
+
}
|
|
47
|
+
this.unzip = new Unzip(this.file);
|
|
48
|
+
}
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
module.exports = Zip;
|
|
50
|
+
module.exports = Zip;
|