@appium/support 2.60.0 → 2.61.1

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.
Files changed (45) hide show
  1. package/build/lib/console.d.ts +1 -1
  2. package/build/lib/console.js +3 -3
  3. package/build/lib/console.js.map +1 -0
  4. package/build/lib/env.d.ts +8 -18
  5. package/build/lib/env.d.ts.map +1 -1
  6. package/build/lib/env.js +57 -36
  7. package/build/lib/env.js.map +1 -0
  8. package/build/lib/fs.d.ts +39 -10
  9. package/build/lib/fs.d.ts.map +1 -1
  10. package/build/lib/fs.js +20 -4
  11. package/build/lib/fs.js.map +1 -0
  12. package/build/lib/image-util.js +3 -3
  13. package/build/lib/image-util.js.map +1 -0
  14. package/build/lib/index.js.map +1 -0
  15. package/build/lib/log-internal.js +3 -3
  16. package/build/lib/log-internal.js.map +1 -0
  17. package/build/lib/logger.js.map +1 -0
  18. package/build/lib/logging.js +3 -3
  19. package/build/lib/logging.js.map +1 -0
  20. package/build/lib/mjpeg.js +3 -3
  21. package/build/lib/mjpeg.js.map +1 -0
  22. package/build/lib/mkdirp.js.map +1 -0
  23. package/build/lib/net.js +3 -3
  24. package/build/lib/net.js.map +1 -0
  25. package/build/lib/node.js +3 -3
  26. package/build/lib/node.js.map +1 -0
  27. package/build/lib/npm.js +3 -3
  28. package/build/lib/npm.js.map +1 -0
  29. package/build/lib/plist.js +3 -3
  30. package/build/lib/plist.js.map +1 -0
  31. package/build/lib/process.js.map +1 -0
  32. package/build/lib/system.js +3 -3
  33. package/build/lib/system.js.map +1 -0
  34. package/build/lib/tempdir.js +3 -3
  35. package/build/lib/tempdir.js.map +1 -0
  36. package/build/lib/timing.js +3 -3
  37. package/build/lib/timing.js.map +1 -0
  38. package/build/lib/util.js +3 -3
  39. package/build/lib/util.js.map +1 -0
  40. package/build/lib/zip.js +3 -3
  41. package/build/lib/zip.js.map +1 -0
  42. package/build/tsconfig.tsbuildinfo +1 -1
  43. package/lib/env.js +63 -74
  44. package/lib/fs.js +34 -7
  45. package/package.json +9 -10
package/lib/fs.js CHANGED
@@ -25,6 +25,7 @@ import sanitize from 'sanitize-filename';
25
25
  import which from 'which';
26
26
  import log from './logger';
27
27
  import Timer from './timing';
28
+ import {isWindows} from './system';
28
29
  import {pluralize} from './util';
29
30
 
30
31
  const ncpAsync =
@@ -36,13 +37,38 @@ const findRootCached = _.memoize(pkgDir.sync);
36
37
  const fs = {
37
38
  /**
38
39
  * Resolves `true` if `path` is _readable_, which differs from Node.js' default behavior of "can we see it?"
39
- * @param {import('fs').PathLike} path
40
+ *
41
+ * On Windows, ACLs are not supported, so this becomes a simple check for existence.
42
+ *
43
+ * This function will never reject.
44
+ * @param {PathLike} path
40
45
  * @returns {Promise<boolean>}
41
46
  */
42
47
  async hasAccess(path) {
43
48
  try {
44
49
  await fsPromises.access(path, constants.R_OK);
45
- } catch (err) {
50
+ } catch {
51
+ return false;
52
+ }
53
+ return true;
54
+ },
55
+
56
+ /**
57
+ * Resolves `true` if `path` is executable; `false` otherwise.
58
+ *
59
+ * On Windows, this function delegates to {@linkcode fs.hasAccess}.
60
+ *
61
+ * This function will never reject.
62
+ * @param {PathLike} path
63
+ * @returns {Promise<boolean>}
64
+ */
65
+ async isExecutable(path) {
66
+ try {
67
+ if (isWindows()) {
68
+ return await fs.hasAccess(path);
69
+ }
70
+ await fsPromises.access(path, constants.R_OK | constants.X_OK);
71
+ } catch {
46
72
  return false;
47
73
  }
48
74
  return true;
@@ -50,7 +76,7 @@ const fs = {
50
76
 
51
77
  /**
52
78
  * Alias for {@linkcode fs.hasAccess}
53
- * @param {import('fs').PathLike} path
79
+ * @param {PathLike} path
54
80
  */
55
81
  async exists(path) {
56
82
  return await fs.hasAccess(path);
@@ -104,7 +130,7 @@ const fs = {
104
130
 
105
131
  /**
106
132
  * Create an MD5 hash of a file.
107
- * @param {import('fs').PathLike} filePath
133
+ * @param {PathLike} filePath
108
134
  * @returns {Promise<string>}
109
135
  */
110
136
  async md5(filePath) {
@@ -136,7 +162,7 @@ const fs = {
136
162
 
137
163
  /**
138
164
  * Create a hex digest of some file at `filePath`
139
- * @param {import('fs').PathLike} filePath
165
+ * @param {PathLike} filePath
140
166
  * @param {string} [algorithm]
141
167
  * @returns {Promise<string>}
142
168
  */
@@ -170,7 +196,7 @@ const fs = {
170
196
 
171
197
  /**
172
198
  * Recursively create a directory.
173
- * @param {import('fs').PathLike} dir
199
+ * @param {PathLike} dir
174
200
  * @returns {Promise<string|undefined>}
175
201
  */
176
202
  async mkdirp(dir) {
@@ -305,7 +331,7 @@ const fs = {
305
331
  /**
306
332
  * Warning: this is a promisified {@linkcode open fs.open}.
307
333
  * It resolves w/a file descriptor instead of a {@linkcode fsPromises.FileHandle FileHandle} object, as {@linkcode fsPromises.open} does. Use {@linkcode fs.openFile} if you want a `FileHandle`.
308
- * @type {(path: import('fs').PathLike, flags: import('fs').OpenMode, mode?: import('fs').Mode) => Promise<number>}
334
+ * @type {(path: PathLike, flags: import('fs').OpenMode, mode?: import('fs').Mode) => Promise<number>}
309
335
  */
310
336
  open: B.promisify(open),
311
337
  openFile: fsPromises.open,
@@ -362,4 +388,5 @@ export default fs;
362
388
  /**
363
389
  * @typedef {import('glob')} glob
364
390
  * @typedef {import('mv')} mv
391
+ * @typedef {import('fs').PathLike} PathLike
365
392
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appium/support",
3
- "version": "2.60.0",
3
+ "version": "2.61.1",
4
4
  "description": "Support libs used across appium packages",
5
5
  "keywords": [
6
6
  "automation",
@@ -44,13 +44,12 @@
44
44
  "test:unit": "mocha \"./test/unit/**/*.spec.js\""
45
45
  },
46
46
  "dependencies": {
47
- "@appium/types": "^0.4.1",
48
- "@babel/runtime": "7.19.0",
47
+ "@appium/types": "^0.5.0",
49
48
  "@colors/colors": "1.5.0",
50
49
  "@types/archiver": "5.3.1",
51
50
  "@types/base64-stream": "1.0.2",
52
51
  "@types/find-root": "1.1.2",
53
- "@types/glob": "7.2.0",
52
+ "@types/glob": "8.0.0",
54
53
  "@types/jsftp": "2.1.2",
55
54
  "@types/klaw": "3.0.3",
56
55
  "@types/lockfile": "1.0.2",
@@ -74,7 +73,7 @@
74
73
  "form-data": "4.0.0",
75
74
  "get-stream": "6.0.1",
76
75
  "glob": "8.0.3",
77
- "jimp": "0.16.1",
76
+ "jimp": "0.16.2",
78
77
  "jsftp": "2.1.3",
79
78
  "klaw": "3.0.0",
80
79
  "lockfile": "1.0.4",
@@ -93,12 +92,12 @@
93
92
  "resolve-from": "5.0.0",
94
93
  "rimraf": "3.0.2",
95
94
  "sanitize-filename": "1.6.3",
96
- "semver": "7.3.7",
97
- "shell-quote": "1.7.3",
95
+ "semver": "7.3.8",
96
+ "shell-quote": "1.7.4",
98
97
  "source-map-support": "0.5.21",
99
98
  "supports-color": "8.1.1",
100
- "teen_process": "1.16.0",
101
- "type-fest": "2.19.0",
99
+ "teen_process": "2.0.2",
100
+ "type-fest": "3.1.0",
102
101
  "uuid": "8.3.2",
103
102
  "which": "2.0.2",
104
103
  "yauzl": "2.10.0"
@@ -110,5 +109,5 @@
110
109
  "publishConfig": {
111
110
  "access": "public"
112
111
  },
113
- "gitHead": "c26af8f85230ac65cbc19f08f763942f74b0eb0c"
112
+ "gitHead": "6b3cc1a8743f78c1f50320364f25f3011d2b2136"
114
113
  }