import { Buffer } from 'node:buffer';
import { Plugin } from 'vite';

/**
 * 文件输出配置
 */
interface GenerateFile {
    /**
     * 文件输出位置，相对于输出目录，默认 ./output.txt
     */
    output?: string;
    /**
     * 文件输出格式：
     * - json-将data转换成JSON格式输出
     * - yaml-将data转换成yaml格式输出
     * - template-使用自定义模板
     * - raw-原样输出
     *
     * 默认json格式
     */
    type?: 'json' | 'yaml' | 'template' | 'raw';
    /**
     * devServer访问时返回的ContentType，默认根据output路径扩展名进行猜测
     */
    contentType?: string;
    /**
     * 输出使用的模板文件，在type为template时有效，无默认值
     */
    template?: string;
    /**
     * 输出使用的data
     */
    data?: Record<string, any> | Buffer | string;
}
type Options = GenerateFile | GenerateFile[];
/**
 * 插件入口
 */
declare function PluginGenerateFile(options: Options): Plugin;

export { type GenerateFile, type Options, PluginGenerateFile as default };
