@mcesystems/tool-debug-g4 1.0.67

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,656 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
28
+ var require_ms = __commonJS({
29
+ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
30
+ var s = 1e3;
31
+ var m = s * 60;
32
+ var h = m * 60;
33
+ var d = h * 24;
34
+ var w = d * 7;
35
+ var y = d * 365.25;
36
+ module.exports = function(val, options) {
37
+ options = options || {};
38
+ var type = typeof val;
39
+ if (type === "string" && val.length > 0) {
40
+ return parse(val);
41
+ } else if (type === "number" && isFinite(val)) {
42
+ return options.long ? fmtLong(val) : fmtShort(val);
43
+ }
44
+ throw new Error(
45
+ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
46
+ );
47
+ };
48
+ function parse(str) {
49
+ str = String(str);
50
+ if (str.length > 100) {
51
+ return;
52
+ }
53
+ 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(
54
+ str
55
+ );
56
+ if (!match) {
57
+ return;
58
+ }
59
+ var n = parseFloat(match[1]);
60
+ var type = (match[2] || "ms").toLowerCase();
61
+ switch (type) {
62
+ case "years":
63
+ case "year":
64
+ case "yrs":
65
+ case "yr":
66
+ case "y":
67
+ return n * y;
68
+ case "weeks":
69
+ case "week":
70
+ case "w":
71
+ return n * w;
72
+ case "days":
73
+ case "day":
74
+ case "d":
75
+ return n * d;
76
+ case "hours":
77
+ case "hour":
78
+ case "hrs":
79
+ case "hr":
80
+ case "h":
81
+ return n * h;
82
+ case "minutes":
83
+ case "minute":
84
+ case "mins":
85
+ case "min":
86
+ case "m":
87
+ return n * m;
88
+ case "seconds":
89
+ case "second":
90
+ case "secs":
91
+ case "sec":
92
+ case "s":
93
+ return n * s;
94
+ case "milliseconds":
95
+ case "millisecond":
96
+ case "msecs":
97
+ case "msec":
98
+ case "ms":
99
+ return n;
100
+ default:
101
+ return void 0;
102
+ }
103
+ }
104
+ function fmtShort(ms) {
105
+ var msAbs = Math.abs(ms);
106
+ if (msAbs >= d) {
107
+ return Math.round(ms / d) + "d";
108
+ }
109
+ if (msAbs >= h) {
110
+ return Math.round(ms / h) + "h";
111
+ }
112
+ if (msAbs >= m) {
113
+ return Math.round(ms / m) + "m";
114
+ }
115
+ if (msAbs >= s) {
116
+ return Math.round(ms / s) + "s";
117
+ }
118
+ return ms + "ms";
119
+ }
120
+ function fmtLong(ms) {
121
+ var msAbs = Math.abs(ms);
122
+ if (msAbs >= d) {
123
+ return plural(ms, msAbs, d, "day");
124
+ }
125
+ if (msAbs >= h) {
126
+ return plural(ms, msAbs, h, "hour");
127
+ }
128
+ if (msAbs >= m) {
129
+ return plural(ms, msAbs, m, "minute");
130
+ }
131
+ if (msAbs >= s) {
132
+ return plural(ms, msAbs, s, "second");
133
+ }
134
+ return ms + " ms";
135
+ }
136
+ function plural(ms, msAbs, n, name) {
137
+ var isPlural = msAbs >= n * 1.5;
138
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
139
+ }
140
+ }
141
+ });
142
+
143
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js
144
+ var require_common = __commonJS({
145
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js"(exports, module) {
146
+ function setup(env) {
147
+ createDebug2.debug = createDebug2;
148
+ createDebug2.default = createDebug2;
149
+ createDebug2.coerce = coerce;
150
+ createDebug2.disable = disable;
151
+ createDebug2.enable = enable;
152
+ createDebug2.enabled = enabled;
153
+ createDebug2.humanize = require_ms();
154
+ createDebug2.destroy = destroy;
155
+ Object.keys(env).forEach((key) => {
156
+ createDebug2[key] = env[key];
157
+ });
158
+ createDebug2.names = [];
159
+ createDebug2.skips = [];
160
+ createDebug2.formatters = {};
161
+ function selectColor(namespace) {
162
+ let hash = 0;
163
+ for (let i = 0; i < namespace.length; i++) {
164
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
165
+ hash |= 0;
166
+ }
167
+ return createDebug2.colors[Math.abs(hash) % createDebug2.colors.length];
168
+ }
169
+ createDebug2.selectColor = selectColor;
170
+ function createDebug2(namespace) {
171
+ let prevTime;
172
+ let enableOverride = null;
173
+ let namespacesCache;
174
+ let enabledCache;
175
+ function debug(...args) {
176
+ if (!debug.enabled) {
177
+ return;
178
+ }
179
+ const self = debug;
180
+ const curr = Number(/* @__PURE__ */ new Date());
181
+ const ms = curr - (prevTime || curr);
182
+ self.diff = ms;
183
+ self.prev = prevTime;
184
+ self.curr = curr;
185
+ prevTime = curr;
186
+ args[0] = createDebug2.coerce(args[0]);
187
+ if (typeof args[0] !== "string") {
188
+ args.unshift("%O");
189
+ }
190
+ let index = 0;
191
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
192
+ if (match === "%%") {
193
+ return "%";
194
+ }
195
+ index++;
196
+ const formatter = createDebug2.formatters[format];
197
+ if (typeof formatter === "function") {
198
+ const val = args[index];
199
+ match = formatter.call(self, val);
200
+ args.splice(index, 1);
201
+ index--;
202
+ }
203
+ return match;
204
+ });
205
+ createDebug2.formatArgs.call(self, args);
206
+ const logFn = self.log || createDebug2.log;
207
+ logFn.apply(self, args);
208
+ }
209
+ debug.namespace = namespace;
210
+ debug.useColors = createDebug2.useColors();
211
+ debug.color = createDebug2.selectColor(namespace);
212
+ debug.extend = extend;
213
+ debug.destroy = createDebug2.destroy;
214
+ Object.defineProperty(debug, "enabled", {
215
+ enumerable: true,
216
+ configurable: false,
217
+ get: () => {
218
+ if (enableOverride !== null) {
219
+ return enableOverride;
220
+ }
221
+ if (namespacesCache !== createDebug2.namespaces) {
222
+ namespacesCache = createDebug2.namespaces;
223
+ enabledCache = createDebug2.enabled(namespace);
224
+ }
225
+ return enabledCache;
226
+ },
227
+ set: (v) => {
228
+ enableOverride = v;
229
+ }
230
+ });
231
+ if (typeof createDebug2.init === "function") {
232
+ createDebug2.init(debug);
233
+ }
234
+ return debug;
235
+ }
236
+ function extend(namespace, delimiter) {
237
+ const newDebug = createDebug2(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
238
+ newDebug.log = this.log;
239
+ return newDebug;
240
+ }
241
+ function enable(namespaces) {
242
+ createDebug2.save(namespaces);
243
+ createDebug2.namespaces = namespaces;
244
+ createDebug2.names = [];
245
+ createDebug2.skips = [];
246
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
247
+ for (const ns of split) {
248
+ if (ns[0] === "-") {
249
+ createDebug2.skips.push(ns.slice(1));
250
+ } else {
251
+ createDebug2.names.push(ns);
252
+ }
253
+ }
254
+ }
255
+ function matchesTemplate(search, template) {
256
+ let searchIndex = 0;
257
+ let templateIndex = 0;
258
+ let starIndex = -1;
259
+ let matchIndex = 0;
260
+ while (searchIndex < search.length) {
261
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
262
+ if (template[templateIndex] === "*") {
263
+ starIndex = templateIndex;
264
+ matchIndex = searchIndex;
265
+ templateIndex++;
266
+ } else {
267
+ searchIndex++;
268
+ templateIndex++;
269
+ }
270
+ } else if (starIndex !== -1) {
271
+ templateIndex = starIndex + 1;
272
+ matchIndex++;
273
+ searchIndex = matchIndex;
274
+ } else {
275
+ return false;
276
+ }
277
+ }
278
+ while (templateIndex < template.length && template[templateIndex] === "*") {
279
+ templateIndex++;
280
+ }
281
+ return templateIndex === template.length;
282
+ }
283
+ function disable() {
284
+ const namespaces = [
285
+ ...createDebug2.names,
286
+ ...createDebug2.skips.map((namespace) => "-" + namespace)
287
+ ].join(",");
288
+ createDebug2.enable("");
289
+ return namespaces;
290
+ }
291
+ function enabled(name) {
292
+ for (const skip of createDebug2.skips) {
293
+ if (matchesTemplate(name, skip)) {
294
+ return false;
295
+ }
296
+ }
297
+ for (const ns of createDebug2.names) {
298
+ if (matchesTemplate(name, ns)) {
299
+ return true;
300
+ }
301
+ }
302
+ return false;
303
+ }
304
+ function coerce(val) {
305
+ if (val instanceof Error) {
306
+ return val.stack || val.message;
307
+ }
308
+ return val;
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
+ createDebug2.enable(createDebug2.load());
314
+ return createDebug2;
315
+ }
316
+ module.exports = setup;
317
+ }
318
+ });
319
+
320
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js
321
+ var require_browser = __commonJS({
322
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js"(exports, module) {
323
+ exports.formatArgs = formatArgs;
324
+ exports.save = save;
325
+ exports.load = load;
326
+ exports.useColors = useColors;
327
+ exports.storage = localstorage();
328
+ exports.destroy = /* @__PURE__ */ (() => {
329
+ let warned = false;
330
+ return () => {
331
+ if (!warned) {
332
+ warned = true;
333
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
334
+ }
335
+ };
336
+ })();
337
+ exports.colors = [
338
+ "#0000CC",
339
+ "#0000FF",
340
+ "#0033CC",
341
+ "#0033FF",
342
+ "#0066CC",
343
+ "#0066FF",
344
+ "#0099CC",
345
+ "#0099FF",
346
+ "#00CC00",
347
+ "#00CC33",
348
+ "#00CC66",
349
+ "#00CC99",
350
+ "#00CCCC",
351
+ "#00CCFF",
352
+ "#3300CC",
353
+ "#3300FF",
354
+ "#3333CC",
355
+ "#3333FF",
356
+ "#3366CC",
357
+ "#3366FF",
358
+ "#3399CC",
359
+ "#3399FF",
360
+ "#33CC00",
361
+ "#33CC33",
362
+ "#33CC66",
363
+ "#33CC99",
364
+ "#33CCCC",
365
+ "#33CCFF",
366
+ "#6600CC",
367
+ "#6600FF",
368
+ "#6633CC",
369
+ "#6633FF",
370
+ "#66CC00",
371
+ "#66CC33",
372
+ "#9900CC",
373
+ "#9900FF",
374
+ "#9933CC",
375
+ "#9933FF",
376
+ "#99CC00",
377
+ "#99CC33",
378
+ "#CC0000",
379
+ "#CC0033",
380
+ "#CC0066",
381
+ "#CC0099",
382
+ "#CC00CC",
383
+ "#CC00FF",
384
+ "#CC3300",
385
+ "#CC3333",
386
+ "#CC3366",
387
+ "#CC3399",
388
+ "#CC33CC",
389
+ "#CC33FF",
390
+ "#CC6600",
391
+ "#CC6633",
392
+ "#CC9900",
393
+ "#CC9933",
394
+ "#CCCC00",
395
+ "#CCCC33",
396
+ "#FF0000",
397
+ "#FF0033",
398
+ "#FF0066",
399
+ "#FF0099",
400
+ "#FF00CC",
401
+ "#FF00FF",
402
+ "#FF3300",
403
+ "#FF3333",
404
+ "#FF3366",
405
+ "#FF3399",
406
+ "#FF33CC",
407
+ "#FF33FF",
408
+ "#FF6600",
409
+ "#FF6633",
410
+ "#FF9900",
411
+ "#FF9933",
412
+ "#FFCC00",
413
+ "#FFCC33"
414
+ ];
415
+ function useColors() {
416
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
417
+ return true;
418
+ }
419
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
420
+ return false;
421
+ }
422
+ let m;
423
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
424
+ typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
425
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
426
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
427
+ typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
428
+ }
429
+ function formatArgs(args) {
430
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
431
+ if (!this.useColors) {
432
+ return;
433
+ }
434
+ const c = "color: " + this.color;
435
+ args.splice(1, 0, c, "color: inherit");
436
+ let index = 0;
437
+ let lastC = 0;
438
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
439
+ if (match === "%%") {
440
+ return;
441
+ }
442
+ index++;
443
+ if (match === "%c") {
444
+ lastC = index;
445
+ }
446
+ });
447
+ args.splice(lastC, 0, c);
448
+ }
449
+ exports.log = console.debug || console.log || (() => {
450
+ });
451
+ function save(namespaces) {
452
+ try {
453
+ if (namespaces) {
454
+ exports.storage.setItem("debug", namespaces);
455
+ } else {
456
+ exports.storage.removeItem("debug");
457
+ }
458
+ } catch (error) {
459
+ }
460
+ }
461
+ function load() {
462
+ let r;
463
+ try {
464
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
465
+ } catch (error) {
466
+ }
467
+ if (!r && typeof process !== "undefined" && "env" in process) {
468
+ r = process.env.DEBUG;
469
+ }
470
+ return r;
471
+ }
472
+ function localstorage() {
473
+ try {
474
+ return localStorage;
475
+ } catch (error) {
476
+ }
477
+ }
478
+ module.exports = require_common()(exports);
479
+ var { formatters } = module.exports;
480
+ formatters.j = function(v) {
481
+ try {
482
+ return JSON.stringify(v);
483
+ } catch (error) {
484
+ return "[UnexpectedJSONParseError]: " + error.message;
485
+ }
486
+ };
487
+ }
488
+ });
489
+
490
+ // src/debug.ts
491
+ var import_debug = __toESM(require_browser());
492
+ var logInfo = (0, import_debug.default)("info");
493
+ var logTask = (0, import_debug.default)("task");
494
+ var logError = (0, import_debug.default)("error");
495
+ var logDetail = (0, import_debug.default)("detail");
496
+ var logDebug = (0, import_debug.default)("debug");
497
+ var logWarning = (0, import_debug.default)("warning");
498
+ var logColor = (0, import_debug.default)("color");
499
+ logInfo.color = "19";
500
+ logTask.color = "25";
501
+ logError.color = "1";
502
+ logDetail.color = "199";
503
+ logWarning.color = "186";
504
+ logDebug.color = "211";
505
+ logColor.enabled = true;
506
+ function logNamespace(namespace) {
507
+ logInfo.namespace = `${namespace}:info`;
508
+ logTask.namespace = `${namespace}:task`;
509
+ logError.namespace = `${namespace}:error`;
510
+ logDetail.namespace = `${namespace}:detail`;
511
+ logWarning.namespace = `${namespace}:warning`;
512
+ logDebug.namespace = `${namespace}:debug`;
513
+ }
514
+ function setLogLevel(level) {
515
+ switch (level) {
516
+ case "info":
517
+ logInfo.enabled = true;
518
+ logTask.enabled = true;
519
+ logError.enabled = true;
520
+ logWarning.enabled = true;
521
+ logDetail.enabled = false;
522
+ logDebug.enabled = false;
523
+ break;
524
+ case "debug":
525
+ logInfo.enabled = true;
526
+ logTask.enabled = true;
527
+ logError.enabled = true;
528
+ logWarning.enabled = true;
529
+ logDetail.enabled = true;
530
+ logDebug.enabled = true;
531
+ break;
532
+ case "none":
533
+ logInfo.enabled = false;
534
+ logTask.enabled = false;
535
+ logError.enabled = false;
536
+ logWarning.enabled = false;
537
+ logDetail.enabled = false;
538
+ logDebug.enabled = false;
539
+ break;
540
+ }
541
+ }
542
+ function setColors(type, color) {
543
+ switch (type) {
544
+ case "info":
545
+ logInfo.color = color;
546
+ break;
547
+ case "task":
548
+ logTask.color = color;
549
+ break;
550
+ case "error":
551
+ logError.color = color;
552
+ break;
553
+ case "detail":
554
+ logDetail.color = color;
555
+ break;
556
+ case "warning":
557
+ logWarning.color = color;
558
+ break;
559
+ case "debug":
560
+ logDebug.color = color;
561
+ break;
562
+ default:
563
+ throw new Error(`Invalid log type: ${type}`);
564
+ }
565
+ }
566
+ function printColors() {
567
+ for (let i = 0; i < 256; i++) {
568
+ logColor.color = `${i}`;
569
+ logColor(`${i}: ${i}`);
570
+ }
571
+ }
572
+ function logDataDetail(data, prefix = "# ") {
573
+ if (data === null || data === void 0) {
574
+ return `${prefix}<null or undefined>`;
575
+ }
576
+ if (typeof data !== "object") {
577
+ return `${prefix}${String(data)}`;
578
+ }
579
+ const keys = Object.keys(data);
580
+ let result = "";
581
+ for (const key of keys) {
582
+ result += `${prefix}${key}: `;
583
+ if (key in data) {
584
+ let dataKey = key;
585
+ if (key in data) {
586
+ dataKey = key;
587
+ const value = data[dataKey];
588
+ if (value === null || value === void 0) {
589
+ result += `<${value === null ? "null" : "undefined"}>
590
+ `;
591
+ } else if (typeof value === "object") {
592
+ result += `
593
+ ${logDataDetail(value, `${prefix} `)}
594
+ `;
595
+ } else {
596
+ result += `${value}
597
+ `;
598
+ }
599
+ }
600
+ }
601
+ }
602
+ return result.trim();
603
+ }
604
+ function header(title, padding = 0) {
605
+ return `${" ".repeat(padding)}${"=".repeat(80)}
606
+ ${" ".repeat(40 - title.length / 2)}${title}
607
+ ${" ".repeat(padding)}${"=".repeat(80)}`;
608
+ }
609
+ function logHeader(title) {
610
+ logInfo(`${header(title, 2)}`);
611
+ }
612
+ function logDataObject(title, ...args) {
613
+ var _a;
614
+ const stack = ((_a = new Error().stack) == null ? void 0 : _a.split("\n")[2]) || "";
615
+ const stackMatch = stack.match(/\((.*):(\d+):(\d+)\)$/) || stack.match(/at (.*):(\d+):(\d+)$/);
616
+ let callerDetails = "";
617
+ if (stackMatch) {
618
+ const functionMatch = stack.match(/at (.+) \(/);
619
+ const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
620
+ callerDetails = `${functionName}`;
621
+ }
622
+ logDetail(`${header(`*${title}* ${callerDetails}`)}
623
+ ${args.reduce((acc, arg) => `${acc}
624
+ ${logDataDetail(arg)}`, "")}
625
+
626
+ ${"=".repeat(80)}`);
627
+ }
628
+ function logErrorObject(error, extraDetails) {
629
+ if (error instanceof Error) {
630
+ logError(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
631
+ Error Message:
632
+ ${error.message}
633
+ Error Stack:
634
+ ${error.stack}
635
+ ${"=".repeat(80)}`);
636
+ } else {
637
+ logError(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
638
+ ${"=".repeat(80)}`);
639
+ }
640
+ }
641
+ export {
642
+ logDataObject,
643
+ logDebug,
644
+ logDetail,
645
+ logError,
646
+ logErrorObject,
647
+ logHeader,
648
+ logInfo,
649
+ logNamespace,
650
+ logTask,
651
+ logWarning,
652
+ printColors,
653
+ setColors,
654
+ setLogLevel
655
+ };
656
+ //# sourceMappingURL=index.browser.mjs.map