@@ -126,6 +126,25 @@ namespace ts.projectSystem {
126
126
return JSON . stringify ( { dependencies } ) ;
127
127
}
128
128
129
+ export function createTypesRegistry ( ...list : string [ ] ) : Map < MapLike < string > > {
130
+ const versionMap = {
131
+ "latest" : "1.3.0" ,
132
+ "ts2.0" : "1.0.0" ,
133
+ "ts2.1" : "1.0.0" ,
134
+ "ts2.2" : "1.2.0" ,
135
+ "ts2.3" : "1.3.0" ,
136
+ "ts2.4" : "1.3.0" ,
137
+ "ts2.5" : "1.3.0" ,
138
+ "ts2.6" : "1.3.0" ,
139
+ "ts2.7" : "1.3.0"
140
+ } ;
141
+ const map = createMap < MapLike < string > > ( ) ;
142
+ for ( const l of list ) {
143
+ map . set ( l , versionMap ) ;
144
+ }
145
+ return map ;
146
+ }
147
+
129
148
export function toExternalFile ( fileName : string ) : protocol . ExternalFile {
130
149
return { fileName } ;
131
150
}
@@ -6528,12 +6547,18 @@ namespace ts.projectSystem {
6528
6547
} ,
6529
6548
} )
6530
6549
} ;
6550
+ const typingsCachePackageLockJson : FileOrFolder = {
6551
+ path : `${ typingsCache } /package-lock.json` ,
6552
+ content : JSON . stringify ( {
6553
+ dependencies : {
6554
+ } ,
6555
+ } )
6556
+ } ;
6531
6557
6532
- const files = [ file , packageJsonInCurrentDirectory , packageJsonOfPkgcurrentdirectory , indexOfPkgcurrentdirectory , typingsCachePackageJson ] ;
6558
+ const files = [ file , packageJsonInCurrentDirectory , packageJsonOfPkgcurrentdirectory , indexOfPkgcurrentdirectory , typingsCachePackageJson , typingsCachePackageLockJson ] ;
6533
6559
const host = createServerHost ( files , { currentDirectory } ) ;
6534
6560
6535
- const typesRegistry = createMap < MapLike < string > > ( ) ;
6536
- typesRegistry . set ( "pkgcurrentdirectory" , void 0 ) ;
6561
+ const typesRegistry = createTypesRegistry ( "pkgcurrentdirectory" ) ;
6537
6562
const typingsInstaller = new TestTypingsInstaller ( typingsCache , /*throttleLimit*/ 5 , host , typesRegistry ) ;
6538
6563
6539
6564
const projectService = createProjectService ( host , { typingsInstaller } ) ;
0 commit comments