Askr documentation
Generated API snapshot

@askrjs/vite/server

Exports from the declarations published in @askrjs/vite. Signatures reflect the published artifact.

Exports

This entrypoint publishes 12 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

ASKR_APP_MARKERtype

ASKR_APP_MARKER: "<!--askr-app-->"

Placeholder marker in `index.html` replaced with the rendered app fragment.

ASKR_HEAD_MARKERtype

ASKR_HEAD_MARKER: "<!--askr-head-->"

Placeholder marker in `index.html` replaced with rendered `<head>` content.

ASKR_SERVER_MODULE_IDtype

ASKR_SERVER_MODULE_ID: "virtual:askr-server"

Virtual module id that resolves to the generated server document app.

AskrDocumentOptionstype

AskrDocumentOptions: any

Options for composing a rendered Askr fragment into the HTML document.

telemetry
telemetry?: ViteTelemetry;

askrServertype

askrServer: (options: AskrServerOptions) => AskrServerPlugin

Create the Vite plugin that serves Askr's server-rendered document during development and generates the {@link ASKR_SERVER_MODULE_ID} virtual module that composes the built server app with the HTML document.

AskrServerOptionstype

AskrServerOptions: any

Options for {@link askrServer}.

entry
Path to the server entry module, resolved relative to the Vite root.
exportName
Named export on `entry` providing the `ServerApp`. Defaults to `"app"`, falling back to the default export.
indexHtml
Path to the HTML document template, resolved relative to the Vite root. Defaults to `"index.html"`.

AskrServerPlugintype

AskrServerPlugin: any

Portable public identity for the server integration plugin.

name
readonly name: "askr:server";

composeAskrDocumentResponsetype

composeAskrDocumentResponse: (response: Response, transformedDocument: string, options?: AskrDocumentOptions) => Promise<Response>

Compose an Askr fragment response into the full `transformedDocument` HTML, streaming the fragment's body between the document prefix and suffix. Non-fragment responses are returned unchanged.

composeAskrHeadtype

composeAskrHead: (document: string, head: string, lang?: string, dir?: string) => string

Replace the {@link ASKR_HEAD_MARKER} in `document` with normalized `head` markup, and patch the `<html>` tag's `lang`/`dir` attributes when given.

createDocumentApptype

createDocumentApp: (app: ServerApp, transformedDocument: string, options?: AskrDocumentOptions) => ServerApp

Wrap `app` so every response is composed into `transformedDocument` via {@link composeAskrDocumentResponse}.

insertAskrFragmenttype

insertAskrFragment: (document: string, fragment: string) => string

Replace the single {@link ASKR_APP_MARKER} in `document` with `fragment`.

isAskrFragmenttype

isAskrFragment: (response: Response) => boolean

Whether `response` carries the `askr-fragment=1` content-type marker.