Skip to content

Commit da8d3ef

Browse files
authored
Drop support for defunct Chakra host (#33797)
1 parent 2e97918 commit da8d3ef

File tree

1 file changed

+1
-68
lines changed

1 file changed

+1
-68
lines changed

src/compiler/sys.ts

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,31 +1107,6 @@ namespace ts {
11071107
return parseInt(version.substring(1, dot));
11081108
}
11091109

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-
11351110
// TODO: GH#18217 this is used as if it's certainly defined in many places.
11361111
// eslint-disable-next-line prefer-const
11371112
export let sys: System = (() => {
@@ -1737,50 +1712,8 @@ namespace ts {
17371712
}
17381713
}
17391714

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-
17791715
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") {
17841717
// process and process.nextTick checks if current environment is node-like
17851718
// process.browser check excludes webpack and browserify
17861719
sys = getNodeSystem();

0 commit comments

Comments
 (0)