interface ICompilerEvents

Callback function types for compiler events.

Pass an object implementing any subset of these callbacks to FilterCompilerOptions.events or WorkerCompilerOptions.events. All handlers are optional; you only need to implement the events you care about.

Lifecycle order

onCompilationStart
  for each source:
    onSourceStart
    onSourceComplete  (or onSourceError)
  for each transformation (via bridge hook):
    onTransformationStart
    onTransformationComplete
  onProgress  (emitted throughout)
onCompilationComplete

Relationship to TransformationHookManager

onTransformationStart and onTransformationComplete are now routed through the hook system via a bridge hook rather than direct emitter calls. This is an implementation detail that is transparent to callers — the events still arrive at the same callbacks as before.

For async hooks or error hooks on individual transformations, use FilterCompilerOptions.hookManager with a TransformationHookManager.

Error safety

All handlers are wrapped in try-catch by CompilerEventEmitter.safeEmit(). Throwing inside a handler logs the error but does not abort compilation.

Properties

optional
onCompilationStart: (event: ICompilationStartEvent) => void

Called after validation passes, before any source is fetched.

Useful for: pre-flight logging, latency measurement, cache-warming.

optional
onSourceStart: (event: ISourceStartEvent) => void

Called when a source starts downloading

optional
onSourceComplete: (event: ISourceCompleteEvent) => void

Called when a source completes successfully

optional
onSourceError: (event: ISourceErrorEvent) => void

Called when a source fails to compile

Called when a transformation starts

Called when a transformation completes

optional
onProgress: (event: IProgressEvent) => void

Called to report progress

Called when compilation completes