agmd 0.2.9 → 0.3.0-alpha0.2

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/lib/index.esm.js CHANGED
@@ -1,20 +1,793 @@
1
1
  /*!
2
- * agmd v0.2.8
2
+ * agmd v0.3.0-alpha0.1
3
3
  * author:kakajun <253495832@qq.com>
4
- * Sun Mar 20 2022 22:57:02 GMT+0800 (中国标准时间)
4
+ * Wed Apr 06 2022 10:04:24 GMT+0800 (中国标准时间)
5
5
  */
6
- // src/index.ts
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
+ }) : x)(function(x) {
15
+ if (typeof require !== "undefined")
16
+ return require.apply(this, arguments);
17
+ throw new Error('Dynamic require of "' + x + '" is not supported');
18
+ });
19
+ var __commonJS = (cb, mod) => function __require2() {
20
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (let key of __getOwnPropNames(from))
25
+ if (!__hasOwnProp.call(to, key) && key !== except)
26
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
31
+
32
+ // node_modules/ms/index.js
33
+ var require_ms = __commonJS({
34
+ "node_modules/ms/index.js"(exports, module) {
35
+ var s = 1e3;
36
+ var m = s * 60;
37
+ var h = m * 60;
38
+ var d = h * 24;
39
+ var w = d * 7;
40
+ var y = d * 365.25;
41
+ module.exports = function(val, options) {
42
+ options = options || {};
43
+ var type = typeof val;
44
+ if (type === "string" && val.length > 0) {
45
+ return parse(val);
46
+ } else if (type === "number" && isFinite(val)) {
47
+ return options.long ? fmtLong(val) : fmtShort(val);
48
+ }
49
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
50
+ };
51
+ function parse(str) {
52
+ str = String(str);
53
+ if (str.length > 100) {
54
+ return;
55
+ }
56
+ 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);
57
+ if (!match) {
58
+ return;
59
+ }
60
+ var n = parseFloat(match[1]);
61
+ var type = (match[2] || "ms").toLowerCase();
62
+ switch (type) {
63
+ case "years":
64
+ case "year":
65
+ case "yrs":
66
+ case "yr":
67
+ case "y":
68
+ return n * y;
69
+ case "weeks":
70
+ case "week":
71
+ case "w":
72
+ return n * w;
73
+ case "days":
74
+ case "day":
75
+ case "d":
76
+ return n * d;
77
+ case "hours":
78
+ case "hour":
79
+ case "hrs":
80
+ case "hr":
81
+ case "h":
82
+ return n * h;
83
+ case "minutes":
84
+ case "minute":
85
+ case "mins":
86
+ case "min":
87
+ case "m":
88
+ return n * m;
89
+ case "seconds":
90
+ case "second":
91
+ case "secs":
92
+ case "sec":
93
+ case "s":
94
+ return n * s;
95
+ case "milliseconds":
96
+ case "millisecond":
97
+ case "msecs":
98
+ case "msec":
99
+ case "ms":
100
+ return n;
101
+ default:
102
+ return void 0;
103
+ }
104
+ }
105
+ function fmtShort(ms) {
106
+ var msAbs = Math.abs(ms);
107
+ if (msAbs >= d) {
108
+ return Math.round(ms / d) + "d";
109
+ }
110
+ if (msAbs >= h) {
111
+ return Math.round(ms / h) + "h";
112
+ }
113
+ if (msAbs >= m) {
114
+ return Math.round(ms / m) + "m";
115
+ }
116
+ if (msAbs >= s) {
117
+ return Math.round(ms / s) + "s";
118
+ }
119
+ return ms + "ms";
120
+ }
121
+ function fmtLong(ms) {
122
+ var msAbs = Math.abs(ms);
123
+ if (msAbs >= d) {
124
+ return plural(ms, msAbs, d, "day");
125
+ }
126
+ if (msAbs >= h) {
127
+ return plural(ms, msAbs, h, "hour");
128
+ }
129
+ if (msAbs >= m) {
130
+ return plural(ms, msAbs, m, "minute");
131
+ }
132
+ if (msAbs >= s) {
133
+ return plural(ms, msAbs, s, "second");
134
+ }
135
+ return ms + " ms";
136
+ }
137
+ function plural(ms, msAbs, n, name) {
138
+ var isPlural = msAbs >= n * 1.5;
139
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
140
+ }
141
+ }
142
+ });
143
+
144
+ // node_modules/debug/src/common.js
145
+ var require_common = __commonJS({
146
+ "node_modules/debug/src/common.js"(exports, module) {
147
+ function setup(env) {
148
+ createDebug.debug = createDebug;
149
+ createDebug.default = createDebug;
150
+ createDebug.coerce = coerce;
151
+ createDebug.disable = disable;
152
+ createDebug.enable = enable;
153
+ createDebug.enabled = enabled;
154
+ createDebug.humanize = require_ms();
155
+ createDebug.destroy = destroy;
156
+ Object.keys(env).forEach((key) => {
157
+ createDebug[key] = env[key];
158
+ });
159
+ createDebug.names = [];
160
+ createDebug.skips = [];
161
+ createDebug.formatters = {};
162
+ function selectColor(namespace) {
163
+ let hash = 0;
164
+ for (let i = 0; i < namespace.length; i++) {
165
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
166
+ hash |= 0;
167
+ }
168
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
169
+ }
170
+ createDebug.selectColor = selectColor;
171
+ function createDebug(namespace) {
172
+ let prevTime;
173
+ let enableOverride = null;
174
+ let namespacesCache;
175
+ let enabledCache;
176
+ function debug3(...args) {
177
+ if (!debug3.enabled) {
178
+ return;
179
+ }
180
+ const self = debug3;
181
+ const curr = Number(new Date());
182
+ const ms = curr - (prevTime || curr);
183
+ self.diff = ms;
184
+ self.prev = prevTime;
185
+ self.curr = curr;
186
+ prevTime = curr;
187
+ args[0] = createDebug.coerce(args[0]);
188
+ if (typeof args[0] !== "string") {
189
+ args.unshift("%O");
190
+ }
191
+ let index = 0;
192
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format2) => {
193
+ if (match === "%%") {
194
+ return "%";
195
+ }
196
+ index++;
197
+ const formatter = createDebug.formatters[format2];
198
+ if (typeof formatter === "function") {
199
+ const val = args[index];
200
+ match = formatter.call(self, val);
201
+ args.splice(index, 1);
202
+ index--;
203
+ }
204
+ return match;
205
+ });
206
+ createDebug.formatArgs.call(self, args);
207
+ const logFn = self.log || createDebug.log;
208
+ logFn.apply(self, args);
209
+ }
210
+ debug3.namespace = namespace;
211
+ debug3.useColors = createDebug.useColors();
212
+ debug3.color = createDebug.selectColor(namespace);
213
+ debug3.extend = extend;
214
+ debug3.destroy = createDebug.destroy;
215
+ Object.defineProperty(debug3, "enabled", {
216
+ enumerable: true,
217
+ configurable: false,
218
+ get: () => {
219
+ if (enableOverride !== null) {
220
+ return enableOverride;
221
+ }
222
+ if (namespacesCache !== createDebug.namespaces) {
223
+ namespacesCache = createDebug.namespaces;
224
+ enabledCache = createDebug.enabled(namespace);
225
+ }
226
+ return enabledCache;
227
+ },
228
+ set: (v) => {
229
+ enableOverride = v;
230
+ }
231
+ });
232
+ if (typeof createDebug.init === "function") {
233
+ createDebug.init(debug3);
234
+ }
235
+ return debug3;
236
+ }
237
+ function extend(namespace, delimiter) {
238
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
239
+ newDebug.log = this.log;
240
+ return newDebug;
241
+ }
242
+ function enable(namespaces) {
243
+ createDebug.save(namespaces);
244
+ createDebug.namespaces = namespaces;
245
+ createDebug.names = [];
246
+ createDebug.skips = [];
247
+ let i;
248
+ const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
249
+ const len = split.length;
250
+ for (i = 0; i < len; i++) {
251
+ if (!split[i]) {
252
+ continue;
253
+ }
254
+ namespaces = split[i].replace(/\*/g, ".*?");
255
+ if (namespaces[0] === "-") {
256
+ createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
257
+ } else {
258
+ createDebug.names.push(new RegExp("^" + namespaces + "$"));
259
+ }
260
+ }
261
+ }
262
+ function disable() {
263
+ const namespaces = [
264
+ ...createDebug.names.map(toNamespace),
265
+ ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
266
+ ].join(",");
267
+ createDebug.enable("");
268
+ return namespaces;
269
+ }
270
+ function enabled(name) {
271
+ if (name[name.length - 1] === "*") {
272
+ return true;
273
+ }
274
+ let i;
275
+ let len;
276
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
277
+ if (createDebug.skips[i].test(name)) {
278
+ return false;
279
+ }
280
+ }
281
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
282
+ if (createDebug.names[i].test(name)) {
283
+ return true;
284
+ }
285
+ }
286
+ return false;
287
+ }
288
+ function toNamespace(regexp) {
289
+ return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
290
+ }
291
+ function coerce(val) {
292
+ if (val instanceof Error) {
293
+ return val.stack || val.message;
294
+ }
295
+ return val;
296
+ }
297
+ function destroy() {
298
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
299
+ }
300
+ createDebug.enable(createDebug.load());
301
+ return createDebug;
302
+ }
303
+ module.exports = setup;
304
+ }
305
+ });
306
+
307
+ // node_modules/debug/src/browser.js
308
+ var require_browser = __commonJS({
309
+ "node_modules/debug/src/browser.js"(exports, module) {
310
+ exports.formatArgs = formatArgs;
311
+ exports.save = save;
312
+ exports.load = load;
313
+ exports.useColors = useColors;
314
+ exports.storage = localstorage();
315
+ exports.destroy = (() => {
316
+ let warned = false;
317
+ return () => {
318
+ if (!warned) {
319
+ warned = true;
320
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
321
+ }
322
+ };
323
+ })();
324
+ exports.colors = [
325
+ "#0000CC",
326
+ "#0000FF",
327
+ "#0033CC",
328
+ "#0033FF",
329
+ "#0066CC",
330
+ "#0066FF",
331
+ "#0099CC",
332
+ "#0099FF",
333
+ "#00CC00",
334
+ "#00CC33",
335
+ "#00CC66",
336
+ "#00CC99",
337
+ "#00CCCC",
338
+ "#00CCFF",
339
+ "#3300CC",
340
+ "#3300FF",
341
+ "#3333CC",
342
+ "#3333FF",
343
+ "#3366CC",
344
+ "#3366FF",
345
+ "#3399CC",
346
+ "#3399FF",
347
+ "#33CC00",
348
+ "#33CC33",
349
+ "#33CC66",
350
+ "#33CC99",
351
+ "#33CCCC",
352
+ "#33CCFF",
353
+ "#6600CC",
354
+ "#6600FF",
355
+ "#6633CC",
356
+ "#6633FF",
357
+ "#66CC00",
358
+ "#66CC33",
359
+ "#9900CC",
360
+ "#9900FF",
361
+ "#9933CC",
362
+ "#9933FF",
363
+ "#99CC00",
364
+ "#99CC33",
365
+ "#CC0000",
366
+ "#CC0033",
367
+ "#CC0066",
368
+ "#CC0099",
369
+ "#CC00CC",
370
+ "#CC00FF",
371
+ "#CC3300",
372
+ "#CC3333",
373
+ "#CC3366",
374
+ "#CC3399",
375
+ "#CC33CC",
376
+ "#CC33FF",
377
+ "#CC6600",
378
+ "#CC6633",
379
+ "#CC9900",
380
+ "#CC9933",
381
+ "#CCCC00",
382
+ "#CCCC33",
383
+ "#FF0000",
384
+ "#FF0033",
385
+ "#FF0066",
386
+ "#FF0099",
387
+ "#FF00CC",
388
+ "#FF00FF",
389
+ "#FF3300",
390
+ "#FF3333",
391
+ "#FF3366",
392
+ "#FF3399",
393
+ "#FF33CC",
394
+ "#FF33FF",
395
+ "#FF6600",
396
+ "#FF6633",
397
+ "#FF9900",
398
+ "#FF9933",
399
+ "#FFCC00",
400
+ "#FFCC33"
401
+ ];
402
+ function useColors() {
403
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
404
+ return true;
405
+ }
406
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
407
+ return false;
408
+ }
409
+ 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+)/);
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) {
414
+ return;
415
+ }
416
+ const c = "color: " + this.color;
417
+ args.splice(1, 0, c, "color: inherit");
418
+ let index = 0;
419
+ let lastC = 0;
420
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
421
+ if (match === "%%") {
422
+ return;
423
+ }
424
+ index++;
425
+ if (match === "%c") {
426
+ lastC = index;
427
+ }
428
+ });
429
+ args.splice(lastC, 0, c);
430
+ }
431
+ exports.log = console.debug || console.log || (() => {
432
+ });
433
+ function save(namespaces) {
434
+ try {
435
+ if (namespaces) {
436
+ exports.storage.setItem("debug", namespaces);
437
+ } else {
438
+ exports.storage.removeItem("debug");
439
+ }
440
+ } catch (error) {
441
+ }
442
+ }
443
+ function load() {
444
+ let r;
445
+ try {
446
+ r = exports.storage.getItem("debug");
447
+ } catch (error) {
448
+ }
449
+ if (!r && typeof process !== "undefined" && "env" in process) {
450
+ r = process.env.DEBUG;
451
+ }
452
+ return r;
453
+ }
454
+ function localstorage() {
455
+ try {
456
+ return localStorage;
457
+ } catch (error) {
458
+ }
459
+ }
460
+ module.exports = require_common()(exports);
461
+ var { formatters } = module.exports;
462
+ formatters.j = function(v) {
463
+ try {
464
+ return JSON.stringify(v);
465
+ } catch (error) {
466
+ return "[UnexpectedJSONParseError]: " + error.message;
467
+ }
468
+ };
469
+ }
470
+ });
471
+
472
+ // node_modules/has-flag/index.js
473
+ var require_has_flag = __commonJS({
474
+ "node_modules/has-flag/index.js"(exports, module) {
475
+ "use strict";
476
+ module.exports = (flag, argv = process.argv) => {
477
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
478
+ const position = argv.indexOf(prefix + flag);
479
+ const terminatorPosition = argv.indexOf("--");
480
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
481
+ };
482
+ }
483
+ });
484
+
485
+ // node_modules/supports-color/index.js
486
+ var require_supports_color = __commonJS({
487
+ "node_modules/supports-color/index.js"(exports, module) {
488
+ "use strict";
489
+ var os = __require("os");
490
+ var tty = __require("tty");
491
+ var hasFlag = require_has_flag();
492
+ var { env } = process;
493
+ var forceColor;
494
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
495
+ forceColor = 0;
496
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
497
+ forceColor = 1;
498
+ }
499
+ if ("FORCE_COLOR" in env) {
500
+ if (env.FORCE_COLOR === "true") {
501
+ forceColor = 1;
502
+ } else if (env.FORCE_COLOR === "false") {
503
+ forceColor = 0;
504
+ } else {
505
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
506
+ }
507
+ }
508
+ function translateLevel(level) {
509
+ if (level === 0) {
510
+ return false;
511
+ }
512
+ return {
513
+ level,
514
+ hasBasic: true,
515
+ has256: level >= 2,
516
+ has16m: level >= 3
517
+ };
518
+ }
519
+ function supportsColor(haveStream, streamIsTTY) {
520
+ if (forceColor === 0) {
521
+ return 0;
522
+ }
523
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
524
+ return 3;
525
+ }
526
+ if (hasFlag("color=256")) {
527
+ return 2;
528
+ }
529
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
530
+ return 0;
531
+ }
532
+ const min = forceColor || 0;
533
+ if (env.TERM === "dumb") {
534
+ return min;
535
+ }
536
+ if (process.platform === "win32") {
537
+ const osRelease = os.release().split(".");
538
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
539
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
540
+ }
541
+ return 1;
542
+ }
543
+ if ("CI" in env) {
544
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
545
+ return 1;
546
+ }
547
+ return min;
548
+ }
549
+ if ("TEAMCITY_VERSION" in env) {
550
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
551
+ }
552
+ if (env.COLORTERM === "truecolor") {
553
+ return 3;
554
+ }
555
+ if ("TERM_PROGRAM" in env) {
556
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
557
+ switch (env.TERM_PROGRAM) {
558
+ case "iTerm.app":
559
+ return version >= 3 ? 3 : 2;
560
+ case "Apple_Terminal":
561
+ return 2;
562
+ }
563
+ }
564
+ if (/-256(color)?$/i.test(env.TERM)) {
565
+ return 2;
566
+ }
567
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
568
+ return 1;
569
+ }
570
+ if ("COLORTERM" in env) {
571
+ return 1;
572
+ }
573
+ return min;
574
+ }
575
+ function getSupportLevel(stream) {
576
+ const level = supportsColor(stream, stream && stream.isTTY);
577
+ return translateLevel(level);
578
+ }
579
+ module.exports = {
580
+ supportsColor: getSupportLevel,
581
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
582
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
583
+ };
584
+ }
585
+ });
586
+
587
+ // node_modules/debug/src/node.js
588
+ var require_node = __commonJS({
589
+ "node_modules/debug/src/node.js"(exports, module) {
590
+ var tty = __require("tty");
591
+ var util = __require("util");
592
+ exports.init = init;
593
+ exports.log = log;
594
+ exports.formatArgs = formatArgs;
595
+ exports.save = save;
596
+ exports.load = load;
597
+ exports.useColors = useColors;
598
+ exports.destroy = util.deprecate(() => {
599
+ }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
600
+ exports.colors = [6, 2, 3, 4, 5, 1];
601
+ try {
602
+ const supportsColor = require_supports_color();
603
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
604
+ exports.colors = [
605
+ 20,
606
+ 21,
607
+ 26,
608
+ 27,
609
+ 32,
610
+ 33,
611
+ 38,
612
+ 39,
613
+ 40,
614
+ 41,
615
+ 42,
616
+ 43,
617
+ 44,
618
+ 45,
619
+ 56,
620
+ 57,
621
+ 62,
622
+ 63,
623
+ 68,
624
+ 69,
625
+ 74,
626
+ 75,
627
+ 76,
628
+ 77,
629
+ 78,
630
+ 79,
631
+ 80,
632
+ 81,
633
+ 92,
634
+ 93,
635
+ 98,
636
+ 99,
637
+ 112,
638
+ 113,
639
+ 128,
640
+ 129,
641
+ 134,
642
+ 135,
643
+ 148,
644
+ 149,
645
+ 160,
646
+ 161,
647
+ 162,
648
+ 163,
649
+ 164,
650
+ 165,
651
+ 166,
652
+ 167,
653
+ 168,
654
+ 169,
655
+ 170,
656
+ 171,
657
+ 172,
658
+ 173,
659
+ 178,
660
+ 179,
661
+ 184,
662
+ 185,
663
+ 196,
664
+ 197,
665
+ 198,
666
+ 199,
667
+ 200,
668
+ 201,
669
+ 202,
670
+ 203,
671
+ 204,
672
+ 205,
673
+ 206,
674
+ 207,
675
+ 208,
676
+ 209,
677
+ 214,
678
+ 215,
679
+ 220,
680
+ 221
681
+ ];
682
+ }
683
+ } catch (error) {
684
+ }
685
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
686
+ return /^debug_/i.test(key);
687
+ }).reduce((obj, key) => {
688
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
689
+ return k.toUpperCase();
690
+ });
691
+ let val = process.env[key];
692
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
693
+ val = true;
694
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
695
+ val = false;
696
+ } else if (val === "null") {
697
+ val = null;
698
+ } else {
699
+ val = Number(val);
700
+ }
701
+ obj[prop] = val;
702
+ return obj;
703
+ }, {});
704
+ function useColors() {
705
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
706
+ }
707
+ function formatArgs(args) {
708
+ const { namespace: name, useColors: useColors2 } = this;
709
+ if (useColors2) {
710
+ const c = this.color;
711
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
712
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
713
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
714
+ args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
715
+ } else {
716
+ args[0] = getDate() + name + " " + args[0];
717
+ }
718
+ }
719
+ function getDate() {
720
+ if (exports.inspectOpts.hideDate) {
721
+ return "";
722
+ }
723
+ return new Date().toISOString() + " ";
724
+ }
725
+ function log(...args) {
726
+ return process.stderr.write(util.format(...args) + "\n");
727
+ }
728
+ function save(namespaces) {
729
+ if (namespaces) {
730
+ process.env.DEBUG = namespaces;
731
+ } else {
732
+ delete process.env.DEBUG;
733
+ }
734
+ }
735
+ function load() {
736
+ return process.env.DEBUG;
737
+ }
738
+ function init(debug3) {
739
+ debug3.inspectOpts = {};
740
+ const keys = Object.keys(exports.inspectOpts);
741
+ for (let i = 0; i < keys.length; i++) {
742
+ debug3.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
743
+ }
744
+ }
745
+ module.exports = require_common()(exports);
746
+ var { formatters } = module.exports;
747
+ formatters.o = function(v) {
748
+ this.inspectOpts.colors = this.useColors;
749
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
750
+ };
751
+ formatters.O = function(v) {
752
+ this.inspectOpts.colors = this.useColors;
753
+ return util.inspect(v, this.inspectOpts);
754
+ };
755
+ }
756
+ });
757
+
758
+ // node_modules/debug/src/index.js
759
+ var require_src = __commonJS({
760
+ "node_modules/debug/src/index.js"(exports, module) {
761
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
762
+ module.exports = require_browser();
763
+ } else {
764
+ module.exports = require_node();
765
+ }
766
+ }
767
+ });
768
+
769
+ // src/commands/wirte-md.ts
770
+ import path2 from "path";
771
+
772
+ // src/commands/get-file.ts
773
+ var import_debug = __toESM(require_src());
7
774
  import fs from "fs";
8
775
  import path from "path";
776
+ var debug = (0, import_debug.default)("get-file");
777
+ debug.enabled = false;
9
778
  function getFile(file) {
10
779
  const str = fs.readFileSync(file, "utf-8");
11
780
  const size = str.length;
12
- const sarr = str.split(/[\n,]/g);
781
+ const sarr = str.split(/[\n]/g);
13
782
  const rowSize = sarr.length;
14
783
  const f = sarr[0].indexOf("eslint") === -1 && (sarr[0].indexOf("-->") > -1 || sarr[0].indexOf("*/") > -1 || sarr[0].indexOf("//") > -1) ? sarr[0] : "";
15
- return { note: f, size, rowSize };
784
+ return {
785
+ note: f,
786
+ size,
787
+ rowSize
788
+ };
16
789
  }
17
- function getFileNodes(option, nodes = [], dir = path.resolve("./"), level = 0) {
790
+ function getFileNodes(dir = path.resolve("./"), option, nodes = [], level = 0) {
18
791
  let ignore = [
19
792
  "img",
20
793
  "styles",
@@ -28,7 +801,7 @@ function getFileNodes(option, nodes = [], dir = path.resolve("./"), level = 0) {
28
801
  "readme-file.js",
29
802
  "readme-md.js"
30
803
  ];
31
- let include = [".js", ".vue", ".ts"];
804
+ let include = [".js", ".vue"];
32
805
  if (option) {
33
806
  ignore = option.ignore || ignore;
34
807
  include = option.include || include;
@@ -40,7 +813,9 @@ function getFileNodes(option, nodes = [], dir = path.resolve("./"), level = 0) {
40
813
  name: item,
41
814
  isDir,
42
815
  level,
43
- note: ""
816
+ note: "",
817
+ imports: new Array(),
818
+ belongTo: new Array()
44
819
  };
45
820
  }).sort((a, b) => {
46
821
  if (!a.isDir && b.isDir)
@@ -58,7 +833,7 @@ function getFileNodes(option, nodes = [], dir = path.resolve("./"), level = 0) {
58
833
  const fullPath = path.join(dir, item.name);
59
834
  const isDir = fs.lstatSync(fullPath).isDirectory();
60
835
  if (isDir) {
61
- getFileNodes(option, item.children = [], fullPath, level + 1);
836
+ getFileNodes(fullPath, option, item.children = [], level + 1);
62
837
  nodes.push(item);
63
838
  } else {
64
839
  const i = fullPath.lastIndexOf(".");
@@ -67,6 +842,7 @@ function getFileNodes(option, nodes = [], dir = path.resolve("./"), level = 0) {
67
842
  const obj = getFile(fullPath);
68
843
  Object.assign(item, obj);
69
844
  item.suffix = lastName;
845
+ item.fullPath = fullPath;
70
846
  nodes.push(item);
71
847
  }
72
848
  }
@@ -79,13 +855,10 @@ function getNote(datas, keys) {
79
855
  datas.forEach((obj, index) => {
80
856
  const last = index === datas.length - 1;
81
857
  if (obj.children) {
82
- const md = setMd(obj, last);
83
- nodes.push(md);
84
858
  getNote(obj.children, nodes);
85
- } else {
86
- const md = setMd(obj, last);
87
- nodes.push(md);
88
859
  }
860
+ const md = setMd(obj, last);
861
+ nodes.push(md);
89
862
  });
90
863
  return nodes;
91
864
  }
@@ -102,35 +875,11 @@ function setMd(obj, last) {
102
875
  }
103
876
  return filesString;
104
877
  }
105
- function wirteJs(data, filePath) {
106
- const file = path.resolve(__dirname, filePath);
107
- const pre = "export default";
108
- fs.writeFile(file, pre + data, { encoding: "utf8" }, (err) => {
109
- console.error(err);
110
- });
111
- }
112
- function format(num) {
113
- var reg = /\d{1,3}(?=(\d{3})+$)/g;
114
- return (num + "").replace(reg, "$&,");
115
- }
116
- function setCountMd(obj) {
117
- const { rowTotleNumber, sizeTotleNumber, coutObj } = obj;
118
- let countMd = "";
119
- let totle = 0;
120
- for (const key in coutObj) {
121
- const ele = coutObj[key];
122
- totle += ele;
123
- countMd += `The suffix is ${key} has ${ele} files
124
- `;
125
- }
126
- countMd += `The totle has ${totle} files
127
- `;
128
- let md = `Total number of file lines: ${format(rowTotleNumber)},
129
- Total number of codes: ${format(sizeTotleNumber)}
130
- `;
131
- md = countMd + md;
132
- return md;
133
- }
878
+
879
+ // src/commands/wirte-md.ts
880
+ var import_debug2 = __toESM(require_src());
881
+ var debug2 = (0, import_debug2.default)("wirte-md");
882
+ debug2.enabled = false;
134
883
  function getCountMd(datas) {
135
884
  let rowTotleNumber = 0;
136
885
  let sizeTotleNumber = 0;
@@ -155,29 +904,43 @@ function getCountMd(datas) {
155
904
  coutObj
156
905
  };
157
906
  }
158
- function getMd(option) {
159
- console.log("\x1B[36m%s\x1B[0m", "*** run location: ", path.resolve("./"));
160
- const nodes = getFileNodes(option);
161
- wirteJs(JSON.stringify(nodes), __dirname + "\\readme-file.js");
907
+ function format(num) {
908
+ var reg = /\d{1,3}(?=(\d{3})+$)/g;
909
+ return (num + "").replace(reg, "$&,");
910
+ }
911
+ function setCountMd(obj) {
912
+ const { rowTotleNumber, sizeTotleNumber, coutObj } = obj;
913
+ let countMd = "";
914
+ let totle = 0;
915
+ for (const key in coutObj) {
916
+ const ele = coutObj[key];
917
+ totle += ele;
918
+ countMd += `The suffix is ${key} has ${ele} files
919
+ `;
920
+ }
921
+ countMd += `The totle has ${totle} files
922
+ `;
923
+ let md = `Total number of file lines: ${format(rowTotleNumber)},
924
+ Total number of codes: ${format(sizeTotleNumber)}
925
+ `;
926
+ md = countMd + md;
927
+ return md;
928
+ }
929
+ function getMd(rootPath, option) {
930
+ console.log("\x1B[36m%s\x1B[0m", "*** run location: ", path2.resolve("./") + "\n");
931
+ const nodes = getFileNodes(rootPath, option);
162
932
  const countMdObj = getCountMd(nodes);
163
933
  const coutMd = setCountMd(countMdObj);
934
+ console.log("\x1B[33m%s\x1B[0m", coutMd);
164
935
  const note = getNote(nodes);
165
936
  const md = note.join("") + "\n";
166
937
  if (md.length > 0) {
167
938
  console.log("\x1B[36m%s\x1B[0m", "*** Automatic generation completed ! ");
168
939
  }
169
- console.log("\x1B[33m%s\x1B[0m:", coutMd);
170
- return md + coutMd;
171
- }
172
- function wirteMd(data, filePath) {
173
- const file = path.resolve(__dirname, filePath);
174
- fs.writeFile(file, data, { encoding: "utf8" }, (err) => {
175
- console.error(err);
176
- });
940
+ return { md: md + coutMd, nodes };
177
941
  }
178
942
  export {
179
943
  getFileNodes,
180
- getMd,
181
- wirteMd
944
+ getMd
182
945
  };
183
946
  //# sourceMappingURL=index.esm.js.map