chore(toolchain): upgrade Bun to 1.4.4 and migrate console to TanStack Router
This commit is contained in:
1 parent
b44ebc2ba1
commit
3b9376c75a
134 files changed
+893
-692
No files matched your search
@@ -12,16 +12,18 @@ import {
|
||||
} from "./nav.ts";
|
||||
import { recordPath, taskPath } from "./record-sheet.tsx";
|
||||
|
||||
/** routes.ts 里登记的控制台路由(相对 /console) */
|
||||
/** TanStack 路由表里登记的控制台路由(相对 /console) */
|
||||
const ROUTE_PATTERNS = [
|
||||
"",
|
||||
...[...readFileSync(new URL("../../routes.ts", import.meta.url), "utf8").matchAll(/route\("([^"*]+)",/g)].map(
|
||||
"agent",
|
||||
"agent/$runId",
|
||||
...[...readFileSync(new URL("../../router.tsx", import.meta.url), "utf8").matchAll(/page\("([^"*]+)",/g)].map(
|
||||
(m) => m[1] as string,
|
||||
),
|
||||
];
|
||||
const matchesRoute = (pathname: string) => {
|
||||
const rest = pathname.replace(/^\/console\/?/, "");
|
||||
return ROUTE_PATTERNS.some((p) => new RegExp(`^${p.replace(/:[^/]+/g, "[^/]+")}$`).test(rest));
|
||||
return ROUTE_PATTERNS.some((p) => new RegExp(`^${p.replace(/\$[^/]+/g, "[^/]+")}$`).test(rest));
|
||||
};
|
||||
|
||||
describe("控制台导航", () => {
|
||||
|
||||
Reference in new issue
Block a user