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