This commit is contained in:
2025-12-26 19:25:14 +08:00
parent a76f1fb5d2
commit 6e659fd278
2 changed files with 9 additions and 9 deletions

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.49", "version": "0.0.50",
"description": "", "description": "",
"type": "module", "type": "module",
"main": "./dist/router.js", "main": "./dist/router.js",
@@ -20,10 +20,10 @@
"keywords": [], "keywords": [],
"author": "abearxiong", "author": "abearxiong",
"license": "MIT", "license": "MIT",
"packageManager": "pnpm@10.26.0", "packageManager": "pnpm@10.26.2",
"devDependencies": { "devDependencies": {
"@kevisual/local-proxy": "^0.0.8", "@kevisual/local-proxy": "^0.0.8",
"@kevisual/query": "^0.0.32", "@kevisual/query": "^0.0.33",
"@rollup/plugin-alias": "^6.0.0", "@rollup/plugin-alias": "^6.0.0",
"@rollup/plugin-commonjs": "29.0.0", "@rollup/plugin-commonjs": "29.0.0",
"@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-node-resolve": "^16.0.3",
@@ -35,7 +35,7 @@
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"cookie": "^1.1.1", "cookie": "^1.1.1",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"rollup": "^4.53.5", "rollup": "^4.54.0",
"rollup-plugin-dts": "^6.3.0", "rollup-plugin-dts": "^6.3.0",
"ts-loader": "^9.5.4", "ts-loader": "^9.5.4",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
@@ -52,7 +52,7 @@
}, },
"dependencies": { "dependencies": {
"path-to-regexp": "^8.3.0", "path-to-regexp": "^8.3.0",
"selfsigned": "^5.2.0", "selfsigned": "^5.4.0",
"send": "^1.2.1" "send": "^1.2.1"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -555,13 +555,13 @@ 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);
} }
createRouteList(force: boolean = false) { createRouteList(force: boolean = false, filter?: (route: Route) => boolean) {
const hasListRoute = this.hasRoute('route', 'list'); const hasListRoute = this.hasRoute('router', 'list');
if (!hasListRoute || force) { if (!hasListRoute || force) {
const listRoute = new Route('route', 'list', { const listRoute = new Route('router', 'list', {
description: '列出当前应用下的所有的路由信息', description: '列出当前应用下的所有的路由信息',
run: async (ctx: RouteContext) => { run: async (ctx: RouteContext) => {
const list = this.getList(); const list = this.getList(filter);
ctx.body = list; ctx.body = list;
}, },
}); });