react-native-update-cli 2.9.4 → 2.9.6
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 +19 -15
- package/lib/app.d.ts +5 -1
- package/lib/app.js +31 -21
- package/lib/bundle-pack.js +2 -1
- package/lib/bundle-runner.js +14 -14
- package/lib/diff.js +24 -22
- package/lib/exports.js +16 -16
- package/lib/index.js +3 -3
- package/lib/module-manager.js +3 -6
- package/lib/modules/app-module.js +1 -1
- package/lib/modules/index.js +7 -7
- package/lib/package.js +15 -11
- package/lib/utils/app-info-parser/aab.js +7 -7
- package/lib/utils/app-info-parser/resource-finder.js +7 -7
- 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/http-helper.js +5 -5
- package/lib/utils/index.js +10 -10
- package/lib/utils/latest-version/cli.js +1 -1
- package/lib/utils/latest-version/index.js +10 -10
- package/lib/utils/options.js +5 -5
- package/lib/utils/plugin-config.js +2 -2
- package/lib/utils/zip-entries.d.ts +1 -0
- package/lib/utils/zip-entries.js +82 -4
- package/lib/utils/zip-options.d.ts +9 -0
- package/lib/utils/zip-options.js +272 -0
- package/lib/versions.js +17 -21
- package/package.json +14 -14
- package/src/api.ts +7 -1
- package/src/app.ts +27 -12
- package/src/bundle-pack.ts +6 -1
- package/src/diff.ts +55 -15
- package/src/module-manager.ts +0 -4
- package/src/package.ts +5 -4
- package/src/utils/zip-entries.ts +89 -2
- package/src/utils/zip-options.ts +169 -0
- package/src/versions.ts +16 -18
package/lib/package.js
CHANGED
|
@@ -5,20 +5,20 @@ 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
|
-
choosePackage
|
|
12
|
+
get choosePackage () {
|
|
13
13
|
return choosePackage;
|
|
14
14
|
},
|
|
15
|
-
listPackage
|
|
15
|
+
get listPackage () {
|
|
16
16
|
return listPackage;
|
|
17
17
|
},
|
|
18
|
-
normalizeUploadBuildTime
|
|
18
|
+
get normalizeUploadBuildTime () {
|
|
19
19
|
return normalizeUploadBuildTime;
|
|
20
20
|
},
|
|
21
|
-
packageCommands
|
|
21
|
+
get packageCommands () {
|
|
22
22
|
return packageCommands;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -72,7 +72,7 @@ async function uploadNativePackage(filePath, options, config) {
|
|
|
72
72
|
const { versionName: extractedVersionName, buildTime } = info;
|
|
73
73
|
const { appId: appIdInPkg, appKey: appKeyInPkg } = info;
|
|
74
74
|
const { appId, appKey } = await (0, _app.getSelectedApp)(config.platform);
|
|
75
|
-
if (appIdInPkg && appIdInPkg
|
|
75
|
+
if (appIdInPkg && String(appIdInPkg) !== appId) {
|
|
76
76
|
throw new Error((0, _i18n.t)(config.appIdMismatchKey, {
|
|
77
77
|
appIdInPkg,
|
|
78
78
|
appId
|
|
@@ -123,11 +123,11 @@ async function listPackage(appId) {
|
|
|
123
123
|
const { version } = pkg;
|
|
124
124
|
let versionInfo = '';
|
|
125
125
|
if (version) {
|
|
126
|
+
var _ref, _ref1;
|
|
126
127
|
const versionObj = getVersionBinding(version);
|
|
127
|
-
var _versionObj_name, _versionObj_id;
|
|
128
128
|
versionInfo = (0, _i18n.t)('boundTo', {
|
|
129
|
-
name: (
|
|
130
|
-
id: (
|
|
129
|
+
name: (_ref = versionObj == null ? void 0 : versionObj.name) != null ? _ref : version,
|
|
130
|
+
id: (_ref1 = versionObj == null ? void 0 : versionObj.id) != null ? _ref1 : version
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
let output = pkg.name;
|
|
@@ -151,9 +151,13 @@ async function listPackage(appId) {
|
|
|
151
151
|
}
|
|
152
152
|
async function choosePackage(appId) {
|
|
153
153
|
const list = await listPackage(appId);
|
|
154
|
+
const packageMap = new Map(list == null ? void 0 : list.map((v)=>[
|
|
155
|
+
v.id.toString(),
|
|
156
|
+
v
|
|
157
|
+
]));
|
|
154
158
|
while(true){
|
|
155
159
|
const id = await (0, _utils.question)((0, _i18n.t)('enterNativePackageId'));
|
|
156
|
-
const app =
|
|
160
|
+
const app = packageMap.get(id);
|
|
157
161
|
if (app) {
|
|
158
162
|
return app;
|
|
159
163
|
}
|
|
@@ -262,7 +266,7 @@ const packageCommands = {
|
|
|
262
266
|
packages: async ({ options })=>{
|
|
263
267
|
const platform = await (0, _app.getPlatform)(options.platform);
|
|
264
268
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
265
|
-
await listPackage(appId);
|
|
269
|
+
await listPackage(String(appId));
|
|
266
270
|
},
|
|
267
271
|
deletePackage: async ({ args, options })=>{
|
|
268
272
|
let { appId, packageId, packageVersion } = options;
|
|
@@ -70,7 +70,7 @@ class AabParser extends _zip.Zip {
|
|
|
70
70
|
'--version'
|
|
71
71
|
]);
|
|
72
72
|
return false;
|
|
73
|
-
} catch (
|
|
73
|
+
} catch (unused) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
};
|
|
@@ -174,9 +174,9 @@ class AabParser extends _zip.Zip {
|
|
|
174
174
|
apkInfo = (0, _utils.mapInfoResource)(apkInfo, resourceMap);
|
|
175
175
|
}
|
|
176
176
|
} catch (e) {
|
|
177
|
-
var
|
|
177
|
+
var _ref;
|
|
178
178
|
console.warn((0, _i18n.t)('aabParseResourcesWarning', {
|
|
179
|
-
error: (
|
|
179
|
+
error: (_ref = e == null ? void 0 : e.message) != null ? _ref : e
|
|
180
180
|
}));
|
|
181
181
|
}
|
|
182
182
|
return apkInfo;
|
|
@@ -203,9 +203,9 @@ class AabParser extends _zip.Zip {
|
|
|
203
203
|
});
|
|
204
204
|
return parser.parse();
|
|
205
205
|
} catch (e) {
|
|
206
|
-
var
|
|
206
|
+
var _ref;
|
|
207
207
|
throw new Error((0, _i18n.t)('aabParseManifestError', {
|
|
208
|
-
error: (
|
|
208
|
+
error: (_ref = e == null ? void 0 : e.message) != null ? _ref : e
|
|
209
209
|
}));
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -216,9 +216,9 @@ class AabParser extends _zip.Zip {
|
|
|
216
216
|
try {
|
|
217
217
|
return new _resourcefinder.ResourceFinder().processResourceTable(buffer);
|
|
218
218
|
} catch (e) {
|
|
219
|
-
var
|
|
219
|
+
var _ref;
|
|
220
220
|
throw new Error((0, _i18n.t)('aabParseResourcesError', {
|
|
221
|
-
error: (
|
|
221
|
+
error: (_ref = e == null ? void 0 : e.message) != null ? _ref : e
|
|
222
222
|
}));
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Code translated from a C# project https://github.com/hylander0/Iteedee.ApkReader/blob/master/Iteedee.ApkReader/ApkResourceFinder.cs
|
|
3
|
-
*
|
|
4
|
-
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
|
5
|
-
*/ "use strict";
|
|
1
|
+
"use strict";
|
|
6
2
|
Object.defineProperty(exports, "__esModule", {
|
|
7
3
|
value: true
|
|
8
4
|
});
|
|
@@ -12,7 +8,11 @@ Object.defineProperty(exports, "ResourceFinder", {
|
|
|
12
8
|
return ResourceFinder;
|
|
13
9
|
}
|
|
14
10
|
});
|
|
15
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Code translated from a C# project https://github.com/hylander0/Iteedee.ApkReader/blob/master/Iteedee.ApkReader/ApkResourceFinder.cs
|
|
13
|
+
*
|
|
14
|
+
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
|
15
|
+
*/ const ByteBuffer = require('bytebuffer');
|
|
16
16
|
const DEBUG = false;
|
|
17
17
|
const RES_STRING_POOL_TYPE = 0x0001;
|
|
18
18
|
const RES_TABLE_TYPE = 0x0002;
|
|
@@ -231,6 +231,7 @@ class ResourceFinder {
|
|
|
231
231
|
void entrySize;
|
|
232
232
|
const FLAG_COMPLEX = 0x0001;
|
|
233
233
|
if ((entryFlag & FLAG_COMPLEX) === 0) {
|
|
234
|
+
var _this_entryMap_key;
|
|
234
235
|
const valueSize = bb.readShort();
|
|
235
236
|
const valueRes0 = bb.readByte();
|
|
236
237
|
const valueDataType = bb.readByte();
|
|
@@ -244,7 +245,6 @@ class ResourceFinder {
|
|
|
244
245
|
console.log(`Entry 0x${idStr}, key: ${keyStr}, simple value type: `);
|
|
245
246
|
}
|
|
246
247
|
const key = Number.parseInt(idStr, 16);
|
|
247
|
-
var _this_entryMap_key;
|
|
248
248
|
const entryArr = (_this_entryMap_key = this.entryMap[key]) != null ? _this_entryMap_key : [];
|
|
249
249
|
entryArr.push(keyStr);
|
|
250
250
|
this.entryMap[key] = entryArr;
|
|
@@ -5,35 +5,35 @@ 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
|
-
decodeNullUnicode
|
|
12
|
+
get decodeNullUnicode () {
|
|
13
13
|
return decodeNullUnicode;
|
|
14
14
|
},
|
|
15
|
-
findApkIconPath
|
|
15
|
+
get findApkIconPath () {
|
|
16
16
|
return findApkIconPath;
|
|
17
17
|
},
|
|
18
|
-
findIpaIconPath
|
|
18
|
+
get findIpaIconPath () {
|
|
19
19
|
return findIpaIconPath;
|
|
20
20
|
},
|
|
21
|
-
getBase64FromBuffer
|
|
21
|
+
get getBase64FromBuffer () {
|
|
22
22
|
return getBase64FromBuffer;
|
|
23
23
|
},
|
|
24
|
-
isArray
|
|
24
|
+
get isArray () {
|
|
25
25
|
return isArray;
|
|
26
26
|
},
|
|
27
|
-
isBrowser
|
|
27
|
+
get isBrowser () {
|
|
28
28
|
return isBrowser;
|
|
29
29
|
},
|
|
30
|
-
isObject
|
|
30
|
+
get isObject () {
|
|
31
31
|
return isObject;
|
|
32
32
|
},
|
|
33
|
-
isPrimitive
|
|
33
|
+
get isPrimitive () {
|
|
34
34
|
return isPrimitive;
|
|
35
35
|
},
|
|
36
|
-
mapInfoResource
|
|
36
|
+
get mapInfoResource () {
|
|
37
37
|
return mapInfoResource;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// From https://github.com/openstf/adbkit-apkreader
|
|
2
1
|
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
@@ -9,6 +8,7 @@ Object.defineProperty(exports, "BinaryXmlParser", {
|
|
|
9
8
|
return BinaryXmlParser;
|
|
10
9
|
}
|
|
11
10
|
});
|
|
11
|
+
// From https://github.com/openstf/adbkit-apkreader
|
|
12
12
|
const NodeType = {
|
|
13
13
|
ELEMENT_NODE: 1,
|
|
14
14
|
ATTRIBUTE_NODE: 2,
|
|
@@ -136,6 +136,7 @@ class BinaryXmlParser {
|
|
|
136
136
|
return len;
|
|
137
137
|
}
|
|
138
138
|
readDimension() {
|
|
139
|
+
var _dimension_value;
|
|
139
140
|
this.debug && console.group('readDimension');
|
|
140
141
|
const dimension = {
|
|
141
142
|
value: null,
|
|
@@ -143,7 +144,6 @@ class BinaryXmlParser {
|
|
|
143
144
|
rawUnit: null
|
|
144
145
|
};
|
|
145
146
|
const value = this.readU32();
|
|
146
|
-
var _dimension_value;
|
|
147
147
|
const unit = ((_dimension_value = dimension.value) != null ? _dimension_value : 0) & 0xff;
|
|
148
148
|
dimension.value = value >> 8;
|
|
149
149
|
dimension.rawUnit = unit;
|
|
@@ -5,14 +5,14 @@ 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
|
-
runAsCommandResult
|
|
12
|
+
get runAsCommandResult () {
|
|
13
13
|
return runAsCommandResult;
|
|
14
14
|
},
|
|
15
|
-
toErrorMessage
|
|
15
|
+
get toErrorMessage () {
|
|
16
16
|
return toErrorMessage;
|
|
17
17
|
}
|
|
18
18
|
});
|
package/lib/utils/constants.js
CHANGED
|
@@ -5,35 +5,35 @@ 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
|
-
IS_CRESC
|
|
12
|
+
get IS_CRESC () {
|
|
13
13
|
return IS_CRESC;
|
|
14
14
|
},
|
|
15
|
-
credentialFile
|
|
15
|
+
get credentialFile () {
|
|
16
16
|
return credentialFile;
|
|
17
17
|
},
|
|
18
|
-
defaultEndpoints
|
|
18
|
+
get defaultEndpoints () {
|
|
19
19
|
return defaultEndpoints;
|
|
20
20
|
},
|
|
21
|
-
isPPKBundleFileName
|
|
21
|
+
get isPPKBundleFileName () {
|
|
22
22
|
return isPPKBundleFileName;
|
|
23
23
|
},
|
|
24
|
-
ppkBundleFileNames
|
|
24
|
+
get ppkBundleFileNames () {
|
|
25
25
|
return ppkBundleFileNames;
|
|
26
26
|
},
|
|
27
|
-
pricingPageUrl
|
|
27
|
+
get pricingPageUrl () {
|
|
28
28
|
return pricingPageUrl;
|
|
29
29
|
},
|
|
30
|
-
scriptName
|
|
30
|
+
get scriptName () {
|
|
31
31
|
return scriptName;
|
|
32
32
|
},
|
|
33
|
-
tempDir
|
|
33
|
+
get tempDir () {
|
|
34
34
|
return tempDir;
|
|
35
35
|
},
|
|
36
|
-
updateJson
|
|
36
|
+
get updateJson () {
|
|
37
37
|
return updateJson;
|
|
38
38
|
}
|
|
39
39
|
});
|
package/lib/utils/http-helper.js
CHANGED
|
@@ -5,20 +5,20 @@ 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
|
-
getBaseUrl
|
|
12
|
+
get getBaseUrl () {
|
|
13
13
|
return getBaseUrl;
|
|
14
14
|
},
|
|
15
|
-
ping
|
|
15
|
+
get ping () {
|
|
16
16
|
return ping;
|
|
17
17
|
},
|
|
18
|
-
promiseAny
|
|
18
|
+
get promiseAny () {
|
|
19
19
|
return promiseAny;
|
|
20
20
|
},
|
|
21
|
-
testUrls
|
|
21
|
+
get testUrls () {
|
|
22
22
|
return testUrls;
|
|
23
23
|
}
|
|
24
24
|
});
|
package/lib/utils/index.js
CHANGED
|
@@ -5,35 +5,35 @@ 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
|
-
checkPlugins
|
|
12
|
+
get checkPlugins () {
|
|
13
13
|
return _checkplugin.checkPlugins;
|
|
14
14
|
},
|
|
15
|
-
getAabInfo
|
|
15
|
+
get getAabInfo () {
|
|
16
16
|
return getAabInfo;
|
|
17
17
|
},
|
|
18
|
-
getApkInfo
|
|
18
|
+
get getApkInfo () {
|
|
19
19
|
return getApkInfo;
|
|
20
20
|
},
|
|
21
|
-
getAppInfo
|
|
21
|
+
get getAppInfo () {
|
|
22
22
|
return getAppInfo;
|
|
23
23
|
},
|
|
24
|
-
getIpaInfo
|
|
24
|
+
get getIpaInfo () {
|
|
25
25
|
return getIpaInfo;
|
|
26
26
|
},
|
|
27
|
-
printVersionCommand
|
|
27
|
+
get printVersionCommand () {
|
|
28
28
|
return printVersionCommand;
|
|
29
29
|
},
|
|
30
|
-
question
|
|
30
|
+
get question () {
|
|
31
31
|
return question;
|
|
32
32
|
},
|
|
33
|
-
saveToLocal
|
|
33
|
+
get saveToLocal () {
|
|
34
34
|
return saveToLocal;
|
|
35
35
|
},
|
|
36
|
-
translateOptions
|
|
36
|
+
get translateOptions () {
|
|
37
37
|
return translateOptions;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -254,7 +254,7 @@ const checkVersions = async (packages, skipMissing, options = {
|
|
|
254
254
|
}
|
|
255
255
|
if (skipMissing) {
|
|
256
256
|
latestVersionPackages = latestVersionPackages.filter((pkg)=>{
|
|
257
|
-
var
|
|
257
|
+
var _ref, _pkg_local;
|
|
258
258
|
return (_ref = (_pkg_local = pkg.local) != null ? _pkg_local : pkg.globalNpm) != null ? _ref : pkg.globalYarn;
|
|
259
259
|
});
|
|
260
260
|
}
|
|
@@ -5,14 +5,14 @@ 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
|
-
ONE_DAY
|
|
12
|
+
get ONE_DAY () {
|
|
13
13
|
return ONE_DAY;
|
|
14
14
|
},
|
|
15
|
-
default
|
|
15
|
+
get default () {
|
|
16
16
|
return _default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -36,10 +36,10 @@ const isPackageJson = (obj)=>{
|
|
|
36
36
|
};
|
|
37
37
|
const downloadMetadata = (pkgName, options)=>{
|
|
38
38
|
return new Promise((resolve, reject)=>{
|
|
39
|
+
var _ref;
|
|
39
40
|
const i = pkgName.indexOf('/');
|
|
40
41
|
const pkgScope = i !== -1 ? pkgName.slice(0, i) : '';
|
|
41
|
-
|
|
42
|
-
const registryUrl = (_options_registryUrl = options == null ? void 0 : options.registryUrl) != null ? _options_registryUrl : (0, _registryurl.default)(pkgScope);
|
|
42
|
+
const registryUrl = (_ref = options == null ? void 0 : options.registryUrl) != null ? _ref : (0, _registryurl.default)(pkgScope);
|
|
43
43
|
const pkgUrl = new _url.URL(encodeURIComponent(pkgName).replace(/^%40/, '@'), registryUrl);
|
|
44
44
|
let requestOptions = {
|
|
45
45
|
headers: {
|
|
@@ -132,8 +132,8 @@ const saveMetadataToCache = (pkg)=>{
|
|
|
132
132
|
(0, _fs.writeFileSync)(filePath, JSON.stringify(pkg));
|
|
133
133
|
};
|
|
134
134
|
const getMetadataFromCache = (pkgName, options)=>{
|
|
135
|
-
var
|
|
136
|
-
const maxAge = (
|
|
135
|
+
var _ref;
|
|
136
|
+
const maxAge = (_ref = options == null ? void 0 : options.cacheMaxAge) != null ? _ref : ONE_DAY;
|
|
137
137
|
if (maxAge !== 0) {
|
|
138
138
|
const pkgCacheFilePath = (0, _path.join)(getCacheDir(), `${pkgName}.json`);
|
|
139
139
|
if ((0, _fs.existsSync)(pkgCacheFilePath)) {
|
|
@@ -205,7 +205,7 @@ const getInstalledVersion = (pkgName, location = 'local')=>{
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
return undefined;
|
|
208
|
-
} catch (
|
|
208
|
+
} catch (unused) {
|
|
209
209
|
return undefined;
|
|
210
210
|
}
|
|
211
211
|
};
|
|
@@ -233,8 +233,8 @@ const getInfo = async (pkg, options)=>{
|
|
|
233
233
|
globalYarn
|
|
234
234
|
} : false;
|
|
235
235
|
} catch (err) {
|
|
236
|
-
var
|
|
237
|
-
pkgInfo.error = (
|
|
236
|
+
var _ref;
|
|
237
|
+
pkgInfo.error = (_ref = err == null ? void 0 : err.message) != null ? _ref : err;
|
|
238
238
|
}
|
|
239
239
|
return pkgInfo;
|
|
240
240
|
};
|
package/lib/utils/options.js
CHANGED
|
@@ -5,20 +5,20 @@ 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
|
-
getBooleanOption
|
|
12
|
+
get getBooleanOption () {
|
|
13
13
|
return getBooleanOption;
|
|
14
14
|
},
|
|
15
|
-
getOptionalStringOption
|
|
15
|
+
get getOptionalStringOption () {
|
|
16
16
|
return getOptionalStringOption;
|
|
17
17
|
},
|
|
18
|
-
getStringOption
|
|
18
|
+
get getStringOption () {
|
|
19
19
|
return getStringOption;
|
|
20
20
|
},
|
|
21
|
-
toObjectState
|
|
21
|
+
get toObjectState () {
|
|
22
22
|
return toObjectState;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -25,11 +25,11 @@ const plugins = [
|
|
|
25
25
|
try {
|
|
26
26
|
await _fsextra.default.access('ios/sentry.properties');
|
|
27
27
|
return true;
|
|
28
|
-
} catch (
|
|
28
|
+
} catch (unused) {
|
|
29
29
|
try {
|
|
30
30
|
await _fsextra.default.access('android/sentry.properties');
|
|
31
31
|
return true;
|
|
32
|
-
} catch (
|
|
32
|
+
} catch (unused) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type Entry, type ZipFile as YauzlZipFile } from 'yauzl';
|
|
2
2
|
export declare function readEntry(entry: Entry, zipFile: YauzlZipFile): Promise<Buffer>;
|
|
3
|
+
export declare function readEntryPrefix(entry: Entry, zipFile: YauzlZipFile, maxBytes: number): Promise<Buffer>;
|
|
3
4
|
export declare function enumZipEntries(zipFn: string, callback: (entry: Entry, zipFile: YauzlZipFile, nestedPath?: string) => Promise<any> | undefined, nestedPath?: string): Promise<unknown>;
|
package/lib/utils/zip-entries.js
CHANGED
|
@@ -5,20 +5,23 @@ 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
|
-
enumZipEntries
|
|
12
|
+
get enumZipEntries () {
|
|
13
13
|
return enumZipEntries;
|
|
14
14
|
},
|
|
15
|
-
readEntry
|
|
15
|
+
get readEntry () {
|
|
16
16
|
return readEntry;
|
|
17
|
+
},
|
|
18
|
+
get readEntryPrefix () {
|
|
19
|
+
return readEntryPrefix;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
22
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
19
23
|
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
20
24
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
21
|
-
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
22
25
|
const _yauzl = require("yauzl");
|
|
23
26
|
const _i18n = require("./i18n");
|
|
24
27
|
function _interop_require_default(obj) {
|
|
@@ -71,6 +74,12 @@ function readEntry(entry, zipFile) {
|
|
|
71
74
|
const buffers = [];
|
|
72
75
|
return new Promise((resolve, reject)=>{
|
|
73
76
|
zipFile.openReadStream(entry, (err, stream)=>{
|
|
77
|
+
if (err) {
|
|
78
|
+
return reject(err);
|
|
79
|
+
}
|
|
80
|
+
if (!stream) {
|
|
81
|
+
return reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
82
|
+
}
|
|
74
83
|
stream.on('data', (chunk)=>{
|
|
75
84
|
buffers.push(chunk);
|
|
76
85
|
});
|
|
@@ -83,6 +92,75 @@ function readEntry(entry, zipFile) {
|
|
|
83
92
|
});
|
|
84
93
|
});
|
|
85
94
|
}
|
|
95
|
+
function readEntryPrefix(entry, zipFile, maxBytes) {
|
|
96
|
+
if (maxBytes <= 0) {
|
|
97
|
+
return Promise.resolve(Buffer.alloc(0));
|
|
98
|
+
}
|
|
99
|
+
const buffers = [];
|
|
100
|
+
let length = 0;
|
|
101
|
+
return new Promise((resolve, reject)=>{
|
|
102
|
+
zipFile.openReadStream(entry, (err, stream)=>{
|
|
103
|
+
if (err) {
|
|
104
|
+
return reject(err);
|
|
105
|
+
}
|
|
106
|
+
if (!stream) {
|
|
107
|
+
return reject(new Error(`Unable to read zip entry: ${entry.fileName}`));
|
|
108
|
+
}
|
|
109
|
+
let settled = false;
|
|
110
|
+
let expectedDestroyError;
|
|
111
|
+
const cleanup = ()=>{
|
|
112
|
+
stream.off('data', onData);
|
|
113
|
+
stream.off('end', onEnd);
|
|
114
|
+
stream.off('error', onError);
|
|
115
|
+
};
|
|
116
|
+
const finish = (destroyStream = false)=>{
|
|
117
|
+
if (settled) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
settled = true;
|
|
121
|
+
stream.off('data', onData);
|
|
122
|
+
stream.off('end', onEnd);
|
|
123
|
+
if (!destroyStream) {
|
|
124
|
+
stream.off('error', onError);
|
|
125
|
+
}
|
|
126
|
+
resolve(Buffer.concat(buffers, length));
|
|
127
|
+
if (destroyStream) {
|
|
128
|
+
expectedDestroyError = new Error('zip entry prefix read complete');
|
|
129
|
+
stream.destroy(expectedDestroyError);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const onData = (chunk)=>{
|
|
133
|
+
const remaining = maxBytes - length;
|
|
134
|
+
if (remaining <= 0) {
|
|
135
|
+
finish(true);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const slice = chunk.length > remaining ? chunk.subarray(0, remaining) : chunk;
|
|
139
|
+
buffers.push(slice);
|
|
140
|
+
length += slice.length;
|
|
141
|
+
if (length >= maxBytes) {
|
|
142
|
+
finish(true);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const onEnd = ()=>finish();
|
|
146
|
+
const onError = (error)=>{
|
|
147
|
+
if (settled && error === expectedDestroyError) {
|
|
148
|
+
cleanup();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (settled) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
settled = true;
|
|
155
|
+
cleanup();
|
|
156
|
+
reject(error);
|
|
157
|
+
};
|
|
158
|
+
stream.on('data', onData);
|
|
159
|
+
stream.once('end', onEnd);
|
|
160
|
+
stream.once('error', onError);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
86
164
|
async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
|
87
165
|
return new Promise((resolve, reject)=>{
|
|
88
166
|
(0, _yauzl.open)(zipFn, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ZipEntryOptions = {
|
|
2
|
+
compress?: boolean;
|
|
3
|
+
compressionLevel?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const ZIP_ENTRY_SNIFF_BYTES = 64;
|
|
6
|
+
export declare function zipOptionsForPatchEntry(): ZipEntryOptions;
|
|
7
|
+
export declare function zipOptionsForManifestEntry(): ZipEntryOptions;
|
|
8
|
+
export declare function zipOptionsForPayloadEntry(fileName: string, prefix?: Buffer): ZipEntryOptions;
|
|
9
|
+
export declare function zipOptionsForPayloadFile(filePath: string, entryName?: string): ZipEntryOptions;
|