skydive-cli 0.5.0-beta.8 → 0.5.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/CHANGELOG.md +13 -0
- package/README.md +61 -13
- package/dist/js/api-BFQ4PQDA.mjs +315 -0
- package/dist/js/{billing-blocked-Dgu5-oDy.mjs → billing-blocked-SE6tySLd.mjs} +1 -1
- package/dist/js/bin.mjs +674 -307
- package/dist/js/{boot-BCClEpCM.mjs → boot-DD4T-61U.mjs} +4558 -930
- package/dist/js/chunk-BbwQpWto.mjs +33 -0
- package/dist/js/{client-DabRpc_T.mjs → client--k9cjfkX.mjs} +437 -39
- package/dist/js/{client-c4c5MmgN.mjs → client-Btq6bMzX.mjs} +108 -2
- package/dist/js/client-Ct0-JZSS.mjs +5 -0
- package/dist/js/daemon-CCgNLD0H.mjs +7 -0
- package/dist/js/{daemon-k2kVkJ8D.mjs → daemon-Do1jU2UF.mjs} +123 -43
- package/dist/js/daemon-client-C7nE-lLK.mjs +8 -0
- package/dist/js/{daemon-client-fxf1A25Z.mjs → daemon-client-Dvad009G.mjs} +1 -1
- package/dist/js/dist-CRtjM7ba.mjs +1750 -0
- package/dist/js/forward-C-f04uyE.mjs +208 -0
- package/dist/js/{profiler-DawY0V0Z.mjs → install-CtAVvERm.mjs} +545 -215
- package/dist/js/launcher.mjs +49 -0
- package/dist/js/localhost-cert-Bn-UBUmj.mjs +67 -0
- package/dist/js/{print-Wakr3GJd.mjs → print-Bx8qUC9U.mjs} +3 -3
- package/dist/js/{print-BpuyEfWX.mjs → print-D_UEjdSw.mjs} +257 -35
- package/dist/js/{print-share-CKLPmsg0.mjs → print-share-Cz0EO2RK.mjs} +9 -3
- package/dist/js/raw-pty-Ci2qFR9F.mjs +5 -0
- package/dist/js/{raw-pty-DY4KelZW.mjs → raw-pty-D5PhKZSl.mjs} +1 -1
- package/dist/js/{rest-I3imNduB.mjs → rest-B9__Zsuk.mjs} +144 -19
- package/dist/js/rest-Dc0EEok3.mjs +6 -0
- package/dist/js/tls-cert-BpCaD5AT.mjs +4 -0
- package/dist/js/tls-cert-Rua2oV7n.mjs +67 -0
- package/package.json +12 -4
- package/dist/js/api-DG5W6iwx.mjs +0 -131
- package/dist/js/client-BuU34IVE.mjs +0 -5
- package/dist/js/daemon-BxU59xie.mjs +0 -6
- package/dist/js/daemon-client-C2BvZgKO.mjs +0 -7
- package/dist/js/forward-18QoL5dO.mjs +0 -68
- package/dist/js/raw-pty-DmdUf4_w.mjs +0 -5
- package/dist/js/rest-D29qNkto.mjs +0 -6
- /package/dist/js/{billing-blocked-2wju4gC_.mjs → billing-blocked-D3l5kJlX.mjs} +0 -0
- /package/dist/js/{http-error-DzyrsLAZ.mjs → http-error-BF2NZZE3.mjs} +0 -0
- /package/dist/js/{output-DYzzdXYV.mjs → output-C9mb3sUB.mjs} +0 -0
|
@@ -0,0 +1,1750 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as __require, t as __commonJSMin } from "./chunk-BbwQpWto.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../../node_modules/ms/index.js
|
|
5
|
+
var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
/**
|
|
7
|
+
* Helpers.
|
|
8
|
+
*/
|
|
9
|
+
var s = 1e3;
|
|
10
|
+
var m = s * 60;
|
|
11
|
+
var h = m * 60;
|
|
12
|
+
var d = h * 24;
|
|
13
|
+
var w = d * 7;
|
|
14
|
+
var y = d * 365.25;
|
|
15
|
+
/**
|
|
16
|
+
* Parse or format the given `val`.
|
|
17
|
+
*
|
|
18
|
+
* Options:
|
|
19
|
+
*
|
|
20
|
+
* - `long` verbose formatting [false]
|
|
21
|
+
*
|
|
22
|
+
* @param {String|Number} val
|
|
23
|
+
* @param {Object} [options]
|
|
24
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
25
|
+
* @return {String|Number}
|
|
26
|
+
* @api public
|
|
27
|
+
*/
|
|
28
|
+
module.exports = function(val, options) {
|
|
29
|
+
options = options || {};
|
|
30
|
+
var type = typeof val;
|
|
31
|
+
if (type === "string" && val.length > 0) return parse(val);
|
|
32
|
+
else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
33
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Parse the given `str` and return milliseconds.
|
|
37
|
+
*
|
|
38
|
+
* @param {String} str
|
|
39
|
+
* @return {Number}
|
|
40
|
+
* @api private
|
|
41
|
+
*/
|
|
42
|
+
function parse(str) {
|
|
43
|
+
str = String(str);
|
|
44
|
+
if (str.length > 100) return;
|
|
45
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
46
|
+
if (!match) return;
|
|
47
|
+
var n = parseFloat(match[1]);
|
|
48
|
+
switch ((match[2] || "ms").toLowerCase()) {
|
|
49
|
+
case "years":
|
|
50
|
+
case "year":
|
|
51
|
+
case "yrs":
|
|
52
|
+
case "yr":
|
|
53
|
+
case "y": return n * y;
|
|
54
|
+
case "weeks":
|
|
55
|
+
case "week":
|
|
56
|
+
case "w": return n * w;
|
|
57
|
+
case "days":
|
|
58
|
+
case "day":
|
|
59
|
+
case "d": return n * d;
|
|
60
|
+
case "hours":
|
|
61
|
+
case "hour":
|
|
62
|
+
case "hrs":
|
|
63
|
+
case "hr":
|
|
64
|
+
case "h": return n * h;
|
|
65
|
+
case "minutes":
|
|
66
|
+
case "minute":
|
|
67
|
+
case "mins":
|
|
68
|
+
case "min":
|
|
69
|
+
case "m": return n * m;
|
|
70
|
+
case "seconds":
|
|
71
|
+
case "second":
|
|
72
|
+
case "secs":
|
|
73
|
+
case "sec":
|
|
74
|
+
case "s": return n * s;
|
|
75
|
+
case "milliseconds":
|
|
76
|
+
case "millisecond":
|
|
77
|
+
case "msecs":
|
|
78
|
+
case "msec":
|
|
79
|
+
case "ms": return n;
|
|
80
|
+
default: return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Short format for `ms`.
|
|
85
|
+
*
|
|
86
|
+
* @param {Number} ms
|
|
87
|
+
* @return {String}
|
|
88
|
+
* @api private
|
|
89
|
+
*/
|
|
90
|
+
function fmtShort(ms) {
|
|
91
|
+
var msAbs = Math.abs(ms);
|
|
92
|
+
if (msAbs >= d) return Math.round(ms / d) + "d";
|
|
93
|
+
if (msAbs >= h) return Math.round(ms / h) + "h";
|
|
94
|
+
if (msAbs >= m) return Math.round(ms / m) + "m";
|
|
95
|
+
if (msAbs >= s) return Math.round(ms / s) + "s";
|
|
96
|
+
return ms + "ms";
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Long format for `ms`.
|
|
100
|
+
*
|
|
101
|
+
* @param {Number} ms
|
|
102
|
+
* @return {String}
|
|
103
|
+
* @api private
|
|
104
|
+
*/
|
|
105
|
+
function fmtLong(ms) {
|
|
106
|
+
var msAbs = Math.abs(ms);
|
|
107
|
+
if (msAbs >= d) return plural(ms, msAbs, d, "day");
|
|
108
|
+
if (msAbs >= h) return plural(ms, msAbs, h, "hour");
|
|
109
|
+
if (msAbs >= m) return plural(ms, msAbs, m, "minute");
|
|
110
|
+
if (msAbs >= s) return plural(ms, msAbs, s, "second");
|
|
111
|
+
return ms + " ms";
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Pluralization helper.
|
|
115
|
+
*/
|
|
116
|
+
function plural(ms, msAbs, n, name) {
|
|
117
|
+
var isPlural = msAbs >= n * 1.5;
|
|
118
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region ../../../node_modules/@expo/devcert/node_modules/debug/src/common.js
|
|
124
|
+
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
125
|
+
/**
|
|
126
|
+
* This is the common logic for both the Node.js and web browser
|
|
127
|
+
* implementations of `debug()`.
|
|
128
|
+
*/
|
|
129
|
+
function setup(env) {
|
|
130
|
+
createDebug.debug = createDebug;
|
|
131
|
+
createDebug.default = createDebug;
|
|
132
|
+
createDebug.coerce = coerce;
|
|
133
|
+
createDebug.disable = disable;
|
|
134
|
+
createDebug.enable = enable;
|
|
135
|
+
createDebug.enabled = enabled;
|
|
136
|
+
createDebug.humanize = require_ms();
|
|
137
|
+
Object.keys(env).forEach(function(key) {
|
|
138
|
+
createDebug[key] = env[key];
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Active `debug` instances.
|
|
142
|
+
*/
|
|
143
|
+
createDebug.instances = [];
|
|
144
|
+
/**
|
|
145
|
+
* The currently active debug mode names, and names to skip.
|
|
146
|
+
*/
|
|
147
|
+
createDebug.names = [];
|
|
148
|
+
createDebug.skips = [];
|
|
149
|
+
/**
|
|
150
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
151
|
+
*
|
|
152
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
153
|
+
*/
|
|
154
|
+
createDebug.formatters = {};
|
|
155
|
+
/**
|
|
156
|
+
* Selects a color for a debug namespace
|
|
157
|
+
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
|
158
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
159
|
+
* @api private
|
|
160
|
+
*/
|
|
161
|
+
function selectColor(namespace) {
|
|
162
|
+
var hash = 0;
|
|
163
|
+
for (var i = 0; i < namespace.length; i++) {
|
|
164
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
165
|
+
hash |= 0;
|
|
166
|
+
}
|
|
167
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
168
|
+
}
|
|
169
|
+
createDebug.selectColor = selectColor;
|
|
170
|
+
/**
|
|
171
|
+
* Create a debugger with the given `namespace`.
|
|
172
|
+
*
|
|
173
|
+
* @param {String} namespace
|
|
174
|
+
* @return {Function}
|
|
175
|
+
* @api public
|
|
176
|
+
*/
|
|
177
|
+
function createDebug(namespace) {
|
|
178
|
+
var prevTime;
|
|
179
|
+
function debug() {
|
|
180
|
+
if (!debug.enabled) return;
|
|
181
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
182
|
+
var self = debug;
|
|
183
|
+
var curr = Number(/* @__PURE__ */ new Date());
|
|
184
|
+
self.diff = curr - (prevTime || curr);
|
|
185
|
+
self.prev = prevTime;
|
|
186
|
+
self.curr = curr;
|
|
187
|
+
prevTime = curr;
|
|
188
|
+
args[0] = createDebug.coerce(args[0]);
|
|
189
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
190
|
+
var index = 0;
|
|
191
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
192
|
+
if (match === "%%") return match;
|
|
193
|
+
index++;
|
|
194
|
+
var formatter = createDebug.formatters[format];
|
|
195
|
+
if (typeof formatter === "function") {
|
|
196
|
+
var val = args[index];
|
|
197
|
+
match = formatter.call(self, val);
|
|
198
|
+
args.splice(index, 1);
|
|
199
|
+
index--;
|
|
200
|
+
}
|
|
201
|
+
return match;
|
|
202
|
+
});
|
|
203
|
+
createDebug.formatArgs.call(self, args);
|
|
204
|
+
(self.log || createDebug.log).apply(self, args);
|
|
205
|
+
}
|
|
206
|
+
debug.namespace = namespace;
|
|
207
|
+
debug.enabled = createDebug.enabled(namespace);
|
|
208
|
+
debug.useColors = createDebug.useColors();
|
|
209
|
+
debug.color = selectColor(namespace);
|
|
210
|
+
debug.destroy = destroy;
|
|
211
|
+
debug.extend = extend;
|
|
212
|
+
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
213
|
+
createDebug.instances.push(debug);
|
|
214
|
+
return debug;
|
|
215
|
+
}
|
|
216
|
+
function destroy() {
|
|
217
|
+
var index = createDebug.instances.indexOf(this);
|
|
218
|
+
if (index !== -1) {
|
|
219
|
+
createDebug.instances.splice(index, 1);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
function extend(namespace, delimiter) {
|
|
225
|
+
return createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
229
|
+
* separated by a colon and wildcards.
|
|
230
|
+
*
|
|
231
|
+
* @param {String} namespaces
|
|
232
|
+
* @api public
|
|
233
|
+
*/
|
|
234
|
+
function enable(namespaces) {
|
|
235
|
+
createDebug.save(namespaces);
|
|
236
|
+
createDebug.names = [];
|
|
237
|
+
createDebug.skips = [];
|
|
238
|
+
var i;
|
|
239
|
+
var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
240
|
+
var len = split.length;
|
|
241
|
+
for (i = 0; i < len; i++) {
|
|
242
|
+
if (!split[i]) continue;
|
|
243
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
244
|
+
if (namespaces[0] === "-") createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
|
|
245
|
+
else createDebug.names.push(new RegExp("^" + namespaces + "$"));
|
|
246
|
+
}
|
|
247
|
+
for (i = 0; i < createDebug.instances.length; i++) {
|
|
248
|
+
var instance = createDebug.instances[i];
|
|
249
|
+
instance.enabled = createDebug.enabled(instance.namespace);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Disable debug output.
|
|
254
|
+
*
|
|
255
|
+
* @api public
|
|
256
|
+
*/
|
|
257
|
+
function disable() {
|
|
258
|
+
createDebug.enable("");
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
262
|
+
*
|
|
263
|
+
* @param {String} name
|
|
264
|
+
* @return {Boolean}
|
|
265
|
+
* @api public
|
|
266
|
+
*/
|
|
267
|
+
function enabled(name) {
|
|
268
|
+
if (name[name.length - 1] === "*") return true;
|
|
269
|
+
var i;
|
|
270
|
+
var len;
|
|
271
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) if (createDebug.skips[i].test(name)) return false;
|
|
272
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) if (createDebug.names[i].test(name)) return true;
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Coerce `val`.
|
|
277
|
+
*
|
|
278
|
+
* @param {Mixed} val
|
|
279
|
+
* @return {Mixed}
|
|
280
|
+
* @api private
|
|
281
|
+
*/
|
|
282
|
+
function coerce(val) {
|
|
283
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
284
|
+
return val;
|
|
285
|
+
}
|
|
286
|
+
createDebug.enable(createDebug.load());
|
|
287
|
+
return createDebug;
|
|
288
|
+
}
|
|
289
|
+
module.exports = setup;
|
|
290
|
+
}));
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region ../../../node_modules/@expo/devcert/node_modules/debug/src/browser.js
|
|
294
|
+
var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
295
|
+
function _typeof(obj) {
|
|
296
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) {
|
|
297
|
+
return typeof obj;
|
|
298
|
+
};
|
|
299
|
+
else _typeof = function _typeof(obj) {
|
|
300
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
301
|
+
};
|
|
302
|
+
return _typeof(obj);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* This is the web browser implementation of `debug()`.
|
|
306
|
+
*/
|
|
307
|
+
exports.log = log;
|
|
308
|
+
exports.formatArgs = formatArgs;
|
|
309
|
+
exports.save = save;
|
|
310
|
+
exports.load = load;
|
|
311
|
+
exports.useColors = useColors;
|
|
312
|
+
exports.storage = localstorage();
|
|
313
|
+
/**
|
|
314
|
+
* Colors.
|
|
315
|
+
*/
|
|
316
|
+
exports.colors = [
|
|
317
|
+
"#0000CC",
|
|
318
|
+
"#0000FF",
|
|
319
|
+
"#0033CC",
|
|
320
|
+
"#0033FF",
|
|
321
|
+
"#0066CC",
|
|
322
|
+
"#0066FF",
|
|
323
|
+
"#0099CC",
|
|
324
|
+
"#0099FF",
|
|
325
|
+
"#00CC00",
|
|
326
|
+
"#00CC33",
|
|
327
|
+
"#00CC66",
|
|
328
|
+
"#00CC99",
|
|
329
|
+
"#00CCCC",
|
|
330
|
+
"#00CCFF",
|
|
331
|
+
"#3300CC",
|
|
332
|
+
"#3300FF",
|
|
333
|
+
"#3333CC",
|
|
334
|
+
"#3333FF",
|
|
335
|
+
"#3366CC",
|
|
336
|
+
"#3366FF",
|
|
337
|
+
"#3399CC",
|
|
338
|
+
"#3399FF",
|
|
339
|
+
"#33CC00",
|
|
340
|
+
"#33CC33",
|
|
341
|
+
"#33CC66",
|
|
342
|
+
"#33CC99",
|
|
343
|
+
"#33CCCC",
|
|
344
|
+
"#33CCFF",
|
|
345
|
+
"#6600CC",
|
|
346
|
+
"#6600FF",
|
|
347
|
+
"#6633CC",
|
|
348
|
+
"#6633FF",
|
|
349
|
+
"#66CC00",
|
|
350
|
+
"#66CC33",
|
|
351
|
+
"#9900CC",
|
|
352
|
+
"#9900FF",
|
|
353
|
+
"#9933CC",
|
|
354
|
+
"#9933FF",
|
|
355
|
+
"#99CC00",
|
|
356
|
+
"#99CC33",
|
|
357
|
+
"#CC0000",
|
|
358
|
+
"#CC0033",
|
|
359
|
+
"#CC0066",
|
|
360
|
+
"#CC0099",
|
|
361
|
+
"#CC00CC",
|
|
362
|
+
"#CC00FF",
|
|
363
|
+
"#CC3300",
|
|
364
|
+
"#CC3333",
|
|
365
|
+
"#CC3366",
|
|
366
|
+
"#CC3399",
|
|
367
|
+
"#CC33CC",
|
|
368
|
+
"#CC33FF",
|
|
369
|
+
"#CC6600",
|
|
370
|
+
"#CC6633",
|
|
371
|
+
"#CC9900",
|
|
372
|
+
"#CC9933",
|
|
373
|
+
"#CCCC00",
|
|
374
|
+
"#CCCC33",
|
|
375
|
+
"#FF0000",
|
|
376
|
+
"#FF0033",
|
|
377
|
+
"#FF0066",
|
|
378
|
+
"#FF0099",
|
|
379
|
+
"#FF00CC",
|
|
380
|
+
"#FF00FF",
|
|
381
|
+
"#FF3300",
|
|
382
|
+
"#FF3333",
|
|
383
|
+
"#FF3366",
|
|
384
|
+
"#FF3399",
|
|
385
|
+
"#FF33CC",
|
|
386
|
+
"#FF33FF",
|
|
387
|
+
"#FF6600",
|
|
388
|
+
"#FF6633",
|
|
389
|
+
"#FF9900",
|
|
390
|
+
"#FF9933",
|
|
391
|
+
"#FFCC00",
|
|
392
|
+
"#FFCC33"
|
|
393
|
+
];
|
|
394
|
+
/**
|
|
395
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
396
|
+
* and the Firebug extension (any Firefox version) are known
|
|
397
|
+
* to support "%c" CSS customizations.
|
|
398
|
+
*
|
|
399
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
400
|
+
*/
|
|
401
|
+
function useColors() {
|
|
402
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
403
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
404
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Colorize log arguments if enabled.
|
|
408
|
+
*
|
|
409
|
+
* @api public
|
|
410
|
+
*/
|
|
411
|
+
function formatArgs(args) {
|
|
412
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
413
|
+
if (!this.useColors) return;
|
|
414
|
+
var c = "color: " + this.color;
|
|
415
|
+
args.splice(1, 0, c, "color: inherit");
|
|
416
|
+
var index = 0;
|
|
417
|
+
var lastC = 0;
|
|
418
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
419
|
+
if (match === "%%") return;
|
|
420
|
+
index++;
|
|
421
|
+
if (match === "%c") lastC = index;
|
|
422
|
+
});
|
|
423
|
+
args.splice(lastC, 0, c);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Invokes `console.log()` when available.
|
|
427
|
+
* No-op when `console.log` is not a "function".
|
|
428
|
+
*
|
|
429
|
+
* @api public
|
|
430
|
+
*/
|
|
431
|
+
function log() {
|
|
432
|
+
var _console;
|
|
433
|
+
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.log && (_console = console).log.apply(_console, arguments);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Save `namespaces`.
|
|
437
|
+
*
|
|
438
|
+
* @param {String} namespaces
|
|
439
|
+
* @api private
|
|
440
|
+
*/
|
|
441
|
+
function save(namespaces) {
|
|
442
|
+
try {
|
|
443
|
+
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
444
|
+
else exports.storage.removeItem("debug");
|
|
445
|
+
} catch (error) {}
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Load `namespaces`.
|
|
449
|
+
*
|
|
450
|
+
* @return {String} returns the previously persisted debug modes
|
|
451
|
+
* @api private
|
|
452
|
+
*/
|
|
453
|
+
function load() {
|
|
454
|
+
var r;
|
|
455
|
+
try {
|
|
456
|
+
r = exports.storage.getItem("debug");
|
|
457
|
+
} catch (error) {}
|
|
458
|
+
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
459
|
+
return r;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Localstorage attempts to return the localstorage.
|
|
463
|
+
*
|
|
464
|
+
* This is necessary because safari throws
|
|
465
|
+
* when a user disables cookies/localstorage
|
|
466
|
+
* and you attempt to access it.
|
|
467
|
+
*
|
|
468
|
+
* @return {LocalStorage}
|
|
469
|
+
* @api private
|
|
470
|
+
*/
|
|
471
|
+
function localstorage() {
|
|
472
|
+
try {
|
|
473
|
+
return localStorage;
|
|
474
|
+
} catch (error) {}
|
|
475
|
+
}
|
|
476
|
+
module.exports = require_common()(exports);
|
|
477
|
+
var formatters = module.exports.formatters;
|
|
478
|
+
/**
|
|
479
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
480
|
+
*/
|
|
481
|
+
formatters.j = function(v) {
|
|
482
|
+
try {
|
|
483
|
+
return JSON.stringify(v);
|
|
484
|
+
} catch (error) {
|
|
485
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}));
|
|
489
|
+
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region ../../../node_modules/has-flag/index.js
|
|
492
|
+
var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
493
|
+
module.exports = (flag, argv = process.argv) => {
|
|
494
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
495
|
+
const position = argv.indexOf(prefix + flag);
|
|
496
|
+
const terminatorPosition = argv.indexOf("--");
|
|
497
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
498
|
+
};
|
|
499
|
+
}));
|
|
500
|
+
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region ../../../node_modules/supports-color/index.js
|
|
503
|
+
var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
504
|
+
const os = __require("os");
|
|
505
|
+
const tty$1 = __require("tty");
|
|
506
|
+
const hasFlag = require_has_flag();
|
|
507
|
+
const { env } = process;
|
|
508
|
+
let forceColor;
|
|
509
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
|
|
510
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
|
|
511
|
+
if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
|
|
512
|
+
else if (env.FORCE_COLOR === "false") forceColor = 0;
|
|
513
|
+
else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
514
|
+
function translateLevel(level) {
|
|
515
|
+
if (level === 0) return false;
|
|
516
|
+
return {
|
|
517
|
+
level,
|
|
518
|
+
hasBasic: true,
|
|
519
|
+
has256: level >= 2,
|
|
520
|
+
has16m: level >= 3
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
524
|
+
if (forceColor === 0) return 0;
|
|
525
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
526
|
+
if (hasFlag("color=256")) return 2;
|
|
527
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
528
|
+
const min = forceColor || 0;
|
|
529
|
+
if (env.TERM === "dumb") return min;
|
|
530
|
+
if (process.platform === "win32") {
|
|
531
|
+
const osRelease = os.release().split(".");
|
|
532
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
533
|
+
return 1;
|
|
534
|
+
}
|
|
535
|
+
if ("CI" in env) {
|
|
536
|
+
if ([
|
|
537
|
+
"TRAVIS",
|
|
538
|
+
"CIRCLECI",
|
|
539
|
+
"APPVEYOR",
|
|
540
|
+
"GITLAB_CI",
|
|
541
|
+
"GITHUB_ACTIONS",
|
|
542
|
+
"BUILDKITE"
|
|
543
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
544
|
+
return min;
|
|
545
|
+
}
|
|
546
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
547
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
548
|
+
if ("TERM_PROGRAM" in env) {
|
|
549
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
550
|
+
switch (env.TERM_PROGRAM) {
|
|
551
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
552
|
+
case "Apple_Terminal": return 2;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
556
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
557
|
+
if ("COLORTERM" in env) return 1;
|
|
558
|
+
return min;
|
|
559
|
+
}
|
|
560
|
+
function getSupportLevel(stream) {
|
|
561
|
+
return translateLevel(supportsColor(stream, stream && stream.isTTY));
|
|
562
|
+
}
|
|
563
|
+
module.exports = {
|
|
564
|
+
supportsColor: getSupportLevel,
|
|
565
|
+
stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
|
|
566
|
+
stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
|
|
567
|
+
};
|
|
568
|
+
}));
|
|
569
|
+
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region ../../../node_modules/@expo/devcert/node_modules/debug/src/node.js
|
|
572
|
+
var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
573
|
+
/**
|
|
574
|
+
* Module dependencies.
|
|
575
|
+
*/
|
|
576
|
+
var tty = __require("tty");
|
|
577
|
+
var util = __require("util");
|
|
578
|
+
/**
|
|
579
|
+
* This is the Node.js implementation of `debug()`.
|
|
580
|
+
*/
|
|
581
|
+
exports.init = init;
|
|
582
|
+
exports.log = log;
|
|
583
|
+
exports.formatArgs = formatArgs;
|
|
584
|
+
exports.save = save;
|
|
585
|
+
exports.load = load;
|
|
586
|
+
exports.useColors = useColors;
|
|
587
|
+
/**
|
|
588
|
+
* Colors.
|
|
589
|
+
*/
|
|
590
|
+
exports.colors = [
|
|
591
|
+
6,
|
|
592
|
+
2,
|
|
593
|
+
3,
|
|
594
|
+
4,
|
|
595
|
+
5,
|
|
596
|
+
1
|
|
597
|
+
];
|
|
598
|
+
try {
|
|
599
|
+
var supportsColor = require_supports_color();
|
|
600
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
601
|
+
20,
|
|
602
|
+
21,
|
|
603
|
+
26,
|
|
604
|
+
27,
|
|
605
|
+
32,
|
|
606
|
+
33,
|
|
607
|
+
38,
|
|
608
|
+
39,
|
|
609
|
+
40,
|
|
610
|
+
41,
|
|
611
|
+
42,
|
|
612
|
+
43,
|
|
613
|
+
44,
|
|
614
|
+
45,
|
|
615
|
+
56,
|
|
616
|
+
57,
|
|
617
|
+
62,
|
|
618
|
+
63,
|
|
619
|
+
68,
|
|
620
|
+
69,
|
|
621
|
+
74,
|
|
622
|
+
75,
|
|
623
|
+
76,
|
|
624
|
+
77,
|
|
625
|
+
78,
|
|
626
|
+
79,
|
|
627
|
+
80,
|
|
628
|
+
81,
|
|
629
|
+
92,
|
|
630
|
+
93,
|
|
631
|
+
98,
|
|
632
|
+
99,
|
|
633
|
+
112,
|
|
634
|
+
113,
|
|
635
|
+
128,
|
|
636
|
+
129,
|
|
637
|
+
134,
|
|
638
|
+
135,
|
|
639
|
+
148,
|
|
640
|
+
149,
|
|
641
|
+
160,
|
|
642
|
+
161,
|
|
643
|
+
162,
|
|
644
|
+
163,
|
|
645
|
+
164,
|
|
646
|
+
165,
|
|
647
|
+
166,
|
|
648
|
+
167,
|
|
649
|
+
168,
|
|
650
|
+
169,
|
|
651
|
+
170,
|
|
652
|
+
171,
|
|
653
|
+
172,
|
|
654
|
+
173,
|
|
655
|
+
178,
|
|
656
|
+
179,
|
|
657
|
+
184,
|
|
658
|
+
185,
|
|
659
|
+
196,
|
|
660
|
+
197,
|
|
661
|
+
198,
|
|
662
|
+
199,
|
|
663
|
+
200,
|
|
664
|
+
201,
|
|
665
|
+
202,
|
|
666
|
+
203,
|
|
667
|
+
204,
|
|
668
|
+
205,
|
|
669
|
+
206,
|
|
670
|
+
207,
|
|
671
|
+
208,
|
|
672
|
+
209,
|
|
673
|
+
214,
|
|
674
|
+
215,
|
|
675
|
+
220,
|
|
676
|
+
221
|
|
677
|
+
];
|
|
678
|
+
} catch (error) {}
|
|
679
|
+
/**
|
|
680
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
681
|
+
*
|
|
682
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
683
|
+
*/
|
|
684
|
+
exports.inspectOpts = Object.keys(process.env).filter(function(key) {
|
|
685
|
+
return /^debug_/i.test(key);
|
|
686
|
+
}).reduce(function(obj, key) {
|
|
687
|
+
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
|
|
688
|
+
return k.toUpperCase();
|
|
689
|
+
});
|
|
690
|
+
var val = process.env[key];
|
|
691
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
692
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
693
|
+
else if (val === "null") val = null;
|
|
694
|
+
else val = Number(val);
|
|
695
|
+
obj[prop] = val;
|
|
696
|
+
return obj;
|
|
697
|
+
}, {});
|
|
698
|
+
/**
|
|
699
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
700
|
+
*/
|
|
701
|
+
function useColors() {
|
|
702
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Adds ANSI color escape codes if enabled.
|
|
706
|
+
*
|
|
707
|
+
* @api public
|
|
708
|
+
*/
|
|
709
|
+
function formatArgs(args) {
|
|
710
|
+
var name = this.namespace;
|
|
711
|
+
if (this.useColors) {
|
|
712
|
+
var c = this.color;
|
|
713
|
+
var colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
714
|
+
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
|
|
715
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
716
|
+
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
717
|
+
} else args[0] = getDate() + name + " " + args[0];
|
|
718
|
+
}
|
|
719
|
+
function getDate() {
|
|
720
|
+
if (exports.inspectOpts.hideDate) return "";
|
|
721
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
725
|
+
*/
|
|
726
|
+
function log() {
|
|
727
|
+
return process.stderr.write(util.format.apply(util, arguments) + "\n");
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Save `namespaces`.
|
|
731
|
+
*
|
|
732
|
+
* @param {String} namespaces
|
|
733
|
+
* @api private
|
|
734
|
+
*/
|
|
735
|
+
function save(namespaces) {
|
|
736
|
+
if (namespaces) process.env.DEBUG = namespaces;
|
|
737
|
+
else delete process.env.DEBUG;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Load `namespaces`.
|
|
741
|
+
*
|
|
742
|
+
* @return {String} returns the previously persisted debug modes
|
|
743
|
+
* @api private
|
|
744
|
+
*/
|
|
745
|
+
function load() {
|
|
746
|
+
return process.env.DEBUG;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Init logic for `debug` instances.
|
|
750
|
+
*
|
|
751
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
752
|
+
* differently for a particular `debug` instance.
|
|
753
|
+
*/
|
|
754
|
+
function init(debug) {
|
|
755
|
+
debug.inspectOpts = {};
|
|
756
|
+
var keys = Object.keys(exports.inspectOpts);
|
|
757
|
+
for (var i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
758
|
+
}
|
|
759
|
+
module.exports = require_common()(exports);
|
|
760
|
+
var formatters = module.exports.formatters;
|
|
761
|
+
/**
|
|
762
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
763
|
+
*/
|
|
764
|
+
formatters.o = function(v) {
|
|
765
|
+
this.inspectOpts.colors = this.useColors;
|
|
766
|
+
return util.inspect(v, this.inspectOpts).split("\n").map(function(str) {
|
|
767
|
+
return str.trim();
|
|
768
|
+
}).join(" ");
|
|
769
|
+
};
|
|
770
|
+
/**
|
|
771
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
772
|
+
*/
|
|
773
|
+
formatters.O = function(v) {
|
|
774
|
+
this.inspectOpts.colors = this.useColors;
|
|
775
|
+
return util.inspect(v, this.inspectOpts);
|
|
776
|
+
};
|
|
777
|
+
}));
|
|
778
|
+
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region ../../../node_modules/@expo/devcert/node_modules/debug/src/index.js
|
|
781
|
+
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
782
|
+
/**
|
|
783
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
784
|
+
* treat as a browser.
|
|
785
|
+
*/
|
|
786
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
|
|
787
|
+
else module.exports = require_node();
|
|
788
|
+
}));
|
|
789
|
+
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region ../../../node_modules/@expo/sudo-prompt/index.js
|
|
792
|
+
var require_sudo_prompt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
793
|
+
var Node = {
|
|
794
|
+
child: __require("child_process"),
|
|
795
|
+
crypto: __require("crypto"),
|
|
796
|
+
fs: __require("fs"),
|
|
797
|
+
os: __require("os"),
|
|
798
|
+
path: __require("path"),
|
|
799
|
+
process
|
|
800
|
+
};
|
|
801
|
+
var SudoPromptError = class extends Error {
|
|
802
|
+
constructor(message) {
|
|
803
|
+
super(message);
|
|
804
|
+
this.name = "SudoPromptError";
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
function Attempt(instance, end) {
|
|
808
|
+
var platform = Node.process.platform;
|
|
809
|
+
if (platform === "darwin") return Mac(instance, end);
|
|
810
|
+
if (platform === "linux") return Linux(instance, end);
|
|
811
|
+
if (platform === "win32") return Windows(instance, end);
|
|
812
|
+
end(new SudoPromptError("Platform not yet supported."));
|
|
813
|
+
}
|
|
814
|
+
function EscapeDoubleQuotes(string) {
|
|
815
|
+
if (typeof string !== "string") throw new SudoPromptError("Expected a string.");
|
|
816
|
+
return string.replace(/"/g, "\\\"");
|
|
817
|
+
}
|
|
818
|
+
function Exec() {
|
|
819
|
+
if (arguments.length < 1 || arguments.length > 3) throw new SudoPromptError("Wrong number of arguments.");
|
|
820
|
+
var command = arguments[0];
|
|
821
|
+
var options = {};
|
|
822
|
+
var end = function() {};
|
|
823
|
+
if (typeof command !== "string") throw new SudoPromptError("Command should be a string.");
|
|
824
|
+
if (arguments.length === 2) if (arguments[1] && typeof arguments[1] === "object") options = arguments[1];
|
|
825
|
+
else if (typeof arguments[1] === "function") end = arguments[1];
|
|
826
|
+
else throw new SudoPromptError("Expected options or callback.");
|
|
827
|
+
else if (arguments.length === 3) {
|
|
828
|
+
if (arguments[1] && typeof arguments[1] === "object") options = arguments[1];
|
|
829
|
+
else throw new SudoPromptError("Expected options to be an object.");
|
|
830
|
+
if (typeof arguments[2] === "function") end = arguments[2];
|
|
831
|
+
else throw new SudoPromptError("Expected callback to be a function.");
|
|
832
|
+
}
|
|
833
|
+
if (/^sudo/i.test(command)) return end(new SudoPromptError("Command should not be prefixed with \"sudo\"."));
|
|
834
|
+
if (typeof options.name === "undefined") {
|
|
835
|
+
var title = Node.process.title;
|
|
836
|
+
if (ValidName(title)) options.name = title;
|
|
837
|
+
else return end(new SudoPromptError("process.title cannot be used as a valid name."));
|
|
838
|
+
} else if (!ValidName(options.name)) {
|
|
839
|
+
var error = "";
|
|
840
|
+
error += "options.name must be alphanumeric only ";
|
|
841
|
+
error += "(spaces are allowed) and <= 70 characters.";
|
|
842
|
+
return end(new SudoPromptError(error));
|
|
843
|
+
}
|
|
844
|
+
if (typeof options.icns !== "undefined") {
|
|
845
|
+
if (typeof options.icns !== "string") return end(new SudoPromptError("options.icns must be a string if provided."));
|
|
846
|
+
else if (options.icns.trim().length === 0) return end(new SudoPromptError("options.icns must not be empty if provided."));
|
|
847
|
+
}
|
|
848
|
+
if (typeof options.env !== "undefined") if (typeof options.env !== "object") return end(new SudoPromptError("options.env must be an object if provided."));
|
|
849
|
+
else if (Object.keys(options.env).length === 0) return end(new SudoPromptError("options.env must not be empty if provided."));
|
|
850
|
+
else for (var key in options.env) {
|
|
851
|
+
var value = options.env[key];
|
|
852
|
+
if (typeof key !== "string" || typeof value !== "string") return end(new SudoPromptError("options.env environment variables must be strings."));
|
|
853
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) return end(new SudoPromptError("options.env has an invalid environment variable name: " + JSON.stringify(key)));
|
|
854
|
+
if (/[\r\n]/.test(value)) return end(new SudoPromptError("options.env has an invalid environment variable value: " + JSON.stringify(value)));
|
|
855
|
+
}
|
|
856
|
+
var platform = Node.process.platform;
|
|
857
|
+
if (platform !== "darwin" && platform !== "linux" && platform !== "win32") return end(new SudoPromptError("Platform not yet supported."));
|
|
858
|
+
Attempt({
|
|
859
|
+
command,
|
|
860
|
+
options,
|
|
861
|
+
uuid: void 0,
|
|
862
|
+
path: void 0
|
|
863
|
+
}, end);
|
|
864
|
+
}
|
|
865
|
+
function Linux(instance, end) {
|
|
866
|
+
LinuxBinary(instance, function(error, binary) {
|
|
867
|
+
if (error) return end(error);
|
|
868
|
+
var command = [];
|
|
869
|
+
command.push("cd \"" + EscapeDoubleQuotes(Node.process.cwd()) + "\";");
|
|
870
|
+
for (var key in instance.options.env) {
|
|
871
|
+
var value = instance.options.env[key];
|
|
872
|
+
command.push("export " + key + "=\"" + EscapeDoubleQuotes(value) + "\";");
|
|
873
|
+
}
|
|
874
|
+
command.push("\"" + EscapeDoubleQuotes(binary) + "\"");
|
|
875
|
+
if (/kdesudo/i.test(binary)) {
|
|
876
|
+
command.push("--comment", "\"" + instance.options.name + " wants to make changes. Enter your password to allow this.\"");
|
|
877
|
+
command.push("-d");
|
|
878
|
+
command.push("--");
|
|
879
|
+
} else if (/pkexec/i.test(binary)) command.push("--disable-internal-agent");
|
|
880
|
+
var magic = "SUDOPROMPT\n";
|
|
881
|
+
command.push("/bin/bash -c \"echo " + EscapeDoubleQuotes(magic.trim()) + "; " + EscapeDoubleQuotes(instance.command) + "\"");
|
|
882
|
+
command = command.join(" ");
|
|
883
|
+
Node.child.exec(command, {
|
|
884
|
+
encoding: "utf-8",
|
|
885
|
+
maxBuffer: MAX_BUFFER
|
|
886
|
+
}, function(error, stdout, stderr) {
|
|
887
|
+
var elevated = stdout && stdout.slice(0, magic.length) === magic;
|
|
888
|
+
if (elevated) stdout = stdout.slice(magic.length);
|
|
889
|
+
if (error && !elevated) if (/No authentication agent found/.test(stderr)) error = new SudoPromptError(NO_POLKIT_AGENT);
|
|
890
|
+
else error = new SudoPromptError(PERMISSION_DENIED);
|
|
891
|
+
end(error, stdout, stderr);
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
function LinuxBinary(instance, end) {
|
|
896
|
+
var index = 0;
|
|
897
|
+
var paths = ["/usr/bin/kdesudo", "/usr/bin/pkexec"];
|
|
898
|
+
function test() {
|
|
899
|
+
if (index === paths.length) return end(new SudoPromptError("Unable to find pkexec or kdesudo."));
|
|
900
|
+
var path = paths[index++];
|
|
901
|
+
Node.fs.stat(path, function(error) {
|
|
902
|
+
if (error) {
|
|
903
|
+
if (error.code === "ENOTDIR") return test();
|
|
904
|
+
if (error.code === "ENOENT") return test();
|
|
905
|
+
end(error);
|
|
906
|
+
} else end(void 0, path);
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
test();
|
|
910
|
+
}
|
|
911
|
+
function Mac(instance, callback) {
|
|
912
|
+
var temp = Node.os.tmpdir();
|
|
913
|
+
if (!temp) return callback(new SudoPromptError("os.tmpdir() not defined."));
|
|
914
|
+
if (!Node.process.env.USER) return callback(new SudoPromptError("env['USER'] not defined."));
|
|
915
|
+
UUID(instance, function(error, uuid) {
|
|
916
|
+
if (error) return callback(error);
|
|
917
|
+
instance.uuid = uuid;
|
|
918
|
+
instance.path = Node.path.join(temp, instance.uuid, instance.options.name + ".app");
|
|
919
|
+
function end(error, stdout, stderr) {
|
|
920
|
+
Remove(Node.path.dirname(instance.path), function(errorRemove) {
|
|
921
|
+
if (error) return callback(error);
|
|
922
|
+
if (errorRemove) return callback(errorRemove);
|
|
923
|
+
callback(void 0, stdout, stderr);
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
MacApplet(instance, function(error, stdout, stderr) {
|
|
927
|
+
if (error) return end(error, stdout, stderr);
|
|
928
|
+
MacIcon(instance, function(error) {
|
|
929
|
+
if (error) return end(error);
|
|
930
|
+
MacPropertyList(instance, function(error, stdout, stderr) {
|
|
931
|
+
if (error) return end(error, stdout, stderr);
|
|
932
|
+
MacCommand(instance, function(error) {
|
|
933
|
+
if (error) return end(error);
|
|
934
|
+
MacOpen(instance, function(error, stdout, stderr) {
|
|
935
|
+
if (error) return end(error, stdout, stderr);
|
|
936
|
+
MacResult(instance, end);
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
function MacApplet(instance, end) {
|
|
945
|
+
var parent = Node.path.dirname(instance.path);
|
|
946
|
+
Node.fs.mkdir(parent, function(error) {
|
|
947
|
+
if (error) return end(error);
|
|
948
|
+
var zip = Node.path.join(parent, "sudo-prompt-applet.zip");
|
|
949
|
+
Node.fs.writeFile(zip, APPLET, "base64", function(error) {
|
|
950
|
+
if (error) return end(error);
|
|
951
|
+
var command = [];
|
|
952
|
+
command.push("/usr/bin/unzip");
|
|
953
|
+
command.push("-o");
|
|
954
|
+
command.push("\"" + EscapeDoubleQuotes(zip) + "\"");
|
|
955
|
+
command.push("-d \"" + EscapeDoubleQuotes(instance.path) + "\"");
|
|
956
|
+
command = command.join(" ");
|
|
957
|
+
Node.child.exec(command, { encoding: "utf-8" }, end);
|
|
958
|
+
});
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
function MacCommand(instance, end) {
|
|
962
|
+
var path = Node.path.join(instance.path, "Contents", "MacOS", "sudo-prompt-command");
|
|
963
|
+
var script = [];
|
|
964
|
+
script.push("cd \"" + EscapeDoubleQuotes(Node.process.cwd()) + "\"");
|
|
965
|
+
for (var key in instance.options.env) {
|
|
966
|
+
var value = instance.options.env[key];
|
|
967
|
+
script.push("export " + key + "=\"" + EscapeDoubleQuotes(value) + "\"");
|
|
968
|
+
}
|
|
969
|
+
script.push(instance.command);
|
|
970
|
+
script = script.join("\n");
|
|
971
|
+
Node.fs.writeFile(path, script, "utf-8", end);
|
|
972
|
+
}
|
|
973
|
+
function MacIcon(instance, end) {
|
|
974
|
+
if (!instance.options.icns) return end();
|
|
975
|
+
Node.fs.readFile(instance.options.icns, function(error, buffer) {
|
|
976
|
+
if (error) return end(error);
|
|
977
|
+
var icns = Node.path.join(instance.path, "Contents", "Resources", "applet.icns");
|
|
978
|
+
Node.fs.writeFile(icns, buffer, end);
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function MacOpen(instance, end) {
|
|
982
|
+
var binary = Node.path.join(instance.path, "Contents", "MacOS", "applet");
|
|
983
|
+
var options = {
|
|
984
|
+
cwd: Node.path.dirname(binary),
|
|
985
|
+
encoding: "utf-8"
|
|
986
|
+
};
|
|
987
|
+
Node.child.exec("./" + Node.path.basename(binary), options, end);
|
|
988
|
+
}
|
|
989
|
+
function MacPropertyList(instance, end) {
|
|
990
|
+
var path = EscapeDoubleQuotes(Node.path.join(instance.path, "Contents", "Info.plist"));
|
|
991
|
+
var key = EscapeDoubleQuotes("CFBundleName");
|
|
992
|
+
var value = instance.options.name + " Password Prompt";
|
|
993
|
+
if (/'/.test(value)) return end(new SudoPromptError("Value should not contain single quotes."));
|
|
994
|
+
var command = [];
|
|
995
|
+
command.push("/usr/bin/defaults");
|
|
996
|
+
command.push("write");
|
|
997
|
+
command.push("\"" + path + "\"");
|
|
998
|
+
command.push("\"" + key + "\"");
|
|
999
|
+
command.push("'" + value + "'");
|
|
1000
|
+
command = command.join(" ");
|
|
1001
|
+
Node.child.exec(command, { encoding: "utf-8" }, end);
|
|
1002
|
+
}
|
|
1003
|
+
function MacResult(instance, end) {
|
|
1004
|
+
var cwd = Node.path.join(instance.path, "Contents", "MacOS");
|
|
1005
|
+
Node.fs.readFile(Node.path.join(cwd, "code"), "utf-8", function(error, code) {
|
|
1006
|
+
if (error) {
|
|
1007
|
+
if (error.code === "ENOENT") return end(new SudoPromptError(PERMISSION_DENIED));
|
|
1008
|
+
end(error);
|
|
1009
|
+
} else Node.fs.readFile(Node.path.join(cwd, "stdout"), "utf-8", function(error, stdout) {
|
|
1010
|
+
if (error) return end(error);
|
|
1011
|
+
Node.fs.readFile(Node.path.join(cwd, "stderr"), "utf-8", function(error, stderr) {
|
|
1012
|
+
if (error) return end(error);
|
|
1013
|
+
code = parseInt(code.trim(), 10);
|
|
1014
|
+
if (code === 0) end(void 0, stdout, stderr);
|
|
1015
|
+
else {
|
|
1016
|
+
error = new SudoPromptError("Command failed: " + instance.command + "\n" + stderr);
|
|
1017
|
+
error.code = code;
|
|
1018
|
+
end(error, stdout, stderr);
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
});
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
function Remove(path, end) {
|
|
1025
|
+
if (typeof path !== "string" || !path.trim()) return end(new SudoPromptError("Argument path not defined."));
|
|
1026
|
+
var command = [];
|
|
1027
|
+
if (Node.process.platform === "win32") {
|
|
1028
|
+
if (/"/.test(path)) return end(new SudoPromptError("Argument path cannot contain double-quotes."));
|
|
1029
|
+
command.push("rmdir /s /q \"" + path + "\"");
|
|
1030
|
+
} else {
|
|
1031
|
+
command.push("/bin/rm");
|
|
1032
|
+
command.push("-rf");
|
|
1033
|
+
command.push("\"" + EscapeDoubleQuotes(Node.path.normalize(path)) + "\"");
|
|
1034
|
+
}
|
|
1035
|
+
command = command.join(" ");
|
|
1036
|
+
Node.child.exec(command, { encoding: "utf-8" }, end);
|
|
1037
|
+
}
|
|
1038
|
+
function UUID(instance, end) {
|
|
1039
|
+
Node.crypto.randomBytes(256, function(error, random) {
|
|
1040
|
+
if (error) random = Date.now() + "" + Math.random();
|
|
1041
|
+
var hash = Node.crypto.createHash("SHA256");
|
|
1042
|
+
hash.update("sudo-prompt-3");
|
|
1043
|
+
hash.update(instance.options.name);
|
|
1044
|
+
hash.update(instance.command);
|
|
1045
|
+
hash.update(random);
|
|
1046
|
+
var uuid = hash.digest("hex").slice(-32);
|
|
1047
|
+
if (!uuid || typeof uuid !== "string" || uuid.length !== 32) return end(new SudoPromptError("Expected a valid UUID."));
|
|
1048
|
+
end(void 0, uuid);
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
function ValidName(string) {
|
|
1052
|
+
if (!/^[a-z0-9 ]+$/i.test(string)) return false;
|
|
1053
|
+
if (string.trim().length === 0) return false;
|
|
1054
|
+
if (string.length > 70) return false;
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
function Windows(instance, callback) {
|
|
1058
|
+
var temp = Node.os.tmpdir();
|
|
1059
|
+
if (!temp) return callback(new SudoPromptError("os.tmpdir() not defined."));
|
|
1060
|
+
UUID(instance, function(error, uuid) {
|
|
1061
|
+
if (error) return callback(error);
|
|
1062
|
+
instance.uuid = uuid;
|
|
1063
|
+
instance.path = Node.path.join(temp, instance.uuid);
|
|
1064
|
+
if (/"/.test(instance.path)) return callback(new SudoPromptError("instance.path cannot contain double-quotes."));
|
|
1065
|
+
instance.pathElevate = Node.path.join(instance.path, "elevate.vbs");
|
|
1066
|
+
instance.pathExecute = Node.path.join(instance.path, "execute.bat");
|
|
1067
|
+
instance.pathCommand = Node.path.join(instance.path, "command.bat");
|
|
1068
|
+
instance.pathStdout = Node.path.join(instance.path, "stdout");
|
|
1069
|
+
instance.pathStderr = Node.path.join(instance.path, "stderr");
|
|
1070
|
+
instance.pathStatus = Node.path.join(instance.path, "status");
|
|
1071
|
+
Node.fs.mkdir(instance.path, function(error) {
|
|
1072
|
+
if (error) return callback(error);
|
|
1073
|
+
function end(error, stdout, stderr) {
|
|
1074
|
+
Remove(instance.path, function(errorRemove) {
|
|
1075
|
+
if (error) return callback(error);
|
|
1076
|
+
if (errorRemove) return callback(errorRemove);
|
|
1077
|
+
callback(void 0, stdout, stderr);
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
WindowsWriteExecuteScript(instance, function(error) {
|
|
1081
|
+
if (error) return end(error);
|
|
1082
|
+
WindowsWriteCommandScript(instance, function(error) {
|
|
1083
|
+
if (error) return end(error);
|
|
1084
|
+
WindowsElevate(instance, function(error, stdout, stderr) {
|
|
1085
|
+
if (error) return end(error, stdout, stderr);
|
|
1086
|
+
WindowsWaitForStatus(instance, function(error) {
|
|
1087
|
+
if (error) return end(error);
|
|
1088
|
+
WindowsResult(instance, end);
|
|
1089
|
+
});
|
|
1090
|
+
});
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function WindowsElevate(instance, end) {
|
|
1097
|
+
var command = [];
|
|
1098
|
+
command.push("powershell.exe");
|
|
1099
|
+
command.push("Start-Process");
|
|
1100
|
+
command.push("-FilePath");
|
|
1101
|
+
command.push("\"'" + instance.pathExecute.replace(/'/g, "`'") + "'\"");
|
|
1102
|
+
command.push("-WindowStyle hidden");
|
|
1103
|
+
command.push("-Verb runAs");
|
|
1104
|
+
command = command.join(" ");
|
|
1105
|
+
Node.child.exec(command, { encoding: "utf-8" }, function(error, stdout, stderr) {
|
|
1106
|
+
if (error) return end(new SudoPromptError(PERMISSION_DENIED), stdout, stderr);
|
|
1107
|
+
end();
|
|
1108
|
+
}).stdin.end();
|
|
1109
|
+
}
|
|
1110
|
+
function WindowsResult(instance, end) {
|
|
1111
|
+
Node.fs.readFile(instance.pathStatus, "utf-8", function(error, code) {
|
|
1112
|
+
if (error) return end(error);
|
|
1113
|
+
Node.fs.readFile(instance.pathStdout, "utf-8", function(error, stdout) {
|
|
1114
|
+
if (error) return end(error);
|
|
1115
|
+
Node.fs.readFile(instance.pathStderr, "utf-8", function(error, stderr) {
|
|
1116
|
+
if (error) return end(error);
|
|
1117
|
+
code = parseInt(code.trim(), 10);
|
|
1118
|
+
if (code === 0) end(void 0, stdout, stderr);
|
|
1119
|
+
else {
|
|
1120
|
+
error = new SudoPromptError("Command failed: " + instance.command + "\r\n" + stderr);
|
|
1121
|
+
error.code = code;
|
|
1122
|
+
end(error, stdout, stderr);
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
});
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function WindowsWaitForStatus(instance, end) {
|
|
1129
|
+
Node.fs.stat(instance.pathStatus, function(error, stats) {
|
|
1130
|
+
if (error && error.code === "ENOENT" || stats.size < 2) setTimeout(function() {
|
|
1131
|
+
Node.fs.stat(instance.pathStdout, function(error) {
|
|
1132
|
+
if (error) return end(new SudoPromptError(PERMISSION_DENIED));
|
|
1133
|
+
WindowsWaitForStatus(instance, end);
|
|
1134
|
+
});
|
|
1135
|
+
}, 1e3);
|
|
1136
|
+
else if (error) end(error);
|
|
1137
|
+
else end();
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
function WindowsWriteCommandScript(instance, end) {
|
|
1141
|
+
var cwd = Node.process.cwd();
|
|
1142
|
+
if (/"/.test(cwd)) return end(new SudoPromptError("process.cwd() cannot contain double-quotes."));
|
|
1143
|
+
var script = [];
|
|
1144
|
+
script.push("@echo off");
|
|
1145
|
+
script.push("chcp 65001>nul");
|
|
1146
|
+
script.push("cd /d \"" + cwd + "\"");
|
|
1147
|
+
for (var key in instance.options.env) {
|
|
1148
|
+
var value = instance.options.env[key];
|
|
1149
|
+
script.push("set " + key + "=" + value.replace(/([<>\\|&^])/g, "^$1"));
|
|
1150
|
+
}
|
|
1151
|
+
script.push(instance.command);
|
|
1152
|
+
script = script.join("\r\n");
|
|
1153
|
+
Node.fs.writeFile(instance.pathCommand, script, "utf-8", end);
|
|
1154
|
+
}
|
|
1155
|
+
function WindowsWriteExecuteScript(instance, end) {
|
|
1156
|
+
var script = [];
|
|
1157
|
+
script.push("@echo off");
|
|
1158
|
+
script.push("call \"" + instance.pathCommand + "\" > \"" + instance.pathStdout + "\" 2> \"" + instance.pathStderr + "\"");
|
|
1159
|
+
script.push("(echo %ERRORLEVEL%) > \"" + instance.pathStatus + "\"");
|
|
1160
|
+
script = script.join("\r\n");
|
|
1161
|
+
Node.fs.writeFile(instance.pathExecute, script, "utf-8", end);
|
|
1162
|
+
}
|
|
1163
|
+
module.exports.exec = Exec;
|
|
1164
|
+
var APPLET = "UEsDBAoAAAAAABg+cVMAAAAAAAAAAAAAAAAJABwAQ29udGVudHMvVVQJAAPQpZRh0qWUYXV4CwABBPUBAAAEFAAAAFBLAwQKAAAAAAANPnFTAAAAAAAAAAAAAAAADwAcAENvbnRlbnRzL01hY09TL1VUCQADuaWUYbmllGF1eAsAAQT1AQAABBQAAABQSwMEFAAAAA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Vzb3VyY2VzL1NjcmlwdHMvbWFpbi5zY3B0VVQFAANxog9XdXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAgHFwR3658rH2BgAAH9wAAB4AGAAAAAAAAAAAAKSBChAAAENvbnRlbnRzL1Jlc291cmNlcy9hcHBsZXQuaWNuc1VUBQADH9ZJVnV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAKBxcEeUdoaooQEAAL4DAAATABgAAAAAAAEAAACkgVgXAABDb250ZW50cy9JbmZvLnBsaXN0VVQFAANc1klWdXgLAAEE9QEAAAQUAAAAUEsBAh4DCgAAAAAA7VBwR6ogBnsIAAAACAAAABAAGAAAAAAAAQAAAKSBRhkAAENvbnRlbnRzL1BrZ0luZm9VVAUAA82cSVZ1eAsAAQT1AQAABBQAAABQSwUGAAAAAA0ADQDcBAAAmBkAAAAA";
|
|
1165
|
+
var PERMISSION_DENIED = "User did not grant permission.";
|
|
1166
|
+
var NO_POLKIT_AGENT = "No polkit authentication agent found.";
|
|
1167
|
+
var MAX_BUFFER = 134217728;
|
|
1168
|
+
}));
|
|
1169
|
+
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region ../../../node_modules/@expo/devcert/dist/utils.js
|
|
1172
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1173
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1174
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1175
|
+
};
|
|
1176
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1177
|
+
exports.openssl = openssl;
|
|
1178
|
+
exports.run = run;
|
|
1179
|
+
exports.sudoAppend = sudoAppend;
|
|
1180
|
+
exports.waitForUser = waitForUser;
|
|
1181
|
+
exports.reportableError = reportableError;
|
|
1182
|
+
exports.mktmp = mktmp;
|
|
1183
|
+
exports.sudo = sudo;
|
|
1184
|
+
exports.commandExists = commandExists;
|
|
1185
|
+
const child_process_1 = __require("child_process");
|
|
1186
|
+
const crypto_1 = __require("crypto");
|
|
1187
|
+
const fs_1$4 = __importDefault(__require("fs"));
|
|
1188
|
+
const os_1 = __importDefault(__require("os"));
|
|
1189
|
+
const debug_1 = __importDefault(require_src());
|
|
1190
|
+
const path_1$1 = __importDefault(__require("path"));
|
|
1191
|
+
const sudo_prompt_1 = __importDefault(require_sudo_prompt());
|
|
1192
|
+
const constants_1 = require_constants();
|
|
1193
|
+
const debug = (0, debug_1.default)("devcert:util");
|
|
1194
|
+
function openssl(args) {
|
|
1195
|
+
return run("openssl", args, {
|
|
1196
|
+
stdio: "pipe",
|
|
1197
|
+
env: Object.assign({ RANDFILE: path_1$1.default.join((0, constants_1.configPath)(".rnd")) }, process.env)
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
function run(cmd, args, options = {}) {
|
|
1201
|
+
debug(`execFileSync: \`${cmd} ${args.join(" ")}\``);
|
|
1202
|
+
return (0, child_process_1.execFileSync)(cmd, args, options);
|
|
1203
|
+
}
|
|
1204
|
+
function sudoAppend(file, input) {
|
|
1205
|
+
run("sudo", [
|
|
1206
|
+
"tee",
|
|
1207
|
+
"-a",
|
|
1208
|
+
file
|
|
1209
|
+
], { input });
|
|
1210
|
+
}
|
|
1211
|
+
function waitForUser() {
|
|
1212
|
+
return new Promise((resolve) => {
|
|
1213
|
+
process.stdin.resume();
|
|
1214
|
+
process.stdin.on("data", resolve);
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function reportableError(message) {
|
|
1218
|
+
return /* @__PURE__ */ new Error(`${message} | This is a bug in devcert, please report the issue at https://github.com/davewasmer/devcert/issues`);
|
|
1219
|
+
}
|
|
1220
|
+
function mktmp() {
|
|
1221
|
+
const random = (0, crypto_1.randomBytes)(6).toString("hex");
|
|
1222
|
+
const tmppath = path_1$1.default.join(os_1.default.tmpdir(), `tmp-${process.pid}${random}`);
|
|
1223
|
+
fs_1$4.default.closeSync(fs_1$4.default.openSync(tmppath, "w"));
|
|
1224
|
+
return tmppath;
|
|
1225
|
+
}
|
|
1226
|
+
function sudo(cmd) {
|
|
1227
|
+
return new Promise((resolve, reject) => {
|
|
1228
|
+
sudo_prompt_1.default.exec(cmd, { name: "devcert" }, (err, stdout, stderr) => {
|
|
1229
|
+
let error = err || typeof stderr === "string" && stderr.trim().length > 0 && new Error(stderr);
|
|
1230
|
+
error ? reject(error) : resolve(stdout);
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
const _commands = {};
|
|
1235
|
+
function commandExists(command) {
|
|
1236
|
+
if (_commands[command] !== void 0) return _commands[command];
|
|
1237
|
+
const paths = process.env[constants_1.isWindows ? "Path" : "PATH"].split(path_1$1.default.delimiter);
|
|
1238
|
+
const extensions = [...(process.env.PATHEXT || "").split(path_1$1.default.delimiter), ""];
|
|
1239
|
+
for (const dir of paths) for (const extension of extensions) {
|
|
1240
|
+
const filePath = path_1$1.default.join(dir, command + extension);
|
|
1241
|
+
try {
|
|
1242
|
+
fs_1$4.default.accessSync(filePath, fs_1$4.default.constants.X_OK);
|
|
1243
|
+
return _commands[command] = filePath;
|
|
1244
|
+
} catch (_a) {}
|
|
1245
|
+
}
|
|
1246
|
+
return _commands[command] = null;
|
|
1247
|
+
}
|
|
1248
|
+
}));
|
|
1249
|
+
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region ../../../node_modules/@expo/devcert/dist/constants.js
|
|
1252
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1253
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1254
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1255
|
+
};
|
|
1256
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1257
|
+
exports.rootCACertPath = exports.rootCAKeyPath = exports.rootCADir = exports.caSelfSignConfig = exports.opensslDatabaseFilePath = exports.opensslSerialFilePath = exports.caVersionFile = exports.pathForDomain = exports.domainsDir = exports.configPath = exports.configDir = exports.isWindows = exports.isLinux = exports.isMac = exports.VALID_DOMAIN = exports.VALID_IP = void 0;
|
|
1258
|
+
exports.withDomainSigningRequestConfig = withDomainSigningRequestConfig;
|
|
1259
|
+
exports.withDomainCertificateConfig = withDomainCertificateConfig;
|
|
1260
|
+
exports.getLegacyConfigDir = getLegacyConfigDir;
|
|
1261
|
+
exports.ensureConfigDirs = ensureConfigDirs;
|
|
1262
|
+
const path_1 = __importDefault(__require("path"));
|
|
1263
|
+
const fs_1$3 = __importDefault(__require("fs"));
|
|
1264
|
+
const utils_1 = require_utils();
|
|
1265
|
+
function applicationConfigPath(name) {
|
|
1266
|
+
switch (process.platform) {
|
|
1267
|
+
case "darwin": return path_1.default.join(process.env.HOME, "Library", "Application Support", name);
|
|
1268
|
+
case "win32": return process.env.LOCALAPPDATA ? path_1.default.join(process.env.LOCALAPPDATA, name) : path_1.default.join(process.env.USERPROFILE, "Local Settings", "Application Data", name);
|
|
1269
|
+
default: return process.env.XDG_CONFIG_HOME ? path_1.default.join(process.env.XDG_CONFIG_HOME, name) : path_1.default.join(process.env.HOME, ".config", name);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
exports.VALID_IP = /(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}/;
|
|
1273
|
+
exports.VALID_DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.?)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/i;
|
|
1274
|
+
exports.isMac = process.platform === "darwin";
|
|
1275
|
+
exports.isLinux = process.platform === "linux";
|
|
1276
|
+
exports.isWindows = process.platform === "win32";
|
|
1277
|
+
exports.configDir = applicationConfigPath("devcert");
|
|
1278
|
+
exports.configPath = path_1.default.join.bind(path_1.default, exports.configDir);
|
|
1279
|
+
exports.domainsDir = (0, exports.configPath)("domains");
|
|
1280
|
+
exports.pathForDomain = path_1.default.join.bind(path_1.default, exports.domainsDir);
|
|
1281
|
+
exports.caVersionFile = (0, exports.configPath)("devcert-ca-version");
|
|
1282
|
+
exports.opensslSerialFilePath = (0, exports.configPath)("certificate-authority", "serial");
|
|
1283
|
+
exports.opensslDatabaseFilePath = (0, exports.configPath)("certificate-authority", "index.txt");
|
|
1284
|
+
exports.caSelfSignConfig = path_1.default.join(__dirname, "../openssl-configurations/certificate-authority-self-signing.conf");
|
|
1285
|
+
function eolAuto(str) {
|
|
1286
|
+
return str.replace(/\r?\n|\r/g, exports.isWindows ? "\r\n" : "\n");
|
|
1287
|
+
}
|
|
1288
|
+
function withDomainSigningRequestConfig(domain, cb) {
|
|
1289
|
+
let tmpFile = (0, utils_1.mktmp)();
|
|
1290
|
+
let result = fs_1$3.default.readFileSync(path_1.default.join(__dirname, "../openssl-configurations/domain-certificate-signing-requests.conf"), "utf-8").replace(/%DOMAIN%/g, domain);
|
|
1291
|
+
fs_1$3.default.writeFileSync(tmpFile, eolAuto(result));
|
|
1292
|
+
cb(tmpFile);
|
|
1293
|
+
fs_1$3.default.rmSync(tmpFile);
|
|
1294
|
+
}
|
|
1295
|
+
function withDomainCertificateConfig(domain, cb) {
|
|
1296
|
+
let tmpFile = (0, utils_1.mktmp)();
|
|
1297
|
+
let result = fs_1$3.default.readFileSync(path_1.default.join(__dirname, "../openssl-configurations/domain-certificates.conf"), "utf-8").replace(/%DOMAIN%/g, domain).replace(/%SERIALFILE%/g, exports.opensslSerialFilePath.replace(/\\/g, "\\\\")).replace(/%DATABASEFILE%/g, exports.opensslDatabaseFilePath.replace(/\\/g, "\\\\")).replace(/%DOMAINDIR%/g, (0, exports.pathForDomain)(domain).replace(/\\/g, "\\\\"));
|
|
1298
|
+
fs_1$3.default.writeFileSync(tmpFile, eolAuto(result));
|
|
1299
|
+
cb(tmpFile);
|
|
1300
|
+
fs_1$3.default.rmSync(tmpFile);
|
|
1301
|
+
}
|
|
1302
|
+
exports.rootCADir = (0, exports.configPath)("certificate-authority");
|
|
1303
|
+
exports.rootCAKeyPath = (0, exports.configPath)("certificate-authority", "private-key.key");
|
|
1304
|
+
exports.rootCACertPath = (0, exports.configPath)("certificate-authority", "certificate.cert");
|
|
1305
|
+
function getLegacyConfigDir() {
|
|
1306
|
+
if (exports.isWindows && process.env.LOCALAPPDATA) return path_1.default.join(process.env.LOCALAPPDATA, "devcert", "config");
|
|
1307
|
+
else {
|
|
1308
|
+
let uid = process.getuid && process.getuid();
|
|
1309
|
+
let userHome = exports.isLinux && uid === 0 ? path_1.default.resolve("/usr/local/share") : __require("os").homedir();
|
|
1310
|
+
return path_1.default.join(userHome, ".config", "devcert");
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
function ensureConfigDirs() {
|
|
1314
|
+
fs_1$3.default.mkdirSync(exports.configDir, { recursive: true });
|
|
1315
|
+
fs_1$3.default.mkdirSync(exports.domainsDir, { recursive: true });
|
|
1316
|
+
fs_1$3.default.mkdirSync(exports.rootCADir, { recursive: true });
|
|
1317
|
+
}
|
|
1318
|
+
ensureConfigDirs();
|
|
1319
|
+
}));
|
|
1320
|
+
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region ../../../node_modules/@expo/devcert/dist/platforms/index.js
|
|
1323
|
+
var require_platforms = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1324
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1325
|
+
const PlatformClass = __require(`./${process.platform}`).default;
|
|
1326
|
+
exports.default = new PlatformClass();
|
|
1327
|
+
}));
|
|
1328
|
+
|
|
1329
|
+
//#endregion
|
|
1330
|
+
//#region ../../../node_modules/@expo/devcert/dist/certificates.js
|
|
1331
|
+
var require_certificates = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1332
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1333
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1334
|
+
};
|
|
1335
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1336
|
+
exports.default = generateDomainCertificate;
|
|
1337
|
+
exports.generateKey = generateKey;
|
|
1338
|
+
const debug_1 = __importDefault(require_src());
|
|
1339
|
+
const fs_1$2 = __importDefault(__require("fs"));
|
|
1340
|
+
const constants_1 = require_constants();
|
|
1341
|
+
const utils_1 = require_utils();
|
|
1342
|
+
const certificate_authority_1 = require_certificate_authority();
|
|
1343
|
+
const debug = (0, debug_1.default)("devcert:certificates");
|
|
1344
|
+
/**
|
|
1345
|
+
* Generate a domain certificate signed by the devcert root CA. Domain
|
|
1346
|
+
* certificates are cached in their own directories under
|
|
1347
|
+
* CONFIG_ROOT/domains/<domain>, and reused on subsequent requests. Because the
|
|
1348
|
+
* individual domain certificates are signed by the devcert root CA (which was
|
|
1349
|
+
* added to the OS/browser trust stores), they are trusted.
|
|
1350
|
+
*/
|
|
1351
|
+
async function generateDomainCertificate(domain) {
|
|
1352
|
+
await fs_1$2.default.promises.mkdir((0, constants_1.pathForDomain)(domain), { recursive: true });
|
|
1353
|
+
debug(`Generating private key for ${domain}`);
|
|
1354
|
+
let domainKeyPath = (0, constants_1.pathForDomain)(domain, "private-key.key");
|
|
1355
|
+
generateKey(domainKeyPath);
|
|
1356
|
+
debug(`Generating certificate signing request for ${domain}`);
|
|
1357
|
+
let csrFile = (0, constants_1.pathForDomain)(domain, `certificate-signing-request.csr`);
|
|
1358
|
+
(0, constants_1.withDomainSigningRequestConfig)(domain, (configpath) => {
|
|
1359
|
+
(0, utils_1.openssl)([
|
|
1360
|
+
"req",
|
|
1361
|
+
"-new",
|
|
1362
|
+
"-config",
|
|
1363
|
+
configpath,
|
|
1364
|
+
"-key",
|
|
1365
|
+
domainKeyPath,
|
|
1366
|
+
"-out",
|
|
1367
|
+
csrFile
|
|
1368
|
+
]);
|
|
1369
|
+
});
|
|
1370
|
+
debug(`Generating certificate for ${domain} from signing request and signing with root CA`);
|
|
1371
|
+
let domainCertPath = (0, constants_1.pathForDomain)(domain, `certificate.crt`);
|
|
1372
|
+
await (0, certificate_authority_1.withCertificateAuthorityCredentials)(({ caKeyPath, caCertPath }) => {
|
|
1373
|
+
(0, constants_1.withDomainCertificateConfig)(domain, (domainCertConfigPath) => {
|
|
1374
|
+
(0, utils_1.openssl)([
|
|
1375
|
+
"ca",
|
|
1376
|
+
"-config",
|
|
1377
|
+
domainCertConfigPath,
|
|
1378
|
+
"-in",
|
|
1379
|
+
csrFile,
|
|
1380
|
+
"-out",
|
|
1381
|
+
domainCertPath,
|
|
1382
|
+
"-keyfile",
|
|
1383
|
+
caKeyPath,
|
|
1384
|
+
"-cert",
|
|
1385
|
+
caCertPath,
|
|
1386
|
+
"-days",
|
|
1387
|
+
"825",
|
|
1388
|
+
"-batch"
|
|
1389
|
+
]);
|
|
1390
|
+
});
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
function generateKey(filename) {
|
|
1394
|
+
debug(`generateKey: ${filename}`);
|
|
1395
|
+
(0, utils_1.openssl)([
|
|
1396
|
+
"genrsa",
|
|
1397
|
+
"-out",
|
|
1398
|
+
filename,
|
|
1399
|
+
"2048"
|
|
1400
|
+
]);
|
|
1401
|
+
fs_1$2.default.chmodSync(filename, 400);
|
|
1402
|
+
}
|
|
1403
|
+
}));
|
|
1404
|
+
|
|
1405
|
+
//#endregion
|
|
1406
|
+
//#region ../../../node_modules/@expo/devcert/dist/certificate-authority.js
|
|
1407
|
+
var require_certificate_authority = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1408
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1409
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1410
|
+
};
|
|
1411
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1412
|
+
exports.default = installCertificateAuthority;
|
|
1413
|
+
exports.withCertificateAuthorityCredentials = withCertificateAuthorityCredentials;
|
|
1414
|
+
exports.ensureCACertReadable = ensureCACertReadable;
|
|
1415
|
+
exports.uninstall = uninstall;
|
|
1416
|
+
const fs_1$1 = __require("fs");
|
|
1417
|
+
const debug_1 = __importDefault(require_src());
|
|
1418
|
+
const constants_1 = require_constants();
|
|
1419
|
+
const platforms_1 = __importDefault(require_platforms());
|
|
1420
|
+
const utils_1 = require_utils();
|
|
1421
|
+
const certificates_1 = require_certificates();
|
|
1422
|
+
const debug = (0, debug_1.default)("devcert:certificate-authority");
|
|
1423
|
+
/**
|
|
1424
|
+
* Install the once-per-machine trusted root CA. We'll use this CA to sign
|
|
1425
|
+
* per-app certs.
|
|
1426
|
+
*/
|
|
1427
|
+
async function installCertificateAuthority(options = {}) {
|
|
1428
|
+
debug(`Uninstalling existing certificates, which will be void once any existing CA is gone`);
|
|
1429
|
+
uninstall();
|
|
1430
|
+
(0, constants_1.ensureConfigDirs)();
|
|
1431
|
+
debug(`Making a temp working directory for files to copied in`);
|
|
1432
|
+
let rootKeyPath = (0, utils_1.mktmp)();
|
|
1433
|
+
debug(`Generating the OpenSSL configuration needed to setup the certificate authority`);
|
|
1434
|
+
seedConfigFiles();
|
|
1435
|
+
debug(`Generating a private key`);
|
|
1436
|
+
(0, certificates_1.generateKey)(rootKeyPath);
|
|
1437
|
+
debug(`Generating a CA certificate`);
|
|
1438
|
+
(0, utils_1.openssl)([
|
|
1439
|
+
"req",
|
|
1440
|
+
"-new",
|
|
1441
|
+
"-x509",
|
|
1442
|
+
"-config",
|
|
1443
|
+
constants_1.caSelfSignConfig,
|
|
1444
|
+
"-key",
|
|
1445
|
+
rootKeyPath,
|
|
1446
|
+
"-out",
|
|
1447
|
+
constants_1.rootCACertPath,
|
|
1448
|
+
"-days",
|
|
1449
|
+
"825"
|
|
1450
|
+
]);
|
|
1451
|
+
debug("Saving certificate authority credentials");
|
|
1452
|
+
await saveCertificateAuthorityCredentials(rootKeyPath);
|
|
1453
|
+
debug(`Adding the root certificate authority to trust stores`);
|
|
1454
|
+
await platforms_1.default.addToTrustStores(constants_1.rootCACertPath, options);
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Initializes the files OpenSSL needs to sign certificates as a certificate
|
|
1458
|
+
* authority, as well as our CA setup version
|
|
1459
|
+
*/
|
|
1460
|
+
function seedConfigFiles() {
|
|
1461
|
+
(0, fs_1$1.writeFileSync)(constants_1.caVersionFile, "2");
|
|
1462
|
+
(0, fs_1$1.writeFileSync)(constants_1.opensslDatabaseFilePath, "");
|
|
1463
|
+
(0, fs_1$1.writeFileSync)(constants_1.opensslSerialFilePath, "01");
|
|
1464
|
+
}
|
|
1465
|
+
async function withCertificateAuthorityCredentials(cb) {
|
|
1466
|
+
debug(`Retrieving devcert's certificate authority credentials`);
|
|
1467
|
+
let tmpCAKeyPath = (0, utils_1.mktmp)();
|
|
1468
|
+
let caKey = await platforms_1.default.readProtectedFile(constants_1.rootCAKeyPath);
|
|
1469
|
+
(0, fs_1$1.writeFileSync)(tmpCAKeyPath, caKey);
|
|
1470
|
+
await cb({
|
|
1471
|
+
caKeyPath: tmpCAKeyPath,
|
|
1472
|
+
caCertPath: constants_1.rootCACertPath
|
|
1473
|
+
});
|
|
1474
|
+
(0, fs_1$1.unlinkSync)(tmpCAKeyPath);
|
|
1475
|
+
}
|
|
1476
|
+
async function saveCertificateAuthorityCredentials(keypath) {
|
|
1477
|
+
debug(`Saving devcert's certificate authority credentials`);
|
|
1478
|
+
let key = (0, fs_1$1.readFileSync)(keypath, "utf-8");
|
|
1479
|
+
await platforms_1.default.writeProtectedFile(constants_1.rootCAKeyPath, key);
|
|
1480
|
+
}
|
|
1481
|
+
function certErrors() {
|
|
1482
|
+
try {
|
|
1483
|
+
(0, utils_1.openssl)([
|
|
1484
|
+
"x509",
|
|
1485
|
+
"-in",
|
|
1486
|
+
constants_1.rootCACertPath,
|
|
1487
|
+
"-noout"
|
|
1488
|
+
]);
|
|
1489
|
+
return "";
|
|
1490
|
+
} catch (e) {
|
|
1491
|
+
return e.toString();
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Smoothly migrate the certificate storage from v1.0.x to >= v1.1.0.
|
|
1496
|
+
* In v1.1.0 there are new options for retrieving the CA cert directly,
|
|
1497
|
+
* to help third-party Node apps trust the root CA.
|
|
1498
|
+
*
|
|
1499
|
+
* If a v1.0.x cert already exists, then devcert has written it with
|
|
1500
|
+
* platform.writeProtectedFile(), so an unprivileged readFile cannot access it.
|
|
1501
|
+
* Pre-detect and remedy this; it should only happen once per installation.
|
|
1502
|
+
*/
|
|
1503
|
+
async function ensureCACertReadable(options = {}) {
|
|
1504
|
+
if (!certErrors()) return;
|
|
1505
|
+
/**
|
|
1506
|
+
* on windows, writeProtectedFile left the cert encrypted on *nix, the cert
|
|
1507
|
+
* has no read permissions either way, openssl will fail and that means we
|
|
1508
|
+
* have to fix it
|
|
1509
|
+
*/
|
|
1510
|
+
try {
|
|
1511
|
+
const caFileContents = await platforms_1.default.readProtectedFile(constants_1.rootCACertPath);
|
|
1512
|
+
await platforms_1.default.deleteProtectedFiles(constants_1.rootCACertPath);
|
|
1513
|
+
(0, fs_1$1.writeFileSync)(constants_1.rootCACertPath, caFileContents);
|
|
1514
|
+
} catch (e) {
|
|
1515
|
+
return await installCertificateAuthority(options);
|
|
1516
|
+
}
|
|
1517
|
+
if (certErrors()) return await installCertificateAuthority(options);
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Remove as much of the devcert files and state as we can. This is necessary
|
|
1521
|
+
* when generating a new root certificate, and should be available to API
|
|
1522
|
+
* consumers as well.
|
|
1523
|
+
*
|
|
1524
|
+
* Not all of it will be removable. If certutil is not installed, we'll leave
|
|
1525
|
+
* Firefox alone. We try to remove files with maximum permissions, and if that
|
|
1526
|
+
* fails, we'll silently fail.
|
|
1527
|
+
*
|
|
1528
|
+
* It's also possible that the command to untrust will not work, and we'll
|
|
1529
|
+
* silently fail that as well; with no existing certificates anymore, the
|
|
1530
|
+
* security exposure there is minimal.
|
|
1531
|
+
*/
|
|
1532
|
+
async function uninstall() {
|
|
1533
|
+
await platforms_1.default.removeFromTrustStores(constants_1.rootCACertPath);
|
|
1534
|
+
await platforms_1.default.deleteProtectedFiles(constants_1.domainsDir);
|
|
1535
|
+
await platforms_1.default.deleteProtectedFiles(constants_1.rootCADir);
|
|
1536
|
+
await platforms_1.default.deleteProtectedFiles((0, constants_1.getLegacyConfigDir)());
|
|
1537
|
+
}
|
|
1538
|
+
}));
|
|
1539
|
+
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region ../../../node_modules/@expo/devcert/dist/user-interface.js
|
|
1542
|
+
var require_user_interface = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1543
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1544
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1545
|
+
};
|
|
1546
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1547
|
+
const node_readline_1 = __importDefault(__require("node:readline"));
|
|
1548
|
+
const utils_1 = require_utils();
|
|
1549
|
+
async function passwordPrompt(prompt) {
|
|
1550
|
+
const input = node_readline_1.default.createInterface({
|
|
1551
|
+
input: process.stdin,
|
|
1552
|
+
output: process.stdout
|
|
1553
|
+
});
|
|
1554
|
+
return new Promise((resolve, reject) => {
|
|
1555
|
+
input.on("SIGINT", () => {
|
|
1556
|
+
reject(/* @__PURE__ */ new Error("SIGINT"));
|
|
1557
|
+
});
|
|
1558
|
+
input.question(prompt, (answer) => {
|
|
1559
|
+
node_readline_1.default.moveCursor(process.stdout, 0, -1);
|
|
1560
|
+
node_readline_1.default.clearLine(process.stdout, 0);
|
|
1561
|
+
input.write(prompt + answer.replace(/./g, "*") + "\n");
|
|
1562
|
+
input.close();
|
|
1563
|
+
resolve(answer);
|
|
1564
|
+
});
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
const DefaultUI = {
|
|
1568
|
+
async getWindowsEncryptionPassword() {
|
|
1569
|
+
return await passwordPrompt("devcert password (http://bit.ly/devcert-what-password?):");
|
|
1570
|
+
},
|
|
1571
|
+
async warnChromeOnLinuxWithoutCertutil() {
|
|
1572
|
+
console.warn(`
|
|
1573
|
+
WARNING: It looks like you have Chrome installed, but you specified
|
|
1574
|
+
'skipCertutilInstall: true'. Unfortunately, without installing
|
|
1575
|
+
certutil, it's impossible get Chrome to trust devcert's certificates
|
|
1576
|
+
The certificates will work, but Chrome will continue to warn you that
|
|
1577
|
+
they are untrusted.
|
|
1578
|
+
`);
|
|
1579
|
+
},
|
|
1580
|
+
async closeFirefoxBeforeContinuing() {
|
|
1581
|
+
console.log("Please close Firefox before continuing");
|
|
1582
|
+
},
|
|
1583
|
+
async startFirefoxWizard(certificateHost) {
|
|
1584
|
+
console.log(`
|
|
1585
|
+
devcert was unable to automatically configure Firefox. You'll need to
|
|
1586
|
+
complete this process manually. Don't worry though - Firefox will walk
|
|
1587
|
+
you through it.
|
|
1588
|
+
|
|
1589
|
+
When you're ready, hit any key to continue. Firefox will launch and
|
|
1590
|
+
display a wizard to walk you through how to trust the devcert
|
|
1591
|
+
certificate. When you are finished, come back here and we'll finish up.
|
|
1592
|
+
|
|
1593
|
+
(If Firefox doesn't start, go ahead and start it and navigate to
|
|
1594
|
+
${certificateHost} in a new tab.)
|
|
1595
|
+
|
|
1596
|
+
If you are curious about why all this is necessary, check out
|
|
1597
|
+
https://github.com/davewasmer/devcert#how-it-works
|
|
1598
|
+
|
|
1599
|
+
<Press any key to launch Firefox wizard>
|
|
1600
|
+
`);
|
|
1601
|
+
await (0, utils_1.waitForUser)();
|
|
1602
|
+
},
|
|
1603
|
+
async firefoxWizardPromptPage(certificateURL) {
|
|
1604
|
+
return `
|
|
1605
|
+
<html>
|
|
1606
|
+
<head>
|
|
1607
|
+
<meta http-equiv="refresh" content="0; url=${certificateURL}" />
|
|
1608
|
+
</head>
|
|
1609
|
+
</html>
|
|
1610
|
+
`;
|
|
1611
|
+
},
|
|
1612
|
+
async waitForFirefoxWizard() {
|
|
1613
|
+
console.log(`
|
|
1614
|
+
Launching Firefox ...
|
|
1615
|
+
|
|
1616
|
+
Great! Once you've finished the Firefox wizard for adding the devcert
|
|
1617
|
+
certificate, just hit any key here again and we'll wrap up.
|
|
1618
|
+
|
|
1619
|
+
<Press any key to continue>
|
|
1620
|
+
`);
|
|
1621
|
+
await (0, utils_1.waitForUser)();
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
exports.default = DefaultUI;
|
|
1625
|
+
}));
|
|
1626
|
+
|
|
1627
|
+
//#endregion
|
|
1628
|
+
//#region ../../../node_modules/@expo/devcert/dist/index.js
|
|
1629
|
+
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1630
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1631
|
+
if (k2 === void 0) k2 = k;
|
|
1632
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1633
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
1634
|
+
enumerable: true,
|
|
1635
|
+
get: function() {
|
|
1636
|
+
return m[k];
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
Object.defineProperty(o, k2, desc);
|
|
1640
|
+
}) : (function(o, m, k, k2) {
|
|
1641
|
+
if (k2 === void 0) k2 = k;
|
|
1642
|
+
o[k2] = m[k];
|
|
1643
|
+
}));
|
|
1644
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1645
|
+
Object.defineProperty(o, "default", {
|
|
1646
|
+
enumerable: true,
|
|
1647
|
+
value: v
|
|
1648
|
+
});
|
|
1649
|
+
}) : function(o, v) {
|
|
1650
|
+
o["default"] = v;
|
|
1651
|
+
});
|
|
1652
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1653
|
+
if (mod && mod.__esModule) return mod;
|
|
1654
|
+
var result = {};
|
|
1655
|
+
if (mod != null) {
|
|
1656
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1657
|
+
}
|
|
1658
|
+
__setModuleDefault(result, mod);
|
|
1659
|
+
return result;
|
|
1660
|
+
};
|
|
1661
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1662
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1663
|
+
};
|
|
1664
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1665
|
+
exports.uninstall = void 0;
|
|
1666
|
+
exports.certificateFor = certificateFor;
|
|
1667
|
+
exports.hasCertificateFor = hasCertificateFor;
|
|
1668
|
+
exports.configuredDomains = configuredDomains;
|
|
1669
|
+
exports.removeDomain = removeDomain;
|
|
1670
|
+
const fs_1 = __require("fs");
|
|
1671
|
+
const debug_1 = __importDefault(require_src());
|
|
1672
|
+
const constants_1 = require_constants();
|
|
1673
|
+
const platforms_1 = __importDefault(require_platforms());
|
|
1674
|
+
const utils_1 = require_utils();
|
|
1675
|
+
const certificate_authority_1 = __importStar(require_certificate_authority());
|
|
1676
|
+
Object.defineProperty(exports, "uninstall", {
|
|
1677
|
+
enumerable: true,
|
|
1678
|
+
get: function() {
|
|
1679
|
+
return certificate_authority_1.uninstall;
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
const certificates_1 = __importDefault(require_certificates());
|
|
1683
|
+
const user_interface_1 = __importDefault(require_user_interface());
|
|
1684
|
+
const debug = (0, debug_1.default)("devcert");
|
|
1685
|
+
/**
|
|
1686
|
+
* Request an SSL certificate for the given app name signed by the devcert root
|
|
1687
|
+
* certificate authority. If devcert has previously generated a certificate for
|
|
1688
|
+
* that app name on this machine, it will reuse that certificate.
|
|
1689
|
+
*
|
|
1690
|
+
* If this is the first time devcert is being run on this machine, it will
|
|
1691
|
+
* generate and attempt to install a root certificate authority.
|
|
1692
|
+
*
|
|
1693
|
+
* Returns a promise that resolves with { key, cert }, where `key` and `cert`
|
|
1694
|
+
* are Buffers with the contents of the certificate private key and certificate
|
|
1695
|
+
* file, respectively
|
|
1696
|
+
*
|
|
1697
|
+
* If `options.getCaBuffer` is true, return value will include the ca certificate data
|
|
1698
|
+
* as { ca: Buffer }
|
|
1699
|
+
*
|
|
1700
|
+
* If `options.getCaPath` is true, return value will include the ca certificate path
|
|
1701
|
+
* as { caPath: string }
|
|
1702
|
+
*/
|
|
1703
|
+
async function certificateFor(domain, options = {}) {
|
|
1704
|
+
if (constants_1.VALID_IP.test(domain)) throw new Error("IP addresses are not supported currently");
|
|
1705
|
+
if (!constants_1.VALID_DOMAIN.test(domain)) throw new Error(`"${domain}" is not a valid domain name.`);
|
|
1706
|
+
debug(`Certificate requested for ${domain}. Skipping certutil install: ${Boolean(options.skipCertutilInstall)}. Skipping hosts file: ${Boolean(options.skipHostsFile)}`);
|
|
1707
|
+
if (options.ui) Object.assign(user_interface_1.default, options.ui);
|
|
1708
|
+
if (!constants_1.isMac && !constants_1.isLinux && !constants_1.isWindows) throw new Error(`Platform not supported: "${process.platform}"`);
|
|
1709
|
+
if (!(0, utils_1.commandExists)("openssl")) throw new Error("OpenSSL not found: OpenSSL is required to generate SSL certificates - make sure it is installed and available in your PATH");
|
|
1710
|
+
let domainKeyPath = (0, constants_1.pathForDomain)(domain, `private-key.key`);
|
|
1711
|
+
let domainCertPath = (0, constants_1.pathForDomain)(domain, `certificate.crt`);
|
|
1712
|
+
if (!(0, fs_1.existsSync)(constants_1.rootCAKeyPath)) {
|
|
1713
|
+
debug("Root CA is not installed yet, so it must be our first run. Installing root CA ...");
|
|
1714
|
+
await (0, certificate_authority_1.default)(options);
|
|
1715
|
+
} else if (options.getCaBuffer || options.getCaPath) {
|
|
1716
|
+
debug("Root CA is not readable, but it probably is because an earlier version of devcert locked it. Trying to fix...");
|
|
1717
|
+
await (0, certificate_authority_1.ensureCACertReadable)(options);
|
|
1718
|
+
}
|
|
1719
|
+
if (!(0, fs_1.existsSync)((0, constants_1.pathForDomain)(domain, `certificate.crt`))) {
|
|
1720
|
+
debug(`Can't find certificate file for ${domain}, so it must be the first request for ${domain}. Generating and caching ...`);
|
|
1721
|
+
await (0, certificates_1.default)(domain);
|
|
1722
|
+
}
|
|
1723
|
+
if (!options.skipHostsFile) await platforms_1.default.addDomainToHostFileIfMissing(domain);
|
|
1724
|
+
debug(`Returning domain certificate`);
|
|
1725
|
+
const ret = {
|
|
1726
|
+
key: (0, fs_1.readFileSync)(domainKeyPath),
|
|
1727
|
+
cert: (0, fs_1.readFileSync)(domainCertPath)
|
|
1728
|
+
};
|
|
1729
|
+
if (options.getCaBuffer) ret.ca = (0, fs_1.readFileSync)(constants_1.rootCACertPath);
|
|
1730
|
+
if (options.getCaPath) ret.caPath = constants_1.rootCACertPath;
|
|
1731
|
+
return ret;
|
|
1732
|
+
}
|
|
1733
|
+
function hasCertificateFor(domain) {
|
|
1734
|
+
return (0, fs_1.existsSync)((0, constants_1.pathForDomain)(domain, `certificate.crt`));
|
|
1735
|
+
}
|
|
1736
|
+
function configuredDomains() {
|
|
1737
|
+
return (0, fs_1.readdirSync)(constants_1.domainsDir);
|
|
1738
|
+
}
|
|
1739
|
+
function removeDomain(domain) {
|
|
1740
|
+
return (0, fs_1.rmSync)((0, constants_1.pathForDomain)(domain), {
|
|
1741
|
+
force: true,
|
|
1742
|
+
recursive: true
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}));
|
|
1746
|
+
|
|
1747
|
+
//#endregion
|
|
1748
|
+
export default require_dist();
|
|
1749
|
+
|
|
1750
|
+
export { };
|