diff --git a/.changeset/soft-news-teach.md b/.changeset/soft-news-teach.md new file mode 100644 index 000000000000..6698998de995 --- /dev/null +++ b/.changeset/soft-news-teach.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +restore reverted config changes diff --git a/packages/kit/types/config.d.ts b/packages/kit/types/config.d.ts index 6a10d370ba6e..a7d34c05c54f 100644 --- a/packages/kit/types/config.d.ts +++ b/packages/kit/types/config.d.ts @@ -1,4 +1,5 @@ import { UserConfig as ViteConfig } from 'vite'; +import { RecursiveRequired } from './helper'; import { Logger, TrailingSlash } from './internal'; export interface AdapterUtils { @@ -9,15 +10,7 @@ export interface AdapterUtils { copy_server_files: (dest: string) => void; copy_static_files: (dest: string) => void; copy: (from: string, to: string, filter?: (basename: string) => boolean) => void; - prerender: ({ - all, - dest, - fallback - }: { - all?: boolean; - dest: string; - fallback?: string; - }) => Promise; + prerender: (options: { all?: boolean; dest: string; fallback?: string }) => Promise; } export interface Adapter { @@ -25,6 +18,17 @@ export interface Adapter { adapt: (context: { utils: AdapterUtils; config: ValidatedConfig }) => Promise; } +export interface PrerenderErrorHandler { + (details: { + status: number; + path: string; + referrer: string | null; + referenceType: 'linked' | 'fetched'; + }): void; +} + +export type PrerenderOnErrorValue = 'fail' | 'continue' | PrerenderErrorHandler; + export interface Config { compilerOptions?: any; extensions?: string[]; @@ -63,7 +67,7 @@ export interface Config { prerender?: { crawl?: boolean; enabled?: boolean; - force?: boolean; + onError?: PrerenderOnErrorValue; pages?: string[]; }; router?: boolean; @@ -78,65 +82,6 @@ export interface Config { preprocess?: any; } -export type PrerenderErrorHandler = (errorDetails: { - status: number; - path: string; - referrer: string | null; - referenceType: 'linked' | 'fetched'; -}) => void | never; - -export type PrerenderOnErrorValue = 'fail' | 'continue' | PrerenderErrorHandler; - -export interface ValidatedConfig { - compilerOptions: any; - extensions: string[]; - kit: { - adapter: Adapter; - amp: boolean; - appDir: string; - files: { - assets: string; - hooks: string; - lib: string; - routes: string; - serviceWorker: string; - setup: string; - template: string; - }; - floc: boolean; - host: string; - hostHeader: string; - hydrate: boolean; - package: { - dir: string; - emitTypes: boolean; - exports: { - include: string[]; - exclude: string[]; - }; - files: { - include: string[]; - exclude: string[]; - }; - }; - paths: { - assets: string; - base: string; - }; - prerender: { - crawl: boolean; - enabled: boolean; - onError: PrerenderOnErrorValue; - pages: string[]; - }; - router: boolean; - serviceWorker: { - exclude: string[]; - }; - ssr: boolean; - target: string; - trailingSlash: TrailingSlash; - vite: () => ViteConfig; - }; - preprocess: any; -} +export type ValidatedConfig = RecursiveRequired & { + kit: { files: { setup: string } }; // only for validated +};