litestar-vite-plugin 0.28.0 → 0.29.0

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.
@@ -27,7 +27,8 @@
27
27
  *
28
28
  * @module
29
29
  */
30
- import { DEFAULT_CSRF_HEADER_NAME, getCsrfToken } from "./csrf.js";
30
+ import { getCsrfHeaderName, getCsrfToken } from "./csrf.js";
31
+ import { compileExpression } from "./expression.js";
31
32
  function getHeadersFromConfigRequestEvent(evt) {
32
33
  const detail = evt.detail;
33
34
  if (!detail || typeof detail !== "object")
@@ -80,12 +81,13 @@ export function registerHtmxExtension() {
80
81
  onEvent(name, evt) {
81
82
  if (name === "htmx:configRequest") {
82
83
  const token = getCsrfToken();
84
+ const headerName = getCsrfHeaderName();
83
85
  const headers = getHeadersFromConfigRequestEvent(evt);
84
86
  if (token && headers) {
85
87
  if (headers instanceof Headers)
86
- headers.set(DEFAULT_CSRF_HEADER_NAME, token);
88
+ headers.set(headerName, token);
87
89
  else
88
- headers[DEFAULT_CSRF_HEADER_NAME] = token;
90
+ headers[headerName] = token;
89
91
  }
90
92
  }
91
93
  return true;
@@ -194,6 +196,28 @@ function swapKids(start, end, ctx, parse = false) {
194
196
  current = (r ?? current).nextSibling;
195
197
  }
196
198
  }
199
+ function wrapEvent(event) {
200
+ const eventTarget = event.target;
201
+ let target = null;
202
+ if (eventTarget instanceof HTMLInputElement || eventTarget instanceof HTMLSelectElement || eventTarget instanceof HTMLTextAreaElement) {
203
+ target = Object.freeze({
204
+ value: eventTarget.value,
205
+ name: eventTarget.name,
206
+ checked: eventTarget instanceof HTMLInputElement ? eventTarget.checked : false,
207
+ id: eventTarget.id,
208
+ type: eventTarget instanceof HTMLInputElement ? eventTarget.type : "",
209
+ });
210
+ }
211
+ else if (eventTarget instanceof Element) {
212
+ target = Object.freeze({ value: "", name: "", checked: false, id: eventTarget.id, type: "" });
213
+ }
214
+ return Object.freeze({
215
+ type: event.type,
216
+ target,
217
+ preventDefault: () => event.preventDefault(),
218
+ stopPropagation: () => event.stopPropagation(),
219
+ });
220
+ }
197
221
  const directives = [
198
222
  // :attr="expr" - attribute binding
199
223
  {
@@ -246,7 +270,7 @@ const directives = [
246
270
  if (!current)
247
271
  return;
248
272
  const eventCtx = Object.create(current);
249
- eventCtx.$event = e;
273
+ eventCtx.$event = wrapEvent(e);
250
274
  g(eventCtx);
251
275
  });
252
276
  };
@@ -458,131 +482,6 @@ function childCtx(parent, data, index, key) {
458
482
  // =============================================================================
459
483
  // Expression Compiler
460
484
  // =============================================================================
461
- /** Identifiers that must never appear as standalone words in expressions */
462
- const BLOCKED_GLOBALS = [
463
- "window",
464
- "document",
465
- "globalThis",
466
- "self",
467
- "top",
468
- "frames",
469
- "Function",
470
- "eval",
471
- "setTimeout",
472
- "setInterval",
473
- "constructor",
474
- "__proto__",
475
- "prototype",
476
- "import",
477
- "require",
478
- ];
479
- /** Build a single regex: matches any blocked word at a word boundary */
480
- const BLOCKED_RE = new RegExp(`\\b(${BLOCKED_GLOBALS.join("|")})\\b`);
481
- /** Strip string literals and template strings before checking for blocked patterns */
482
- function stripStrings(s) {
483
- return s
484
- .replace(/`(?:[^`\\]|\\.)*`/g, "") // template literals
485
- .replace(/"(?:[^"\\]|\\.)*"/g, "") // double-quoted strings
486
- .replace(/'(?:[^'\\]|\\.)*'/g, ""); // single-quoted strings
487
- }
488
- function readQuotedLiteral(s, start) {
489
- const quote = s[start];
490
- if (quote !== "'" && quote !== '"' && quote !== "`")
491
- return null;
492
- let value = "";
493
- for (let i = start + 1; i < s.length; i++) {
494
- const ch = s[i];
495
- if (ch === "\\") {
496
- if (i + 1 >= s.length)
497
- return null;
498
- const escaped = readEscapedCharacter(s, i + 1);
499
- if (!escaped)
500
- return null;
501
- value += escaped.value;
502
- i = escaped.end - 1;
503
- continue;
504
- }
505
- if (quote === "`" && ch === "$" && s[i + 1] === "{") {
506
- return null;
507
- }
508
- if (ch === quote) {
509
- return { end: i + 1, value };
510
- }
511
- value += ch;
512
- }
513
- return null;
514
- }
515
- function readEscapedCharacter(s, start) {
516
- const ch = s[start];
517
- if (ch === "u") {
518
- if (s[start + 1] === "{") {
519
- const close = s.indexOf("}", start + 2);
520
- if (close === -1)
521
- return null;
522
- const codePoint = Number.parseInt(s.slice(start + 2, close), 16);
523
- return Number.isFinite(codePoint) ? { end: close + 1, value: String.fromCodePoint(codePoint) } : null;
524
- }
525
- const codePoint = Number.parseInt(s.slice(start + 1, start + 5), 16);
526
- return Number.isFinite(codePoint) ? { end: start + 5, value: String.fromCharCode(codePoint) } : null;
527
- }
528
- if (ch === "x") {
529
- const codePoint = Number.parseInt(s.slice(start + 1, start + 3), 16);
530
- return Number.isFinite(codePoint) ? { end: start + 3, value: String.fromCharCode(codePoint) } : null;
531
- }
532
- const escapes = { b: "\b", f: "\f", n: "\n", r: "\r", t: "\t", v: "\v" };
533
- return { end: start + 1, value: escapes[ch] ?? ch };
534
- }
535
- function skipTrivia(s, start) {
536
- let i = start;
537
- while (i < s.length) {
538
- while (/\s/.test(s[i] ?? ""))
539
- i += 1;
540
- if (s[i] === "/" && s[i + 1] === "/") {
541
- i = s.indexOf("\n", i + 2);
542
- if (i === -1)
543
- return s.length;
544
- continue;
545
- }
546
- if (s[i] === "/" && s[i + 1] === "*") {
547
- const close = s.indexOf("*/", i + 2);
548
- if (close === -1)
549
- return s.length;
550
- i = close + 2;
551
- continue;
552
- }
553
- break;
554
- }
555
- return i;
556
- }
557
- function hasBlockedStringConcatenation(s) {
558
- for (let i = 0; i < s.length; i++) {
559
- const first = readQuotedLiteral(s, i);
560
- if (!first)
561
- continue;
562
- const parts = [first.value];
563
- let cursor = skipTrivia(s, first.end);
564
- while (s[cursor] === "+") {
565
- const nextStart = skipTrivia(s, cursor + 1);
566
- const next = readQuotedLiteral(s, nextStart);
567
- if (!next)
568
- break;
569
- parts.push(next.value);
570
- cursor = skipTrivia(s, next.end);
571
- }
572
- if (parts.length > 1 && BLOCKED_GLOBALS.includes(parts.join(""))) {
573
- return true;
574
- }
575
- i = first.end - 1;
576
- }
577
- return false;
578
- }
579
- function isExpressionSafe(s) {
580
- if (hasBlockedStringConcatenation(s)) {
581
- return false;
582
- }
583
- const stripped = stripStrings(s);
584
- return !BLOCKED_RE.test(stripped);
585
- }
586
485
  function expr(s) {
587
486
  if (!s)
588
487
  return null;
@@ -593,22 +492,16 @@ function expr(s) {
593
492
  expressionCache.set(s, cached);
594
493
  return cached;
595
494
  }
596
- if (!isExpressionSafe(s)) {
495
+ const compiled = compileExpression(s);
496
+ if (!compiled) {
597
497
  if (debug)
598
498
  console.warn(`[litestar] blocked expression: ${s}`);
599
499
  cacheExpression(s, null);
600
500
  return null;
601
501
  }
602
- try {
603
- // Expression validated by isExpressionSafe() above — dangerous globals/constructors blocked
604
- const fn = new Function("ctx", `with(ctx){return(${s})}`);
605
- cacheExpression(s, fn);
606
- return fn;
607
- }
608
- catch {
609
- cacheExpression(s, null);
610
- return null;
611
- }
502
+ const fn = (context) => compiled(context);
503
+ cacheExpression(s, fn);
504
+ return fn;
612
505
  }
613
506
  /** Compile text with ${expr} interpolation - escapes backticks and backslashes */
614
507
  function compileTextExpr(t) {
@@ -38,7 +38,7 @@
38
38
  *
39
39
  * @module
40
40
  */
41
- export { csrfFetch, csrfHeaders, getCsrfToken } from "./csrf.js";
41
+ export { csrfFetch, csrfHeaders, getCsrfHeaderName, getCsrfToken } from "./csrf.js";
42
42
  export { createChannelsStream, type ChannelName, type ChannelsStreamOptions } from "./channels.js";
43
43
  export { addDirective, registerHtmxExtension, setDebug as setHtmxDebug, swapJson } from "./htmx.js";
44
44
  export { createQueueEventStream, QUEUE_SSE_EVENTS, type QueueEventStreamOptions, type QueueStreamTarget, type QueueStreamValue } from "./queues.js";
@@ -39,7 +39,7 @@
39
39
  * @module
40
40
  */
41
41
  // CSRF utilities
42
- export { csrfFetch, csrfHeaders, getCsrfToken } from "./csrf.js";
42
+ export { csrfFetch, csrfHeaders, getCsrfHeaderName, getCsrfToken } from "./csrf.js";
43
43
  // Litestar Channels utilities
44
44
  export { createChannelsStream } from "./channels.js";
45
45
  // HTMX utilities
@@ -1,114 +1,12 @@
1
1
  import { type Config as FullReloadConfig } from "vite-plugin-full-reload";
2
+ import { type TypesConfigShape } from "./shared/typegen-plugin.js";
2
3
  /**
3
4
  * Configuration for TypeScript type generation.
4
5
  *
5
- * Type generation works as follows:
6
- * 1. Python's Litestar exports openapi.json and routes.json on startup (and reload)
7
- * 2. The Vite plugin watches these files for changes
8
- * 3. When they change, it runs @hey-api/openapi-ts to generate TypeScript types
9
- * 4. HMR event is sent to notify the client
6
+ * Alias of the shared {@link TypesConfigShape}, which every framework integration also
7
+ * re-exports, so the `types` option is identical everywhere. Retained as a named export.
10
8
  */
11
- export interface TypesConfig {
12
- /**
13
- * Enable type generation.
14
- *
15
- * @default false
16
- */
17
- enabled?: boolean;
18
- /**
19
- * Path to output generated TypeScript types.
20
- *
21
- * @default 'src/generated'
22
- */
23
- output?: string;
24
- /**
25
- * Path where the OpenAPI schema is exported by Litestar.
26
- * The Vite plugin watches this file and runs @hey-api/openapi-ts when it changes.
27
- *
28
- * @default 'src/generated/openapi.json'
29
- */
30
- openapiPath?: string;
31
- /**
32
- * Path where route metadata is exported by Litestar.
33
- * The Vite plugin watches this file for route helper generation.
34
- *
35
- * @default 'src/generated/routes.json'
36
- */
37
- routesPath?: string;
38
- /**
39
- * Optional path for the generated schemas.ts helper file.
40
- * Defaults to `${output}/schemas.ts` when not set.
41
- */
42
- schemasTsPath?: string;
43
- /**
44
- * Path where Inertia page props metadata is exported by Litestar.
45
- * The Vite plugin watches this file for page props type generation.
46
- *
47
- * @default 'src/generated/inertia-pages.json'
48
- */
49
- pagePropsPath?: string;
50
- /**
51
- * Generate Zod schemas in addition to TypeScript types.
52
- *
53
- * @default false
54
- */
55
- generateZod?: boolean;
56
- /**
57
- * Generate a typed SDK client in addition to types.
58
- *
59
- * @default true
60
- */
61
- generateSdk?: boolean;
62
- /**
63
- * Generate typed routes.ts from routes.json metadata.
64
- *
65
- * Mirrors Python TypeGenConfig.generate_routes.
66
- *
67
- * @default true
68
- */
69
- generateRoutes?: boolean;
70
- /**
71
- * Generate Inertia page props types from inertia-pages.json metadata.
72
- *
73
- * Mirrors Python TypeGenConfig.generate_page_props.
74
- *
75
- * @default true
76
- */
77
- generatePageProps?: boolean;
78
- /**
79
- * Generate schemas.ts with ergonomic form/response type helpers.
80
- *
81
- * Creates helper types like FormInput<'api:login'> and FormResponse<'api:login', 201>
82
- * that wrap hey-api generated types with cleaner DX.
83
- *
84
- * @default true
85
- */
86
- generateSchemas?: boolean;
87
- /**
88
- * Register route() function globally on window object.
89
- *
90
- * When true, the generated routes.ts will include code that registers
91
- * the type-safe route() function on `window.route`, similar to Laravel's
92
- * Ziggy library. This allows using route() without imports.
93
- *
94
- * @default false
95
- */
96
- globalRoute?: boolean;
97
- /**
98
- * Fail Vite when type generation fails.
99
- *
100
- * Defaults to true during `vite build` and false during `vite serve`.
101
- */
102
- failOnError?: boolean;
103
- /**
104
- * Debounce time in milliseconds for type regeneration.
105
- * Prevents regeneration from running too frequently when
106
- * multiple files are written in quick succession.
107
- *
108
- * @default 300
109
- */
110
- debounce?: number;
111
- }
9
+ export type TypesConfig = TypesConfigShape;
112
10
  export interface PluginConfig {
113
11
  /**
114
12
  * The path or paths of the entry points to compile.
@@ -51,19 +51,7 @@ function resolveInstallHint(pkg = "@hey-api/openapi-ts") {
51
51
  return `npm install -D ${packageArgs}`;
52
52
  }
53
53
  function resolvePackageExecutor(pkg, executor) {
54
- const runtime = executor || detectExecutor();
55
- switch (runtime) {
56
- case "bun":
57
- return `bunx ${pkg}`;
58
- case "deno":
59
- return `deno run -A npm:${pkg}`;
60
- case "pnpm":
61
- return `pnpm dlx ${pkg}`;
62
- case "yarn":
63
- return `yarn dlx ${pkg}`;
64
- default:
65
- return `npx ${pkg}`;
66
- }
54
+ return resolvePackageExecutorArgv(pkg.split(" "), executor).join(" ");
67
55
  }
68
56
  function getPackageNameFromSpec(packageSpec) {
69
57
  if (packageSpec.startsWith("@")) {
@@ -88,9 +76,14 @@ function resolvePackageExecutorArgv(args, executor, options = {}) {
88
76
  case "bun":
89
77
  if (requiresMultiplePackages) return [];
90
78
  return ["bunx", ...packageSpec ? [packageSpec, ...args] : args];
91
- case "deno":
79
+ case "deno": {
92
80
  if (requiresMultiplePackages) return [];
93
- return ["deno", "run", "-A", ...packageSpec ? [`npm:${resolveDenoPackageSpec(packageSpec, binName)}`, ...args] : args];
81
+ if (packageSpec) {
82
+ return ["deno", "run", "-A", `npm:${resolveDenoPackageSpec(packageSpec, binName)}`, ...args];
83
+ }
84
+ const [firstArg, ...restArgs] = args;
85
+ return firstArg ? ["deno", "run", "-A", `npm:${firstArg}`, ...restArgs] : ["deno", "run", "-A"];
86
+ }
94
87
  case "pnpm":
95
88
  if (requiresMultiplePackages && binName) {
96
89
  return ["pnpm", "dlx", ...packageSpecs.map((spec) => `--package=${spec}`), binName, ...args];
package/dist/js/nuxt.d.ts CHANGED
@@ -23,138 +23,22 @@
23
23
  * @module
24
24
  */
25
25
  import type { Plugin } from "vite";
26
+ import { type LitestarIntegrationConfig } from "./shared/integration-config.js";
27
+ import { type TypesConfigShape } from "./shared/typegen-plugin.js";
26
28
  /**
27
- * Configuration for TypeScript type generation in Nuxt.
29
+ * Configuration for TypeScript type generation.
30
+ *
31
+ * Alias of the shared {@link TypesConfigShape} so every integration accepts an identical
32
+ * `types` option. Retained as a named export for backwards compatibility.
28
33
  */
29
- export interface NuxtTypesConfig {
30
- /**
31
- * Enable type generation.
32
- *
33
- * @default false
34
- */
35
- enabled?: boolean;
36
- /**
37
- * Path to output generated TypeScript types.
38
- * Relative to the Nuxt project root.
39
- *
40
- * @default 'generated'
41
- */
42
- output?: string;
43
- /**
44
- * Path where the OpenAPI schema is exported by Litestar.
45
- *
46
- * @default `${output}/openapi.json`
47
- */
48
- openapiPath?: string;
49
- /**
50
- * Path where route metadata is exported by Litestar.
51
- *
52
- * @default `${output}/routes.json`
53
- */
54
- routesPath?: string;
55
- /**
56
- * Optional path for the generated schemas.ts helper file.
57
- *
58
- * @default `${output}/schemas.ts`
59
- */
60
- schemasTsPath?: string;
61
- /**
62
- * Path where Inertia page props metadata is exported by Litestar.
63
- *
64
- * @default `${output}/inertia-pages.json`
65
- */
66
- pagePropsPath?: string;
67
- /**
68
- * Generate Zod schemas in addition to TypeScript types.
69
- *
70
- * @default false
71
- */
72
- generateZod?: boolean;
73
- /**
74
- * Generate SDK client functions for API calls.
75
- *
76
- * @default true
77
- */
78
- generateSdk?: boolean;
79
- /**
80
- * Generate typed routes.ts from routes.json metadata.
81
- *
82
- * @default true
83
- */
84
- generateRoutes?: boolean;
85
- /**
86
- * Generate Inertia page props types from inertia-pages.json metadata.
87
- *
88
- * @default true
89
- */
90
- generatePageProps?: boolean;
91
- /**
92
- * Generate schemas.ts with ergonomic form/response type helpers.
93
- *
94
- * @default true
95
- */
96
- generateSchemas?: boolean;
97
- /**
98
- * Register route() globally on window object.
99
- *
100
- * @default false
101
- */
102
- globalRoute?: boolean;
103
- /**
104
- * Fail Vite when type generation fails.
105
- *
106
- * Defaults to true during build and false during dev.
107
- */
108
- failOnError?: boolean;
109
- /**
110
- * Debounce time in milliseconds for type regeneration.
111
- *
112
- * @default 300
113
- */
114
- debounce?: number;
115
- }
34
+ export type NuxtTypesConfig = TypesConfigShape;
116
35
  /**
117
- * Configuration options for the Litestar Nuxt module.
36
+ * Configuration options for the Litestar integration.
37
+ *
38
+ * Alias of the shared {@link LitestarIntegrationConfig}. Retained as a named export for
39
+ * backwards compatibility.
118
40
  */
119
- export interface LitestarNuxtConfig {
120
- /**
121
- * URL of the Litestar API backend for proxying requests during development.
122
- *
123
- * @example 'http://127.0.0.1:8000'
124
- * @default 'http://localhost:8000'
125
- */
126
- apiProxy?: string;
127
- /**
128
- * API route prefix to proxy to the Litestar backend.
129
- * Requests matching this prefix will be forwarded to the apiProxy URL.
130
- *
131
- * @example '/api'
132
- * @default '/api'
133
- */
134
- apiPrefix?: string;
135
- /**
136
- * Enable and configure TypeScript type generation.
137
- *
138
- * When set to `true`, enables type generation with default settings.
139
- * When set to a NuxtTypesConfig object, enables type generation with custom settings.
140
- *
141
- * @default false
142
- */
143
- types?: boolean | NuxtTypesConfig;
144
- /**
145
- * Enable verbose logging for debugging.
146
- *
147
- * @default false
148
- */
149
- verbose?: boolean;
150
- /**
151
- * JavaScript runtime executor for package commands.
152
- * Used when running tools like @hey-api/openapi-ts.
153
- *
154
- * @default undefined (uses LITESTAR_VITE_RUNTIME env or 'node')
155
- */
156
- executor?: "node" | "bun" | "deno" | "yarn" | "pnpm";
157
- }
41
+ export type LitestarNuxtConfig = LitestarIntegrationConfig;
158
42
  /**
159
43
  * Nuxt module definition for Litestar integration.
160
44
  *
package/dist/js/nuxt.js CHANGED
@@ -1,64 +1,13 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import colors from "picocolors";
4
- import { readBridgeConfig } from "./shared/bridge-schema.js";
4
+ import { resolveIntegrationConfig } from "./shared/integration-config.js";
5
5
  import { installManagedShutdown } from "./shared/managed-shutdown.js";
6
- import { normalizeHost, resolveHotFilePath, resolveLitestarPort } from "./shared/network.js";
7
- import { createLitestarTypeGenPlugin, resolveTypesConfig } from "./shared/typegen-plugin.js";
6
+ import { normalizeHost } from "./shared/network.js";
7
+ import { createLitestarTypeGenPlugin } from "./shared/typegen-plugin.js";
8
8
  import { hmrServerConfig } from "./shared/vite-compat.js";
9
9
  function resolveConfig(config = {}) {
10
- let hotFile;
11
- let proxyMode = "vite";
12
- let devPort;
13
- let pythonTypesConfig;
14
- let hasPythonConfig = false;
15
- const envPort = process.env.VITE_PORT;
16
- if (envPort) {
17
- devPort = Number.parseInt(envPort, 10);
18
- if (Number.isNaN(devPort)) {
19
- devPort = void 0;
20
- }
21
- }
22
- let pythonExecutor;
23
- let assetUrl;
24
- let litestarPort;
25
- const runtime = readBridgeConfig();
26
- if (runtime) {
27
- hasPythonConfig = true;
28
- const hot = runtime.hotFile;
29
- hotFile = resolveHotFilePath(runtime.bundleDir, hot);
30
- proxyMode = runtime.proxyMode;
31
- devPort = runtime.port;
32
- pythonExecutor = runtime.executor;
33
- assetUrl = runtime.assetUrl;
34
- if (runtime.types) {
35
- pythonTypesConfig = runtime.types;
36
- }
37
- }
38
- const resolvedLitestarPort = resolveLitestarPort(runtime?.litestarPort, runtime?.appUrl);
39
- if (resolvedLitestarPort !== null) {
40
- litestarPort = resolvedLitestarPort;
41
- }
42
- const typesConfig = resolveTypesConfig({
43
- requested: config.types,
44
- pythonConfig: pythonTypesConfig ?? void 0,
45
- defaultOutput: "generated",
46
- mergePythonWhenTrue: true,
47
- mergePythonForObject: true
48
- });
49
- return {
50
- apiProxy: config.apiProxy ?? "http://localhost:8000",
51
- apiPrefix: config.apiPrefix ?? "/api",
52
- types: typesConfig,
53
- verbose: config.verbose ?? false,
54
- hotFile,
55
- proxyMode,
56
- devPort,
57
- litestarPort,
58
- assetUrl,
59
- executor: config.executor ?? pythonExecutor,
60
- hasPythonConfig
61
- };
10
+ return resolveIntegrationConfig(config, "generated");
62
11
  }
63
12
  async function getPort() {
64
13
  return new Promise((resolve, reject) => {
@@ -81,7 +30,7 @@ function createProxyPlugin(config) {
81
30
  async config() {
82
31
  hmrPort = await getPort();
83
32
  const hmrPath = `${(config.assetUrl ?? "/static").replace(/\/$/, "")}/vite-hmr`;
84
- const browserHmrPort = config.litestarPort ?? config.devPort;
33
+ const browserHmrPort = config.litestarPort ?? config.port;
85
34
  return {
86
35
  server: {
87
36
  // Force IPv4 binding for consistency with Python proxy configuration
@@ -89,8 +38,8 @@ function createProxyPlugin(config) {
89
38
  host: "127.0.0.1",
90
39
  // Set the port from Python config/env to ensure Nuxt uses the expected port
91
40
  // strictPort: true prevents auto-incrementing to a different port
92
- ...config.devPort !== void 0 ? {
93
- port: config.devPort,
41
+ ...config.port !== void 0 ? {
42
+ port: config.port,
94
43
  strictPort: true
95
44
  } : {},
96
45
  // Vite serves HMR on a separate internal port; browsers reach it through
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- export type BridgeMode = "spa" | "template" | "hybrid" | "framework" | "external";
12
- export type BridgeProxyMode = "vite" | "direct" | "proxy" | null;
13
- export type BridgeExecutor = "node" | "bun" | "deno" | "yarn" | "pnpm";
11
+ type BridgeMode = "spa" | "template" | "hybrid" | "framework" | "external";
12
+ type BridgeProxyMode = "vite" | "direct" | "proxy" | null;
13
+ type BridgeExecutor = "node" | "bun" | "deno" | "yarn" | "pnpm";
14
14
  export interface BridgeTypesConfig {
15
15
  enabled: boolean;
16
16
  output: string;
@@ -27,7 +27,7 @@ export interface BridgeTypesConfig {
27
27
  globalRoute: boolean;
28
28
  failOnError?: boolean;
29
29
  }
30
- export interface BridgeSpaConfig {
30
+ interface BridgeSpaConfig {
31
31
  /** Use script element instead of data-page attribute for Inertia page data */
32
32
  useScriptElement: boolean;
33
33
  }
@@ -35,6 +35,8 @@ export interface BridgeSchema {
35
35
  assetUrl: string;
36
36
  deployAssetUrl: string | null;
37
37
  appUrl: string | null;
38
+ csrfCookieName: string | null;
39
+ csrfHeaderName: string | null;
38
40
  /**
39
41
  * Litestar dev server port. Used by framework integrations to set
40
42
  * `vite.server.ws.clientPort` on Vite 8.1+ (`vite.server.hmr.clientPort` on
@@ -71,3 +73,4 @@ export interface BridgeSchema {
71
73
  }
72
74
  export declare function parseBridgeSchema(value: unknown): BridgeSchema;
73
75
  export declare function readBridgeConfig(explicitPath?: string): BridgeSchema | null;
76
+ export {};