type alias StaticPluginOptions
Since 0.1.0

Options for configuring the StaticPlugin.

Properties

root: string

Required. The filesystem directory to serve files from.

optional
fs: IFileSystem

The filesystem to use for file operations.

optional
urlPrefix: string

URL prefix for static routes (default: '/').

optional
index: string

Index file to serve when a directory is requested (default: 'index.html'). Set to empty string '' to disable index resolution.

optional
fallback: string

Fallback file to serve for missing paths when Accept includes text/html (default: undefined). Used for SPA fallback.

optional
cacheControl: string | ((relativePath: string) => string)

Cache-Control header configuration (default: function returning immutable for hashed assets, must-revalidate for others).

  • A string is used verbatim for all responses.
  • A function is called per request with the root-relative path.
optional
etag: boolean

Enable ETag generation (default: true).

optional
ranges: boolean

Enable Range request handling (default: true).

optional
compressed: boolean

Enable precompressed sidecar negotiation (default: true).

optional
maxBufferBytes: number

Maximum file size to read fully into memory (default: 1MB). Files larger than this will use streaming when available.

Usage

import { type StaticPluginOptions } from "static-plugin/src/index.ts";