import Debug from 'debug'; import * as esbuild from 'esbuild'; import { ImportInfo } from './parse'; import { Pkg } from './findPkg'; export declare const hasFile: (file: string) => Promise; export declare const pick: (obj: T, keys: (keyof T)[]) => T; type StatsOpt = boolean | 'tree' | 'table'; type BundleResult = { size: number; zippedSize: number; human: { size: string; zippedSize: string; }; pkg?: Pkg; pkgFile?: string; modulePkg?: Pkg; modulePkgFile?: string; stats?: string; }; export type MeasureResult = { importInfo: ImportInfo; result?: BundleResult; error?: Error | unknown; }; type MeasureOptions = { /** * whether to enable debug log * @default false */ debug?: boolean; /** * the format of stats */ stats?: StatsOpt; /** * whether to cache bundle result * @default false */ cache?: boolean; /** * custom log function */ log?: Debug.Debugger['log']; /** * the path of the workspace folder */ workspaceFolder?: string; /** * the files pattern to strip flow types */ flowPattern?: RegExp; /** * custom loader for esbuild */ loader?: esbuild.BuildOptions['loader']; /** * packages to exclude from bundle size calculation (passed to esbuild.external) */ external?: string[]; }; /** * Measure the bundle size of each import statement */ export declare function measureIterable(input: string, fileName?: string | null, { debug, log, stats, cache, workspaceFolder, flowPattern, loader, external, }?: MeasureOptions): AsyncGenerator; /** * Measure the bundle size of each import statement */ export declare const measure: (input: string, fileName?: string | null, opts?: MeasureOptions) => Promise; export {};