UNPKG

@ordojs/cli

Version:

Command-line interface for OrdoJS framework

179 lines 3.99 kB
/** * @fileoverview OrdoJS CLI - Asset optimization utilities for production builds */ /** * Asset optimization options */ export interface AssetOptimizationOptions { /** * Whether to minify JavaScript */ minifyJs?: boolean; /** * Whether to minify CSS */ minifyCss?: boolean; /** * Whether to generate Brotli compressed versions */ brotli?: boolean; /** * Whether to generate Gzip compressed versions */ gzip?: boolean; /** * Whether to generate size reports */ sizeReport?: boolean; /** * Terser options for JavaScript minification */ terserOptions?: any; } /** * Asset size information */ export interface AssetSizeInfo { /** * Original file size in bytes */ originalSize: number; /** * Minified file size in bytes */ minifiedSize?: number; /** * Gzip compressed size in bytes */ gzipSize?: number; /** * Brotli compressed size in bytes */ brotliSize?: number; /** * Compression ratio (1 - minifiedSize/originalSize) */ compressionRatio?: number; /** * Human-readable original size */ originalSizeHuman: string; /** * Human-readable minified size */ minifiedSizeHuman?: string; /** * Human-readable gzip size */ gzipSizeHuman?: string; /** * Human-readable brotli size */ brotliSizeHuman?: string; } /** * Optimization result for a single asset */ export interface AssetOptimizationResult { /** * Asset file path */ filePath: string; /** * Asset type */ type: 'js' | 'css' | 'html' | 'other'; /** * Size information */ sizes: AssetSizeInfo; /** * Whether minification was successful */ minified: boolean; /** * Whether Gzip compression was successful */ gzipped: boolean; /** * Whether Brotli compression was successful */ brotlified: boolean; } /** * Optimization results for all assets */ export interface OptimizationResults { /** * Results for individual assets */ assets: AssetOptimizationResult[]; /** * Total original size in bytes */ totalOriginalSize: number; /** * Total minified size in bytes */ totalMinifiedSize: number; /** * Total Gzip size in bytes */ totalGzipSize: number; /** * Total Brotli size in bytes */ totalBrotliSize: number; /** * Overall compression ratio */ overallCompressionRatio: number; /** * Human-readable total original size */ totalOriginalSizeHuman: string; /** * Human-readable total minified size */ totalMinifiedSizeHuman: string; /** * Human-readable total Gzip size */ totalGzipSizeHuman: string; /** * Human-readable total Brotli size */ totalBrotliSizeHuman: string; } /** * Asset optimizer for production builds */ export declare class AssetOptimizer { private options; /** * Create a new asset optimizer */ constructor(options?: AssetOptimizationOptions); /** * Optimize a JavaScript file */ optimizeJavaScript(filePath: string): Promise<AssetOptimizationResult>; /** * Optimize a CSS file * Note: Basic implementation - the actual CSS minification is handled by the CSS optimizer in the core package */ optimizeCSS(filePath: string): Promise<AssetOptimizationResult>; /** * Optimize an HTML file */ optimizeHTML(filePath: string): Promise<AssetOptimizationResult>; /** * Optimize a directory of assets */ optimizeDirectory(dir: string, patterns?: string[]): Promise<OptimizationResults>; /** * Generate a size report for the optimized assets */ generateSizeReport(results: OptimizationResults): string; } //# sourceMappingURL=asset-optimizer.d.ts.map