diff --git a/src/rollup.js b/src/rollup.js index e0db03e..2ab5b51 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -61,7 +61,7 @@ export function rollup ( options ) { timeEnd( '--BUILD--' ); function generate ( options ) { - timeStart( '--GENERATE--' ) + timeStart( '--GENERATE--' ); const rendered = bundle.render( options ); diff --git a/src/utils/flushTime.js b/src/utils/flushTime.js index e54e1b2..fb4d331 100644 --- a/src/utils/flushTime.js +++ b/src/utils/flushTime.js @@ -1,7 +1,7 @@ const DEBUG = false; const map = new Map; -export function timeStart( label ) { +export function timeStart ( label ) { if ( !map.has( label ) ) { map.set( label, { time: 0 @@ -10,26 +10,28 @@ export function timeStart( label ) { map.get( label ).start = process.hrtime(); } -export function timeEnd( label ) { +export function timeEnd ( label ) { if ( map.has( label ) ) { const item = map.get( label ); item.time += toMilliseconds( process.hrtime( item.start ) ); } } -export function flushTime( log = defaultLog ) { +export function flushTime ( log = defaultLog ) { for ( const item of map.entries() ) { log( item[0], item[1].time ); } map.clear(); } -function toMilliseconds( time ) { +function toMilliseconds ( time ) { return time[0] * 1e+3 + Math.floor( time[1] * 1e-6 ); } -function defaultLog( label, time ) { +function defaultLog ( label, time ) { if ( DEBUG ) { + /* eslint-disable no-console */ console.info( '%dms: %s', time, label ); + /* eslint-enable no-console */ } }