@appium/support 2.56.1 → 2.57.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/env.d.ts +54 -0
- package/build/lib/env.d.ts.map +1 -0
- package/build/lib/fs.d.ts +221 -0
- package/build/lib/fs.d.ts.map +1 -0
- package/build/lib/fs.js +1 -1
- package/build/lib/image-util.d.ts +56 -0
- package/build/lib/image-util.d.ts.map +1 -0
- package/build/lib/image-util.js +2 -3
- package/build/lib/index.d.ts +38 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +20 -14
- package/build/lib/log-internal.d.ts +74 -0
- package/build/lib/log-internal.d.ts.map +1 -0
- package/build/lib/log-internal.js +10 -18
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logging.d.ts +45 -0
- package/build/lib/logging.d.ts.map +1 -0
- package/build/lib/logging.js +11 -13
- package/build/lib/mjpeg.d.ts +65 -0
- package/build/lib/mjpeg.d.ts.map +1 -0
- package/build/lib/mjpeg.js +11 -4
- package/build/lib/mkdirp.d.ts +3 -0
- package/build/lib/mkdirp.d.ts.map +1 -0
- package/build/lib/net.d.ts +95 -0
- package/build/lib/net.d.ts.map +1 -0
- package/build/lib/net.js +41 -23
- package/build/lib/node.d.ts +26 -0
- package/build/lib/node.d.ts.map +1 -0
- package/build/lib/node.js +4 -2
- package/build/lib/npm.d.ts +123 -0
- package/build/lib/npm.d.ts.map +1 -0
- package/build/lib/npm.js +18 -41
- package/build/lib/plist.d.ts +43 -0
- package/build/lib/plist.d.ts.map +1 -0
- package/build/lib/plist.js +1 -1
- package/build/lib/process.d.ts +3 -0
- package/build/lib/process.d.ts.map +1 -0
- package/build/lib/system.d.ts +7 -0
- package/build/lib/system.d.ts.map +1 -0
- package/build/lib/tempdir.d.ts +63 -0
- package/build/lib/tempdir.d.ts.map +1 -0
- package/build/lib/tempdir.js +3 -6
- package/build/lib/timing.d.ts +46 -0
- package/build/lib/timing.d.ts.map +1 -0
- package/build/lib/util.d.ts +183 -0
- package/build/lib/util.d.ts.map +1 -0
- package/build/lib/util.js +4 -8
- package/build/lib/zip.d.ts +180 -0
- package/build/lib/zip.d.ts.map +1 -0
- package/build/lib/zip.js +6 -2
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/fs.js +9 -4
- package/lib/image-util.js +23 -7
- package/lib/index.js +2 -8
- package/lib/log-internal.js +31 -38
- package/lib/logging.js +40 -16
- package/lib/mjpeg.js +14 -5
- package/lib/net.js +116 -60
- package/lib/node.js +4 -4
- package/lib/npm.js +33 -90
- package/lib/plist.js +3 -1
- package/lib/tempdir.js +8 -7
- package/lib/util.js +10 -11
- package/lib/zip.js +24 -13
- package/package.json +18 -11
package/lib/npm.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import semver from 'semver';
|
|
5
|
+
import { hasAppiumDependency } from './env';
|
|
5
6
|
import { exec } from 'teen_process';
|
|
6
7
|
import { fs } from './fs';
|
|
7
8
|
import * as util from './util';
|
|
@@ -27,14 +28,6 @@ export const INSTALL_LOCKFILE_RELATIVE_PATH = path.join(
|
|
|
27
28
|
'.install.lock',
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
/**
|
|
31
|
-
* Relative path to lockfile used when linking an extension via `appium`
|
|
32
|
-
*/
|
|
33
|
-
export const LINK_LOCKFILE_RELATIVE_PATH = path.join(
|
|
34
|
-
CACHE_DIR_RELATIVE_PATH,
|
|
35
|
-
'.link.lock',
|
|
36
|
-
);
|
|
37
|
-
|
|
38
31
|
/**
|
|
39
32
|
* XXX: This should probably be a singleton, but it isn't. Maybe this module should just export functions?
|
|
40
33
|
*/
|
|
@@ -48,15 +41,6 @@ export class NPM {
|
|
|
48
41
|
return path.join(cwd, INSTALL_LOCKFILE_RELATIVE_PATH);
|
|
49
42
|
}
|
|
50
43
|
|
|
51
|
-
/**
|
|
52
|
-
* Returns path to "link" lockfile
|
|
53
|
-
* @private
|
|
54
|
-
* @param {string} cwd
|
|
55
|
-
*/
|
|
56
|
-
_getLinkLockfilePath (cwd) {
|
|
57
|
-
return path.join(cwd, LINK_LOCKFILE_RELATIVE_PATH);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
44
|
/**
|
|
61
45
|
* Execute `npm` with given args.
|
|
62
46
|
*
|
|
@@ -65,9 +49,9 @@ export class NPM {
|
|
|
65
49
|
* @param {string} cmd
|
|
66
50
|
* @param {string[]} args
|
|
67
51
|
* @param {ExecOpts} opts
|
|
68
|
-
* @param {
|
|
52
|
+
* @param {ExecOpts} [execOpts]
|
|
69
53
|
*/
|
|
70
|
-
async exec (cmd, args, opts, execOpts = {}) {
|
|
54
|
+
async exec (cmd, args, opts, execOpts = /** @type {ExecOpts} */({})) {
|
|
71
55
|
let { cwd, json, lockFile } = opts;
|
|
72
56
|
|
|
73
57
|
// make sure we perform the current operation in cwd
|
|
@@ -85,10 +69,11 @@ export class NPM {
|
|
|
85
69
|
runner = async () => await acquireLock(_runner);
|
|
86
70
|
}
|
|
87
71
|
|
|
72
|
+
/** @type {import('teen_process').ExecResult<string> & {json?: any}} */
|
|
88
73
|
let ret;
|
|
89
74
|
try {
|
|
90
75
|
const {stdout, stderr, code} = await runner();
|
|
91
|
-
ret =
|
|
76
|
+
ret = {stdout, stderr, code};
|
|
92
77
|
// if possible, parse NPM's json output. During NPM install 3rd-party
|
|
93
78
|
// packages can write to stdout, so sometimes the json output can't be
|
|
94
79
|
// guaranteed to be parseable
|
|
@@ -189,18 +174,37 @@ export class NPM {
|
|
|
189
174
|
* @returns {Promise<import('type-fest').PackageJson>}
|
|
190
175
|
*/
|
|
191
176
|
async installPackage (cwd, pkgName, {pkgVer} = {}) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
177
|
+
/** @type {any} */
|
|
178
|
+
let dummyPkgJson;
|
|
179
|
+
const dummyPkgPath = path.join(cwd, 'package.json');
|
|
180
|
+
try {
|
|
181
|
+
dummyPkgJson = JSON.parse(await fs.readFile(dummyPkgPath, 'utf8'));
|
|
182
|
+
} catch (err) {
|
|
183
|
+
if (err.code === 'ENOENT') {
|
|
184
|
+
dummyPkgJson = {};
|
|
185
|
+
await fs.writeFile(dummyPkgPath, JSON.stringify(dummyPkgJson, null, 2), 'utf8');
|
|
186
|
+
} else {
|
|
187
|
+
throw err;
|
|
188
|
+
}
|
|
198
189
|
}
|
|
199
190
|
|
|
191
|
+
/**
|
|
192
|
+
* If we've found a `package.json` containined the `appiumCreated` property,
|
|
193
|
+
* then we can do whatever we please with it, since we created it. This is
|
|
194
|
+
* likely when `APPIUM_HOME` is the default (in `~/.appium`). In that case,
|
|
195
|
+
* we want `--global-style` to avoid deduping, and we also do not need a
|
|
196
|
+
* `package-lock.json`.
|
|
197
|
+
*
|
|
198
|
+
* If we _haven't_ found such a key, then this `package.json` isn't a
|
|
199
|
+
* "dummy" and is controlled by the user. So we'll just add it as a dev
|
|
200
|
+
* dep; whatever else it does is up to the user's npm config.
|
|
201
|
+
*/
|
|
202
|
+
const installOpts = await hasAppiumDependency(cwd) ?
|
|
203
|
+
['--save-dev'] :
|
|
204
|
+
['--save-dev', '--save-exact', '--global-style', '--no-package-lock'];
|
|
205
|
+
|
|
200
206
|
const res = await this.exec('install', [
|
|
201
|
-
|
|
202
|
-
'--global-style',
|
|
203
|
-
'--no-package-lock',
|
|
207
|
+
...installOpts,
|
|
204
208
|
pkgVer ? `${pkgName}@${pkgVer}` : pkgName
|
|
205
209
|
], {
|
|
206
210
|
cwd,
|
|
@@ -230,46 +234,6 @@ export class NPM {
|
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
/**
|
|
234
|
-
* @todo: I think this can be an `install` instead of a `link`.
|
|
235
|
-
* @param {string} cwd
|
|
236
|
-
* @param {string} pkgPath
|
|
237
|
-
*/
|
|
238
|
-
async linkPackage (cwd, pkgPath) {
|
|
239
|
-
// from the path alone we don't know the npm package name, so we need to
|
|
240
|
-
// look in package.json
|
|
241
|
-
let pkgName;
|
|
242
|
-
try {
|
|
243
|
-
pkgName = require(path.resolve(pkgPath, 'package.json')).name;
|
|
244
|
-
} catch {
|
|
245
|
-
throw new Error('Could not find package.json inside the package path ' +
|
|
246
|
-
`provided: ${pkgPath}`);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// this is added to handle commands with relative paths
|
|
250
|
-
// ie: "node . driver install --source=local ../fake-driver"
|
|
251
|
-
pkgPath = path.resolve(process.cwd(), pkgPath);
|
|
252
|
-
|
|
253
|
-
// call link with --no-package-lock to ensure no corruption while installing local packages
|
|
254
|
-
const args = [
|
|
255
|
-
'--global-style',
|
|
256
|
-
'--no-package-lock',
|
|
257
|
-
pkgPath
|
|
258
|
-
];
|
|
259
|
-
const res = await this.exec('link', args, {cwd, lockFile: this._getLinkLockfilePath(cwd)});
|
|
260
|
-
if (res.json && res.json.error) {
|
|
261
|
-
throw new Error(res.json.error);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// now ensure it was linked to the correct place
|
|
265
|
-
try {
|
|
266
|
-
return require(resolveFrom(cwd, `${pkgName}/package.json`));
|
|
267
|
-
} catch {
|
|
268
|
-
throw new Error('The package was not linked correctly; its package.json ' +
|
|
269
|
-
'did not exist or was unreadable');
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
237
|
/**
|
|
274
238
|
* @param {string} cwd
|
|
275
239
|
* @param {string} pkg
|
|
@@ -300,15 +264,6 @@ export const npm = new NPM();
|
|
|
300
264
|
|
|
301
265
|
// THESE TYPES SHOULD BE IN TEEN PROCESS, NOT HERE
|
|
302
266
|
|
|
303
|
-
/**
|
|
304
|
-
* Result from a non-zero-exit execution of `appium`
|
|
305
|
-
* @typedef TeenProcessExecResult
|
|
306
|
-
* @property {string} stdout - Stdout
|
|
307
|
-
* @property {string} stderr - Stderr
|
|
308
|
-
* @property {number?} code - Exit code
|
|
309
|
-
* @property {any} json - JSON parsed from stdout
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
267
|
/**
|
|
313
268
|
* Extra props `teen_process.exec` adds to its error objects
|
|
314
269
|
* @typedef TeenProcessExecErrorProps
|
|
@@ -317,18 +272,6 @@ export const npm = new NPM();
|
|
|
317
272
|
* @property {number?} code - Exit code
|
|
318
273
|
*/
|
|
319
274
|
|
|
320
|
-
/**
|
|
321
|
-
* Options unique to `teen_process.exec`. I probably missed some
|
|
322
|
-
* @typedef TeenProcessExecExtraOpts
|
|
323
|
-
* @property {number} [maxStdoutBufferSize]
|
|
324
|
-
* @property {number} [maxStderrBufferSize]
|
|
325
|
-
*/
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* All options for `teen_process.exec`
|
|
329
|
-
* @typedef {import('child_process').SpawnOptions & TeenProcessExecExtraOpts} TeenProcessExecOpts
|
|
330
|
-
*/
|
|
331
|
-
|
|
332
275
|
/**
|
|
333
276
|
* Error thrown by `teen_process.exec`
|
|
334
277
|
* @typedef {Error & TeenProcessExecErrorProps} TeenProcessExecError
|
package/lib/plist.js
CHANGED
|
@@ -26,7 +26,7 @@ async function parseXmlPlistFile (plistFilename) {
|
|
|
26
26
|
* @param {string} plist The plist file path
|
|
27
27
|
* @param {boolean} mustExist If set to false, this method will return an empty object when the file doesn't exist
|
|
28
28
|
* @param {boolean} quiet If set to false, the plist path will be logged in debug level
|
|
29
|
-
* @returns {
|
|
29
|
+
* @returns {Promise<any>} parsed plist JS Object
|
|
30
30
|
*/
|
|
31
31
|
async function parsePlistFile (plist, mustExist = true, quiet = true) {
|
|
32
32
|
// handle nonexistant file
|
|
@@ -103,6 +103,8 @@ function createBinaryPlist (data) {
|
|
|
103
103
|
* @param {Buffer} data The beffer of a binary plist
|
|
104
104
|
*/
|
|
105
105
|
function parseBinaryPlist (data) {
|
|
106
|
+
// this function exists, but is not in the type declarations.
|
|
107
|
+
// @ts-expect-error
|
|
106
108
|
return bplistParse.parseBuffer(data);
|
|
107
109
|
}
|
|
108
110
|
|
package/lib/tempdir.js
CHANGED
|
@@ -34,8 +34,8 @@ async function tempDir () {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @typedef Affixes
|
|
37
|
-
* @property {string} prefix - prefix of the temp directory name
|
|
38
|
-
* @property {string} suffix - suffix of the temp directory name
|
|
37
|
+
* @property {string} [prefix] - prefix of the temp directory name
|
|
38
|
+
* @property {string} [suffix] - suffix of the temp directory name
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -43,7 +43,7 @@ async function tempDir () {
|
|
|
43
43
|
* with arbitrary prefix/suffix for the directory name.
|
|
44
44
|
*
|
|
45
45
|
* @param {string|Affixes} rawAffixes
|
|
46
|
-
* @param {
|
|
46
|
+
* @param {string} [defaultPrefix]
|
|
47
47
|
* @returns {Promise<string>} A path to the temporary directory with rawAffixes and defaultPrefix
|
|
48
48
|
*/
|
|
49
49
|
async function path (rawAffixes, defaultPrefix) {
|
|
@@ -56,7 +56,7 @@ async function path (rawAffixes, defaultPrefix) {
|
|
|
56
56
|
/**
|
|
57
57
|
* @typedef OpenedAffixes
|
|
58
58
|
* @property {string} path - The path to file
|
|
59
|
-
* @property {
|
|
59
|
+
* @property {number} fd - The file descriptor opened
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -73,7 +73,7 @@ async function open (affixes) {
|
|
|
73
73
|
// opens the file in mode 384
|
|
74
74
|
return {path: filePath, fd};
|
|
75
75
|
} catch (err) {
|
|
76
|
-
log.errorAndThrow(err);
|
|
76
|
+
return log.errorAndThrow(err);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -82,11 +82,12 @@ async function open (affixes) {
|
|
|
82
82
|
* Returns prefix/suffix object
|
|
83
83
|
*
|
|
84
84
|
* @param {string|Affixes} rawAffixes
|
|
85
|
-
* @param {
|
|
85
|
+
* @param {string} [defaultPrefix]
|
|
86
86
|
* @returns {Affixes}
|
|
87
87
|
*/
|
|
88
88
|
function parseAffixes (rawAffixes, defaultPrefix) {
|
|
89
|
-
|
|
89
|
+
/** @type {Affixes} */
|
|
90
|
+
let affixes = {};
|
|
90
91
|
if (rawAffixes) {
|
|
91
92
|
switch (typeof rawAffixes) {
|
|
92
93
|
case 'string':
|
package/lib/util.js
CHANGED
|
@@ -276,15 +276,9 @@ async function isSameDestination (path1, path2, ...pathN) {
|
|
|
276
276
|
return true;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
// however below that the options get interpreted as the callback
|
|
281
|
-
// TODO: remove when Node 10 is no longer supported
|
|
282
|
-
let mapCb = async (x) => await fs.stat(x, {
|
|
279
|
+
let mapCb = async (x) => (await fs.stat(x, {
|
|
283
280
|
bigint: true,
|
|
284
|
-
}).ino;
|
|
285
|
-
if (semver.lt(process.version, '10.5.0')) {
|
|
286
|
-
mapCb = async (x) => await fs.stat(x).ino;
|
|
287
|
-
}
|
|
281
|
+
})).ino;
|
|
288
282
|
return areAllItemsEqual(await B.map(allPaths, mapCb));
|
|
289
283
|
}
|
|
290
284
|
|
|
@@ -304,7 +298,7 @@ function coerceVersion (ver, strict = /** @type {Strict} */(true)) {
|
|
|
304
298
|
if (strict && !result) {
|
|
305
299
|
throw new Error(`'${ver}' cannot be coerced to a valid version number`);
|
|
306
300
|
}
|
|
307
|
-
return /** @type {Strict extends true ? string : string
|
|
301
|
+
return /** @type {Strict extends true ? string : string?} */(result);
|
|
308
302
|
}
|
|
309
303
|
|
|
310
304
|
const SUPPORTED_OPERATORS = ['==', '!=', '>', '<', '>=', '<=', '='];
|
|
@@ -341,7 +335,7 @@ function compareVersions (ver1, operator, ver2) {
|
|
|
341
335
|
* @returns {string} - The arguments, quoted
|
|
342
336
|
*/
|
|
343
337
|
function quote (args) {
|
|
344
|
-
return shellQuote(args);
|
|
338
|
+
return shellQuote(_.castArray(args));
|
|
345
339
|
}
|
|
346
340
|
|
|
347
341
|
/**
|
|
@@ -460,9 +454,10 @@ async function toInMemoryBase64 (srcPath, opts = {}) {
|
|
|
460
454
|
* longer present on the system. This allows for preventing concurrent behavior across processes
|
|
461
455
|
* using a known lockfile path.
|
|
462
456
|
*
|
|
457
|
+
* @template T
|
|
463
458
|
* @param {string} lockFile The full path to the file used for the lock
|
|
464
459
|
* @param {LockFileOptions} opts
|
|
465
|
-
* @returns
|
|
460
|
+
* @returns async function that takes another async function defining the locked
|
|
466
461
|
* behavior
|
|
467
462
|
*/
|
|
468
463
|
function getLockFileGuard (lockFile, opts = {}) {
|
|
@@ -475,6 +470,10 @@ function getLockFileGuard (lockFile, opts = {}) {
|
|
|
475
470
|
const check = B.promisify(_lockfile.check);
|
|
476
471
|
const unlock = B.promisify(_lockfile.unlock);
|
|
477
472
|
|
|
473
|
+
/**
|
|
474
|
+
* @param {(...args: any[]) => T} behavior
|
|
475
|
+
* @returns {Promise<T>}
|
|
476
|
+
*/
|
|
478
477
|
const guard = async (behavior) => {
|
|
479
478
|
let triedRecovery = false;
|
|
480
479
|
do {
|
package/lib/zip.js
CHANGED
|
@@ -14,7 +14,13 @@ import log from './logger';
|
|
|
14
14
|
import getStream from 'get-stream';
|
|
15
15
|
import { exec } from 'teen_process';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @type {(path: string, options?: yauzl.Options) => Promise<yauzl.ZipFile>}
|
|
19
|
+
*/
|
|
17
20
|
const openZip = B.promisify(yauzl.open);
|
|
21
|
+
/**
|
|
22
|
+
* @type {(source: NodeJS.ReadableStream, destination: NodeJS.WritableStream) => Promise<NodeJS.WritableStream>}
|
|
23
|
+
*/
|
|
18
24
|
const pipeline = B.promisify(stream.pipeline);
|
|
19
25
|
const ZIP_MAGIC = 'PK';
|
|
20
26
|
const IFMT = 61440;
|
|
@@ -23,6 +29,9 @@ const IFLNK = 40960;
|
|
|
23
29
|
|
|
24
30
|
// This class is mostly copied from https://github.com/maxogden/extract-zip/blob/master/index.js
|
|
25
31
|
class ZipExtractor {
|
|
32
|
+
/** @type {yauzl.ZipFile} */
|
|
33
|
+
zipfile;
|
|
34
|
+
|
|
26
35
|
constructor (sourcePath, opts = {}) {
|
|
27
36
|
this.zipPath = sourcePath;
|
|
28
37
|
this.opts = opts;
|
|
@@ -125,7 +134,9 @@ class ZipExtractor {
|
|
|
125
134
|
return;
|
|
126
135
|
}
|
|
127
136
|
|
|
128
|
-
|
|
137
|
+
/** @type {(entry: yauzl.Entry) => Promise<NodeJS.ReadableStream>} */
|
|
138
|
+
const openReadStream = B.promisify(this.zipfile.openReadStream.bind(this.zipfile));
|
|
139
|
+
const readStream = await openReadStream(entry);
|
|
129
140
|
if (isSymlink) {
|
|
130
141
|
const link = await getStream(readStream);
|
|
131
142
|
await fs.symlink(link, dest);
|
|
@@ -183,9 +194,9 @@ class ZipExtractor {
|
|
|
183
194
|
*
|
|
184
195
|
* @param {string} zipFilePath The full path to the source ZIP file
|
|
185
196
|
* @param {string} destDir The full path to the destination folder
|
|
186
|
-
* @param {
|
|
197
|
+
* @param {ExtractAllOptions} [opts]
|
|
187
198
|
*/
|
|
188
|
-
async function extractAllTo (zipFilePath, destDir, opts = {}) {
|
|
199
|
+
async function extractAllTo (zipFilePath, destDir, opts = /** @type {ExtractAllOptions} */({})) {
|
|
189
200
|
if (!path.isAbsolute(destDir)) {
|
|
190
201
|
throw new Error(`Target path '${destDir}' is expected to be absolute`);
|
|
191
202
|
}
|
|
@@ -250,8 +261,8 @@ async function extractWithSystemUnzip (zipFilePath, destDir) {
|
|
|
250
261
|
/**
|
|
251
262
|
* Extract a single zip entry to a directory
|
|
252
263
|
*
|
|
253
|
-
* @param {
|
|
254
|
-
* @param {yauzl.
|
|
264
|
+
* @param {yauzl.ZipFile} zipFile The source ZIP stream
|
|
265
|
+
* @param {yauzl.Entry} entry The entry instance
|
|
255
266
|
* @param {string} destDir The full path to the destination folder
|
|
256
267
|
*/
|
|
257
268
|
async function _extractEntryTo (zipFile, entry, destDir) {
|
|
@@ -294,7 +305,7 @@ async function _extractEntryTo (zipFile, entry, destDir) {
|
|
|
294
305
|
|
|
295
306
|
/**
|
|
296
307
|
* @typedef ZipEntry
|
|
297
|
-
* @property {yauzl.
|
|
308
|
+
* @property {yauzl.Entry} entry The actual entry instance
|
|
298
309
|
* @property {function} extractEntryTo An async function, which accepts one parameter.
|
|
299
310
|
* This parameter contains the destination folder path to which this function is going to extract the entry.
|
|
300
311
|
*/
|
|
@@ -354,12 +365,12 @@ async function readEntries (zipFilePath, onEntry) {
|
|
|
354
365
|
*
|
|
355
366
|
* @param {string} srcPath The full path to the folder or file being zipped
|
|
356
367
|
* @param {ZipOptions} opts Zipping options
|
|
357
|
-
* @returns {Buffer} Zipped (and encoded if `encodeToBase64` is truthy)
|
|
368
|
+
* @returns {Promise<Buffer>} Zipped (and encoded if `encodeToBase64` is truthy)
|
|
358
369
|
* content of the source path as memory buffer
|
|
359
370
|
* @throws {Error} if there was an error while reading the source
|
|
360
371
|
* or the source is too big
|
|
361
372
|
*/
|
|
362
|
-
async function toInMemoryZip (srcPath, opts = {}) {
|
|
373
|
+
async function toInMemoryZip (srcPath, opts = /** @type {ZipOptions} */({})) {
|
|
363
374
|
if (!await fs.exists(srcPath)) {
|
|
364
375
|
throw new Error(`No such file or folder: ${srcPath}`);
|
|
365
376
|
}
|
|
@@ -481,10 +492,10 @@ async function assertValidZip (filePath) {
|
|
|
481
492
|
|
|
482
493
|
/**
|
|
483
494
|
* @typedef ZipSourceOptions
|
|
484
|
-
* @property {
|
|
485
|
-
* @property {
|
|
495
|
+
* @property {string} pattern ['**\/*'] - GLOB pattern for compression
|
|
496
|
+
* @property {string} cwd - The source root folder (the parent folder of
|
|
486
497
|
* the destination file by default)
|
|
487
|
-
* @property {
|
|
498
|
+
* @property {string[]} [ignore] - The list of ignored patterns
|
|
488
499
|
*/
|
|
489
500
|
|
|
490
501
|
/**
|
|
@@ -495,7 +506,7 @@ async function assertValidZip (filePath) {
|
|
|
495
506
|
* @param {ZipCompressionOptions} opts - Compression options
|
|
496
507
|
* @throws {Error} If there was an error while creating the archive
|
|
497
508
|
*/
|
|
498
|
-
async function toArchive (dstPath, src = {}, opts = {}) {
|
|
509
|
+
async function toArchive (dstPath, src = /** @type {ZipSourceOptions} */({}), opts = /** @type {ZipCompressionOptions} */({})) {
|
|
499
510
|
const {
|
|
500
511
|
level = 9,
|
|
501
512
|
} = opts;
|
|
@@ -532,7 +543,7 @@ async function toArchive (dstPath, src = {}, opts = {}) {
|
|
|
532
543
|
*/
|
|
533
544
|
const getExecutablePath = _.memoize(
|
|
534
545
|
/**
|
|
535
|
-
* @returns {
|
|
546
|
+
* @returns {Promise<string>} Full Path to the executable
|
|
536
547
|
*/
|
|
537
548
|
async function getExecutablePath (binaryName) {
|
|
538
549
|
const fullPath = await fs.which(binaryName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/support",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.57.2",
|
|
4
4
|
"description": "Support libs used across appium packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"build"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "babel lib --root-mode=upward --
|
|
35
|
+
"build": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
36
36
|
"dev": "npm run build -- --watch",
|
|
37
37
|
"fix": "npm run lint -- --fix",
|
|
38
38
|
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
39
39
|
"test": "npm run test:unit",
|
|
40
|
-
"test:e2e": "mocha --
|
|
41
|
-
"test:unit": "mocha
|
|
40
|
+
"test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
|
|
41
|
+
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@babel/runtime": "7.17.
|
|
45
|
-
"archiver": "5.3.
|
|
44
|
+
"@babel/runtime": "7.17.9",
|
|
45
|
+
"archiver": "5.3.1",
|
|
46
46
|
"axios": "0.26.1",
|
|
47
47
|
"base64-stream": "1.0.0",
|
|
48
48
|
"bluebird": "3.7.2",
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
"bplist-parser": "0.3.1",
|
|
51
51
|
"form-data": "4.0.0",
|
|
52
52
|
"get-stream": "6.0.1",
|
|
53
|
-
"glob": "
|
|
53
|
+
"glob": "8.0.1",
|
|
54
54
|
"jimp": "0.16.1",
|
|
55
55
|
"jsftp": "2.1.3",
|
|
56
56
|
"klaw": "3.0.0",
|
|
57
57
|
"lockfile": "1.0.4",
|
|
58
58
|
"lodash": "4.17.21",
|
|
59
|
-
"moment": "2.29.
|
|
59
|
+
"moment": "2.29.3",
|
|
60
60
|
"mv": "2.1.1",
|
|
61
61
|
"ncp": "2.0.0",
|
|
62
62
|
"npmlog": "6.0.1",
|
|
63
63
|
"opencv-bindings": "4.5.5",
|
|
64
64
|
"pkg-dir": "5.0.0",
|
|
65
|
-
"plist": "3.0.
|
|
65
|
+
"plist": "3.0.5",
|
|
66
66
|
"pluralize": "8.0.0",
|
|
67
67
|
"pngjs": "6.0.0",
|
|
68
68
|
"read-pkg": "5.2.0",
|
|
69
69
|
"resolve-from": "5.0.0",
|
|
70
70
|
"rimraf": "3.0.2",
|
|
71
71
|
"sanitize-filename": "1.6.3",
|
|
72
|
-
"semver": "7.3.
|
|
72
|
+
"semver": "7.3.7",
|
|
73
73
|
"shell-quote": "1.7.3",
|
|
74
74
|
"source-map-support": "0.5.21",
|
|
75
75
|
"teen_process": "1.16.0",
|
|
@@ -84,5 +84,12 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"
|
|
87
|
+
"types": "./build/lib/index.d.ts",
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"type-fest": "2.12.2"
|
|
90
|
+
},
|
|
91
|
+
"overrides": {
|
|
92
|
+
"type-fest": "$type-fest"
|
|
93
|
+
},
|
|
94
|
+
"gitHead": "8b7906f757f23b7abc09a0acf41a3daa6671c2ec"
|
|
88
95
|
}
|