import { Options, Rule } from '@stylexjs/babel-plugin';
import * as webpack from 'webpack';
import { Buffer } from 'node:buffer';

interface StyleXLoaderOptions {
    stylexImports: string[];
    stylexOption: Partial<Options>;
    nextjsMode: boolean;
    nextjsAppRouterMode: 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;
    /**
     * Next.js App Router Mode
     *
     * @default false
     */
    nextjsAppRouterMode?: 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;
}
declare class StyleXPlugin {
    stylexRules: Map<string, readonly Rule[]>;
    useCSSLayers: boolean;
    loaderOption: StyleXLoaderOptions;
    transformCss: CSSTransformer;
    constructor({ stylexImports, useCSSLayers, stylexOption, nextjsMode, nextjsAppRouterMode, transformCss }?: StyleXPluginOption);
    apply(compiler: webpack.Compiler): void;
}

export { StyleXPlugin };
export type { StyleXPluginOption };
