export interface Aleph { readonly mode: 'development' | 'production' readonly workingDir: string readonly config: RequiredConfig addDist(path: string, content: Uint8Array): Promise<void> addModule(specifier: string, sourceCode: string, forceRefresh?: boolean): Promise<Module> fetchModule(specifier: string): Promise<{ content: Uint8Array, contentType: string | null }> resolveImport(module: Module, importer: string, bundleMode?: boolean, timeStamp?: boolean): string onResolve(test: RegExp, resolve: (specifier: string) => ResolveResult): void onLoad(test: RegExp, load: (input: LoadInput) => LoadOutput | Promise<LoadOutput>): void onTransform(test: 'hmr' | 'main' | RegExp, transform: (input: TransformInput) => TransformOutput | void | Promise<TransformOutput | void>): void onRender(callback: (input: RenderOutput) => Promise<void> | void): void}
export type Config = { framework?: 'react' basePath?: string i18n?: I18nOptions css?: CSSOptions build?: BuildOptions ssr?: boolean | GlobalSSROptions plugins?: Plugin[] server?: ServerOptions}
export type RequiredConfig = Required<Config> & { i18n: Required<I18nOptions> build: Required<BuildOptions> server: Required<ServerOptions> css: Required<CSSOptions>}
export type Plugin = { name: string setup(aleph: Aleph): Promise<void> | void checksum?(): string}
export type ResolveResult = { specifier?: string asPage?: { path: string, isIndex?: boolean } acceptHMR?: boolean external?: boolean data?: any}
export type LoadInput = { specifier: string data?: any}
export type LoadOutput = { type?: 'css' | 'js' | 'jsx' | 'ts' | 'tsx' code: string map?: string}
export type TransformInput = { module: Omit<Module, 'jsBuffer' | 'ready'> code: string bundleMode?: boolean map?: string}
export type TransformOutput = { code: string extraDeps?: DependencyDescriptor[] map?: string}
export type Module = { readonly specifier: string deps: DependencyDescriptor[] external?: boolean isStyle?: boolean httpExternal?: boolean ssrPropsFn?: string ssgPathsFn?: boolean denoHooks?: string[] jsxStaticClassNames?: string[] sourceHash: string jsFile: string jsBuffer?: Uint8Array ready: Promise<void>}
type DependencyDescriptor = { readonly specifier: string virtual?: boolean isDynamic?: boolean hashLoc?: number}
type HtmlDescriptor = { lang: string, head: string[], scripts: (string | { id?: string, type?: string, src?: string, innerText?: string, async?: boolean, preload?: boolean, nomodule?: boolean })[], body: string, bodyAttrs: Record<string, string>,}
export type SSRData = { value: any expires: number}
export type RenderOutput = { path: string html: HtmlDescriptor data: Record<string, SSRData> | null}
export type I18nOptions = { defaultLocale?: string locales: string[]}
export type BuildTarget = 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'esnext'
export type BrowserName = 'chrome' | 'edge' | 'firefox' | 'ios' | 'safari'
export type BuildOptions = { target?: BuildTarget browsers?: Record<BrowserName, number> outputDir?: string}
export type ImportMap = { imports: Record<string, string> scopes: Record<string, Record<string, string>>}
export type CSSOptions = { cache?: boolean postcss?: { plugins: PostCSSPlugin[] } modules?: CSSModulesOptions}
export type PostCSSPlugin = string | [string, any] | Record<string, any> | CallableFunction
export type CSSModulesOptions = { exportGlobals?: boolean generateScopedName?: string | ((name: string, filename: string, css: string) => string) globalModulePaths?: string[] hashPrefix?: string localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' scopeBehaviour?: 'global' | 'local'}
export type GlobalSSROptions = { include?: RegExp[] exclude?: RegExp[]}
export type SSRProps<P> = P & { $revalidate?: number | boolean | { date: number }}
interface SSRRequest extends Request { readonly basePath: string readonly routePath: string readonly locale: string readonly defaultLocale: string readonly locales: string[] readonly pathname: string readonly params: Record<string, string> readonly query: URLSearchParams}
export type SSROptions<P = {}> = { props?(request: SSRRequest): (SSRProps<P> | Promise<SSRProps<P>>) paths?(): (string[] | Promise<string[]>)}
export type ServerOptions = { middlewares?: APIMiddleware[] headers?: Record<string, string> rewrites?: Record<string, string> compress?: boolean}
export type APIHandler = { (context: APIContext): Promise<void> | void}
export type APIMiddleware = { (context: APIContext, next: () => void): Promise<void> | void}
export interface APIContext extends Deno.RequestEvent { readonly data: Map<string, any> readonly response: APIResponse readonly router: RouterURL}
export interface APIResponse { status: number headers: Headers body?: string | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> addHeader(key: string, value: string): this setHeader(key: string, value: string): this removeHeader(key: string): this redirect(url: string, status?: number): this json(data: any, space?: string | number): this}
export type RouterURL = { readonly basePath: string readonly routePath: string readonly locale: string readonly defaultLocale: string readonly locales: string[] readonly pathname: string readonly params: Record<string, string> readonly query: URLSearchParams toString(): string push(url: string): void replace(url: string): void}