Ox Content

dev-server.ts

Source

shouldSkip

function

Check if a request URL should be skipped by the dev server middleware.

Source

function shouldSkip(url: string): boolean

Returns

boolean -


resolveMarkdownFile

function

Resolve a request URL to a markdown file path. Returns null if no matching file exists.

Source

async function resolveMarkdownFile(url: string, srcDir: string): Promise<string | null>

Returns

Promise<string | null> -


injectViteHmrClient

function

Inject Vite HMR client script into the HTML.

Source

function injectViteHmrClient(html: string): string

Returns

string -


DevServerCache

interface

Dev server state for caching.

Source


createDevServerCache

function

Create a dev server cache instance.

Source

export function createDevServerCache(): DevServerCache

Returns

DevServerCache -


invalidateNavCache

function

Invalidate navigation cache (called on file add/unlink).

Source

export function invalidateNavCache(cache: DevServerCache): void

Returns

void -


invalidatePageCache

function

Invalidate page cache for a specific file (called on file change).

Source

export function invalidatePageCache(cache: DevServerCache, filePath: string): void

Returns

void -


resolveSiteName

function

Resolve site name from options or package.json.

Source

async function resolveSiteName(options: ResolvedOptions, root: string): Promise<string>

Returns

Promise<string> -


renderPage

function

Render a single markdown page to full HTML.

Source


createDevServerMiddleware

function

Create the dev server middleware for SSG page serving.

Source

export function createDevServerMiddleware(
  options: ResolvedOptions,
  root: string,
  cache: DevServerCache,
  ): Connect.NextHandleFunction

Returns

Connect.NextHandleFunction -