agmd 0.3.11 → 0.3.12
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/bin/bin.js +65 -65
- package/bin/bin.js.map +4 -4
- package/lib/commands/change-path.d.ts +2 -2
- package/lib/index.cjs.js +77 -95
- package/lib/index.cjs.js.map +4 -4
- package/lib/index.esm.js +77 -95
- package/lib/index.esm.js.map +4 -4
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* agmd v0.3.
|
|
2
|
+
* agmd v0.3.11
|
|
3
3
|
* author:kakajun <253495832@qq.com>
|
|
4
|
-
*
|
|
4
|
+
* Tue Nov 28 2023 22:44:13 GMT+0800 (中国标准时间)
|
|
5
5
|
*/
|
|
6
6
|
var __create = Object.create;
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
@@ -36,9 +36,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
36
|
mod
|
|
37
37
|
));
|
|
38
38
|
|
|
39
|
-
// node_modules/.
|
|
39
|
+
// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
|
|
40
40
|
var require_ms = __commonJS({
|
|
41
|
-
"node_modules/.
|
|
41
|
+
"node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports, module) {
|
|
42
42
|
var s = 1e3;
|
|
43
43
|
var m = s * 60;
|
|
44
44
|
var h = m * 60;
|
|
@@ -152,9 +152,9 @@ var require_ms = __commonJS({
|
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
// node_modules/.
|
|
155
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js
|
|
156
156
|
var require_common = __commonJS({
|
|
157
|
-
"node_modules/.
|
|
157
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js"(exports, module) {
|
|
158
158
|
function setup(env2) {
|
|
159
159
|
createDebug.debug = createDebug;
|
|
160
160
|
createDebug.default = createDebug;
|
|
@@ -315,9 +315,9 @@ var require_common = __commonJS({
|
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
|
|
318
|
-
// node_modules/.
|
|
318
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
|
|
319
319
|
var require_browser = __commonJS({
|
|
320
|
-
"node_modules/.
|
|
320
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module) {
|
|
321
321
|
exports.formatArgs = formatArgs;
|
|
322
322
|
exports.save = save;
|
|
323
323
|
exports.load = load;
|
|
@@ -484,43 +484,35 @@ var require_browser = __commonJS({
|
|
|
484
484
|
}
|
|
485
485
|
});
|
|
486
486
|
|
|
487
|
-
// node_modules/.
|
|
487
|
+
// node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
|
|
488
488
|
var require_has_flag = __commonJS({
|
|
489
|
-
"node_modules/.
|
|
489
|
+
"node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports, module) {
|
|
490
490
|
"use strict";
|
|
491
|
-
module.exports = (flag, argv
|
|
491
|
+
module.exports = (flag, argv) => {
|
|
492
|
+
argv = argv || process.argv;
|
|
492
493
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
493
|
-
const
|
|
494
|
-
const
|
|
495
|
-
return
|
|
494
|
+
const pos = argv.indexOf(prefix + flag);
|
|
495
|
+
const terminatorPos = argv.indexOf("--");
|
|
496
|
+
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
496
497
|
};
|
|
497
498
|
}
|
|
498
499
|
});
|
|
499
500
|
|
|
500
|
-
// node_modules/.
|
|
501
|
+
// node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
|
|
501
502
|
var require_supports_color = __commonJS({
|
|
502
|
-
"node_modules/.
|
|
503
|
+
"node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports, module) {
|
|
503
504
|
"use strict";
|
|
504
505
|
var os = __require("os");
|
|
505
|
-
var tty = __require("tty");
|
|
506
506
|
var hasFlag = require_has_flag();
|
|
507
|
-
var
|
|
508
|
-
var
|
|
509
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")
|
|
510
|
-
|
|
507
|
+
var env2 = process.env;
|
|
508
|
+
var forceColor;
|
|
509
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
|
510
|
+
forceColor = false;
|
|
511
511
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
512
|
-
|
|
512
|
+
forceColor = true;
|
|
513
513
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (env2.FORCE_COLOR === "true") {
|
|
517
|
-
return 1;
|
|
518
|
-
}
|
|
519
|
-
if (env2.FORCE_COLOR === "false") {
|
|
520
|
-
return 0;
|
|
521
|
-
}
|
|
522
|
-
return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
|
|
523
|
-
}
|
|
514
|
+
if ("FORCE_COLOR" in env2) {
|
|
515
|
+
forceColor = env2.FORCE_COLOR.length === 0 || parseInt(env2.FORCE_COLOR, 10) !== 0;
|
|
524
516
|
}
|
|
525
517
|
function translateLevel(level) {
|
|
526
518
|
if (level === 0) {
|
|
@@ -533,39 +525,29 @@ var require_supports_color = __commonJS({
|
|
|
533
525
|
has16m: level >= 3
|
|
534
526
|
};
|
|
535
527
|
}
|
|
536
|
-
function supportsColor(
|
|
537
|
-
|
|
538
|
-
if (noFlagForceColor !== void 0) {
|
|
539
|
-
flagForceColor = noFlagForceColor;
|
|
540
|
-
}
|
|
541
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
542
|
-
if (forceColor === 0) {
|
|
528
|
+
function supportsColor(stream) {
|
|
529
|
+
if (forceColor === false) {
|
|
543
530
|
return 0;
|
|
544
531
|
}
|
|
545
|
-
if (
|
|
546
|
-
|
|
547
|
-
return 3;
|
|
548
|
-
}
|
|
549
|
-
if (hasFlag("color=256")) {
|
|
550
|
-
return 2;
|
|
551
|
-
}
|
|
532
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
533
|
+
return 3;
|
|
552
534
|
}
|
|
553
|
-
if (
|
|
554
|
-
return
|
|
535
|
+
if (hasFlag("color=256")) {
|
|
536
|
+
return 2;
|
|
555
537
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
return min;
|
|
538
|
+
if (stream && !stream.isTTY && forceColor !== true) {
|
|
539
|
+
return 0;
|
|
559
540
|
}
|
|
541
|
+
const min = forceColor ? 1 : 0;
|
|
560
542
|
if (process.platform === "win32") {
|
|
561
543
|
const osRelease = os.release().split(".");
|
|
562
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
544
|
+
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
563
545
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
564
546
|
}
|
|
565
547
|
return 1;
|
|
566
548
|
}
|
|
567
549
|
if ("CI" in env2) {
|
|
568
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"
|
|
550
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
|
|
569
551
|
return 1;
|
|
570
552
|
}
|
|
571
553
|
return min;
|
|
@@ -577,7 +559,7 @@ var require_supports_color = __commonJS({
|
|
|
577
559
|
return 3;
|
|
578
560
|
}
|
|
579
561
|
if ("TERM_PROGRAM" in env2) {
|
|
580
|
-
const version =
|
|
562
|
+
const version = parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
581
563
|
switch (env2.TERM_PROGRAM) {
|
|
582
564
|
case "iTerm.app":
|
|
583
565
|
return version >= 3 ? 3 : 2;
|
|
@@ -594,26 +576,26 @@ var require_supports_color = __commonJS({
|
|
|
594
576
|
if ("COLORTERM" in env2) {
|
|
595
577
|
return 1;
|
|
596
578
|
}
|
|
579
|
+
if (env2.TERM === "dumb") {
|
|
580
|
+
return min;
|
|
581
|
+
}
|
|
597
582
|
return min;
|
|
598
583
|
}
|
|
599
|
-
function getSupportLevel(stream
|
|
600
|
-
const level = supportsColor(stream
|
|
601
|
-
streamIsTTY: stream && stream.isTTY,
|
|
602
|
-
...options2
|
|
603
|
-
});
|
|
584
|
+
function getSupportLevel(stream) {
|
|
585
|
+
const level = supportsColor(stream);
|
|
604
586
|
return translateLevel(level);
|
|
605
587
|
}
|
|
606
588
|
module.exports = {
|
|
607
589
|
supportsColor: getSupportLevel,
|
|
608
|
-
stdout: getSupportLevel(
|
|
609
|
-
stderr: getSupportLevel(
|
|
590
|
+
stdout: getSupportLevel(process.stdout),
|
|
591
|
+
stderr: getSupportLevel(process.stderr)
|
|
610
592
|
};
|
|
611
593
|
}
|
|
612
594
|
});
|
|
613
595
|
|
|
614
|
-
// node_modules/.
|
|
596
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js
|
|
615
597
|
var require_node = __commonJS({
|
|
616
|
-
"node_modules/.
|
|
598
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js"(exports, module) {
|
|
617
599
|
var tty = __require("tty");
|
|
618
600
|
var util = __require("util");
|
|
619
601
|
exports.init = init;
|
|
@@ -785,9 +767,9 @@ var require_node = __commonJS({
|
|
|
785
767
|
}
|
|
786
768
|
});
|
|
787
769
|
|
|
788
|
-
// node_modules/.
|
|
770
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js
|
|
789
771
|
var require_src = __commonJS({
|
|
790
|
-
"node_modules/.
|
|
772
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js"(exports, module) {
|
|
791
773
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
792
774
|
module.exports = require_browser();
|
|
793
775
|
} else {
|
|
@@ -796,18 +778,18 @@ var require_src = __commonJS({
|
|
|
796
778
|
}
|
|
797
779
|
});
|
|
798
780
|
|
|
799
|
-
// node_modules/.
|
|
781
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js
|
|
800
782
|
var require_compare_aliases = __commonJS({
|
|
801
|
-
"node_modules/.
|
|
783
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js"(exports, module) {
|
|
802
784
|
module.exports = function compareAliases(env2, ...aliases) {
|
|
803
785
|
return aliases.some((alias) => alias.toLowerCase() === env2.toLowerCase());
|
|
804
786
|
};
|
|
805
787
|
}
|
|
806
788
|
});
|
|
807
789
|
|
|
808
|
-
// node_modules/.
|
|
790
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js
|
|
809
791
|
var require_modes_enum = __commonJS({
|
|
810
|
-
"node_modules/.
|
|
792
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js"(exports, module) {
|
|
811
793
|
var Development = {
|
|
812
794
|
dev: "dev",
|
|
813
795
|
development: "development"
|
|
@@ -823,9 +805,9 @@ var require_modes_enum = __commonJS({
|
|
|
823
805
|
}
|
|
824
806
|
});
|
|
825
807
|
|
|
826
|
-
// node_modules/.
|
|
808
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js
|
|
827
809
|
var require_inspector = __commonJS({
|
|
828
|
-
"node_modules/.
|
|
810
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js"(exports, module) {
|
|
829
811
|
var compare = require_compare_aliases();
|
|
830
812
|
var modes = require_modes_enum();
|
|
831
813
|
function inspector(...envs) {
|
|
@@ -855,9 +837,9 @@ var require_inspector = __commonJS({
|
|
|
855
837
|
}
|
|
856
838
|
});
|
|
857
839
|
|
|
858
|
-
// node_modules/.
|
|
840
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/index.js
|
|
859
841
|
var require_lib = __commonJS({
|
|
860
|
-
"node_modules/.
|
|
842
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/index.js"(exports, module) {
|
|
861
843
|
module.exports = {
|
|
862
844
|
env: require_inspector()
|
|
863
845
|
};
|
|
@@ -873,7 +855,7 @@ import path2 from "path";
|
|
|
873
855
|
import fs from "fs";
|
|
874
856
|
import path from "path";
|
|
875
857
|
|
|
876
|
-
// node_modules/.
|
|
858
|
+
// node_modules/.pnpm/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
|
|
877
859
|
var enabled = true;
|
|
878
860
|
var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
879
861
|
var supportLevel = 0;
|
|
@@ -985,7 +967,8 @@ var logger_default = logger;
|
|
|
985
967
|
// src/commands/change-path.ts
|
|
986
968
|
var import_debug = __toESM(require_src());
|
|
987
969
|
var debug = (0, import_debug.default)("change-path");
|
|
988
|
-
debug.enabled =
|
|
970
|
+
debug.enabled = true;
|
|
971
|
+
var rootPath = process.cwd().replace(/\\/g, "/");
|
|
989
972
|
function getRelatPath(absoluteImport, fullPath) {
|
|
990
973
|
let relatPath = path.relative(path.dirname(fullPath), absoluteImport);
|
|
991
974
|
relatPath = relatPath.replace(/\\/g, "/");
|
|
@@ -1007,7 +990,7 @@ function makeSuffix(filePath, fullPath) {
|
|
|
1007
990
|
debug("lastName", lastName);
|
|
1008
991
|
if (!lastName) {
|
|
1009
992
|
debug("!!!!!!!!!!!\u7F3A\u540E\u7F00\u6587\u4EF6: ", absoluteImport);
|
|
1010
|
-
const suffix = [".js", ".ts", ".vue", "/index.js", "/index.vue"];
|
|
993
|
+
const suffix = [".js", ".ts", ".vue", ".tsx", "/index.js", "/index.vue"];
|
|
1011
994
|
for (let j = 0; j < suffix.length; j++) {
|
|
1012
995
|
const fixStr = suffix[j];
|
|
1013
996
|
if (fs.existsSync(absoluteImport + fixStr)) {
|
|
@@ -1019,20 +1002,9 @@ function makeSuffix(filePath, fullPath) {
|
|
|
1019
1002
|
}
|
|
1020
1003
|
return absoluteImport.replace(/\\/g, "/");
|
|
1021
1004
|
}
|
|
1022
|
-
function getImportName(ele) {
|
|
1005
|
+
function getImportName(ele, dependencies) {
|
|
1023
1006
|
let str = "";
|
|
1024
|
-
const
|
|
1025
|
-
"xiwicloud",
|
|
1026
|
-
"bpmn-js",
|
|
1027
|
-
"element-ui",
|
|
1028
|
-
"lodash",
|
|
1029
|
-
"handsontable",
|
|
1030
|
-
"nprogress",
|
|
1031
|
-
"quill",
|
|
1032
|
-
"qrcodejs2",
|
|
1033
|
-
"echarts"
|
|
1034
|
-
];
|
|
1035
|
-
const flag = ignore.some((item) => ele.indexOf(item) > -1);
|
|
1007
|
+
const flag = dependencies.some((item) => ele.indexOf(item) > -1);
|
|
1036
1008
|
const reg = / from [\"|\'](.*)[\'|\"]/;
|
|
1037
1009
|
if (!flag && ele.indexOf("/") > -1 && ele.indexOf("//") !== 0) {
|
|
1038
1010
|
const impStr = ele.match(reg);
|
|
@@ -1041,13 +1013,13 @@ function getImportName(ele) {
|
|
|
1041
1013
|
}
|
|
1042
1014
|
return str;
|
|
1043
1015
|
}
|
|
1044
|
-
function changeImport(ele, fullPath, nochangePath) {
|
|
1016
|
+
function changeImport(ele, fullPath, dependencies, nochangePath) {
|
|
1045
1017
|
const obj = {
|
|
1046
1018
|
impName: "",
|
|
1047
1019
|
filePath: "",
|
|
1048
1020
|
absoluteImport: ""
|
|
1049
1021
|
};
|
|
1050
|
-
const impName = getImportName(ele);
|
|
1022
|
+
const impName = getImportName(ele, dependencies);
|
|
1051
1023
|
if (impName) {
|
|
1052
1024
|
obj.filePath = impName;
|
|
1053
1025
|
debug("!!!!!!!!!\u5339\u914Dimp: ", impName);
|
|
@@ -1065,6 +1037,7 @@ function changeImport(ele, fullPath, nochangePath) {
|
|
|
1065
1037
|
var import_node_environment = __toESM(require_lib());
|
|
1066
1038
|
var debug2 = (0, import_debug2.default)("get-file");
|
|
1067
1039
|
debug2.enabled = false;
|
|
1040
|
+
var rootPath2 = process.cwd().replace(/\\/g, "/");
|
|
1068
1041
|
var isDev = (0, import_node_environment.env)() === "development";
|
|
1069
1042
|
function getFile(fullPath) {
|
|
1070
1043
|
const str = fs2.readFileSync(fullPath, "utf-8");
|
|
@@ -1082,10 +1055,19 @@ function getFile(fullPath) {
|
|
|
1082
1055
|
};
|
|
1083
1056
|
}
|
|
1084
1057
|
function getImport(sarr, fullPath) {
|
|
1058
|
+
const dependencies = [];
|
|
1059
|
+
if (fs2.existsSync(rootPath2 + "/package.json")) {
|
|
1060
|
+
const pkg = __require(rootPath2 + "/package.json");
|
|
1061
|
+
if (pkg.devDependencies) {
|
|
1062
|
+
dependencies.push(...Object.keys(pkg.devDependencies));
|
|
1063
|
+
} else if (pkg.dependencies) {
|
|
1064
|
+
dependencies.push(...Object.keys(pkg.dependencies));
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1085
1067
|
const imports = [];
|
|
1086
1068
|
sarr.forEach((ele) => {
|
|
1087
1069
|
if (ele.indexOf("from") > -1) {
|
|
1088
|
-
const { absoluteImport } = changeImport(ele, fullPath);
|
|
1070
|
+
const { absoluteImport } = changeImport(ele, fullPath, dependencies);
|
|
1089
1071
|
if (absoluteImport) {
|
|
1090
1072
|
imports.push(absoluteImport);
|
|
1091
1073
|
}
|
|
@@ -1114,7 +1096,7 @@ function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
|
|
|
1114
1096
|
"readme-file.js",
|
|
1115
1097
|
"readme-md.js"
|
|
1116
1098
|
];
|
|
1117
|
-
let include = isDev ? [".js", ".vue"] : [".js", ".vue", ".ts"];
|
|
1099
|
+
let include = isDev ? [".js", ".vue"] : [".js", ".vue", ".ts", ".tsx"];
|
|
1118
1100
|
if (option) {
|
|
1119
1101
|
ignore = option.ignore || ignore;
|
|
1120
1102
|
include = option.include || include;
|
|
@@ -1192,7 +1174,7 @@ function setMd(obj, last) {
|
|
|
1192
1174
|
|
|
1193
1175
|
// src/commands/wirte-md.ts
|
|
1194
1176
|
var import_debug3 = __toESM(require_src());
|
|
1195
|
-
var
|
|
1177
|
+
var rootPath3 = process.cwd().replace(/\\/g, "/");
|
|
1196
1178
|
var debug3 = (0, import_debug3.default)("wirte-md");
|
|
1197
1179
|
debug3.enabled = false;
|
|
1198
1180
|
function getCountMd(datas) {
|
|
@@ -1243,7 +1225,7 @@ function setCountMd(obj) {
|
|
|
1243
1225
|
}
|
|
1244
1226
|
function getMd(option) {
|
|
1245
1227
|
logger_default.success("\u{1F449} \u547D\u4EE4\u8FD0\u884C\u4F4D\u7F6E: " + process.cwd() + "\n");
|
|
1246
|
-
const nodes = getFileNodes(
|
|
1228
|
+
const nodes = getFileNodes(rootPath3, option);
|
|
1247
1229
|
const countMdObj = getCountMd(nodes);
|
|
1248
1230
|
const coutMd = setCountMd(countMdObj);
|
|
1249
1231
|
logger_default.success(coutMd);
|