File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import * as ts from "typescript";
3
3
import * as fs from "fs" ;
4
4
import * as path from "path" ;
5
5
6
+ const TSCONFIG_CACHE : { [ filePath : string ] : ts . ParsedCommandLine ; } = { } ;
7
+
6
8
export function createDefaultFormatCodeSettings ( ) : ts . FormatCodeSettings {
7
9
8
10
return {
@@ -49,6 +51,10 @@ export function readFilesFromTsconfig(configPath: string): string[] {
49
51
}
50
52
51
53
export function readTsconfig ( configPath : string ) : ts . ParsedCommandLine {
54
+ if ( TSCONFIG_CACHE [ configPath ] ) {
55
+ return TSCONFIG_CACHE [ configPath ] ;
56
+ }
57
+
52
58
// for `extends` support. It supported from TypeScript 2.1.1.
53
59
// `& { readFile(path: string): string; }` is backword compat for TypeScript compiler 2.0.3 support.
54
60
const host : ts . ParseConfigHost & { readFile ( path : string ) : string ; } = {
@@ -63,6 +69,8 @@ export function readTsconfig(configPath: string): ts.ParsedCommandLine {
63
69
throw new Error ( parsed . errors . map ( e => e . messageText ) . join ( "\n" ) ) ;
64
70
}
65
71
72
+ TSCONFIG_CACHE [ configPath ] = parsed ;
73
+
66
74
return parsed ;
67
75
}
68
76
You can’t perform that action at this time.
0 commit comments