Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type declaration #17

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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[];
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down