import { type Tree } from '@nx/devkit'; import type { SetupViteGeneratorSchema } from './schema'; /** * Wires LensMCP into a host Vite project. Idempotent on every step. * * 1. Locate the project's vite.config.{ts,mts,js,mjs,cts,cjs}. * 2. Add `import { lensmcpVitePlugin } from '@lensmcp/vite-plugin'` * near the top (after the last existing import). * 3. Insert `lensmcpVitePlugin({ enabled: mode !== 'production' })` * into the `plugins` array if not already present. We do *not* * AST-edit — we use string heuristics on the standard * `defineConfig({ plugins: [...] })` shape. If the file is too * custom for the heuristics, we print a diff hint and bail. * 4. Add Nx targets: agent-dev, agent-build, agent-verify. */ export declare function setupViteGenerator(tree: Tree, rawOptions: SetupViteGeneratorSchema): Promise; export default setupViteGenerator; /** * String-heuristic patch: * * 1. If the file already imports `@lensmcp/vite-plugin` and mentions * `lensmcpVitePlugin(` in the plugins array, return unchanged. * 2. Otherwise insert the import near the top (after the last * `import …` line) and add the plugin call to the plugins array * declared by `plugins: [` (first occurrence). * * If neither anchor is found, return `null` so the generator can ask * the user to patch manually. */ export declare function patchViteConfig(src: string): string | null;