import * as binding from "@rspack/binding"; import { type Comparator } from "../util/comparators"; import type { Compilation } from "../Compilation"; import type { StatsOptions } from "../config"; import type { StatsFactory, StatsFactoryContext } from "./StatsFactory"; export type KnownStatsChunkGroup = binding.JsStatsChunkGroup; export type KnownStatsChunk = binding.JsStatsChunk; export type StatsChunkGroup = binding.JsStatsChunkGroup & Record; export type KnownStatsAsset = binding.JsStatsAsset; export type StatsAsset = KnownStatsAsset & Record; export type StatsChunk = KnownStatsChunk & Record; export type KnownStatsModule = Omit & { profile?: StatsProfile; usedExports?: null | string[] | boolean; providedExports?: null | string[]; optimizationBailout?: null | string[]; }; export type StatsProfile = KnownStatsProfile & Record; export type KnownStatsProfile = { total: number; resolving: number; integration: number; building: number; }; export type StatsModule = KnownStatsModule & Record; export type StatsModuleIssuer = binding.JsStatsModuleIssuer & Record; export type StatsError = binding.JsStatsError & Record; export type StatsWarnings = binding.JsStatsWarning & Record; export type StatsModuleReason = binding.JsStatsModuleReason & Record; export type KnownStatsCompilation = { /** * webpack version. * this is a hack to be compatible with plugin which detect webpack's version */ version?: string; /** rspack version */ rspackVersion?: string; name?: string; hash?: string; time?: number; builtAt?: number; publicPath?: string; outputPath?: string; assets?: StatsAsset[]; assetsByChunkName?: Record; chunks?: StatsChunk[]; modules?: StatsModule[]; entrypoints?: Record; namedChunkGroups?: Record; errors?: StatsError[]; errorsCount?: number; warnings?: StatsWarnings[]; warningsCount?: number; filteredModules?: number; children?: StatsCompilation[]; logging?: Record; }; export type StatsCompilation = KnownStatsCompilation & Record; export type StatsLogging = KnownStatsLogging & Record; export type KnownStatsLogging = { entries: StatsLoggingEntry[]; filteredEntries: number; debug: boolean; }; export type StatsLoggingEntry = KnownStatsLoggingEntry & Record; export type KnownStatsLoggingEntry = { type: string; message: string; trace?: string[] | undefined; children?: StatsLoggingEntry[] | undefined; args?: any[] | undefined; time?: number | undefined; }; export type KnownStatsChunkOrigin = { module?: string | undefined; moduleIdentifier?: string | undefined; moduleName?: string | undefined; loc?: string | undefined; request?: string | undefined; moduleId?: (string | number) | undefined; }; type ExtractorsByOption = { [x: string]: (object: O, data: T, context: StatsFactoryContext, options: any, factory: StatsFactory) => void; }; type PreprocessedAsset = StatsAsset & { type: string; related: PreprocessedAsset[]; }; export type SimpleExtractors = { compilation: ExtractorsByOption; asset$visible: ExtractorsByOption; asset: ExtractorsByOption; module: ExtractorsByOption; module$visible: ExtractorsByOption; moduleIssuer: ExtractorsByOption; profile: ExtractorsByOption; moduleReason: ExtractorsByOption; chunk: ExtractorsByOption; }; type KnownNormalizedStatsOptions = { context: string; }; export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit & Record; export declare const uniqueArray: (items: Iterable, selector: (arg: T) => Iterable) => I[]; export declare const uniqueOrderedArray: (items: Iterable, selector: (arg: T) => Iterable, comparator: Comparator) => I[]; export declare const iterateConfig: (config: Record>, options: NormalizedStatsOptions, fn: (a1: string, a2: Function) => void) => void; type Child = { children?: ItemChildren; filteredChildren?: number; }; type ItemChildren = Child[]; export declare const getTotalItems: (children: ItemChildren) => number; export declare const collapse: (children: ItemChildren) => Child[]; export declare const spaceLimited: (itemsAndGroups: ItemChildren, max: number, filteredChildrenLineReserved?: boolean) => { children: any; filteredChildren: any; }; export declare const countWithChildren: (compilation: Compilation, getItems: (compilation: Compilation, key: string) => any[]) => number; export declare const sortByField: (field: string) => (a1: Object, a2: Object) => number; export declare const assetGroup: (children: StatsAsset[]) => { size: number; }; export declare const moduleGroup: (children: KnownStatsModule[]) => { size: number; sizes: {}; }; export declare const mergeToObject: (items: { [key: string]: any; name: string; }[]) => Object; export declare function resolveStatsMillisecond(s: binding.JsStatsMillisecond): number; export {};