function createEventBridgeHook
createEventBridgeHook(eventEmitter: { emitTransformationStart: (event: { name: string; inputCount: number; }) => void; emitTransformationComplete: (event: { name: string; inputCount: number; outputCount: number; durationMs: number; }) => void; }): TransformationHookConfig

Create a hook configuration that bridges the transformation hook system into the compiler's ICompilerEvents / CompilerEventEmitter event bus.

Why this exists

The TransformationPipeline previously called eventEmitter.emitTransformationStart / emitTransformationComplete directly inside its transform loop. When the pipeline was updated to use hooks instead, those direct calls were removed to avoid double-firing. This factory re-implements that forwarding as a hook so the existing ICompilerEvents.onTransformationStart / onTransformationComplete callbacks continue to work with no changes on the caller side.

How it's used automatically

FilterCompiler and WorkerCompiler automatically create and register this bridge hook when ICompilerEvents listeners are present but no custom hookManager is provided:

new FilterCompiler({ events: { onTransformationStart: (e) => … } })
       ↓ internally
resolvedHookManager = new TransformationHookManager(createEventBridgeHook(emitter))

This means existing code that uses ICompilerEvents continues to receive transformation events without any changes.

Using it explicitly

You can also use it explicitly when you want to add your own hooks and keep ICompilerEvents working:

const hookManager = new TransformationHookManager();
hookManager
  .onBeforeTransform(myCustomHook)
  .onAfterTransform(myTimingHook);

// Manually wire in the bridge so onTransformationStart / Complete still fire
const bridge = createEventBridgeHook(eventEmitter);
for (const h of bridge.beforeTransform ?? []) hookManager.onBeforeTransform(h);
for (const h of bridge.afterTransform  ?? []) hookManager.onAfterTransform(h);

When you pass hookManager to FilterCompilerOptions, the compiler detects that both a custom hook manager and an event emitter with listeners are present, and performs this bridging automatically.

Parameters

eventEmitter: { emitTransformationStart: (event: { name: string; inputCount: number; }) => void; emitTransformationComplete: (event: { name: string; inputCount: number; outputCount: number; durationMs: number; }) => void; }
  • An object exposing emitTransformationStart and emitTransformationComplete. In practice this is always a CompilerEventEmitter, but the interface is duck-typed so it works with mocks in tests.

Return Type

A TransformationHookConfig with beforeTransform and afterTransform arrays populated. onError is intentionally omitted — ICompilerEvents has no error hook for transformations.