@appium/support 4.1.10 → 4.2.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/README.md CHANGED
@@ -1,11 +1,15 @@
1
- # appium-support
1
+ # @appium/support
2
2
 
3
- Utility functions used to support Appium drivers and plugins.
3
+ > Utility functions used to support Appium drivers and plugins
4
4
 
5
- # Usage in drivers and plugins
5
+ [![NPM version](http://img.shields.io/npm/v/@appium/support.svg)](https://npmjs.org/package/@appium/support)
6
+ [![Downloads](http://img.shields.io/npm/dm/@appium/support.svg)](https://npmjs.org/package/@appium/support)
6
7
 
7
- It is recommended to have Appium as a peer dependency in driver and plugin packages.
8
- Add the following line to `peerDependencies` section of your module's `package.json`:
8
+ ## Usage in drivers and plugins
9
+
10
+ Drivers and plugins are recommended to have Appium as a peer dependency, as it already includes
11
+ these utility functions. Add the following line to `peerDependencies` section of your module's
12
+ `package.json`:
9
13
 
10
14
  ```js
11
15
  "peerDependencies": {
@@ -19,7 +23,7 @@ Afterwards import it in your code similarly to the below example:
19
23
  import {timing, util} from 'appium/support';
20
24
  ```
21
25
 
22
- # Usage in helper modules
26
+ ## Usage in helper modules
23
27
 
24
28
  If you want to use this module in a helper library, which is not a driver or a plugin,
25
29
  then add the following line to `dependencies` section of your module's `package.json`:
@@ -36,96 +40,49 @@ Afterwards import it in your code similarly to the below example:
36
40
  import {timing, util} from '@appium/support';
37
41
  ```
38
42
 
39
- ### Categories
43
+ ## Categories
40
44
 
41
45
  All utility functions are split into a bunch of different categories. Each category has its own file under the `lib` folder. All utility functions in these files are documented.
42
46
 
43
- #### fs
44
-
45
- Most of the functions there are just thin wrappers over utility functions available in [Promises API](https://nodejs.org/api/fs.html#promises-api).
46
-
47
- #### env
48
-
49
- Several helpers needed by the server to cope with internal dependencies and manifests.
50
-
51
- #### console
52
-
53
- Wrappers for the command line interface abstraction used by the Appium server.
54
-
55
- #### image-util
56
-
57
- Utilities to work with images. Use [sharp](https://github.com/lovell/sharp) under the hood.
58
-
59
- #### log-internal
60
-
61
- Utilities needed for internal Appium log config assistance.
62
-
63
- #### logging
64
-
65
- See [below](#logger)
66
-
67
- #### mjpeg
68
-
69
- Helpers needed to implement [MJPEG streaming](https://en.wikipedia.org/wiki/Motion_JPEG#Video_streaming).
70
-
71
- #### net
72
-
73
- Helpers needed for network interactions, for example, upload and download of files.
74
-
75
- #### node
76
-
77
- Set of Node.js-specific utility functions needed, for example, to ensure objects immutability or to calculate their sizes.
78
-
79
- #### npm
80
-
81
- Set of [npm](https://en.wikipedia.org/wiki/Npm_(software))-related helpers.
82
-
83
- #### plist
84
-
85
- Set of utilities used to read and write data from [plist](https://en.wikipedia.org/wiki/Property_List) files in javascript.
86
-
87
- #### process
88
-
89
- Helpers for interactions with system processes. These APIs don't support Windows.
90
-
91
- #### system
92
-
93
- Set of helper functions needed to determine properties of the current operating system.
94
-
95
- #### tempdir
96
-
97
- Set of helpers that allow interactions with temporary folders.
98
-
99
- #### timing
100
-
101
- Helpers that allow to measure execution time.
102
-
103
- #### util
104
-
105
- Miscellaneous utilities.
106
-
107
- #### zip
108
-
109
- Helpers that allow to work with archives in .ZIP format.
110
-
111
-
112
- ## logger
113
-
114
- Basic logger defaulting to [npmlog](https://github.com/npm/npmlog) with special consideration for running
115
- tests (doesn't output logs when run with `_TESTING=1` in the env).
47
+ |Category|Description|
48
+ |-|-|
49
+ |console|Wrappers for the command line interface abstraction used by the Appium server|
50
+ |doctor|Common doctor utilities that can be used by drivers and plugins|
51
+ |env|Several helpers needed by the server to cope with internal dependencies and manifests|
52
+ |fs|Most of the functions here are just thin wrappers over utility functions available in [Promises API](https://nodejs.org/api/fs.html#promises-api)|
53
+ |image-util|Utilities to work with images. Use [sharp](https://github.com/lovell/sharp) under the hood.<br>:bangbang: Node >=18.17 is required to use these utilities|
54
+ |log-internal|Utilities needed for internal Appium log config assistance|
55
+ |logging|See [the logging section below](#logging)|
56
+ |mjpeg|Helpers needed to implement [MJPEG streaming](https://en.wikipedia.org/wiki/Motion_JPEG#Video_streaming)|
57
+ |net|Helpers needed for network interactions, for example, upload and download of files|
58
+ |node|Set of Node.js-specific utility functions needed, for example, to ensure objects immutability or to calculate their sizes|
59
+ |npm|Set of `npm`-related helpers|
60
+ |plist|Set of utilities used to read and write data from [plist](https://en.wikipedia.org/wiki/Property_List) files in javascript|
61
+ |process|Helpers for interactions with system processes. These APIs don't support Windows.|
62
+ |system|Set of helper functions needed to determine properties of the current operating system|
63
+ |tempdir|Set of helpers that allow interactions with temporary folders|
64
+ |timing|Helpers that allow to measure execution time|
65
+ |util|Miscellaneous utilities|
66
+ |zip|Helpers that allow to work with archives in `.zip ` format|
67
+
68
+ ## logging
69
+
70
+ This is a basic logger defaulting to [npmlog](https://github.com/npm/npmlog) with special
71
+ consideration for running tests (doesn't output logs when run with `_TESTING=1`).
116
72
 
117
73
  ### Logging levels
118
74
 
119
- There are a number of levels, exposed as methods on the log object, at which logging can be made. The built-in ones correspond to those of [npmlog](https://github.com/npm/npmlog#loglevelprefix-message-), and are:
120
- `silly`, `verbose`, `info`, `http`, `warn`, and `error`. In addition there is a `debug` level.
75
+ There are a number of levels, exposed as methods on the log object, at which logging can be made.
76
+ The built-in ones correspond to those of [npmlog](https://github.com/npm/npmlog#loglevelprefix-message-),
77
+ and are: `silly`, `verbose`, `info`, `http`, `warn`, and `error`. There is also a `debug` level.
121
78
 
122
79
  The default threshold level is `verbose`.
123
80
 
124
81
  The logged output, by default, will be `level prefix message`. So
125
82
 
126
83
  ```js
127
- import { logger } from 'appium-support';
128
- let log = logger.getLogger('mymodule');
84
+ import {logging} from 'appium/support';
85
+ let log = logging.getLogger('mymodule');
129
86
  log.warn('a warning');`
130
87
  ```
131
88
 
@@ -139,27 +96,25 @@ warn mymodule a warning
139
96
 
140
97
  There are two environment variable flags that affect the way `logger` works.
141
98
 
142
- `_TESTING`
143
-
144
- - `_TESTING=1` stops output of logs when set to `1`.
145
-
146
- `_FORCE_LOGS`
147
-
148
- - This flag, when set to `1`, reverses the `_TESTING`
149
-
99
+ |Variable|Description|
100
+ |-|-|
101
+ |`_TESTING`|If set to `1`, logging output is stopped|
102
+ |`_FORCE_LOGS`|If set to `1`, overrides the value of `_TESTING`|
150
103
 
151
104
  ### Usage
152
105
 
153
106
  `log.level`
154
107
 
155
- - get and set the threshold level at which to display the logs. Any logs at or above this level will be displayed. The special level silent will prevent anything from being displayed ever. See [npmlog#level](https://github.com/npm/npmlog#loglevel).
108
+ - Get and set the threshold level at which to display the logs. Any logs at or above this level will
109
+ be displayed. The special level `silent` will prevent anything from being displayed ever. See
110
+ [npmlog#level](https://github.com/npm/npmlog#loglevel) for more details.
156
111
 
157
112
  `log[level](message)`
158
113
 
159
- - logs to `level`
114
+ - Logs `message` at the specified `level`
160
115
  ```js
161
- import { logger } from 'appium-support';
162
- let log = logger.getLogger('mymodule');
116
+ import {logging} from 'appium/support';
117
+ let log = logging.getLogger('mymodule');
163
118
 
164
119
  log.info('hi!');
165
120
  // => info mymodule hi!
@@ -167,11 +122,13 @@ log.info('hi!');
167
122
 
168
123
  `log.unwrap()`
169
124
 
170
- - retrieves the underlying [npmlog](https://github.com/npm/npmlog) object, in order to manage how logging is done at a low level (e.g., changing output streams, retrieving an array of messages, adding log levels, etc.).
125
+ - Retrieves the underlying [npmlog](https://github.com/npm/npmlog) object, in order to manage how
126
+ logging is done at a low level (e.g., changing output streams, retrieving an array of messages,
127
+ adding log levels, etc.).
171
128
 
172
129
  ```js
173
- import { getLogger } from 'appium-base-driver';
174
- let log = getLogger('mymodule');
130
+ import {logging} from 'appium/support';
131
+ let log = logging.getLogger('mymodule');
175
132
 
176
133
  log.info('hi!');
177
134
 
@@ -182,18 +139,24 @@ let logs = npmlogger.record;
182
139
  // logs === [ { id: 0, level: 'info', prefix: 'mymodule', message: 'hi!', messageRaw: [ 'hi!' ] }]
183
140
  ```
184
141
 
185
- `log.errorAndThrow(error)`
142
+ `log.errorWithException(error)`
186
143
 
187
- - logs the error passed in, at `error` level, and then throws the error. If the error passed in is not an instance of [Error](https://nodejs.org/api/errors.html#errors_class_error) (either directly, or a subclass of `Error`) it will be wrapped in a generic `Error` object.
144
+ - Logs the error passed in, at `error` level, and then returns the error. If the error passed in is
145
+ not an instance of [Error](https://nodejs.org/api/errors.html#errors_class_error) (either directly,
146
+ or a subclass of `Error`), it will be wrapped in a generic `Error` object.
188
147
 
189
148
  ```js
190
- import { getLogger } from 'appium-base-driver';
191
- let log = getLogger('mymodule');
149
+ import {logging} from 'appium/support';
150
+ let log = logging.getLogger('mymodule');
192
151
 
193
152
  // previously there would be two lines
194
153
  log.error('This is an error');
195
154
  throw new Error('This is an error');
196
155
 
197
156
  // now is compacted
198
- log.errorAndThrow('This is an error');
157
+ throw log.errorWithException('This is an error');
199
158
  ```
159
+
160
+ ## License
161
+
162
+ Apache-2.0
@@ -153,6 +153,7 @@ class CliConsole {
153
153
  this.log(this.decorate(message, 'error'), ...args);
154
154
  }
155
155
  }
156
+ exports.CliConsole = CliConsole;
156
157
  _CliConsole_console = new WeakMap(), _CliConsole_useSymbols = new WeakMap(), _CliConsole_useColor = new WeakMap();
157
158
  /**
158
159
  * @type {Record<keyof typeof symbols,keyof Extract<import('@colors/colors').Color, 'string'>>}
@@ -163,7 +164,6 @@ CliConsole.symbolToColor = {
163
164
  warning: 'yellow',
164
165
  error: 'red',
165
166
  };
166
- exports.CliConsole = CliConsole;
167
167
  /**
168
168
  * Options for {@linkcode CliConsole}.
169
169
  *
@@ -1 +1 @@
1
- {"version":3,"file":"console.js","sourceRoot":"","sources":["../../lib/console.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,mDAA6C;AAC7C,qCAA+C;AAC/C,0BAAwB;AACxB,8DAAkC;AAwK1B,kBAxKD,qBAAO,CAwKC;AAvKf,mCAAgC;AAEhC;;GAEG;AACH,MAAM,YAAa,SAAQ,iBAAQ;IACjC,6DAA6D;IAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,QAA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G;IACH,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI;QACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI;QACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACrD,CAAC;;AApIH,gCAqIC;;AAlHC;;GAEG;AACI,wBAAa,GAAG;IACrB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,KAAK;CACb,AALmB,CAKlB;AA4GJ;;;;;;;;GAQG;AAEU,QAAA,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A shortcut for a successful required doctor check
3
+ *
4
+ * @param {string} message
5
+ * @returns {DoctorCheckResult}
6
+ */
7
+ export function ok(message: string): DoctorCheckResult;
8
+ /**
9
+ * A shortcut for an unsuccessful required doctor check
10
+ *
11
+ * @param {string} message
12
+ * @returns {DoctorCheckResult}
13
+ */
14
+ export function nok(message: string): DoctorCheckResult;
15
+ /**
16
+ * A shortcut for a successful optional doctor check
17
+ *
18
+ * @param {string} message
19
+ * @returns {DoctorCheckResult}
20
+ */
21
+ export function okOptional(message: string): DoctorCheckResult;
22
+ /**
23
+ * A shortcut for an unsuccessful optional doctor check
24
+ *
25
+ * @param {string} message
26
+ * @returns {DoctorCheckResult}
27
+ */
28
+ export function nokOptional(message: string): DoctorCheckResult;
29
+ /**
30
+ * Throw this exception in the fix() method
31
+ * of your doctor check to skip the actual fix if hasAutofix() is true
32
+ */
33
+ export class FixSkippedError extends Error {
34
+ }
35
+ export type DoctorCheckResult = import('@appium/types').DoctorCheckResult;
36
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../lib/doctor.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,4BAHW,MAAM,GACJ,iBAAiB,CAI7B;AAED;;;;;GAKG;AACH,6BAHW,MAAM,GACJ,iBAAiB,CAI7B;AAED;;;;;GAKG;AACH,oCAHW,MAAM,GACJ,iBAAiB,CAI7B;AAED;;;;;GAKG;AACH,qCAHW,MAAM,GACJ,iBAAiB,CAI7B;AAED;;;GAGG;AACH;CAA6C;gCAGhC,OAAO,eAAe,EAAE,iBAAiB"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FixSkippedError = exports.nokOptional = exports.okOptional = exports.nok = exports.ok = void 0;
4
+ /**
5
+ * A shortcut for a successful required doctor check
6
+ *
7
+ * @param {string} message
8
+ * @returns {DoctorCheckResult}
9
+ */
10
+ function ok(message) {
11
+ return { ok: true, optional: false, message };
12
+ }
13
+ exports.ok = ok;
14
+ /**
15
+ * A shortcut for an unsuccessful required doctor check
16
+ *
17
+ * @param {string} message
18
+ * @returns {DoctorCheckResult}
19
+ */
20
+ function nok(message) {
21
+ return { ok: false, optional: false, message };
22
+ }
23
+ exports.nok = nok;
24
+ /**
25
+ * A shortcut for a successful optional doctor check
26
+ *
27
+ * @param {string} message
28
+ * @returns {DoctorCheckResult}
29
+ */
30
+ function okOptional(message) {
31
+ return { ok: true, optional: true, message };
32
+ }
33
+ exports.okOptional = okOptional;
34
+ /**
35
+ * A shortcut for an unsuccessful optional doctor check
36
+ *
37
+ * @param {string} message
38
+ * @returns {DoctorCheckResult}
39
+ */
40
+ function nokOptional(message) {
41
+ return { ok: false, optional: true, message };
42
+ }
43
+ exports.nokOptional = nokOptional;
44
+ /**
45
+ * Throw this exception in the fix() method
46
+ * of your doctor check to skip the actual fix if hasAutofix() is true
47
+ */
48
+ class FixSkippedError extends Error {
49
+ }
50
+ exports.FixSkippedError = FixSkippedError;
51
+ /**
52
+ * @typedef {import('@appium/types').DoctorCheckResult} DoctorCheckResult
53
+ */
54
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../lib/doctor.js"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,EAAE,CAAC,OAAO;IACxB,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;AAC9C,CAAC;AAFD,gBAEC;AAED;;;;;GAKG;AACH,SAAgB,GAAG,CAAC,OAAO;IACzB,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;AAC/C,CAAC;AAFD,kBAEC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAAO;IAChC,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;AAC7C,CAAC;AAFD,gCAEC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,OAAO;IACjC,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;AAC9C,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK;CAAG;AAA7C,0CAA6C;AAE7C;;GAEG"}
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../lib/env.js"],"names":[],"mappings":"AAgCA;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,QAAQ,OAAO,CAAC,CAI5B;AAjCD;;;GAGG;AACH,kCAFU,MAAM,CAEsD;AAEtE;;;GAGG;AACH,gCAFU,MAAM,CAEmC;AAEnD;;;GAGG;AACH,qCAFU,MAAM,CAOd;AAcF;;;;GAIG;AACH,yEAGe,QAAQ,MAAM,GAAC,SAAS,CAAC,uBAsCtC;AAEF;;GAEG;AACH,sCAGa,MAAM,KACJ,QAAQ,OAAO,UAAU,EAAE,qBAAqB,GAAC,SAAS,CAAC,uBAKxE;AAEF;;;;;;;GAOG;AACH,+DAGe,QAAQ,MAAM,CAAC,uBAiB5B;AAEF;;;;;GAKG;AACH,wEAGe,QAAQ,MAAM,CAAC,uBAO5B;oCAGW,OAAO,UAAU,EAAE,qBAAqB;cAxJvC,QAAQ"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../lib/env.js"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,QAAQ,OAAO,CAAC,CAI5B;AA/BD;;;GAGG;AACH,kCAFU,MAAM,CAEsD;AAEtE;;;GAGG;AACH,gCAFU,MAAM,CAEmC;AAEnD;;;GAGG;AACH,qCAFU,MAAM,CAOd;AAYF;;;;GAIG;AACH,yEAGe,QAAQ,MAAM,GAAC,SAAS,CAAC,uBAkCtC;AAEF;;GAEG;AACH,sCAGa,MAAM,KACJ,QAAQ,OAAO,UAAU,EAAE,qBAAqB,GAAC,SAAS,CAAC,uBAKxE;AAEF;;;;;;;GAOG;AACH,+DAGe,QAAQ,MAAM,CAAC,uBAa5B;AAEF;;;;;GAKG;AACH,wEAGe,QAAQ,MAAM,CAAC,uBAO5B;oCAGW,OAAO,UAAU,EAAE,qBAAqB;cA9IvC,QAAQ"}
package/build/lib/env.js CHANGED
@@ -9,7 +9,7 @@ const lodash_1 = __importDefault(require("lodash"));
9
9
  const os_1 = require("os");
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const read_pkg_1 = __importDefault(require("read-pkg"));
12
- const npm_1 = require("./npm");
12
+ const semver_1 = __importDefault(require("semver"));
13
13
  /**
14
14
  * Path to the default `APPIUM_HOME` dir (`~/.appium`).
15
15
  * @type {string}
@@ -25,7 +25,6 @@ exports.MANIFEST_BASENAME = 'extensions.yaml';
25
25
  * @type {string}
26
26
  */
27
27
  exports.MANIFEST_RELATIVE_PATH = path_1.default.join('node_modules', '.cache', 'appium', exports.MANIFEST_BASENAME);
28
- const OLD_VERSION_REGEX = /^[01]/;
29
28
  /**
30
29
  * Resolves `true` if an `appium` dependency can be found somewhere in the given `cwd`.
31
30
  *
@@ -48,38 +47,33 @@ exports.findAppiumDependencyPackage = lodash_1.default.memoize(
48
47
  */
49
48
  async (cwd = process.cwd()) => {
50
49
  /**
51
- * Tries to read `package.json` in `cwd` and resolves the identity if it depends on `appium`;
50
+ * Tries to read `package.json` in `root` and resolves the identity if it depends on `appium`;
52
51
  * otherwise resolves `undefined`.
53
- * @param {string} cwd
52
+ * @param {string} root
54
53
  * @returns {Promise<string|undefined>}
55
54
  */
56
- const readPkg = async (cwd) => {
57
- /** @type {string|undefined} */
58
- let pkgPath;
55
+ const readPkg = async (root) => {
59
56
  try {
60
- const pkg = await (0, exports.readPackageInDir)(cwd);
61
- const version = pkg?.dependencies?.appium ??
57
+ const pkg = await (0, exports.readPackageInDir)(root);
58
+ const version = semver_1.default.coerce(String(pkg?.dependencies?.appium ??
62
59
  pkg?.devDependencies?.appium ??
63
- pkg?.peerDependencies?.appium;
64
- pkgPath = version && !OLD_VERSION_REGEX.test(String(version)) ? cwd : undefined;
60
+ pkg?.peerDependencies?.appium));
61
+ return version && semver_1.default.satisfies(version, '>=2.0.0-beta', { includePrerelease: true })
62
+ ? root
63
+ : undefined;
65
64
  }
66
65
  catch { }
67
- return pkgPath;
68
66
  };
69
- cwd = path_1.default.resolve(cwd);
70
- /** @type {string} */
71
- let pkgDir;
72
- try {
73
- const { json: list } = await npm_1.npm.exec('list', ['--long', '--json'], { cwd });
74
- ({ path: pkgDir } = list);
75
- if (pkgDir !== cwd) {
76
- pkgDir = pkgDir ?? cwd;
67
+ let currentDir = path_1.default.resolve(cwd);
68
+ let isAtFsRoot = false;
69
+ while (!isAtFsRoot) {
70
+ const result = await readPkg(currentDir);
71
+ if (result) {
72
+ return result;
77
73
  }
74
+ currentDir = path_1.default.dirname(currentDir);
75
+ isAtFsRoot = currentDir.length <= path_1.default.dirname(currentDir).length;
78
76
  }
79
- catch {
80
- pkgDir = cwd;
81
- }
82
- return await readPkg(pkgDir);
83
77
  });
84
78
  /**
85
79
  * Read a `package.json` in dir `cwd`. If none found, return `undefined`.
@@ -113,11 +107,7 @@ async function _resolveAppiumHome(cwd = process.cwd()) {
113
107
  if (process.env.APPIUM_HOME) {
114
108
  return path_1.default.resolve(cwd, process.env.APPIUM_HOME);
115
109
  }
116
- const pkgPath = await (0, exports.findAppiumDependencyPackage)(cwd);
117
- if (pkgPath) {
118
- return pkgPath;
119
- }
120
- return exports.DEFAULT_APPIUM_HOME;
110
+ return await (0, exports.findAppiumDependencyPackage)(cwd) ?? exports.DEFAULT_APPIUM_HOME;
121
111
  });
122
112
  /**
123
113
  * Figure out manifest path based on `appiumHome`.
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../lib/env.js"],"names":[],"mappings":";;;;;;AAAA,YAAY;AACZ,oDAAuB;AACvB,2BAA2B;AAC3B,gDAAwB;AACxB,wDAA+B;AAC/B,+BAA0B;AAE1B;;;GAGG;AACU,QAAA,mBAAmB,GAAG,cAAI,CAAC,OAAO,CAAC,IAAA,YAAO,GAAE,EAAE,SAAS,CAAC,CAAC;AAEtE;;;GAGG;AACU,QAAA,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD;;;GAGG;AACU,QAAA,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAC7C,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,yBAAiB,CAClB,CAAC;AAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;GAKG;AACI,KAAK,UAAU,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,gBAAC,CAAC,OAAO;AAC1C;;;GAGG;AACH,KAAK,UAAU,oBAAoB,CAAC,UAAU;IAC5C,+DAA+D;IAC/D,UAAU,GAAG,UAAU,IAAI,CAAC,MAAM,IAAA,yBAAiB,GAAE,CAAC,CAAC;IACvD,OAAO,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,8BAAsB,CAAC,CAAC;AACvD,CAAC,CACF,CAAC;AAEF;;GAEG"}
package/build/lib/fs.d.ts CHANGED
@@ -127,34 +127,34 @@ export namespace fs {
127
127
  * @returns {string} The closeset parent dir containing `package.json`
128
128
  */
129
129
  export function findRoot(dir: string): string;
130
- export const access: typeof fsPromises.access;
131
- export const appendFile: typeof fsPromises.appendFile;
132
- export const chmod: typeof fsPromises.chmod;
133
- export const close: (arg1: number) => B<any>;
130
+ export let access: typeof fsPromises.access;
131
+ export let appendFile: typeof fsPromises.appendFile;
132
+ export let chmod: typeof fsPromises.chmod;
133
+ export let close: (arg1: number) => B<any>;
134
134
  export { constants };
135
135
  export { createWriteStream };
136
136
  export { createReadStream };
137
- export const lstat: typeof fsPromises.lstat;
138
- export const open: (path: import("fs").PathLike, flags: import("fs").OpenMode, mode?: import("fs").Mode | undefined) => Promise<number>;
139
- export const openFile: typeof fsPromises.open;
140
- export const readdir: typeof fsPromises.readdir;
137
+ export let lstat: typeof fsPromises.lstat;
138
+ export let open: (path: import("fs").PathLike, flags: import("fs").OpenMode, mode?: import("fs").Mode | undefined) => Promise<number>;
139
+ export let openFile: typeof fsPromises.open;
140
+ export let readdir: typeof fsPromises.readdir;
141
141
  export function read(fd: number, buffer: NodeJS.ArrayBufferView | import("fs").ReadAsyncOptions<NodeJS.ArrayBufferView>, offset: number | undefined, length: number | undefined, position: number | null | undefined): B<{
142
142
  bytesRead: number;
143
143
  buffer: NodeJS.ArrayBufferView;
144
144
  }>;
145
- export const readFile: typeof fsPromises.readFile;
146
- export const readlink: typeof fsPromises.readlink;
147
- export const realpath: typeof fsPromises.realpath;
148
- export const rename: typeof fsPromises.rename;
149
- export const stat: typeof fsPromises.stat;
150
- export const symlink: typeof fsPromises.symlink;
151
- export const unlink: typeof fsPromises.unlink;
152
- export const write: (arg1: number, arg2: string) => B<number>;
153
- export const writeFile: typeof fsPromises.writeFile;
154
- export const F_OK: number;
155
- export const R_OK: number;
156
- export const W_OK: number;
157
- export const X_OK: number;
145
+ export let readFile: typeof fsPromises.readFile;
146
+ export let readlink: typeof fsPromises.readlink;
147
+ export let realpath: typeof fsPromises.realpath;
148
+ export let rename: typeof fsPromises.rename;
149
+ export let stat: typeof fsPromises.stat;
150
+ export let symlink: typeof fsPromises.symlink;
151
+ export let unlink: typeof fsPromises.unlink;
152
+ export let write: (arg1: number, arg2: string) => B<number>;
153
+ export let writeFile: typeof fsPromises.writeFile;
154
+ export let F_OK: number;
155
+ export let R_OK: number;
156
+ export let W_OK: number;
157
+ export let X_OK: number;
158
158
  }
159
159
  import mv from 'mv';
160
160
  import B from 'bluebird';
@@ -20,9 +20,10 @@ import * as node from './node';
20
20
  import * as timing from './timing';
21
21
  import * as env from './env';
22
22
  import * as console from './console';
23
+ import * as doctor from './doctor';
23
24
  export { npm } from './npm';
24
25
  declare const cancellableDelay: typeof util.cancellableDelay;
25
- export { tempDir, system, util, fs, cancellableDelay, plist, mkdirp, logger, process, zip, imageUtil, net, mjpeg, node, timing, env, console, };
26
+ export { tempDir, system, util, fs, cancellableDelay, plist, mkdirp, logger, process, zip, imageUtil, net, mjpeg, node, timing, env, console, doctor, };
26
27
  declare const _default: {
27
28
  tempDir: typeof tempDir;
28
29
  system: typeof system;
@@ -85,6 +86,7 @@ declare const _default: {
85
86
  timing: typeof timing;
86
87
  env: typeof env;
87
88
  console: typeof console;
89
+ doctor: typeof doctor;
88
90
  };
89
91
  export default _default;
90
92
  export type { ConsoleOpts } from './console';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,OAAO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;AAEnC,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAO,gBAAgB,8BAAQ,CAAC;AAEhC,OAAO,EACL,OAAO,EACP,MAAM,EACN,IAAI,EACJ,EAAE,EACF,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,GAAG,EACH,SAAS,EACT,GAAG,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,GACP,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACF,wBAmBE;AAEF,YAAY,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,MAAM,CAAC;AAClD,YAAY,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,OAAO,CAAC;AACf,YAAY,EAAC,kBAAkB,EAAE,QAAQ,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAC3E,YAAY,EAAC,OAAO,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACtD,YAAY,EAAC,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAC,MAAM,QAAQ,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,OAAO,CAAC;AACf,YAAY,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC"}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.console = exports.env = exports.timing = exports.node = exports.mjpeg = exports.net = exports.imageUtil = exports.zip = exports.process = exports.logger = exports.mkdirp = exports.plist = exports.cancellableDelay = exports.fs = exports.util = exports.system = exports.tempDir = exports.npm = void 0;
26
+ exports.doctor = exports.console = exports.env = exports.timing = exports.node = exports.mjpeg = exports.net = exports.imageUtil = exports.zip = exports.process = exports.logger = exports.mkdirp = exports.plist = exports.cancellableDelay = exports.fs = exports.util = exports.system = exports.tempDir = exports.npm = void 0;
27
27
  const tempDir = __importStar(require("./tempdir"));
28
28
  exports.tempDir = tempDir;
29
29
  const system = __importStar(require("./system"));
@@ -56,6 +56,8 @@ const env = __importStar(require("./env"));
56
56
  exports.env = env;
57
57
  const console = __importStar(require("./console"));
58
58
  exports.console = console;
59
+ const doctor = __importStar(require("./doctor"));
60
+ exports.doctor = doctor;
59
61
  var npm_1 = require("./npm");
60
62
  Object.defineProperty(exports, "npm", { enumerable: true, get: function () { return npm_1.npm; } });
61
63
  const { cancellableDelay } = util;
@@ -78,5 +80,6 @@ exports.default = {
78
80
  timing,
79
81
  env,
80
82
  console,
83
+ doctor,
81
84
  };
82
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AAsBnC,0BAAO;AArBT,iDAAmC;AAsBjC,wBAAM;AArBR,6CAA+B;AAsB7B,oBAAI;AArBN,6BAAwB;AAsBtB,mFAtBM,OAAE,OAsBN;AArBJ,2CAA6B;AA6B3B,kBAAG;AA5BL,+CAAiC;AAsB/B,sBAAK;AArBP,qCAAgC;AAsB9B,uFAtBM,eAAM,OAsBN;AArBR,kDAAoC;AAsBlC,wBAAM;AArBR,mDAAqC;AAsBnC,0BAAO;AArBT,2CAA6B;AAsB3B,kBAAG;AArBL,wDAA0C;AAsBxC,8BAAS;AArBX,+CAAiC;AAuB/B,sBAAK;AAtBP,6CAA+B;AAuB7B,oBAAI;AAtBN,iDAAmC;AAuBjC,wBAAM;AAtBR,2CAA6B;AAuB3B,kBAAG;AAtBL,mDAAqC;AAuBnC,0BAAO;AArBT,6B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ACN,OAAO;IACP,GAAG;IACH,SAAS;IACT,GAAG;IACH,KAAK;IACL,IAAI;IACJ,MAAM;IACN,GAAG;IACH,OAAO;IACP,MAAM;CACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../lib/logging.js"],"names":[],"mappings":"AAQA,0DAA0D;AAC1D,qBADW,OAAO,eAAe,EAAE,iBAAiB,EAAE,CAC+B;;;;;;;YAsHvE,MAAM,EAAE;;;;;WAER,OAAO,gBAAgB,EAAE,4BAA4B,EAAE;;iCA+BxD,OAAO,eAAe,EAAE,kBAAkB;2BAC1C,OAAO,eAAe,EAAE,YAAY;gCACpC,OAAO,eAAe,EAAE,iBAAiB;AARtD,uDAAwB;AAtIxB;;;GAGG;AACH,oCAFW,OAAO,QAAQ,EAAE,MAAM,QAMjC;AAsCD;;;;GAIG;AACH,mCAHW,kBAAkB,UAChB,YAAY,CAsDxB;AAED;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AACH,kEANW,MAAM,GAAC,MAAM,EAAE,GAAC,OAAO,eAAe,EAAE,gBAAgB,GAItD,QAAQ,UAAU,CAAC,CAQ/B"}
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../lib/logging.js"],"names":[],"mappings":"AAQA,0DAA0D;AAC1D,qBADW,OAAO,eAAe,EAAE,iBAAiB,EAAE,CAC+B;;;;;;;YA2HvE,MAAM,EAAE;;;;;WAER,OAAO,gBAAgB,EAAE,4BAA4B,EAAE;;iCA+BxD,OAAO,eAAe,EAAE,kBAAkB;2BAC1C,OAAO,eAAe,EAAE,YAAY;gCACpC,OAAO,eAAe,EAAE,iBAAiB;AARtD,uDAAwB;AA3IxB;;;GAGG;AACH,oCAFW,OAAO,QAAQ,EAAE,MAAM,QAMjC;AAsCD;;;;GAIG;AACH,mCAHW,kBAAkB,UAChB,YAAY,CA2DxB;AAED;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AACH,kEANW,MAAM,GAAC,MAAM,EAAE,GAAC,OAAO,eAAe,EAAE,gBAAgB,GAItD,QAAQ,UAAU,CAAC,CAQ/B"}
@@ -103,11 +103,16 @@ function getLogger(prefix = null) {
103
103
  }
104
104
  };
105
105
  }
106
- // add method to log an error, and throw it, for convenience
107
- wrappedLogger.errorAndThrow = function (err) {
108
- this.error(err);
106
+ wrappedLogger.errorWithException = function (/** @type {any[]} */ ...args) {
107
+ this.error(...args);
109
108
  // make sure we have an `Error` object. Wrap if necessary
110
- throw lodash_1.default.isError(err) ? err : new Error((0, util_1.unleakString)(err));
109
+ return lodash_1.default.isError(args[0]) ? args[0] : new Error(args.map(util_1.unleakString).join('\n'));
110
+ };
111
+ /**
112
+ * @deprecated Use {@link errorWithException} instead
113
+ */
114
+ wrappedLogger.errorAndThrow = function (/** @type {any[]} */ ...args) {
115
+ throw this.errorWithException(args);
111
116
  };
112
117
  if (!usingGlobalLog) {
113
118
  // if we're not using a global log specified from some top-level package,