UNPKG

rollup-plugin-visualizer

Version:

Visualize and analyze bundle sizes and module dependencies in Rollup, Rolldown, and Vite.

58 lines (57 loc) • 1.74 kB
import type { BundlerOutputBundle, GetModuleInfo } from "./bundler-types.js"; import type { ModuleLengths, VisualizerData } from "../shared/types.js"; import { type Filter } from "../shared/create-filter.js"; type CodeContribution = { id: string; code: string | null; }; type Contribution = CodeContribution | { id: string; renderedLength: number; }; type ReportModule = { id: string; isEntry?: boolean; isExternal?: boolean; }; type CollectedModule = ReportModule & { bundles: Set<string>; isGraphNode: boolean; }; type ReportLink = { source: string; target: string; dynamic?: boolean; }; type ReportChunk = { id: string; } & ({ kind: "modules"; parts: Contribution[]; } | { kind: "fallback"; part: CodeContribution; }); export type CollectedReport = { chunks: (ReportChunk & { outputModuleIds: string[]; })[]; modules: Map<string, CollectedModule>; links: ReportLink[]; }; export type SelectedReport = { chunks: ReportChunk[]; modules: Map<string, ReportModule>; links: ReportLink[]; }; export declare const collectReport: (outputBundle: BundlerOutputBundle, options: { sourcemap: boolean; dir: string; getModuleInfo: GetModuleInfo; warn: (message: string) => void; }) => Promise<CollectedReport>; export declare const selectReport: (collected: CollectedReport, include: Filter | Filter[] | undefined, exclude: Filter | Filter[] | undefined) => SelectedReport; export declare const buildReport: (selected: SelectedReport, projectRoot: string | RegExp, measure: (part: CodeContribution) => Promise<ModuleLengths & { id: string; }>) => Promise<Pick<VisualizerData, "tree" | "nodeParts" | "nodeMetas">>; export {};