@lsby/net-core 0.0.24 → 0.0.25
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/bin/gen-list/bin.cjs +1 -0
- package/dist/bin/gen-list/index.cjs +1 -0
- package/dist/bin/gen-test/bin.cjs +1 -0
- package/dist/bin/gen-test/index.cjs +1 -0
- package/dist/bin/gen-type/bin.cjs +20 -21
- package/dist/bin/gen-type/calc-code.cjs +19 -21
- package/dist/bin/gen-type/calc-code.d.cts +1 -1
- package/dist/bin/gen-type/index.cjs +20 -21
- package/dist/cjs/bin/gen-list/bin.cjs +1 -0
- package/dist/cjs/bin/gen-list/index.cjs +1 -0
- package/dist/cjs/bin/gen-test/bin.cjs +1 -0
- package/dist/cjs/bin/gen-test/index.cjs +1 -0
- package/dist/cjs/bin/gen-type/bin.cjs +20 -21
- package/dist/cjs/bin/gen-type/calc-code.cjs +19 -21
- package/dist/cjs/bin/gen-type/calc-code.d.cts +1 -1
- package/dist/cjs/bin/gen-type/index.cjs +20 -21
- package/dist/esm/bin/gen-list/bin.js +1 -1
- package/dist/esm/bin/gen-list/index.js +1 -1
- package/dist/esm/bin/gen-test/bin.js +1 -1
- package/dist/esm/bin/gen-test/index.js +1 -1
- package/dist/esm/bin/gen-type/bin.js +2 -2
- package/dist/esm/bin/gen-type/calc-code.d.ts +1 -1
- package/dist/esm/bin/gen-type/calc-code.js +1 -1
- package/dist/esm/bin/gen-type/index.js +2 -2
- package/dist/esm/{chunk-VLNWJ4OM.js → chunk-HFRDMPQ4.js} +1 -0
- package/dist/esm/chunk-IRKJYOPK.js +29 -0
- package/dist/esm/{chunk-FXHL3NIN.js → chunk-KN7DZTQG.js} +2 -1
- package/dist/esm/{chunk-ALBZFUFF.js → chunk-WB2UYUI3.js} +1 -0
- package/dist/esm/index.js +14 -14
- package/package.json +1 -2
- package/dist/esm/chunk-23CY3P3G.js +0 -31
|
@@ -63,6 +63,7 @@ var Log = class _Log {
|
|
|
63
63
|
// src/bin/gen-list/index.ts
|
|
64
64
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath) {
|
|
65
65
|
var log = new Log("@lsby:net-core").extend("gen-list");
|
|
66
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u63A5\u53E3\u5217\u8868...");
|
|
66
67
|
const \u9879\u76EE\u6839\u8DEF\u5F84 = import_node_path.default.dirname(tsconfigPath);
|
|
67
68
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
68
69
|
if (tsconfigJson.error) {
|
|
@@ -68,6 +68,7 @@ var Log = class _Log {
|
|
|
68
68
|
// src/bin/gen-list/index.ts
|
|
69
69
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath) {
|
|
70
70
|
var log = new Log("@lsby:net-core").extend("gen-list");
|
|
71
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u63A5\u53E3\u5217\u8868...");
|
|
71
72
|
const \u9879\u76EE\u6839\u8DEF\u5F84 = import_node_path.default.dirname(tsconfigPath);
|
|
72
73
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
73
74
|
if (tsconfigJson.error) {
|
|
@@ -63,6 +63,7 @@ var Log = class _Log {
|
|
|
63
63
|
// src/bin/gen-test/index.ts
|
|
64
64
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
65
65
|
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
66
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u6D4B\u8BD5\u6587\u4EF6...");
|
|
66
67
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
67
68
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
68
69
|
if (tsconfigJson.error) {
|
|
@@ -68,6 +68,7 @@ var Log = class _Log {
|
|
|
68
68
|
// src/bin/gen-test/index.ts
|
|
69
69
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
70
70
|
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
71
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u6D4B\u8BD5\u6587\u4EF6...");
|
|
71
72
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
72
73
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
73
74
|
if (tsconfigJson.error) {
|
|
@@ -63,28 +63,26 @@ var Log = class _Log {
|
|
|
63
63
|
|
|
64
64
|
// src/bin/gen-type/calc-code.ts
|
|
65
65
|
var calcCode = `
|
|
66
|
-
import type {
|
|
67
|
-
import type {
|
|
66
|
+
import type { z } from 'zod'
|
|
67
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
68
|
+
import exportedApiSchema from './type'
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
86
|
-
}
|
|
87
|
-
: never
|
|
70
|
+
type Api =
|
|
71
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
72
|
+
infer Path,
|
|
73
|
+
infer Method,
|
|
74
|
+
infer PreApis,
|
|
75
|
+
infer SuccessSchema,
|
|
76
|
+
infer ErrorSchema
|
|
77
|
+
>
|
|
78
|
+
? {
|
|
79
|
+
path: Path
|
|
80
|
+
method: Method
|
|
81
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
82
|
+
successOutput: z.infer<SuccessSchema>
|
|
83
|
+
errorOutput: z.infer<ErrorSchema>
|
|
84
|
+
}
|
|
85
|
+
: never
|
|
88
86
|
|
|
89
87
|
export default Api
|
|
90
88
|
`;
|
|
@@ -92,6 +90,7 @@ export default Api
|
|
|
92
90
|
// src/bin/gen-type/index.ts
|
|
93
91
|
async function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
94
92
|
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
93
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u7C7B\u578B\u6587\u4EF6...");
|
|
95
94
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
96
95
|
if (tsconfigJson.error) {
|
|
97
96
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -24,28 +24,26 @@ __export(calc_code_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(calc_code_exports);
|
|
26
26
|
var calcCode = `
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
27
|
+
import type { z } from 'zod'
|
|
28
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
29
|
+
import exportedApiSchema from './type'
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
47
|
-
}
|
|
48
|
-
: never
|
|
31
|
+
type Api =
|
|
32
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
33
|
+
infer Path,
|
|
34
|
+
infer Method,
|
|
35
|
+
infer PreApis,
|
|
36
|
+
infer SuccessSchema,
|
|
37
|
+
infer ErrorSchema
|
|
38
|
+
>
|
|
39
|
+
? {
|
|
40
|
+
path: Path
|
|
41
|
+
method: Method
|
|
42
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
43
|
+
successOutput: z.infer<SuccessSchema>
|
|
44
|
+
errorOutput: z.infer<ErrorSchema>
|
|
45
|
+
}
|
|
46
|
+
: never
|
|
49
47
|
|
|
50
48
|
export default Api
|
|
51
49
|
`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const calcCode = "\nimport type { \
|
|
1
|
+
declare const calcCode = "\nimport type { z } from 'zod'\nimport type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'\nimport exportedApiSchema from './type'\n\ntype Api =\n typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<\n infer Path,\n infer Method,\n infer PreApis,\n infer SuccessSchema,\n infer ErrorSchema\n >\n ? {\n path: Path\n method: Method\n input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>\n successOutput: z.infer<SuccessSchema>\n errorOutput: z.infer<ErrorSchema>\n }\n : never\n\nexport default Api\n";
|
|
2
2
|
|
|
3
3
|
export { calcCode };
|
|
@@ -68,28 +68,26 @@ var Log = class _Log {
|
|
|
68
68
|
|
|
69
69
|
// src/bin/gen-type/calc-code.ts
|
|
70
70
|
var calcCode = `
|
|
71
|
-
import type {
|
|
72
|
-
import type {
|
|
71
|
+
import type { z } from 'zod'
|
|
72
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
73
|
+
import exportedApiSchema from './type'
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
91
|
-
}
|
|
92
|
-
: never
|
|
75
|
+
type Api =
|
|
76
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
77
|
+
infer Path,
|
|
78
|
+
infer Method,
|
|
79
|
+
infer PreApis,
|
|
80
|
+
infer SuccessSchema,
|
|
81
|
+
infer ErrorSchema
|
|
82
|
+
>
|
|
83
|
+
? {
|
|
84
|
+
path: Path
|
|
85
|
+
method: Method
|
|
86
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
87
|
+
successOutput: z.infer<SuccessSchema>
|
|
88
|
+
errorOutput: z.infer<ErrorSchema>
|
|
89
|
+
}
|
|
90
|
+
: never
|
|
93
91
|
|
|
94
92
|
export default Api
|
|
95
93
|
`;
|
|
@@ -97,6 +95,7 @@ export default Api
|
|
|
97
95
|
// src/bin/gen-type/index.ts
|
|
98
96
|
async function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
99
97
|
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
98
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u7C7B\u578B\u6587\u4EF6...");
|
|
100
99
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
101
100
|
if (tsconfigJson.error) {
|
|
102
101
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -63,6 +63,7 @@ var Log = class _Log {
|
|
|
63
63
|
// src/bin/gen-list/index.ts
|
|
64
64
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath) {
|
|
65
65
|
var log = new Log("@lsby:net-core").extend("gen-list");
|
|
66
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u63A5\u53E3\u5217\u8868...");
|
|
66
67
|
const \u9879\u76EE\u6839\u8DEF\u5F84 = import_node_path.default.dirname(tsconfigPath);
|
|
67
68
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
68
69
|
if (tsconfigJson.error) {
|
|
@@ -68,6 +68,7 @@ var Log = class _Log {
|
|
|
68
68
|
// src/bin/gen-list/index.ts
|
|
69
69
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath) {
|
|
70
70
|
var log = new Log("@lsby:net-core").extend("gen-list");
|
|
71
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u63A5\u53E3\u5217\u8868...");
|
|
71
72
|
const \u9879\u76EE\u6839\u8DEF\u5F84 = import_node_path.default.dirname(tsconfigPath);
|
|
72
73
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
73
74
|
if (tsconfigJson.error) {
|
|
@@ -63,6 +63,7 @@ var Log = class _Log {
|
|
|
63
63
|
// src/bin/gen-test/index.ts
|
|
64
64
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
65
65
|
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
66
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u6D4B\u8BD5\u6587\u4EF6...");
|
|
66
67
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
67
68
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
68
69
|
if (tsconfigJson.error) {
|
|
@@ -68,6 +68,7 @@ var Log = class _Log {
|
|
|
68
68
|
// src/bin/gen-test/index.ts
|
|
69
69
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
70
70
|
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
71
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u6D4B\u8BD5\u6587\u4EF6...");
|
|
71
72
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
72
73
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
73
74
|
if (tsconfigJson.error) {
|
|
@@ -63,28 +63,26 @@ var Log = class _Log {
|
|
|
63
63
|
|
|
64
64
|
// src/bin/gen-type/calc-code.ts
|
|
65
65
|
var calcCode = `
|
|
66
|
-
import type {
|
|
67
|
-
import type {
|
|
66
|
+
import type { z } from 'zod'
|
|
67
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
68
|
+
import exportedApiSchema from './type'
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
86
|
-
}
|
|
87
|
-
: never
|
|
70
|
+
type Api =
|
|
71
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
72
|
+
infer Path,
|
|
73
|
+
infer Method,
|
|
74
|
+
infer PreApis,
|
|
75
|
+
infer SuccessSchema,
|
|
76
|
+
infer ErrorSchema
|
|
77
|
+
>
|
|
78
|
+
? {
|
|
79
|
+
path: Path
|
|
80
|
+
method: Method
|
|
81
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
82
|
+
successOutput: z.infer<SuccessSchema>
|
|
83
|
+
errorOutput: z.infer<ErrorSchema>
|
|
84
|
+
}
|
|
85
|
+
: never
|
|
88
86
|
|
|
89
87
|
export default Api
|
|
90
88
|
`;
|
|
@@ -92,6 +90,7 @@ export default Api
|
|
|
92
90
|
// src/bin/gen-type/index.ts
|
|
93
91
|
async function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
94
92
|
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
93
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u7C7B\u578B\u6587\u4EF6...");
|
|
95
94
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
96
95
|
if (tsconfigJson.error) {
|
|
97
96
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -24,28 +24,26 @@ __export(calc_code_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(calc_code_exports);
|
|
26
26
|
var calcCode = `
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
27
|
+
import type { z } from 'zod'
|
|
28
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
29
|
+
import exportedApiSchema from './type'
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
47
|
-
}
|
|
48
|
-
: never
|
|
31
|
+
type Api =
|
|
32
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
33
|
+
infer Path,
|
|
34
|
+
infer Method,
|
|
35
|
+
infer PreApis,
|
|
36
|
+
infer SuccessSchema,
|
|
37
|
+
infer ErrorSchema
|
|
38
|
+
>
|
|
39
|
+
? {
|
|
40
|
+
path: Path
|
|
41
|
+
method: Method
|
|
42
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
43
|
+
successOutput: z.infer<SuccessSchema>
|
|
44
|
+
errorOutput: z.infer<ErrorSchema>
|
|
45
|
+
}
|
|
46
|
+
: never
|
|
49
47
|
|
|
50
48
|
export default Api
|
|
51
49
|
`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const calcCode = "\nimport type { \
|
|
1
|
+
declare const calcCode = "\nimport type { z } from 'zod'\nimport type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'\nimport exportedApiSchema from './type'\n\ntype Api =\n typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<\n infer Path,\n infer Method,\n infer PreApis,\n infer SuccessSchema,\n infer ErrorSchema\n >\n ? {\n path: Path\n method: Method\n input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>\n successOutput: z.infer<SuccessSchema>\n errorOutput: z.infer<ErrorSchema>\n }\n : never\n\nexport default Api\n";
|
|
2
2
|
|
|
3
3
|
export { calcCode };
|
|
@@ -68,28 +68,26 @@ var Log = class _Log {
|
|
|
68
68
|
|
|
69
69
|
// src/bin/gen-type/calc-code.ts
|
|
70
70
|
var calcCode = `
|
|
71
|
-
import type {
|
|
72
|
-
import type {
|
|
71
|
+
import type { z } from 'zod'
|
|
72
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
73
|
+
import exportedApiSchema from './type'
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
91
|
-
}
|
|
92
|
-
: never
|
|
75
|
+
type Api =
|
|
76
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
77
|
+
infer Path,
|
|
78
|
+
infer Method,
|
|
79
|
+
infer PreApis,
|
|
80
|
+
infer SuccessSchema,
|
|
81
|
+
infer ErrorSchema
|
|
82
|
+
>
|
|
83
|
+
? {
|
|
84
|
+
path: Path
|
|
85
|
+
method: Method
|
|
86
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
87
|
+
successOutput: z.infer<SuccessSchema>
|
|
88
|
+
errorOutput: z.infer<ErrorSchema>
|
|
89
|
+
}
|
|
90
|
+
: never
|
|
93
91
|
|
|
94
92
|
export default Api
|
|
95
93
|
`;
|
|
@@ -97,6 +95,7 @@ export default Api
|
|
|
97
95
|
// src/bin/gen-type/index.ts
|
|
98
96
|
async function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
99
97
|
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
98
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u7C7B\u578B\u6587\u4EF6...");
|
|
100
99
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
101
100
|
if (tsconfigJson.error) {
|
|
102
101
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const calcCode = "\nimport type { \
|
|
1
|
+
declare const calcCode = "\nimport type { z } from 'zod'\nimport type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'\nimport exportedApiSchema from './type'\n\ntype Api =\n typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<\n infer Path,\n infer Method,\n infer PreApis,\n infer SuccessSchema,\n infer ErrorSchema\n >\n ? {\n path: Path\n method: Method\n input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>\n successOutput: z.infer<SuccessSchema>\n errorOutput: z.infer<ErrorSchema>\n }\n : never\n\nexport default Api\n";
|
|
2
2
|
|
|
3
3
|
export { calcCode };
|
|
@@ -8,6 +8,7 @@ import path from "node:path";
|
|
|
8
8
|
import ts from "typescript";
|
|
9
9
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
10
10
|
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
11
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u6D4B\u8BD5\u6587\u4EF6...");
|
|
11
12
|
const projectRootPath = path.dirname(tsconfigPath);
|
|
12
13
|
const tsconfigJson = ts.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, "utf8"));
|
|
13
14
|
if (tsconfigJson.error) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/bin/gen-type/calc-code.ts
|
|
2
|
+
var calcCode = `
|
|
3
|
+
import type { z } from 'zod'
|
|
4
|
+
import type { \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C, \u63A5\u53E3\u7C7B\u578B } from '@lsby/net-core'
|
|
5
|
+
import exportedApiSchema from './type'
|
|
6
|
+
|
|
7
|
+
type Api =
|
|
8
|
+
typeof exportedApiSchema extends \u63A5\u53E3\u7C7B\u578B<
|
|
9
|
+
infer Path,
|
|
10
|
+
infer Method,
|
|
11
|
+
infer PreApis,
|
|
12
|
+
infer SuccessSchema,
|
|
13
|
+
infer ErrorSchema
|
|
14
|
+
>
|
|
15
|
+
? {
|
|
16
|
+
path: Path
|
|
17
|
+
method: Method
|
|
18
|
+
input: \u5408\u5E76JSON\u63D2\u4EF6\u7ED3\u679C<PreApis>
|
|
19
|
+
successOutput: z.infer<SuccessSchema>
|
|
20
|
+
errorOutput: z.infer<ErrorSchema>
|
|
21
|
+
}
|
|
22
|
+
: never
|
|
23
|
+
|
|
24
|
+
export default Api
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
calcCode
|
|
29
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
calcCode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IRKJYOPK.js";
|
|
4
4
|
import {
|
|
5
5
|
Log
|
|
6
6
|
} from "./chunk-BZOQHDXK.js";
|
|
@@ -12,6 +12,7 @@ import path from "node:path";
|
|
|
12
12
|
import ts from "typescript";
|
|
13
13
|
async function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
14
14
|
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
15
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u7C7B\u578B\u6587\u4EF6...");
|
|
15
16
|
const tsconfigJson = ts.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, "utf8"));
|
|
16
17
|
if (tsconfigJson.error) {
|
|
17
18
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -8,6 +8,7 @@ import path from "node:path";
|
|
|
8
8
|
import ts from "typescript";
|
|
9
9
|
async function main(tsconfigPath, interfaceFolderPath, outFilePath) {
|
|
10
10
|
var log = new Log("@lsby:net-core").extend("gen-list");
|
|
11
|
+
await log.debug("\u51C6\u5907\u751F\u6210\u63A5\u53E3\u5217\u8868...");
|
|
11
12
|
const \u9879\u76EE\u6839\u8DEF\u5F84 = path.dirname(tsconfigPath);
|
|
12
13
|
const tsconfigJson = ts.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, "utf8"));
|
|
13
14
|
if (tsconfigJson.error) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JSON解析插件
|
|
3
|
+
} from "./chunk-B62YPABM.js";
|
|
1
4
|
import {
|
|
2
5
|
表单解析插件
|
|
3
6
|
} from "./chunk-5UUMGDDD.js";
|
|
7
|
+
import {
|
|
8
|
+
测试
|
|
9
|
+
} from "./chunk-I4WZG5LK.js";
|
|
4
10
|
import {
|
|
5
11
|
服务器
|
|
6
12
|
} from "./chunk-VSYZY2NW.js";
|
|
7
13
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
14
|
+
接口类型
|
|
15
|
+
} from "./chunk-SF5Z34AP.js";
|
|
16
|
+
import {
|
|
17
|
+
接口
|
|
18
|
+
} from "./chunk-KRIDSMPV.js";
|
|
10
19
|
import {
|
|
11
20
|
正确JSON结果,
|
|
12
21
|
正确结果,
|
|
@@ -15,24 +24,15 @@ import {
|
|
|
15
24
|
错误JSON结果,
|
|
16
25
|
错误结果
|
|
17
26
|
} from "./chunk-HARBKRRI.js";
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
接口
|
|
23
|
-
} from "./chunk-KRIDSMPV.js";
|
|
27
|
+
import "./chunk-ZSY7VBEW.js";
|
|
28
|
+
import "./chunk-LVYVPQ5V.js";
|
|
29
|
+
import "./chunk-BZOQHDXK.js";
|
|
24
30
|
import {
|
|
25
31
|
中文路径支持插件
|
|
26
32
|
} from "./chunk-XG4VZZOX.js";
|
|
27
33
|
import {
|
|
28
34
|
自定义数据插件
|
|
29
35
|
} from "./chunk-P6PGPAMW.js";
|
|
30
|
-
import {
|
|
31
|
-
JSON解析插件
|
|
32
|
-
} from "./chunk-B62YPABM.js";
|
|
33
|
-
import "./chunk-ZSY7VBEW.js";
|
|
34
|
-
import "./chunk-LVYVPQ5V.js";
|
|
35
|
-
import "./chunk-BZOQHDXK.js";
|
|
36
36
|
import {
|
|
37
37
|
插件
|
|
38
38
|
} from "./chunk-KSZE2DTR.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsby/net-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"require": "./dist/cjs/index.cjs",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"prettier": "3.2.5",
|
|
46
46
|
"prettier-plugin-packagejson": "^2.5.0",
|
|
47
47
|
"tsup": "^8.0.2",
|
|
48
|
-
"tsx": "^4.9.3",
|
|
49
48
|
"typescript": "^5.4.5"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// src/bin/gen-type/calc-code.ts
|
|
2
|
-
var calcCode = `
|
|
3
|
-
import type { \u63A5\u53E3\u7C7B\u578B, JSON\u89E3\u6790\u63D2\u4EF6 } from "@lsby/net-core"
|
|
4
|
-
import type { z } from "zod"
|
|
5
|
-
|
|
6
|
-
import exportedApiSchema from "./type"
|
|
7
|
-
|
|
8
|
-
type GetApiInputFromPreApi<PreApis> = PreApis extends []
|
|
9
|
-
? {}
|
|
10
|
-
: PreApis extends [infer x, ...infer xs]
|
|
11
|
-
? x extends JSON\u89E3\u6790\u63D2\u4EF6<infer input>
|
|
12
|
-
? z.infer<input>
|
|
13
|
-
: GetApiInputFromPreApi<xs>
|
|
14
|
-
: {}
|
|
15
|
-
|
|
16
|
-
type Api = (typeof exportedApiSchema) extends \u63A5\u53E3\u7C7B\u578B<infer Path, infer Method, infer PreApis, infer SuccessSchema, infer ErrorSchema>
|
|
17
|
-
? {
|
|
18
|
-
path: Path,
|
|
19
|
-
method: Method,
|
|
20
|
-
input: GetApiInputFromPreApi<PreApis>,
|
|
21
|
-
successOutput: z.infer<SuccessSchema>,
|
|
22
|
-
errorOutput: z.infer<ErrorSchema>,
|
|
23
|
-
}
|
|
24
|
-
: never
|
|
25
|
-
|
|
26
|
-
export default Api
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
calcCode
|
|
31
|
-
};
|