import { Plugin } from 'esbuild';
import LazyPromise from 'p-lazy';
import { PackageJson } from 'type-fest';

interface OptionalConfig {
    /**
     * The editor to use when opening a new function.
     */
    editor?: string;
}
/**
 * The config located at `./radashi.json`
 */
interface UserConfig extends OptionalConfig {
    /**
     * Whether to emit TypeScript declaration files.
     *
     * @default false
     */
    dts?: boolean;
    /**
     * Control which bundle formats are used.
     *
     * @default ['esm']
     */
    formats?: ('esm' | 'cjs')[];
}
interface Config extends Required<Omit<UserConfig, keyof OptionalConfig>>, OptionalConfig {
}
interface Env {
    pkg: PackageJson;
    config: Config;
    configPath: string | null;
    root: string;
    modPath: string;
    outDir: string;
    radashiDir: string | null;
    overrideDir: string;
    radashiRef: LazyPromise<string>;
}

declare function esbuildRadashi(options?: {
    root?: string;
    env?: Env;
}): Plugin;

export { esbuildRadashi };
