UNPKG

@ima/cli

Version:

IMA.js CLI tool to build, develop and work with IMA.js applications.

53 lines (52 loc) 1.74 kB
import webpack from 'webpack'; import { ImaConfigurationContext } from '../../types'; /** * Helper class to track and display progress in the webpack.ProgressPlugin * across multiple configuration contexts. All configuration contexts are * tracked using one progress bar. */ declare class ProgressTracker { private _hasStarted; private _elapsed; private _trackedEntries; private _percentageTracker; private _progressBar; constructor(); /** * Register new webpack.PluginProgress instance. */ register(name: ImaConfigurationContext['name']): void; /** * Custom handler for webpack.ProgressPlugin, this should be called * from within the webpack.ProgressPlugin instance and handles all styling * and progress reporting. */ handler(name: ImaConfigurationContext['name'], percentage: number, msg: string, ...args: string[]): void; /** * Returns percentage between 0-100 computed across all tracked configurations. */ private _getPercentage; /** * Start progress bar reporting (renders progress bar with specified size). */ start(): void; /** * Update progress bar with new data. */ update(percentage: number, msg: string, other: string): void; /** * Stop progress bar rendering and end compilation reporting. */ stop(): void; } /** * Initializes wrapped webpack.ProgressPlugin * to track compilation progress. */ declare function createProgress(name: ImaConfigurationContext['name']): webpack.ProgressPlugin; /** * Provides access to the singleton progress instance * so i can be modified externally. */ declare function getProgress(): ProgressTracker; export { createProgress, getProgress };