import webpack from 'webpack';
import { Options, Rule } from '@stylexjs/babel-plugin';

interface StyleXLoaderOptions {
    stylexImports: string[];
    stylexOption: Partial<Options>;
    nextjsMode: boolean;
}

type CSSTransformer = (css: string) => string | Buffer | Promise<string | Buffer>;
interface StyleXPluginOption {
    /**
     * stylex options passed to stylex babel plugin
     *
     * @see https://stylexjs.com/docs/api/configuration/babel-plugin/
     */
    stylexOption?: Partial<Options>;
    /**
     * Specify where stylex will be imported from
     *
     * @default ['stylex', '@stylexjs/stylex']
     */
    stylexImports?: string[];
    /**
     * Whether to use CSS layers
     *
     * @default false
     */
    useCSSLayers?: boolean;
    /**
     * Next.js Mode
     *
     * @default false
     */
    nextjsMode?: boolean;
    /**
     * Enable other CSS transformation
     *
     * Since stylex-webpack only inject CSS after all loaders, you can not use postcss-loader.
     * With this you can incovate `postcss()` here.
     */
    transformCss?: CSSTransformer;
}
type RegisterStyleXRules = (resourcePath: string, stylexRules: Rule[]) => void;
declare class StyleXPlugin {
    stylexRules: Map<string, readonly Rule[]>;
    useCSSLayers: boolean;
    loaderOption: StyleXLoaderOptions;
    transformCss: CSSTransformer;
    constructor({ stylexImports, useCSSLayers, stylexOption, nextjsMode, transformCss }?: StyleXPluginOption);
    apply(compiler: webpack.Compiler): void;
}

export { type RegisterStyleXRules, StyleXPlugin, type StyleXPluginOption };
