@@ -183,8 +183,8 @@ var servicesSources = [
183183 return path . join ( servicesDirectory , f ) ;
184184} ) ) ;
185185
186- var serverCoreSources = [
187- "types.d. ts" ,
186+ var baseServerCoreSources = [
187+ "types.ts" ,
188188 "shared.ts" ,
189189 "utilities.ts" ,
190190 "scriptVersionCache.ts" ,
@@ -195,19 +195,24 @@ var serverCoreSources = [
195195 "editorServices.ts" ,
196196 "protocol.ts" ,
197197 "session.ts" ,
198- "server.ts"
199198] . map ( function ( f ) {
200199 return path . join ( serverDirectory , f ) ;
201200} ) ;
202201
202+ var serverCoreSources = [
203+ "server.ts"
204+ ] . map ( function ( f ) {
205+ return path . join ( serverDirectory , f ) ;
206+ } ) . concat ( baseServerCoreSources ) ;
207+
203208var cancellationTokenSources = [
204209 "cancellationToken.ts"
205210] . map ( function ( f ) {
206211 return path . join ( cancellationTokenDirectory , f ) ;
207212} ) ;
208213
209214var typingsInstallerSources = [
210- "../types.d. ts" ,
215+ "../types.ts" ,
211216 "../shared.ts" ,
212217 "typingsInstaller.ts" ,
213218 "nodeTypingsInstaller.ts"
@@ -216,20 +221,7 @@ var typingsInstallerSources = [
216221} ) ;
217222
218223var 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 ) ;
224+ var languageServiceLibrarySources = baseServerCoreSources . concat ( servicesSources ) ;
233225
234226var harnessCoreSources = [
235227 "harness.ts" ,
@@ -727,7 +719,15 @@ compileFile(
727719 [ builtLocalDirectory , copyright , builtLocalCompiler ] . concat ( languageServiceLibrarySources ) . concat ( libraryTargets ) ,
728720 /*prefixes*/ [ copyright ] ,
729721 /*useBuiltCompiler*/ true ,
730- { noOutFile : false , generateDeclarations : true } ) ;
722+ { noOutFile : false , generateDeclarations : true } ,
723+ /*callback*/ function ( ) {
724+
725+ prependFile ( copyright , tsserverLibraryDefinitionFile ) ;
726+
727+ // Appending 'export = ts;' at the end of the server library file to turn it into an external module
728+ var tsserverLibraryDefinitionFileContents = fs . readFileSync ( tsserverLibraryDefinitionFile ) . toString ( ) + "\r\nexport = ts;" ;
729+ fs . writeFileSync ( tsserverLibraryDefinitionFile , tsserverLibraryDefinitionFileContents ) ;
730+ } ) ;
731731
732732// Local target to build the language service server library
733733desc ( "Builds language service server library" ) ;
0 commit comments