import http from 'http' ; import { ChildProcess } from 'child_process' ; import { Lambda as FunLambda } from '@zeit/fun' ; import { Builder as BuildConfig , BuildOptions , PrepareCacheOptions , ShouldServeOptions , StartDevServerOptions , StartDevServerResult , Env , FileBlob , FileFsRef , Lambda , PackageJson , } from '@vercel/build-utils' ; import { VercelConfig } from '@vercel/client' ; import { HandleValue , Route } from '@vercel/routing-utils' ; import { Output } from '../output' ; import { ProjectEnvVariable , ProjectSettings } from '../../types' ; export { VercelConfig } ; export interface DevServerOptions { output : Output ; devCommand ? : string ; frameworkSlug ? : string ; projectSettings ? : ProjectSettings ; systemEnvValues ? : string [ ] ; projectEnvs ? : ProjectEnvVariable [ ] ; } export interface EnvConfigs { /**
     * environment variables from `.env.build` file
     */ buildEnv : Env ; /**
     * environment variables from `.env` file
     */ runEnv : Env ; /**
     * environment variables from `.env` and `.env.build`
     */ allEnv : Env ; } export interface BuildMatch extends BuildConfig { entrypoint : string ; src : string ; builderWithPkg : BuilderWithPackage ; buildOutput : BuilderOutputs ; buildResults : Map < string | null , BuildResult > ; buildTimestamp : number ; buildProcess ? : ChildProcess ; } export interface HttpHandler { ( req , res ) : void ; } export interface BuilderInputs { [ path ] : FileFsRef ; } export interface BuiltLambda extends Lambda { fn ? : FunLambda ; } export type BuilderOutput = BuiltLambda | FileFsRef | FileBlob ; export interface BuilderOutputs { [ path ] : BuilderOutput ; } export type CacheOutput = FileFsRef | FileBlob ; export interface CacheOutputs { [ path ] : CacheOutput ; } export interface BuilderConfigAttr { maxLambdaSize ? : string | number ; } export interface Builder { version ? : 1 | 2 | 3 | 4 ; config ? : BuilderConfigAttr ; build ( opts ) : BuilderOutputs | BuildResult | Promise < BuilderOutputs > | Promise < BuildResult > ; prepareCache ? ( opts ) : CacheOutputs | Promise < CacheOutputs > ; shouldServe ? ( params ) : boolean | Promise < boolean > ; startDevServer ? ( opts ) : Promise < StartDevServerResult > ; } export interface BuildResult { output : BuilderOutputs ; routes : Route [ ] ; watch : string [ ] ; distPath ? : string ; } export interface BuildResultV3 { output : Lambda ; routes : Route [ ] ; watch : string [ ] ; distPath ? : string ; } export interface BuildResultV4 { output : { [ filePath ] : Lambda ; } ; routes : Route [ ] ; watch : string [ ] ; distPath ? : string ; } export interface BuilderWithPackage { runInProcess ? : boolean ; requirePath : string ; builder : Readonly < Builder > ; package : Readonly < PackageJson > ; } export interface HttpHeadersConfig { [ name ] : string ; } export interface RouteResult { found : boolean ; dest : string ; continue : boolean ; status ? : number ; headers : HttpHeadersConfig ; uri_args ? : { [ key ] : any ; } ; matched_route ? : Route ; matched_route_idx ? : number ; userDest ? : boolean ; isDestUrl : boolean ; phase ? : HandleValue | null ; } export interface InvokePayload { method : string ; host ? : string ; path : string ; headers : http . IncomingHttpHeaders ; encoding ? : string ; body ? : string ; } export interface InvokeResult { statusCode : number ; headers : HttpHeadersConfig ; encoding ? : string ; body ? : string ; } export type SocketSpec = [ string ] ; export type HostPortSpec = [ number , string ? ] ; export type ListenSpec = SocketSpec | HostPortSpec ;