import Plugins from "../plugins" ; import Promise from "../utils/promise" ; param { Output } return { Promise < Output > } function preparePlugins ( output ) { const book = output . getBook ( ) ; return ( Promise ( ) . then ( ( ) => { if ( book . isLanguageBook ( ) ) { return output . getPlugins ( ) ; } else { return Plugins . loadForBook ( book ) ; } } ) . then ( ( plugins ) => { return Plugins . validateConfig ( book , plugins ) . then ( ( newBook ) => { return output . merge ( { book : newBook , plugins : plugins , } ) ; } ) ; } ) ) ; } export default preparePlugins ;