import { Plugin } from 'esbuild';
import { AcceptedPlugin } from 'postcss';
import postcssModulesPlugin from 'postcss-modules';

type PostcssModulesOptions = Omit<Parameters<typeof postcssModulesPlugin>[0], 'getJSON' | 'globalModulePaths'>;
interface TailwindPluginOptions {
    /**
     * Custom PostCSS plugins to prepend or append to the default plugin chain.
     */
    postcssPlugins?: {
        /** Plugins to add before Tailwind and Autoprefixer. */
        prepend?: AcceptedPlugin[];
        /** Plugins to add after Tailwind and Autoprefixer. */
        append?: AcceptedPlugin[];
        /** Disable applying the Autoprefixer plugin. Defaults to `false`. */
        disableAutoprefixer?: boolean;
    };
    /**
     * CSS Modules configuration.
     */
    cssModules?: {
        /** Enable CSS Modules. Defaults to `true`. */
        enabled?: boolean;
        /** Regex to identify CSS Module files. Defaults to `/\.module\.css$/`. */
        filter?: RegExp;
        /** Regex patterns to exclude files from CSS Modules. */
        exclude?: RegExp[];
        /** Options to pass to postcss-modules. `getJSON` and `globalModulePaths` are managed internally. */
        options?: PostcssModulesOptions;
    };
}

declare const tailwindPlugin: (options?: TailwindPluginOptions) => Plugin;

export { tailwindPlugin as default, tailwindPlugin };
