This commit is contained in:
2026-01-13 14:02:03 +08:00
parent 03f24318d2
commit 78af49906e
14 changed files with 338 additions and 323 deletions

19
auto.ts
View File

@@ -1,19 +0,0 @@
import { loadTS, getMatchFiles } from './src/auto/load-ts.ts';
import { listenSocket } from './src/auto/listen-sock.ts';
import { Route, QueryRouter, QueryRouterServer } from './src/route.ts';
export { Route, QueryRouter, QueryRouterServer };
export const App = QueryRouterServer;
export { createSchema } from './src/validator/index.ts';
export type { Rule } from './src/validator/rule.ts';
export type { RouteContext, RouteOpts } from './src/route.ts';
export type { Run } from './src/route.ts';
export { CustomError } from './src/result/error.ts';
export { listenSocket, loadTS, getMatchFiles };
export { autoCall } from './src/auto/call-sock.ts';

View File

@@ -1,20 +1,23 @@
import { Route, App } from '@kevisual/router'; import { Route, App } from '@kevisual/router';
const app = new App(); const app = new App({ appId: 'abc' });
app.listen(4003); app.listen(4003);
const route01 = new Route('demo', '01'); const route01 = new Route('demo', '00');
route01.run = async (ctx) => { route01.run = async (ctx) => {
ctx.body = '01'; ctx.body = '00';
console.log('appId', ctx.app.appId, ctx);
return ctx; return ctx;
}; };
app.use( app.addRoute(route01);
'demo',
async (ctx) => { // app.use(
ctx.body = '01'; // 'demo',
return ctx; // async (ctx) => {
}, // ctx.body = '01';
{ key: '01' }, // return ctx;
); // },
// { key: '01' },
// );
const route02 = new Route('demo', '02'); const route02 = new Route('demo', '02');
route02.run = async (ctx) => { route02.run = async (ctx) => {
@@ -25,3 +28,10 @@ app.addRoute(route02);
console.log(`http://localhost:4003/api/router?path=demo&key=02`); console.log(`http://localhost:4003/api/router?path=demo&key=02`);
console.log(`http://localhost:4003/api/router?path=demo&key=01`); console.log(`http://localhost:4003/api/router?path=demo&key=01`);
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
await wait(1000);
const a = await app.run({
path: 'demo',
key: '00',
})
console.log('a', a);

View File

@@ -1,4 +1,5 @@
import { QueryRouter, Route, Server } from '@kevisual/router'; import { QueryRouter, Route, } from '@kevisual/router';
// Server
const router = new QueryRouter(); const router = new QueryRouter();
@@ -9,14 +10,14 @@ route01.run = async (ctx) => {
}; };
router.add(route01); router.add(route01);
const server = new Server({ // const server = new Server({
handle: async (msg) => { // handle: async (msg) => {
const res = await router.parse(msg); // const res = await router.parse(msg);
const { code, body, message } = res; // const { code, body, message } = res;
// console.log('response', res); // // console.log('response', res);
return { code, data: body, message }; // return { code, data: body, message };
} // }
}); // });
// server.setHandle(async (msg) => { // server.setHandle(async (msg) => {
// const res = await router.parse(msg); // const res = await router.parse(msg);
@@ -25,7 +26,7 @@ const server = new Server({
// return { code, data: body, message }; // return { code, data: body, message };
// }); // });
server.listen(3000); // server.listen(3000);
const route02 = new Route('demo', '02'); const route02 = new Route('demo', '02');
route02.run = async (ctx) => { route02.run = async (ctx) => {

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://json.schemastore.org/package", "$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router", "name": "@kevisual/router",
"version": "0.0.52", "version": "0.0.53",
"description": "", "description": "",
"type": "module", "type": "module",
"main": "./dist/router.js", "main": "./dist/router.js",
@@ -32,8 +32,9 @@
"@types/bun": "^1.3.5", "@types/bun": "^1.3.5",
"@types/node": "^25.0.7", "@types/node": "^25.0.7",
"@types/send": "^1.2.1", "@types/send": "^1.2.1",
"@types/xml2js": "^0.4.14",
"@types/ws": "^8.18.1", "@types/ws": "^8.18.1",
"@types/xml2js": "^0.4.14",
"eventemitter3": "^5.0.1",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"rollup": "^4.55.1", "rollup": "^4.55.1",
"rollup-plugin-dts": "^6.3.0", "rollup-plugin-dts": "^6.3.0",
@@ -42,20 +43,18 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"tsx": "^4.21.0", "tsx": "^4.21.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"ws": "npm:@kevisual/ws",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"zod": "^4.3.5", "zod": "^4.3.5",
"eventemitter3": "^5.0.1", "@kevisual/js-filter": "^0.0.4",
"ws": "npm:@kevisual/ws" "path-to-regexp": "^8.3.0",
"send": "^1.2.1"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/abearxiong/kevisual-router.git" "url": "git+https://github.com/abearxiong/kevisual-router.git"
}, },
"dependencies": { "dependencies": {},
"path-to-regexp": "^8.3.0",
"selfsigned": "^5.5.0",
"send": "^1.2.1"
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
@@ -70,11 +69,6 @@
"require": "./dist/router-browser.js", "require": "./dist/router-browser.js",
"types": "./dist/router-browser.d.ts" "types": "./dist/router-browser.d.ts"
}, },
"./sign": {
"import": "./dist/router-sign.js",
"require": "./dist/router-sign.js",
"types": "./dist/router-sign.d.ts"
},
"./simple": { "./simple": {
"import": "./dist/router-simple.js", "import": "./dist/router-simple.js",
"require": "./dist/router-simple.js", "require": "./dist/router-simple.js",
@@ -93,6 +87,10 @@
"./src/*": { "./src/*": {
"import": "./src/*", "import": "./src/*",
"require": "./src/*" "require": "./src/*"
},
"./modules/*": {
"import": "./src/modules/*",
"require": "./src/modules/*"
} }
} }
} }

323
pnpm-lock.yaml generated
View File

@@ -8,12 +8,15 @@ importers:
.: .:
dependencies: dependencies:
'@kevisual/js-filter':
specifier: ^0.0.4
version: 0.0.4
path-to-regexp: path-to-regexp:
specifier: ^8.3.0 specifier: ^8.3.0
version: 8.3.0 version: 8.3.0
selfsigned: selfsigned:
specifier: ^5.4.0 specifier: ^5.5.0
version: 5.4.0 version: 5.5.0
send: send:
specifier: ^1.2.1 specifier: ^1.2.1
version: 1.2.1 version: 1.2.1
@@ -22,26 +25,26 @@ importers:
specifier: ^0.0.8 specifier: ^0.0.8
version: 0.0.8 version: 0.0.8
'@kevisual/query': '@kevisual/query':
specifier: ^0.0.33 specifier: ^0.0.35
version: 0.0.33 version: 0.0.35
'@rollup/plugin-alias': '@rollup/plugin-alias':
specifier: ^6.0.0 specifier: ^6.0.0
version: 6.0.0(rollup@4.54.0) version: 6.0.0(rollup@4.55.1)
'@rollup/plugin-commonjs': '@rollup/plugin-commonjs':
specifier: 29.0.0 specifier: 29.0.0
version: 29.0.0(rollup@4.54.0) version: 29.0.0(rollup@4.55.1)
'@rollup/plugin-node-resolve': '@rollup/plugin-node-resolve':
specifier: ^16.0.3 specifier: ^16.0.3
version: 16.0.3(rollup@4.54.0) version: 16.0.3(rollup@4.55.1)
'@rollup/plugin-typescript': '@rollup/plugin-typescript':
specifier: ^12.3.0 specifier: ^12.3.0
version: 12.3.0(rollup@4.54.0)(tslib@2.8.1)(typescript@5.9.3) version: 12.3.0(rollup@4.55.1)(tslib@2.8.1)(typescript@5.9.3)
'@types/bun': '@types/bun':
specifier: ^1.3.5 specifier: ^1.3.5
version: 1.3.5 version: 1.3.5
'@types/node': '@types/node':
specifier: ^25.0.3 specifier: ^25.0.7
version: 25.0.3 version: 25.0.7
'@types/send': '@types/send':
specifier: ^1.2.1 specifier: ^1.2.1
version: 1.2.1 version: 1.2.1
@@ -58,17 +61,17 @@ importers:
specifier: ^5.1.6 specifier: ^5.1.6
version: 5.1.6 version: 5.1.6
rollup: rollup:
specifier: ^4.54.0 specifier: ^4.55.1
version: 4.54.0 version: 4.55.1
rollup-plugin-dts: rollup-plugin-dts:
specifier: ^6.3.0 specifier: ^6.3.0
version: 6.3.0(rollup@4.54.0)(typescript@5.9.3) version: 6.3.0(rollup@4.55.1)(typescript@5.9.3)
ts-loader: ts-loader:
specifier: ^9.5.4 specifier: ^9.5.4
version: 9.5.4(typescript@5.9.3)(webpack@5.104.1) version: 9.5.4(typescript@5.9.3)(webpack@5.104.1)
ts-node: ts-node:
specifier: ^10.9.2 specifier: ^10.9.2
version: 10.9.2(@types/node@25.0.3)(typescript@5.9.3) version: 10.9.2(@types/node@25.0.7)(typescript@5.9.3)
tslib: tslib:
specifier: ^2.8.1 specifier: ^2.8.1
version: 2.8.1 version: 2.8.1
@@ -85,8 +88,8 @@ importers:
specifier: ^0.6.2 specifier: ^0.6.2
version: 0.6.2 version: 0.6.2
zod: zod:
specifier: ^4.2.1 specifier: ^4.3.5
version: 4.2.1 version: 4.3.5
demo/simple: demo/simple:
dependencies: dependencies:
@@ -99,7 +102,7 @@ importers:
version: 1.1.1 version: 1.1.1
ts-node: ts-node:
specifier: ^10.9.2 specifier: ^10.9.2
version: 10.9.2(@types/node@25.0.3)(typescript@5.9.3) version: 10.9.2(@types/node@25.0.7)(typescript@5.9.3)
typescript: typescript:
specifier: ^5.5.4 specifier: ^5.5.4
version: 5.9.3 version: 5.9.3
@@ -293,11 +296,14 @@ packages:
'@jridgewell/trace-mapping@0.3.9': '@jridgewell/trace-mapping@0.3.9':
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
'@kevisual/js-filter@0.0.4':
resolution: {integrity: sha512-ncwQmJWqpmK4q2KWSnYQJDxv20gTOb2BZ2rusvBf6H173nddhz/G2geDzgK40THragPOpvZywgVQbFNEjKjOzA==}
'@kevisual/local-proxy@0.0.8': '@kevisual/local-proxy@0.0.8':
resolution: {integrity: sha512-VX/P+6/Cc8ruqp34ag6gVX073BchUmf5VNZcTV/6MJtjrNE76G8V6TLpBE8bywLnrqyRtFLIspk4QlH8up9B5Q==} resolution: {integrity: sha512-VX/P+6/Cc8ruqp34ag6gVX073BchUmf5VNZcTV/6MJtjrNE76G8V6TLpBE8bywLnrqyRtFLIspk4QlH8up9B5Q==}
'@kevisual/query@0.0.33': '@kevisual/query@0.0.35':
resolution: {integrity: sha512-3w74bcLpwV3z483eg8n0DgkftfjWC6iLONXBvfyjW6IZf6jMOuouFaM4Rk+uEsTgElU6XGMKseNTp6dlQdWYkg==} resolution: {integrity: sha512-80dyy2LMCmEC72g+X4QWUKlZErhawQPgnGSBNR4yhrBcFgHIJQ14LR1Z+bS5S1I7db+1PDNpaxBTjIaoYoXunw==}
'@kevisual/ws@8.0.0': '@kevisual/ws@8.0.0':
resolution: {integrity: sha512-jlFxSlXUEz93cFW+UYT5BXv/rFVgiMQnIfqRYZ0gj1hSP8PMGRqMqUoHSLfKvfRRS4jseLSvTTeEKSQpZJtURg==} resolution: {integrity: sha512-jlFxSlXUEz93cFW+UYT5BXv/rFVgiMQnIfqRYZ0gj1hSP8PMGRqMqUoHSLfKvfRRS4jseLSvTTeEKSQpZJtURg==}
@@ -390,113 +396,128 @@ packages:
rollup: rollup:
optional: true optional: true
'@rollup/rollup-android-arm-eabi@4.54.0': '@rollup/rollup-android-arm-eabi@4.55.1':
resolution: {integrity: sha512-OywsdRHrFvCdvsewAInDKCNyR3laPA2mc9bRYJ6LBp5IyvF3fvXbbNR0bSzHlZVFtn6E0xw2oZlyjg4rKCVcng==} resolution: {integrity: sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==}
cpu: [arm] cpu: [arm]
os: [android] os: [android]
'@rollup/rollup-android-arm64@4.54.0': '@rollup/rollup-android-arm64@4.55.1':
resolution: {integrity: sha512-Skx39Uv+u7H224Af+bDgNinitlmHyQX1K/atIA32JP3JQw6hVODX5tkbi2zof/E69M1qH2UoN3Xdxgs90mmNYw==} resolution: {integrity: sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==}
cpu: [arm64] cpu: [arm64]
os: [android] os: [android]
'@rollup/rollup-darwin-arm64@4.54.0': '@rollup/rollup-darwin-arm64@4.55.1':
resolution: {integrity: sha512-k43D4qta/+6Fq+nCDhhv9yP2HdeKeP56QrUUTW7E6PhZP1US6NDqpJj4MY0jBHlJivVJD5P8NxrjuobZBJTCRw==} resolution: {integrity: sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
'@rollup/rollup-darwin-x64@4.54.0': '@rollup/rollup-darwin-x64@4.55.1':
resolution: {integrity: sha512-cOo7biqwkpawslEfox5Vs8/qj83M/aZCSSNIWpVzfU2CYHa2G3P1UN5WF01RdTHSgCkri7XOlTdtk17BezlV3A==} resolution: {integrity: sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
'@rollup/rollup-freebsd-arm64@4.54.0': '@rollup/rollup-freebsd-arm64@4.55.1':
resolution: {integrity: sha512-miSvuFkmvFbgJ1BevMa4CPCFt5MPGw094knM64W9I0giUIMMmRYcGW/JWZDriaw/k1kOBtsWh1z6nIFV1vPNtA==} resolution: {integrity: sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==}
cpu: [arm64] cpu: [arm64]
os: [freebsd] os: [freebsd]
'@rollup/rollup-freebsd-x64@4.54.0': '@rollup/rollup-freebsd-x64@4.55.1':
resolution: {integrity: sha512-KGXIs55+b/ZfZsq9aR026tmr/+7tq6VG6MsnrvF4H8VhwflTIuYh+LFUlIsRdQSgrgmtM3fVATzEAj4hBQlaqQ==} resolution: {integrity: sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==}
cpu: [x64] cpu: [x64]
os: [freebsd] os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.54.0': '@rollup/rollup-linux-arm-gnueabihf@4.55.1':
resolution: {integrity: sha512-EHMUcDwhtdRGlXZsGSIuXSYwD5kOT9NVnx9sqzYiwAc91wfYOE1g1djOEDseZJKKqtHAHGwnGPQu3kytmfaXLQ==} resolution: {integrity: sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.54.0': '@rollup/rollup-linux-arm-musleabihf@4.55.1':
resolution: {integrity: sha512-+pBrqEjaakN2ySv5RVrj/qLytYhPKEUwk+e3SFU5jTLHIcAtqh2rLrd/OkbNuHJpsBgxsD8ccJt5ga/SeG0JmA==} resolution: {integrity: sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.54.0': '@rollup/rollup-linux-arm64-gnu@4.55.1':
resolution: {integrity: sha512-NSqc7rE9wuUaRBsBp5ckQ5CVz5aIRKCwsoa6WMF7G01sX3/qHUw/z4pv+D+ahL1EIKy6Enpcnz1RY8pf7bjwng==} resolution: {integrity: sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@rollup/rollup-linux-arm64-musl@4.54.0': '@rollup/rollup-linux-arm64-musl@4.55.1':
resolution: {integrity: sha512-gr5vDbg3Bakga5kbdpqx81m2n9IX8M6gIMlQQIXiLTNeQW6CucvuInJ91EuCJ/JYvc+rcLLsDFcfAD1K7fMofg==} resolution: {integrity: sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@rollup/rollup-linux-loong64-gnu@4.54.0': '@rollup/rollup-linux-loong64-gnu@4.55.1':
resolution: {integrity: sha512-gsrtB1NA3ZYj2vq0Rzkylo9ylCtW/PhpLEivlgWe0bpgtX5+9j9EZa0wtZiCjgu6zmSeZWyI/e2YRX1URozpIw==} resolution: {integrity: sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==}
cpu: [loong64] cpu: [loong64]
os: [linux] os: [linux]
'@rollup/rollup-linux-ppc64-gnu@4.54.0': '@rollup/rollup-linux-loong64-musl@4.55.1':
resolution: {integrity: sha512-y3qNOfTBStmFNq+t4s7Tmc9hW2ENtPg8FeUD/VShI7rKxNW7O4fFeaYbMsd3tpFlIg1Q8IapFgy7Q9i2BqeBvA==} resolution: {integrity: sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==}
cpu: [loong64]
os: [linux]
'@rollup/rollup-linux-ppc64-gnu@4.55.1':
resolution: {integrity: sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.54.0': '@rollup/rollup-linux-ppc64-musl@4.55.1':
resolution: {integrity: sha512-89sepv7h2lIVPsFma8iwmccN7Yjjtgz0Rj/Ou6fEqg3HDhpCa+Et+YSufy27i6b0Wav69Qv4WBNl3Rs6pwhebQ==} resolution: {integrity: sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==}
cpu: [ppc64]
os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.55.1':
resolution: {integrity: sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
'@rollup/rollup-linux-riscv64-musl@4.54.0': '@rollup/rollup-linux-riscv64-musl@4.55.1':
resolution: {integrity: sha512-ZcU77ieh0M2Q8Ur7D5X7KvK+UxbXeDHwiOt/CPSBTI1fBmeDMivW0dPkdqkT4rOgDjrDDBUed9x4EgraIKoR2A==} resolution: {integrity: sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.54.0': '@rollup/rollup-linux-s390x-gnu@4.55.1':
resolution: {integrity: sha512-2AdWy5RdDF5+4YfG/YesGDDtbyJlC9LHmL6rZw6FurBJ5n4vFGupsOBGfwMRjBYH7qRQowT8D/U4LoSvVwOhSQ==} resolution: {integrity: sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
'@rollup/rollup-linux-x64-gnu@4.54.0': '@rollup/rollup-linux-x64-gnu@4.55.1':
resolution: {integrity: sha512-WGt5J8Ij/rvyqpFexxk3ffKqqbLf9AqrTBbWDk7ApGUzaIs6V+s2s84kAxklFwmMF/vBNGrVdYgbblCOFFezMQ==} resolution: {integrity: sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@rollup/rollup-linux-x64-musl@4.54.0': '@rollup/rollup-linux-x64-musl@4.55.1':
resolution: {integrity: sha512-JzQmb38ATzHjxlPHuTH6tE7ojnMKM2kYNzt44LO/jJi8BpceEC8QuXYA908n8r3CNuG/B3BV8VR3Hi1rYtmPiw==} resolution: {integrity: sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@rollup/rollup-openharmony-arm64@4.54.0': '@rollup/rollup-openbsd-x64@4.55.1':
resolution: {integrity: sha512-huT3fd0iC7jigGh7n3q/+lfPcXxBi+om/Rs3yiFxjvSxbSB6aohDFXbWvlspaqjeOh+hx7DDHS+5Es5qRkWkZg==} resolution: {integrity: sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==}
cpu: [x64]
os: [openbsd]
'@rollup/rollup-openharmony-arm64@4.55.1':
resolution: {integrity: sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==}
cpu: [arm64] cpu: [arm64]
os: [openharmony] os: [openharmony]
'@rollup/rollup-win32-arm64-msvc@4.54.0': '@rollup/rollup-win32-arm64-msvc@4.55.1':
resolution: {integrity: sha512-c2V0W1bsKIKfbLMBu/WGBz6Yci8nJ/ZJdheE0EwB73N3MvHYKiKGs3mVilX4Gs70eGeDaMqEob25Tw2Gb9Nqyw==} resolution: {integrity: sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.54.0': '@rollup/rollup-win32-ia32-msvc@4.55.1':
resolution: {integrity: sha512-woEHgqQqDCkAzrDhvDipnSirm5vxUXtSKDYTVpZG3nUdW/VVB5VdCYA2iReSj/u3yCZzXID4kuKG7OynPnB3WQ==} resolution: {integrity: sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
'@rollup/rollup-win32-x64-gnu@4.54.0': '@rollup/rollup-win32-x64-gnu@4.55.1':
resolution: {integrity: sha512-dzAc53LOuFvHwbCEOS0rPbXp6SIhAf2txMP5p6mGyOXXw5mWY8NGGbPMPrs4P1WItkfApDathBj/NzMLUZ9rtQ==} resolution: {integrity: sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@rollup/rollup-win32-x64-msvc@4.54.0': '@rollup/rollup-win32-x64-msvc@4.55.1':
resolution: {integrity: sha512-hYT5d3YNdSh3mbCU1gwQyPgQd3T2ne0A3KG8KSBdav5TiBg6eInVmV+TeR5uHufiIgSFg0XsOWGW5/RhNcSvPg==} resolution: {integrity: sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
@@ -527,8 +548,8 @@ packages:
'@types/json-schema@7.0.15': '@types/json-schema@7.0.15':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
'@types/node@25.0.3': '@types/node@25.0.7':
resolution: {integrity: sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==} resolution: {integrity: sha512-C/er7DlIZgRJO7WtTdYovjIFzGsz0I95UlMyR9anTb4aCpBSRWe5Jc1/RvLKUfzmOxHPGjSE5+63HgLtndxU4w==}
'@types/resolve@1.20.2': '@types/resolve@1.20.2':
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
@@ -959,8 +980,8 @@ packages:
rollup: ^3.29.4 || ^4 rollup: ^3.29.4 || ^4
typescript: ^4.5 || ^5.0 typescript: ^4.5 || ^5.0
rollup@4.54.0: rollup@4.55.1:
resolution: {integrity: sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==} resolution: {integrity: sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'} engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true hasBin: true
@@ -974,9 +995,9 @@ packages:
resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==}
engines: {node: '>= 10.13.0'} engines: {node: '>= 10.13.0'}
selfsigned@5.4.0: selfsigned@5.5.0:
resolution: {integrity: sha512-Yn8qZOOJv+NhcGY19iC+ngW6hlUCNpvWEkrKllXNhmkLgR9fcErm8EqZ/wev7/tiwjKC9qj17Fa/PtBNzb6q8g==} resolution: {integrity: sha512-ftnu3TW4+3eBfLRFnDEkzGxSF/10BJBkaLJuBHZX0kiPS7bRdlpZGu6YGt4KngMkdTwJE6MbjavFpqHvqVt+Ew==}
engines: {node: '>=15.6.0'} engines: {node: '>=18'}
semver@7.7.3: semver@7.7.3:
resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==}
@@ -1136,8 +1157,8 @@ packages:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'} engines: {node: '>=6'}
zod@4.2.1: zod@4.3.5:
resolution: {integrity: sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==} resolution: {integrity: sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==}
snapshots: snapshots:
@@ -1257,9 +1278,13 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
'@kevisual/js-filter@0.0.4': {}
'@kevisual/local-proxy@0.0.8': {} '@kevisual/local-proxy@0.0.8': {}
'@kevisual/query@0.0.33': {} '@kevisual/query@0.0.35':
dependencies:
tslib: 2.8.1
'@kevisual/ws@8.0.0': {} '@kevisual/ws@8.0.0': {}
@@ -1355,13 +1380,13 @@ snapshots:
tslib: 2.8.1 tslib: 2.8.1
tsyringe: 4.10.0 tsyringe: 4.10.0
'@rollup/plugin-alias@6.0.0(rollup@4.54.0)': '@rollup/plugin-alias@6.0.0(rollup@4.55.1)':
optionalDependencies: optionalDependencies:
rollup: 4.54.0 rollup: 4.55.1
'@rollup/plugin-commonjs@29.0.0(rollup@4.54.0)': '@rollup/plugin-commonjs@29.0.0(rollup@4.55.1)':
dependencies: dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.54.0) '@rollup/pluginutils': 5.3.0(rollup@4.55.1)
commondir: 1.0.1 commondir: 1.0.1
estree-walker: 2.0.2 estree-walker: 2.0.2
fdir: 6.5.0(picomatch@4.0.3) fdir: 6.5.0(picomatch@4.0.3)
@@ -1369,99 +1394,108 @@ snapshots:
magic-string: 0.30.21 magic-string: 0.30.21
picomatch: 4.0.3 picomatch: 4.0.3
optionalDependencies: optionalDependencies:
rollup: 4.54.0 rollup: 4.55.1
'@rollup/plugin-node-resolve@16.0.3(rollup@4.54.0)': '@rollup/plugin-node-resolve@16.0.3(rollup@4.55.1)':
dependencies: dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.54.0) '@rollup/pluginutils': 5.3.0(rollup@4.55.1)
'@types/resolve': 1.20.2 '@types/resolve': 1.20.2
deepmerge: 4.3.1 deepmerge: 4.3.1
is-module: 1.0.0 is-module: 1.0.0
resolve: 1.22.11 resolve: 1.22.11
optionalDependencies: optionalDependencies:
rollup: 4.54.0 rollup: 4.55.1
'@rollup/plugin-typescript@12.3.0(rollup@4.54.0)(tslib@2.8.1)(typescript@5.9.3)': '@rollup/plugin-typescript@12.3.0(rollup@4.55.1)(tslib@2.8.1)(typescript@5.9.3)':
dependencies: dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.54.0) '@rollup/pluginutils': 5.3.0(rollup@4.55.1)
resolve: 1.22.11 resolve: 1.22.11
typescript: 5.9.3 typescript: 5.9.3
optionalDependencies: optionalDependencies:
rollup: 4.54.0 rollup: 4.55.1
tslib: 2.8.1 tslib: 2.8.1
'@rollup/pluginutils@5.3.0(rollup@4.54.0)': '@rollup/pluginutils@5.3.0(rollup@4.55.1)':
dependencies: dependencies:
'@types/estree': 1.0.8 '@types/estree': 1.0.8
estree-walker: 2.0.2 estree-walker: 2.0.2
picomatch: 4.0.3 picomatch: 4.0.3
optionalDependencies: optionalDependencies:
rollup: 4.54.0 rollup: 4.55.1
'@rollup/rollup-android-arm-eabi@4.54.0': '@rollup/rollup-android-arm-eabi@4.55.1':
optional: true optional: true
'@rollup/rollup-android-arm64@4.54.0': '@rollup/rollup-android-arm64@4.55.1':
optional: true optional: true
'@rollup/rollup-darwin-arm64@4.54.0': '@rollup/rollup-darwin-arm64@4.55.1':
optional: true optional: true
'@rollup/rollup-darwin-x64@4.54.0': '@rollup/rollup-darwin-x64@4.55.1':
optional: true optional: true
'@rollup/rollup-freebsd-arm64@4.54.0': '@rollup/rollup-freebsd-arm64@4.55.1':
optional: true optional: true
'@rollup/rollup-freebsd-x64@4.54.0': '@rollup/rollup-freebsd-x64@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.54.0': '@rollup/rollup-linux-arm-gnueabihf@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-arm-musleabihf@4.54.0': '@rollup/rollup-linux-arm-musleabihf@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-arm64-gnu@4.54.0': '@rollup/rollup-linux-arm64-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-arm64-musl@4.54.0': '@rollup/rollup-linux-arm64-musl@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-loong64-gnu@4.54.0': '@rollup/rollup-linux-loong64-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-ppc64-gnu@4.54.0': '@rollup/rollup-linux-loong64-musl@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-riscv64-gnu@4.54.0': '@rollup/rollup-linux-ppc64-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-riscv64-musl@4.54.0': '@rollup/rollup-linux-ppc64-musl@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-s390x-gnu@4.54.0': '@rollup/rollup-linux-riscv64-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-x64-gnu@4.54.0': '@rollup/rollup-linux-riscv64-musl@4.55.1':
optional: true optional: true
'@rollup/rollup-linux-x64-musl@4.54.0': '@rollup/rollup-linux-s390x-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-openharmony-arm64@4.54.0': '@rollup/rollup-linux-x64-gnu@4.55.1':
optional: true optional: true
'@rollup/rollup-win32-arm64-msvc@4.54.0': '@rollup/rollup-linux-x64-musl@4.55.1':
optional: true optional: true
'@rollup/rollup-win32-ia32-msvc@4.54.0': '@rollup/rollup-openbsd-x64@4.55.1':
optional: true optional: true
'@rollup/rollup-win32-x64-gnu@4.54.0': '@rollup/rollup-openharmony-arm64@4.55.1':
optional: true optional: true
'@rollup/rollup-win32-x64-msvc@4.54.0': '@rollup/rollup-win32-arm64-msvc@4.55.1':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.55.1':
optional: true
'@rollup/rollup-win32-x64-gnu@4.55.1':
optional: true
'@rollup/rollup-win32-x64-msvc@4.55.1':
optional: true optional: true
'@tsconfig/node10@1.0.12': {} '@tsconfig/node10@1.0.12': {}
@@ -1490,7 +1524,7 @@ snapshots:
'@types/json-schema@7.0.15': {} '@types/json-schema@7.0.15': {}
'@types/node@25.0.3': '@types/node@25.0.7':
dependencies: dependencies:
undici-types: 7.16.0 undici-types: 7.16.0
@@ -1498,15 +1532,15 @@ snapshots:
'@types/send@1.2.1': '@types/send@1.2.1':
dependencies: dependencies:
'@types/node': 25.0.3 '@types/node': 25.0.7
'@types/ws@8.18.1': '@types/ws@8.18.1':
dependencies: dependencies:
'@types/node': 25.0.3 '@types/node': 25.0.7
'@types/xml2js@0.4.14': '@types/xml2js@0.4.14':
dependencies: dependencies:
'@types/node': 25.0.3 '@types/node': 25.0.7
'@webassemblyjs/ast@1.14.1': '@webassemblyjs/ast@1.14.1':
dependencies: dependencies:
@@ -1644,7 +1678,7 @@ snapshots:
bun-types@1.3.5: bun-types@1.3.5:
dependencies: dependencies:
'@types/node': 25.0.3 '@types/node': 25.0.7
bytestreamjs@2.0.1: {} bytestreamjs@2.0.1: {}
@@ -1805,7 +1839,7 @@ snapshots:
jest-worker@27.5.1: jest-worker@27.5.1:
dependencies: dependencies:
'@types/node': 25.0.3 '@types/node': 25.0.7
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 8.1.1 supports-color: 8.1.1
@@ -1898,40 +1932,43 @@ snapshots:
path-parse: 1.0.7 path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0 supports-preserve-symlinks-flag: 1.0.0
rollup-plugin-dts@6.3.0(rollup@4.54.0)(typescript@5.9.3): rollup-plugin-dts@6.3.0(rollup@4.55.1)(typescript@5.9.3):
dependencies: dependencies:
magic-string: 0.30.21 magic-string: 0.30.21
rollup: 4.54.0 rollup: 4.55.1
typescript: 5.9.3 typescript: 5.9.3
optionalDependencies: optionalDependencies:
'@babel/code-frame': 7.27.1 '@babel/code-frame': 7.27.1
rollup@4.54.0: rollup@4.55.1:
dependencies: dependencies:
'@types/estree': 1.0.8 '@types/estree': 1.0.8
optionalDependencies: optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.54.0 '@rollup/rollup-android-arm-eabi': 4.55.1
'@rollup/rollup-android-arm64': 4.54.0 '@rollup/rollup-android-arm64': 4.55.1
'@rollup/rollup-darwin-arm64': 4.54.0 '@rollup/rollup-darwin-arm64': 4.55.1
'@rollup/rollup-darwin-x64': 4.54.0 '@rollup/rollup-darwin-x64': 4.55.1
'@rollup/rollup-freebsd-arm64': 4.54.0 '@rollup/rollup-freebsd-arm64': 4.55.1
'@rollup/rollup-freebsd-x64': 4.54.0 '@rollup/rollup-freebsd-x64': 4.55.1
'@rollup/rollup-linux-arm-gnueabihf': 4.54.0 '@rollup/rollup-linux-arm-gnueabihf': 4.55.1
'@rollup/rollup-linux-arm-musleabihf': 4.54.0 '@rollup/rollup-linux-arm-musleabihf': 4.55.1
'@rollup/rollup-linux-arm64-gnu': 4.54.0 '@rollup/rollup-linux-arm64-gnu': 4.55.1
'@rollup/rollup-linux-arm64-musl': 4.54.0 '@rollup/rollup-linux-arm64-musl': 4.55.1
'@rollup/rollup-linux-loong64-gnu': 4.54.0 '@rollup/rollup-linux-loong64-gnu': 4.55.1
'@rollup/rollup-linux-ppc64-gnu': 4.54.0 '@rollup/rollup-linux-loong64-musl': 4.55.1
'@rollup/rollup-linux-riscv64-gnu': 4.54.0 '@rollup/rollup-linux-ppc64-gnu': 4.55.1
'@rollup/rollup-linux-riscv64-musl': 4.54.0 '@rollup/rollup-linux-ppc64-musl': 4.55.1
'@rollup/rollup-linux-s390x-gnu': 4.54.0 '@rollup/rollup-linux-riscv64-gnu': 4.55.1
'@rollup/rollup-linux-x64-gnu': 4.54.0 '@rollup/rollup-linux-riscv64-musl': 4.55.1
'@rollup/rollup-linux-x64-musl': 4.54.0 '@rollup/rollup-linux-s390x-gnu': 4.55.1
'@rollup/rollup-openharmony-arm64': 4.54.0 '@rollup/rollup-linux-x64-gnu': 4.55.1
'@rollup/rollup-win32-arm64-msvc': 4.54.0 '@rollup/rollup-linux-x64-musl': 4.55.1
'@rollup/rollup-win32-ia32-msvc': 4.54.0 '@rollup/rollup-openbsd-x64': 4.55.1
'@rollup/rollup-win32-x64-gnu': 4.54.0 '@rollup/rollup-openharmony-arm64': 4.55.1
'@rollup/rollup-win32-x64-msvc': 4.54.0 '@rollup/rollup-win32-arm64-msvc': 4.55.1
'@rollup/rollup-win32-ia32-msvc': 4.55.1
'@rollup/rollup-win32-x64-gnu': 4.55.1
'@rollup/rollup-win32-x64-msvc': 4.55.1
fsevents: 2.3.3 fsevents: 2.3.3
safe-buffer@5.2.1: {} safe-buffer@5.2.1: {}
@@ -1945,7 +1982,7 @@ snapshots:
ajv-formats: 2.1.1(ajv@8.17.1) ajv-formats: 2.1.1(ajv@8.17.1)
ajv-keywords: 5.1.0(ajv@8.17.1) ajv-keywords: 5.1.0(ajv@8.17.1)
selfsigned@5.4.0: selfsigned@5.5.0:
dependencies: dependencies:
'@peculiar/x509': 1.14.2 '@peculiar/x509': 1.14.2
pkijs: 3.3.3 pkijs: 3.3.3
@@ -2029,14 +2066,14 @@ snapshots:
typescript: 5.9.3 typescript: 5.9.3
webpack: 5.104.1 webpack: 5.104.1
ts-node@10.9.2(@types/node@25.0.3)(typescript@5.9.3): ts-node@10.9.2(@types/node@25.0.7)(typescript@5.9.3):
dependencies: dependencies:
'@cspotcode/source-map-support': 0.8.1 '@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.12 '@tsconfig/node10': 1.0.12
'@tsconfig/node12': 1.0.11 '@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3 '@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4 '@tsconfig/node16': 1.0.4
'@types/node': 25.0.3 '@types/node': 25.0.7
acorn: 8.15.0 acorn: 8.15.0
acorn-walk: 8.3.4 acorn-walk: 8.3.4
arg: 4.1.3 arg: 4.1.3
@@ -2122,4 +2159,4 @@ snapshots:
yn@3.1.1: {} yn@3.1.1: {}
zod@4.2.1: {} zod@4.3.5: {}

View File

@@ -81,29 +81,6 @@ export default [
}, },
plugins: [dts()], plugins: [dts()],
}, },
{
input: 'src/sign.ts',
output: {
file: 'dist/router-sign.js',
format: 'es',
},
plugins: [
createAlias(),
resolve({
browser: false,
}),
commonjs(),
typescript(),
],
},
{
input: 'src/sign.ts',
output: {
file: 'dist/router-sign.d.ts',
format: 'es',
},
plugins: [dts()],
},
{ {
input: 'src/router-define.ts', input: 'src/router-define.ts',
output: { output: {

View File

@@ -7,6 +7,7 @@ import { handleServer } from './server/handle-server.ts';
import { IncomingMessage, ServerResponse } from 'http'; import { IncomingMessage, ServerResponse } from 'http';
import { isBun } from './utils/is-engine.ts'; import { isBun } from './utils/is-engine.ts';
import { BunServer } from './server/server-bun.ts'; import { BunServer } from './server/server-bun.ts';
import { nanoid } from 'nanoid';
type RouterHandle = (msg: { path: string;[key: string]: any }) => { code: string; data?: any; message?: string;[key: string]: any }; type RouterHandle = (msg: { path: string;[key: string]: any }) => { code: string; data?: any; message?: string;[key: string]: any };
type AppOptions<T = {}> = { type AppOptions<T = {}> = {
@@ -16,6 +17,7 @@ type AppOptions<T = {}> = {
routerHandle?: RouterHandle; routerHandle?: RouterHandle;
routerContext?: RouteContext<T>; routerContext?: RouteContext<T>;
serverOptions?: ServerNodeOpts; serverOptions?: ServerNodeOpts;
appId?: string;
}; };
export type AppRouteContext<T = {}> = HandleCtx & RouteContext<T> & { app: App<T> }; export type AppRouteContext<T = {}> = HandleCtx & RouteContext<T> & { app: App<T> };
@@ -25,6 +27,7 @@ export type AppRouteContext<T = {}> = HandleCtx & RouteContext<T> & { app: App<T
* U - Route Context的扩展类型 * U - Route Context的扩展类型
*/ */
export class App<U = {}> { export class App<U = {}> {
appId: string;
router: QueryRouter; router: QueryRouter;
server: ServerType; server: ServerType;
constructor(opts?: AppOptions<U>) { constructor(opts?: AppOptions<U>) {
@@ -42,6 +45,12 @@ export class App<U = {}> {
router.setContext({ needSerialize: true, ...opts?.routerContext }); router.setContext({ needSerialize: true, ...opts?.routerContext });
this.router = router; this.router = router;
this.server = server; this.server = server;
if (opts?.appId) {
this.appId = opts.appId;
} else {
this.appId = nanoid(16);
}
router.appId = this.appId;
} }
listen(port: number, hostname?: string, backlog?: number, listeningListener?: () => void): void; listen(port: number, hostname?: string, backlog?: number, listeningListener?: () => void): void;
listen(port: number, hostname?: string, listeningListener?: () => void): void; listen(port: number, hostname?: string, listeningListener?: () => void): void;

19
src/auto/index.ts Normal file
View File

@@ -0,0 +1,19 @@
import { loadTS, getMatchFiles } from './load-ts.ts';
import { listenSocket } from './listen-sock.ts';
import { Route, QueryRouter, QueryRouterServer } from '../route.ts';
export { Route, QueryRouter, QueryRouterServer };
export const App = QueryRouterServer;
export { createSchema } from './../index.ts';
export type { Rule } from '../validator/rule.ts';
export type { RouteContext, RouteOpts } from '../route.ts';
export type { Run } from '../route.ts';
export { CustomError } from '../result/error.ts';
export { listenSocket, loadTS, getMatchFiles };
export { autoCall } from './call-sock.ts';

View File

@@ -1,40 +0,0 @@
import { QueryRouter } from "./route.ts";
type RouterChatOptions = {
router?: QueryRouter;
}
export class RouterChat {
router: QueryRouter;
prompt: string = '';
constructor(opts?: RouterChatOptions) {
this.router = opts?.router || new QueryRouter();
}
prefix(wrapperFn?: (routes: any[]) => string) {
if (this.prompt) {
return this.prompt;
}
let _prompt = `你是一个调用函数工具的助手,当用户询问时,如果拥有工具,请返回 JSON 数据,数据的值的内容是 id 和 payload 。如果有参数,请放到 payload 当中。
下面是你可以使用的工具列表:
`;
if (!wrapperFn) {
_prompt += this.router.routes.map(r => `工具名称: ${r.id}\n描述: ${r.description}\n`).join('\n');
} else {
_prompt += wrapperFn(this.router.exportRoutes());
}
_prompt += `当你需要使用工具时,请严格按照以下格式返回:
{
"id": "工具名称",
"payload": {
// 参数列表
}
}
如果你不需要使用工具,直接返回用户想要的内容即可,不要返回任何多余的信息。`;
return _prompt;
}
chat() {
const prompt = this.prefix();
return prompt;
}
}

57
src/modules/chat.ts Normal file
View File

@@ -0,0 +1,57 @@
import { QueryRouter } from "../route.ts";
import { filter } from '@kevisual/js-filter'
type RouterChatOptions = {
router?: QueryRouter;
}
export class RouterChat {
router: QueryRouter;
prompt: string = '';
constructor(opts?: RouterChatOptions) {
this.router = opts?.router || new QueryRouter();
}
prefix(opts?: { query?: string }) {
if (this.prompt) {
return this.prompt;
}
let _routes = this.router.routes;
if (opts?.query) {
_routes = filter(this.router.routes, opts.query);
}
const toolsList = _routes.map((r, index) =>
`${index + 1}. 工具名称: ${r.id}\n 描述: ${r.description}`
).join('\n\n');
const _prompt = `你是一个 AI 助手,你可以使用以下工具来帮助用户完成任务:
${toolsList}
## 回复规则
1. 如果用户的请求可以使用上述工具完成,请返回 JSON 格式数据
2. 如果没有合适的工具,请直接分析并回答用户问题
## JSON 数据格式
\`\`\`json
{
"id": "工具的id",
"payload": {
// 工具所需的参数(如果需要)
// 例如: "id": "xxx", "name": "xxx"
}
}
\`\`\`
注意:
- payload 中包含工具执行所需的所有参数
- 如果工具不需要参数payload 可以为空对象 {}
- 确保返回的 id 与上述工具列表中的工具名称完全匹配`
this.prompt = _prompt;
return _prompt;
}
recreate() {
this.prompt = '';
}
getChatPrompt() {
const prompt = this.prefix();
return prompt;
}
}

View File

@@ -5,6 +5,11 @@ import { listenProcess } from './utils/listen-process.ts';
export type RouterContextT = { code?: number;[key: string]: any }; export type RouterContextT = { code?: number;[key: string]: any };
export type RouteContext<T = { code?: number }, S = any> = { export type RouteContext<T = { code?: number }, S = any> = {
/**
* 本地自己调用的时候使用,可以标识为当前自调用,那么 auth 就不许重复的校验
* 或者不需要登录的,直接调用
*/
appId?: string;
// run first // run first
query?: { [key: string]: any }; query?: { [key: string]: any };
// response body // response body
@@ -217,6 +222,7 @@ export class Route<U = { [key: string]: any }, T extends SimpleObject = SimpleOb
} }
export class QueryRouter { export class QueryRouter {
appId: string = '';
routes: Route[]; routes: Route[];
maxNextRoute = 40; maxNextRoute = 40;
context?: RouteContext = {}; // default context for call context?: RouteContext = {}; // default context for call
@@ -555,6 +561,21 @@ export class QueryRouter {
hasRoute(path: string, key: string = '') { hasRoute(path: string, key: string = '') {
return this.routes.find((r) => r.path === path && r.key === key); return this.routes.find((r) => r.path === path && r.key === key);
} }
findRoute(opts?: { path?: string; key?: string; id?: string }) {
const { path, key, id } = opts || {};
return this.routes.find((r) => {
if (id) {
return r.id === id;
}
if (path) {
if (key !== undefined) {
return r.path === path && r.key === key;
}
return r.path === path;
}
return false;
});
}
createRouteList(force: boolean = false, filter?: (route: Route) => boolean) { createRouteList(force: boolean = false, filter?: (route: Route) => boolean) {
const hasListRoute = this.hasRoute('router', 'list'); const hasListRoute = this.hasRoute('router', 'list');
if (!hasListRoute || force) { if (!hasListRoute || force) {
@@ -594,6 +615,7 @@ export class QueryRouter {
type QueryRouterServerOpts = { type QueryRouterServerOpts = {
handleFn?: HandleFn; handleFn?: HandleFn;
context?: RouteContext; context?: RouteContext;
appId?: string;
}; };
interface HandleFn<T = any> { interface HandleFn<T = any> {
(msg: { path: string;[key: string]: any }, ctx?: any): { code: string; data?: any; message?: string;[key: string]: any }; (msg: { path: string;[key: string]: any }, ctx?: any): { code: string; data?: any; message?: string;[key: string]: any };
@@ -604,11 +626,17 @@ interface HandleFn<T = any> {
* @description 移除server相关的功能只保留router相关的功能和http.createServer不相关独立 * @description 移除server相关的功能只保留router相关的功能和http.createServer不相关独立
*/ */
export class QueryRouterServer extends QueryRouter { export class QueryRouterServer extends QueryRouter {
declare appId: string;
handle: any; handle: any;
constructor(opts?: QueryRouterServerOpts) { constructor(opts?: QueryRouterServerOpts) {
super(); super();
this.handle = this.getHandle(this, opts?.handleFn, opts?.context); this.handle = this.getHandle(this, opts?.handleFn, opts?.context);
this.setContext({ needSerialize: false, ...opts?.context }); this.setContext({ needSerialize: false, ...opts?.context });
if (opts?.appId) {
this.appId = opts.appId;
} else {
this.appId = nanoid(16);
}
} }
setHandle(wrapperFn?: HandleFn, ctx?: RouteContext) { setHandle(wrapperFn?: HandleFn, ctx?: RouteContext) {
this.handle = this.getHandle(this, wrapperFn, ctx); this.handle = this.getHandle(this, wrapperFn, ctx);

View File

@@ -1,3 +0,0 @@
import { parseXml } from './server/parse-xml.ts';
export { parseXml };

View File

@@ -1,59 +0,0 @@
import { generate } from 'selfsigned';
export type Attributes = {
name: string;
value: string;
};
export type AltNames = {
type: number;
value?: string;
ip?: string;
};
export const createCert = async(attrs: Attributes[] = [], altNames: AltNames[] = []) => {
let attributes = [
{ name: 'countryName', value: 'CN' }, // 国家代码
{ name: 'stateOrProvinceName', value: 'ZheJiang' }, // 州名
{ name: 'localityName', value: 'HangZhou' }, // 城市名
{ name: 'organizationName', value: 'kevisual' }, // 组织名
{ name: 'organizationalUnitName', value: 'kevisual' }, // 组织单位
...attrs,
];
// attribute 根据name去重复, 后面的覆盖前面的
attributes = Object.values(
attributes.reduce(
(acc, attr) => ({
...acc,
[attr.name]: attr,
}),
{} as Record<string, Attributes>,
),
);
const options = {
days: 365, // 证书有效期(天)
extensions: [
{
name: 'subjectAltName',
altNames: [
{ type: 2, value: '*' }, // DNS 名称
{ type: 2, value: 'localhost' }, // DNS
{
type: 2,
value: '[::1]',
},
{
type: 7,
ip: 'fe80::1',
},
{ type: 7, ip: '127.0.0.1' }, // IP 地址
...altNames,
],
},
],
};
const pems = await generate(attributes, options);
return {
key: pems.private,
cert: pems.cert,
};
};

View File

@@ -1,5 +1,5 @@
import { App } from '../app.ts' import { App } from '../app.ts'
import { RouterChat } from '@/chat.ts'; import { RouterChat } from '@/modules/chat.ts';
const app = new App(); const app = new App();