dev-server.ts
shouldSkip
function
Check if a request URL should be skipped by the dev server middleware.
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.
async function resolveMarkdownFile(url: string, srcDir: string): Promise<string | null>
Returns
Promise<string | null> -
injectViteHmrClient
function
Inject Vite HMR client script into the HTML.
function injectViteHmrClient(html: string): string
Returns
string -
DevServerCache
interface
Dev server state for caching.
createDevServerCache
function
Create a dev server cache instance.
export function createDevServerCache(): DevServerCache
Returns
DevServerCache -
invalidateNavCache
function
Invalidate navigation cache (called on file add/unlink).
export function invalidateNavCache(cache: DevServerCache): void
Returns
void -
invalidatePageCache
function
Invalidate page cache for a specific file (called on file change).
export function invalidatePageCache(cache: DevServerCache, filePath: string): void
Returns
void -
resolveSiteName
function
Resolve site name from options or package.json.
async function resolveSiteName(options: ResolvedOptions, root: string): Promise<string>
Returns
Promise<string> -
renderPage
function
Render a single markdown page to full HTML.
createDevServerMiddleware
function
Create the dev server middleware for SSG page serving.
export function createDevServerMiddleware(
options: ResolvedOptions,
root: string,
cache: DevServerCache,
): Connect.NextHandleFunction
Returns
Connect.NextHandleFunction -