import { AliasOptions, InlineConfig } from 'vite';

interface BaseOptions {
    cwd: string;
    entry: string;
}
interface ServeOptions extends BaseOptions {
    watch: false | string | string[];
    port: number;
    outDir?: string;
}
interface BuildOptions extends BaseOptions {
    outDir: string;
    watch: boolean | string | string[];
}
interface UserConfig {
    /**
     * Specifies an object or an array of objects, which defines aliases
     * used to replace values in `import` statements.
     * With either format, the order of the entries is important,
     * in that the first defined rules are applied first.
     */
    alias?: AliasOptions;
    /**
     * Extends Vite's configuration. Will be merged with kirbyup's
     * default configuration. For example, you can define global constant replacements.
     *
     * @example
     * export default defineConfig({
     *   vite: {
     *    define: {
     *     __TEST__: JSON.stringify(process.env.TEST === 'true'),
     *   },
     * })
     */
    vite?: InlineConfig;
    /**
     * @deprecated Use `vite` instead.
     */
    extendViteConfig?: InlineConfig;
}

export type { BuildOptions as B, ServeOptions as S, UserConfig as U };
