Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] restore reverted config changes #2093

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-news-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

restore reverted config changes
89 changes: 17 additions & 72 deletions packages/kit/types/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UserConfig as ViteConfig } from 'vite';
import { RecursiveRequired } from './helper';
import { Logger, TrailingSlash } from './internal';

export interface AdapterUtils {
Expand All @@ -9,22 +10,25 @@ 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<void>;
prerender: (options: { all?: boolean; dest: string; fallback?: string }) => Promise<void>;
}

export interface Adapter {
name: string;
adapt: (context: { utils: AdapterUtils; config: ValidatedConfig }) => Promise<void>;
}

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[];
Expand Down Expand Up @@ -63,7 +67,7 @@ export interface Config {
prerender?: {
crawl?: boolean;
enabled?: boolean;
force?: boolean;
onError?: PrerenderOnErrorValue;
pages?: string[];
};
router?: boolean;
Expand All @@ -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<Config> & {
kit: { files: { setup: string } }; // only for validated
};