@@ -93,9 +93,9 @@ export class WebpackFileSystemHostAdapter implements InputFileSystem {
93
93
return this . _doHostCall ( this . _host . list ( normalize ( '/' + path ) ) , callback ) ;
94
94
}
95
95
96
- readFile ( path : string , callback : Callback < string > ) : void {
96
+ readFile ( path : string , callback : Callback < Buffer > ) : void {
97
97
const o = this . _host . read ( normalize ( '/' + path ) ) . pipe (
98
- map ( content => virtualFs . fileBufferToString ( content ) ) ,
98
+ map ( content => Buffer . from ( content ) ) ,
99
99
) ;
100
100
101
101
return this . _doHostCall ( o , callback ) ;
@@ -134,15 +134,21 @@ export class WebpackFileSystemHostAdapter implements InputFileSystem {
134
134
135
135
return this . _syncHost . list ( normalize ( '/' + path ) ) ;
136
136
}
137
- readFileSync ( path : string ) : string {
137
+ readFileSync ( path : string ) : Buffer {
138
138
if ( ! this . _syncHost ) {
139
139
this . _syncHost = new virtualFs . SyncDelegateHost ( this . _host ) ;
140
140
}
141
141
142
- return virtualFs . fileBufferToString ( this . _syncHost . read ( normalize ( '/' + path ) ) ) ;
142
+ return Buffer . from ( this . _syncHost . read ( normalize ( '/' + path ) ) ) ;
143
143
}
144
- readJsonSync ( path : string ) : string {
145
- return JSON . parse ( this . readFileSync ( path ) ) ;
144
+ readJsonSync ( path : string ) : { } {
145
+ if ( ! this . _syncHost ) {
146
+ this . _syncHost = new virtualFs . SyncDelegateHost ( this . _host ) ;
147
+ }
148
+
149
+ const data = this . _syncHost . read ( normalize ( '/' + path ) ) ;
150
+
151
+ return JSON . parse ( virtualFs . fileBufferToString ( data ) ) ;
146
152
}
147
153
readlinkSync ( path : string ) : string {
148
154
const err : NodeJS . ErrnoException = new Error ( 'Not a symlink.' ) ;
0 commit comments