File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,30 +58,23 @@ const options: esbuild.BuildOptions = {
5858 format : "esm" ,
5959 target : "node20" ,
6060 logLevel : "warning" ,
61+ metafile : true ,
6162 logOverride : {
6263 "direct-eval" : "silent" ,
6364 } ,
6465 plugins : [
6566 {
6667 name : "watch-reporter" ,
6768 setup ( build ) {
68- const mtimes = new Map < string , number > ( ) ;
69- let isInitialBuild = true ;
7069 build . onEnd ( ( result ) => {
71- if ( result . errors . length > 0 ) return ;
72- const changed : string [ ] = [ ] ;
73- for ( const ep of entryPoints ) {
74- try {
75- const stats = fs . statSync ( ep ) ;
76- const lastMtime = mtimes . get ( ep ) ;
77- if ( lastMtime !== undefined && stats . mtimeMs > lastMtime ) {
78- changed . push ( ep ) ;
79- }
80- mtimes . set ( ep , stats . mtimeMs ) ;
81- } catch ( e ) { }
70+ if ( result . errors . length > 0 || ! result . metafile ) return ;
71+ const entryPoints = new Set < string > ( ) ;
72+ for ( const info of Object . values ( result . metafile . outputs ) ) {
73+ if ( info . entryPoint ) {
74+ entryPoints . add ( info . entryPoint ) ;
75+ }
8276 }
83- changed . forEach ( ( file ) => console . log ( `transpiled ${ file } ` ) ) ;
84- isInitialBuild = false ;
77+ entryPoints . forEach ( ( file ) => console . log ( `transpiled ${ file } ` ) ) ;
8578 } ) ;
8679 } ,
8780 } ,
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ Description:
4040
4141const BATCH_SIZE = 3 ;
4242const DEBOUNCE_MS = 100 ;
43+ const PADDING = 4 ;
4344
45+ let counter = 0 ;
4446let buffer : string [ ] = [ ] ;
4547let timeout : NodeJS . Timeout | null = null ;
4648
@@ -71,7 +73,11 @@ function flush() {
7173 console . error ( `stderr: ${ stderr } ` ) ;
7274 return ;
7375 }
74- files . forEach ( ( f ) => console . log ( `frmtd: ${ f } ` ) ) ;
76+ counter ++ ;
77+ const c = String ( counter ) . padStart ( PADDING , "0" ) ;
78+ files . forEach ( ( f ) => {
79+ console . log ( `frmtd: ${ c } ${ f } ` ) ;
80+ } ) ;
7581 } ) ;
7682}
7783
You can’t perform that action at this time.
0 commit comments