Enables source maps for exceptions thrown in the compiler (when available)
This commit is contained in:
parent
1ceb02a5bc
commit
dd2dc78dd6
2 changed files with 15 additions and 0 deletions
|
@ -8,6 +8,7 @@ namespace ts {
|
|||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
/*@internal*/ developmentMode?: boolean;
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
|
@ -22,6 +23,7 @@ namespace ts {
|
|||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
/*@internal*/ tryEnableSourceMapsForHost?(): void;
|
||||
}
|
||||
|
||||
interface WatchedFile {
|
||||
|
@ -494,6 +496,7 @@ namespace ts {
|
|||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
developmentMode: /^development$/i.test(String(process.env.NODE_ENV)),
|
||||
write(s: string): void {
|
||||
process.stdout.write(s);
|
||||
},
|
||||
|
@ -564,6 +567,14 @@ namespace ts {
|
|||
},
|
||||
exit(exitCode?: number): void {
|
||||
process.exit(exitCode);
|
||||
},
|
||||
tryEnableSourceMapsForHost() {
|
||||
try {
|
||||
require("source-map-support").install();
|
||||
}
|
||||
catch (e) {
|
||||
// Could not enable source maps.
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -777,4 +777,8 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (ts.sys.developmentMode && ts.sys.tryEnableSourceMapsForHost) {
|
||||
ts.sys.tryEnableSourceMapsForHost();
|
||||
}
|
||||
|
||||
ts.executeCommandLine(ts.sys.args);
|
||||
|
|
Loading…
Reference in a new issue