When using addSourceMiddleware, the middleware is only registered for certain event types. As such, whilst track and page events are successfully routed via custom registered middleware, the screen event type bypasses them entirely.
This appears to stem from the return for sourceMiddlewarePlugin which omits the screen event binding for the apply method, when it constructs the plugin object:
return {
name: `Source Middleware ${fn.name}`,
type: 'before',
version: '0.1.0',
isLoaded: (): boolean => true,
load: (ctx): Promise<Context> => Promise.resolve(ctx),
track: apply,
page: apply,
identify: apply,
alias: apply,
group: apply,
}
Is the omission of the screen binding here intentional?