/**
 * ViteDevServer - Vite-compatible dev server for browser environment
 * Serves files from VirtualFS with JSX/TypeScript transformation
 */
import { DevServer, DevServerOptions, ResponseData } from '../dev-server';
import { VirtualFS } from '../virtual-fs';
import { Buffer } from '../shims/stream';
export interface ViteDevServerOptions extends DevServerOptions {
    /**
     * Enable JSX transformation (default: true)
     */
    jsx?: boolean;
    /**
     * JSX factory function (default: 'React.createElement')
     */
    jsxFactory?: string;
    /**
     * JSX fragment function (default: 'React.Fragment')
     */
    jsxFragment?: string;
    /**
     * Auto-inject React import for JSX files (default: true)
     */
    jsxAutoImport?: boolean;
    /**
     * Enable SPA fallback - serve index.html for 404s on extensionless paths (default: false)
     */
    spaFallback?: boolean;
    /**
     * Path aliases for import resolution (e.g. { '~/': 'src/', '@/': 'src/' })
     */
    aliases?: Record<string, string>;
    /**
     * Enable TanStack Router route tree auto-generation (default: false)
     */
    tanstackRouter?: boolean;
    /**
     * Public directory for static assets mounted at the URL root (default: '<root>/public')
     */
    publicDir?: string | false;
    /** Deployment base path prefix (e.g., '/almostnode' for GitHub Pages subpath). NOT the same as Vite's `base`. */
    deploymentBasePath?: string;
    /**
     * Raw HTML injected at the very start of `<head>`, before import maps and
     * module scripts. Use for a bootstrap that must run before any app code —
     * e.g. installing an Electron preload / contextBridge bridge in the renderer.
     */
    injectHead?: string;
}
export declare class ViteDevServer extends DevServer {
    private watcherCleanup;
    private options;
    private hmrTargetWindow;
    private transformCache;
    private pendingInstalledPackagesCacheClear;
    private pendingRouteTreeRegen;
    private tailwindConfigScript;
    private tailwindConfigLoaded;
    private _dependencies;
    private _installedPackages;
    private publicDir;
    constructor(vfs: VirtualFS, options: ViteDevServerOptions);
    /**
     * Set the target window for HMR updates (typically iframe.contentWindow).
     * This enables HMR to work with sandboxed iframes via postMessage.
     * Pass null when the workspace detaches: the iframe element (and its
     * contentWindow identity) is shared across sandboxes, so a stale target
     * would deliver this server's updates into another sandbox's preview.
     */
    setHMRTarget(targetWindow: Window | null): void;
    clearInstalledPackagesCache(): void;
    private scheduleInstalledPackagesCacheClear;
    /**
     * Handle an incoming HTTP request
     */
    handleRequest(method: string, url: string, headers: Record<string, string>, body?: Buffer): Promise<ResponseData>;
    /**
     * Start file watching for HMR
     */
    startWatching(): void;
    /**
     * Handle file change event
     */
    private handleFileChange;
    /**
     * Stop the server
     */
    stop(): void;
    /**
     * Check if a file needs transformation
     */
    private needsTransform;
    private resolveModulePath;
    private servePublicFile;
    /**
     * Transform and serve a JSX/TS file
     */
    private transformAndServe;
    /**
     * Transform JSX/TS code to browser-compatible JavaScript
     */
    private transformCode;
    private addReactRefresh;
    /**
     * Rewrite path alias prefixes in import/export specifiers to relative paths
     */
    private rewriteAliases;
    /**
     * Schedule route tree regeneration (debounced)
     */
    private scheduleRouteTreeRegen;
    private getDependencies;
    private getInstalledPackages;
    /**
     * Packages handled by the import map injected into index.html.
     * These must NOT be rewritten by redirectNpmImports — the import map
     * already maps the bare specifiers to the correct CDN URLs.
     */
    private static IMPORT_MAP_PACKAGES;
    private redirectNpmImports;
    private serveNpmModule;
    /**
     * Serve CSS file as a JavaScript module that injects styles
     * This is needed because ES module imports of CSS files need to return JS
     */
    private serveCssAsModule;
    /**
     * Serve HTML file with HMR client script injected
     *
     * IMPORTANT: React Refresh preamble MUST be injected before any module scripts.
     * The preamble uses top-level await to block until React Refresh is loaded
     * and injectIntoGlobalHook is called. This ensures React Refresh hooks into
     * React BEFORE React is imported by any module.
     */
    private serveHtmlWithHMR;
    private rewriteHtmlModuleScriptSources;
    private loadTailwindConfigIfNeeded;
    private hasTailwindProjectMarker;
    private getTailwindInjection;
}
export default ViteDevServer;
//# sourceMappingURL=vite-dev-server.d.ts.map