class CompilerEventEmitter

Event emitter that wraps ICompilerEvents callbacks. Provides safe event emission with error handling and type safety.

Constructors

new
CompilerEventEmitter(
events?: ICompilerEvents,
logger?: IBasicLogger,
)

Creates a new CompilerEventEmitter

Properties

private
readonly
events: Readonly<ICompilerEvents>
private
readonly
logger: IBasicLogger

Methods

Emit compilation complete event

Emit compilation start event.

Fires after configuration validation passes but before any source is fetched. This is the earliest point at which sourceCount and transformationCount are guaranteed to be correct.

Emit progress event

Emit source complete event

Emit source error event

Emit source start event

Emit transformation complete event

Emit transformation start event

hasListeners(): boolean

Check if any event handlers are registered

Check if transformation-specific event handlers are registered.

Used by TransformationPipeline to decide whether to auto-wire the event-bridge hook. We check only onTransformationStart and onTransformationComplete rather than the broad hasListeners() to avoid registering hook overhead for unrelated listeners such as onProgress or onCompilationComplete.

private
safeEmit<K extends keyof EventMap>(
eventName: K,
event: EventMap[K],
): void

Safely emit an event, catching any errors thrown by handlers. This prevents user code from breaking the compilation process.