@zwa73/dev-utils 1.0.91 → 1.0.93
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/dist/DynImport.d.ts +11 -3
- package/dist/DynImport.js +21 -3
- package/package.json +22 -9
package/dist/DynImport.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type cliProgress from "cli-progress";
|
|
2
2
|
import type { Project, SyntaxKind } from 'ts-morph';
|
|
3
3
|
import type { getProgramFromFiles, buildGenerator } from 'typescript-json-schema';
|
|
4
|
+
type ImportOptionPackOpt = {
|
|
5
|
+
/**包名 */
|
|
6
|
+
name: string;
|
|
7
|
+
/**安装指令提示 */
|
|
8
|
+
installTip: string;
|
|
9
|
+
};
|
|
10
|
+
/**导入可选包 */
|
|
11
|
+
export declare function importOptionPack<T>(opt: ImportOptionPackOpt): Promise<T>;
|
|
4
12
|
type TJSInstance = {
|
|
5
13
|
getProgramFromFiles: typeof getProgramFromFiles;
|
|
6
14
|
buildGenerator: typeof buildGenerator;
|
|
@@ -9,7 +17,7 @@ export type TsMorphInstance = {
|
|
|
9
17
|
Project: typeof Project;
|
|
10
18
|
SyntaxKind: typeof SyntaxKind;
|
|
11
19
|
};
|
|
12
|
-
export declare function importTsMorph(): Promise<TsMorphInstance
|
|
13
|
-
export declare function importTJS(): Promise<TJSInstance
|
|
14
|
-
export declare function importCliProgress(): Promise<typeof cliProgress
|
|
20
|
+
export declare function importTsMorph(): Promise<TsMorphInstance>;
|
|
21
|
+
export declare function importTJS(): Promise<TJSInstance>;
|
|
22
|
+
export declare function importCliProgress(): Promise<typeof cliProgress>;
|
|
15
23
|
export {};
|
package/dist/DynImport.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importOptionPack = importOptionPack;
|
|
3
4
|
exports.importTsMorph = importTsMorph;
|
|
4
5
|
exports.importTJS = importTJS;
|
|
5
6
|
exports.importCliProgress = importCliProgress;
|
|
6
7
|
const utils_1 = require("@zwa73/utils");
|
|
8
|
+
/**导入可选包 */
|
|
9
|
+
async function importOptionPack(opt) {
|
|
10
|
+
const { name, installTip } = opt;
|
|
11
|
+
const pack = await utils_1.UtilFunc.dynamicImport(name);
|
|
12
|
+
if (pack == undefined)
|
|
13
|
+
utils_1.UtilFunc.throwError(`npm包 ${name} 动态导入失败, 可能是未安装, 可使用 ${installTip} 安装`);
|
|
14
|
+
return pack;
|
|
15
|
+
}
|
|
7
16
|
async function importTsMorph() {
|
|
8
|
-
return await
|
|
17
|
+
return await importOptionPack({
|
|
18
|
+
name: "ts-morph",
|
|
19
|
+
installTip: "npm i ts-morph@23.0.0"
|
|
20
|
+
});
|
|
9
21
|
}
|
|
10
22
|
async function importTJS() {
|
|
11
|
-
return await
|
|
23
|
+
return await importOptionPack({
|
|
24
|
+
name: "typescript-json-schema",
|
|
25
|
+
installTip: "npm i typescript-json-schema@0.67.1"
|
|
26
|
+
});
|
|
12
27
|
}
|
|
13
28
|
async function importCliProgress() {
|
|
14
|
-
return await
|
|
29
|
+
return await importOptionPack({
|
|
30
|
+
name: "cli-progress",
|
|
31
|
+
installTip: "npm i cli-progress@3.12.0"
|
|
32
|
+
});
|
|
15
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwa73/dev-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.93",
|
|
4
4
|
"description": "编译与调试工具",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
"author": "zwa73",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@deepkit/type-compiler": "^1.0.1-alpha.150",
|
|
20
19
|
"@zwa73/utils": "^1.0.280",
|
|
21
|
-
"cli-progress": "^3.12.0",
|
|
22
20
|
"commander": "^11.1.0",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"tsconfig-paths": "^4.2.0",
|
|
26
|
-
"typescript-json-schema": "^0.64.0"
|
|
21
|
+
"pathe": "^1.1.2",
|
|
22
|
+
"tsconfig-paths": "^4.2.0"
|
|
27
23
|
},
|
|
28
24
|
"devDependencies": {
|
|
29
25
|
"@types/cli-progress": "^3.11.6",
|
|
30
26
|
"@types/jest": "^29.5.12",
|
|
31
27
|
"@types/node": "^20.14.11",
|
|
28
|
+
"cli-progress": "^3.12.0",
|
|
29
|
+
"ts-morph": "^23.0.0",
|
|
30
|
+
"ts-node": "^10.9.2",
|
|
32
31
|
"tsc-alias": "^1.8.8",
|
|
33
|
-
"typescript": "^5.3.3"
|
|
32
|
+
"typescript": "^5.3.3",
|
|
33
|
+
"typescript-json-schema": "^0.67.1"
|
|
34
34
|
},
|
|
35
35
|
"bin": {
|
|
36
36
|
"zcli": "bin/cli"
|
|
@@ -42,6 +42,19 @@
|
|
|
42
42
|
"index.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"
|
|
45
|
+
"cli-progress": "^3.12.0",
|
|
46
|
+
"ts-morph": "^23.0.0",
|
|
47
|
+
"typescript-json-schema": "^0.67.1"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"ts-morph": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"typescript-json-schema": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"cli-progress": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
}
|