@@ -183,31 +183,37 @@ var servicesSources = [
183183 return path . join ( servicesDirectory , f ) ;
184184} ) ) ;
185185
186- var serverCoreSources = [
187- "types.d.ts" ,
188- "shared.ts" ,
189- "utilities.ts" ,
190- "scriptVersionCache.ts" ,
191- "typingsCache.ts" ,
192- "scriptInfo.ts" ,
186+ var baseServerCoreSources = [
187+ "builder.ts" ,
188+ "editorServices.ts" ,
193189 "lsHost.ts" ,
194190 "project.ts" ,
195- "editorServices.ts" ,
196191 "protocol.ts" ,
192+ "scriptInfo.ts" ,
193+ "scriptVersionCache.ts" ,
197194 "session.ts" ,
198- "server.ts"
195+ "shared.ts" ,
196+ "types.ts" ,
197+ "typingsCache.ts" ,
198+ "utilities.ts" ,
199199] . map ( function ( f ) {
200200 return path . join ( serverDirectory , f ) ;
201201} ) ;
202202
203+ var serverCoreSources = [
204+ "server.ts"
205+ ] . map ( function ( f ) {
206+ return path . join ( serverDirectory , f ) ;
207+ } ) . concat ( baseServerCoreSources ) ;
208+
203209var cancellationTokenSources = [
204210 "cancellationToken.ts"
205211] . map ( function ( f ) {
206212 return path . join ( cancellationTokenDirectory , f ) ;
207213} ) ;
208214
209215var typingsInstallerSources = [
210- "../types.d. ts" ,
216+ "../types.ts" ,
211217 "../shared.ts" ,
212218 "typingsInstaller.ts" ,
213219 "nodeTypingsInstaller.ts"
@@ -216,20 +222,7 @@ var typingsInstallerSources = [
216222} ) ;
217223
218224var serverSources = serverCoreSources . concat ( servicesSources ) ;
219-
220- var languageServiceLibrarySources = [
221- "protocol.ts" ,
222- "utilities.ts" ,
223- "scriptVersionCache.ts" ,
224- "scriptInfo.ts" ,
225- "lsHost.ts" ,
226- "project.ts" ,
227- "editorServices.ts" ,
228- "session.ts" ,
229-
230- ] . map ( function ( f ) {
231- return path . join ( serverDirectory , f ) ;
232- } ) . concat ( servicesSources ) ;
225+ var languageServiceLibrarySources = baseServerCoreSources . concat ( servicesSources ) ;
233226
234227var harnessCoreSources = [
235228 "harness.ts" ,
@@ -463,7 +456,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
463456 options += " --stripInternal" ;
464457 }
465458
466- options += " --target es5 --noUnusedLocals --noUnusedParameters" ;
459+ options += " --target es5 --lib es5,scripthost -- noUnusedLocals --noUnusedParameters" ;
467460
468461 var cmd = host + " " + compilerPath + " " + options + " " ;
469462 cmd = cmd + sources . join ( " " ) ;
@@ -727,7 +720,18 @@ compileFile(
727720 [ builtLocalDirectory , copyright , builtLocalCompiler ] . concat ( languageServiceLibrarySources ) . concat ( libraryTargets ) ,
728721 /*prefixes*/ [ copyright ] ,
729722 /*useBuiltCompiler*/ true ,
730- { noOutFile : false , generateDeclarations : true } ) ;
723+ { noOutFile : false , generateDeclarations : true , stripInternal : true } ,
724+ /*callback*/ function ( ) {
725+ prependFile ( copyright , tsserverLibraryDefinitionFile ) ;
726+
727+ // Appending exports at the end of the server library
728+ var tsserverLibraryDefinitionFileContents =
729+ fs . readFileSync ( tsserverLibraryDefinitionFile ) . toString ( ) +
730+ "\r\nexport = ts;" +
731+ "\r\nexport as namespace ts;" ;
732+
733+ fs . writeFileSync ( tsserverLibraryDefinitionFile , tsserverLibraryDefinitionFileContents ) ;
734+ } ) ;
731735
732736// Local target to build the language service server library
733737desc ( "Builds language service server library" ) ;
0 commit comments