AssetServer

View Source

Signature

interface AssetServer {
  close(): Promise<void>;
  fetch(request: Request): Promise<Response | null>;
  getHref(filePath: string): Promise<string>;
  getPreloads(filePath: string | readonly string[]): Promise<string[]>;
}

Methods

close(): Promise

Closes any watcher resources owned by this server instance.

fetch(request: Request): Promise<Response | null>

Serves a script or style request. Returns Response | null — null means the request was not handled by this server, letting the router fall through to a 404.

request

getHref(filePath: string): Promise

Returns the request href for a served asset file.

filePath

getPreloads(filePath: string | readonly string[]): Promise<string[]>

Returns preload URLs for one or more served asset files, ordered shallowest-first.

filePath