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.
@@ -1,12 +1,12 @@
1
- import { ItemType } from './get-file';
2
- export declare function changePath(nodes: ItemType[]): Promise<void>;
3
- export declare function getRelatPath(absoluteImport: string, fullPath: string): string;
4
- export declare function makeSuffix(filePath: string, fullPath: string): string;
5
- export declare function getImportName(ele: string): string;
6
- export declare function changeImport(ele: string, fullPath: string): {
7
- impName: string;
8
- filePath: string;
9
- absoluteImport: string;
10
- };
11
- export declare function witeFile(node: ItemType, isRelative?: Boolean): void;
12
- export declare function wirteJsNodes(data: string, filePath: string): void;
1
+ import { ItemType } from './get-file';
2
+ export declare function changePath(nodes: ItemType[], nochangePath?: Boolean): Promise<void>;
3
+ export declare function getRelatPath(absoluteImport: string, fullPath: string): string;
4
+ export declare function makeSuffix(filePath: string, fullPath: string): string;
5
+ export declare function getImportName(ele: string): string;
6
+ export declare function changeImport(ele: string, fullPath: string, nochangePath?: Boolean): {
7
+ impName: string;
8
+ filePath: string;
9
+ absoluteImport: string;
10
+ };
11
+ export declare function witeFile(node: ItemType, isRelative?: Boolean, nochangePath?: Boolean): void;
12
+ export declare function wirteJsNodes(data: string, filePath: string): void;
@@ -1,26 +1,26 @@
1
- export declare function getFile(fullPath: string): {
2
- note: string;
3
- size: number;
4
- rowSize: number;
5
- imports: string[];
6
- };
7
- export declare function getImport(sarr: any[], fullPath: string): string[];
8
- export declare type ItemType = {
9
- name: string;
10
- copyed?: boolean;
11
- isDir: boolean;
12
- level: number;
13
- note: string;
14
- size?: number;
15
- suffix?: string;
16
- rowSize?: number;
17
- fullPath: string;
18
- belongTo: string[];
19
- imports: string[];
20
- children?: ItemType[];
21
- };
22
- export declare function getFileNodes(dir?: string, option?: {
23
- ignore: string[] | undefined;
24
- include: string[] | undefined;
25
- } | undefined, nodes?: ItemType[], level?: number): ItemType[];
26
- export declare function getNote(datas: ItemType[], keys?: string[]): string[];
1
+ export declare function getFile(fullPath: string): {
2
+ note: string;
3
+ size: number;
4
+ rowSize: number;
5
+ imports: string[];
6
+ };
7
+ export declare function getImport(sarr: any[], fullPath: string): string[];
8
+ export type ItemType = {
9
+ name: string;
10
+ copyed?: boolean;
11
+ isDir: boolean;
12
+ level: number;
13
+ note: string;
14
+ size?: number;
15
+ suffix?: string;
16
+ rowSize?: number;
17
+ fullPath: string;
18
+ belongTo: string[];
19
+ imports: string[];
20
+ children?: ItemType[];
21
+ };
22
+ export declare function getFileNodes(dir?: string, option?: {
23
+ ignore: string[] | undefined;
24
+ include: string[] | undefined;
25
+ } | undefined, nodes?: ItemType[], level?: number): ItemType[];
26
+ export declare function getNote(datas: ItemType[], keys?: string[]): string[];
@@ -1,9 +1,9 @@
1
- import { ItemType } from './get-file';
2
- export declare function wirteMd(data: string, filePath: string): void;
3
- export declare function getMd(option?: {
4
- ignore: string[] | undefined;
5
- include: string[] | undefined;
6
- } | undefined): {
7
- md: string;
8
- nodes: ItemType[];
9
- };
1
+ import { ItemType } from './get-file';
2
+ export declare function wirteMd(data: string, filePath: string): void;
3
+ export declare function getMd(option?: {
4
+ ignore: string[] | undefined;
5
+ include: string[] | undefined;
6
+ } | undefined): {
7
+ md: string;
8
+ nodes: ItemType[];
9
+ };
package/lib/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * agmd v0.3.6
2
+ * agmd v0.3.10
3
3
  * author:kakajun <253495832@qq.com>
4
- * Tue Oct 18 2022 11:35:52 GMT+0800 (中国标准时间)
4
+ * Fri Nov 17 2023 15:04:26 GMT+0800 (中国标准时间)
5
5
  */
6
6
  "use strict";
7
7
  var __create = Object.create;
@@ -26,14 +26,18 @@ var __copyProps = (to, from, except, desc) => {
26
26
  return to;
27
27
  };
28
28
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
33
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
34
  mod
31
35
  ));
32
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
37
 
34
- // node_modules/_ms@2.1.2@ms/index.js
35
- var require_ms_2_1 = __commonJS({
36
- "node_modules/_ms@2.1.2@ms/index.js"(exports, module2) {
38
+ // node_modules/.store/ms@2.1.2/node_modules/ms/index.js
39
+ var require_ms = __commonJS({
40
+ "node_modules/.store/ms@2.1.2/node_modules/ms/index.js"(exports, module2) {
37
41
  var s = 1e3;
38
42
  var m = s * 60;
39
43
  var h = m * 60;
@@ -147,9 +151,9 @@ var require_ms_2_1 = __commonJS({
147
151
  }
148
152
  });
149
153
 
150
- // node_modules/_debug@4.3.4@debug/src/common.js
154
+ // node_modules/.store/debug@4.3.4/node_modules/debug/src/common.js
151
155
  var require_common = __commonJS({
152
- "node_modules/_debug@4.3.4@debug/src/common.js"(exports, module2) {
156
+ "node_modules/.store/debug@4.3.4/node_modules/debug/src/common.js"(exports, module2) {
153
157
  function setup(env2) {
154
158
  createDebug.debug = createDebug;
155
159
  createDebug.default = createDebug;
@@ -157,7 +161,7 @@ var require_common = __commonJS({
157
161
  createDebug.disable = disable;
158
162
  createDebug.enable = enable;
159
163
  createDebug.enabled = enabled2;
160
- createDebug.humanize = require_ms_2_1();
164
+ createDebug.humanize = require_ms();
161
165
  createDebug.destroy = destroy;
162
166
  Object.keys(env2).forEach((key) => {
163
167
  createDebug[key] = env2[key];
@@ -184,7 +188,7 @@ var require_common = __commonJS({
184
188
  return;
185
189
  }
186
190
  const self2 = debug4;
187
- const curr = Number(new Date());
191
+ const curr = Number(/* @__PURE__ */ new Date());
188
192
  const ms = curr - (prevTime || curr);
189
193
  self2.diff = ms;
190
194
  self2.prev = prevTime;
@@ -310,9 +314,9 @@ var require_common = __commonJS({
310
314
  }
311
315
  });
312
316
 
313
- // node_modules/_debug@4.3.4@debug/src/browser.js
317
+ // node_modules/.store/debug@4.3.4/node_modules/debug/src/browser.js
314
318
  var require_browser = __commonJS({
315
- "node_modules/_debug@4.3.4@debug/src/browser.js"(exports, module2) {
319
+ "node_modules/.store/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module2) {
316
320
  exports.formatArgs = formatArgs;
317
321
  exports.save = save;
318
322
  exports.load = load;
@@ -412,7 +416,11 @@ var require_browser = __commonJS({
412
416
  if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
413
417
  return false;
414
418
  }
415
- 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+)/);
419
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
420
+ typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
421
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
422
+ 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
423
+ typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
416
424
  }
417
425
  function formatArgs(args) {
418
426
  args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
@@ -475,9 +483,9 @@ var require_browser = __commonJS({
475
483
  }
476
484
  });
477
485
 
478
- // node_modules/_has-flag@4.0.0@has-flag/index.js
479
- var require_has_flag_4_0 = __commonJS({
480
- "node_modules/_has-flag@4.0.0@has-flag/index.js"(exports, module2) {
486
+ // node_modules/.store/has-flag@4.0.0/node_modules/has-flag/index.js
487
+ var require_has_flag = __commonJS({
488
+ "node_modules/.store/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
481
489
  "use strict";
482
490
  module2.exports = (flag, argv = process.argv) => {
483
491
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -488,13 +496,13 @@ var require_has_flag_4_0 = __commonJS({
488
496
  }
489
497
  });
490
498
 
491
- // node_modules/_supports-color@8.1.1@supports-color/index.js
492
- var require_supports_color_8_1 = __commonJS({
493
- "node_modules/_supports-color@8.1.1@supports-color/index.js"(exports, module2) {
499
+ // node_modules/.store/supports-color@8.1.1/node_modules/supports-color/index.js
500
+ var require_supports_color = __commonJS({
501
+ "node_modules/.store/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module2) {
494
502
  "use strict";
495
503
  var os = require("os");
496
504
  var tty = require("tty");
497
- var hasFlag = require_has_flag_4_0();
505
+ var hasFlag = require_has_flag();
498
506
  var { env: env2 } = process;
499
507
  var flagForceColor;
500
508
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
@@ -602,9 +610,9 @@ var require_supports_color_8_1 = __commonJS({
602
610
  }
603
611
  });
604
612
 
605
- // node_modules/_debug@4.3.4@debug/src/node.js
613
+ // node_modules/.store/debug@4.3.4/node_modules/debug/src/node.js
606
614
  var require_node = __commonJS({
607
- "node_modules/_debug@4.3.4@debug/src/node.js"(exports, module2) {
615
+ "node_modules/.store/debug@4.3.4/node_modules/debug/src/node.js"(exports, module2) {
608
616
  var tty = require("tty");
609
617
  var util = require("util");
610
618
  exports.init = init;
@@ -620,7 +628,7 @@ var require_node = __commonJS({
620
628
  );
621
629
  exports.colors = [6, 2, 3, 4, 5, 1];
622
630
  try {
623
- const supportsColor = require_supports_color_8_1();
631
+ const supportsColor = require_supports_color();
624
632
  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
625
633
  exports.colors = [
626
634
  20,
@@ -741,7 +749,7 @@ var require_node = __commonJS({
741
749
  if (exports.inspectOpts.hideDate) {
742
750
  return "";
743
751
  }
744
- return new Date().toISOString() + " ";
752
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
745
753
  }
746
754
  function log(...args) {
747
755
  return process.stderr.write(util.format(...args) + "\n");
@@ -776,9 +784,9 @@ var require_node = __commonJS({
776
784
  }
777
785
  });
778
786
 
779
- // node_modules/_debug@4.3.4@debug/src/index.js
787
+ // node_modules/.store/debug@4.3.4/node_modules/debug/src/index.js
780
788
  var require_src = __commonJS({
781
- "node_modules/_debug@4.3.4@debug/src/index.js"(exports, module2) {
789
+ "node_modules/.store/debug@4.3.4/node_modules/debug/src/index.js"(exports, module2) {
782
790
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
783
791
  module2.exports = require_browser();
784
792
  } else {
@@ -787,18 +795,18 @@ var require_src = __commonJS({
787
795
  }
788
796
  });
789
797
 
790
- // node_modules/_node-environment@0.5.1@node-environment/lib/compare-aliases.js
798
+ // node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js
791
799
  var require_compare_aliases = __commonJS({
792
- "node_modules/_node-environment@0.5.1@node-environment/lib/compare-aliases.js"(exports, module2) {
800
+ "node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js"(exports, module2) {
793
801
  module2.exports = function compareAliases(env2, ...aliases) {
794
802
  return aliases.some((alias) => alias.toLowerCase() === env2.toLowerCase());
795
803
  };
796
804
  }
797
805
  });
798
806
 
799
- // node_modules/_node-environment@0.5.1@node-environment/lib/modes.enum.js
807
+ // node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js
800
808
  var require_modes_enum = __commonJS({
801
- "node_modules/_node-environment@0.5.1@node-environment/lib/modes.enum.js"(exports, module2) {
809
+ "node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js"(exports, module2) {
802
810
  var Development = {
803
811
  dev: "dev",
804
812
  development: "development"
@@ -814,9 +822,9 @@ var require_modes_enum = __commonJS({
814
822
  }
815
823
  });
816
824
 
817
- // node_modules/_node-environment@0.5.1@node-environment/lib/inspector.js
825
+ // node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js
818
826
  var require_inspector = __commonJS({
819
- "node_modules/_node-environment@0.5.1@node-environment/lib/inspector.js"(exports, module2) {
827
+ "node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js"(exports, module2) {
820
828
  var compare = require_compare_aliases();
821
829
  var modes = require_modes_enum();
822
830
  function inspector(...envs) {
@@ -846,9 +854,9 @@ var require_inspector = __commonJS({
846
854
  }
847
855
  });
848
856
 
849
- // node_modules/_node-environment@0.5.1@node-environment/lib/index.js
857
+ // node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/index.js
850
858
  var require_lib = __commonJS({
851
- "node_modules/_node-environment@0.5.1@node-environment/lib/index.js"(exports, module2) {
859
+ "node_modules/.store/node-environment@0.5.1/node_modules/node-environment/lib/index.js"(exports, module2) {
852
860
  module2.exports = {
853
861
  env: require_inspector()
854
862
  };
@@ -872,15 +880,15 @@ var import_debug2 = __toESM(require_src());
872
880
  var import_fs = __toESM(require("fs"));
873
881
  var import_path = __toESM(require("path"));
874
882
 
875
- // node_modules/_kolorist@1.6.0@kolorist/dist/esm/index.mjs
883
+ // node_modules/.store/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
876
884
  var enabled = true;
877
885
  var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
878
886
  var supportLevel = 0;
879
887
  if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
880
- const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = globalVar.process.env;
881
- if (NODE_DISABLE_COLORS || FORCE_COLOR === "0") {
888
+ const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
889
+ if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") {
882
890
  enabled = false;
883
- } else if (FORCE_COLOR === "1") {
891
+ } else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") {
884
892
  enabled = true;
885
893
  } else if (TERM === "dumb") {
886
894
  enabled = false;
@@ -898,7 +906,17 @@ if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
898
906
  enabled = process.stdout.isTTY;
899
907
  }
900
908
  if (enabled) {
901
- supportLevel = TERM && TERM.endsWith("-256color") ? 2 : 1;
909
+ if (process.platform === "win32") {
910
+ supportLevel = 3;
911
+ } else {
912
+ if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) {
913
+ supportLevel = 3;
914
+ } else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) {
915
+ supportLevel = 2;
916
+ } else {
917
+ supportLevel = 1;
918
+ }
919
+ }
902
920
  }
903
921
  }
904
922
  var options = {
@@ -1030,8 +1048,8 @@ function getImportName(ele) {
1030
1048
  }
1031
1049
  return str;
1032
1050
  }
1033
- function changeImport(ele, fullPath) {
1034
- let obj = {
1051
+ function changeImport(ele, fullPath, nochangePath) {
1052
+ const obj = {
1035
1053
  impName: "",
1036
1054
  filePath: "",
1037
1055
  absoluteImport: ""
@@ -1042,8 +1060,10 @@ function changeImport(ele, fullPath) {
1042
1060
  debug("!!!!!!!!!\u5339\u914Dimp: ", impName);
1043
1061
  obj.absoluteImport = makeSuffix(obj.filePath, fullPath);
1044
1062
  debug("\u8865\u8FC7\u540E", obj.absoluteImport);
1045
- obj.impName = getRelatPath(obj.absoluteImport, fullPath);
1046
- debug("\u76F8\u5BF9\u8DEF\u5F84: ", obj.impName);
1063
+ if (!nochangePath) {
1064
+ obj.impName = getRelatPath(obj.absoluteImport, fullPath);
1065
+ debug("\u76F8\u5BF9\u8DEF\u5F84: ", obj.impName);
1066
+ }
1047
1067
  }
1048
1068
  return obj;
1049
1069
  }
@@ -1062,6 +1082,7 @@ function getFile(fullPath) {
1062
1082
  const f = sarr[0].indexOf("eslint") === -1 && (sarr[0].indexOf("-->") > -1 || sarr[0].indexOf("*/") > -1 || sarr[0].indexOf("//") > -1) ? sarr[0] : "";
1063
1083
  return {
1064
1084
  note: f.replace(/<\/?[^>]*>|(\n|\r)/g, ""),
1085
+ // 去掉尾巴换行符号
1065
1086
  size,
1066
1087
  rowSize,
1067
1088
  imports
@@ -1081,6 +1102,8 @@ function getImport(sarr, fullPath) {
1081
1102
  }
1082
1103
  function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
1083
1104
  let ignore = [
1105
+ // 'api',
1106
+ // 'src',
1084
1107
  "bin",
1085
1108
  "lib",
1086
1109
  "jest.config.js",
@@ -1104,7 +1127,7 @@ function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
1104
1127
  include = option.include || include;
1105
1128
  }
1106
1129
  const files = import_fs2.default.readdirSync(dir).map((item) => {
1107
- let fullPath = import_path2.default.join(dir, item);
1130
+ const fullPath = import_path2.default.join(dir, item);
1108
1131
  const isDir = import_fs2.default.lstatSync(fullPath).isDirectory();
1109
1132
  return {
1110
1133
  name: item,
@@ -1209,24 +1232,24 @@ function format(num) {
1209
1232
  }
1210
1233
  function setCountMd(obj) {
1211
1234
  const { rowTotleNumber, sizeTotleNumber, coutObj } = obj;
1212
- let countMd = "";
1235
+ let countMd = "\u{1F60D} \u4EE3\u7801\u603B\u6570\u7EDF\u8BA1\uFF1A\n";
1213
1236
  let totle = 0;
1214
1237
  for (const key in coutObj) {
1215
1238
  const ele = coutObj[key];
1216
1239
  totle += ele;
1217
- countMd += `The suffix is ${key} has ${ele} files
1240
+ countMd += `\u540E\u7F00\u662F ${key} \u7684\u6587\u4EF6\u6709 ${ele} \u4E2A
1218
1241
  `;
1219
1242
  }
1220
- countMd += `The totle has ${totle} files
1243
+ countMd += `\u603B\u5171\u6709 ${totle} \u4E2A\u6587\u4EF6
1221
1244
  `;
1222
- let md = `Total number of file lines: ${format(rowTotleNumber)},
1223
- Total number of codes: ${format(sizeTotleNumber)}
1245
+ let md = `\u603B\u4EE3\u7801\u884C\u6570\u6709: ${format(rowTotleNumber)}\u884C,
1246
+ \u603B\u4EE3\u7801\u5B57\u6570\u6709: ${format(sizeTotleNumber)}\u4E2A
1224
1247
  `;
1225
1248
  md = countMd + md;
1226
1249
  return md;
1227
1250
  }
1228
1251
  function getMd(option) {
1229
- logger_default.success("*** run location: " + process.cwd() + "\n");
1252
+ logger_default.success("\u{1F449} \u547D\u4EE4\u8FD0\u884C\u4F4D\u7F6E: " + process.cwd() + "\n");
1230
1253
  const nodes = getFileNodes(rootPath, option);
1231
1254
  const countMdObj = getCountMd(nodes);
1232
1255
  const coutMd = setCountMd(countMdObj);
@@ -1234,7 +1257,7 @@ function getMd(option) {
1234
1257
  const note = getNote(nodes);
1235
1258
  const md = note.join("") + "\n";
1236
1259
  if (md.length > 0) {
1237
- logger_default.success("*** Automatic generation completed !");
1260
+ logger_default.success("\u{1F004}\uFE0F \u751F\u6210MarkDown\u5B8C\u6BD5 !");
1238
1261
  }
1239
1262
  return { md: md + coutMd, nodes };
1240
1263
  }