diff --git a/Target/master.d.ts b/Target/master.d.ts index 5c939d0..5ce9253 100644 --- a/Target/master.d.ts +++ b/Target/master.d.ts @@ -1,2 +1,3 @@ import type { IOptions } from "./protocol.js"; + export declare function spawnWorkers(options: IOptions): Promise; diff --git a/Target/progress-reporter.d.ts b/Target/progress-reporter.d.ts index 106378d..95767e1 100644 --- a/Target/progress-reporter.d.ts +++ b/Target/progress-reporter.d.ts @@ -1,21 +1,22 @@ import { type IFormatResults } from "./protocol.js"; + /** * Handles reporting progress of the formatting to the console. */ export declare class ProgressReporter { - private readonly check; - total: number; - reformatted: number; - failed: number; - private spinner?; - constructor(quiet: boolean, check: boolean); - /** - * Increments the count of the total and reformatted files. - */ - update(results: IFormatResults): void; - /** - * Prints a completion message. - */ - complete(): void; - private getMessage; + private readonly check; + total: number; + reformatted: number; + failed: number; + private spinner?; + constructor(quiet: boolean, check: boolean); + /** + * Increments the count of the total and reformatted files. + */ + update(results: IFormatResults): void; + /** + * Prints a completion message. + */ + complete(): void; + private getMessage; } diff --git a/Target/protocol.d.ts b/Target/protocol.d.ts index 5541a17..dbc1fe3 100644 --- a/Target/protocol.d.ts +++ b/Target/protocol.d.ts @@ -2,31 +2,31 @@ * MessageType delimits the kind of message sent in the formatter IPC. */ export declare enum MessageType { - WorkerInitialization = 0, - WorkerFiles = 1, - Formatted = 2, - Complete = 3 + WorkerInitialization = 0, + WorkerFiles = 1, + Formatted = 2, + Complete = 3, } export declare enum WorkerMode { - Write = 0, - Print = 1, - Assert = 2 + Write = 0, + Print = 1, + Assert = 2, } /** * An InitializationMessage is sent from * the master to queue work on its workers. */ export interface IInitializationMessage { - type: MessageType.WorkerInitialization; - mode: WorkerMode.Write; + type: MessageType.WorkerInitialization; + mode: WorkerMode.Write; } /** * IFiles is sent to queue files to format on the worker. */ export interface IFilesMessage { - type: MessageType.WorkerFiles; - files: IDiscoveredFile[]; - id: number; + type: MessageType.WorkerFiles; + files: IDiscoveredFile[]; + id: number; } /** * MasterMessage is sent from the cluster master to its workers. @@ -36,24 +36,24 @@ export type MasterMessage = IInitializationMessage | IFilesMessage; * Results returned from formatting files. */ export interface IFormatResults { - files: number; - failed: IDiscoveredFile[]; - formatted: IDiscoveredFile[]; + files: number; + failed: IDiscoveredFile[]; + formatted: IDiscoveredFile[]; } /** * Format message received from a worker. */ export interface IFormattedMessage extends IFormatResults { - type: MessageType.Formatted; - id: number; + type: MessageType.Formatted; + id: number; } /** * Discovered file item. */ export interface IDiscoveredFile { - cwd: string; - base: string; - path: string; + cwd: string; + base: string; + path: string; } /** * Mesage is sent from the worker to the parent process. @@ -63,10 +63,10 @@ export type WorkerMessage = IFormattedMessage; * Top-level options for the formatter. */ export interface IOptions { - check: boolean; - write: boolean; - concurrency: number; - quiet: boolean; - files: string[]; - ignorePath: string; + check: boolean; + write: boolean; + concurrency: number; + quiet: boolean; + files: string[]; + ignorePath: string; } diff --git a/Target/worker-pool.d.ts b/Target/worker-pool.d.ts index c877e44..3850962 100644 --- a/Target/worker-pool.d.ts +++ b/Target/worker-pool.d.ts @@ -1,24 +1,26 @@ import { Observable } from "rxjs"; + import { type IFormatResults, type IOptions } from "./protocol.js"; + export declare class WorkerExitedError extends Error { - constructor(codeOrSignal: number | string); + constructor(codeOrSignal: number | string); } /** * Pool of workers. */ export declare class WorkerPool { - private readonly options; - private readonly workers; - private workIdCounter; - /** - * Maximum size of the worker pool. - */ - get maxSize(): number; - constructor(options: IOptions); - /** - * Schedules the given files to be formatted. - */ - format(files: string[]): Observable | void; - private sortWorkers; - private spawnWorker; + private readonly options; + private readonly workers; + private workIdCounter; + /** + * Maximum size of the worker pool. + */ + get maxSize(): number; + constructor(options: IOptions); + /** + * Schedules the given files to be formatted. + */ + format(files: string[]): Observable | void; + private sortWorkers; + private spawnWorker; }