import { type TtscWatchInput } from "./transform.cjs"; /** One module node inside a Vite module graph; opaque to this module. */ type ViteModuleNodeLike = object; /** * The module-graph surface this module touches, shared by Vite's mixed module * graph and the per-environment graphs of the environment API. */ interface ViteModuleGraphLike { fileToModulesMap?: Map>; getModulesByFile?(file: string): Set | undefined; invalidateModule?(node: ViteModuleNodeLike): void; } /** A channel that can deliver a full-reload event to connected clients. */ interface ViteHotChannelLike { send?(payload: { path?: string; type: "full-reload"; }): void; } /** One dev-server environment (client, ssr, or a custom one). */ interface ViteEnvironmentLike { hot?: ViteHotChannelLike; moduleGraph?: ViteModuleGraphLike; } /** * Minimal structural view of the Vite dev server. Declared locally instead of * importing `vite` so the published type declarations never require Vite to be * installed, and so one shape spans the mixed module graph (Vite 5), the * environment API (Vite 6+), and whichever of `ws`/`hot` a major still * carries. */ export interface ViteDevServerLike { config?: { root?: string; }; environments?: Record; hot?: ViteHotChannelLike; moduleGraph?: ViteModuleGraphLike; ws?: ViteHotChannelLike; } export interface ViteServeWatchOperations { /** Override case-policy discovery for a simulated host filesystem. */ caseSensitive?(directory: string): boolean; /** Override path semantics when testing a non-host platform. */ platform?: NodeJS.Platform; poll(listener: () => void): { close(): void; }; watch(root: string, listener: (eventType: string, file: string | null) => void, onError: () => void): { close(): void; }; } /** Serve-time compiler dependencies never enter Vite's runtime import graph. */ export interface ViteServeInputWatch { attach(server: ViteDevServerLike): void; begin(): number; dispose(): Promise; /** Release every compiler input owned by one removed source module. */ forget(importer: string): void; replace(importer: string, inputs: readonly TtscWatchInput[], failed?: boolean, startedAt?: number): void; } /** * A bounded recursive filesystem observer shared by all served modules. * * Vite resolves transform-context addWatchFile as a runtime import, including * type-only .server files and non-module plugin assets. Use a separate watcher * for compiler inputs, including node_modules, which Vite's watcher ignores. * Ordinary files use events after their initial subscription is observed. * Missing spellings and directory predicates use the recursive observer for * their nearest available scope. Inputs a native scope cannot safely cover * share one bounded fallback poll; linked files also share topology checks * because retargeting a junction need not emit events on its old descendants. */ export declare function createViteServeInputWatch(operations?: Partial): ViteServeInputWatch; export {};