@@ -11,6 +11,7 @@ import picomatch from 'picomatch'
11
11
import { relative } from 'node:path'
12
12
import type tsStatic from 'typescript'
13
13
import prettyHrtime from 'pretty-hrtime'
14
+ import { fileURLToPath } from 'node:url'
14
15
import { type ExecaChildProcess } from 'execa'
15
16
import { cliui , type Logger } from '@poppinss/cliui'
16
17
import type { Watcher } from '@poppinss/chokidar-ts'
@@ -168,7 +169,7 @@ export class DevServer {
168
169
* Starts the HTTP server
169
170
*/
170
171
#startHTTPServer( port : string , mode : 'blocking' | 'nonblocking' ) {
171
- const hooksArgs = { colors : ui . colors , logger : this . #logger }
172
+ const hooksArgs = { colors : this . # colors, logger : this . #logger }
172
173
this . #httpServer = runNode ( this . #cwd, {
173
174
script : this . #scriptFile,
174
175
env : { PORT : port , ...this . #options. env } ,
@@ -185,16 +186,16 @@ export class DevServer {
185
186
* Handle Hot-Hook messages
186
187
*/
187
188
if ( this . #isHotHookMessage( message ) ) {
188
- const path = relative ( this . #cwd. pathname , message . path || message . paths ?. [ 0 ] ! )
189
+ const path = relative ( fileURLToPath ( this . #cwd) , message . path || message . paths ?. [ 0 ] ! )
189
190
this . #hooks. onSourceFileChanged ( hooksArgs , path )
190
191
191
192
if ( message . type === 'hot-hook:full-reload' ) {
192
193
this . #clearScreen( )
193
- this . #logger. log ( `${ ui . colors . green ( 'full-reload' ) } ${ path } ` )
194
+ this . #logger. log ( `${ this . # colors. green ( 'full-reload' ) } ${ path } ` )
194
195
this . #restartHTTPServer( port )
195
196
this . #hooks. onDevServerStarted ( hooksArgs )
196
197
} else if ( message . type === 'hot-hook:invalidated' ) {
197
- this . #logger. log ( `${ ui . colors . green ( 'invalidated' ) } ${ path } ` )
198
+ this . #logger. log ( `${ this . # colors. green ( 'invalidated' ) } ${ path } ` )
198
199
}
199
200
}
200
201
@@ -296,7 +297,6 @@ export class DevServer {
296
297
* Handles TypeScript source file change
297
298
*/
298
299
async #handleSourceFileChange( action : string , port : string , relativePath : string ) {
299
- console . log ( { relativePath } )
300
300
await this . #hooks. onSourceFileChanged ( { colors : ui . colors , logger : this . #logger } , relativePath )
301
301
302
302
this . #clearScreen( )
0 commit comments