@@ -20,6 +20,7 @@ const dev = Math.floor(Math.random() * 10000);
20
20
21
21
export class WebpackCompilerHost implements ts . CompilerHost {
22
22
private _syncHost : virtualFs . SyncDelegateHost ;
23
+ private _innerMemoryHost : virtualFs . SimpleMemoryHost ;
23
24
private _memoryHost : virtualFs . SyncDelegateHost ;
24
25
private _changedFiles = new Set < string > ( ) ;
25
26
private _readResourceFiles = new Set < string > ( ) ;
@@ -49,14 +50,23 @@ export class WebpackCompilerHost implements ts.CompilerHost {
49
50
private readonly moduleResolutionCache ?: ts . ModuleResolutionCache ,
50
51
) {
51
52
this . _syncHost = new virtualFs . SyncDelegateHost ( host ) ;
52
- this . _memoryHost = new virtualFs . SyncDelegateHost ( new virtualFs . SimpleMemoryHost ( ) ) ;
53
+ this . _innerMemoryHost = new virtualFs . SimpleMemoryHost ( ) ;
54
+ this . _memoryHost = new virtualFs . SyncDelegateHost ( this . _innerMemoryHost ) ;
53
55
this . _basePath = normalize ( basePath ) ;
54
56
}
55
57
56
58
private get virtualFiles ( ) : Path [ ] {
57
59
return [ ...( ( this . _memoryHost . delegate as { } ) as { _cache : Map < Path , { } > } ) . _cache . keys ( ) ] ;
58
60
}
59
61
62
+ reset ( ) {
63
+ this . _innerMemoryHost . reset ( ) ;
64
+ this . _changedFiles . clear ( ) ;
65
+ this . _readResourceFiles . clear ( ) ;
66
+ this . _sourceFileCache . clear ( ) ;
67
+ this . _resourceLoader = undefined ;
68
+ }
69
+
60
70
denormalizePath ( path : string ) {
61
71
return getSystemPath ( normalize ( path ) ) ;
62
72
}
0 commit comments