Navigated to /docs/core/api/dev

Development and testing API

Experimental testing, validation, diagnostics, instrumentation, scheduling, inspection, overlays, configuration loading, and development servers.

Development and testing exports

55 public exports, grouped under their canonical import boundary.

@tavojs/core/dev

Canonical import boundary for every symbol in this section.

captureDiagnostics#

captureDiagnostics(): { traces: DevTraceEvent[]; mismatches: HydrationMismatchEvent[]; restore(): void; }

Captures diagnostics for the experimental development tooling.

Related guide

clearServices#

clearServices(): void

Clears the shared service registry. Intended primarily for tests.

Related guide

configureDevDiagnostics#

configureDevDiagnostics(options: DevDiagnosticsOptions): void

Updates runtime diagnostics callbacks used by the DOM renderer.

Related guide

createInstrumentation#

createInstrumentation(listener: TavoInstrumentationListener): TavoInstrumentation

Creates an isolated observer. Listener failures never interrupt framework work.

Related guide

createOpenTelemetryInstrumentation#

createOpenTelemetryInstrumentation(tracer: OpenTelemetryTracerLike, options?: { recordErrors?: boolean | undefined; } | undefined): TavoInstrumentation

Adapts Tavo.js events to the stable tracing subset shared by OpenTelemetry implementations.

Related guide

createPagesManifest#

createPagesManifest(modules: PageModules): PageRouteDefinition[]

Convenience helper returning only sorted route definitions.

Related guide

createPagesManifestDetailed#

createPagesManifestDetailed(modules: PageModules): PagesManifest

Builds the full pages manifest with routes, layouts, and diagnostics.

Related guide

createPagesTestHarness#

createPagesTestHarness(modules: PageModules, options?: PageRuntimeOptions | undefined): { runtime: PagesRuntime; renderPath(pathname: string): string; resolvePath(pathname: string): Promise<unknown>; }

Creates pages test harness for the experimental development tooling.

Related guide

createTestRoot#

createTestRoot(): TestRoot

Creates test root for the experimental development tooling.

Related guide

defineValidatedAction#

defineValidatedAction<TInput>(schema: TavoSchema<TInput>, handler: (context: ValidatedActionContext<TInput>) => void | Response | ActionResult | Promise<void | Response | ActionResult>, options?: PageActionOptions | undefined): PageAction

Defines a route action with portable schema validation and structured 400 failures.

Related guide

DevDiagnosticsOptions#

type DevDiagnosticsOptions = {
    enabled?: boolean;
    devMode?: boolean;
    onTrace?: ((event: DevTraceEvent) => void) | null;
    onHydrationMismatch?: ((event: HydrationMismatchEvent) => void) | null;
    onError?: ((error: unknown) => void) | null;
    strictHydration?: boolean;
};

Configures dev diagnostics in the experimental development tooling.

Related guide

DevTraceEvent#

type DevTraceEvent = {
    phase: DevTracePhase;
    kind: string;
    key?: string | number | null;
    detail?: string;
};

Describes an event emitted by dev trace in the experimental development tooling.

Related guide

DevTracePhase#

type DevTracePhase = "mount" | "patch" | "hydrate";

Defines the dev trace phase contract used by the experimental development tooling.

Related guide

expectTextContent#

expectTextContent(root: TestRoot, expected: string): void

Asserts text content for the experimental development tooling.

Related guide

flushMicrotasks#

flushMicrotasks(): Promise<void>

Flushes microtasks for the experimental development tooling.

Related guide

flushSync#

flushSync<T>(callback: () => T): T

Flushes sync for the experimental development tooling.

Related guide

getAutoPagesInspection#

getAutoPagesInspection(): AutoPagesInspection

Returns a privacy-safe snapshot for first-party development tools.

Related guide

getCurrentUpdatePriority#

getCurrentUpdatePriority(): UpdatePriority

Reads current update priority for the experimental development tooling.

Related guide

HydrationMismatchEvent#

type HydrationMismatchEvent = {
    message: string;
    expected?: string;
    found?: string;
    path?: string;
    pathSegments?: string[];
    phase?: DevTracePhase;
    kind?: string;
    recovery?: "text" | "subtree" | "cleanup";
};

Describes an event emitted by hydration mismatch in the experimental development tooling.

Related guide

inspectPages#

inspectPages(modules: PageModules): { routes: PageRouteDefinition[]; diagnostics: string[]; }

Returns route data and diagnostics without creating runtime objects.

Related guide

inspectPluginGraph#

inspectPluginGraph(config?: TavoPluginInput | undefined, options?: PluginCompileOptions | undefined): PluginGraphInspection

Returns a serializable inspection without executing plugin code.

Related guide

inspectTavoRuntime#

inspectTavoRuntime(): TavoDevtoolsSnapshot

Returns an inspection of tavo runtime for the experimental development tooling.

Related guide

installDevOverlay#

installDevOverlay(options?: { traces?: boolean | undefined; } | undefined): void

Enables a browser overlay for runtime errors and hydration mismatches during development.

Related guide

installTavoDevtoolsPanel#

installTavoDevtoolsPanel(options?: { target?: HTMLElement | undefined; initiallyOpen?: boolean | undefined; } | undefined): TavoDevtoolsPanel

Installs an opt-in, dependency-free browser panel backed by privacy-safe snapshots.

Related guide

loadTavoConfig#

loadTavoConfig(rootDir?: string | undefined, options?: LoadTavoConfigOptions | undefined): Promise<TavoConfig>

Loads the root `tavo.config.ts` default export once for the current process.

Related guide

LoadTavoConfigOptions#

type LoadTavoConfigOptions = {
    mode?: string;
};

Configures load tavo config in the experimental development tooling.

Related guide

OpenTelemetrySpanLike#

type OpenTelemetrySpanLike = {
    setAttribute?(name: string, value: string | number | boolean): unknown;
    recordException?(error: unknown): unknown;
    setStatus?(status: {
        code: number;
        message?: string;
    }): unknown;
    end?(endTime?: number): unknown;
};

Defines the open telemetry span like contract used by the experimental development tooling.

Related guide

OpenTelemetryTracerLike#

type OpenTelemetryTracerLike = {
    startSpan(name: string, options?: {
        attributes?: Record<string, string | number | boolean>;
        startTime?: number;
    }): OpenTelemetrySpanLike;
};

Defines the open telemetry tracer like contract used by the experimental development tooling.

Related guide

ParseSchema#

type ParseSchema<T> = {
    parse?(value: unknown): T;
    parseAsync?(value: unknown): Promise<T>;
};

Defines the parse schema contract used by the experimental development tooling.

Related guide

RunningDevServer#

type RunningDevServer = {
    close(): Promise<void>;
    url: string;
};

Defines the running dev server contract used by the experimental development tooling.

Related guide

runWithUpdatePriority#

runWithUpdatePriority<T>(priority: UpdatePriority, callback: () => T): T

Runs with update priority for the experimental development tooling.

Related guide

SafeParseSchema#

type SafeParseSchema<T> = {
    safeParse?(value: unknown): unknown;
    safeParseAsync?(value: unknown): Promise<unknown>;
};

Defines the safe parse schema contract used by the experimental development tooling.

Related guide

StandardSchema#

type StandardSchema<T> = {
    "~standard": {
        validate(value: unknown): {
            value: T;
            issues?: undefined;
        } | {
            value?: undefined;
            issues: ReadonlyArray<{
                message: string;
                path?: ReadonlyArray<PropertyKey | {
                    key: PropertyKey;
                }>;
            }>;
        } | Promise<{
            value: T;
            issues?: undefined;
        } | {
            value?: undefined;
            issues: ReadonlyArray<{
                message: string;
                path?: ReadonlyArray<PropertyKey | {
                    key: PropertyKey;
                }>;
            }>;
        }>;
    };
};

Defines the standard schema contract used by the experimental development tooling.

Related guide

startTransition#

startTransition(callback: () => void): void

Starts transition for the experimental development tooling.

Related guide

startViteAutoPagesDevServer#

startViteAutoPagesDevServer(options?: ViteAutoPagesDevServerOptions | undefined): Promise<RunningDevServer>

Starts a Vite middleware-mode server that SSR-renders file-based pages.

Related guide

subscribeTavoRuntime#

subscribeTavoRuntime(listener: (snapshot: TavoDevtoolsSnapshot) => void, options?: { immediate?: boolean | undefined; } | undefined): () => void

Subscribes to navigation and route lifecycle changes with privacy-safe snapshots.

Related guide

TavoDevtoolsPanel#

type TavoDevtoolsPanel = {
    element: HTMLElement;
    refresh(): void;
    dispose(): void;
};

Defines the tavo devtools panel contract used by the experimental development tooling.

Related guide

TavoDevtoolsSnapshot#

type TavoDevtoolsSnapshot = AutoPagesInspection & {
    dom: {
        mountedComponents: number;
        pendingPassiveEffects: number;
        pendingUpdates: number;
    };
};

Defines the tavo devtools snapshot contract used by the experimental development tooling.

Related guide

TavoInstrumentation#

type TavoInstrumentation = {
    emit(event: TavoInstrumentationEvent): void;
};

Defines the tavo instrumentation contract used by the experimental development tooling.

Related guide

TavoInstrumentationEvent#

type TavoInstrumentationEvent = {
    name: TavoInstrumentationEventName;
    phase: TavoInstrumentationPhase;
    timestamp: number;
    requestId?: string;
    route?: string;
    layer?: string;
    durationMs?: number;
    status?: number;
    count?: number;
    cacheTags?: string[];
    error?: unknown;
};

Describes an event emitted by tavo instrumentation in the experimental development tooling.

Related guide

TavoInstrumentationEventName#

type TavoInstrumentationEventName = "route.resolve" | "route.middleware" | "route.loader" | "route.action" | "route.cache";

Defines the tavo instrumentation event name contract used by the experimental development tooling.

Related guide

TavoInstrumentationListener#

type TavoInstrumentationListener = (event: TavoInstrumentationEvent) => void;

Defines a callback notified by tavo instrumentation in the experimental development tooling.

Related guide

TavoInstrumentationPhase#

type TavoInstrumentationPhase = "start" | "end" | "error" | "abort" | "hit" | "miss" | "invalidate";

Defines the tavo instrumentation phase contract used by the experimental development tooling.

Related guide

TavoSchema#

type TavoSchema<T> = StandardSchema<T> | SafeParseSchema<T> | ParseSchema<T>;

Defines the tavo schema contract used by the experimental development tooling.

Related guide

TestRoot#

type TestRoot = {
    container: HTMLElement;
    render(node: Child): void;
    hydrate(node: Child): void;
    unmount(): void;
    text(): string;
    html(): string;
};

Defines the test root contract used by the experimental development tooling.

Related guide

unregisterService#

unregisterService(identifier: ServiceIdentifier<unknown>): boolean

Removes a service registration. Intended primarily for tests.

Related guide

UpdatePriority#

type UpdatePriority = "immediate" | "user-blocking" | "normal" | "background" | "idle";

Defines the update priority contract used by the experimental development tooling.

Related guide

ValidatedActionContext#

type ValidatedActionContext<TInput> = PageActionContext & {
    input: TInput;
};

Provides the context passed to validated action in the experimental development tooling.

Related guide

validateInput#

validateInput<T>(schema: TavoSchema<T>, input: unknown): Promise<ValidationResult<T>>

Validates through Standard Schema or common safeParse/parse-compatible validators.

Related guide

ValidationFailure#

type ValidationFailure = {
    ok: false;
    issues: ValidationIssue[];
};

Defines the validation failure contract used by the experimental development tooling.

Related guide

ValidationIssue#

type ValidationIssue = {
    message: string;
    path?: ReadonlyArray<PropertyKey>;
};

Defines the validation issue contract used by the experimental development tooling.

Related guide

ValidationResult#

type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;

Describes the result returned by validation in the experimental development tooling.

Related guide

ValidationSuccess#

type ValidationSuccess<T> = {
    ok: true;
    value: T;
};

Defines the validation success contract used by the experimental development tooling.

Related guide

ViteAutoPagesDevServerOptions#

type ViteAutoPagesDevServerOptions = {
    root?: string;
    pagesDir?: string;
    cssEntries?: string[];
    mode?: string;
    images?: ImageOptimizerOptions;
    port?: number;
    host?: string;
};

Configures vite auto pages dev server in the experimental development tooling.

Related guide

ViteDevServerLike#

type ViteDevServerLike = {
    middlewares: (req: unknown, res: unknown, next: (error?: unknown) => void) => void;
    transformRequest(url: string, options?: {
        ssr?: boolean;
    }): Promise<null | {
        code: string;
    }>;
    pluginContainer?: {
        resolveId(id: string, importer?: string, options?: {
            ssr?: boolean;
        }): Promise<string | null | {
            id: string;
        }>;
    };
    ssrLoadModule(id: string): Promise<unknown>;
    ssrFixStacktrace(error: unknown): void;
    close(): Promise<void>;
};

Defines the vite dev server like contract used by the experimental development tooling.

Related guide