agmd 0.3.7 → 0.3.11
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 +34 -20
- package/bin/bin.js +101 -94
- package/bin/bin.js.map +4 -4
- package/lib/commands/change-path.d.ts +12 -12
- package/lib/commands/get-file.d.ts +26 -26
- package/lib/commands/wirte-md.d.ts +9 -9
- package/lib/index.cjs.js +73 -50
- package/lib/index.cjs.js.map +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.esm.js +74 -51
- package/lib/index.esm.js.map +3 -3
- package/lib/shared/logger.d.ts +7 -7
- package/package.json +23 -22
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* agmd v0.3.
|
|
2
|
+
* agmd v0.3.10
|
|
3
3
|
* author:kakajun <253495832@qq.com>
|
|
4
|
-
*
|
|
4
|
+
* Fri Nov 17 2023 15:04:26 GMT+0800 (中国标准时间)
|
|
5
5
|
*/
|
|
6
6
|
var __create = Object.create;
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
@@ -14,7 +14,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
14
14
|
}) : x)(function(x) {
|
|
15
15
|
if (typeof require !== "undefined")
|
|
16
16
|
return require.apply(this, arguments);
|
|
17
|
-
throw
|
|
17
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
18
18
|
});
|
|
19
19
|
var __commonJS = (cb, mod) => function __require2() {
|
|
20
20
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -28,13 +28,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
28
28
|
return to;
|
|
29
29
|
};
|
|
30
30
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
35
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
36
|
mod
|
|
33
37
|
));
|
|
34
38
|
|
|
35
|
-
// node_modules/
|
|
36
|
-
var
|
|
37
|
-
"node_modules/
|
|
39
|
+
// node_modules/.store/ms@2.1.2/node_modules/ms/index.js
|
|
40
|
+
var require_ms = __commonJS({
|
|
41
|
+
"node_modules/.store/ms@2.1.2/node_modules/ms/index.js"(exports, module) {
|
|
38
42
|
var s = 1e3;
|
|
39
43
|
var m = s * 60;
|
|
40
44
|
var h = m * 60;
|
|
@@ -148,9 +152,9 @@ var require_ms_2_1 = __commonJS({
|
|
|
148
152
|
}
|
|
149
153
|
});
|
|
150
154
|
|
|
151
|
-
// node_modules/
|
|
155
|
+
// node_modules/.store/debug@4.3.4/node_modules/debug/src/common.js
|
|
152
156
|
var require_common = __commonJS({
|
|
153
|
-
"node_modules/
|
|
157
|
+
"node_modules/.store/debug@4.3.4/node_modules/debug/src/common.js"(exports, module) {
|
|
154
158
|
function setup(env2) {
|
|
155
159
|
createDebug.debug = createDebug;
|
|
156
160
|
createDebug.default = createDebug;
|
|
@@ -158,7 +162,7 @@ var require_common = __commonJS({
|
|
|
158
162
|
createDebug.disable = disable;
|
|
159
163
|
createDebug.enable = enable;
|
|
160
164
|
createDebug.enabled = enabled2;
|
|
161
|
-
createDebug.humanize =
|
|
165
|
+
createDebug.humanize = require_ms();
|
|
162
166
|
createDebug.destroy = destroy;
|
|
163
167
|
Object.keys(env2).forEach((key) => {
|
|
164
168
|
createDebug[key] = env2[key];
|
|
@@ -185,7 +189,7 @@ var require_common = __commonJS({
|
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
const self2 = debug4;
|
|
188
|
-
const curr = Number(new Date());
|
|
192
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
189
193
|
const ms = curr - (prevTime || curr);
|
|
190
194
|
self2.diff = ms;
|
|
191
195
|
self2.prev = prevTime;
|
|
@@ -311,9 +315,9 @@ var require_common = __commonJS({
|
|
|
311
315
|
}
|
|
312
316
|
});
|
|
313
317
|
|
|
314
|
-
// node_modules/
|
|
318
|
+
// node_modules/.store/debug@4.3.4/node_modules/debug/src/browser.js
|
|
315
319
|
var require_browser = __commonJS({
|
|
316
|
-
"node_modules/
|
|
320
|
+
"node_modules/.store/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module) {
|
|
317
321
|
exports.formatArgs = formatArgs;
|
|
318
322
|
exports.save = save;
|
|
319
323
|
exports.load = load;
|
|
@@ -413,7 +417,11 @@ var require_browser = __commonJS({
|
|
|
413
417
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
414
418
|
return false;
|
|
415
419
|
}
|
|
416
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
|
420
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
421
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
422
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
423
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
424
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
417
425
|
}
|
|
418
426
|
function formatArgs(args) {
|
|
419
427
|
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
@@ -476,9 +484,9 @@ var require_browser = __commonJS({
|
|
|
476
484
|
}
|
|
477
485
|
});
|
|
478
486
|
|
|
479
|
-
// node_modules/
|
|
480
|
-
var
|
|
481
|
-
"node_modules/
|
|
487
|
+
// node_modules/.store/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
488
|
+
var require_has_flag = __commonJS({
|
|
489
|
+
"node_modules/.store/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
|
|
482
490
|
"use strict";
|
|
483
491
|
module.exports = (flag, argv = process.argv) => {
|
|
484
492
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
@@ -489,13 +497,13 @@ var require_has_flag_4_0 = __commonJS({
|
|
|
489
497
|
}
|
|
490
498
|
});
|
|
491
499
|
|
|
492
|
-
// node_modules/
|
|
493
|
-
var
|
|
494
|
-
"node_modules/
|
|
500
|
+
// node_modules/.store/supports-color@8.1.1/node_modules/supports-color/index.js
|
|
501
|
+
var require_supports_color = __commonJS({
|
|
502
|
+
"node_modules/.store/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module) {
|
|
495
503
|
"use strict";
|
|
496
504
|
var os = __require("os");
|
|
497
505
|
var tty = __require("tty");
|
|
498
|
-
var hasFlag =
|
|
506
|
+
var hasFlag = require_has_flag();
|
|
499
507
|
var { env: env2 } = process;
|
|
500
508
|
var flagForceColor;
|
|
501
509
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
@@ -603,9 +611,9 @@ var require_supports_color_8_1 = __commonJS({
|
|
|
603
611
|
}
|
|
604
612
|
});
|
|
605
613
|
|
|
606
|
-
// node_modules/
|
|
614
|
+
// node_modules/.store/debug@4.3.4/node_modules/debug/src/node.js
|
|
607
615
|
var require_node = __commonJS({
|
|
608
|
-
"node_modules/
|
|
616
|
+
"node_modules/.store/debug@4.3.4/node_modules/debug/src/node.js"(exports, module) {
|
|
609
617
|
var tty = __require("tty");
|
|
610
618
|
var util = __require("util");
|
|
611
619
|
exports.init = init;
|
|
@@ -621,7 +629,7 @@ var require_node = __commonJS({
|
|
|
621
629
|
);
|
|
622
630
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
623
631
|
try {
|
|
624
|
-
const supportsColor =
|
|
632
|
+
const supportsColor = require_supports_color();
|
|
625
633
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
626
634
|
exports.colors = [
|
|
627
635
|
20,
|
|
@@ -742,7 +750,7 @@ var require_node = __commonJS({
|
|
|
742
750
|
if (exports.inspectOpts.hideDate) {
|
|
743
751
|
return "";
|
|
744
752
|
}
|
|
745
|
-
return new Date().toISOString() + " ";
|
|
753
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
746
754
|
}
|
|
747
755
|
function log(...args) {
|
|
748
756
|
return process.stderr.write(util.format(...args) + "\n");
|
|
@@ -777,9 +785,9 @@ var require_node = __commonJS({
|
|
|
777
785
|
}
|
|
778
786
|
});
|
|
779
787
|
|
|
780
|
-
// node_modules/
|
|
788
|
+
// node_modules/.store/debug@4.3.4/node_modules/debug/src/index.js
|
|
781
789
|
var require_src = __commonJS({
|
|
782
|
-
"node_modules/
|
|
790
|
+
"node_modules/.store/debug@4.3.4/node_modules/debug/src/index.js"(exports, module) {
|
|
783
791
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
784
792
|
module.exports = require_browser();
|
|
785
793
|
} else {
|
|
@@ -788,18 +796,18 @@ var require_src = __commonJS({
|
|
|
788
796
|
}
|
|
789
797
|
});
|
|
790
798
|
|
|
791
|
-
// node_modules/
|
|
799
|
+
// node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js
|
|
792
800
|
var require_compare_aliases = __commonJS({
|
|
793
|
-
"node_modules/
|
|
801
|
+
"node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js"(exports, module) {
|
|
794
802
|
module.exports = function compareAliases(env2, ...aliases) {
|
|
795
803
|
return aliases.some((alias) => alias.toLowerCase() === env2.toLowerCase());
|
|
796
804
|
};
|
|
797
805
|
}
|
|
798
806
|
});
|
|
799
807
|
|
|
800
|
-
// node_modules/
|
|
808
|
+
// node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js
|
|
801
809
|
var require_modes_enum = __commonJS({
|
|
802
|
-
"node_modules/
|
|
810
|
+
"node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js"(exports, module) {
|
|
803
811
|
var Development = {
|
|
804
812
|
dev: "dev",
|
|
805
813
|
development: "development"
|
|
@@ -815,9 +823,9 @@ var require_modes_enum = __commonJS({
|
|
|
815
823
|
}
|
|
816
824
|
});
|
|
817
825
|
|
|
818
|
-
// node_modules/
|
|
826
|
+
// node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js
|
|
819
827
|
var require_inspector = __commonJS({
|
|
820
|
-
"node_modules/
|
|
828
|
+
"node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js"(exports, module) {
|
|
821
829
|
var compare = require_compare_aliases();
|
|
822
830
|
var modes = require_modes_enum();
|
|
823
831
|
function inspector(...envs) {
|
|
@@ -847,9 +855,9 @@ var require_inspector = __commonJS({
|
|
|
847
855
|
}
|
|
848
856
|
});
|
|
849
857
|
|
|
850
|
-
// node_modules/
|
|
858
|
+
// node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/index.js
|
|
851
859
|
var require_lib = __commonJS({
|
|
852
|
-
"node_modules/
|
|
860
|
+
"node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/index.js"(exports, module) {
|
|
853
861
|
module.exports = {
|
|
854
862
|
env: require_inspector()
|
|
855
863
|
};
|
|
@@ -865,15 +873,15 @@ import path2 from "path";
|
|
|
865
873
|
import fs from "fs";
|
|
866
874
|
import path from "path";
|
|
867
875
|
|
|
868
|
-
// node_modules/
|
|
876
|
+
// node_modules/.store/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
|
|
869
877
|
var enabled = true;
|
|
870
878
|
var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
871
879
|
var supportLevel = 0;
|
|
872
880
|
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
|
873
|
-
const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = globalVar.process.env;
|
|
874
|
-
if (NODE_DISABLE_COLORS || FORCE_COLOR === "0") {
|
|
881
|
+
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
|
|
882
|
+
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") {
|
|
875
883
|
enabled = false;
|
|
876
|
-
} else if (FORCE_COLOR === "1") {
|
|
884
|
+
} else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") {
|
|
877
885
|
enabled = true;
|
|
878
886
|
} else if (TERM === "dumb") {
|
|
879
887
|
enabled = false;
|
|
@@ -891,7 +899,17 @@ if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
|
|
891
899
|
enabled = process.stdout.isTTY;
|
|
892
900
|
}
|
|
893
901
|
if (enabled) {
|
|
894
|
-
|
|
902
|
+
if (process.platform === "win32") {
|
|
903
|
+
supportLevel = 3;
|
|
904
|
+
} else {
|
|
905
|
+
if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) {
|
|
906
|
+
supportLevel = 3;
|
|
907
|
+
} else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) {
|
|
908
|
+
supportLevel = 2;
|
|
909
|
+
} else {
|
|
910
|
+
supportLevel = 1;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
895
913
|
}
|
|
896
914
|
}
|
|
897
915
|
var options = {
|
|
@@ -1023,8 +1041,8 @@ function getImportName(ele) {
|
|
|
1023
1041
|
}
|
|
1024
1042
|
return str;
|
|
1025
1043
|
}
|
|
1026
|
-
function changeImport(ele, fullPath) {
|
|
1027
|
-
|
|
1044
|
+
function changeImport(ele, fullPath, nochangePath) {
|
|
1045
|
+
const obj = {
|
|
1028
1046
|
impName: "",
|
|
1029
1047
|
filePath: "",
|
|
1030
1048
|
absoluteImport: ""
|
|
@@ -1035,8 +1053,10 @@ function changeImport(ele, fullPath) {
|
|
|
1035
1053
|
debug("!!!!!!!!!\u5339\u914Dimp: ", impName);
|
|
1036
1054
|
obj.absoluteImport = makeSuffix(obj.filePath, fullPath);
|
|
1037
1055
|
debug("\u8865\u8FC7\u540E", obj.absoluteImport);
|
|
1038
|
-
|
|
1039
|
-
|
|
1056
|
+
if (!nochangePath) {
|
|
1057
|
+
obj.impName = getRelatPath(obj.absoluteImport, fullPath);
|
|
1058
|
+
debug("\u76F8\u5BF9\u8DEF\u5F84: ", obj.impName);
|
|
1059
|
+
}
|
|
1040
1060
|
}
|
|
1041
1061
|
return obj;
|
|
1042
1062
|
}
|
|
@@ -1055,6 +1075,7 @@ function getFile(fullPath) {
|
|
|
1055
1075
|
const f = sarr[0].indexOf("eslint") === -1 && (sarr[0].indexOf("-->") > -1 || sarr[0].indexOf("*/") > -1 || sarr[0].indexOf("//") > -1) ? sarr[0] : "";
|
|
1056
1076
|
return {
|
|
1057
1077
|
note: f.replace(/<\/?[^>]*>|(\n|\r)/g, ""),
|
|
1078
|
+
// 去掉尾巴换行符号
|
|
1058
1079
|
size,
|
|
1059
1080
|
rowSize,
|
|
1060
1081
|
imports
|
|
@@ -1074,6 +1095,8 @@ function getImport(sarr, fullPath) {
|
|
|
1074
1095
|
}
|
|
1075
1096
|
function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
|
|
1076
1097
|
let ignore = [
|
|
1098
|
+
// 'api',
|
|
1099
|
+
// 'src',
|
|
1077
1100
|
"bin",
|
|
1078
1101
|
"lib",
|
|
1079
1102
|
"jest.config.js",
|
|
@@ -1097,7 +1120,7 @@ function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
|
|
|
1097
1120
|
include = option.include || include;
|
|
1098
1121
|
}
|
|
1099
1122
|
const files = fs2.readdirSync(dir).map((item) => {
|
|
1100
|
-
|
|
1123
|
+
const fullPath = path2.join(dir, item);
|
|
1101
1124
|
const isDir = fs2.lstatSync(fullPath).isDirectory();
|
|
1102
1125
|
return {
|
|
1103
1126
|
name: item,
|
|
@@ -1202,24 +1225,24 @@ function format(num) {
|
|
|
1202
1225
|
}
|
|
1203
1226
|
function setCountMd(obj) {
|
|
1204
1227
|
const { rowTotleNumber, sizeTotleNumber, coutObj } = obj;
|
|
1205
|
-
let countMd = "";
|
|
1228
|
+
let countMd = "\u{1F60D} \u4EE3\u7801\u603B\u6570\u7EDF\u8BA1\uFF1A\n";
|
|
1206
1229
|
let totle = 0;
|
|
1207
1230
|
for (const key in coutObj) {
|
|
1208
1231
|
const ele = coutObj[key];
|
|
1209
1232
|
totle += ele;
|
|
1210
|
-
countMd +=
|
|
1233
|
+
countMd += `\u540E\u7F00\u662F ${key} \u7684\u6587\u4EF6\u6709 ${ele} \u4E2A
|
|
1211
1234
|
`;
|
|
1212
1235
|
}
|
|
1213
|
-
countMd +=
|
|
1236
|
+
countMd += `\u603B\u5171\u6709 ${totle} \u4E2A\u6587\u4EF6
|
|
1214
1237
|
`;
|
|
1215
|
-
let md =
|
|
1216
|
-
|
|
1238
|
+
let md = `\u603B\u4EE3\u7801\u884C\u6570\u6709: ${format(rowTotleNumber)}\u884C,
|
|
1239
|
+
\u603B\u4EE3\u7801\u5B57\u6570\u6709: ${format(sizeTotleNumber)}\u4E2A
|
|
1217
1240
|
`;
|
|
1218
1241
|
md = countMd + md;
|
|
1219
1242
|
return md;
|
|
1220
1243
|
}
|
|
1221
1244
|
function getMd(option) {
|
|
1222
|
-
logger_default.success("
|
|
1245
|
+
logger_default.success("\u{1F449} \u547D\u4EE4\u8FD0\u884C\u4F4D\u7F6E: " + process.cwd() + "\n");
|
|
1223
1246
|
const nodes = getFileNodes(rootPath, option);
|
|
1224
1247
|
const countMdObj = getCountMd(nodes);
|
|
1225
1248
|
const coutMd = setCountMd(countMdObj);
|
|
@@ -1227,7 +1250,7 @@ function getMd(option) {
|
|
|
1227
1250
|
const note = getNote(nodes);
|
|
1228
1251
|
const md = note.join("") + "\n";
|
|
1229
1252
|
if (md.length > 0) {
|
|
1230
|
-
logger_default.success("
|
|
1253
|
+
logger_default.success("\u{1F004}\uFE0F \u751F\u6210MarkDown\u5B8C\u6BD5 !");
|
|
1231
1254
|
}
|
|
1232
1255
|
return { md: md + coutMd, nodes };
|
|
1233
1256
|
}
|