@lsby/net-core 0.0.18 → 0.0.20-beta.1
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/cjs/index.cjs +3 -2
- package/dist/cjs/interface/interface-type.d.cts +1 -1
- package/dist/cjs/interface/interface.d.cts +1 -1
- package/dist/cjs/interface/plug.d.cts +2 -1
- package/dist/cjs/server/server.cjs +3 -2
- package/dist/esm/{chunk-OFMQBHC7.js → chunk-S3ITAYKY.js} +3 -2
- package/dist/esm/index.js +16 -16
- package/dist/esm/interface/interface-type.d.ts +1 -1
- package/dist/esm/interface/interface.d.ts +1 -1
- package/dist/esm/interface/plug.d.ts +2 -1
- package/dist/esm/server/server.js +1 -1
- package/package.json +2 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -350,11 +350,12 @@ var \u670D\u52A1\u5668 = class {
|
|
|
350
350
|
res.send("\u672A\u77E5\u9519\u8BEF");
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
|
-
var server;
|
|
353
|
+
var server = null;
|
|
354
354
|
await new Promise((res, _rej) => {
|
|
355
355
|
server = app.listen(this.\u7AEF\u53E3, () => res());
|
|
356
356
|
});
|
|
357
|
-
|
|
357
|
+
if (server == null)
|
|
358
|
+
throw new Error("\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25");
|
|
358
359
|
return {
|
|
359
360
|
ip: Object.values((0, import_node_os.networkInterfaces)()).flat().flatMap((address) => address !== void 0 ? [address] : []).map((wrappedAddress) => wrappedAddress.address).map((address) => `http://${address}:${this.\u7AEF\u53E3}`),
|
|
360
361
|
server
|
|
@@ -3,7 +3,7 @@ import { 类型保持符号 as ______ } from '../types/type-hold.cjs';
|
|
|
3
3
|
import { 插件 as __ } from './plug.cjs';
|
|
4
4
|
import 'express';
|
|
5
5
|
|
|
6
|
-
declare class 接口类型<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject
|
|
6
|
+
declare class 接口类型<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<() => Promise<__<z.AnyZodObject>>>, 正确结果类型 extends z.ZodTypeAny, 错误结果类型 extends z.ZodTypeAny> {
|
|
7
7
|
private 路径;
|
|
8
8
|
private 方法;
|
|
9
9
|
private 插件们;
|
|
@@ -5,7 +5,7 @@ import { 插件 as __, 合并插件结果 as ______ } from './plug.cjs';
|
|
|
5
5
|
import 'express';
|
|
6
6
|
import '../types/type-hold.cjs';
|
|
7
7
|
|
|
8
|
-
declare class 接口<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject
|
|
8
|
+
declare class 接口<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<() => Promise<__<z.AnyZodObject>>>, 正确返回类型 extends z.ZodTypeAny, 错误返回类型 extends z.ZodTypeAny> {
|
|
9
9
|
private 接口类型;
|
|
10
10
|
private 实现;
|
|
11
11
|
constructor(接口类型: ____<路径, 方法, 插件们, 正确返回类型, 错误返回类型>, 实现: (插件结果: ______<插件们>) => Promise<____$1<z.infer<正确返回类型>> | ____$2<z.infer<错误返回类型>>>);
|
|
@@ -10,6 +10,7 @@ declare class 插件<Obj extends z.AnyZodObject> {
|
|
|
10
10
|
获得类型(): typeof this.类型;
|
|
11
11
|
获得实现(): typeof this.实现;
|
|
12
12
|
}
|
|
13
|
-
type
|
|
13
|
+
type 取值<A> = A extends () => Promise<插件<infer x>> ? x : never;
|
|
14
|
+
type 合并插件结果<Arr extends Array<() => Promise<插件<z.AnyZodObject>>>> = Arr extends [] ? {} : Arr extends [infer x, ...infer xs] ? x extends 插件<infer obj> ? xs extends Array<() => Promise<插件<z.AnyZodObject>>> ? obj extends (...args: any) => any ? z.infer<取值<obj>> & 合并插件结果<xs> : {} : {} : {} : {};
|
|
14
15
|
|
|
15
16
|
export { type 合并插件结果, 插件 };
|
|
@@ -171,11 +171,12 @@ var \u670D\u52A1\u5668 = class {
|
|
|
171
171
|
res.send("\u672A\u77E5\u9519\u8BEF");
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
-
var server;
|
|
174
|
+
var server = null;
|
|
175
175
|
await new Promise((res, _rej) => {
|
|
176
176
|
server = app.listen(this.\u7AEF\u53E3, () => res());
|
|
177
177
|
});
|
|
178
|
-
|
|
178
|
+
if (server == null)
|
|
179
|
+
throw new Error("\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25");
|
|
179
180
|
return {
|
|
180
181
|
ip: Object.values((0, import_node_os.networkInterfaces)()).flat().flatMap((address) => address !== void 0 ? [address] : []).map((wrappedAddress) => wrappedAddress.address).map((address) => `http://${address}:${this.\u7AEF\u53E3}`),
|
|
181
182
|
server
|
|
@@ -47,11 +47,12 @@ var \u670D\u52A1\u5668 = class {
|
|
|
47
47
|
res.send("\u672A\u77E5\u9519\u8BEF");
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
var server;
|
|
50
|
+
var server = null;
|
|
51
51
|
await new Promise((res, _rej) => {
|
|
52
52
|
server = app.listen(this.\u7AEF\u53E3, () => res());
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
if (server == null)
|
|
55
|
+
throw new Error("\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25");
|
|
55
56
|
return {
|
|
56
57
|
ip: Object.values(networkInterfaces()).flat().flatMap((address) => address !== void 0 ? [address] : []).map((wrappedAddress) => wrappedAddress.address).map((address) => `http://${address}:${this.\u7AEF\u53E3}`),
|
|
57
58
|
server
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +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
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S3ITAYKY.js";
|
|
13
|
+
import {
|
|
14
|
+
接口类型
|
|
15
|
+
} from "./chunk-SF5Z34AP.js";
|
|
16
|
+
import {
|
|
17
|
+
接口
|
|
18
|
+
} from "./chunk-KRIDSMPV.js";
|
|
7
19
|
import {
|
|
8
20
|
正确JSON结果,
|
|
9
21
|
正确结果,
|
|
@@ -12,27 +24,15 @@ import {
|
|
|
12
24
|
错误JSON结果,
|
|
13
25
|
错误结果
|
|
14
26
|
} from "./chunk-HARBKRRI.js";
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
接口类型
|
|
20
|
-
} from "./chunk-SF5Z34AP.js";
|
|
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";
|
|
@@ -3,7 +3,7 @@ import { 类型保持符号 as ______ } from '../types/type-hold.js';
|
|
|
3
3
|
import { 插件 as __ } from './plug.js';
|
|
4
4
|
import 'express';
|
|
5
5
|
|
|
6
|
-
declare class 接口类型<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject
|
|
6
|
+
declare class 接口类型<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<() => Promise<__<z.AnyZodObject>>>, 正确结果类型 extends z.ZodTypeAny, 错误结果类型 extends z.ZodTypeAny> {
|
|
7
7
|
private 路径;
|
|
8
8
|
private 方法;
|
|
9
9
|
private 插件们;
|
|
@@ -5,7 +5,7 @@ import { 插件 as __, 合并插件结果 as ______ } from './plug.js';
|
|
|
5
5
|
import 'express';
|
|
6
6
|
import '../types/type-hold.js';
|
|
7
7
|
|
|
8
|
-
declare class 接口<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject
|
|
8
|
+
declare class 接口<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<() => Promise<__<z.AnyZodObject>>>, 正确返回类型 extends z.ZodTypeAny, 错误返回类型 extends z.ZodTypeAny> {
|
|
9
9
|
private 接口类型;
|
|
10
10
|
private 实现;
|
|
11
11
|
constructor(接口类型: ____<路径, 方法, 插件们, 正确返回类型, 错误返回类型>, 实现: (插件结果: ______<插件们>) => Promise<____$1<z.infer<正确返回类型>> | ____$2<z.infer<错误返回类型>>>);
|
|
@@ -10,6 +10,7 @@ declare class 插件<Obj extends z.AnyZodObject> {
|
|
|
10
10
|
获得类型(): typeof this.类型;
|
|
11
11
|
获得实现(): typeof this.实现;
|
|
12
12
|
}
|
|
13
|
-
type
|
|
13
|
+
type 取值<A> = A extends () => Promise<插件<infer x>> ? x : never;
|
|
14
|
+
type 合并插件结果<Arr extends Array<() => Promise<插件<z.AnyZodObject>>>> = Arr extends [] ? {} : Arr extends [infer x, ...infer xs] ? x extends 插件<infer obj> ? xs extends Array<() => Promise<插件<z.AnyZodObject>>> ? obj extends (...args: any) => any ? z.infer<取值<obj>> & 合并插件结果<xs> : {} : {} : {} : {};
|
|
14
15
|
|
|
15
16
|
export { type 合并插件结果, 插件 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsby/net-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"require": "./dist/cjs/index.cjs",
|
|
@@ -37,16 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
|
40
|
+
"@lsby/eslint-config": "^0.0.2",
|
|
40
41
|
"@types/debug": "^4.1.12",
|
|
41
42
|
"@types/node": "^20.12.10",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
43
|
-
"@typescript-eslint/parser": "^7.8.0",
|
|
44
43
|
"@vitest/coverage-v8": "^2.0.2",
|
|
45
44
|
"bumpp": "^9.4.1",
|
|
46
|
-
"eslint": "^8.56.0",
|
|
47
|
-
"eslint-config-prettier": "^9.1.0",
|
|
48
|
-
"eslint-plugin-sort-class-members": "^1.20.0",
|
|
49
|
-
"eslint-plugin-unused-imports": "^3.2.0",
|
|
50
45
|
"prettier": "3.2.5",
|
|
51
46
|
"prettier-plugin-packagejson": "^2.5.0",
|
|
52
47
|
"tsup": "^8.0.2",
|