agmd 0.3.8 → 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 +88 -85
- 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 +99 -106
- package/lib/index.cjs.js.map +4 -4
- package/lib/index.d.ts +3 -3
- package/lib/index.esm.js +100 -107
- package/lib/index.esm.js.map +4 -4
- package/lib/shared/logger.d.ts +7 -7
- package/package.json +23 -22
|
@@ -1,12 +1,12 @@
|
|
|
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
|
+
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, dependencies: string[]): string;
|
|
6
|
+
export declare function changeImport(ele: string, fullPath: string, dependencies: 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 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.
|
|
2
|
+
* agmd v0.3.11
|
|
3
3
|
* author:kakajun <253495832@qq.com>
|
|
4
|
-
* Tue
|
|
4
|
+
* Tue Nov 28 2023 22:44:13 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/
|
|
35
|
-
var
|
|
36
|
-
"node_modules/
|
|
38
|
+
// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
|
|
39
|
+
var require_ms = __commonJS({
|
|
40
|
+
"node_modules/.pnpm/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/
|
|
154
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js
|
|
151
155
|
var require_common = __commonJS({
|
|
152
|
-
"node_modules/
|
|
156
|
+
"node_modules/.pnpm/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 =
|
|
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/
|
|
317
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
|
|
314
318
|
var require_browser = __commonJS({
|
|
315
|
-
"node_modules/
|
|
319
|
+
"node_modules/.pnpm/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 ||
|
|
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,43 +483,35 @@ var require_browser = __commonJS({
|
|
|
475
483
|
}
|
|
476
484
|
});
|
|
477
485
|
|
|
478
|
-
// node_modules/
|
|
479
|
-
var
|
|
480
|
-
"node_modules/
|
|
486
|
+
// node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
|
|
487
|
+
var require_has_flag = __commonJS({
|
|
488
|
+
"node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports, module2) {
|
|
481
489
|
"use strict";
|
|
482
|
-
module2.exports = (flag, argv
|
|
490
|
+
module2.exports = (flag, argv) => {
|
|
491
|
+
argv = argv || process.argv;
|
|
483
492
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
484
|
-
const
|
|
485
|
-
const
|
|
486
|
-
return
|
|
493
|
+
const pos = argv.indexOf(prefix + flag);
|
|
494
|
+
const terminatorPos = argv.indexOf("--");
|
|
495
|
+
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
487
496
|
};
|
|
488
497
|
}
|
|
489
498
|
});
|
|
490
499
|
|
|
491
|
-
// node_modules/
|
|
492
|
-
var
|
|
493
|
-
"node_modules/
|
|
500
|
+
// node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
|
|
501
|
+
var require_supports_color = __commonJS({
|
|
502
|
+
"node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports, module2) {
|
|
494
503
|
"use strict";
|
|
495
504
|
var os = require("os");
|
|
496
|
-
var
|
|
497
|
-
var
|
|
498
|
-
var
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
flagForceColor = 0;
|
|
505
|
+
var hasFlag = require_has_flag();
|
|
506
|
+
var env2 = process.env;
|
|
507
|
+
var forceColor;
|
|
508
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
|
509
|
+
forceColor = false;
|
|
502
510
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
503
|
-
|
|
511
|
+
forceColor = true;
|
|
504
512
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (env2.FORCE_COLOR === "true") {
|
|
508
|
-
return 1;
|
|
509
|
-
}
|
|
510
|
-
if (env2.FORCE_COLOR === "false") {
|
|
511
|
-
return 0;
|
|
512
|
-
}
|
|
513
|
-
return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
|
|
514
|
-
}
|
|
513
|
+
if ("FORCE_COLOR" in env2) {
|
|
514
|
+
forceColor = env2.FORCE_COLOR.length === 0 || parseInt(env2.FORCE_COLOR, 10) !== 0;
|
|
515
515
|
}
|
|
516
516
|
function translateLevel(level) {
|
|
517
517
|
if (level === 0) {
|
|
@@ -524,39 +524,29 @@ var require_supports_color_8_1 = __commonJS({
|
|
|
524
524
|
has16m: level >= 3
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function supportsColor(
|
|
528
|
-
|
|
529
|
-
if (noFlagForceColor !== void 0) {
|
|
530
|
-
flagForceColor = noFlagForceColor;
|
|
531
|
-
}
|
|
532
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
533
|
-
if (forceColor === 0) {
|
|
527
|
+
function supportsColor(stream) {
|
|
528
|
+
if (forceColor === false) {
|
|
534
529
|
return 0;
|
|
535
530
|
}
|
|
536
|
-
if (
|
|
537
|
-
|
|
538
|
-
return 3;
|
|
539
|
-
}
|
|
540
|
-
if (hasFlag("color=256")) {
|
|
541
|
-
return 2;
|
|
542
|
-
}
|
|
531
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
532
|
+
return 3;
|
|
543
533
|
}
|
|
544
|
-
if (
|
|
545
|
-
return
|
|
534
|
+
if (hasFlag("color=256")) {
|
|
535
|
+
return 2;
|
|
546
536
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return min;
|
|
537
|
+
if (stream && !stream.isTTY && forceColor !== true) {
|
|
538
|
+
return 0;
|
|
550
539
|
}
|
|
540
|
+
const min = forceColor ? 1 : 0;
|
|
551
541
|
if (process.platform === "win32") {
|
|
552
542
|
const osRelease = os.release().split(".");
|
|
553
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
543
|
+
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
554
544
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
555
545
|
}
|
|
556
546
|
return 1;
|
|
557
547
|
}
|
|
558
548
|
if ("CI" in env2) {
|
|
559
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"
|
|
549
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
|
|
560
550
|
return 1;
|
|
561
551
|
}
|
|
562
552
|
return min;
|
|
@@ -568,7 +558,7 @@ var require_supports_color_8_1 = __commonJS({
|
|
|
568
558
|
return 3;
|
|
569
559
|
}
|
|
570
560
|
if ("TERM_PROGRAM" in env2) {
|
|
571
|
-
const version =
|
|
561
|
+
const version = parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
572
562
|
switch (env2.TERM_PROGRAM) {
|
|
573
563
|
case "iTerm.app":
|
|
574
564
|
return version >= 3 ? 3 : 2;
|
|
@@ -585,26 +575,26 @@ var require_supports_color_8_1 = __commonJS({
|
|
|
585
575
|
if ("COLORTERM" in env2) {
|
|
586
576
|
return 1;
|
|
587
577
|
}
|
|
578
|
+
if (env2.TERM === "dumb") {
|
|
579
|
+
return min;
|
|
580
|
+
}
|
|
588
581
|
return min;
|
|
589
582
|
}
|
|
590
|
-
function getSupportLevel(stream
|
|
591
|
-
const level = supportsColor(stream
|
|
592
|
-
streamIsTTY: stream && stream.isTTY,
|
|
593
|
-
...options2
|
|
594
|
-
});
|
|
583
|
+
function getSupportLevel(stream) {
|
|
584
|
+
const level = supportsColor(stream);
|
|
595
585
|
return translateLevel(level);
|
|
596
586
|
}
|
|
597
587
|
module2.exports = {
|
|
598
588
|
supportsColor: getSupportLevel,
|
|
599
|
-
stdout: getSupportLevel(
|
|
600
|
-
stderr: getSupportLevel(
|
|
589
|
+
stdout: getSupportLevel(process.stdout),
|
|
590
|
+
stderr: getSupportLevel(process.stderr)
|
|
601
591
|
};
|
|
602
592
|
}
|
|
603
593
|
});
|
|
604
594
|
|
|
605
|
-
// node_modules/
|
|
595
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js
|
|
606
596
|
var require_node = __commonJS({
|
|
607
|
-
"node_modules/
|
|
597
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js"(exports, module2) {
|
|
608
598
|
var tty = require("tty");
|
|
609
599
|
var util = require("util");
|
|
610
600
|
exports.init = init;
|
|
@@ -620,7 +610,7 @@ var require_node = __commonJS({
|
|
|
620
610
|
);
|
|
621
611
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
622
612
|
try {
|
|
623
|
-
const supportsColor =
|
|
613
|
+
const supportsColor = require_supports_color();
|
|
624
614
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
625
615
|
exports.colors = [
|
|
626
616
|
20,
|
|
@@ -741,7 +731,7 @@ var require_node = __commonJS({
|
|
|
741
731
|
if (exports.inspectOpts.hideDate) {
|
|
742
732
|
return "";
|
|
743
733
|
}
|
|
744
|
-
return new Date().toISOString() + " ";
|
|
734
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
745
735
|
}
|
|
746
736
|
function log(...args) {
|
|
747
737
|
return process.stderr.write(util.format(...args) + "\n");
|
|
@@ -776,9 +766,9 @@ var require_node = __commonJS({
|
|
|
776
766
|
}
|
|
777
767
|
});
|
|
778
768
|
|
|
779
|
-
// node_modules/
|
|
769
|
+
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js
|
|
780
770
|
var require_src = __commonJS({
|
|
781
|
-
"node_modules/
|
|
771
|
+
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js"(exports, module2) {
|
|
782
772
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
783
773
|
module2.exports = require_browser();
|
|
784
774
|
} else {
|
|
@@ -787,18 +777,18 @@ var require_src = __commonJS({
|
|
|
787
777
|
}
|
|
788
778
|
});
|
|
789
779
|
|
|
790
|
-
// node_modules/
|
|
780
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js
|
|
791
781
|
var require_compare_aliases = __commonJS({
|
|
792
|
-
"node_modules/
|
|
782
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/compare-aliases.js"(exports, module2) {
|
|
793
783
|
module2.exports = function compareAliases(env2, ...aliases) {
|
|
794
784
|
return aliases.some((alias) => alias.toLowerCase() === env2.toLowerCase());
|
|
795
785
|
};
|
|
796
786
|
}
|
|
797
787
|
});
|
|
798
788
|
|
|
799
|
-
// node_modules/
|
|
789
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js
|
|
800
790
|
var require_modes_enum = __commonJS({
|
|
801
|
-
"node_modules/
|
|
791
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/modes.enum.js"(exports, module2) {
|
|
802
792
|
var Development = {
|
|
803
793
|
dev: "dev",
|
|
804
794
|
development: "development"
|
|
@@ -814,9 +804,9 @@ var require_modes_enum = __commonJS({
|
|
|
814
804
|
}
|
|
815
805
|
});
|
|
816
806
|
|
|
817
|
-
// node_modules/
|
|
807
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js
|
|
818
808
|
var require_inspector = __commonJS({
|
|
819
|
-
"node_modules/
|
|
809
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/inspector.js"(exports, module2) {
|
|
820
810
|
var compare = require_compare_aliases();
|
|
821
811
|
var modes = require_modes_enum();
|
|
822
812
|
function inspector(...envs) {
|
|
@@ -846,9 +836,9 @@ var require_inspector = __commonJS({
|
|
|
846
836
|
}
|
|
847
837
|
});
|
|
848
838
|
|
|
849
|
-
// node_modules/
|
|
839
|
+
// node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/index.js
|
|
850
840
|
var require_lib = __commonJS({
|
|
851
|
-
"node_modules/
|
|
841
|
+
"node_modules/.pnpm/node-environment@0.5.1/node_modules/node-environment/lib/index.js"(exports, module2) {
|
|
852
842
|
module2.exports = {
|
|
853
843
|
env: require_inspector()
|
|
854
844
|
};
|
|
@@ -872,7 +862,7 @@ var import_debug2 = __toESM(require_src());
|
|
|
872
862
|
var import_fs = __toESM(require("fs"));
|
|
873
863
|
var import_path = __toESM(require("path"));
|
|
874
864
|
|
|
875
|
-
// node_modules/
|
|
865
|
+
// node_modules/.pnpm/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
|
|
876
866
|
var enabled = true;
|
|
877
867
|
var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
878
868
|
var supportLevel = 0;
|
|
@@ -984,7 +974,8 @@ var logger_default = logger;
|
|
|
984
974
|
// src/commands/change-path.ts
|
|
985
975
|
var import_debug = __toESM(require_src());
|
|
986
976
|
var debug = (0, import_debug.default)("change-path");
|
|
987
|
-
debug.enabled =
|
|
977
|
+
debug.enabled = true;
|
|
978
|
+
var rootPath = process.cwd().replace(/\\/g, "/");
|
|
988
979
|
function getRelatPath(absoluteImport, fullPath) {
|
|
989
980
|
let relatPath = import_path.default.relative(import_path.default.dirname(fullPath), absoluteImport);
|
|
990
981
|
relatPath = relatPath.replace(/\\/g, "/");
|
|
@@ -1006,7 +997,7 @@ function makeSuffix(filePath, fullPath) {
|
|
|
1006
997
|
debug("lastName", lastName);
|
|
1007
998
|
if (!lastName) {
|
|
1008
999
|
debug("!!!!!!!!!!!\u7F3A\u540E\u7F00\u6587\u4EF6: ", absoluteImport);
|
|
1009
|
-
const suffix = [".js", ".ts", ".vue", "/index.js", "/index.vue"];
|
|
1000
|
+
const suffix = [".js", ".ts", ".vue", ".tsx", "/index.js", "/index.vue"];
|
|
1010
1001
|
for (let j = 0; j < suffix.length; j++) {
|
|
1011
1002
|
const fixStr = suffix[j];
|
|
1012
1003
|
if (import_fs.default.existsSync(absoluteImport + fixStr)) {
|
|
@@ -1018,20 +1009,9 @@ function makeSuffix(filePath, fullPath) {
|
|
|
1018
1009
|
}
|
|
1019
1010
|
return absoluteImport.replace(/\\/g, "/");
|
|
1020
1011
|
}
|
|
1021
|
-
function getImportName(ele) {
|
|
1012
|
+
function getImportName(ele, dependencies) {
|
|
1022
1013
|
let str = "";
|
|
1023
|
-
const
|
|
1024
|
-
"xiwicloud",
|
|
1025
|
-
"bpmn-js",
|
|
1026
|
-
"element-ui",
|
|
1027
|
-
"lodash",
|
|
1028
|
-
"handsontable",
|
|
1029
|
-
"nprogress",
|
|
1030
|
-
"quill",
|
|
1031
|
-
"qrcodejs2",
|
|
1032
|
-
"echarts"
|
|
1033
|
-
];
|
|
1034
|
-
const flag = ignore.some((item) => ele.indexOf(item) > -1);
|
|
1014
|
+
const flag = dependencies.some((item) => ele.indexOf(item) > -1);
|
|
1035
1015
|
const reg = / from [\"|\'](.*)[\'|\"]/;
|
|
1036
1016
|
if (!flag && ele.indexOf("/") > -1 && ele.indexOf("//") !== 0) {
|
|
1037
1017
|
const impStr = ele.match(reg);
|
|
@@ -1040,13 +1020,13 @@ function getImportName(ele) {
|
|
|
1040
1020
|
}
|
|
1041
1021
|
return str;
|
|
1042
1022
|
}
|
|
1043
|
-
function changeImport(ele, fullPath, nochangePath) {
|
|
1044
|
-
|
|
1023
|
+
function changeImport(ele, fullPath, dependencies, nochangePath) {
|
|
1024
|
+
const obj = {
|
|
1045
1025
|
impName: "",
|
|
1046
1026
|
filePath: "",
|
|
1047
1027
|
absoluteImport: ""
|
|
1048
1028
|
};
|
|
1049
|
-
const impName = getImportName(ele);
|
|
1029
|
+
const impName = getImportName(ele, dependencies);
|
|
1050
1030
|
if (impName) {
|
|
1051
1031
|
obj.filePath = impName;
|
|
1052
1032
|
debug("!!!!!!!!!\u5339\u914Dimp: ", impName);
|
|
@@ -1064,6 +1044,7 @@ function changeImport(ele, fullPath, nochangePath) {
|
|
|
1064
1044
|
var import_node_environment = __toESM(require_lib());
|
|
1065
1045
|
var debug2 = (0, import_debug2.default)("get-file");
|
|
1066
1046
|
debug2.enabled = false;
|
|
1047
|
+
var rootPath2 = process.cwd().replace(/\\/g, "/");
|
|
1067
1048
|
var isDev = (0, import_node_environment.env)() === "development";
|
|
1068
1049
|
function getFile(fullPath) {
|
|
1069
1050
|
const str = import_fs2.default.readFileSync(fullPath, "utf-8");
|
|
@@ -1074,16 +1055,26 @@ function getFile(fullPath) {
|
|
|
1074
1055
|
const f = sarr[0].indexOf("eslint") === -1 && (sarr[0].indexOf("-->") > -1 || sarr[0].indexOf("*/") > -1 || sarr[0].indexOf("//") > -1) ? sarr[0] : "";
|
|
1075
1056
|
return {
|
|
1076
1057
|
note: f.replace(/<\/?[^>]*>|(\n|\r)/g, ""),
|
|
1058
|
+
// 去掉尾巴换行符号
|
|
1077
1059
|
size,
|
|
1078
1060
|
rowSize,
|
|
1079
1061
|
imports
|
|
1080
1062
|
};
|
|
1081
1063
|
}
|
|
1082
1064
|
function getImport(sarr, fullPath) {
|
|
1065
|
+
const dependencies = [];
|
|
1066
|
+
if (import_fs2.default.existsSync(rootPath2 + "/package.json")) {
|
|
1067
|
+
const pkg = require(rootPath2 + "/package.json");
|
|
1068
|
+
if (pkg.devDependencies) {
|
|
1069
|
+
dependencies.push(...Object.keys(pkg.devDependencies));
|
|
1070
|
+
} else if (pkg.dependencies) {
|
|
1071
|
+
dependencies.push(...Object.keys(pkg.dependencies));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1083
1074
|
const imports = [];
|
|
1084
1075
|
sarr.forEach((ele) => {
|
|
1085
1076
|
if (ele.indexOf("from") > -1) {
|
|
1086
|
-
const { absoluteImport } = changeImport(ele, fullPath);
|
|
1077
|
+
const { absoluteImport } = changeImport(ele, fullPath, dependencies);
|
|
1087
1078
|
if (absoluteImport) {
|
|
1088
1079
|
imports.push(absoluteImport);
|
|
1089
1080
|
}
|
|
@@ -1093,6 +1084,8 @@ function getImport(sarr, fullPath) {
|
|
|
1093
1084
|
}
|
|
1094
1085
|
function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
|
|
1095
1086
|
let ignore = [
|
|
1087
|
+
// 'api',
|
|
1088
|
+
// 'src',
|
|
1096
1089
|
"bin",
|
|
1097
1090
|
"lib",
|
|
1098
1091
|
"jest.config.js",
|
|
@@ -1110,13 +1103,13 @@ function getFileNodes(dir = process.cwd(), option, nodes = [], level = 0) {
|
|
|
1110
1103
|
"readme-file.js",
|
|
1111
1104
|
"readme-md.js"
|
|
1112
1105
|
];
|
|
1113
|
-
let include = isDev ? [".js", ".vue"] : [".js", ".vue", ".ts"];
|
|
1106
|
+
let include = isDev ? [".js", ".vue"] : [".js", ".vue", ".ts", ".tsx"];
|
|
1114
1107
|
if (option) {
|
|
1115
1108
|
ignore = option.ignore || ignore;
|
|
1116
1109
|
include = option.include || include;
|
|
1117
1110
|
}
|
|
1118
1111
|
const files = import_fs2.default.readdirSync(dir).map((item) => {
|
|
1119
|
-
|
|
1112
|
+
const fullPath = import_path2.default.join(dir, item);
|
|
1120
1113
|
const isDir = import_fs2.default.lstatSync(fullPath).isDirectory();
|
|
1121
1114
|
return {
|
|
1122
1115
|
name: item,
|
|
@@ -1188,7 +1181,7 @@ function setMd(obj, last) {
|
|
|
1188
1181
|
|
|
1189
1182
|
// src/commands/wirte-md.ts
|
|
1190
1183
|
var import_debug3 = __toESM(require_src());
|
|
1191
|
-
var
|
|
1184
|
+
var rootPath3 = process.cwd().replace(/\\/g, "/");
|
|
1192
1185
|
var debug3 = (0, import_debug3.default)("wirte-md");
|
|
1193
1186
|
debug3.enabled = false;
|
|
1194
1187
|
function getCountMd(datas) {
|
|
@@ -1239,7 +1232,7 @@ function setCountMd(obj) {
|
|
|
1239
1232
|
}
|
|
1240
1233
|
function getMd(option) {
|
|
1241
1234
|
logger_default.success("\u{1F449} \u547D\u4EE4\u8FD0\u884C\u4F4D\u7F6E: " + process.cwd() + "\n");
|
|
1242
|
-
const nodes = getFileNodes(
|
|
1235
|
+
const nodes = getFileNodes(rootPath3, option);
|
|
1243
1236
|
const countMdObj = getCountMd(nodes);
|
|
1244
1237
|
const coutMd = setCountMd(countMdObj);
|
|
1245
1238
|
logger_default.success(coutMd);
|