@codemcp/skills 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,857 @@
1
+ import { n as __require, t as __commonJSMin } from "../../rolldown-runtime.mjs";
2
+ var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3
+ /**
4
+ * Helpers.
5
+ */
6
+ var s = 1e3;
7
+ var m = s * 60;
8
+ var h = m * 60;
9
+ var d = h * 24;
10
+ var w = d * 7;
11
+ var y = d * 365.25;
12
+ /**
13
+ * Parse or format the given `val`.
14
+ *
15
+ * Options:
16
+ *
17
+ * - `long` verbose formatting [false]
18
+ *
19
+ * @param {String|Number} val
20
+ * @param {Object} [options]
21
+ * @throws {Error} throw an error if val is not a non-empty string or a number
22
+ * @return {String|Number}
23
+ * @api public
24
+ */
25
+ module.exports = function(val, options) {
26
+ options = options || {};
27
+ var type = typeof val;
28
+ if (type === "string" && val.length > 0) return parse(val);
29
+ else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
30
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
31
+ };
32
+ /**
33
+ * Parse the given `str` and return milliseconds.
34
+ *
35
+ * @param {String} str
36
+ * @return {Number}
37
+ * @api private
38
+ */
39
+ function parse(str) {
40
+ str = String(str);
41
+ if (str.length > 100) return;
42
+ 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);
43
+ if (!match) return;
44
+ var n = parseFloat(match[1]);
45
+ switch ((match[2] || "ms").toLowerCase()) {
46
+ case "years":
47
+ case "year":
48
+ case "yrs":
49
+ case "yr":
50
+ case "y": return n * y;
51
+ case "weeks":
52
+ case "week":
53
+ case "w": return n * w;
54
+ case "days":
55
+ case "day":
56
+ case "d": return n * d;
57
+ case "hours":
58
+ case "hour":
59
+ case "hrs":
60
+ case "hr":
61
+ case "h": return n * h;
62
+ case "minutes":
63
+ case "minute":
64
+ case "mins":
65
+ case "min":
66
+ case "m": return n * m;
67
+ case "seconds":
68
+ case "second":
69
+ case "secs":
70
+ case "sec":
71
+ case "s": return n * s;
72
+ case "milliseconds":
73
+ case "millisecond":
74
+ case "msecs":
75
+ case "msec":
76
+ case "ms": return n;
77
+ default: return;
78
+ }
79
+ }
80
+ /**
81
+ * Short format for `ms`.
82
+ *
83
+ * @param {Number} ms
84
+ * @return {String}
85
+ * @api private
86
+ */
87
+ function fmtShort(ms) {
88
+ var msAbs = Math.abs(ms);
89
+ if (msAbs >= d) return Math.round(ms / d) + "d";
90
+ if (msAbs >= h) return Math.round(ms / h) + "h";
91
+ if (msAbs >= m) return Math.round(ms / m) + "m";
92
+ if (msAbs >= s) return Math.round(ms / s) + "s";
93
+ return ms + "ms";
94
+ }
95
+ /**
96
+ * Long format for `ms`.
97
+ *
98
+ * @param {Number} ms
99
+ * @return {String}
100
+ * @api private
101
+ */
102
+ function fmtLong(ms) {
103
+ var msAbs = Math.abs(ms);
104
+ if (msAbs >= d) return plural(ms, msAbs, d, "day");
105
+ if (msAbs >= h) return plural(ms, msAbs, h, "hour");
106
+ if (msAbs >= m) return plural(ms, msAbs, m, "minute");
107
+ if (msAbs >= s) return plural(ms, msAbs, s, "second");
108
+ return ms + " ms";
109
+ }
110
+ /**
111
+ * Pluralization helper.
112
+ */
113
+ function plural(ms, msAbs, n, name) {
114
+ var isPlural = msAbs >= n * 1.5;
115
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
116
+ }
117
+ }));
118
+ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119
+ /**
120
+ * This is the common logic for both the Node.js and web browser
121
+ * implementations of `debug()`.
122
+ */
123
+ function setup(env) {
124
+ createDebug.debug = createDebug;
125
+ createDebug.default = createDebug;
126
+ createDebug.coerce = coerce;
127
+ createDebug.disable = disable;
128
+ createDebug.enable = enable;
129
+ createDebug.enabled = enabled;
130
+ createDebug.humanize = require_ms();
131
+ createDebug.destroy = destroy;
132
+ Object.keys(env).forEach((key) => {
133
+ createDebug[key] = env[key];
134
+ });
135
+ /**
136
+ * The currently active debug mode names, and names to skip.
137
+ */
138
+ createDebug.names = [];
139
+ createDebug.skips = [];
140
+ /**
141
+ * Map of special "%n" handling functions, for the debug "format" argument.
142
+ *
143
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
144
+ */
145
+ createDebug.formatters = {};
146
+ /**
147
+ * Selects a color for a debug namespace
148
+ * @param {String} namespace The namespace string for the debug instance to be colored
149
+ * @return {Number|String} An ANSI color code for the given namespace
150
+ * @api private
151
+ */
152
+ function selectColor(namespace) {
153
+ let hash = 0;
154
+ for (let i = 0; i < namespace.length; i++) {
155
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
156
+ hash |= 0;
157
+ }
158
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
159
+ }
160
+ createDebug.selectColor = selectColor;
161
+ /**
162
+ * Create a debugger with the given `namespace`.
163
+ *
164
+ * @param {String} namespace
165
+ * @return {Function}
166
+ * @api public
167
+ */
168
+ function createDebug(namespace) {
169
+ let prevTime;
170
+ let enableOverride = null;
171
+ let namespacesCache;
172
+ let enabledCache;
173
+ function debug(...args) {
174
+ if (!debug.enabled) return;
175
+ const self = debug;
176
+ const curr = Number(/* @__PURE__ */ new Date());
177
+ self.diff = curr - (prevTime || curr);
178
+ self.prev = prevTime;
179
+ self.curr = curr;
180
+ prevTime = curr;
181
+ args[0] = createDebug.coerce(args[0]);
182
+ if (typeof args[0] !== "string") args.unshift("%O");
183
+ let index = 0;
184
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
185
+ if (match === "%%") return "%";
186
+ index++;
187
+ const formatter = createDebug.formatters[format];
188
+ if (typeof formatter === "function") {
189
+ const val = args[index];
190
+ match = formatter.call(self, val);
191
+ args.splice(index, 1);
192
+ index--;
193
+ }
194
+ return match;
195
+ });
196
+ createDebug.formatArgs.call(self, args);
197
+ (self.log || createDebug.log).apply(self, args);
198
+ }
199
+ debug.namespace = namespace;
200
+ debug.useColors = createDebug.useColors();
201
+ debug.color = createDebug.selectColor(namespace);
202
+ debug.extend = extend;
203
+ debug.destroy = createDebug.destroy;
204
+ Object.defineProperty(debug, "enabled", {
205
+ enumerable: true,
206
+ configurable: false,
207
+ get: () => {
208
+ if (enableOverride !== null) return enableOverride;
209
+ if (namespacesCache !== createDebug.namespaces) {
210
+ namespacesCache = createDebug.namespaces;
211
+ enabledCache = createDebug.enabled(namespace);
212
+ }
213
+ return enabledCache;
214
+ },
215
+ set: (v) => {
216
+ enableOverride = v;
217
+ }
218
+ });
219
+ if (typeof createDebug.init === "function") createDebug.init(debug);
220
+ return debug;
221
+ }
222
+ function extend(namespace, delimiter) {
223
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
224
+ newDebug.log = this.log;
225
+ return newDebug;
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.namespaces = namespaces;
237
+ createDebug.names = [];
238
+ createDebug.skips = [];
239
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
240
+ for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
241
+ else createDebug.names.push(ns);
242
+ }
243
+ /**
244
+ * Checks if the given string matches a namespace template, honoring
245
+ * asterisks as wildcards.
246
+ *
247
+ * @param {String} search
248
+ * @param {String} template
249
+ * @return {Boolean}
250
+ */
251
+ function matchesTemplate(search, template) {
252
+ let searchIndex = 0;
253
+ let templateIndex = 0;
254
+ let starIndex = -1;
255
+ let matchIndex = 0;
256
+ while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
257
+ starIndex = templateIndex;
258
+ matchIndex = searchIndex;
259
+ templateIndex++;
260
+ } else {
261
+ searchIndex++;
262
+ templateIndex++;
263
+ }
264
+ else if (starIndex !== -1) {
265
+ templateIndex = starIndex + 1;
266
+ matchIndex++;
267
+ searchIndex = matchIndex;
268
+ } else return false;
269
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
270
+ return templateIndex === template.length;
271
+ }
272
+ /**
273
+ * Disable debug output.
274
+ *
275
+ * @return {String} namespaces
276
+ * @api public
277
+ */
278
+ function disable() {
279
+ const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
280
+ createDebug.enable("");
281
+ return namespaces;
282
+ }
283
+ /**
284
+ * Returns true if the given mode name is enabled, false otherwise.
285
+ *
286
+ * @param {String} name
287
+ * @return {Boolean}
288
+ * @api public
289
+ */
290
+ function enabled(name) {
291
+ for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
292
+ for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
293
+ return false;
294
+ }
295
+ /**
296
+ * Coerce `val`.
297
+ *
298
+ * @param {Mixed} val
299
+ * @return {Mixed}
300
+ * @api private
301
+ */
302
+ function coerce(val) {
303
+ if (val instanceof Error) return val.stack || val.message;
304
+ return val;
305
+ }
306
+ /**
307
+ * XXX DO NOT USE. This is a temporary stub function.
308
+ * XXX It WILL be removed in the next major release.
309
+ */
310
+ function destroy() {
311
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
312
+ }
313
+ createDebug.enable(createDebug.load());
314
+ return createDebug;
315
+ }
316
+ module.exports = setup;
317
+ }));
318
+ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
319
+ /**
320
+ * This is the web browser implementation of `debug()`.
321
+ */
322
+ exports.formatArgs = formatArgs;
323
+ exports.save = save;
324
+ exports.load = load;
325
+ exports.useColors = useColors;
326
+ exports.storage = localstorage();
327
+ exports.destroy = (() => {
328
+ let warned = false;
329
+ return () => {
330
+ if (!warned) {
331
+ warned = true;
332
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
333
+ }
334
+ };
335
+ })();
336
+ /**
337
+ * Colors.
338
+ */
339
+ exports.colors = [
340
+ "#0000CC",
341
+ "#0000FF",
342
+ "#0033CC",
343
+ "#0033FF",
344
+ "#0066CC",
345
+ "#0066FF",
346
+ "#0099CC",
347
+ "#0099FF",
348
+ "#00CC00",
349
+ "#00CC33",
350
+ "#00CC66",
351
+ "#00CC99",
352
+ "#00CCCC",
353
+ "#00CCFF",
354
+ "#3300CC",
355
+ "#3300FF",
356
+ "#3333CC",
357
+ "#3333FF",
358
+ "#3366CC",
359
+ "#3366FF",
360
+ "#3399CC",
361
+ "#3399FF",
362
+ "#33CC00",
363
+ "#33CC33",
364
+ "#33CC66",
365
+ "#33CC99",
366
+ "#33CCCC",
367
+ "#33CCFF",
368
+ "#6600CC",
369
+ "#6600FF",
370
+ "#6633CC",
371
+ "#6633FF",
372
+ "#66CC00",
373
+ "#66CC33",
374
+ "#9900CC",
375
+ "#9900FF",
376
+ "#9933CC",
377
+ "#9933FF",
378
+ "#99CC00",
379
+ "#99CC33",
380
+ "#CC0000",
381
+ "#CC0033",
382
+ "#CC0066",
383
+ "#CC0099",
384
+ "#CC00CC",
385
+ "#CC00FF",
386
+ "#CC3300",
387
+ "#CC3333",
388
+ "#CC3366",
389
+ "#CC3399",
390
+ "#CC33CC",
391
+ "#CC33FF",
392
+ "#CC6600",
393
+ "#CC6633",
394
+ "#CC9900",
395
+ "#CC9933",
396
+ "#CCCC00",
397
+ "#CCCC33",
398
+ "#FF0000",
399
+ "#FF0033",
400
+ "#FF0066",
401
+ "#FF0099",
402
+ "#FF00CC",
403
+ "#FF00FF",
404
+ "#FF3300",
405
+ "#FF3333",
406
+ "#FF3366",
407
+ "#FF3399",
408
+ "#FF33CC",
409
+ "#FF33FF",
410
+ "#FF6600",
411
+ "#FF6633",
412
+ "#FF9900",
413
+ "#FF9933",
414
+ "#FFCC00",
415
+ "#FFCC33"
416
+ ];
417
+ /**
418
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
419
+ * and the Firebug extension (any Firefox version) are known
420
+ * to support "%c" CSS customizations.
421
+ *
422
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
423
+ */
424
+ function useColors() {
425
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
426
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
427
+ let m;
428
+ 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 && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
429
+ }
430
+ /**
431
+ * Colorize log arguments if enabled.
432
+ *
433
+ * @api public
434
+ */
435
+ function formatArgs(args) {
436
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
437
+ if (!this.useColors) return;
438
+ const c = "color: " + this.color;
439
+ args.splice(1, 0, c, "color: inherit");
440
+ let index = 0;
441
+ let lastC = 0;
442
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
443
+ if (match === "%%") return;
444
+ index++;
445
+ if (match === "%c") lastC = index;
446
+ });
447
+ args.splice(lastC, 0, c);
448
+ }
449
+ /**
450
+ * Invokes `console.debug()` when available.
451
+ * No-op when `console.debug` is not a "function".
452
+ * If `console.debug` is not available, falls back
453
+ * to `console.log`.
454
+ *
455
+ * @api public
456
+ */
457
+ exports.log = console.debug || console.log || (() => {});
458
+ /**
459
+ * Save `namespaces`.
460
+ *
461
+ * @param {String} namespaces
462
+ * @api private
463
+ */
464
+ function save(namespaces) {
465
+ try {
466
+ if (namespaces) exports.storage.setItem("debug", namespaces);
467
+ else exports.storage.removeItem("debug");
468
+ } catch (error) {}
469
+ }
470
+ /**
471
+ * Load `namespaces`.
472
+ *
473
+ * @return {String} returns the previously persisted debug modes
474
+ * @api private
475
+ */
476
+ function load() {
477
+ let r;
478
+ try {
479
+ r = exports.storage.getItem("debug");
480
+ } catch (error) {}
481
+ if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
482
+ return r;
483
+ }
484
+ /**
485
+ * Localstorage attempts to return the localstorage.
486
+ *
487
+ * This is necessary because safari throws
488
+ * when a user disables cookies/localstorage
489
+ * and you attempt to access it.
490
+ *
491
+ * @return {LocalStorage}
492
+ * @api private
493
+ */
494
+ function localstorage() {
495
+ try {
496
+ return localStorage;
497
+ } catch (error) {}
498
+ }
499
+ module.exports = require_common()(exports);
500
+ const { formatters } = module.exports;
501
+ /**
502
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
503
+ */
504
+ formatters.j = function(v) {
505
+ try {
506
+ return JSON.stringify(v);
507
+ } catch (error) {
508
+ return "[UnexpectedJSONParseError]: " + error.message;
509
+ }
510
+ };
511
+ }));
512
+ var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
513
+ module.exports = (flag, argv) => {
514
+ argv = argv || process.argv;
515
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
516
+ const pos = argv.indexOf(prefix + flag);
517
+ const terminatorPos = argv.indexOf("--");
518
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
519
+ };
520
+ }));
521
+ var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
522
+ const os = __require("os");
523
+ const hasFlag = require_has_flag();
524
+ const env = process.env;
525
+ let forceColor;
526
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
527
+ else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
528
+ if ("FORCE_COLOR" in env) forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
529
+ function translateLevel(level) {
530
+ if (level === 0) return false;
531
+ return {
532
+ level,
533
+ hasBasic: true,
534
+ has256: level >= 2,
535
+ has16m: level >= 3
536
+ };
537
+ }
538
+ function supportsColor(stream) {
539
+ if (forceColor === false) return 0;
540
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
541
+ if (hasFlag("color=256")) return 2;
542
+ if (stream && !stream.isTTY && forceColor !== true) return 0;
543
+ const min = forceColor ? 1 : 0;
544
+ if (process.platform === "win32") {
545
+ const osRelease = os.release().split(".");
546
+ if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
547
+ return 1;
548
+ }
549
+ if ("CI" in env) {
550
+ if ([
551
+ "TRAVIS",
552
+ "CIRCLECI",
553
+ "APPVEYOR",
554
+ "GITLAB_CI"
555
+ ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
556
+ return min;
557
+ }
558
+ if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
559
+ if (env.COLORTERM === "truecolor") return 3;
560
+ if ("TERM_PROGRAM" in env) {
561
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
562
+ switch (env.TERM_PROGRAM) {
563
+ case "iTerm.app": return version >= 3 ? 3 : 2;
564
+ case "Apple_Terminal": return 2;
565
+ }
566
+ }
567
+ if (/-256(color)?$/i.test(env.TERM)) return 2;
568
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
569
+ if ("COLORTERM" in env) return 1;
570
+ if (env.TERM === "dumb") return min;
571
+ return min;
572
+ }
573
+ function getSupportLevel(stream) {
574
+ return translateLevel(supportsColor(stream));
575
+ }
576
+ module.exports = {
577
+ supportsColor: getSupportLevel,
578
+ stdout: getSupportLevel(process.stdout),
579
+ stderr: getSupportLevel(process.stderr)
580
+ };
581
+ }));
582
+ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
583
+ /**
584
+ * Module dependencies.
585
+ */
586
+ const tty = __require("tty");
587
+ const util = __require("util");
588
+ /**
589
+ * This is the Node.js implementation of `debug()`.
590
+ */
591
+ exports.init = init;
592
+ exports.log = log;
593
+ exports.formatArgs = formatArgs;
594
+ exports.save = save;
595
+ exports.load = load;
596
+ exports.useColors = useColors;
597
+ exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
598
+ /**
599
+ * Colors.
600
+ */
601
+ exports.colors = [
602
+ 6,
603
+ 2,
604
+ 3,
605
+ 4,
606
+ 5,
607
+ 1
608
+ ];
609
+ try {
610
+ const supportsColor = require_supports_color();
611
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
612
+ 20,
613
+ 21,
614
+ 26,
615
+ 27,
616
+ 32,
617
+ 33,
618
+ 38,
619
+ 39,
620
+ 40,
621
+ 41,
622
+ 42,
623
+ 43,
624
+ 44,
625
+ 45,
626
+ 56,
627
+ 57,
628
+ 62,
629
+ 63,
630
+ 68,
631
+ 69,
632
+ 74,
633
+ 75,
634
+ 76,
635
+ 77,
636
+ 78,
637
+ 79,
638
+ 80,
639
+ 81,
640
+ 92,
641
+ 93,
642
+ 98,
643
+ 99,
644
+ 112,
645
+ 113,
646
+ 128,
647
+ 129,
648
+ 134,
649
+ 135,
650
+ 148,
651
+ 149,
652
+ 160,
653
+ 161,
654
+ 162,
655
+ 163,
656
+ 164,
657
+ 165,
658
+ 166,
659
+ 167,
660
+ 168,
661
+ 169,
662
+ 170,
663
+ 171,
664
+ 172,
665
+ 173,
666
+ 178,
667
+ 179,
668
+ 184,
669
+ 185,
670
+ 196,
671
+ 197,
672
+ 198,
673
+ 199,
674
+ 200,
675
+ 201,
676
+ 202,
677
+ 203,
678
+ 204,
679
+ 205,
680
+ 206,
681
+ 207,
682
+ 208,
683
+ 209,
684
+ 214,
685
+ 215,
686
+ 220,
687
+ 221
688
+ ];
689
+ } catch (error) {}
690
+ /**
691
+ * Build up the default `inspectOpts` object from the environment variables.
692
+ *
693
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
694
+ */
695
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
696
+ return /^debug_/i.test(key);
697
+ }).reduce((obj, key) => {
698
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
699
+ return k.toUpperCase();
700
+ });
701
+ let val = process.env[key];
702
+ if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
703
+ else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
704
+ else if (val === "null") val = null;
705
+ else val = Number(val);
706
+ obj[prop] = val;
707
+ return obj;
708
+ }, {});
709
+ /**
710
+ * Is stdout a TTY? Colored output is enabled when `true`.
711
+ */
712
+ function useColors() {
713
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
714
+ }
715
+ /**
716
+ * Adds ANSI color escape codes if enabled.
717
+ *
718
+ * @api public
719
+ */
720
+ function formatArgs(args) {
721
+ const { namespace: name, useColors } = this;
722
+ if (useColors) {
723
+ const c = this.color;
724
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
725
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
726
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
727
+ args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
728
+ } else args[0] = getDate() + name + " " + args[0];
729
+ }
730
+ function getDate() {
731
+ if (exports.inspectOpts.hideDate) return "";
732
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
733
+ }
734
+ /**
735
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
736
+ */
737
+ function log(...args) {
738
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
739
+ }
740
+ /**
741
+ * Save `namespaces`.
742
+ *
743
+ * @param {String} namespaces
744
+ * @api private
745
+ */
746
+ function save(namespaces) {
747
+ if (namespaces) process.env.DEBUG = namespaces;
748
+ else delete process.env.DEBUG;
749
+ }
750
+ /**
751
+ * Load `namespaces`.
752
+ *
753
+ * @return {String} returns the previously persisted debug modes
754
+ * @api private
755
+ */
756
+ function load() {
757
+ return process.env.DEBUG;
758
+ }
759
+ /**
760
+ * Init logic for `debug` instances.
761
+ *
762
+ * Create a new `inspectOpts` object in case `useColors` is set
763
+ * differently for a particular `debug` instance.
764
+ */
765
+ function init(debug) {
766
+ debug.inspectOpts = {};
767
+ const keys = Object.keys(exports.inspectOpts);
768
+ for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
769
+ }
770
+ module.exports = require_common()(exports);
771
+ const { formatters } = module.exports;
772
+ /**
773
+ * Map %o to `util.inspect()`, all on a single line.
774
+ */
775
+ formatters.o = function(v) {
776
+ this.inspectOpts.colors = this.useColors;
777
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
778
+ };
779
+ /**
780
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
781
+ */
782
+ formatters.O = function(v) {
783
+ this.inspectOpts.colors = this.useColors;
784
+ return util.inspect(v, this.inspectOpts);
785
+ };
786
+ }));
787
+ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
788
+ /**
789
+ * Detect Electron renderer / nwjs process, which is node, but we should
790
+ * treat as a browser.
791
+ */
792
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
793
+ else module.exports = require_node();
794
+ }));
795
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports) => {
796
+ var __importDefault = exports && exports.__importDefault || function(mod) {
797
+ return mod && mod.__esModule ? mod : { "default": mod };
798
+ };
799
+ Object.defineProperty(exports, "__esModule", { value: true });
800
+ const fs_1 = __require("fs");
801
+ const log = __importDefault(require_src$1()).default("@kwsites/file-exists");
802
+ function check(path, isFile, isDirectory) {
803
+ log(`checking %s`, path);
804
+ try {
805
+ const stat = fs_1.statSync(path);
806
+ if (stat.isFile() && isFile) {
807
+ log(`[OK] path represents a file`);
808
+ return true;
809
+ }
810
+ if (stat.isDirectory() && isDirectory) {
811
+ log(`[OK] path represents a directory`);
812
+ return true;
813
+ }
814
+ log(`[FAIL] path represents something other than a file or directory`);
815
+ return false;
816
+ } catch (e) {
817
+ if (e.code === "ENOENT") {
818
+ log(`[FAIL] path is not accessible: %o`, e);
819
+ return false;
820
+ }
821
+ log(`[FATAL] %o`, e);
822
+ throw e;
823
+ }
824
+ }
825
+ /**
826
+ * Synchronous validation of a path existing either as a file or as a directory.
827
+ *
828
+ * @param {string} path The path to check
829
+ * @param {number} type One or both of the exported numeric constants
830
+ */
831
+ function exists(path, type = exports.READABLE) {
832
+ return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
833
+ }
834
+ exports.exists = exists;
835
+ /**
836
+ * Constant representing a file
837
+ */
838
+ exports.FILE = 1;
839
+ /**
840
+ * Constant representing a folder
841
+ */
842
+ exports.FOLDER = 2;
843
+ /**
844
+ * Constant representing either a file or a folder
845
+ */
846
+ exports.READABLE = exports.FILE + exports.FOLDER;
847
+ }));
848
+ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
849
+ function __export(m) {
850
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
851
+ }
852
+ Object.defineProperty(exports, "__esModule", { value: true });
853
+ __export(require_src());
854
+ }));
855
+ export { require_src$1 as n, require_dist as t };
856
+
857
+ //# sourceMappingURL=file-exists.mjs.map