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