diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..1841043 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,37 @@ +import { Plugin } from "rollup"; + +declare const analyzer: (options?: AnalyzerOptions) => Plugin; +export default analyzer; + +export interface AnalyzerOptions { + stdout?: boolean; + limit?: number; + filter?: string | string[] | ((id: string) => boolean); + root?: string; + hideDeps?: boolean; + showExports?: boolean; + summaryOnly?: boolean; + skipFormatted?: boolean; + writeTo?: (analysisString: string) => void; + transformModuleId?: (id: string) => string; + onAnalysis?: (analysisObject: AnalysisObject) => void; +} + +export interface AnalysisObject { + bundleSize: number; + bundleOrigSize: number; + bundleReduction: number; + moduleCount: number; + modules: Module[]; +} + +export interface Module { + id: string; + size: number; + origSize: number; + dependents: string[]; + percent: number; + reduction: number; + usedExports: string[]; + unusedExports: string[]; +} diff --git a/package.json b/package.json index bd74dc8..d2a917c 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,14 @@ "name": "rollup-plugin-analyzer", "version": "3.2.2", "description": "Mad metrics for your rollup bundles, know all the things", - "engines" : { "node" : ">=8.0.0" }, + "engines": { + "node": ">=8.0.0" + }, "main": "index.js", "module": "module.js", "files": [ "index.js", + "index.d.ts", "module.js" ], "scripts": {