@@ -15,24 +15,109 @@ import lazy from "./lazy.ts";
1515import { manifest } from "./manifest.ts" ;
1616import { parseIdQuery } from "./utils.ts" ;
1717
18+ /**
19+ * Configuration options for SolidStart. (previously in `app.config.ts`)
20+ *
21+ * @see https://docs.solidjs.com/solid-start/v2/migrating-from-v1#move-framework-configuration-into-viteconfigts
22+ */
1823export interface SolidStartOptions {
24+ /**
25+ * Path to the root of the application (where `app.tsx` / `app.jsx` lives).
26+ *
27+ * @default "./src"
28+ */
29+ appRoot ?: string ;
30+
31+ /**
32+ * Options forwarded to `vite-plugin-solid`.
33+ *
34+ * @see https://github.com/solidjs/vite-plugin-solid#api
35+ */
1936 solid ?: Partial < SolidOptions > ;
37+
38+ /**
39+ * Enable or disable server-side rendering.
40+ *
41+ * - `true` — SSR (default)
42+ * - `false` — client-side rendering only (SPA mode)
43+ *
44+ * @default true
45+ */
2046 ssr ?: boolean ;
47+
48+ /**
49+ * Show the SolidStart development overlay (error overlay, etc.) in development.
50+ *
51+ * @default true
52+ */
53+ devOverlay ?: boolean ;
54+
55+ /**
56+ * Experimental features.
57+ */
58+ experimental ?: {
59+ /**
60+ * Enable islands architecture mode.
61+ *
62+ * Currently fixed to `false` (not yet fully supported).
63+ *
64+ * @default false
65+ */
66+ islands ?: false ;
67+ } ;
68+
69+ /**
70+ * Directory containing file-system routes, relative to {@link appRoot}.
71+ *
72+ * @default "./routes"
73+ */
2174 routeDir ?: string ;
75+
76+ /**
77+ * File extensions that should be treated as routes.
78+ *
79+ * @default ["js", "jsx", "ts", "tsx"]
80+ */
2281 extensions ?: string [ ] ;
82+
83+ /**
84+ * Path to an optional middleware module.
85+ *
86+ * The module should export a middleware created with `createMiddleware`
87+ * from `@solidjs/start/middleware`.
88+ *
89+ * @example "src/middleware/index.ts"
90+ */
2391 middleware ?: string ;
92+
93+ /**
94+ * Serialization settings for server-function / action payloads
95+ * that cross the server-client boundary.
96+ */
2497 serialization ?: {
2598 /**
2699 * The serialization mode to use for server functions/actions.
27- * The "js" mode uses a custom binary format that is more efficient than JSON, but requires a custom deserializer (with `eval()`) on the client.
28- * A strong CSP should block `eval()` executions, which would prevent the "js" mode from working.
29- * The "json" mode uses JSON for serialization, which is less efficient but can be deserialized with `JSON.parse` on the client.
100+ *
101+ * - `"js"` — Uses a custom binary format (Seroval) that is more efficient
102+ * than JSON, but requires a custom deserializer (with `eval()`) on the client.
103+ * A strong CSP that blocks `eval()` will prevent this mode from working.
104+ * - `"json"` — Uses JSON for serialization. Less efficient / larger payloads,
105+ * but can be deserialized with `JSON.parse` on the client and is CSP-friendly.
30106 *
31107 * @default "json"
32108 */
33109 mode ?: "js" | "json" ;
34110 } ;
111+
112+ /**
113+ * Configures plugin behavior per build environment
114+ */
35115 env ?: EnvPluginOptions ;
116+
117+ /**
118+ * Options controlling which files are processed as server functions
119+ * (inclusion / exclusion filters for the `"use server"` transform).
120+ */
36121 serverFunctions ?: Pick < ServerFunctionsOptions , "filter" > ;
37122}
38123
@@ -50,7 +135,7 @@ export function solidStart(options?: SolidStartOptions): Array<PluginOption> {
50135 } ,
51136 solid : { } ,
52137 extensions : [ ] ,
53- } ) ;
138+ } satisfies SolidStartOptions ) ;
54139 const extensions = [ ...DEFAULT_EXTENSIONS , ...( start . extensions || [ ] ) ] ;
55140 const routeDir = join ( start . appRoot , start . routeDir ) ;
56141 const root = process . cwd ( ) ;
@@ -224,15 +309,9 @@ export function solidStart(options?: SolidStartOptions): Array<PluginOption> {
224309 enforce : "pre" ,
225310 resolveId ( id , importer , { ssr } ) {
226311 if ( id === "server-only" ) {
227- if ( ! ssr )
228- this . error (
229- `Attempt to import 'server-only' in a client module: ${ importer } ` ,
230- ) ;
312+ if ( ! ssr ) this . error ( `Attempt to import 'server-only' in a client module: ${ importer } ` ) ;
231313 } else if ( id === "client-only" ) {
232- if ( ssr )
233- this . error (
234- `Attempt to import 'client-only' in a server module: ${ importer } ` ,
235- ) ;
314+ if ( ssr ) this . error ( `Attempt to import 'client-only' in a server module: ${ importer } ` ) ;
236315 } else {
237316 return null ;
238317 }
0 commit comments