@kevisual/router 0.0.31 → 0.0.33
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/router-browser.d.ts +2 -0
- package/dist/router-browser.js +17 -0
- package/dist/router.d.ts +2 -0
- package/dist/router.js +17 -0
- package/package.json +7 -7
- package/src/route.ts +18 -1
package/dist/router-browser.d.ts
CHANGED
|
@@ -365,6 +365,7 @@ declare class QueryRouter {
|
|
|
365
365
|
hasRoute(path: string, key?: string): Route<{
|
|
366
366
|
[key: string]: any;
|
|
367
367
|
}>;
|
|
368
|
+
createRouteList(force?: boolean): void;
|
|
368
369
|
/**
|
|
369
370
|
* 等待程序运行, 获取到message的数据,就执行
|
|
370
371
|
*
|
|
@@ -380,6 +381,7 @@ declare class QueryRouter {
|
|
|
380
381
|
}, opts?: {
|
|
381
382
|
emitter?: any;
|
|
382
383
|
timeout?: number;
|
|
384
|
+
getList?: boolean;
|
|
383
385
|
}): Promise<void>;
|
|
384
386
|
}
|
|
385
387
|
type QueryRouterServerOpts = {
|
package/dist/router-browser.js
CHANGED
|
@@ -5394,6 +5394,19 @@ class QueryRouter {
|
|
|
5394
5394
|
hasRoute(path, key = '') {
|
|
5395
5395
|
return this.routes.find((r) => r.path === path && r.key === key);
|
|
5396
5396
|
}
|
|
5397
|
+
createRouteList(force = false) {
|
|
5398
|
+
const hasListRoute = this.hasRoute('route', 'list');
|
|
5399
|
+
if (!hasListRoute || force) {
|
|
5400
|
+
const listRoute = new Route('route', 'list', {
|
|
5401
|
+
description: '列出当前应用下的所有的路由信息',
|
|
5402
|
+
run: async (ctx) => {
|
|
5403
|
+
const list = this.getList();
|
|
5404
|
+
ctx.body = list;
|
|
5405
|
+
},
|
|
5406
|
+
});
|
|
5407
|
+
this.add(listRoute);
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5397
5410
|
/**
|
|
5398
5411
|
* 等待程序运行, 获取到message的数据,就执行
|
|
5399
5412
|
*
|
|
@@ -5403,6 +5416,10 @@ class QueryRouter {
|
|
|
5403
5416
|
* -- .send
|
|
5404
5417
|
*/
|
|
5405
5418
|
wait(params, opts) {
|
|
5419
|
+
const getList = opts?.getList ?? true;
|
|
5420
|
+
if (getList) {
|
|
5421
|
+
this.createRouteList();
|
|
5422
|
+
}
|
|
5406
5423
|
return listenProcess({ app: this, params, ...opts });
|
|
5407
5424
|
}
|
|
5408
5425
|
}
|
package/dist/router.d.ts
CHANGED
|
@@ -369,6 +369,7 @@ declare class QueryRouter {
|
|
|
369
369
|
hasRoute(path: string, key?: string): Route<{
|
|
370
370
|
[key: string]: any;
|
|
371
371
|
}>;
|
|
372
|
+
createRouteList(force?: boolean): void;
|
|
372
373
|
/**
|
|
373
374
|
* 等待程序运行, 获取到message的数据,就执行
|
|
374
375
|
*
|
|
@@ -384,6 +385,7 @@ declare class QueryRouter {
|
|
|
384
385
|
}, opts?: {
|
|
385
386
|
emitter?: any;
|
|
386
387
|
timeout?: number;
|
|
388
|
+
getList?: boolean;
|
|
387
389
|
}): Promise<void>;
|
|
388
390
|
}
|
|
389
391
|
type QueryRouterServerOpts = {
|
package/dist/router.js
CHANGED
|
@@ -5416,6 +5416,19 @@ class QueryRouter {
|
|
|
5416
5416
|
hasRoute(path, key = '') {
|
|
5417
5417
|
return this.routes.find((r) => r.path === path && r.key === key);
|
|
5418
5418
|
}
|
|
5419
|
+
createRouteList(force = false) {
|
|
5420
|
+
const hasListRoute = this.hasRoute('route', 'list');
|
|
5421
|
+
if (!hasListRoute || force) {
|
|
5422
|
+
const listRoute = new Route('route', 'list', {
|
|
5423
|
+
description: '列出当前应用下的所有的路由信息',
|
|
5424
|
+
run: async (ctx) => {
|
|
5425
|
+
const list = this.getList();
|
|
5426
|
+
ctx.body = list;
|
|
5427
|
+
},
|
|
5428
|
+
});
|
|
5429
|
+
this.add(listRoute);
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5419
5432
|
/**
|
|
5420
5433
|
* 等待程序运行, 获取到message的数据,就执行
|
|
5421
5434
|
*
|
|
@@ -5425,6 +5438,10 @@ class QueryRouter {
|
|
|
5425
5438
|
* -- .send
|
|
5426
5439
|
*/
|
|
5427
5440
|
wait(params, opts) {
|
|
5441
|
+
const getList = opts?.getList ?? true;
|
|
5442
|
+
if (getList) {
|
|
5443
|
+
this.createRouteList();
|
|
5444
|
+
}
|
|
5428
5445
|
return listenProcess({ app: this, params, ...opts });
|
|
5429
5446
|
}
|
|
5430
5447
|
}
|
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.33",
|
|
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
|
}
|