export interface BuildParams { root : string ; source : string ; target : string ; cleanup ? : boolean ; rebuildCommonJS ? : boolean ; updateExports ? : boolean ; buildScript ? : string | null ; } export type RequiredBuildParams = Required < BuildParams > ; const removeTrailing = [ 'source' , 'target' , ] ; /**
 * Clean up params
 */ export function cleanupParams ( params ) { const result = { ... params , cleanup : params . cleanup !== false , rebuildCommonJS : ! ! params . rebuildCommonJS , updateExports : params . updateExports !== false , buildScript : params . buildScript || null , } ; if ( result . root . slice ( - 1 ) !== '/' ) { result . root += '/' ; } removeTrailing . forEach ( ( attr ) => { const value = result [ attr ] ; if ( value . slice ( - 1 ) === '/' ) { result [ attr ] = value . slice ( 0 , value . length - 1 ) ; } } ) ; return result ; }