chore: bump version to 0.0.51 and enhance createQueryByRoutes to support dynamic queryApi export

This commit is contained in:
2026-02-24 21:44:57 +08:00
parent 7109fddae4
commit 026d6733da
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@kevisual/query", "name": "@kevisual/query",
"version": "0.0.50", "version": "0.0.51",
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "npm run clean && bun run bun.config.ts", "build": "npm run clean && bun run bun.config.ts",

View File

@@ -67,7 +67,8 @@ export const createQueryByRoutes = (list: RouteInfo[], options?: CreateQueryOpti
obj[route.path][route.key] = route; obj[route.path][route.key] = route;
} }
const before = options?.before || `import { createQueryApi } from '@kevisual/query/api';`; const before = options?.before || `import { createQueryApi } from '@kevisual/query/api';`;
const after = options?.after || `export { queryApi };`; const after = options?.after || `const queryApi = createQueryApi({ api });
export { queryApi };`;
const code = `${before} const code = `${before}
const api = ${generateApiCode(obj)} as const; const api = ${generateApiCode(obj)} as const;
const queryApi = createQueryApi({ api }); const queryApi = createQueryApi({ api });