@kevisual/router 0.0.31 → 0.0.32
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/package.json +7 -7
- package/src/route.ts +18 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@kevisual/router",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.32",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/router.js",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@kevisual/local-proxy": "^0.0.6",
|
|
25
25
|
"@kevisual/query": "^0.0.29",
|
|
26
|
-
"@rollup/plugin-alias": "^
|
|
27
|
-
"@rollup/plugin-commonjs": "
|
|
26
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
27
|
+
"@rollup/plugin-commonjs": "29.0.0",
|
|
28
28
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
29
29
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
30
30
|
"@types/lodash-es": "^4.17.12",
|
|
31
|
-
"@types/node": "^24.
|
|
32
|
-
"@types/send": "^1.2.
|
|
31
|
+
"@types/node": "^24.10.1",
|
|
32
|
+
"@types/send": "^1.2.1",
|
|
33
33
|
"@types/ws": "^8.18.1",
|
|
34
34
|
"@types/xml2js": "^0.4.14",
|
|
35
35
|
"cookie": "^1.0.2",
|
|
36
36
|
"lodash-es": "^4.17.21",
|
|
37
37
|
"nanoid": "^5.1.6",
|
|
38
|
-
"rollup": "^4.
|
|
38
|
+
"rollup": "^4.53.2",
|
|
39
39
|
"rollup-plugin-dts": "^6.2.3",
|
|
40
40
|
"ts-loader": "^9.5.4",
|
|
41
41
|
"ts-node": "^10.9.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"path-to-regexp": "^8.3.0",
|
|
54
|
-
"selfsigned": "^
|
|
54
|
+
"selfsigned": "^4.0.0",
|
|
55
55
|
"send": "^1.2.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
package/src/route.ts
CHANGED
|
@@ -702,6 +702,19 @@ export class QueryRouter {
|
|
|
702
702
|
hasRoute(path: string, key: string = '') {
|
|
703
703
|
return this.routes.find((r) => r.path === path && r.key === key);
|
|
704
704
|
}
|
|
705
|
+
createRouteList(force: boolean = false) {
|
|
706
|
+
const hasListRoute = this.hasRoute('route', 'list');
|
|
707
|
+
if (!hasListRoute || force) {
|
|
708
|
+
const listRoute = new Route('route', 'list', {
|
|
709
|
+
description: '列出当前应用下的所有的路由信息',
|
|
710
|
+
run: async (ctx: RouteContext) => {
|
|
711
|
+
const list = this.getList();
|
|
712
|
+
ctx.body = list;
|
|
713
|
+
},
|
|
714
|
+
});
|
|
715
|
+
this.add(listRoute);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
705
718
|
/**
|
|
706
719
|
* 等待程序运行, 获取到message的数据,就执行
|
|
707
720
|
*
|
|
@@ -710,7 +723,11 @@ export class QueryRouter {
|
|
|
710
723
|
* -- .on
|
|
711
724
|
* -- .send
|
|
712
725
|
*/
|
|
713
|
-
wait(params?: { path?: string; key?: string; payload?: any }, opts?: { emitter?: any, timeout?: number }) {
|
|
726
|
+
wait(params?: { path?: string; key?: string; payload?: any }, opts?: { emitter?: any, timeout?: number, getList?: boolean }) {
|
|
727
|
+
const getList = opts?.getList ?? true;
|
|
728
|
+
if (getList) {
|
|
729
|
+
this.createRouteList();
|
|
730
|
+
}
|
|
714
731
|
return listenProcess({ app: this, params, ...opts });
|
|
715
732
|
}
|
|
716
733
|
}
|