@@ -83,11 +83,6 @@ export class DevServer {
83
83
hotReloaded : false ,
84
84
}
85
85
86
- /**
87
- * File path computed from the cwd
88
- */
89
- #cwdPath: string
90
-
91
86
/**
92
87
* External listeners that are invoked when child process
93
88
* gets an error or closes
@@ -223,12 +218,17 @@ export class DevServer {
223
218
/**
224
219
* The current working directory URL
225
220
*/
226
- public cwd : URL
221
+ cwd : URL
222
+
223
+ /**
224
+ * File path computed from the cwd
225
+ */
226
+ cwdPath : string
227
227
228
228
/**
229
229
* Development server configuration options including hooks and environment variables
230
230
*/
231
- public options : DevServerOptions
231
+ options : DevServerOptions
232
232
233
233
/**
234
234
* Create a new DevServer instance
@@ -239,8 +239,8 @@ export class DevServer {
239
239
constructor ( cwd : URL , options : DevServerOptions ) {
240
240
this . cwd = cwd
241
241
this . options = options
242
- this . # cwdPath = string . toUnixSlash ( fileURLToPath ( this . cwd ) )
243
- this . #indexGenerator = new IndexGenerator ( this . # cwdPath, this . ui . logger )
242
+ this . cwdPath = string . toUnixSlash ( fileURLToPath ( this . cwd ) )
243
+ this . #indexGenerator = new IndexGenerator ( this . cwdPath , this . ui . logger )
244
244
}
245
245
246
246
/**
@@ -459,7 +459,7 @@ export class DevServer {
459
459
this . ui . logger . info ( `starting server in ${ this . #mode} mode...` )
460
460
461
461
this . #stickyPort = String ( await getPort ( this . cwd ) )
462
- this . #fileSystem = new FileSystem ( this . # cwdPath, tsConfig , this . options )
462
+ this . #fileSystem = new FileSystem ( this . cwdPath , tsConfig , this . options )
463
463
464
464
this . ui . logger . info ( 'loading hooks...' )
465
465
this . #hooks = await loadHooks ( this . options . hooks , [
@@ -527,7 +527,7 @@ export class DevServer {
527
527
} else if ( this . #mode === 'hmr' && this . #isHotHookMessage( message ) ) {
528
528
debug ( 'received hot-hook message %O' , message )
529
529
const absolutePath = message . path ? string . toUnixSlash ( message . path ) : ''
530
- const relativePath = relative ( this . # cwdPath, absolutePath )
530
+ const relativePath = relative ( this . cwdPath , absolutePath )
531
531
532
532
if ( message . type === 'hot-hook:file-changed' ) {
533
533
const { action } = message
@@ -656,7 +656,7 @@ export class DevServer {
656
656
*/
657
657
this . #watcher = watch ( {
658
658
usePolling : options ?. poll ?? false ,
659
- cwd : this . # cwdPath,
659
+ cwd : this . cwdPath ,
660
660
ignoreInitial : true ,
661
661
ignored : ( file , stats ) => {
662
662
if ( ! stats ) {
@@ -689,19 +689,19 @@ export class DevServer {
689
689
690
690
this . #watcher. on ( 'add' , ( filePath ) => {
691
691
const relativePath = string . toUnixSlash ( filePath )
692
- const absolutePath = join ( this . # cwdPath, relativePath )
692
+ const absolutePath = join ( this . cwdPath , relativePath )
693
693
this . #hooks. runner ( 'fileAdded' ) . run ( relativePath , absolutePath , this )
694
694
} )
695
695
this . #watcher. on ( 'change' , ( filePath ) => {
696
696
const relativePath = string . toUnixSlash ( filePath )
697
- const absolutePath = join ( this . # cwdPath, relativePath )
697
+ const absolutePath = join ( this . cwdPath , relativePath )
698
698
this . #hooks
699
699
. runner ( 'fileChanged' )
700
700
. run ( relativePath , absolutePath , DevServer . #WATCHER_INFO, this )
701
701
} )
702
702
this . #watcher. on ( 'unlink' , ( filePath ) => {
703
703
const relativePath = string . toUnixSlash ( filePath )
704
- const absolutePath = join ( this . # cwdPath, relativePath )
704
+ const absolutePath = join ( this . cwdPath , relativePath )
705
705
this . #hooks. runner ( 'fileRemoved' ) . run ( relativePath , absolutePath , this )
706
706
} )
707
707
}
0 commit comments