import { EventFactory } from '../types' ; export interface BuildEvent { name : 'build' ; isSuccess : boolean ; isDev : boolean ; duration : object ; } export const build = < EventFactory < BuildEvent > > function ( { nuxt } , payload ) { const duration = { build : payload . duration . build } ; let isSuccess = true ; for ( const [ name , stat ] of Object . entries < any > ( payload . stats ) ) { duration [ name ] = stat . duration ; if ( ! stat . success ) { isSuccess = false ; } } return { name : 'build' , isSuccess , isDev : nuxt . options . dev || false , duration } ; } ;