Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

schema.ts

37 lines994 Bytes

1import { z } from 'zod'
2import {
3 parseStartConfig as parseCoreStartConfig,
4 tanstackStartOptionsObjectSchema,
5} from '../schema'
6import type { CompileStartFrameworkOptions } from '../types'
7import type { InlineCssInputOptions } from '../schema'
8​
9export const tanstackStartViteOptionsSchema = tanstackStartOptionsObjectSchema
10 .extend({
11 vite: z
12 .object({ installDevServerMiddleware: z.boolean().optional() })
13 .optional(),
14 })
15 .optional()
16 .prefault({})
17​
18export function parseStartConfig(
19 opts: z.input<typeof tanstackStartViteOptionsSchema>,
20 corePluginOpts: { framework: CompileStartFrameworkOptions },
21 root: string,
22) {
23 tanstackStartViteOptionsSchema.parse(opts)
24 const { vite: _vite, ...coreOptions } = opts ?? {}
25​
26 return parseCoreStartConfig(coreOptions, corePluginOpts, root)
28​
29export type TanStackStartViteInputConfig = z.input<
30 typeof tanstackStartViteOptionsSchema
31> & {
32 server?: {
33 build?: {
34 inlineCss?: InlineCssInputOptions
35 }
36 }