Sections

@calvinbonner/minifw API Reference

Version 0.2.1

core/shared

interface MiniContext

interface MiniContext {
  isHtmx: boolean;
  params: Record<string, string>;
  request: BunRequest;
  route?: string;
  url: URL;
}

Server context passed to MiniPage, MiniPartial, and MiniLayout render functions.

property isHtmx

Whether the request was made via HTMX (HX-Request header present).

boolean

property params

Route parameters extracted from the matched path pattern.

Record<string, string>

property request

The raw incoming Bun.BunRequest, including Bun-specific metadata.

BunRequest

property route

The matched route path used for route-specific rendering behavior.

string

property url

The parsed request URL.

URL

interface MiniHead

interface MiniHead {
  canonical?: string;
  description?: string;
  robots?: string;
  title?: string;
}

HTML <head> metadata for a MiniPage. All fields are optional and only rendered when provided.

property canonical

Canonical URL rendered in <link rel="canonical">.

string

property description

Meta description rendered in <meta name="description">.

string

property robots

Robots directive rendered in <meta name="robots">.

string

property title

Page title rendered in <title>.

string

type-alias MiniCacheOptions

type MiniCacheOptions = boolean | { ttl: number };

Cache behavior for render primitives.

  • true: cache indefinitely.
  • { ttl }: cache for ttl milliseconds.
  • false / undefined: do not cache.
boolean | { ttl: number }