import { CloudflareInitOptions, InitPlatform } from "./init-platform.js";
import { getReactUpgradeDeps } from "./utils/react-version.js";

//#region src/init.d.ts
type InitOptions = {
  /** Project root directory */root: string; /** Dev server port (default: 3001), or false to omit the port flag. */
  port?: number | false; /** Skip the compatibility check step */
  skipCheck?: boolean; /** Force overwrite even if vite.config.ts exists */
  force?: boolean; /** Deployment target selected by the user */
  platform?: InitPlatform; /** Configure build-time pre-rendering for all discovered static routes */
  prerender?: boolean; /** Cloudflare cache and image choices. */
  cloudflare?: CloudflareInitOptions; /** Install missing dependencies with the detected package manager (default: true). */
  install?: boolean; /** Script naming style (default: namespaced, e.g. dev:vinext). */
  scriptNames?: "namespaced" | "standard"; /** @internal — override exec for testing (avoids ESM spy issues) */
  _exec?: (cmd: string, opts: {
    cwd: string;
    stdio: string;
  }) => string | void | Promise<string | void>; /** @internal — override pnpm ignored-builds inspection for testing */
  _inspectPnpmIgnoredBuilds?: (root: string) => string; /** @internal — stable compatibility date for snapshot tests */
  _today?: string;
};
type InitResult = {
  /** Whether dependencies were installed */installedDeps: string[]; /** Whether "type": "module" was added */
  addedTypeModule: boolean; /** CJS config files that were renamed ([old, new] pairs) */
  renamedConfigs: Array<[string, string]>; /** Whether scripts were added to package.json */
  addedScripts: string[]; /** Whether vite.config.ts was generated */
  generatedViteConfig: boolean; /** Whether vite.config.ts generation was skipped (already exists) */
  skippedViteConfig: boolean; /** Whether .gitignore was updated to include vinext-generated output */
  updatedGitignore: boolean; /** Deployment target configured by init */
  platform: InitPlatform; /** Platform-specific deployment files generated by init */
  generatedPlatformFiles: string[];
};
declare function generateViteConfig(_isAppRouter: boolean, prerender?: boolean): string;
/**
 * Add vinext scripts to package.json without overwriting existing scripts.
 * Returns the list of script names that were added.
 */
declare function addScripts(root: string, port: number | false, platform?: InitPlatform, options?: {
  warmCdnCache?: boolean;
  scriptNames?: "namespaced" | "standard";
}): string[];
type InitDependencyGroups = {
  dependencies: string[];
  devDependencies: string[];
};
declare function getInitDependencyGroups(isAppRouter: boolean, platform: InitPlatform): InitDependencyGroups;
declare function getInitDeps(isAppRouter: boolean, platform: InitPlatform): string[];
declare function isDepInstalled(root: string, dep: string): boolean;
/**
 * Ensure vinext-generated output directories are listed in .gitignore.
 * Creates the file if it doesn't exist. Returns true if the file was modified
 * (or created), false if all entries were already present.
 */
declare function updateGitignore(root: string, platform?: InitPlatform): boolean;
declare function init(options: InitOptions): Promise<InitResult>;
//#endregion
export { InitDependencyGroups, InitOptions, addScripts, generateViteConfig, getInitDependencyGroups, getInitDeps, getReactUpgradeDeps, init, isDepInstalled, updateGitignore };