///
///
import './ambient.js';
import { CompileOptions } from 'svelte/types/compiler/interfaces';
import {
AdapterEntry,
BodyValidator,
CspDirectives,
JSONValue,
Logger,
MaybePromise,
Prerendered,
PrerenderOnErrorValue,
RequestOptions,
ResponseHeaders,
RouteDefinition,
TrailingSlash
} from './private.js';
import { SSRNodeLoader, SSRRoute, ValidatedConfig } from './internal.js';
export interface Adapter {
name: string;
adapt(builder: Builder): MaybePromise;
}
export interface Builder {
log: Logger;
rimraf(dir: string): void;
mkdirp(dir: string): void;
config: ValidatedConfig;
prerendered: Prerendered;
/**
* Create entry points that map to individual functions
* @param fn A function that groups a set of routes into an entry point
*/
createEntries(fn: (route: RouteDefinition) => AdapterEntry): Promise;
generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
getBuildDirectory(name: string): string;
getClientDirectory(): string;
getServerDirectory(): string;
getStaticDirectory(): string;
/**
* @param dest the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
writeClient(dest: string): string[];
/**
* @param dest
*/
writePrerendered(
dest: string,
opts?: {
fallback?: string;
}
): string[];
/**
* @param dest the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
writeServer(dest: string): string[];
/**
* @param from the source file or folder
* @param to the destination file or folder
* @param opts.filter a function to determine whether a file or folder should be copied
* @param opts.replace a map of strings to replace
* @returns an array of paths corresponding to the files that have been created by the copy
*/
copy(
from: string,
to: string,
opts?: {
filter?: (basename: string) => boolean;
replace?: Record;
}
): string[];
/**
* @param {string} directory Path to the directory containing the files to be compressed
*/
compress(directory: string): void;
}
export interface Config {
compilerOptions?: CompileOptions;
extensions?: string[];
kit?: KitConfig;
preprocess?: any;
}
export interface KitConfig {
adapter?: Adapter;
alias?: Record;
appDir?: string;
browser?: {
hydrate?: boolean;
router?: boolean;
};
csp?: {
mode?: 'hash' | 'nonce' | 'auto';
directives?: CspDirectives;
reportOnly?: CspDirectives;
};
env?: {
publicPrefix: string;
};
moduleExtensions?: string[];
files?: {
assets?: string;
hooks?: string;
lib?: string;
params?: string;
routes?: string;
serviceWorker?: string;
template?: string;
};
inlineStyleThreshold?: number;
methodOverride?: {
parameter?: string;
allowed?: string[];
};
outDir?: string;
package?: {
dir?: string;
emitTypes?: boolean;
exports?(filepath: string): boolean;
files?(filepath: string): boolean;
};
paths?: {
assets?: string;
base?: string;
};
prerender?: {
concurrency?: number;
crawl?: boolean;
default?: boolean;
enabled?: boolean;
entries?: Array<'*' | `/${string}`>;
onError?: PrerenderOnErrorValue;
origin?: string;
};
routes?: (filepath: string) => boolean;
serviceWorker?: {
register?: boolean;
files?: (filepath: string) => boolean;
};
trailingSlash?: TrailingSlash;
version?: {
name?: string;
pollInterval?: number;
};
}
export interface ExternalFetch {
(req: Request): Promise;
}
export interface GetSession {
(event: RequestEvent): MaybePromise;
}
export interface Handle {
(input: {
event: RequestEvent;
resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise;
}): MaybePromise;
}
export interface HandleError {
(input: { error: Error & { frame?: string }; event: RequestEvent }): void;
}
/**
* The `(event: LoadEvent) => LoadOutput` `load` function exported from `