import { AstroIntegration } from "astro"; /** * Adapter-specific options passed to the server entrypoint via a Vite virtual * module at build time. Runtime values like `buildClientDir` and * `buildServerDir` come from `app.manifest` instead. */ interface AdapterOptions { /** Hostname or boolean (`true` = `"0.0.0.0"`, `false` = `"localhost"`). */ host: string | boolean; /** Port the server listens on. */ port: number; /** Relative path to the adapter directory within `dist/server/` (e.g. `".astro-bun-adapter"`). Resolved at runtime against the server directory. */ adapterDir: string; /** * `Cache-Control` header for non-hashed static assets. Hashed assets * (`/_astro/*`) always use `public, max-age=31536000, immutable`. */ staticCacheControl: string; /** Image endpoint route with leading slash (e.g. "/_image"). */ imageEndpointRoute: string; /** * ISR (Incremental Static Regeneration) caching configuration. * `false` disables ISR; otherwise holds the resolved ISR options. */ isr: false | ISROptions; } /** Resolved ISR configuration passed to the server entrypoint. */ interface ISROptions { maxByteSize: number; cacheDir?: string; preFillMemoryCache: boolean; } /** * User-facing ISR (Incremental Static Regeneration) configuration options. * All properties are optional — omitted values use their documented defaults. */ interface ISRConfig { /** * Maximum byte size of the in-memory LRU cache. Entries evicted from memory * are persisted to disk and reloaded on demand. * * @default 50 * 1024 * 1024 // (50 MB) */ maxByteSize?: number; /** * Absolute path to the directory for persistent ISR cache storage. * * @default "/.astro-bun-adapter/isr-cache" */ cacheDir?: string; /** * Whether to pre-fill the in-memory LRU cache from disk at startup. When * `false`, the disk index is restored for L2 fallback but entries are only * loaded into memory on first access. * * @default false */ preFillMemoryCache?: boolean; } /** User-facing configuration for the Bun adapter. */ interface BunAdapterConfig { /** * Override the default `Cache-Control` header for non-hashed static assets. * Hashed assets under `/_astro/` always use * `public, max-age=31536000, immutable`. Route-level * `staticHeaders` still take precedence over this value. * * @default "public, max-age=86400, must-revalidate" */ staticCacheControl?: string; /** * Enable ISR (Incremental Static Regeneration). When `true`, SSR responses * with `s-maxage` and optional `stale-while-revalidate` Cache-Control * directives are cached in-memory (up to 50 MB by default) and served * according to standard cache semantics. Pass an object to customize the * maximum cache byte size. Disabled by default — zero overhead when off. * * @default false * * @example * // Use defaults (maxByteSize: 50 MB) * bun({ isr: true }) * * @example * // Custom cache byte size (100 MB) * bun({ isr: { maxByteSize: 100 * 1024 * 1024 } }) */ isr?: boolean | ISRConfig; } /** Create the Astro integration that configures and registers the Bun adapter. */ declare function bun(adapterConfig?: BunAdapterConfig): AstroIntegration; export { bun as default, ISRConfig, AdapterOptions };