Expose publisher as a middleware attribute

Publisher is useful for unit-testing, and also to allow the 'warn' event
to be listened on, for debugging.