import type { RsbuildPlugin, Rspack } from '@rsbuild/core'; import type { Config as BaseSvgrOptions } from '@svgr/core'; import type { Config as SvgoConfig } from 'svgo'; // @svgr/core does not have the svgo dependency, so we need to // manually specify the svgoConfig type type SvgrOptions = Omit & { svgoConfig?: SvgoConfig; }; export type SvgDefaultExport = 'component' | 'url'; export type PluginSvgrOptions = { /** * Configure SVGR options. * @see https://react-svgr.com/docs/options/ */ svgrOptions?: SvgrOptions; /** * Whether to allow the use of default import and named import at the same time. * @default false */ mixedImport?: boolean; /** * Custom query suffix to match SVGR transformation. * @default /react/ */ query?: RegExp; /** * Whether to transform SVG modules into React components in parallel using worker * threads. When enabled, SVG modules are processed across multiple worker threads, * reducing pressure on the main thread and improving overall build performance * when compiling large numbers of SVG modules. * * Options transferred to worker threads must comply with the HTML structured clone * algorithm. For example, functions cannot be passed as options. * @see https://nodejs.org/api/worker_threads.html#portpostmessagevalue-transferlist * @default false */ parallel?: boolean; /** * Exclude specific SVG files from SVGR transformation. */ exclude?: Rspack.RuleSetCondition; /** * Exclude some modules, the SVGs imported by these modules will not be transformed by SVGR. */ excludeImporter?: Rspack.RuleSetCondition; }; export declare const PLUGIN_SVGR_NAME = 'rsbuild:svgr'; export declare const pluginSvgr: (options?: PluginSvgrOptions) => RsbuildPlugin; export { };