@appium/support 2.61.1 → 3.0.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/build/lib/console.d.ts +1 -1
- package/build/lib/console.js +169 -105
- package/build/lib/console.js.map +1 -1
- package/build/lib/env.js +142 -117
- package/build/lib/env.js.map +1 -1
- package/build/lib/fs.d.ts +9 -2
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +358 -246
- package/build/lib/fs.js.map +1 -1
- package/build/lib/image-util.js +139 -124
- package/build/lib/image-util.js.map +1 -1
- package/build/lib/index.js +64 -103
- package/build/lib/index.js.map +1 -1
- package/build/lib/log-internal.d.ts +4 -27
- package/build/lib/log-internal.d.ts.map +1 -1
- package/build/lib/log-internal.js +141 -123
- package/build/lib/log-internal.js.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +5 -14
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logging.d.ts +3 -4
- package/build/lib/logging.d.ts.map +1 -1
- package/build/lib/logging.js +139 -110
- package/build/lib/logging.js.map +1 -1
- package/build/lib/mjpeg.js +169 -141
- package/build/lib/mjpeg.js.map +1 -1
- package/build/lib/mkdirp.js +7 -13
- package/build/lib/mkdirp.js.map +1 -1
- package/build/lib/net.d.ts.map +1 -1
- package/build/lib/net.js +278 -254
- package/build/lib/net.js.map +1 -1
- package/build/lib/node.js +203 -192
- package/build/lib/node.js.map +1 -1
- package/build/lib/npm.d.ts +19 -4
- package/build/lib/npm.d.ts.map +1 -1
- package/build/lib/npm.js +277 -228
- package/build/lib/npm.js.map +1 -1
- package/build/lib/plist.js +145 -136
- package/build/lib/plist.js.map +1 -1
- package/build/lib/process.js +41 -42
- package/build/lib/process.js.map +1 -1
- package/build/lib/system.js +39 -56
- package/build/lib/system.js.map +1 -1
- package/build/lib/tempdir.js +112 -73
- package/build/lib/tempdir.js.map +1 -1
- package/build/lib/timing.js +99 -84
- package/build/lib/timing.js.map +1 -1
- package/build/lib/util.js +454 -356
- package/build/lib/util.js.map +1 -1
- package/build/lib/zip.js +469 -423
- package/build/lib/zip.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/fs.js +15 -1
- package/lib/log-internal.js +12 -16
- package/lib/logging.js +2 -3
- package/lib/net.js +15 -6
- package/lib/npm.js +28 -18
- package/package.json +19 -18
package/build/lib/console.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export class CliConsole {
|
|
|
26
26
|
* @param {keyof typeof CliConsole['symbolToColor']} [symbol] - Symbol to use
|
|
27
27
|
* @returns {string|undefined}
|
|
28
28
|
*/
|
|
29
|
-
decorate(msg?: string | undefined, symbol?: "
|
|
29
|
+
decorate(msg?: string | undefined, symbol?: "info" | "success" | "warning" | "error" | undefined): string | undefined;
|
|
30
30
|
/**
|
|
31
31
|
* Writes to `STDOUT`. Must be stringifyable.
|
|
32
32
|
*
|
package/build/lib/console.js
CHANGED
|
@@ -1,113 +1,177 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _CliConsole_console, _CliConsole_useSymbols, _CliConsole_useColor;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.symbols = exports.console = exports.CliConsole = void 0;
|
|
19
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
20
|
+
const supports_color_1 = require("supports-color");
|
|
21
|
+
const console_1 = require("console");
|
|
22
22
|
require("@colors/colors");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
24
|
+
exports.symbols = log_symbols_1.default;
|
|
25
|
+
const stream_1 = require("stream");
|
|
26
|
+
/**
|
|
27
|
+
* Stream to nowhere. Used when we want to disable any output other than JSON output.
|
|
28
|
+
*/
|
|
29
|
+
class NullWritable extends stream_1.Writable {
|
|
30
|
+
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
|
31
|
+
_write(chunk, encoding, callback) {
|
|
32
|
+
setImmediate(callback);
|
|
33
|
+
}
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* A particular console/logging class for Appium's CLI.
|
|
37
|
+
*
|
|
38
|
+
* - By default, uses some fancy symbols
|
|
39
|
+
* - Writes to `STDERR`, generally.
|
|
40
|
+
* - In "JSON mode", `STDERR` is squelched. Use {@linkcode Console.json} to write the JSON.
|
|
41
|
+
*
|
|
42
|
+
* DO NOT extend this to do anything other than what it already does. Download a library or something.
|
|
43
|
+
*/
|
|
37
44
|
class CliConsole {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {ConsoleOpts} opts
|
|
48
|
+
*/
|
|
49
|
+
constructor({ jsonMode = false, useSymbols = true, useColor } = {}) {
|
|
50
|
+
/**
|
|
51
|
+
* Internal console
|
|
52
|
+
* @type {globalThis.Console}
|
|
53
|
+
*/
|
|
54
|
+
_CliConsole_console.set(this, void 0);
|
|
55
|
+
/**
|
|
56
|
+
* Whether or not to use fancy symbols when logging.
|
|
57
|
+
* @type {boolean}
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
_CliConsole_useSymbols.set(this, void 0);
|
|
61
|
+
/**
|
|
62
|
+
* Whether or not to use color.
|
|
63
|
+
*/
|
|
64
|
+
_CliConsole_useColor.set(this, void 0);
|
|
65
|
+
__classPrivateFieldSet(this, _CliConsole_console, new console_1.Console(process.stdout, jsonMode ? new NullWritable() : process.stderr), "f");
|
|
66
|
+
__classPrivateFieldSet(this, _CliConsole_useSymbols, Boolean(useSymbols), "f");
|
|
67
|
+
__classPrivateFieldSet(this, _CliConsole_useColor, Boolean(useColor ?? (0, supports_color_1.supportsColor)(process.stderr)), "f");
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Wraps a message string in breathtaking fanciness
|
|
71
|
+
*
|
|
72
|
+
* Returns `undefined` if `msg` is `undefined`.
|
|
73
|
+
* @param {string} [msg] - Message to decorate, if anything
|
|
74
|
+
* @param {keyof typeof CliConsole['symbolToColor']} [symbol] - Symbol to use
|
|
75
|
+
* @returns {string|undefined}
|
|
76
|
+
*/
|
|
77
|
+
decorate(msg, symbol) {
|
|
78
|
+
if (lodash_1.default.isString(msg)) {
|
|
79
|
+
let newMsg = /** @type {string} */ (msg);
|
|
80
|
+
if (lodash_1.default.isString(symbol) && __classPrivateFieldGet(this, _CliConsole_useSymbols, "f")) {
|
|
81
|
+
newMsg = `${log_symbols_1.default[symbol]} ${newMsg}`;
|
|
82
|
+
if (__classPrivateFieldGet(this, _CliConsole_useColor, "f")) {
|
|
83
|
+
newMsg = newMsg[CliConsole.symbolToColor[symbol]];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return newMsg;
|
|
67
87
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
return msg;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Writes to `STDOUT`. Must be stringifyable.
|
|
92
|
+
*
|
|
93
|
+
* You probably don't want to call this more than once before exiting (since that will output invalid JSON).
|
|
94
|
+
* @param {import('type-fest').JsonValue} value
|
|
95
|
+
*/
|
|
96
|
+
json(value) {
|
|
97
|
+
__classPrivateFieldGet(this, _CliConsole_console, "f").log(JSON.stringify(value));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* General logging function.
|
|
101
|
+
* @param {string} [message]
|
|
102
|
+
* @param {...any} args
|
|
103
|
+
*/
|
|
104
|
+
log(message, ...args) {
|
|
105
|
+
__classPrivateFieldGet(this, _CliConsole_console, "f").error(message, ...args);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A "success" message
|
|
109
|
+
* @param {string} [message]
|
|
110
|
+
* @param {...any} args
|
|
111
|
+
*/
|
|
112
|
+
ok(message, ...args) {
|
|
113
|
+
__classPrivateFieldGet(this, _CliConsole_console, "f").error(this.decorate(message, 'success'), ...args);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Alias for {@linkcode Console.log}
|
|
117
|
+
* @param {string} [message]
|
|
118
|
+
* @param {...any} args
|
|
119
|
+
*/
|
|
120
|
+
debug(message, ...args) {
|
|
121
|
+
this.log(message, ...args);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Wraps {@link console.dir}
|
|
125
|
+
* @param {any} item
|
|
126
|
+
* @param {import('util').InspectOptions} [opts]
|
|
127
|
+
*/
|
|
128
|
+
dump(item, opts) {
|
|
129
|
+
__classPrivateFieldGet(this, _CliConsole_console, "f").dir(item, opts);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* An "info" message
|
|
133
|
+
* @param {string} [message]
|
|
134
|
+
* @param {...any} args
|
|
135
|
+
*/
|
|
136
|
+
info(message, ...args) {
|
|
137
|
+
this.log(this.decorate(message, 'info'), ...args);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A "warning" message
|
|
141
|
+
* @param {string} [message]
|
|
142
|
+
* @param {...any} args
|
|
143
|
+
*/
|
|
144
|
+
warn(message, ...args) {
|
|
145
|
+
this.log(this.decorate(message, 'warning'), ...args);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* An "error" message
|
|
149
|
+
* @param {string} [message]
|
|
150
|
+
* @param {...any} args
|
|
151
|
+
*/
|
|
152
|
+
error(message, ...args) {
|
|
153
|
+
this.log(this.decorate(message, 'error'), ...args);
|
|
71
154
|
}
|
|
72
|
-
|
|
73
|
-
return msg;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
json(value) {
|
|
77
|
-
this.#console.log(JSON.stringify(value));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
log(message, ...args) {
|
|
81
|
-
this.#console.error(message, ...args);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
ok(message, ...args) {
|
|
85
|
-
this.#console.error(this.decorate(message, 'success'), ...args);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
debug(message, ...args) {
|
|
89
|
-
this.log(message, ...args);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
dump(item, opts) {
|
|
93
|
-
this.#console.dir(item, opts);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
info(message, ...args) {
|
|
97
|
-
this.log(this.decorate(message, 'info'), ...args);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
warn(message, ...args) {
|
|
101
|
-
this.log(this.decorate(message, 'warning'), ...args);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
error(message, ...args) {
|
|
105
|
-
this.log(this.decorate(message, 'error'), ...args);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
155
|
}
|
|
109
|
-
|
|
110
156
|
exports.CliConsole = CliConsole;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
157
|
+
_CliConsole_console = new WeakMap(), _CliConsole_useSymbols = new WeakMap(), _CliConsole_useColor = new WeakMap();
|
|
158
|
+
/**
|
|
159
|
+
* @type {Record<keyof typeof symbols,keyof Extract<import('@colors/colors').Color, 'string'>>}
|
|
160
|
+
*/
|
|
161
|
+
CliConsole.symbolToColor = {
|
|
162
|
+
success: 'green',
|
|
163
|
+
info: 'cyan',
|
|
164
|
+
warning: 'yellow',
|
|
165
|
+
error: 'red',
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Options for {@linkcode CliConsole}.
|
|
169
|
+
*
|
|
170
|
+
* @typedef ConsoleOpts
|
|
171
|
+
* @property {boolean} [jsonMode] - If _truthy_, supress all output except JSON (use {@linkcode CliConsole#json}), which writes to `STDOUT`.
|
|
172
|
+
* @property {boolean} [useSymbols] - If _falsy_, do not use fancy symbols.
|
|
173
|
+
* @property {boolean} [useColor] - If _falsy_, do not use color output. If _truthy_, forces color output. By default, checks terminal/TTY for support via pkg `supports-color`. Ignored if `useSymbols` is `false`.
|
|
174
|
+
* @see https://npm.im/supports-color
|
|
175
|
+
*/
|
|
176
|
+
exports.console = new CliConsole();
|
|
177
|
+
//# sourceMappingURL=console.js.map
|
package/build/lib/console.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","
|
|
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,QAAQ;QAC9B,YAAY,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAa,UAAU;IA6BrB;;;OAGG;IACH,YAAY,EAAC,QAAQ,GAAG,KAAK,EAAE,UAAU,GAAG,IAAI,EAAE,QAAQ,EAAC,GAAG,EAAE;QAhChE;;;WAGG;QACH,sCAAS;QAET;;;;WAIG;QACH,yCAAY;QAEZ;;WAEG;QACH,uCAAU;QAiBR,uBAAA,IAAI,uBAAY,IAAI,iBAAW,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAA,CAAC;QAChG,uBAAA,IAAI,0BAAe,OAAO,CAAC,UAAU,CAAC,MAAA,CAAC;QACvC,uBAAA,IAAI,wBAAa,OAAO,CAAC,QAAQ,IAAI,IAAA,8BAAa,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAA,CAAC;IACtE,C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