litestar-vite-plugin 0.15.0-rc.1 → 0.15.0-rc.3

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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Base types for Inertia.js type generation.
3
+ *
4
+ * These types are generated by `litestar assets generate-types` in your
5
+ * project's `generated/page-props.ts` file. This module provides fallback
6
+ * types for when the generated file hasn't been created yet.
7
+ *
8
+ * To customize types, edit your project's `generated/page-props.user.ts` file.
9
+ */
10
+ /** User interface - customize in page-props.user.ts */
11
+ export interface User {
12
+ }
13
+ /** Authentication data interface */
14
+ export interface AuthData {
15
+ }
16
+ /** Flash messages interface */
17
+ export interface FlashMessages {
18
+ }
19
+ /** User-defined shared props - customize in page-props.user.ts */
20
+ export interface SharedProps {
21
+ }
22
+ /** Generated shared props (populated by page-props.ts) */
23
+ export interface GeneratedSharedProps {
24
+ }
25
+ /** Full shared props = generated + user-defined */
26
+ export type FullSharedProps = GeneratedSharedProps & SharedProps & {
27
+ [key: string]: unknown;
28
+ };
29
+ /** Page props mapped by component name (populated by page-props.ts) */
30
+ export interface PageProps {
31
+ }
32
+ /** Component name union type */
33
+ export type ComponentName = keyof PageProps;
34
+ /** Type-safe props for a specific component */
35
+ export type InertiaPageProps<C extends ComponentName> = PageProps[C];
36
+ /** Get props type for a specific page component */
37
+ export type PagePropsFor<C extends ComponentName> = PageProps[C];
File without changes
@@ -1,7 +1,12 @@
1
+ /**
2
+ * Detect the executor from .litestar.json or environment.
3
+ * Priority: LITESTAR_VITE_RUNTIME env > .litestar.json executor > lockfile detection > 'node'
4
+ */
5
+ export declare function detectExecutor(): string;
1
6
  export declare function resolveInstallHint(pkg?: string): string;
2
7
  /**
3
8
  * Resolves the package executor command based on runtime.
4
- * Priority: explicit executor > LITESTAR_VITE_RUNTIME env > 'node' default
9
+ * Priority: explicit executor > .litestar.json > LITESTAR_VITE_RUNTIME env > lockfile detection > 'npx'
5
10
  *
6
11
  * @param pkg - The package command to execute (e.g., "@hey-api/openapi-ts -i schema.json -o src/types")
7
12
  * @param executor - Optional explicit executor override
@@ -1,5 +1,37 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ function detectExecutor() {
4
+ const envRuntime = (process.env.LITESTAR_VITE_RUNTIME ?? "").toLowerCase();
5
+ if (envRuntime) return envRuntime;
6
+ const configPath = process.env.LITESTAR_VITE_CONFIG_PATH ?? path.resolve(process.cwd(), ".litestar.json");
7
+ if (fs.existsSync(configPath)) {
8
+ try {
9
+ const raw = fs.readFileSync(configPath, "utf8");
10
+ const data = JSON.parse(raw);
11
+ const executor = data?.executor;
12
+ if (typeof executor === "string" && executor.trim()) {
13
+ return executor.trim().toLowerCase();
14
+ }
15
+ } catch {
16
+ }
17
+ }
18
+ const cwd = process.cwd();
19
+ if (fs.existsSync(path.join(cwd, "bun.lockb")) || fs.existsSync(path.join(cwd, "bun.lock"))) {
20
+ return "bun";
21
+ }
22
+ if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
23
+ return "pnpm";
24
+ }
25
+ if (fs.existsSync(path.join(cwd, "yarn.lock"))) {
26
+ return "yarn";
27
+ }
28
+ if (fs.existsSync(path.join(cwd, "deno.lock"))) {
29
+ return "deno";
30
+ }
31
+ return "node";
32
+ }
1
33
  function resolveInstallHint(pkg = "@hey-api/openapi-ts") {
2
- const runtime = (process.env.LITESTAR_VITE_RUNTIME ?? "").toLowerCase();
34
+ const runtime = detectExecutor();
3
35
  switch (runtime) {
4
36
  case "bun":
5
37
  return `bun add -d ${pkg}`;
@@ -17,7 +49,7 @@ function resolveInstallHint(pkg = "@hey-api/openapi-ts") {
17
49
  return `npm install -D ${pkg}`;
18
50
  }
19
51
  function resolvePackageExecutor(pkg, executor) {
20
- const runtime = (executor ?? process.env.LITESTAR_VITE_RUNTIME ?? "").toLowerCase();
52
+ const runtime = executor || detectExecutor();
21
53
  switch (runtime) {
22
54
  case "bun":
23
55
  return `bunx ${pkg}`;
@@ -32,6 +64,7 @@ function resolvePackageExecutor(pkg, executor) {
32
64
  }
33
65
  }
34
66
  export {
67
+ detectExecutor,
35
68
  resolveInstallHint,
36
69
  resolvePackageExecutor
37
70
  };
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- export type BridgeMode = "spa" | "template" | "htmx" | "hybrid" | "inertia" | "ssr" | "ssg" | "external";
11
+ export type BridgeMode = "spa" | "template" | "htmx" | "hybrid" | "inertia" | "framework" | "ssr" | "ssg" | "external";
12
12
  export type BridgeProxyMode = "vite" | "direct" | "proxy" | null;
13
13
  export type BridgeExecutor = "node" | "bun" | "deno" | "yarn" | "pnpm";
14
14
  export interface BridgeTypesConfig {
@@ -23,8 +23,13 @@ export interface BridgeTypesConfig {
23
23
  generatePageProps: boolean;
24
24
  globalRoute: boolean;
25
25
  }
26
+ export interface BridgeSpaConfig {
27
+ /** Use script element instead of data-page attribute for Inertia page data */
28
+ useScriptElement: boolean;
29
+ }
26
30
  export interface BridgeSchema {
27
31
  assetUrl: string;
32
+ deployAssetUrl: string | null;
28
33
  bundleDir: string;
29
34
  resourceDir: string;
30
35
  staticDir: string;
@@ -34,9 +39,9 @@ export interface BridgeSchema {
34
39
  proxyMode: BridgeProxyMode;
35
40
  host: string;
36
41
  port: number;
37
- ssrEnabled: boolean;
38
42
  ssrOutDir: string | null;
39
43
  types: BridgeTypesConfig | null;
44
+ spa: BridgeSpaConfig | null;
40
45
  executor: BridgeExecutor;
41
46
  logging: {
42
47
  level: "quiet" | "normal" | "verbose";
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  const allowedTopLevelKeys = /* @__PURE__ */ new Set([
4
4
  "assetUrl",
5
+ "deployAssetUrl",
5
6
  "bundleDir",
6
7
  "resourceDir",
7
8
  "staticDir",
@@ -11,14 +12,14 @@ const allowedTopLevelKeys = /* @__PURE__ */ new Set([
11
12
  "proxyMode",
12
13
  "host",
13
14
  "port",
14
- "ssrEnabled",
15
15
  "ssrOutDir",
16
16
  "types",
17
+ "spa",
17
18
  "executor",
18
19
  "logging",
19
20
  "litestarVersion"
20
21
  ]);
21
- const allowedModes = /* @__PURE__ */ new Set(["spa", "template", "htmx", "hybrid", "inertia", "ssr", "ssg", "external"]);
22
+ const allowedModes = /* @__PURE__ */ new Set(["spa", "template", "htmx", "hybrid", "inertia", "framework", "ssr", "ssg", "external"]);
22
23
  const allowedProxyModes = /* @__PURE__ */ new Set(["vite", "direct", "proxy"]);
23
24
  const allowedExecutors = /* @__PURE__ */ new Set(["node", "bun", "deno", "yarn", "pnpm"]);
24
25
  const allowedLogLevels = /* @__PURE__ */ new Set(["quiet", "normal", "verbose"]);
@@ -106,6 +107,12 @@ function parseLogging(value) {
106
107
  const timestamps = assertBoolean(obj, "timestamps");
107
108
  return { level, showPathsAbsolute, suppressNpmOutput, suppressViteBanner, timestamps };
108
109
  }
110
+ function parseSpaConfig(value) {
111
+ if (value === null || value === void 0) return null;
112
+ const obj = assertObject(value, "spa");
113
+ const useScriptElement = assertBoolean(obj, "useScriptElement");
114
+ return { useScriptElement };
115
+ }
109
116
  function parseBridgeSchema(value) {
110
117
  const obj = assertObject(value, "root");
111
118
  for (const key of Object.keys(obj)) {
@@ -114,6 +121,7 @@ function parseBridgeSchema(value) {
114
121
  }
115
122
  }
116
123
  const assetUrl = assertString(obj, "assetUrl");
124
+ const deployAssetUrl = assertNullableString(obj, "deployAssetUrl");
117
125
  const bundleDir = assertString(obj, "bundleDir");
118
126
  const resourceDir = assertString(obj, "resourceDir");
119
127
  const staticDir = assertString(obj, "staticDir");
@@ -123,14 +131,15 @@ function parseBridgeSchema(value) {
123
131
  const proxyMode = assertProxyMode(obj.proxyMode);
124
132
  const host = assertString(obj, "host");
125
133
  const port = assertNumber(obj, "port");
126
- const ssrEnabled = assertBoolean(obj, "ssrEnabled");
127
134
  const ssrOutDir = assertNullableString(obj, "ssrOutDir");
128
135
  const types = parseTypesConfig(obj.types);
136
+ const spa = parseSpaConfig(obj.spa);
129
137
  const executor = assertEnum(obj.executor, "executor", allowedExecutors);
130
138
  const logging = parseLogging(obj.logging);
131
139
  const litestarVersion = assertString(obj, "litestarVersion");
132
140
  return {
133
141
  assetUrl,
142
+ deployAssetUrl,
134
143
  bundleDir,
135
144
  resourceDir,
136
145
  staticDir,
@@ -140,9 +149,9 @@ function parseBridgeSchema(value) {
140
149
  proxyMode,
141
150
  host,
142
151
  port,
143
- ssrEnabled,
144
152
  ssrOutDir,
145
153
  types,
154
+ spa,
146
155
  executor,
147
156
  logging,
148
157
  litestarVersion
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Generate `page-props.ts` from `inertia-pages.json` metadata.
3
+ *
4
+ * @returns true if file was changed, false if unchanged
3
5
  */
4
- export declare function emitPagePropsTypes(pagesPath: string, outputDir: string): Promise<void>;
6
+ export declare function emitPagePropsTypes(pagesPath: string, outputDir: string): Promise<boolean>;
@@ -1,5 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import { writeIfChanged } from "./write-if-changed.js";
3
4
  async function emitPagePropsTypes(pagesPath, outputDir) {
4
5
  const contents = await fs.promises.readFile(pagesPath, "utf-8");
5
6
  const json = JSON.parse(contents);
@@ -16,18 +17,9 @@ async function emitPagePropsTypes(pagesPath, outputDir) {
16
17
  if (includeDefaultAuth) {
17
18
  userTypes = `/**
18
19
  * Default User interface - minimal baseline for common auth patterns.
19
- * Users extend this via module augmentation with their full user model.
20
- *
21
- * @example
22
- * declare module 'litestar-vite-plugin/inertia' {
23
- * interface User {
24
- * avatarUrl?: string | null
25
- * roles: Role[]
26
- * teams: Team[]
27
- * }
28
- * }
20
+ * Extend by adding properties to UserExtensions in page-props.user.ts
29
21
  */
30
- export interface User {
22
+ export interface User extends UserExtensions {
31
23
  id: string
32
24
  email: string
33
25
  name?: string | null
@@ -46,23 +38,13 @@ export interface AuthData {
46
38
  `;
47
39
  } else {
48
40
  userTypes = `/**
49
- * User interface - define via module augmentation.
50
- * Default auth types are disabled.
51
- *
52
- * @example
53
- * declare module 'litestar-vite-plugin/inertia' {
54
- * interface User {
55
- * uuid: string
56
- * username: string
57
- * }
58
- * }
41
+ * User interface - add properties to UserExtensions in page-props.user.ts
59
42
  */
60
- export interface User {}
43
+ export interface User extends UserExtensions {}
61
44
 
62
45
  `;
63
46
  authTypes = `/**
64
- * AuthData interface - define via module augmentation.
65
- * Default auth types are disabled.
47
+ * AuthData interface - define your auth structure here or in page-props.user.ts
66
48
  */
67
49
  export interface AuthData {}
68
50
 
@@ -163,7 +145,7 @@ export interface FlashMessages {}
163
145
  const availableApiTypes = /* @__PURE__ */ new Set();
164
146
  if (fs.existsSync(apiTypesPath)) {
165
147
  const content = await fs.promises.readFile(apiTypesPath, "utf-8");
166
- for (const match of content.matchAll(/export (?:type|interface|enum|class) (\\w+)/g)) {
148
+ for (const match of content.matchAll(/export (?:type|interface|enum|class) (\w+)/g)) {
167
149
  if (match[1]) {
168
150
  availableApiTypes.add(match[1]);
169
151
  }
@@ -184,7 +166,13 @@ export interface FlashMessages {}
184
166
  }
185
167
  }
186
168
  if (unresolvedTypes.length > 0) {
187
- console.warn(`litestar-vite: unresolved Inertia props types: ${unresolvedTypes.join(", ")}. Add them to TypeGenConfig.type_import_paths or include them in OpenAPI.`);
169
+ console.warn(
170
+ `litestar-vite: Unresolved Inertia props types: ${unresolvedTypes.join(", ")}.
171
+ To fix:
172
+ 1. Add to OpenAPI by including in route return types
173
+ 2. Or configure TypeGenConfig.type_import_paths:
174
+ types=TypeGenConfig(type_import_paths={"${unresolvedTypes[0]}": "@/types/custom"})`
175
+ );
188
176
  }
189
177
  let importStatement = "";
190
178
  if (apiImports.length > 0) {
@@ -211,6 +199,9 @@ export interface FlashMessages {}
211
199
  const body = `// AUTO-GENERATED by litestar-vite. Do not edit.
212
200
  /* eslint-disable */
213
201
 
202
+ // Import user-defined type extensions (edit page-props.user.ts to customize)
203
+ import type { UserExtensions, SharedPropsExtensions } from "./page-props.user"
204
+
214
205
  ${importStatement}${userTypes}${authTypes}${flashTypes}/**
215
206
  * Generated shared props (always present).
216
207
  * Includes built-in props + static config props.
@@ -221,26 +212,13 @@ ${generatedSharedPropLines.join("\n")}
221
212
 
222
213
  /**
223
214
  * User-defined shared props for dynamic share() calls in guards/middleware.
224
- * Extend this interface via module augmentation.
225
- *
226
- * @example
227
- * declare module 'litestar-vite-plugin/inertia' {
228
- * interface User {
229
- * avatarUrl?: string | null
230
- * roles: Role[]
231
- * teams: Team[]
232
- * }
233
- * interface SharedProps {
234
- * locale?: string
235
- * currentTeam?: CurrentTeam
236
- * }
237
- * }
215
+ * Extend by adding properties to SharedPropsExtensions in page-props.user.ts
238
216
  */
239
- export interface SharedProps {
240
- }
217
+ export type SharedProps = SharedPropsExtensions
241
218
 
242
- /** Full shared props = generated + user-defined */
243
- export type FullSharedProps = GeneratedSharedProps & SharedProps
219
+ /** Full shared props = generated + user-defined.
220
+ * Includes index signature for compatibility with Inertia's usePage<T>(). */
221
+ export type FullSharedProps = GeneratedSharedProps & SharedProps & { [key: string]: unknown }
244
222
 
245
223
  /** Page props mapped by component name */
246
224
  export interface PageProps {
@@ -255,13 +233,57 @@ export type InertiaPageProps<C extends ComponentName> = PageProps[C]
255
233
 
256
234
  /** Get props type for a specific page component */
257
235
  export type PagePropsFor<C extends ComponentName> = PageProps[C]
236
+ `;
237
+ const result = await writeIfChanged(outFile, body, { encoding: "utf-8" });
238
+ const userStubFile = path.join(outDir, "page-props.user.ts");
239
+ if (!fs.existsSync(userStubFile)) {
240
+ const userStub = `/**
241
+ * User-defined type extensions for Inertia page props.
242
+ * This file is generated ONCE and never overwritten - edit freely!
243
+ *
244
+ * Add properties to these interfaces to extend the generated types.
245
+ * The main page-props.ts file imports and uses these extensions.
246
+ */
247
+
248
+ /**
249
+ * Extend the User interface with additional properties.
250
+ *
251
+ * @example
252
+ * export interface UserExtensions {
253
+ * avatarUrl?: string | null
254
+ * roles: string[]
255
+ * teams: Team[]
256
+ * }
257
+ */
258
+ export interface UserExtensions {
259
+ // Add your custom User properties here
260
+ }
258
261
 
259
- // Re-export for module augmentation
260
- declare module "litestar-vite-plugin/inertia" {
261
- export { User, AuthData, FlashMessages, SharedProps, GeneratedSharedProps, FullSharedProps, PageProps, ComponentName, InertiaPageProps, PagePropsFor }
262
+ /**
263
+ * Extend SharedProps with session-based or dynamic properties.
264
+ *
265
+ * @example
266
+ * export interface SharedPropsExtensions {
267
+ * locale?: string
268
+ * currentTeam?: {
269
+ * teamId: string
270
+ * teamName: string
271
+ * }
272
+ * }
273
+ */
274
+ export interface SharedPropsExtensions {
275
+ // Add your custom shared props here
262
276
  }
277
+
278
+ // Export custom types that can be used in page props
279
+ // export interface CurrentTeam {
280
+ // teamId: string
281
+ // teamName: string
282
+ // }
263
283
  `;
264
- await fs.promises.writeFile(outFile, body, "utf-8");
284
+ await fs.promises.writeFile(userStubFile, userStub, "utf-8");
285
+ }
286
+ return result.changed;
265
287
  }
266
288
  export {
267
289
  emitPagePropsTypes
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Check if openapi-ts should run based on input cache.
3
+ *
4
+ * @param openapiPath - Path to openapi.json
5
+ * @param configPath - Path to config file (or null)
6
+ * @param options - Generator options
7
+ * @returns true if generation should run, false if cached
8
+ */
9
+ export declare function shouldRunOpenApiTs(openapiPath: string, configPath: string | null, options: {
10
+ generateSdk: boolean;
11
+ generateZod: boolean;
12
+ plugins: string[];
13
+ }): Promise<boolean>;
14
+ /**
15
+ * Update cache after successful openapi-ts run.
16
+ *
17
+ * @param openapiPath - Path to openapi.json
18
+ * @param configPath - Path to config file (or null)
19
+ * @param options - Generator options
20
+ */
21
+ export declare function updateOpenApiTsCache(openapiPath: string, configPath: string | null, options: {
22
+ generateSdk: boolean;
23
+ generateZod: boolean;
24
+ plugins: string[];
25
+ }): Promise<void>;
26
+ /**
27
+ * Compute input hash for page props generation.
28
+ *
29
+ * @param pagePropsPath - Path to inertia-pages.json
30
+ * @returns Hash of the input file
31
+ */
32
+ export declare function computePagePropsHash(pagePropsPath: string): Promise<string>;
33
+ /**
34
+ * Check if page props types should be regenerated.
35
+ *
36
+ * @param pagePropsPath - Path to inertia-pages.json
37
+ * @returns true if generation should run, false if cached
38
+ */
39
+ export declare function shouldRegeneratePageProps(pagePropsPath: string): Promise<boolean>;
40
+ /**
41
+ * Update cache after successful page props generation.
42
+ *
43
+ * @param pagePropsPath - Path to inertia-pages.json
44
+ */
45
+ export declare function updatePagePropsCache(pagePropsPath: string): Promise<void>;
@@ -0,0 +1,83 @@
1
+ import crypto from "node:crypto";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ const CACHE_DIR = "node_modules/.cache/litestar-vite";
5
+ const CACHE_FILE = "typegen-cache.json";
6
+ async function loadCache() {
7
+ const cacheFilePath = path.join(CACHE_DIR, CACHE_FILE);
8
+ try {
9
+ const content = await fs.promises.readFile(cacheFilePath, "utf-8");
10
+ return JSON.parse(content);
11
+ } catch {
12
+ return {};
13
+ }
14
+ }
15
+ async function saveCache(cache) {
16
+ const cacheFilePath = path.join(CACHE_DIR, CACHE_FILE);
17
+ await fs.promises.mkdir(CACHE_DIR, { recursive: true });
18
+ await fs.promises.writeFile(cacheFilePath, JSON.stringify(cache, null, 2), "utf-8");
19
+ }
20
+ async function hashFile(filePath) {
21
+ try {
22
+ const content = await fs.promises.readFile(filePath);
23
+ return crypto.createHash("sha256").update(content).digest("hex");
24
+ } catch {
25
+ return "";
26
+ }
27
+ }
28
+ function hashObject(obj) {
29
+ const sorted = JSON.stringify(obj, Object.keys(obj).sort());
30
+ return crypto.createHash("sha256").update(sorted).digest("hex");
31
+ }
32
+ async function shouldRunOpenApiTs(openapiPath, configPath, options) {
33
+ const cache = await loadCache();
34
+ const inputHash = await hashFile(openapiPath);
35
+ const configHash = configPath ? await hashFile(configPath) : "";
36
+ const optionsHash = hashObject(options);
37
+ const cacheKey = "openapi-ts";
38
+ const entry = cache[cacheKey];
39
+ if (entry && entry.inputHash === inputHash && entry.configHash === configHash && entry.optionsHash === optionsHash) {
40
+ return false;
41
+ }
42
+ return true;
43
+ }
44
+ async function updateOpenApiTsCache(openapiPath, configPath, options) {
45
+ const cache = await loadCache();
46
+ cache["openapi-ts"] = {
47
+ inputHash: await hashFile(openapiPath),
48
+ configHash: configPath ? await hashFile(configPath) : "",
49
+ optionsHash: hashObject(options),
50
+ timestamp: Date.now()
51
+ };
52
+ await saveCache(cache);
53
+ }
54
+ async function computePagePropsHash(pagePropsPath) {
55
+ return hashFile(pagePropsPath);
56
+ }
57
+ async function shouldRegeneratePageProps(pagePropsPath) {
58
+ const cache = await loadCache();
59
+ const currentHash = await hashFile(pagePropsPath);
60
+ const cacheKey = "page-props";
61
+ const entry = cache[cacheKey];
62
+ if (entry && entry.inputHash === currentHash) {
63
+ return false;
64
+ }
65
+ return true;
66
+ }
67
+ async function updatePagePropsCache(pagePropsPath) {
68
+ const cache = await loadCache();
69
+ cache["page-props"] = {
70
+ inputHash: await hashFile(pagePropsPath),
71
+ configHash: "",
72
+ optionsHash: "",
73
+ timestamp: Date.now()
74
+ };
75
+ await saveCache(cache);
76
+ }
77
+ export {
78
+ computePagePropsHash,
79
+ shouldRegeneratePageProps,
80
+ shouldRunOpenApiTs,
81
+ updateOpenApiTsCache,
82
+ updatePagePropsCache
83
+ };
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Configuration for type generation.
3
+ */
4
+ export interface TypeGenCoreConfig {
5
+ /** Project root directory */
6
+ projectRoot: string;
7
+ /** Path to openapi.json (relative or absolute) */
8
+ openapiPath: string;
9
+ /** Output directory for generated files */
10
+ output: string;
11
+ /** Path to inertia-pages.json (relative or absolute) */
12
+ pagePropsPath: string;
13
+ /** Whether to generate SDK client */
14
+ generateSdk: boolean;
15
+ /** Whether to generate Zod schemas */
16
+ generateZod: boolean;
17
+ /** Whether to generate page props types */
18
+ generatePageProps: boolean;
19
+ /** SDK client plugin (e.g., "@hey-api/client-fetch") */
20
+ sdkClientPlugin: string;
21
+ /** JS runtime executor (e.g., "bun", "pnpm") */
22
+ executor?: string;
23
+ }
24
+ /**
25
+ * Result of type generation.
26
+ */
27
+ export interface TypeGenResult {
28
+ /** Whether any files were generated */
29
+ generated: boolean;
30
+ /** Files that were generated/updated */
31
+ generatedFiles: string[];
32
+ /** Files that were skipped (unchanged) */
33
+ skippedFiles: string[];
34
+ /** Total duration in milliseconds */
35
+ durationMs: number;
36
+ /** Any warnings to report */
37
+ warnings: string[];
38
+ /** Any errors encountered */
39
+ errors: string[];
40
+ }
41
+ /**
42
+ * Logger interface for type generation.
43
+ * Allows callers to inject their own logging behavior.
44
+ */
45
+ export interface TypeGenLogger {
46
+ info(message: string): void;
47
+ warn(message: string): void;
48
+ error(message: string): void;
49
+ }
50
+ /**
51
+ * Options for running type generation.
52
+ */
53
+ export interface RunTypeGenOptions {
54
+ /** Logger for output (optional - silent if not provided) */
55
+ logger?: TypeGenLogger;
56
+ }
57
+ /**
58
+ * Find user's openapi-ts config file.
59
+ */
60
+ export declare function findOpenApiTsConfig(projectRoot: string): string | null;
61
+ /**
62
+ * Build the list of plugins for @hey-api/openapi-ts.
63
+ */
64
+ export declare function buildHeyApiPlugins(config: {
65
+ generateSdk: boolean;
66
+ generateZod: boolean;
67
+ sdkClientPlugin: string;
68
+ }): string[];
69
+ /**
70
+ * Run @hey-api/openapi-ts to generate TypeScript types from OpenAPI spec.
71
+ *
72
+ * @param config - Type generation configuration
73
+ * @param configPath - Path to user's openapi-ts config (or null for default)
74
+ * @param plugins - List of plugins to use
75
+ * @param logger - Optional logger for output
76
+ * @returns Path to output directory
77
+ */
78
+ export declare function runHeyApiGeneration(config: TypeGenCoreConfig, configPath: string | null, plugins: string[], logger?: TypeGenLogger): Promise<string>;
79
+ /**
80
+ * Run the complete type generation pipeline.
81
+ *
82
+ * This is the main entry point for type generation, handling:
83
+ * - OpenAPI type generation via @hey-api/openapi-ts
84
+ * - Page props type generation
85
+ *
86
+ * @param config - Type generation configuration
87
+ * @param options - Runtime options (logger, etc.)
88
+ * @returns Result with generated files and timing info
89
+ */
90
+ export declare function runTypeGeneration(config: TypeGenCoreConfig, options?: RunTypeGenOptions): Promise<TypeGenResult>;