import { Plugin } from 'vite'; import { TWDTheme } from '../ui/utils/theme'; /** * Options for the TWD Vite plugin. */ export interface TwdPluginOptions { /** * Glob pattern used to discover TWD test files via `import.meta.glob`. * @default "/**\/*.twd.test.ts" */ testFilePattern?: string; /** * Whether the TWD sidebar starts open. * @default true */ open?: boolean; /** * Side of the viewport the sidebar is anchored to. * @default "left" */ position?: 'left' | 'right'; /** * Whether to register the Mock Service Worker for request mocking. * @default true */ serviceWorker?: boolean; /** * URL of the Mock Service Worker script served by the app. * @default "/mock-sw.js" */ serviceWorkerUrl?: string; /** * Optional theme overrides for the sidebar UI. */ theme?: Partial; /** * Whether to show the search input in the sidebar. */ search?: boolean; /** * CSS selector for the host element used to mount the sidebar. */ rootSelector?: string; } /** * Vite plugin that auto-wires TWD into a dev server. * It exposes a virtual module that calls `initTWD` with a glob of test files * and injects a `