@dudousxd/nestjs-inertia-codegen 2.0.0 → 2.0.1
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/CHANGELOG.md +9 -0
- package/dist/cli/main.cjs +5 -10
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +5 -10
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +5 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog — @dudousxd/nestjs-inertia-codegen
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(codegen): remove @tanstack/query-core dependency — generated api.ts uses plain object literals
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @dudousxd/nestjs-inertia@2.0.1
|
|
11
|
+
|
|
3
12
|
## 2.0.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/cli/main.cjs
CHANGED
|
@@ -325,11 +325,10 @@ function emitApiObjectBlock(tree, indent) {
|
|
|
325
325
|
const typeAccess = buildRouterTypeAccess(c.name);
|
|
326
326
|
lines.push(`${pad}${objKey}: {`);
|
|
327
327
|
lines.push(`${pad} queryKey: (query?: ${typeAccess}['query']) => query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
|
|
328
|
-
lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query'])
|
|
329
|
-
lines.push(`${pad}
|
|
330
|
-
lines.push(`${pad}
|
|
331
|
-
lines.push(`${pad}
|
|
332
|
-
lines.push(`${pad} }),`);
|
|
328
|
+
lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) => ({`);
|
|
329
|
+
lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
|
|
330
|
+
lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
|
|
331
|
+
lines.push(`${pad} }),`);
|
|
333
332
|
lines.push(`${pad}},`);
|
|
334
333
|
} else {
|
|
335
334
|
const typeAccess = buildRouterTypeAccess(c.name);
|
|
@@ -356,14 +355,10 @@ function buildRouterTypeAccess(name) {
|
|
|
356
355
|
__name(buildRouterTypeAccess, "buildRouterTypeAccess");
|
|
357
356
|
function buildApiFile(routes) {
|
|
358
357
|
const contracted = routes.filter((r) => r.contract);
|
|
359
|
-
const hasGetRoutes = contracted.some((r) => r.method === "GET");
|
|
360
358
|
const lines = [
|
|
361
359
|
"// Generated by @dudousxd/nestjs-inertia-codegen. Do not edit.",
|
|
362
360
|
""
|
|
363
361
|
];
|
|
364
|
-
if (hasGetRoutes) {
|
|
365
|
-
lines.push("import { queryOptions } from '@tanstack/query-core';");
|
|
366
|
-
}
|
|
367
362
|
lines.push("import { route } from './routes.js';");
|
|
368
363
|
lines.push("import { createFetcher } from '@dudousxd/nestjs-inertia-client';");
|
|
369
364
|
lines.push("");
|
|
@@ -1434,7 +1429,7 @@ async function watch(config, onChange) {
|
|
|
1434
1429
|
__name(watch, "watch");
|
|
1435
1430
|
|
|
1436
1431
|
// src/index.ts
|
|
1437
|
-
var VERSION = "2.0.
|
|
1432
|
+
var VERSION = "2.0.1";
|
|
1438
1433
|
|
|
1439
1434
|
// src/cli/codegen.ts
|
|
1440
1435
|
async function runCodegen(opts = {}) {
|