@ordojs/dev-tools
Version:
Advanced developer tools for OrdoJS with component inspector, AST explorer, and performance profiling
119 lines (115 loc) • 3.24 kB
TypeScript
import { EventEmitter } from 'events';
import { B as BundleAnalysis } from '../index-D9DTurRB.js';
/**
* @fileoverview OrdoJS Dev Tools - Bundle Analyzer
*
* Bundle analyzer for analyzing bundle size, dependencies, and optimization opportunities.
*/
/**
* Bundle analyzer for analyzing bundle size and dependencies
*/
declare class BundleAnalyzer extends EventEmitter {
private analyses;
private isRunning;
private port;
/**
* Create a new BundleAnalyzer instance
*
* @param port - WebSocket port for bundle analyzer
*/
constructor(port?: number);
/**
* Start the bundle analyzer
*/
start(): Promise<void>;
/**
* Stop the bundle analyzer
*/
stop(): Promise<void>;
/**
* Analyze a bundle file
*
* @param bundlePath - Path to the bundle file
* @param bundleName - Name for the bundle analysis
* @returns Bundle analysis result
*/
analyzeBundle(bundlePath: string, bundleName: string): Promise<BundleAnalysis>;
/**
* Get bundle analysis by name
*
* @param bundleName - Bundle name
* @returns Bundle analysis or undefined
*/
getAnalysis(bundleName: string): BundleAnalysis | undefined;
/**
* Get all bundle analyses
*
* @returns Array of all bundle analyses
*/
getAllAnalyses(): BundleAnalysis[];
/**
* Compare two bundle analyses
*
* @param bundleName1 - First bundle name
* @param bundleName2 - Second bundle name
* @returns Comparison result
*/
compareBundles(bundleName1: string, bundleName2: string): {
sizeDifference: number;
sizeDifferencePercent: number;
moduleCountDifference: number;
dependencyCountDifference: number;
newModules: string[];
removedModules: string[];
newDependencies: string[];
removedDependencies: string[];
};
/**
* Get bundle optimization suggestions
*
* @param bundleName - Bundle name
* @returns Optimization suggestions
*/
getOptimizationSuggestions(bundleName: string): {
duplicateModules: string[];
largeModules: string[];
unusedDependencies: string[];
codeSplittingOpportunities: string[];
compressionOpportunities: string[];
};
/**
* Get bundle statistics
*
* @param bundleName - Bundle name
* @returns Bundle statistics
*/
getBundleStats(bundleName: string): {
totalSize: number;
gzippedSize: number;
moduleCount: number;
dependencyCount: number;
averageModuleSize: number;
largestModule: string;
largestModuleSize: number;
};
/**
* Clear all bundle analyses
*/
clearAnalyses(): void;
/**
* Simulate bundle analysis (placeholder implementation)
*
* @param bundlePath - Path to bundle file
* @param analysis - Analysis object to populate
*/
private simulateBundleAnalysis;
/**
* Start WebSocket server for bundle analyzer communication
*/
private startWebSocketServer;
/**
* Stop WebSocket server
*/
private stopWebSocketServer;
}
export { BundleAnalyzer };