@@ -16,6 +16,7 @@ import type { Watcher } from '@poppinss/chokidar-ts'
1616import type { DevServerOptions } from './types.js'
1717import { AssetsDevServer } from './assets_dev_server.js'
1818import { getPort , isDotEnvFile , isRcFile , runNode , watch } from './helpers.js'
19+ import prettyHrtime from 'pretty-hrtime'
1920
2021/**
2122 * Instance of CLIUI
@@ -101,6 +102,7 @@ export class DevServer {
101102 * Starts the HTTP server
102103 */
103104 #startHTTPServer( port : string , mode : 'blocking' | 'nonblocking' ) {
105+ let initialTime = process . hrtime ( )
104106 this . #httpServer = runNode ( this . #cwd, {
105107 script : this . #scriptFile,
106108 env : { PORT : port , ...this . #options. env } ,
@@ -110,6 +112,8 @@ export class DevServer {
110112
111113 this . #httpServer. on ( 'message' , ( message ) => {
112114 if ( this . #isAdonisJSReadyMessage( message ) ) {
115+ const readyAt = process . hrtime ( initialTime )
116+
113117 ui . sticker ( )
114118 . useColors ( this . #colors)
115119 . useRenderer ( this . #logger. getRenderer ( ) )
@@ -119,6 +123,7 @@ export class DevServer {
119123 `${ this . #isWatching ? 'enabled' : 'disabled' } `
120124 ) } `
121125 )
126+ . add ( `Ready in: ${ this . #colors. cyan ( prettyHrtime ( readyAt ) ) } ` )
122127 . render ( )
123128 }
124129 } )
@@ -129,13 +134,17 @@ export class DevServer {
129134 this . #onClose?.( result . exitCode )
130135 this . #watcher?. close ( )
131136 this . #assetsServer?. stop ( )
137+ } else {
138+ this . #logger. info ( 'Underlying HTTP server closed. Still watching for changes' )
132139 }
133140 } )
134141 . catch ( ( error ) => {
135142 if ( mode === 'nonblocking' ) {
136143 this . #onError?.( error )
137144 this . #watcher?. close ( )
138145 this . #assetsServer?. stop ( )
146+ } else {
147+ this . #logger. info ( 'Underlying HTTP server died. Still watching for changes' )
139148 }
140149 } )
141150 }
0 commit comments