From 58edb97a160a47eae1ff5d6f8db9ce84d65fe46a Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 4 Aug 2021 20:38:20 +0700 Subject: [PATCH 1/2] restore unrelated reverted changes --- packages/kit/types/config.d.ts | 89 +++++++--------------------------- 1 file changed, 17 insertions(+), 72 deletions(-) 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 +}; From 3adee808bc3be7ab441e7d3234cb868008e287b4 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 4 Aug 2021 20:56:42 +0700 Subject: [PATCH 2/2] add changeset --- .changeset/soft-news-teach.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-news-teach.md 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