File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
packages/angular_devkit/core/src/virtual-fs/host Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export interface ReadonlyHost<StatsT extends object = {}> {
59
59
isFile ( path : Path ) : Observable < boolean > ;
60
60
61
61
// Some hosts may not support stats.
62
- stat ( path : Path ) : Observable < Stats < StatsT > > | null ;
62
+ stat ( path : Path ) : Observable < Stats < StatsT > | null > | null ;
63
63
}
64
64
65
65
export interface Host < StatsT extends object = { } > extends ReadonlyHost < StatsT > {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export interface SimpleMemoryHostStats {
38
38
}
39
39
40
40
export class SimpleMemoryHost implements Host < { } > {
41
- protected readonly _cache = new Map < Path , Stats < SimpleMemoryHostStats > > ( ) ;
41
+ protected _cache = new Map < Path , Stats < SimpleMemoryHostStats > > ( ) ;
42
42
private _watchers = new Map < Path , [ HostWatchOptions , Subject < HostWatchEvent > ] [ ] > ( ) ;
43
43
44
44
protected _newDirStats ( ) {
@@ -257,11 +257,11 @@ export class SimpleMemoryHost implements Host<{}> {
257
257
return maybeStats ? maybeStats . isFile ( ) : false ;
258
258
}
259
259
260
- protected _stat ( path : Path ) : Stats < SimpleMemoryHostStats > {
260
+ protected _stat ( path : Path ) : Stats < SimpleMemoryHostStats > | null {
261
261
const maybeStats = this . _cache . get ( this . _toAbsolute ( path ) ) ;
262
262
263
263
if ( ! maybeStats ) {
264
- throw new FileDoesNotExistException ( path ) ;
264
+ return null ;
265
265
} else {
266
266
return maybeStats ;
267
267
}
@@ -343,8 +343,8 @@ export class SimpleMemoryHost implements Host<{}> {
343
343
}
344
344
345
345
// Some hosts may not support stat.
346
- stat ( path : Path ) : Observable < Stats < { } > > {
347
- return new Observable < Stats < { } > > ( obs => {
346
+ stat ( path : Path ) : Observable < Stats < { } > | null > | null {
347
+ return new Observable < Stats < { } > | null > ( obs => {
348
348
obs . next ( this . _stat ( path ) ) ;
349
349
obs . complete ( ) ;
350
350
} ) ;
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ export class SyncDelegateHost<T extends object = {}> {
93
93
94
94
// Some hosts may not support stat.
95
95
stat ( path : Path ) : Stats < T > | null {
96
- const result : Observable < Stats < T > > | null = this . _delegate . stat ( path ) ;
96
+ const result : Observable < Stats < T > | null > | null = this . _delegate . stat ( path ) ;
97
97
98
98
if ( result ) {
99
99
return this . _doSyncCall ( result ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class TestHost extends SimpleMemoryHost {
116
116
117
117
return super . _isFile ( path ) ;
118
118
}
119
- protected _stat ( path : Path ) : Stats < SimpleMemoryHostStats > {
119
+ protected _stat ( path : Path ) : Stats < SimpleMemoryHostStats > | null {
120
120
this . _records . push ( { kind : 'stat' , path } ) ;
121
121
122
122
return super . _stat ( path ) ;
You can’t perform that action at this time.
0 commit comments