@@ -13,6 +13,7 @@ export interface AutomdResult extends TransformResult {
13
13
export async function automd (
14
14
_config : Config = { } ,
15
15
) : Promise < { results : AutomdResult [ ] ; _config : ResolvedConfig ; time : number } > {
16
+ const start = performance . now ( ) ;
16
17
const config = await loadConfig ( _config . dir , _config ) ;
17
18
18
19
let inputFiles = config . input ;
@@ -34,16 +35,16 @@ export async function automd(
34
35
35
36
const cache : ResultCache = new Map ( ) ;
36
37
37
- const start = performance . now ( ) ;
38
38
const results = await Promise . all (
39
39
inputFiles . map ( ( i ) => _automd ( i , config , multiFiles , cache ) ) ,
40
40
) ;
41
- const time = Math . round ( ( performance . now ( ) - start ) * 1000 ) / 1000 ;
42
41
43
42
if ( config . watch ) {
44
43
await _watch ( inputFiles , config , multiFiles , cache ) ;
45
44
}
46
45
46
+ const time = performance . now ( ) - start ;
47
+
47
48
return {
48
49
_config : config ,
49
50
time,
@@ -61,11 +62,13 @@ async function _automd(
61
62
multiFiles : boolean ,
62
63
cache : ResultCache ,
63
64
) : Promise < AutomdResult > {
65
+ const start = performance . now ( ) ;
64
66
const input = resolve ( config . dir , relativeInput ) ;
65
67
const contents = await fsp . readFile ( input , "utf8" ) ;
66
68
67
69
const cachedResult = await cache . get ( input ) ;
68
70
if ( cachedResult ?. contents === contents ) {
71
+ cachedResult . time = performance . now ( ) - start ;
69
72
return cachedResult ;
70
73
}
71
74
@@ -83,6 +86,7 @@ async function _automd(
83
86
...transformResult ,
84
87
} ;
85
88
cache . set ( input , result ) ;
89
+ result . time = performance . now ( ) - start ;
86
90
return result ;
87
91
}
88
92
0 commit comments