@@ -16,6 +16,7 @@ import type { Watcher } from '@poppinss/chokidar-ts'
16
16
import type { DevServerOptions } from './types.js'
17
17
import { AssetsDevServer } from './assets_dev_server.js'
18
18
import { getPort , isDotEnvFile , isRcFile , runNode , watch } from './helpers.js'
19
+ import prettyHrtime from 'pretty-hrtime'
19
20
20
21
/**
21
22
* Instance of CLIUI
@@ -101,6 +102,7 @@ export class DevServer {
101
102
* Starts the HTTP server
102
103
*/
103
104
#startHTTPServer( port : string , mode : 'blocking' | 'nonblocking' ) {
105
+ let initialTime = process . hrtime ( )
104
106
this . #httpServer = runNode ( this . #cwd, {
105
107
script : this . #scriptFile,
106
108
env : { PORT : port , ...this . #options. env } ,
@@ -110,6 +112,8 @@ export class DevServer {
110
112
111
113
this . #httpServer. on ( 'message' , ( message ) => {
112
114
if ( this . #isAdonisJSReadyMessage( message ) ) {
115
+ const readyAt = process . hrtime ( initialTime )
116
+
113
117
ui . sticker ( )
114
118
. useColors ( this . #colors)
115
119
. useRenderer ( this . #logger. getRenderer ( ) )
@@ -119,6 +123,7 @@ export class DevServer {
119
123
`${ this . #isWatching ? 'enabled' : 'disabled' } `
120
124
) } `
121
125
)
126
+ . add ( `Ready in: ${ this . #colors. cyan ( prettyHrtime ( readyAt ) ) } ` )
122
127
. render ( )
123
128
}
124
129
} )
@@ -129,13 +134,17 @@ export class DevServer {
129
134
this . #onClose?.( result . exitCode )
130
135
this . #watcher?. close ( )
131
136
this . #assetsServer?. stop ( )
137
+ } else {
138
+ this . #logger. info ( 'Underlying HTTP server closed. Still watching for changes' )
132
139
}
133
140
} )
134
141
. catch ( ( error ) => {
135
142
if ( mode === 'nonblocking' ) {
136
143
this . #onError?.( error )
137
144
this . #watcher?. close ( )
138
145
this . #assetsServer?. stop ( )
146
+ } else {
147
+ this . #logger. info ( 'Underlying HTTP server died. Still watching for changes' )
139
148
}
140
149
} )
141
150
}
0 commit comments