@@ -93,9 +93,9 @@ export class WebpackFileSystemHostAdapter implements InputFileSystem {
9393 return this . _doHostCall ( this . _host . list ( normalize ( '/' + path ) ) , callback ) ;
9494 }
9595
96- readFile ( path : string , callback : Callback < string > ) : void {
96+ readFile ( path : string , callback : Callback < Buffer > ) : void {
9797 const o = this . _host . read ( normalize ( '/' + path ) ) . pipe (
98- map ( content => virtualFs . fileBufferToString ( content ) ) ,
98+ map ( content => Buffer . from ( content ) ) ,
9999 ) ;
100100
101101 return this . _doHostCall ( o , callback ) ;
@@ -134,15 +134,21 @@ export class WebpackFileSystemHostAdapter implements InputFileSystem {
134134
135135 return this . _syncHost . list ( normalize ( '/' + path ) ) ;
136136 }
137- readFileSync ( path : string ) : string {
137+ readFileSync ( path : string ) : Buffer {
138138 if ( ! this . _syncHost ) {
139139 this . _syncHost = new virtualFs . SyncDelegateHost ( this . _host ) ;
140140 }
141141
142- return virtualFs . fileBufferToString ( this . _syncHost . read ( normalize ( '/' + path ) ) ) ;
142+ return Buffer . from ( this . _syncHost . read ( normalize ( '/' + path ) ) ) ;
143143 }
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 ) ) ;
146152 }
147153 readlinkSync ( path : string ) : string {
148154 const err : NodeJS . ErrnoException = new Error ( 'Not a symlink.' ) ;
0 commit comments