import { LoaderContext } from '@rspack/core'; interface CsvLoaderOptions { delimiter?: string; quote?: string; escape?: string; bom?: boolean; comment?: string | false; trim?: boolean; /** Generate TypeScript declaration file (.d.ts) */ emitTypes?: boolean; /** Output directory for generated type files (relative to output path) */ typesOutputDir?: string; /** Write .d.ts files to disk (useful for dev server) */ writeToDisk?: boolean; } interface CsvParseResult { /** Parsed CSV data as array of objects */ data: Record[]; /** Generated TypeScript type definition string (if emitTypes is true) */ typeDefinition?: string; /** Property configurations for the CSV columns */ propertyConfigs: PropertyConfig[]; } interface PropertyConfig { name: string; schema: any; validator: (value: unknown) => boolean; parser: (valueString: string) => unknown; } /** * Parse CSV content string into structured data with schema validation. * This is a standalone function that doesn't depend on webpack/rspack LoaderContext. * * @param content - CSV content string (must have at least headers + schema row + 1 data row) * @param options - Parsing options * @returns CsvParseResult containing parsed data and optional type definitions */ declare function parseCsv(content: string, options?: CsvLoaderOptions): CsvParseResult; /** * Generate JavaScript module code from CSV content. * Returns a string that can be used as a module export. * * @param content - CSV content string * @param options - Parsing options * @returns JavaScript module code string */ declare function csvToModule(content: string, options?: CsvLoaderOptions): { js: string; dts?: string; }; declare function csvLoader(this: LoaderContext, content: string): string | Buffer; export { type CsvLoaderOptions, type CsvParseResult, csvToModule, csvLoader as default, parseCsv };