@@ -1107,31 +1107,6 @@ namespace ts {
1107
1107
return parseInt ( version . substring ( 1 , dot ) ) ;
1108
1108
}
1109
1109
1110
- declare const ChakraHost : {
1111
- args : string [ ] ;
1112
- currentDirectory : string ;
1113
- executingFile : string ;
1114
- newLine ?: string ;
1115
- useCaseSensitiveFileNames ?: boolean ;
1116
- echo ( s : string ) : void ;
1117
- quit ( exitCode ?: number ) : void ;
1118
- fileExists ( path : string ) : boolean ;
1119
- deleteFile ( path : string ) : boolean ;
1120
- getModifiedTime ( path : string ) : Date ;
1121
- setModifiedTime ( path : string , time : Date ) : void ;
1122
- directoryExists ( path : string ) : boolean ;
1123
- createDirectory ( path : string ) : void ;
1124
- resolvePath ( path : string ) : string ;
1125
- readFile ( path : string ) : string | undefined ;
1126
- writeFile ( path : string , contents : string ) : void ;
1127
- getDirectories ( path : string ) : string [ ] ;
1128
- readDirectory ( path : string , extensions ?: readonly string [ ] , basePaths ?: readonly string [ ] , excludeEx ?: string , includeFileEx ?: string , includeDirEx ?: string ) : string [ ] ;
1129
- watchFile ?( path : string , callback : FileWatcherCallback ) : FileWatcher ;
1130
- watchDirectory ?( path : string , callback : DirectoryWatcherCallback , recursive ?: boolean ) : FileWatcher ;
1131
- realpath ( path : string ) : string ;
1132
- getEnvironmentVariable ?( name : string ) : string ;
1133
- } ;
1134
-
1135
1110
// TODO: GH#18217 this is used as if it's certainly defined in many places.
1136
1111
// eslint-disable-next-line prefer-const
1137
1112
export let sys : System = ( ( ) => {
@@ -1737,50 +1712,8 @@ namespace ts {
1737
1712
}
1738
1713
}
1739
1714
1740
- function getChakraSystem ( ) : System {
1741
- const realpath = ChakraHost . realpath && ( ( path : string ) => ChakraHost . realpath ( path ) ) ;
1742
- return {
1743
- newLine : ChakraHost . newLine || "\r\n" ,
1744
- args : ChakraHost . args ,
1745
- useCaseSensitiveFileNames : ! ! ChakraHost . useCaseSensitiveFileNames ,
1746
- write : ChakraHost . echo ,
1747
- readFile ( path : string , _encoding ?: string ) {
1748
- // encoding is automatically handled by the implementation in ChakraHost
1749
- return ChakraHost . readFile ( path ) ;
1750
- } ,
1751
- writeFile ( path : string , data : string , writeByteOrderMark ?: boolean ) {
1752
- // If a BOM is required, emit one
1753
- if ( writeByteOrderMark ) {
1754
- data = byteOrderMarkIndicator + data ;
1755
- }
1756
-
1757
- ChakraHost . writeFile ( path , data ) ;
1758
- } ,
1759
- resolvePath : ChakraHost . resolvePath ,
1760
- fileExists : ChakraHost . fileExists ,
1761
- deleteFile : ChakraHost . deleteFile ,
1762
- getModifiedTime : ChakraHost . getModifiedTime ,
1763
- setModifiedTime : ChakraHost . setModifiedTime ,
1764
- directoryExists : ChakraHost . directoryExists ,
1765
- createDirectory : ChakraHost . createDirectory ,
1766
- getExecutingFilePath : ( ) => ChakraHost . executingFile ,
1767
- getCurrentDirectory : ( ) => ChakraHost . currentDirectory ,
1768
- getDirectories : ChakraHost . getDirectories ,
1769
- getEnvironmentVariable : ChakraHost . getEnvironmentVariable || ( ( ) => "" ) ,
1770
- readDirectory ( path , extensions , excludes , includes , _depth ) {
1771
- const pattern = getFileMatcherPatterns ( path , excludes , includes , ! ! ChakraHost . useCaseSensitiveFileNames , ChakraHost . currentDirectory ) ;
1772
- return ChakraHost . readDirectory ( path , extensions , pattern . basePaths , pattern . excludePattern , pattern . includeFilePattern , pattern . includeDirectoryPattern ) ;
1773
- } ,
1774
- exit : ChakraHost . quit ,
1775
- realpath
1776
- } ;
1777
- }
1778
-
1779
1715
let sys : System | undefined ;
1780
- if ( typeof ChakraHost !== "undefined" ) {
1781
- sys = getChakraSystem ( ) ;
1782
- }
1783
- else if ( typeof process !== "undefined" && process . nextTick && ! process . browser && typeof require !== "undefined" ) {
1716
+ if ( typeof process !== "undefined" && process . nextTick && ! process . browser && typeof require !== "undefined" ) {
1784
1717
// process and process.nextTick checks if current environment is node-like
1785
1718
// process.browser check excludes webpack and browserify
1786
1719
sys = getNodeSystem ( ) ;
0 commit comments