@appium/support 2.58.0 → 2.59.2
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/build/lib/console.d.ts +110 -0
- package/build/lib/console.d.ts.map +1 -0
- package/build/lib/console.js +113 -0
- package/build/lib/env.d.ts.map +1 -1
- package/build/lib/env.js +1 -1
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +1 -1
- package/build/lib/image-util.d.ts.map +1 -1
- package/build/lib/image-util.js +1 -1
- package/build/lib/index.d.ts +3 -1
- package/build/lib/index.js +8 -3
- package/build/lib/log-internal.d.ts.map +1 -1
- package/build/lib/log-internal.js +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +1 -1
- package/build/lib/logging.d.ts +11 -4
- package/build/lib/logging.d.ts.map +1 -1
- package/build/lib/logging.js +7 -6
- package/build/lib/mjpeg.d.ts.map +1 -1
- package/build/lib/mjpeg.js +1 -1
- package/build/lib/mkdirp.js +1 -1
- package/build/lib/net.d.ts +5 -2
- package/build/lib/net.d.ts.map +1 -1
- package/build/lib/net.js +1 -1
- package/build/lib/node.d.ts.map +1 -1
- package/build/lib/node.js +1 -1
- package/build/lib/npm.d.ts.map +1 -1
- package/build/lib/npm.js +1 -1
- package/build/lib/plist.d.ts +1 -1
- package/build/lib/plist.d.ts.map +1 -1
- package/build/lib/plist.js +1 -1
- package/build/lib/process.d.ts.map +1 -1
- package/build/lib/process.js +1 -1
- package/build/lib/system.js +1 -1
- package/build/lib/tempdir.d.ts.map +1 -1
- package/build/lib/tempdir.js +1 -1
- package/build/lib/timing.d.ts.map +1 -1
- package/build/lib/timing.js +1 -1
- package/build/lib/util.d.ts +19 -2
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js +3 -7
- package/build/lib/zip.d.ts +5 -5
- package/build/lib/zip.d.ts.map +1 -1
- package/build/lib/zip.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/console.js +173 -0
- package/lib/env.js +12 -14
- package/lib/fs.js +87 -62
- package/lib/image-util.js +50 -32
- package/lib/index.js +39 -8
- package/lib/log-internal.js +16 -11
- package/lib/logger.js +1 -1
- package/lib/logging.js +32 -30
- package/lib/mjpeg.js +32 -27
- package/lib/mkdirp.js +3 -3
- package/lib/net.js +60 -52
- package/lib/node.js +22 -17
- package/lib/npm.js +50 -47
- package/lib/plist.js +34 -18
- package/lib/process.js +8 -6
- package/lib/system.js +8 -8
- package/lib/tempdir.js +14 -9
- package/lib/timing.js +12 -15
- package/lib/util.js +121 -72
- package/lib/zip.js +88 -92
- package/package.json +12 -8
package/lib/zip.js
CHANGED
|
@@ -2,17 +2,17 @@ import _ from 'lodash';
|
|
|
2
2
|
import B from 'bluebird';
|
|
3
3
|
import yauzl from 'yauzl';
|
|
4
4
|
import archiver from 'archiver';
|
|
5
|
-
import {
|
|
5
|
+
import {createWriteStream} from 'fs';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import stream from 'stream';
|
|
8
8
|
import fs from './fs';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import {isWindows} from './system';
|
|
10
|
+
import {Base64Encode} from 'base64-stream';
|
|
11
|
+
import {toReadableSizeString, GiB} from './util';
|
|
12
12
|
import Timer from './timing';
|
|
13
13
|
import log from './logger';
|
|
14
14
|
import getStream from 'get-stream';
|
|
15
|
-
import {
|
|
15
|
+
import {exec} from 'teen_process';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @type {(path: string, options?: yauzl.Options) => Promise<yauzl.ZipFile>}
|
|
@@ -32,21 +32,20 @@ class ZipExtractor {
|
|
|
32
32
|
/** @type {yauzl.ZipFile} */
|
|
33
33
|
zipfile;
|
|
34
34
|
|
|
35
|
-
constructor
|
|
35
|
+
constructor(sourcePath, opts = {}) {
|
|
36
36
|
this.zipPath = sourcePath;
|
|
37
37
|
this.opts = opts;
|
|
38
38
|
this.canceled = false;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
extractFileName
|
|
42
|
-
return _.isBuffer(entry.fileName)
|
|
41
|
+
extractFileName(entry) {
|
|
42
|
+
return _.isBuffer(entry.fileName)
|
|
43
|
+
? entry.fileName.toString(this.opts.fileNamesEncoding)
|
|
44
|
+
: entry.fileName;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
async extract
|
|
46
|
-
const {
|
|
47
|
-
dir,
|
|
48
|
-
fileNamesEncoding,
|
|
49
|
-
} = this.opts;
|
|
47
|
+
async extract() {
|
|
48
|
+
const {dir, fileNamesEncoding} = this.opts;
|
|
50
49
|
this.zipfile = await openZip(this.zipPath, {
|
|
51
50
|
lazyEntries: true,
|
|
52
51
|
// https://github.com/thejoshwolfe/yauzl/commit/cc7455ac789ba84973184e5ebde0581cdc4c3b39#diff-04c6e90faac2675aa89e2176d2eec7d8R95
|
|
@@ -86,7 +85,9 @@ class ZipExtractor {
|
|
|
86
85
|
const relativeDestDir = path.relative(dir, canonicalDestDir);
|
|
87
86
|
|
|
88
87
|
if (relativeDestDir.split(path.sep).includes('..')) {
|
|
89
|
-
new Error(
|
|
88
|
+
new Error(
|
|
89
|
+
`Out of bound path "${canonicalDestDir}" found while processing file ${fileName}`
|
|
90
|
+
);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
await this.extractEntry(entry);
|
|
@@ -100,32 +101,31 @@ class ZipExtractor {
|
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
async extractEntry
|
|
104
|
+
async extractEntry(entry) {
|
|
104
105
|
if (this.canceled) {
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
const {
|
|
109
|
-
dir,
|
|
110
|
-
} = this.opts;
|
|
109
|
+
const {dir} = this.opts;
|
|
111
110
|
|
|
112
111
|
const fileName = this.extractFileName(entry);
|
|
113
112
|
const dest = path.join(dir, fileName);
|
|
114
113
|
|
|
115
114
|
// convert external file attr int into a fs stat mode int
|
|
116
|
-
const mode = (entry.externalFileAttributes >> 16) &
|
|
115
|
+
const mode = (entry.externalFileAttributes >> 16) & 0xffff;
|
|
117
116
|
// check if it's a symlink or dir (using stat mode constants)
|
|
118
117
|
const isSymlink = (mode & IFMT) === IFLNK;
|
|
119
|
-
const isDir =
|
|
118
|
+
const isDir =
|
|
119
|
+
(mode & IFMT) === IFDIR ||
|
|
120
120
|
// Failsafe, borrowed from jsZip
|
|
121
|
-
|
|
121
|
+
fileName.endsWith('/') ||
|
|
122
122
|
// check for windows weird way of specifying a directory
|
|
123
123
|
// https://github.com/maxogden/extract-zip/issues/13#issuecomment-154494566
|
|
124
|
-
|
|
124
|
+
(entry.versionMadeBy >> 8 === 0 && entry.externalFileAttributes === 16);
|
|
125
125
|
const procMode = this.getExtractedMode(mode, isDir) & 0o777;
|
|
126
126
|
// always ensure folders are created
|
|
127
127
|
const destDir = isDir ? dest : path.dirname(dest);
|
|
128
|
-
const mkdirOptions = {
|
|
128
|
+
const mkdirOptions = {recursive: true};
|
|
129
129
|
if (isDir) {
|
|
130
130
|
mkdirOptions.mode = procMode;
|
|
131
131
|
}
|
|
@@ -141,15 +141,12 @@ class ZipExtractor {
|
|
|
141
141
|
const link = await getStream(readStream);
|
|
142
142
|
await fs.symlink(link, dest);
|
|
143
143
|
} else {
|
|
144
|
-
await pipeline(readStream, fs.createWriteStream(dest, {
|
|
144
|
+
await pipeline(readStream, fs.createWriteStream(dest, {mode: procMode}));
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
getExtractedMode
|
|
149
|
-
const {
|
|
150
|
-
defaultDirMode,
|
|
151
|
-
defaultFileMode,
|
|
152
|
-
} = this.opts;
|
|
148
|
+
getExtractedMode(entryMode, isDir) {
|
|
149
|
+
const {defaultDirMode, defaultFileMode} = this.opts;
|
|
153
150
|
|
|
154
151
|
let mode = entryMode;
|
|
155
152
|
// Set defaults, if necessary
|
|
@@ -177,15 +174,14 @@ class ZipExtractor {
|
|
|
177
174
|
}
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
|
|
181
177
|
/**
|
|
182
178
|
* @typedef ExtractAllOptions
|
|
183
|
-
* @property {
|
|
179
|
+
* @property {string} [fileNamesEncoding] The encoding to use for extracted file names.
|
|
184
180
|
* For ZIP archives created on MacOS it is usually expected to be `utf8`.
|
|
185
181
|
* By default it is autodetected based on the entry metadata and is only needed to be set explicitly
|
|
186
182
|
* if the particular archive does not comply to the standards, which leads to corrupted file names
|
|
187
183
|
* after extraction. Only applicable if system unzip binary is NOT being used.
|
|
188
|
-
* @property {
|
|
184
|
+
* @property {boolean} [useSystemUnzip] If true, attempt to use system unzip; if this fails,
|
|
189
185
|
* fallback to the JS unzip implementation.
|
|
190
186
|
*/
|
|
191
187
|
|
|
@@ -196,7 +192,7 @@ class ZipExtractor {
|
|
|
196
192
|
* @param {string} destDir The full path to the destination folder
|
|
197
193
|
* @param {ExtractAllOptions} [opts]
|
|
198
194
|
*/
|
|
199
|
-
async function extractAllTo
|
|
195
|
+
async function extractAllTo(zipFilePath, destDir, opts = /** @type {ExtractAllOptions} */ ({})) {
|
|
200
196
|
if (!path.isAbsolute(destDir)) {
|
|
201
197
|
throw new Error(`Target path '${destDir}' is expected to be absolute`);
|
|
202
198
|
}
|
|
@@ -227,13 +223,11 @@ async function extractAllTo (zipFilePath, destDir, opts = /** @type {ExtractAllO
|
|
|
227
223
|
* @param {string} destDir The full path to the destination folder.
|
|
228
224
|
* This folder is expected to already exist before extracting the archive.
|
|
229
225
|
*/
|
|
230
|
-
async function extractWithSystemUnzip
|
|
226
|
+
async function extractWithSystemUnzip(zipFilePath, destDir) {
|
|
231
227
|
const isWindowsHost = isWindows();
|
|
232
228
|
let executablePath;
|
|
233
229
|
try {
|
|
234
|
-
executablePath = await getExecutablePath(
|
|
235
|
-
isWindowsHost ? 'powershell.exe' : 'unzip'
|
|
236
|
-
);
|
|
230
|
+
executablePath = await getExecutablePath(isWindowsHost ? 'powershell.exe' : 'unzip');
|
|
237
231
|
} catch (e) {
|
|
238
232
|
throw new Error('Could not find system unzip');
|
|
239
233
|
}
|
|
@@ -241,20 +235,19 @@ async function extractWithSystemUnzip (zipFilePath, destDir) {
|
|
|
241
235
|
if (isWindowsHost) {
|
|
242
236
|
// on Windows we use PowerShell to unzip files
|
|
243
237
|
await exec(executablePath, [
|
|
244
|
-
'-command',
|
|
245
|
-
'-
|
|
246
|
-
'-
|
|
247
|
-
|
|
238
|
+
'-command',
|
|
239
|
+
'Expand-Archive',
|
|
240
|
+
'-LiteralPath',
|
|
241
|
+
zipFilePath,
|
|
242
|
+
'-DestinationPath',
|
|
243
|
+
destDir,
|
|
244
|
+
'-Force',
|
|
248
245
|
]);
|
|
249
246
|
} else {
|
|
250
247
|
// -q means quiet (no stdout)
|
|
251
248
|
// -o means overwrite
|
|
252
249
|
// -d is the dest dir
|
|
253
|
-
await exec(executablePath, [
|
|
254
|
-
'-q',
|
|
255
|
-
'-o', zipFilePath,
|
|
256
|
-
'-d', destDir
|
|
257
|
-
]);
|
|
250
|
+
await exec(executablePath, ['-q', '-o', zipFilePath, '-d', destDir]);
|
|
258
251
|
}
|
|
259
252
|
}
|
|
260
253
|
|
|
@@ -265,16 +258,16 @@ async function extractWithSystemUnzip (zipFilePath, destDir) {
|
|
|
265
258
|
* @param {yauzl.Entry} entry The entry instance
|
|
266
259
|
* @param {string} destDir The full path to the destination folder
|
|
267
260
|
*/
|
|
268
|
-
async function _extractEntryTo
|
|
261
|
+
async function _extractEntryTo(zipFile, entry, destDir) {
|
|
269
262
|
const dstPath = path.resolve(destDir, entry.fileName);
|
|
270
263
|
|
|
271
264
|
// Create dest directory if doesn't exist already
|
|
272
265
|
if (/\/$/.test(entry.fileName)) {
|
|
273
|
-
if (!await fs.exists(dstPath)) {
|
|
266
|
+
if (!(await fs.exists(dstPath))) {
|
|
274
267
|
await fs.mkdirp(dstPath);
|
|
275
268
|
}
|
|
276
269
|
return;
|
|
277
|
-
} else if (!await fs.exists(path.dirname(dstPath))) {
|
|
270
|
+
} else if (!(await fs.exists(path.dirname(dstPath)))) {
|
|
278
271
|
await fs.mkdirp(path.dirname(dstPath));
|
|
279
272
|
}
|
|
280
273
|
|
|
@@ -288,7 +281,7 @@ async function _extractEntryTo (zipFile, entry, destDir) {
|
|
|
288
281
|
// Create zipReadStream and pipe data to the write stream
|
|
289
282
|
// (for some odd reason B.promisify doesn't work on zipfile.openReadStream, it causes an error 'closed')
|
|
290
283
|
const zipReadStream = await new B((resolve, reject) => {
|
|
291
|
-
zipFile.openReadStream(entry, (err, readStream) => err ? reject(err) : resolve(readStream));
|
|
284
|
+
zipFile.openReadStream(entry, (err, readStream) => (err ? reject(err) : resolve(readStream)));
|
|
292
285
|
});
|
|
293
286
|
const zipReadStreamPromise = new B((resolve, reject) => {
|
|
294
287
|
zipReadStream.once('end', resolve);
|
|
@@ -297,10 +290,7 @@ async function _extractEntryTo (zipFile, entry, destDir) {
|
|
|
297
290
|
zipReadStream.pipe(writeStream);
|
|
298
291
|
|
|
299
292
|
// Wait for the zipReadStream and writeStream to end before returning
|
|
300
|
-
return await B.all([
|
|
301
|
-
zipReadStreamPromise,
|
|
302
|
-
writeStreamPromise,
|
|
303
|
-
]);
|
|
293
|
+
return await B.all([zipReadStreamPromise, writeStreamPromise]);
|
|
304
294
|
}
|
|
305
295
|
|
|
306
296
|
/**
|
|
@@ -319,7 +309,7 @@ async function _extractEntryTo (zipFile, entry, destDir) {
|
|
|
319
309
|
* The iteration through the source zip file will bi terminated as soon as
|
|
320
310
|
* the result of this function equals to `false`.
|
|
321
311
|
*/
|
|
322
|
-
async function readEntries
|
|
312
|
+
async function readEntries(zipFilePath, onEntry) {
|
|
323
313
|
// Open a zip file and start reading entries
|
|
324
314
|
const zipfile = await openZip(zipFilePath, {lazyEntries: true});
|
|
325
315
|
const zipReadStreamPromise = new B((resolve, reject) => {
|
|
@@ -330,7 +320,7 @@ async function readEntries (zipFilePath, onEntry) {
|
|
|
330
320
|
zipfile.on('entry', async (entry) => {
|
|
331
321
|
const res = await onEntry({
|
|
332
322
|
entry,
|
|
333
|
-
extractEntryTo: async (destDir) => await _extractEntryTo(zipfile, entry, destDir)
|
|
323
|
+
extractEntryTo: async (destDir) => await _extractEntryTo(zipfile, entry, destDir),
|
|
334
324
|
});
|
|
335
325
|
if (res === false) {
|
|
336
326
|
return zipfile.emit('end');
|
|
@@ -370,17 +360,12 @@ async function readEntries (zipFilePath, onEntry) {
|
|
|
370
360
|
* @throws {Error} if there was an error while reading the source
|
|
371
361
|
* or the source is too big
|
|
372
362
|
*/
|
|
373
|
-
async function toInMemoryZip
|
|
374
|
-
if (!await fs.exists(srcPath)) {
|
|
363
|
+
async function toInMemoryZip(srcPath, opts = /** @type {ZipOptions} */ ({})) {
|
|
364
|
+
if (!(await fs.exists(srcPath))) {
|
|
375
365
|
throw new Error(`No such file or folder: ${srcPath}`);
|
|
376
366
|
}
|
|
377
367
|
|
|
378
|
-
const {
|
|
379
|
-
isMetered = true,
|
|
380
|
-
encodeToBase64 = false,
|
|
381
|
-
maxSize = 1 * GiB,
|
|
382
|
-
level = 9,
|
|
383
|
-
} = opts;
|
|
368
|
+
const {isMetered = true, encodeToBase64 = false, maxSize = 1 * GiB, level = 9} = opts;
|
|
384
369
|
const resultBuffers = [];
|
|
385
370
|
let resultBuffersSize = 0;
|
|
386
371
|
// Create a writable stream that zip buffers will be streamed to
|
|
@@ -389,8 +374,13 @@ async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
|
389
374
|
resultBuffers.push(buffer);
|
|
390
375
|
resultBuffersSize += buffer.length;
|
|
391
376
|
if (maxSize > 0 && resultBuffersSize > maxSize) {
|
|
392
|
-
resultWriteStream.emit(
|
|
393
|
-
|
|
377
|
+
resultWriteStream.emit(
|
|
378
|
+
'error',
|
|
379
|
+
new Error(
|
|
380
|
+
`The size of the resulting ` +
|
|
381
|
+
`archive must not be greater than ${toReadableSizeString(maxSize)}`
|
|
382
|
+
)
|
|
383
|
+
);
|
|
394
384
|
}
|
|
395
385
|
next();
|
|
396
386
|
},
|
|
@@ -398,7 +388,7 @@ async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
|
398
388
|
|
|
399
389
|
// Zip 'srcDir' and stream it to the above writable stream
|
|
400
390
|
const archive = archiver('zip', {
|
|
401
|
-
zlib: {level}
|
|
391
|
+
zlib: {level},
|
|
402
392
|
});
|
|
403
393
|
let srcSize = null;
|
|
404
394
|
const base64EncoderStream = encodeToBase64 ? new Base64Encode() : null;
|
|
@@ -421,8 +411,7 @@ async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
|
421
411
|
});
|
|
422
412
|
const archiveStreamPromise = new B((resolve, reject) => {
|
|
423
413
|
archive.once('finish', resolve);
|
|
424
|
-
archive.once('error', (e) => reject(
|
|
425
|
-
new Error(`Failed to archive '${srcPath}': ${e.message}`)));
|
|
414
|
+
archive.once('error', (e) => reject(new Error(`Failed to archive '${srcPath}': ${e.message}`)));
|
|
426
415
|
});
|
|
427
416
|
const timer = isMetered ? new Timer().start() : null;
|
|
428
417
|
if ((await fs.stat(srcPath)).isDirectory()) {
|
|
@@ -444,11 +433,13 @@ async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
|
444
433
|
await B.all([archiveStreamPromise, resultWriteStreamPromise]);
|
|
445
434
|
|
|
446
435
|
if (timer) {
|
|
447
|
-
log.debug(
|
|
448
|
-
`
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
436
|
+
log.debug(
|
|
437
|
+
`Zipped ${encodeToBase64 ? 'and base64-encoded ' : ''}` +
|
|
438
|
+
`'${path.basename(srcPath)}' ` +
|
|
439
|
+
(srcSize ? `(${toReadableSizeString(srcSize)}) ` : '') +
|
|
440
|
+
`in ${timer.getDuration().asSeconds.toFixed(3)}s ` +
|
|
441
|
+
`(compression level: ${level})`
|
|
442
|
+
);
|
|
452
443
|
}
|
|
453
444
|
// Return the array of zip buffers concatenated into one buffer
|
|
454
445
|
return Buffer.concat(resultBuffers);
|
|
@@ -460,8 +451,8 @@ async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
|
460
451
|
* @param {string} filePath - Full path to the file
|
|
461
452
|
* @throws {Error} If the file does not exist or is not a valid ZIP archive
|
|
462
453
|
*/
|
|
463
|
-
async function assertValidZip
|
|
464
|
-
if (!await fs.exists(filePath)) {
|
|
454
|
+
async function assertValidZip(filePath) {
|
|
455
|
+
if (!(await fs.exists(filePath))) {
|
|
465
456
|
throw new Error(`The file at '${filePath}' does not exist`);
|
|
466
457
|
}
|
|
467
458
|
|
|
@@ -475,8 +466,10 @@ async function assertValidZip (filePath) {
|
|
|
475
466
|
await fs.read(fd, buffer, 0, ZIP_MAGIC.length, 0);
|
|
476
467
|
const signature = buffer.toString('ascii');
|
|
477
468
|
if (signature !== ZIP_MAGIC) {
|
|
478
|
-
throw new Error(
|
|
479
|
-
`
|
|
469
|
+
throw new Error(
|
|
470
|
+
`The file signature '${signature}' of '${filePath}' ` +
|
|
471
|
+
`is not equal to the expected ZIP archive signature '${ZIP_MAGIC}'`
|
|
472
|
+
);
|
|
480
473
|
}
|
|
481
474
|
return true;
|
|
482
475
|
} finally {
|
|
@@ -506,16 +499,14 @@ async function assertValidZip (filePath) {
|
|
|
506
499
|
* @param {ZipCompressionOptions} opts - Compression options
|
|
507
500
|
* @throws {Error} If there was an error while creating the archive
|
|
508
501
|
*/
|
|
509
|
-
async function toArchive
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
} = src;
|
|
518
|
-
const archive = archiver('zip', { zlib: { level }});
|
|
502
|
+
async function toArchive(
|
|
503
|
+
dstPath,
|
|
504
|
+
src = /** @type {ZipSourceOptions} */ ({}),
|
|
505
|
+
opts = /** @type {ZipCompressionOptions} */ ({})
|
|
506
|
+
) {
|
|
507
|
+
const {level = 9} = opts;
|
|
508
|
+
const {pattern = '**/*', cwd = path.dirname(dstPath), ignore = []} = src;
|
|
509
|
+
const archive = archiver('zip', {zlib: {level}});
|
|
519
510
|
const stream = fs.createWriteStream(dstPath);
|
|
520
511
|
return await new B((resolve, reject) => {
|
|
521
512
|
archive
|
|
@@ -545,13 +536,18 @@ const getExecutablePath = _.memoize(
|
|
|
545
536
|
/**
|
|
546
537
|
* @returns {Promise<string>} Full Path to the executable
|
|
547
538
|
*/
|
|
548
|
-
async function getExecutablePath
|
|
539
|
+
async function getExecutablePath(binaryName) {
|
|
549
540
|
const fullPath = await fs.which(binaryName);
|
|
550
541
|
log.debug(`Found '%s' at '%s'`, binaryName, fullPath);
|
|
551
542
|
return fullPath;
|
|
552
543
|
}
|
|
553
544
|
);
|
|
554
545
|
|
|
555
|
-
export {
|
|
556
|
-
|
|
557
|
-
|
|
546
|
+
export {extractAllTo, readEntries, toInMemoryZip, _extractEntryTo, assertValidZip, toArchive};
|
|
547
|
+
export default {
|
|
548
|
+
extractAllTo,
|
|
549
|
+
readEntries,
|
|
550
|
+
toInMemoryZip,
|
|
551
|
+
assertValidZip,
|
|
552
|
+
toArchive,
|
|
553
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/support",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.59.2",
|
|
4
4
|
"description": "Support libs used across appium packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"author": "https://github.com/appium",
|
|
26
|
+
"types": "./build/lib/index.d.ts",
|
|
26
27
|
"directories": {
|
|
27
28
|
"lib": "lib"
|
|
28
29
|
},
|
|
@@ -36,26 +37,29 @@
|
|
|
36
37
|
"dev": "npm run build -- --watch",
|
|
37
38
|
"fix": "npm run lint -- --fix",
|
|
38
39
|
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
40
|
+
"prepare": "npm run build",
|
|
39
41
|
"test": "npm run test:unit",
|
|
40
42
|
"test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
|
|
41
43
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@babel/runtime": "7.
|
|
46
|
+
"@babel/runtime": "7.18.3",
|
|
47
|
+
"@colors/colors": "1.5.0",
|
|
45
48
|
"archiver": "5.3.1",
|
|
46
49
|
"axios": "0.27.2",
|
|
47
50
|
"base64-stream": "1.0.0",
|
|
48
51
|
"bluebird": "3.7.2",
|
|
49
|
-
"bplist-creator": "0.1.
|
|
50
|
-
"bplist-parser": "0.3.
|
|
52
|
+
"bplist-creator": "0.1.1",
|
|
53
|
+
"bplist-parser": "0.3.2",
|
|
51
54
|
"form-data": "4.0.0",
|
|
52
55
|
"get-stream": "6.0.1",
|
|
53
|
-
"glob": "8.0.
|
|
56
|
+
"glob": "8.0.3",
|
|
54
57
|
"jimp": "0.16.1",
|
|
55
58
|
"jsftp": "2.1.3",
|
|
56
59
|
"klaw": "3.0.0",
|
|
57
60
|
"lockfile": "1.0.4",
|
|
58
61
|
"lodash": "4.17.21",
|
|
62
|
+
"log-symbols": "4.1.0",
|
|
59
63
|
"moment": "2.29.3",
|
|
60
64
|
"mv": "2.1.1",
|
|
61
65
|
"ncp": "2.0.0",
|
|
@@ -72,18 +76,18 @@
|
|
|
72
76
|
"semver": "7.3.7",
|
|
73
77
|
"shell-quote": "1.7.3",
|
|
74
78
|
"source-map-support": "0.5.21",
|
|
79
|
+
"supports-color": "8.1.1",
|
|
75
80
|
"teen_process": "1.16.0",
|
|
76
81
|
"uuid": "8.3.2",
|
|
77
82
|
"which": "2.0.2",
|
|
78
83
|
"yauzl": "2.10.0"
|
|
79
84
|
},
|
|
80
85
|
"engines": {
|
|
81
|
-
"node": ">=
|
|
86
|
+
"node": ">=14",
|
|
82
87
|
"npm": ">=6"
|
|
83
88
|
},
|
|
84
89
|
"publishConfig": {
|
|
85
90
|
"access": "public"
|
|
86
91
|
},
|
|
87
|
-
"
|
|
88
|
-
"gitHead": "5482c921bc187ed8807922c00bd2355585f4971a"
|
|
92
|
+
"gitHead": "4cf2cc92d066ed32adda27e0439547290a4b71ce"
|
|
89
93
|
}
|