| |
| import { t as ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js"; |
| import { ConnectedPayload, CustomPayload, CustomPayload as hmrPayload_CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, HotPayload as hmrPayload_HotPayload, PrunePayload, Update, UpdatePayload } from "#types/hmrPayload"; |
| import { CustomEventMap, InferCustomEventPayload, InferCustomEventPayload as hmrPayload_InferCustomEventPayload, InvalidatePayload } from "#types/customEvent"; |
| import * as Rolldown from "rolldown"; |
| import { CustomPluginOptions, ExistingRawSourceMap, FunctionPluginHooks, ImportKind, InputOption, InputOptions, LoadResult, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleType, ModuleTypeFilter, ObjectHook, OutputBundle, OutputChunk, OutputOptions, PartialResolvedId, PluginContext, PluginContextMeta, ResolveIdResult, RolldownOptions, RolldownOutput, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, TransformPluginContext, VERSION as rolldownVersion, WatcherOptions } from "rolldown"; |
| import { parseAst as parseAst$1, parseAstAsync as parseAstAsync$1 } from "rolldown/parseAst"; |
| import * as Rollup from "#types/internal/rollupTypeCompat"; |
| import { esmExternalRequirePlugin } from "rolldown/plugins"; |
| import { ESTree, MinifyOptions, MinifyResult, ParseResult, ParserOptions, TransformOptions as rolldown_utils_TransformOptions, TransformResult as rolldown_utils_TransformResult, Visitor, VisitorObject, minify, minifySync, parse, parseSync } from "rolldown/utils"; |
| import * as http from "node:http"; |
| import { Agent, ClientRequest, ClientRequestArgs, OutgoingHttpHeaders, ServerResponse } from "node:http"; |
| import { Http2SecureServer } from "node:http2"; |
| import * as fs from "node:fs"; |
| import { EventEmitter } from "node:events"; |
| import { Server as HttpsServer, ServerOptions as HttpsServerOptions } from "node:https"; |
| import * as net from "node:net"; |
| import { Duplex, DuplexOptions, Stream } from "node:stream"; |
| import { FetchFunction, FetchFunctionOptions, FetchResult, FetchResult as moduleRunner_FetchResult, ModuleEvaluator, ModuleRunner, ModuleRunnerHmr, ModuleRunnerOptions } from "vite/module-runner"; |
| import { DepsOptimizerEsbuildOptions, EsbuildTarget, EsbuildTransformOptions, EsbuildTransformOptions as esbuildOptions_EsbuildTransformOptions, EsbuildTransformResult } from "#types/internal/esbuildOptions"; |
| import { SecureContextOptions } from "node:tls"; |
| import { URL as url_URL } from "node:url"; |
| import { ZlibOptions } from "node:zlib"; |
| import { ChunkMetadata, CustomPluginOptionsVite } from "#types/metadata"; |
| import { Terser, TerserMinifyOptions } from "#types/internal/terserOptions"; |
| import * as PostCSS from "postcss"; |
| import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions"; |
| import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions"; |
| import { withFilter } from "rolldown/filter"; |
| import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from "#types/importGlob"; |
|
|
| |
| |
| |
| |
| interface StartOptions { |
| root?: string; |
| config?: string; |
| host: string; |
| port?: string | number; |
| open?: boolean; |
| } |
| |
| |
| |
| interface DevToolsConfig extends Partial<StartOptions> { |
| enabled: boolean; |
| |
| |
| |
| environments?: string[]; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| clientAuth?: boolean; |
| |
| |
| |
| |
| |
| |
| clientAuthTokens?: string[]; |
| } |
| interface ResolvedDevToolsConfig { |
| config: Omit<DevToolsConfig, 'enabled'> & { |
| host: string; |
| }; |
| enabled: boolean; |
| } |
| |
| |
| interface Alias { |
| find: string | RegExp; |
| replacement: string; |
| |
| |
| |
| |
| |
| |
| customResolver?: ResolverFunction | ResolverObject | null; |
| } |
| type MapToFunction<T> = T extends Function ? T : never; |
| type ResolverFunction = MapToFunction<FunctionPluginHooks['resolveId']>; |
| interface ResolverObject { |
| buildStart?: FunctionPluginHooks['buildStart']; |
| resolveId: ResolverFunction; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| type AliasOptions = readonly Alias[] | { |
| [find: string]: string; |
| }; |
| |
| |
| type AnymatchFn = (testString: string) => boolean; |
| type AnymatchPattern = string | RegExp | AnymatchFn; |
| type AnymatchMatcher = AnymatchPattern | AnymatchPattern[]; |
| |
| |
| declare class FSWatcher extends EventEmitter implements fs.FSWatcher { |
| options: WatchOptions; |
| |
| |
| |
| constructor(options?: WatchOptions); |
| |
| |
| |
| |
| ref(): this; |
| |
| |
| |
| |
| |
| unref(): this; |
| |
| |
| |
| |
| add(paths: string | ReadonlyArray<string>): this; |
| |
| |
| |
| |
| unwatch(paths: string | ReadonlyArray<string>): this; |
| |
| |
| |
| |
| |
| |
| getWatched(): { |
| [directory: string]: string[]; |
| }; |
| |
| |
| |
| close(): Promise<void>; |
| on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this; |
| on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this; |
| |
| |
| |
| on(event: 'error', listener: (error: Error) => void): this; |
| |
| |
| |
| on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this; |
| |
| |
| |
| on(event: 'ready', listener: () => void): this; |
| on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this; |
| on(event: string, listener: (...args: any[]) => void): this; |
| } |
| interface WatchOptions { |
| |
| |
| |
| |
| |
| persistent?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| ignored?: AnymatchMatcher; |
| |
| |
| |
| |
| ignoreInitial?: boolean; |
| |
| |
| |
| |
| followSymlinks?: boolean; |
| |
| |
| |
| |
| cwd?: string; |
| |
| |
| |
| |
| |
| |
| disableGlobbing?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| usePolling?: boolean; |
| |
| |
| |
| |
| |
| useFsEvents?: boolean; |
| |
| |
| |
| |
| |
| alwaysStat?: boolean; |
| |
| |
| |
| depth?: number; |
| |
| |
| |
| interval?: number; |
| |
| |
| |
| |
| binaryInterval?: number; |
| |
| |
| |
| |
| |
| ignorePermissionErrors?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| atomic?: boolean | number; |
| |
| |
| |
| awaitWriteFinish?: AwaitWriteFinishOptions | boolean; |
| } |
| interface AwaitWriteFinishOptions { |
| |
| |
| |
| stabilityThreshold?: number; |
| |
| |
| |
| pollInterval?: number; |
| } |
| |
| |
| declare namespace Connect { |
| export type ServerHandle = HandleFunction | http.Server; |
| export class IncomingMessage extends http.IncomingMessage { |
| originalUrl?: http.IncomingMessage['url'] | undefined; |
| } |
| export type NextFunction = (err?: any) => void; |
| export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void; |
| export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void; |
| export type ErrorHandleFunction = (err: any, req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void; |
| export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction; |
| export interface ServerStackItem { |
| route: string; |
| handle: ServerHandle; |
| } |
| export interface Server extends NodeJS.EventEmitter { |
| (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void; |
| route: string; |
| stack: ServerStackItem[]; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| use(fn: NextHandleFunction): Server; |
| use(fn: HandleFunction): Server; |
| use(route: string, fn: NextHandleFunction): Server; |
| use(route: string, fn: HandleFunction): Server; |
| |
| |
| |
| |
| handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server; |
| listen(port: number, hostname?: string, callback?: Function): http.Server; |
| listen(path: string, callback?: Function): http.Server; |
| listen(handle: any, listeningListener?: Function): http.Server; |
| } |
| } |
| |
| |
| interface ProxyTargetDetailed { |
| host: string; |
| port: number; |
| protocol?: string; |
| hostname?: string; |
| socketPath?: string; |
| key?: string; |
| passphrase?: string; |
| pfx?: Buffer | string; |
| cert?: string; |
| ca?: string; |
| ciphers?: string; |
| secureProtocol?: string; |
| } |
| type ProxyType = "ws" | "web"; |
| type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed; |
| type ProxyTargetUrl = URL | string | { |
| port: number; |
| host: string; |
| protocol?: string; |
| }; |
| type NormalizeProxyTarget<T extends ProxyTargetUrl> = Exclude<T, string> | URL; |
| interface ServerOptions$3 { |
| |
| target?: ProxyTarget; |
| |
| forward?: ProxyTargetUrl; |
| |
| agent?: any; |
| |
| ssl?: any; |
| |
| ws?: boolean; |
| |
| xfwd?: boolean; |
| |
| secure?: boolean; |
| |
| toProxy?: boolean; |
| |
| prependPath?: boolean; |
| |
| ignorePath?: boolean; |
| |
| localAddress?: string; |
| |
| changeOrigin?: boolean; |
| |
| preserveHeaderKeyCase?: boolean; |
| |
| auth?: string; |
| |
| hostRewrite?: string; |
| |
| autoRewrite?: boolean; |
| |
| protocolRewrite?: string; |
| |
| cookieDomainRewrite?: false | string | { |
| [oldDomain: string]: string; |
| }; |
| |
| cookiePathRewrite?: false | string | { |
| [oldPath: string]: string; |
| }; |
| |
| headers?: { |
| [header: string]: string | string[] | undefined; |
| }; |
| |
| proxyTimeout?: number; |
| |
| timeout?: number; |
| |
| followRedirects?: boolean; |
| |
| selfHandleResponse?: boolean; |
| |
| buffer?: Stream; |
| |
| method?: string; |
| |
| |
| |
| |
| ca?: string; |
| |
| |
| |
| fetch?: typeof fetch; |
| |
| |
| |
| fetchOptions?: FetchOptions; |
| } |
| interface FetchOptions { |
| |
| requestOptions?: RequestInit; |
| |
| onBeforeRequest?: (requestOptions: RequestInit, req: http.IncomingMessage, res: http.ServerResponse, options: NormalizedServerOptions) => void | Promise<void>; |
| |
| onAfterResponse?: (response: Response, req: http.IncomingMessage, res: http.ServerResponse, options: NormalizedServerOptions) => void | Promise<void>; |
| } |
| interface NormalizedServerOptions extends ServerOptions$3 { |
| target?: NormalizeProxyTarget<ProxyTarget>; |
| forward?: NormalizeProxyTarget<ProxyTargetUrl>; |
| } |
| type ErrorCallback<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = (err: TError, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse> | net.Socket, target?: ProxyTargetUrl) => void; |
| type ProxyServerEventMap<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = { |
| error: Parameters<ErrorCallback<TIncomingMessage, TServerResponse, TError>>; |
| start: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl]; |
| open: [socket: net.Socket]; |
| proxyReq: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: ServerOptions$3, socket: net.Socket]; |
| proxyRes: [proxyRes: InstanceType<TIncomingMessage>, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>]; |
| proxyReqWs: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, socket: net.Socket, options: ServerOptions$3, head: any]; |
| econnreset: [err: Error, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl]; |
| end: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, proxyRes: InstanceType<TIncomingMessage>]; |
| close: [proxyRes: InstanceType<TIncomingMessage>, proxySocket: net.Socket, proxyHead: any]; |
| }; |
| type ProxyMethodArgs<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = { |
| ws: [req: InstanceType<TIncomingMessage>, socket: any, head: any, ...args: [options?: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]]; |
| web: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, ...args: [options: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]]; |
| }; |
| type PassFunctions<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = { |
| ws: (req: InstanceType<TIncomingMessage>, socket: net.Socket, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown; |
| web: (req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown; |
| }; |
| declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> extends EventEmitter<ProxyServerEventMap<TIncomingMessage, TServerResponse, TError>> { |
| |
| |
| |
| |
| |
| |
| |
| readonly ws: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["ws"]) => void; |
| |
| |
| |
| |
| |
| |
| readonly web: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["web"]) => void; |
| private options; |
| private webPasses; |
| private wsPasses; |
| private _server?; |
| |
| |
| |
| |
| constructor(options?: ServerOptions$3); |
| |
| |
| |
| |
| |
| static createProxyServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>; |
| |
| |
| |
| |
| |
| static createServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>; |
| |
| |
| |
| |
| |
| static createProxy<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>; |
| createRightProxy: <PT extends ProxyType>(type: PT) => Function; |
| onError: (err: TError) => void; |
| |
| |
| |
| |
| |
| listen: (port: number, hostname?: string) => this; |
| address: () => string | net.AddressInfo | null | undefined; |
| |
| |
| |
| close: (cb?: Function) => void; |
| before: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void; |
| after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void; |
| } |
| |
| |
| declare function numOpenSockets(): number; |
| declare namespace index_d_exports { |
| export { ErrorCallback, ProxyServer, ProxyTarget, ProxyTargetUrl, ServerOptions$3 as ServerOptions, createProxyServer as createProxy, createProxyServer, createProxyServer as createServer, ProxyServer as default, numOpenSockets }; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| declare function createProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>; |
| |
| |
| interface ProxyOptions extends ServerOptions$3 { |
| |
| |
| |
| rewrite?: (path: string) => string; |
| |
| |
| |
| configure?: (proxy: ProxyServer, options: ProxyOptions) => void; |
| |
| |
| |
| bypass?: (req: http.IncomingMessage, res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>; |
| |
| |
| |
| |
| |
| rewriteWsOrigin?: boolean | undefined; |
| } |
| |
| |
| type LogType = "error" | "warn" | "info"; |
| type LogLevel = LogType | "silent"; |
| interface Logger { |
| info(msg: string, options?: LogOptions): void; |
| warn(msg: string, options?: LogOptions): void; |
| warnOnce(msg: string, options?: LogOptions): void; |
| error(msg: string, options?: LogErrorOptions): void; |
| clearScreen(type: LogType): void; |
| hasErrorLogged(error: Error | RollupError): boolean; |
| hasWarned: boolean; |
| } |
| interface LogOptions { |
| clear?: boolean; |
| timestamp?: boolean; |
| environment?: string; |
| } |
| interface LogErrorOptions extends LogOptions { |
| error?: Error | RollupError | null; |
| } |
| interface LoggerOptions { |
| prefix?: string; |
| allowClearScreen?: boolean; |
| customLogger?: Logger; |
| console?: Console; |
| } |
| declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger; |
| |
| |
| interface CommonServerOptions { |
| |
| |
| |
| |
| |
| port?: number; |
| |
| |
| |
| strictPort?: boolean; |
| |
| |
| |
| |
| host?: string | boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| allowedHosts?: string[] | true; |
| |
| |
| |
| |
| https?: HttpsServerOptions; |
| |
| |
| |
| open?: boolean | string; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| proxy?: Record<string, string | ProxyOptions>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| cors?: CorsOptions | boolean; |
| |
| |
| |
| headers?: OutgoingHttpHeaders; |
| } |
| |
| |
| |
| interface CorsOptions { |
| |
| |
| |
| |
| |
| |
| origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void); |
| methods?: string | string[]; |
| allowedHeaders?: string | string[]; |
| exposedHeaders?: string | string[]; |
| credentials?: boolean; |
| maxAge?: number; |
| preflightContinue?: boolean; |
| optionsSuccessStatus?: number; |
| } |
| type CorsOrigin = boolean | string | RegExp | (string | RegExp)[]; |
| |
| |
| type ForwardConsoleLogLevel = "error" | "warn" | "info" | "log" | "debug" | (string & {}); |
| interface ForwardConsoleOptions { |
| unhandledErrors?: boolean; |
| logLevels?: ForwardConsoleLogLevel[]; |
| } |
| interface ResolvedForwardConsoleOptions { |
| enabled: boolean; |
| unhandledErrors: boolean; |
| logLevels: ForwardConsoleLogLevel[]; |
| } |
| |
| |
| type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>; |
| |
| |
| interface PreviewOptions extends CommonServerOptions {} |
| interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {} |
| interface PreviewServer { |
| |
| |
| |
| config: ResolvedConfig; |
| |
| |
| |
| close(): Promise<void>; |
| |
| |
| |
| |
| |
| |
| |
| |
| middlewares: Connect.Server; |
| |
| |
| |
| httpServer: HttpServer; |
| |
| |
| |
| |
| resolvedUrls: ResolvedServerUrls | null; |
| |
| |
| |
| printUrls(): void; |
| |
| |
| |
| bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void; |
| } |
| type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>; |
| |
| |
| |
| declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>; |
| |
| |
| type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = { |
| |
| |
| |
| print?: boolean; |
| |
| |
| |
| |
| |
| customShortcuts?: CLIShortcut<Server>[]; |
| }; |
| type CLIShortcut<Server = ViteDevServer | PreviewServer> = { |
| key: string; |
| description: string; |
| action?(server: Server): void | Promise<void>; |
| }; |
| |
| |
| declare class PartialEnvironment { |
| name: string; |
| getTopLevelConfig(): ResolvedConfig; |
| config: ResolvedConfig & ResolvedEnvironmentOptions; |
| logger: Logger; |
| constructor(name: string, topLevelConfig: ResolvedConfig, options?: ResolvedEnvironmentOptions); |
| } |
| declare class BaseEnvironment extends PartialEnvironment { |
| get plugins(): readonly Plugin[]; |
| constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| declare class UnknownEnvironment extends BaseEnvironment { |
| mode: "unknown"; |
| } |
| |
| |
| declare class ScanEnvironment extends BaseEnvironment { |
| mode: "scan"; |
| get pluginContainer(): EnvironmentPluginContainer; |
| init(): Promise<void>; |
| } |
| |
| |
| type ExportsData = { |
| hasModuleSyntax: boolean; |
| exports: readonly string[]; |
| jsxLoader?: boolean; |
| }; |
| interface DepsOptimizer { |
| init: () => Promise<void>; |
| metadata: DepOptimizationMetadata; |
| scanProcessing?: Promise<void>; |
| registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo; |
| run: () => void; |
| isOptimizedDepFile: (id: string) => boolean; |
| isOptimizedDepUrl: (url: string) => boolean; |
| getOptimizedDepId: (depInfo: OptimizedDepInfo) => string; |
| close: () => Promise<void>; |
| options: DepOptimizationOptions; |
| } |
| interface DepOptimizationConfig { |
| |
| |
| |
| |
| include?: string[]; |
| |
| |
| |
| |
| exclude?: string[]; |
| |
| |
| |
| |
| |
| needsInterop?: string[]; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| esbuildOptions?: DepsOptimizerEsbuildOptions; |
| |
| |
| |
| rollupOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & { |
| output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| rolldownOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & { |
| output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| extensions?: string[]; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| disabled?: boolean | "build" | "dev"; |
| |
| |
| |
| |
| |
| |
| noDiscovery?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| holdUntilCrawlEnd?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| ignoreOutdatedRequests?: boolean; |
| } |
| type DepOptimizationOptions = DepOptimizationConfig & { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| entries?: string | string[]; |
| |
| |
| |
| |
| force?: boolean; |
| }; |
| interface OptimizedDepInfo { |
| id: string; |
| file: string; |
| src?: string; |
| needsInterop?: boolean; |
| browserHash?: string; |
| fileHash?: string; |
| |
| |
| |
| |
| processing?: Promise<void>; |
| |
| |
| |
| |
| exportsData?: Promise<ExportsData>; |
| isDynamicEntry?: boolean; |
| } |
| interface DepOptimizationMetadata { |
| |
| |
| |
| |
| hash: string; |
| |
| |
| |
| |
| lockfileHash: string; |
| |
| |
| |
| |
| configHash: string; |
| |
| |
| |
| |
| |
| browserHash: string; |
| |
| |
| |
| optimized: Record<string, OptimizedDepInfo>; |
| |
| |
| |
| chunks: Record<string, OptimizedDepInfo>; |
| |
| |
| |
| discovered: Record<string, OptimizedDepInfo>; |
| |
| |
| |
| depInfoList: OptimizedDepInfo[]; |
| } |
| |
| |
| |
| |
| |
| |
| declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>; |
| |
| |
| interface TransformResult { |
| code: string; |
| map: SourceMap | { |
| mappings: ""; |
| } | null; |
| ssr?: boolean; |
| etag?: string; |
| deps?: string[]; |
| dynamicDeps?: string[]; |
| } |
| interface TransformOptions { |
| |
| |
| |
| ssr?: boolean; |
| } |
| |
| |
| declare class EnvironmentModuleNode { |
| environment: string; |
| |
| |
| |
| url: string; |
| |
| |
| |
| id: string | null; |
| file: string | null; |
| type: "js" | "css" | "asset"; |
| info?: ModuleInfo; |
| meta?: Record<string, any>; |
| importers: Set<EnvironmentModuleNode>; |
| importedModules: Set<EnvironmentModuleNode>; |
| acceptedHmrDeps: Set<EnvironmentModuleNode>; |
| acceptedHmrExports: Set<string> | null; |
| importedBindings: Map<string, Set<string>> | null; |
| isSelfAccepting?: boolean; |
| transformResult: TransformResult | null; |
| ssrModule: Record<string, any> | null; |
| ssrError: Error | null; |
| lastHMRTimestamp: number; |
| lastInvalidationTimestamp: number; |
| |
| |
| |
| constructor(url: string, environment: string, setIsSelfAccepting?: boolean); |
| } |
| type ResolvedUrl = [url: string, resolvedId: string, meta: object | null | undefined]; |
| declare class EnvironmentModuleGraph { |
| environment: string; |
| urlToModuleMap: Map<string, EnvironmentModuleNode>; |
| idToModuleMap: Map<string, EnvironmentModuleNode>; |
| etagToModuleMap: Map<string, EnvironmentModuleNode>; |
| fileToModulesMap: Map<string, Set<EnvironmentModuleNode>>; |
| constructor(environment: string, resolveId: (url: string) => Promise<PartialResolvedId | null>); |
| getModuleByUrl(rawUrl: string): Promise<EnvironmentModuleNode | undefined>; |
| getModuleById(id: string): EnvironmentModuleNode | undefined; |
| getModulesByFile(file: string): Set<EnvironmentModuleNode> | undefined; |
| onFileChange(file: string): void; |
| onFileDelete(file: string): void; |
| invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void; |
| invalidateAll(): void; |
| |
| |
| |
| |
| |
| |
| |
| |
| updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, staticImportedUrls?: Set<string>): Promise<Set<EnvironmentModuleNode> | undefined>; |
| ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>; |
| createFileOnlyEntry(file: string): EnvironmentModuleNode; |
| resolveUrl(url: string): Promise<ResolvedUrl>; |
| updateModuleTransformResult(mod: EnvironmentModuleNode, result: TransformResult | null): void; |
| getModuleByEtag(etag: string): EnvironmentModuleNode | undefined; |
| } |
| |
| |
| declare class ModuleNode { |
| _moduleGraph: ModuleGraph; |
| _clientModule: EnvironmentModuleNode | undefined; |
| _ssrModule: EnvironmentModuleNode | undefined; |
| constructor(moduleGraph: ModuleGraph, clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode); |
| _get<T extends keyof EnvironmentModuleNode>(prop: T): EnvironmentModuleNode[T]; |
| _set<T extends keyof EnvironmentModuleNode>(prop: T, value: EnvironmentModuleNode[T]): void; |
| _wrapModuleSet(prop: ModuleSetNames, module: EnvironmentModuleNode | undefined): Set<ModuleNode>; |
| _getModuleSetUnion(prop: "importedModules" | "importers"): Set<ModuleNode>; |
| _getModuleInfoUnion(prop: "info"): ModuleInfo | undefined; |
| _getModuleObjectUnion(prop: "meta"): Record<string, any> | undefined; |
| get url(): string; |
| set url(value: string); |
| get id(): string | null; |
| set id(value: string | null); |
| get file(): string | null; |
| set file(value: string | null); |
| get type(): "js" | "css" | "asset"; |
| get info(): ModuleInfo | undefined; |
| get meta(): Record<string, any> | undefined; |
| get importers(): Set<ModuleNode>; |
| get clientImportedModules(): Set<ModuleNode>; |
| get ssrImportedModules(): Set<ModuleNode>; |
| get importedModules(): Set<ModuleNode>; |
| get acceptedHmrDeps(): Set<ModuleNode>; |
| get acceptedHmrExports(): Set<string> | null; |
| get importedBindings(): Map<string, Set<string>> | null; |
| get isSelfAccepting(): boolean | undefined; |
| get transformResult(): TransformResult | null; |
| set transformResult(value: TransformResult | null); |
| get ssrTransformResult(): TransformResult | null; |
| set ssrTransformResult(value: TransformResult | null); |
| get ssrModule(): Record<string, any> | null; |
| get ssrError(): Error | null; |
| get lastHMRTimestamp(): number; |
| set lastHMRTimestamp(value: number); |
| get lastInvalidationTimestamp(): number; |
| get invalidationState(): TransformResult | "HARD_INVALIDATED" | undefined; |
| get ssrInvalidationState(): TransformResult | "HARD_INVALIDATED" | undefined; |
| } |
| declare class ModuleGraph { |
| urlToModuleMap: Map<string, ModuleNode>; |
| idToModuleMap: Map<string, ModuleNode>; |
| etagToModuleMap: Map<string, ModuleNode>; |
| fileToModulesMap: Map<string, Set<ModuleNode>>; |
| private moduleNodeCache; |
| constructor(moduleGraphs: { |
| client: () => EnvironmentModuleGraph; |
| ssr: () => EnvironmentModuleGraph; |
| }); |
| getModuleById(id: string): ModuleNode | undefined; |
| getModuleByUrl(url: string, _ssr?: boolean): Promise<ModuleNode | undefined>; |
| getModulesByFile(file: string): Set<ModuleNode> | undefined; |
| onFileChange(file: string): void; |
| onFileDelete(file: string): void; |
| invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void; |
| invalidateAll(): void; |
| ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>; |
| createFileOnlyEntry(file: string): ModuleNode; |
| resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>; |
| updateModuleTransformResult(mod: ModuleNode, result: TransformResult | null, ssr?: boolean): void; |
| getModuleByEtag(etag: string): ModuleNode | undefined; |
| getBackwardCompatibleBrowserModuleNode(clientModule: EnvironmentModuleNode): ModuleNode; |
| getBackwardCompatibleServerModuleNode(ssrModule: EnvironmentModuleNode): ModuleNode; |
| getBackwardCompatibleModuleNode(mod: EnvironmentModuleNode): ModuleNode; |
| getBackwardCompatibleModuleNodeDual(clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode): ModuleNode; |
| } |
| type ModuleSetNames = "acceptedHmrDeps" | "importedModules"; |
| |
| |
| interface HmrOptions { |
| protocol?: string; |
| host?: string; |
| port?: number; |
| clientPort?: number; |
| path?: string; |
| timeout?: number; |
| overlay?: boolean; |
| server?: HttpServer; |
| } |
| interface HotUpdateOptions { |
| type: "create" | "update" | "delete"; |
| file: string; |
| timestamp: number; |
| modules: Array<EnvironmentModuleNode>; |
| read: () => string | Promise<string>; |
| server: ViteDevServer; |
| } |
| interface HmrContext { |
| file: string; |
| timestamp: number; |
| modules: Array<ModuleNode>; |
| read: () => string | Promise<string>; |
| server: ViteDevServer; |
| } |
| interface HotChannelClient { |
| send(payload: hmrPayload_HotPayload): void; |
| } |
| type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void; |
| interface HotChannel<Api = any> { |
| |
| |
| |
| |
| skipFsCheck?: boolean; |
| |
| |
| |
| send?(payload: hmrPayload_HotPayload): void; |
| |
| |
| |
| on?<T extends string>(event: T, listener: HotChannelListener<T>): void; |
| on?(event: "connection", listener: () => void): void; |
| |
| |
| |
| off?(event: string, listener: Function): void; |
| |
| |
| |
| listen?(): void; |
| |
| |
| |
| close?(): Promise<unknown> | void; |
| api?: Api; |
| } |
| interface NormalizedHotChannelClient { |
| |
| |
| |
| send(payload: hmrPayload_HotPayload): void; |
| |
| |
| |
| send(event: string, payload?: hmrPayload_CustomPayload["data"]): void; |
| } |
| interface NormalizedHotChannel<Api = any> { |
| |
| |
| |
| send(payload: hmrPayload_HotPayload): void; |
| |
| |
| |
| send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void; |
| |
| |
| |
| on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: NormalizedHotChannelClient) => void): void; |
| |
| |
| |
| on(event: "connection", listener: () => void): void; |
| |
| |
| |
| off(event: string, listener: Function): void; |
| handleInvoke(payload: hmrPayload_HotPayload): Promise<{ |
| result: any; |
| } | { |
| error: any; |
| }>; |
| |
| |
| |
| listen(): void; |
| |
| |
| |
| close(): Promise<unknown> | void; |
| api?: Api; |
| } |
| type ServerHotChannelApi = { |
| innerEmitter: EventEmitter; |
| outsideEmitter: EventEmitter; |
| }; |
| type ServerHotChannel = HotChannel<ServerHotChannelApi>; |
| type NormalizedServerHotChannel = NormalizedHotChannel<ServerHotChannelApi>; |
| declare function createServerHotChannel(): ServerHotChannel; |
| |
| |
| |
| declare class WebSocket extends EventEmitter { |
| |
| static readonly CONNECTING: 0; |
| |
| static readonly OPEN: 1; |
| |
| static readonly CLOSING: 2; |
| |
| static readonly CLOSED: 3; |
| binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'; |
| readonly bufferedAmount: number; |
| readonly extensions: string; |
| |
| readonly isPaused: boolean; |
| readonly protocol: string; |
| |
| readonly readyState: typeof WebSocket.CONNECTING | typeof WebSocket.OPEN | typeof WebSocket.CLOSING | typeof WebSocket.CLOSED; |
| readonly url: string; |
| |
| readonly CONNECTING: 0; |
| |
| readonly OPEN: 1; |
| |
| readonly CLOSING: 2; |
| |
| readonly CLOSED: 3; |
| onopen: ((event: WebSocket.Event) => void) | null; |
| onerror: ((event: WebSocket.ErrorEvent) => void) | null; |
| onclose: ((event: WebSocket.CloseEvent) => void) | null; |
| onmessage: ((event: WebSocket.MessageEvent) => void) | null; |
| constructor(address: null); |
| constructor(address: string | url_URL, options?: WebSocket.ClientOptions | ClientRequestArgs); |
| constructor(address: string | url_URL, protocols?: string | string[], options?: WebSocket.ClientOptions | ClientRequestArgs); |
| close(code?: number, data?: string | Buffer): void; |
| ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void; |
| pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void; |
| send(data: any, cb?: (err?: Error) => void): void; |
| send(data: any, options: { |
| mask?: boolean | undefined; |
| binary?: boolean | undefined; |
| compress?: boolean | undefined; |
| fin?: boolean | undefined; |
| }, cb?: (err?: Error) => void): void; |
| terminate(): void; |
| |
| |
| |
| |
| |
| pause(): void; |
| |
| |
| |
| |
| resume(): void; |
| addEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void, options?: WebSocket.EventListenerOptions): void; |
| addEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void, options?: WebSocket.EventListenerOptions): void; |
| addEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void, options?: WebSocket.EventListenerOptions): void; |
| addEventListener(method: 'open', cb: (event: WebSocket.Event) => void, options?: WebSocket.EventListenerOptions): void; |
| removeEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void): void; |
| removeEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void): void; |
| removeEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void): void; |
| removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void; |
| on(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this; |
| on(event: 'error', listener: (this: WebSocket, err: Error) => void): this; |
| on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this; |
| on(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this; |
| on(event: 'open', listener: (this: WebSocket) => void): this; |
| on(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this; |
| on(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this; |
| on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this; |
| once(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this; |
| once(event: 'error', listener: (this: WebSocket, err: Error) => void): this; |
| once(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this; |
| once(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this; |
| once(event: 'open', listener: (this: WebSocket) => void): this; |
| once(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this; |
| once(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this; |
| once(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this; |
| off(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this; |
| off(event: 'error', listener: (this: WebSocket, err: Error) => void): this; |
| off(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this; |
| off(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this; |
| off(event: 'open', listener: (this: WebSocket) => void): this; |
| off(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this; |
| off(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this; |
| off(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this; |
| addListener(event: 'close', listener: (code: number, reason: Buffer) => void): this; |
| addListener(event: 'error', listener: (err: Error) => void): this; |
| addListener(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this; |
| addListener(event: 'message', listener: (data: WebSocket.RawData, isBinary: boolean) => void): this; |
| addListener(event: 'open', listener: () => void): this; |
| addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this; |
| addListener(event: 'unexpected-response', listener: (request: ClientRequest, response: http.IncomingMessage) => void): this; |
| addListener(event: string | symbol, listener: (...args: any[]) => void): this; |
| removeListener(event: 'close', listener: (code: number, reason: Buffer) => void): this; |
| removeListener(event: 'error', listener: (err: Error) => void): this; |
| removeListener(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this; |
| removeListener(event: 'message', listener: (data: WebSocket.RawData, isBinary: boolean) => void): this; |
| removeListener(event: 'open', listener: () => void): this; |
| removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this; |
| removeListener(event: 'unexpected-response', listener: (request: ClientRequest, response: http.IncomingMessage) => void): this; |
| removeListener(event: string | symbol, listener: (...args: any[]) => void): this; |
| } |
| declare const WebSocketAlias: typeof WebSocket; |
| interface WebSocketAlias extends WebSocket {} |
| declare namespace WebSocket { |
| |
| |
| |
| type RawData = Buffer | ArrayBuffer | Buffer[]; |
| |
| |
| |
| type Data = string | Buffer | ArrayBuffer | Buffer[]; |
| |
| |
| |
| type CertMeta = string | string[] | Buffer | Buffer[]; |
| |
| |
| |
| |
| |
| type VerifyClientCallbackSync = (info: { |
| origin: string; |
| secure: boolean; |
| req: http.IncomingMessage; |
| }) => boolean; |
| |
| |
| |
| |
| |
| type VerifyClientCallbackAsync = (info: { |
| origin: string; |
| secure: boolean; |
| req: http.IncomingMessage; |
| }, callback: (res: boolean, code?: number, message?: string, headers?: OutgoingHttpHeaders) => void) => void; |
| interface ClientOptions extends SecureContextOptions { |
| protocol?: string | undefined; |
| followRedirects?: boolean | undefined; |
| generateMask?(mask: Buffer): void; |
| handshakeTimeout?: number | undefined; |
| maxRedirects?: number | undefined; |
| perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined; |
| localAddress?: string | undefined; |
| protocolVersion?: number | undefined; |
| headers?: { |
| [key: string]: string; |
| } | undefined; |
| origin?: string | undefined; |
| agent?: Agent | undefined; |
| host?: string | undefined; |
| family?: number | undefined; |
| checkServerIdentity?(servername: string, cert: CertMeta): boolean; |
| rejectUnauthorized?: boolean | undefined; |
| maxPayload?: number | undefined; |
| skipUTF8Validation?: boolean | undefined; |
| } |
| interface PerMessageDeflateOptions { |
| serverNoContextTakeover?: boolean | undefined; |
| clientNoContextTakeover?: boolean | undefined; |
| serverMaxWindowBits?: number | undefined; |
| clientMaxWindowBits?: number | undefined; |
| zlibDeflateOptions?: { |
| flush?: number | undefined; |
| finishFlush?: number | undefined; |
| chunkSize?: number | undefined; |
| windowBits?: number | undefined; |
| level?: number | undefined; |
| memLevel?: number | undefined; |
| strategy?: number | undefined; |
| dictionary?: Buffer | Buffer[] | DataView | undefined; |
| info?: boolean | undefined; |
| } | undefined; |
| zlibInflateOptions?: ZlibOptions | undefined; |
| threshold?: number | undefined; |
| concurrencyLimit?: number | undefined; |
| } |
| interface Event { |
| type: string; |
| target: WebSocket; |
| } |
| interface ErrorEvent { |
| error: any; |
| message: string; |
| type: string; |
| target: WebSocket; |
| } |
| interface CloseEvent { |
| wasClean: boolean; |
| code: number; |
| reason: string; |
| type: string; |
| target: WebSocket; |
| } |
| interface MessageEvent { |
| data: Data; |
| type: string; |
| target: WebSocket; |
| } |
| interface EventListenerOptions { |
| once?: boolean | undefined; |
| } |
| interface ServerOptions { |
| host?: string | undefined; |
| port?: number | undefined; |
| backlog?: number | undefined; |
| server?: http.Server | HttpsServer | undefined; |
| verifyClient?: VerifyClientCallbackAsync | VerifyClientCallbackSync | undefined; |
| handleProtocols?: (protocols: Set<string>, request: http.IncomingMessage) => string | false; |
| path?: string | undefined; |
| noServer?: boolean | undefined; |
| clientTracking?: boolean | undefined; |
| perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined; |
| maxPayload?: number | undefined; |
| skipUTF8Validation?: boolean | undefined; |
| WebSocket?: typeof WebSocket.WebSocket | undefined; |
| } |
| interface AddressInfo { |
| address: string; |
| family: string; |
| port: number; |
| } |
| class Server<T extends WebSocket = WebSocket> extends EventEmitter { |
| options: ServerOptions; |
| path: string; |
| clients: Set<T>; |
| constructor(options?: ServerOptions, callback?: () => void); |
| address(): AddressInfo | string; |
| close(cb?: (err?: Error) => void): void; |
| handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T, request: http.IncomingMessage) => void): void; |
| shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>; |
| on(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this; |
| on(event: 'error', cb: (this: Server<T>, error: Error) => void): this; |
| on(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this; |
| on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this; |
| on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
| once(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this; |
| once(event: 'error', cb: (this: Server<T>, error: Error) => void): this; |
| once(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this; |
| once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this; |
| once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
| off(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this; |
| off(event: 'error', cb: (this: Server<T>, error: Error) => void): this; |
| off(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this; |
| off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this; |
| off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
| addListener(event: 'connection', cb: (client: T, request: http.IncomingMessage) => void): this; |
| addListener(event: 'error', cb: (err: Error) => void): this; |
| addListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this; |
| addListener(event: 'close' | 'listening', cb: () => void): this; |
| addListener(event: string | symbol, listener: (...args: any[]) => void): this; |
| removeListener(event: 'connection', cb: (client: T) => void): this; |
| removeListener(event: 'error', cb: (err: Error) => void): this; |
| removeListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this; |
| removeListener(event: 'close' | 'listening', cb: () => void): this; |
| removeListener(event: string | symbol, listener: (...args: any[]) => void): this; |
| } |
| const WebSocketServer: typeof Server; |
| interface WebSocketServer extends Server {} |
| const WebSocket: typeof WebSocketAlias; |
| interface WebSocket extends WebSocketAlias {} |
| function createWebSocketStream(websocket: WebSocket, options?: DuplexOptions): Duplex; |
| } |
| |
| |
| type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void; |
| declare const isWebSocketServer: unique symbol; |
| interface WebSocketServer extends NormalizedHotChannel { |
| |
| |
| |
| on: WebSocket.Server["on"] & { |
| <T extends string>(event: T, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T>>): void; |
| }; |
| |
| |
| |
| off: WebSocket.Server["off"] & { |
| (event: string, listener: Function): void; |
| }; |
| |
| |
| |
| listen(): void; |
| |
| |
| |
| close(): Promise<void>; |
| [isWebSocketServer]: true; |
| |
| |
| |
| clients: Set<WebSocketClient>; |
| } |
| interface WebSocketClient extends NormalizedHotChannelClient { |
| |
| |
| |
| |
| socket: WebSocket; |
| } |
| |
| |
| interface DevEnvironmentContext { |
| hot: boolean; |
| transport?: HotChannel | WebSocketServer; |
| options?: EnvironmentOptions; |
| remoteRunner?: { |
| inlineSourceMap?: boolean; |
| }; |
| depsOptimizer?: DepsOptimizer; |
| } |
| declare class DevEnvironment extends BaseEnvironment { |
| mode: "dev"; |
| moduleGraph: EnvironmentModuleGraph; |
| depsOptimizer?: DepsOptimizer; |
| get pluginContainer(): EnvironmentPluginContainer<DevEnvironment>; |
| |
| |
| |
| |
| |
| |
| |
| hot: NormalizedHotChannel; |
| constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext); |
| init(options?: { |
| watcher?: FSWatcher; |
| |
| |
| |
| |
| |
| previousInstance?: DevEnvironment; |
| }): Promise<void>; |
| |
| |
| |
| |
| |
| |
| listen(server: ViteDevServer): Promise<void>; |
| |
| |
| |
| |
| |
| |
| fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>; |
| reloadModule(module: EnvironmentModuleNode): Promise<void>; |
| transformRequest(url: string): Promise<TransformResult | null>; |
| warmupRequest(url: string): Promise<void>; |
| protected invalidateModule(m: { |
| path: string; |
| message?: string; |
| firstInvalidatedBy: string; |
| }, _client: NormalizedHotChannelClient): void; |
| close(): Promise<void>; |
| |
| |
| |
| |
| |
| |
| |
| |
| waitForRequestsIdle(ignoredId?: string): Promise<void>; |
| } |
| |
| |
|
|
| interface RollupCommonJSOptions { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| include?: string | RegExp | readonly (string | RegExp)[]; |
| |
| |
| |
| |
| |
| |
| |
| exclude?: string | RegExp | readonly (string | RegExp)[]; |
| |
| |
| |
| |
| |
| |
| extensions?: ReadonlyArray<string>; |
| |
| |
| |
| |
| ignoreGlobal?: boolean; |
| |
| |
| |
| |
| |
| sourceMap?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ignoreDynamicRequires?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| transformMixedEsModules?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[]; |
| |
| |
| |
| |
| |
| ignore?: ReadonlyArray<string> | ((id: string) => boolean); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ignoreTryCatch?: boolean | 'remove' | ReadonlyArray<string> | ((id: string) => boolean | 'remove'); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| requireReturnsDefault?: boolean | 'auto' | 'preferred' | 'namespace' | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace'); |
| |
| |
| |
| defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto'); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| dynamicRequireTargets?: string | ReadonlyArray<string>; |
| |
| |
| |
| |
| |
| |
| dynamicRequireRoot?: string; |
| } |
| |
| |
| interface RollupDynamicImportVarsOptions { |
| |
| |
| |
| |
| include?: string | RegExp | (string | RegExp)[]; |
| |
| |
| |
| |
| exclude?: string | RegExp | (string | RegExp)[]; |
| |
| |
| |
| warnOnError?: boolean; |
| } |
| |
| |
| interface TerserOptions extends TerserMinifyOptions { |
| |
| |
| |
| |
| |
| |
| maxWorkers?: number; |
| } |
| |
| |
| interface EnvironmentResolveOptions { |
| |
| |
| |
| mainFields?: string[]; |
| conditions?: string[]; |
| externalConditions?: string[]; |
| |
| |
| |
| extensions?: string[]; |
| dedupe?: string[]; |
| |
| |
| |
| |
| |
| noExternal?: string | RegExp | (string | RegExp)[] | true; |
| |
| |
| |
| |
| |
| external?: string[] | true; |
| |
| |
| |
| builtins?: (string | RegExp)[]; |
| } |
| interface ResolveOptions extends EnvironmentResolveOptions { |
| |
| |
| |
| preserveSymlinks?: boolean; |
| |
| |
| |
| |
| |
| |
| tsconfigPaths?: boolean; |
| } |
| interface ResolvePluginOptions { |
| root: string; |
| isBuild: boolean; |
| isProduction: boolean; |
| packageCache?: PackageCache; |
| |
| |
| |
| |
| |
| asSrc?: boolean; |
| tryIndex?: boolean; |
| tryPrefix?: string; |
| preferRelative?: boolean; |
| isRequire?: boolean; |
| scan?: boolean; |
| |
| |
| |
| legacyInconsistentCjsInterop?: boolean; |
| } |
| interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {} |
| |
| |
| |
| type PackageCache = Map<string, PackageData>; |
| interface PackageData { |
| dir: string; |
| hasSideEffects: (id: string) => boolean | "no-treeshake" | null; |
| setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void; |
| getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined; |
| data: { |
| [field: string]: any; |
| name: string; |
| type: string; |
| version: string; |
| main: string; |
| module: string; |
| browser: string | Record<string, string | false>; |
| exports: string | Record<string, any> | string[]; |
| imports: Record<string, any>; |
| dependencies: Record<string, string>; |
| }; |
| } |
| |
| |
| interface LicenseOptions { |
| |
| |
| |
| |
| |
| |
| fileName: string; |
| } |
| |
| |
| interface BuildEnvironmentOptions { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| target?: "baseline-widely-available" | EsbuildTarget | false; |
| |
| |
| |
| |
| |
| |
| polyfillModulePreload?: boolean; |
| |
| |
| |
| |
| |
| modulePreload?: boolean | ModulePreloadOptions; |
| |
| |
| |
| |
| |
| outDir?: string; |
| |
| |
| |
| |
| |
| assetsDir?: string; |
| |
| |
| |
| |
| |
| |
| |
| |
| assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined); |
| |
| |
| |
| |
| |
| |
| cssCodeSplit?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| cssTarget?: EsbuildTarget | false; |
| |
| |
| |
| |
| |
| cssMinify?: boolean | "lightningcss" | "esbuild"; |
| |
| |
| |
| |
| |
| |
| |
| sourcemap?: boolean | "inline" | "hidden"; |
| |
| |
| |
| |
| |
| minify?: boolean | "oxc" | "terser" | "esbuild"; |
| |
| |
| |
| |
| |
| |
| |
| terserOptions?: TerserOptions; |
| |
| |
| |
| |
| rollupOptions?: RolldownOptions; |
| |
| |
| |
| |
| rolldownOptions?: RolldownOptions; |
| |
| |
| |
| |
| commonjsOptions?: RollupCommonJSOptions; |
| |
| |
| |
| dynamicImportVarsOptions?: RollupDynamicImportVarsOptions; |
| |
| |
| |
| |
| write?: boolean; |
| |
| |
| |
| |
| emptyOutDir?: boolean | null; |
| |
| |
| |
| |
| copyPublicDir?: boolean; |
| |
| |
| |
| |
| |
| license?: boolean | LicenseOptions; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| manifest?: boolean | string; |
| |
| |
| |
| |
| |
| |
| lib?: LibraryOptions | false; |
| |
| |
| |
| |
| |
| ssr?: boolean | string; |
| |
| |
| |
| |
| |
| ssrManifest?: boolean | string; |
| |
| |
| |
| |
| ssrEmitAssets?: boolean; |
| |
| |
| |
| |
| emitAssets?: boolean; |
| |
| |
| |
| |
| |
| reportCompressedSize?: boolean; |
| |
| |
| |
| |
| chunkSizeWarningLimit?: number; |
| |
| |
| |
| |
| |
| watch?: WatcherOptions | null; |
| |
| |
| |
| createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment; |
| } |
| type BuildOptions = BuildEnvironmentOptions; |
| interface LibraryOptions { |
| |
| |
| |
| entry: InputOption; |
| |
| |
| |
| |
| name?: string; |
| |
| |
| |
| |
| formats?: LibraryFormats[]; |
| |
| |
| |
| |
| |
| fileName?: string | ((format: ModuleFormat, entryName: string) => string); |
| |
| |
| |
| |
| |
| cssFileName?: string; |
| } |
| type LibraryFormats = "es" | "cjs" | "umd" | "iife"; |
| interface ModulePreloadOptions { |
| |
| |
| |
| |
| |
| polyfill?: boolean; |
| |
| |
| |
| |
| resolveDependencies?: ResolveModulePreloadDependenciesFn; |
| } |
| interface ResolvedModulePreloadOptions { |
| polyfill: boolean; |
| resolveDependencies?: ResolveModulePreloadDependenciesFn; |
| } |
| type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: { |
| hostId: string; |
| hostType: "html" | "js"; |
| }) => string[]; |
| interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions, "polyfillModulePreload">> { |
| modulePreload: false | ResolvedModulePreloadOptions; |
| } |
| interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModulePreload">> { |
| modulePreload: false | ResolvedModulePreloadOptions; |
| } |
| |
| |
| |
| |
| declare function build(inlineConfig?: InlineConfig): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>; |
| type RenderBuiltAssetUrl = (filename: string, type: { |
| type: "asset" | "public"; |
| hostId: string; |
| hostType: "js" | "css" | "html"; |
| ssr: boolean; |
| }) => string | { |
| relative?: boolean; |
| runtime?: string; |
| } | undefined; |
| declare class BuildEnvironment extends BaseEnvironment { |
| mode: "build"; |
| isBuilt: boolean; |
| constructor(name: string, config: ResolvedConfig, setup?: { |
| options?: EnvironmentOptions; |
| }); |
| init(): Promise<void>; |
| } |
| interface ViteBuilder { |
| environments: Record<string, BuildEnvironment>; |
| config: ResolvedConfig; |
| buildApp(): Promise<void>; |
| build(environment: BuildEnvironment): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>; |
| runDevTools(): Promise<void>; |
| } |
| interface BuilderOptions { |
| |
| |
| |
| |
| |
| |
| sharedConfigBuild?: boolean; |
| |
| |
| |
| |
| |
| |
| sharedPlugins?: boolean; |
| buildApp?: (builder: ViteBuilder) => Promise<void>; |
| } |
| type ResolvedBuilderOptions = Required<BuilderOptions>; |
| |
| |
| |
| |
| declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>; |
| type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>; |
| |
| |
| type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment; |
| |
| |
| |
| |
| |
| |
| |
| declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State; |
| |
| |
| type SkipInformation = { |
| id: string; |
| importer: string | undefined; |
| plugin: Plugin; |
| called?: boolean; |
| }; |
| declare class EnvironmentPluginContainer<Env extends Environment = Environment> { |
| private _pluginContextMap; |
| private _resolvedRollupOptions?; |
| private _processesing; |
| private _seenResolves; |
| private _moduleNodeToLoadAddedImports; |
| getSortedPluginHooks: PluginHookUtils["getSortedPluginHooks"]; |
| getSortedPlugins: PluginHookUtils["getSortedPlugins"]; |
| moduleGraph: EnvironmentModuleGraph | undefined; |
| watchFiles: Set<string>; |
| minimalContext: MinimalPluginContext$1<Env>; |
| private _started; |
| private _buildStartPromise; |
| private _closed; |
| private _updateModuleLoadAddedImports; |
| private _getAddedImports; |
| getModuleInfo(id: string): ModuleInfo | null; |
| private handleHookPromise; |
| get options(): InputOptions; |
| resolveRollupOptions(): Promise<InputOptions>; |
| private _getPluginContext; |
| private hookParallel; |
| buildStart(_options?: InputOptions): Promise<void>; |
| resolveId(rawId: string, importer?: string | undefined, options?: { |
| kind?: ImportKind; |
| attributes?: Record<string, string>; |
| custom?: CustomPluginOptions; |
| skip?: Set<Plugin>; |
| skipCalls?: readonly SkipInformation[]; |
| |
| isEntry?: boolean; |
| }): Promise<PartialResolvedId | null>; |
| load(id: string): Promise<LoadResult | null>; |
| transform(code: string, id: string, options?: { |
| inMap?: SourceDescription["map"]; |
| moduleType?: string; |
| }): Promise<{ |
| code: string; |
| map: SourceMap | { |
| mappings: ""; |
| } | null; |
| moduleType?: ModuleType; |
| }>; |
| watchChange(id: string, change: { |
| event: "create" | "update" | "delete"; |
| }): Promise<void>; |
| close(): Promise<void>; |
| } |
| declare class BasicMinimalPluginContext<Meta = PluginContextMeta> { |
| meta: Meta; |
| private _logger; |
| constructor(meta: Meta, _logger: Logger); |
| get pluginName(): string; |
| debug(rawLog: string | RollupLog | (() => string | RollupLog)): void; |
| info(rawLog: string | RollupLog | (() => string | RollupLog)): void; |
| warn(rawLog: string | RollupLog | (() => string | RollupLog)): void; |
| error(e: string | RollupError): never; |
| private _normalizeRawLog; |
| } |
| declare class MinimalPluginContext$1<T extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext { |
| environment: T; |
| constructor(meta: PluginContextMeta, environment: T); |
| } |
| declare class PluginContainer { |
| private environments; |
| constructor(environments: Record<string, Environment>); |
| private _getEnvironment; |
| private _getPluginContainer; |
| getModuleInfo(id: string): ModuleInfo | null; |
| get options(): InputOptions; |
| buildStart(_options?: InputOptions): Promise<void>; |
| watchChange(id: string, change: { |
| event: "create" | "update" | "delete"; |
| }): Promise<void>; |
| resolveId(rawId: string, importer?: string, options?: { |
| attributes?: Record<string, string>; |
| custom?: CustomPluginOptions; |
| skip?: Set<Plugin>; |
| skipCalls?: readonly SkipInformation[]; |
| ssr?: boolean; |
| |
| isEntry?: boolean; |
| }): Promise<PartialResolvedId | null>; |
| load(id: string, options?: { |
| ssr?: boolean; |
| }): Promise<LoadResult | null>; |
| transform(code: string, id: string, options?: { |
| ssr?: boolean; |
| environment?: Environment; |
| inMap?: SourceDescription["map"]; |
| }): Promise<{ |
| code: string; |
| map: SourceMap | { |
| mappings: ""; |
| } | null; |
| }>; |
| close(): Promise<void>; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| interface ServerOptions$1 extends CommonServerOptions { |
| |
| |
| |
| hmr?: HmrOptions | boolean; |
| |
| |
| |
| |
| ws?: false; |
| |
| |
| |
| |
| warmup?: { |
| |
| |
| |
| clientFiles?: string[]; |
| |
| |
| |
| ssrFiles?: string[]; |
| }; |
| |
| |
| |
| |
| watch?: WatchOptions | null; |
| |
| |
| |
| |
| middlewareMode?: boolean | { |
| |
| |
| |
| |
| |
| server: HttpServer; |
| }; |
| |
| |
| |
| fs?: FileSystemServeOptions; |
| |
| |
| |
| |
| |
| origin?: string; |
| |
| |
| |
| |
| preTransformRequests?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean); |
| |
| |
| |
| |
| |
| |
| perEnvironmentStartEndDuringDev?: boolean; |
| |
| |
| |
| |
| |
| |
| perEnvironmentWatchChangeDuringDev?: boolean; |
| |
| |
| |
| |
| hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>; |
| forwardConsole?: boolean | ForwardConsoleOptions; |
| } |
| interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList" | "forwardConsole"> { |
| fs: Required<FileSystemServeOptions>; |
| middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>; |
| sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>; |
| forwardConsole: ResolvedForwardConsoleOptions; |
| } |
| interface FileSystemServeOptions { |
| |
| |
| |
| |
| |
| |
| |
| strict?: boolean; |
| |
| |
| |
| |
| |
| |
| allow?: string[]; |
| |
| |
| |
| |
| |
| |
| |
| |
| deny?: string[]; |
| } |
| type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>; |
| type HttpServer = http.Server | Http2SecureServer; |
| interface ViteDevServer { |
| |
| |
| |
| config: ResolvedConfig; |
| |
| |
| |
| |
| |
| |
| |
| |
| middlewares: Connect.Server; |
| |
| |
| |
| |
| httpServer: HttpServer | null; |
| |
| |
| |
| |
| |
| watcher: FSWatcher; |
| |
| |
| |
| ws: WebSocketServer; |
| |
| |
| |
| |
| hot: NormalizedHotChannel; |
| |
| |
| |
| pluginContainer: PluginContainer; |
| |
| |
| |
| environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>; |
| |
| |
| |
| |
| moduleGraph: ModuleGraph; |
| |
| |
| |
| |
| resolvedUrls: ResolvedServerUrls | null; |
| |
| |
| |
| |
| transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>; |
| |
| |
| |
| |
| |
| warmupRequest(url: string, options?: TransformOptions): Promise<void>; |
| |
| |
| |
| transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>; |
| |
| |
| |
| ssrTransform(code: string, inMap: SourceMap | { |
| mappings: ""; |
| } | null, url: string, originalCode?: string): Promise<TransformResult | null>; |
| |
| |
| |
| ssrLoadModule(url: string, opts?: { |
| fixStacktrace?: boolean; |
| }): Promise<Record<string, any>>; |
| |
| |
| |
| ssrRewriteStacktrace(stack: string): string; |
| |
| |
| |
| ssrFixStacktrace(e: Error): void; |
| |
| |
| |
| |
| reloadModule(module: ModuleNode): Promise<void>; |
| |
| |
| |
| listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>; |
| |
| |
| |
| close(): Promise<void>; |
| |
| |
| |
| printUrls(): void; |
| |
| |
| |
| bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void; |
| |
| |
| |
| |
| |
| restart(forceOptimize?: boolean): Promise<void>; |
| |
| |
| |
| openBrowser(): void; |
| |
| |
| |
| |
| |
| |
| waitForRequestsIdle: (ignoredId?: string) => Promise<void>; |
| } |
| interface ResolvedServerUrls { |
| local: string[]; |
| network: string[]; |
| } |
| declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Promise<ViteDevServer>; |
| |
| |
| interface HtmlTagDescriptor { |
| tag: string; |
| |
| |
| |
| attrs?: Record<string, string | boolean | undefined>; |
| children?: string | HtmlTagDescriptor[]; |
| |
| |
| |
| injectTo?: "head" | "body" | "head-prepend" | "body-prepend"; |
| } |
| type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | { |
| html: string; |
| tags: HtmlTagDescriptor[]; |
| }; |
| interface IndexHtmlTransformContext { |
| |
| |
| |
| path: string; |
| |
| |
| |
| filename: string; |
| server?: ViteDevServer; |
| bundle?: OutputBundle; |
| chunk?: OutputChunk; |
| originalUrl?: string; |
| } |
| type IndexHtmlTransformHook = (this: MinimalPluginContextWithoutEnvironment, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>; |
| type IndexHtmlTransform = IndexHtmlTransformHook | { |
| order?: "pre" | "post" | null; |
| handler: IndexHtmlTransformHook; |
| }; |
| |
| |
| type StringFilter<Value = string | RegExp> = Value | Array<Value> | { |
| include?: Value | Array<Value>; |
| exclude?: Value | Array<Value>; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| interface PluginContextExtension { |
| |
| |
| |
| environment: Environment; |
| } |
| interface PluginContextMetaExtension { |
| viteVersion: string; |
| } |
| interface ConfigPluginContext extends Omit<MinimalPluginContext, "meta" | "environment"> { |
| meta: Omit<PluginContextMeta, "watchMode">; |
| } |
| interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext, "environment"> {} |
| declare module "rolldown" { |
| interface MinimalPluginContext extends PluginContextExtension {} |
| interface PluginContextMeta extends PluginContextMetaExtension {} |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| interface Plugin<A = any> extends Rolldown.Plugin<A> { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| hotUpdate?: ObjectHook<(this: MinimalPluginContext & { |
| environment: DevEnvironment; |
| }, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>; |
| |
| |
| |
| resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: { |
| kind?: ImportKind; |
| custom?: CustomPluginOptions; |
| ssr?: boolean | undefined; |
| |
| isEntry: boolean; |
| }) => Promise<ResolveIdResult> | ResolveIdResult, { |
| filter?: { |
| id?: StringFilter<RegExp>; |
| }; |
| }>; |
| load?: ObjectHook<(this: PluginContext, id: string, options?: { |
| ssr?: boolean | undefined; |
| }) => Promise<LoadResult> | LoadResult, { |
| filter?: { |
| id?: StringFilter; |
| }; |
| }>; |
| transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: { |
| moduleType: ModuleType; |
| ssr?: boolean | undefined; |
| }) => Promise<Rolldown.TransformResult> | Rolldown.TransformResult, { |
| filter?: { |
| id?: StringFilter; |
| code?: StringFilter; |
| moduleType?: ModuleTypeFilter; |
| }; |
| }>; |
| |
| |
| |
| |
| |
| |
| |
| |
| sharedDuringBuild?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| perEnvironmentStartEndDuringDev?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| perEnvironmentWatchChangeDuringDev?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| enforce?: "pre" | "post"; |
| |
| |
| |
| apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean); |
| |
| |
| |
| |
| |
| applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption; |
| |
| |
| |
| |
| |
| |
| |
| |
| config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & { |
| /** |
| * Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`. |
| * Only intended to be used for backward compatibility. |
| */ |
| isSsrTargetWebworker?: boolean; |
| }) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>; |
| |
| |
| |
| configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| configureServer?: ObjectHook<ServerHook>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| configurePreviewServer?: ObjectHook<PreviewServerHook>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| transformIndexHtml?: IndexHtmlTransform; |
| |
| |
| |
| |
| |
| buildApp?: ObjectHook<BuildAppHook>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>; |
| |
| |
| |
| |
| |
| shouldTransformCachedModule?: ObjectHook<(this: PluginContext, options: { |
| code: string; |
| id: string; |
| meta: CustomPluginOptions; |
| moduleSideEffects: boolean | "no-treeshake"; |
| }) => boolean | null | void>; |
| } |
| type HookHandler<T> = T extends ObjectHook<infer H> ? H : T; |
| type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]> }; |
| type Thenable<T> = T | Promise<T>; |
| type FalsyPlugin = false | null | undefined; |
| type PluginOption = Thenable<Plugin | { |
| name: string; |
| } | FalsyPlugin | PluginOption[]>; |
| |
| |
| |
| declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin; |
| |
| |
| interface CSSOptions { |
| |
| |
| |
| |
| |
| |
| |
| |
| transformer?: "postcss" | "lightningcss"; |
| |
| |
| |
| modules?: CSSModulesOptions | false; |
| |
| |
| |
| |
| |
| |
| preprocessorOptions?: { |
| scss?: SassPreprocessorOptions; |
| sass?: SassPreprocessorOptions; |
| less?: LessPreprocessorOptions; |
| styl?: StylusPreprocessorOptions; |
| stylus?: StylusPreprocessorOptions; |
| }; |
| |
| |
| |
| |
| |
| |
| preprocessorMaxWorkers?: number | true; |
| postcss?: string | (PostCSS.ProcessOptions & { |
| plugins?: PostCSS.AcceptedPlugin[]; |
| }); |
| |
| |
| |
| |
| |
| devSourcemap?: boolean; |
| |
| |
| |
| lightningcss?: lightningcssOptions_LightningCSSOptions; |
| } |
| interface CSSModulesOptions { |
| getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void; |
| scopeBehaviour?: "global" | "local"; |
| globalModulePaths?: RegExp[]; |
| exportGlobals?: boolean; |
| generateScopedName?: string | ((name: string, filename: string, css: string) => string); |
| hashPrefix?: string; |
| |
| |
| |
| localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" | ((originalClassName: string, generatedClassName: string, inputFile: string) => string); |
| } |
| type ResolvedCSSOptions = Omit<CSSOptions, "lightningcss"> & Required<Pick<CSSOptions, "transformer" | "devSourcemap">> & { |
| lightningcss?: lightningcssOptions_LightningCSSOptions; |
| }; |
| interface PreprocessCSSResult { |
| code: string; |
| map?: SourceMapInput; |
| modules?: Record<string, string>; |
| deps?: Set<string>; |
| } |
| |
| |
| |
| declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>; |
| declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>; |
| type PreprocessorAdditionalDataResult = string | { |
| content: string; |
| map?: ExistingRawSourceMap; |
| }; |
| type PreprocessorAdditionalData = string | ((source: string, filename: string) => PreprocessorAdditionalDataResult | Promise<PreprocessorAdditionalDataResult>); |
| type SassPreprocessorOptions = { |
| additionalData?: PreprocessorAdditionalData; |
| } & SassModernPreprocessBaseOptions; |
| type LessPreprocessorOptions = { |
| additionalData?: PreprocessorAdditionalData; |
| } & LessPreprocessorBaseOptions; |
| type StylusPreprocessorOptions = { |
| additionalData?: PreprocessorAdditionalData; |
| } & StylusPreprocessorBaseOptions; |
| |
| |
| interface ESBuildOptions extends esbuildOptions_EsbuildTransformOptions { |
| include?: string | RegExp | ReadonlyArray<string | RegExp>; |
| exclude?: string | RegExp | ReadonlyArray<string | RegExp>; |
| jsxInject?: string; |
| |
| |
| |
| minify?: never; |
| } |
| type ESBuildTransformResult = Omit<EsbuildTransformResult, "map"> & { |
| map: SourceMap; |
| }; |
| declare function transformWithEsbuild(code: string, filename: string, options?: esbuildOptions_EsbuildTransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher, ignoreEsbuildWarning?: boolean): Promise<ESBuildTransformResult>; |
| |
| |
| interface JsonOptions { |
| |
| |
| |
| |
| namedExports?: boolean; |
| |
| |
| |
| |
| |
| |
| stringify?: boolean | "auto"; |
| } |
| |
| |
| type SSRTarget = "node" | "webworker"; |
| type SsrDepOptimizationConfig = DepOptimizationConfig; |
| interface SSROptions { |
| noExternal?: string | RegExp | (string | RegExp)[] | true; |
| external?: string[] | true; |
| |
| |
| |
| |
| |
| |
| target?: SSRTarget; |
| |
| |
| |
| |
| |
| |
| |
| |
| optimizeDeps?: SsrDepOptimizationConfig; |
| resolve?: { |
| |
| |
| |
| |
| |
| |
| |
| conditions?: string[]; |
| |
| |
| |
| |
| |
| externalConditions?: string[]; |
| mainFields?: string[]; |
| }; |
| } |
| interface ResolvedSSROptions extends SSROptions { |
| target: SSRTarget; |
| optimizeDeps: SsrDepOptimizationConfig; |
| } |
| |
| |
| interface OxcOptions extends Omit<rolldown_utils_TransformOptions, "cwd" | "sourceType" | "lang" | "sourcemap" | "helpers" | "inject" | "tsconfig" | "inputMap"> { |
| include?: string | RegExp | ReadonlyArray<string | RegExp>; |
| exclude?: string | RegExp | ReadonlyArray<string | RegExp>; |
| jsxInject?: string; |
| jsxRefreshInclude?: string | RegExp | ReadonlyArray<string | RegExp>; |
| jsxRefreshExclude?: string | RegExp | ReadonlyArray<string | RegExp>; |
| } |
| declare function transformWithOxc(code: string, filename: string, options?: rolldown_utils_TransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher): Promise<Omit<rolldown_utils_TransformResult, "errors">>; |
| |
| |
| interface ConfigEnv { |
| |
| |
| |
| |
| command: "build" | "serve"; |
| mode: string; |
| isSsrBuild?: boolean; |
| isPreview?: boolean; |
| } |
| |
| |
| |
| |
| |
| |
| |
| type AppType = "spa" | "mpa" | "custom"; |
| type UserConfigFnObject = (env: ConfigEnv) => UserConfig; |
| type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>; |
| type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>; |
| type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn; |
| |
| |
| |
| |
| |
| declare function defineConfig(config: UserConfig): UserConfig; |
| declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>; |
| declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject; |
| declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise; |
| declare function defineConfig(config: UserConfigFn): UserConfigFn; |
| declare function defineConfig(config: UserConfigExport): UserConfigExport; |
| interface CreateDevEnvironmentContext { |
| ws: WebSocketServer; |
| } |
| interface DevEnvironmentOptions { |
| |
| |
| |
| warmup?: string[]; |
| |
| |
| |
| |
| preTransformRequests?: boolean; |
| |
| |
| |
| |
| |
| sourcemap?: boolean | { |
| js?: boolean; |
| css?: boolean; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean); |
| |
| |
| |
| createEnvironment?: (name: string, config: ResolvedConfig, context: CreateDevEnvironmentContext) => Promise<DevEnvironment> | DevEnvironment; |
| |
| |
| |
| |
| |
| |
| recoverable?: boolean; |
| |
| |
| |
| |
| |
| moduleRunnerTransform?: boolean; |
| } |
| type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>, "sourcemapIgnoreList"> & { |
| sourcemapIgnoreList: Exclude<DevEnvironmentOptions["sourcemapIgnoreList"], false | undefined>; |
| }; |
| type AllResolveOptions = ResolveOptions & { |
| alias?: AliasOptions; |
| }; |
| interface SharedEnvironmentOptions { |
| |
| |
| |
| |
| define?: Record<string, any>; |
| |
| |
| |
| resolve?: EnvironmentResolveOptions; |
| |
| |
| |
| |
| consumer?: "client" | "server"; |
| |
| |
| |
| |
| keepProcessEnv?: boolean; |
| |
| |
| |
| optimizeDeps?: DepOptimizationOptions; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| isBundled?: boolean; |
| } |
| interface EnvironmentOptions extends SharedEnvironmentOptions { |
| |
| |
| |
| dev?: DevEnvironmentOptions; |
| |
| |
| |
| build?: BuildEnvironmentOptions; |
| } |
| type ResolvedResolveOptions = Required<ResolveOptions>; |
| type ResolvedEnvironmentOptions = { |
| define?: Record<string, any>; |
| resolve: ResolvedResolveOptions; |
| consumer: "client" | "server"; |
| keepProcessEnv?: boolean; |
| optimizeDeps: DepOptimizationOptions; |
| dev: ResolvedDevEnvironmentOptions; |
| build: ResolvedBuildEnvironmentOptions; |
| isBundled: boolean; |
| plugins: readonly Plugin[]; |
| }; |
| type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve" | "keepProcessEnv"> & { |
| resolve?: AllResolveOptions; |
| }; |
| interface UserConfig extends DefaultEnvironmentOptions { |
| |
| |
| |
| |
| |
| root?: string; |
| |
| |
| |
| |
| base?: string; |
| |
| |
| |
| |
| |
| |
| |
| |
| publicDir?: string | false; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| cacheDir?: string; |
| |
| |
| |
| |
| mode?: string; |
| |
| |
| |
| plugins?: PluginOption[]; |
| |
| |
| |
| html?: HTMLOptions; |
| |
| |
| |
| css?: CSSOptions; |
| |
| |
| |
| json?: JsonOptions; |
| |
| |
| |
| |
| |
| |
| esbuild?: ESBuildOptions | false; |
| |
| |
| |
| |
| oxc?: OxcOptions | false; |
| |
| |
| |
| assetsInclude?: string | RegExp | (string | RegExp)[]; |
| |
| |
| |
| |
| builder?: BuilderOptions; |
| |
| |
| |
| server?: ServerOptions$1; |
| |
| |
| |
| preview?: PreviewOptions; |
| |
| |
| |
| |
| |
| |
| |
| experimental?: ExperimentalOptions; |
| |
| |
| |
| future?: FutureOptions | "warn"; |
| |
| |
| |
| |
| |
| |
| legacy?: LegacyOptions; |
| |
| |
| |
| |
| logLevel?: LogLevel; |
| |
| |
| |
| customLogger?: Logger; |
| |
| |
| |
| clearScreen?: boolean; |
| |
| |
| |
| |
| |
| envDir?: string | false; |
| |
| |
| |
| |
| envPrefix?: string | string[]; |
| |
| |
| |
| worker?: { |
| |
| |
| |
| |
| format?: "es" | "iife"; |
| |
| |
| |
| |
| |
| plugins?: () => PluginOption[]; |
| |
| |
| |
| |
| rollupOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">; |
| |
| |
| |
| rolldownOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">; |
| }; |
| |
| |
| |
| optimizeDeps?: DepOptimizationOptions; |
| |
| |
| |
| |
| |
| ssr?: SSROptions; |
| |
| |
| |
| environments?: Record<string, EnvironmentOptions>; |
| |
| |
| |
| |
| |
| |
| appType?: AppType; |
| |
| |
| |
| |
| |
| |
| devtools?: boolean | DevToolsConfig; |
| } |
| interface HTMLOptions { |
| |
| |
| |
| |
| |
| cspNonce?: string; |
| } |
| interface FutureOptions { |
| removePluginHookHandleHotUpdate?: "warn"; |
| removePluginHookSsrArgument?: "warn"; |
| removeServerModuleGraph?: "warn"; |
| removeServerReloadModule?: "warn"; |
| removeServerPluginContainer?: "warn"; |
| removeServerHot?: "warn"; |
| removeServerTransformRequest?: "warn"; |
| removeServerWarmupRequest?: "warn"; |
| removeSsrLoadModule?: "warn"; |
| } |
| interface ExperimentalOptions { |
| |
| |
| |
| |
| |
| |
| importGlobRestoreExtension?: boolean; |
| |
| |
| |
| |
| |
| renderBuiltUrl?: RenderBuiltAssetUrl; |
| |
| |
| |
| |
| |
| |
| hmrPartialAccept?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| bundledDev?: boolean; |
| } |
| interface LegacyOptions { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| skipWebSocketTokenCheck?: boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| inconsistentCjsInterop?: boolean; |
| } |
| interface ResolvedWorkerOptions { |
| format: "es" | "iife"; |
| plugins: (bundleChain: string[]) => Promise<ResolvedConfig>; |
| |
| |
| |
| rollupOptions: RolldownOptions; |
| rolldownOptions: RolldownOptions; |
| } |
| interface InlineConfig extends UserConfig { |
| configFile?: string | false; |
| |
| configLoader?: "bundle" | "runner" | "native"; |
| |
| envFile?: false; |
| forceOptimizeDeps?: boolean; |
| } |
| interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "json" | "assetsInclude" | "optimizeDeps" | "worker" | "build" | "dev" | "environments" | "experimental" | "future" | "server" | "preview" | "devtools"> & { |
| configFile: string | undefined; |
| configFileDependencies: string[]; |
| inlineConfig: InlineConfig; |
| root: string; |
| base: string; |
| publicDir: string; |
| cacheDir: string; |
| command: "build" | "serve"; |
| mode: string; |
| isWorker: boolean; |
| isProduction: boolean; |
| envDir: string | false; |
| env: Record<string, any>; |
| resolve: Required<ResolveOptions> & { |
| alias: Alias[]; |
| }; |
| plugins: readonly Plugin[]; |
| css: ResolvedCSSOptions; |
| json: Required<JsonOptions>; |
| esbuild: ESBuildOptions | false; |
| oxc: OxcOptions | false; |
| server: ResolvedServerOptions; |
| dev: ResolvedDevEnvironmentOptions; |
| builder: ResolvedBuilderOptions | undefined; |
| build: ResolvedBuildOptions; |
| devtools: ResolvedDevToolsConfig; |
| preview: ResolvedPreviewOptions; |
| ssr: ResolvedSSROptions; |
| assetsInclude: (file: string) => boolean; |
| rawAssetsInclude: (string | RegExp)[]; |
| logger: Logger; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn; |
| optimizeDeps: DepOptimizationOptions; |
| worker: ResolvedWorkerOptions; |
| appType: AppType; |
| experimental: RequiredExceptFor<ExperimentalOptions, "renderBuiltUrl">; |
| future: FutureOptions | undefined; |
| environments: Record<string, ResolvedEnvironmentOptions>; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| webSocketToken: string; |
| } & PluginHookUtils> {} |
| interface PluginHookUtils { |
| getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[]; |
| getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[]; |
| } |
| type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>; |
| declare function resolveConfig(inlineConfig: InlineConfig, command: "build" | "serve", defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>; |
| declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]]; |
| declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: "bundle" | "runner" | "native"): Promise<{ |
| path: string; |
| config: UserConfig; |
| dependencies: string[]; |
| } | null>; |
| |
| |
| type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>; |
| |
| |
| |
| |
| declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn; |
| |
| |
| declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string; |
| |
| |
| |
| |
| |
| interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "fetchModule" | "hmr" | "transport"> { |
| |
| |
| |
| hmr?: false | { |
| logger?: ModuleRunnerHmr["logger"]; |
| }; |
| |
| |
| |
| evaluator?: ModuleEvaluator; |
| } |
| declare const createServerModuleRunnerTransport: (options: { |
| channel: NormalizedServerHotChannel; |
| }) => ModuleRunnerTransport; |
| |
| |
| |
| |
| declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner; |
| |
| |
| declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): RunnableDevEnvironment; |
| interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext, "hot"> { |
| runner?: (environment: RunnableDevEnvironment, options?: ServerModuleRunnerOptions) => ModuleRunner; |
| runnerOptions?: ServerModuleRunnerOptions; |
| hot?: boolean; |
| } |
| declare function isRunnableDevEnvironment(environment: Environment): environment is RunnableDevEnvironment; |
| declare class RunnableDevEnvironment extends DevEnvironment { |
| private _runner; |
| private _runnerFactory; |
| private _runnerOptions; |
| constructor(name: string, config: ResolvedConfig, context: RunnableDevEnvironmentContext); |
| get runner(): ModuleRunner; |
| override close(): Promise<void>; |
| } |
| |
| |
| interface FetchableDevEnvironmentContext extends DevEnvironmentContext { |
| handleRequest(request: Request): Promise<Response> | Response; |
| } |
| declare function createFetchableDevEnvironment(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext): FetchableDevEnvironment; |
| declare function isFetchableDevEnvironment(environment: Environment): environment is FetchableDevEnvironment; |
| declare class FetchableDevEnvironment extends DevEnvironment { |
| private _handleRequest; |
| constructor(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext); |
| dispatchFetch(request: Request): Promise<Response>; |
| } |
| |
| |
| interface RunnerImportResult<T> { |
| module: T; |
| dependencies: string[]; |
| } |
| |
| |
| |
| |
| declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>; |
| |
| |
| interface FetchModuleOptions { |
| cached?: boolean; |
| inlineSourceMap?: boolean; |
| startOffset?: number; |
| } |
| |
| |
| |
| |
| declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>; |
| |
| |
| interface ModuleRunnerTransformOptions { |
| json?: { |
| stringify?: boolean; |
| }; |
| } |
| declare function ssrTransform(code: string, inMap: SourceMap | { |
| mappings: ""; |
| } | null, url: string, originalCode: string, options?: ModuleRunnerTransformOptions): Promise<TransformResult | null>; |
| |
| |
| declare const VERSION: string; |
| declare const DEFAULT_CLIENT_MAIN_FIELDS: readonly string[]; |
| declare const DEFAULT_SERVER_MAIN_FIELDS: readonly string[]; |
| declare const DEFAULT_CLIENT_CONDITIONS: readonly string[]; |
| declare const DEFAULT_SERVER_CONDITIONS: readonly string[]; |
| declare const DEFAULT_EXTERNAL_CONDITIONS: readonly string[]; |
| declare const defaultAllowedOrigins: RegExp; |
| |
| |
| |
| |
| |
| type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null; |
| declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: { |
| resolve?: string | false | null; |
| }) => (id: unknown) => boolean; |
| declare const rollupVersion = "4.23.0"; |
| declare function normalizePath(id: string): string; |
| declare const isCSSRequest: (request: string) => boolean; |
| declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>; |
| declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined; |
| |
| |
| interface SendOptions { |
| etag?: string; |
| cacheControl?: string; |
| headers?: OutgoingHttpHeaders; |
| map?: SourceMap | { |
| mappings: ""; |
| } | null; |
| } |
| declare function send(req: http.IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void; |
| |
| |
| |
| |
| |
| declare function searchForWorkspaceRoot(current: string, root?: string): string; |
| |
| |
| |
| |
| |
| |
| declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean; |
| declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean; |
| |
| |
| |
| declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean; |
| |
| |
| declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>; |
| declare function resolveEnvPrefix({ |
| envPrefix |
| }: UserConfig): string[]; |
| |
| |
| type Manifest = Record<string, ManifestChunk>; |
| interface ManifestChunk { |
| |
| |
| |
| src?: string; |
| |
| |
| |
| file: string; |
| |
| |
| |
| css?: string[]; |
| |
| |
| |
| assets?: string[]; |
| |
| |
| |
| isEntry?: boolean; |
| |
| |
| |
| name?: string; |
| |
| |
| |
| |
| |
| isDynamicEntry?: boolean; |
| |
| |
| |
| |
| |
| imports?: string[]; |
| |
| |
| |
| |
| |
| dynamicImports?: string[]; |
| } |
| |
| |
| |
| declare const parseAst: typeof parseAst$1; |
| |
| declare const parseAstAsync: typeof parseAstAsync$1; |
| declare const esbuildVersion = "0.25.0"; |
| |
| export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter }; |