@@ -17,7 +17,6 @@ declare module "gulp-typescript" {
1717 stripInternal ?: boolean ;
1818 types ?: string [ ] ;
1919 }
20- interface CompileStream extends NodeJS . ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
2120}
2221import * as insert from "gulp-insert" ;
2322import * as sourcemaps from "gulp-sourcemaps" ;
@@ -169,7 +168,7 @@ for (const i in libraryTargets) {
169168 gulp . task ( target , false , [ ] , function ( ) {
170169 return gulp . src ( sources )
171170 . pipe ( newer ( target ) )
172- . pipe ( concat ( target , { newLine : "" } ) )
171+ . pipe ( concat ( target , { newLine : "\n\n " } ) )
173172 . pipe ( gulp . dest ( "." ) ) ;
174173 } ) ;
175174}
@@ -380,18 +379,18 @@ gulp.task(builtLocalCompiler, false, [servicesFile], () => {
380379 return localCompilerProject . src ( )
381380 . pipe ( newer ( builtLocalCompiler ) )
382381 . pipe ( sourcemaps . init ( ) )
383- . pipe ( tsc ( localCompilerProject ) )
382+ . pipe ( localCompilerProject ( ) )
384383 . pipe ( prependCopyright ( ) )
385384 . pipe ( sourcemaps . write ( "." ) )
386- . pipe ( gulp . dest ( builtLocalDirectory ) ) ;
385+ . pipe ( gulp . dest ( "." ) ) ;
387386} ) ;
388387
389388gulp . task ( servicesFile , false , [ "lib" , "generate-diagnostics" ] , ( ) => {
390389 const servicesProject = tsc . createProject ( "src/services/tsconfig.json" , getCompilerSettings ( { removeComments : false } , /*useBuiltCompiler*/ false ) ) ;
391390 const { js, dts} = servicesProject . src ( )
392391 . pipe ( newer ( servicesFile ) )
393392 . pipe ( sourcemaps . init ( ) )
394- . pipe ( tsc ( servicesProject ) ) ;
393+ . pipe ( servicesProject ( ) ) ;
395394 const completedJs = js . pipe ( prependCopyright ( ) )
396395 . pipe ( sourcemaps . write ( "." ) ) ;
397396 const completedDts = dts . pipe ( prependCopyright ( /*outputCopyright*/ true ) )
@@ -409,26 +408,52 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
409408 file . path = nodeDefinitionsFile ;
410409 return content + "\r\nexport = ts;" ;
411410 } ) )
412- . pipe ( gulp . dest ( builtLocalDirectory ) ) ,
411+ . pipe ( gulp . dest ( "." ) ) ,
413412 completedDts . pipe ( clone ( ) )
414413 . pipe ( insert . transform ( ( content , file ) => {
415414 file . path = nodeStandaloneDefinitionsFile ;
416415 return content . replace ( / d e c l a r e ( n a m e s p a c e | m o d u l e ) t s / g, 'declare module "typescript"' ) ;
417416 } ) )
418- ] ) . pipe ( gulp . dest ( builtLocalDirectory ) ) ;
417+ ] ) . pipe ( gulp . dest ( "." ) ) ;
418+ } ) ;
419+
420+ // cancellationToken.js
421+ const cancellationTokenJs = path . join ( builtLocalDirectory , "cancellationToken.js" ) ;
422+ gulp . task ( cancellationTokenJs , false , [ servicesFile ] , ( ) => {
423+ const cancellationTokenProject = tsc . createProject ( "src/server/cancellationToken/tsconfig.json" , getCompilerSettings ( { } , /*useBuiltCompiler*/ true ) ) ;
424+ return cancellationTokenProject . src ( )
425+ . pipe ( newer ( cancellationTokenJs ) )
426+ . pipe ( sourcemaps . init ( ) )
427+ . pipe ( cancellationTokenProject ( ) )
428+ . pipe ( prependCopyright ( ) )
429+ . pipe ( sourcemaps . write ( "." ) )
430+ . pipe ( gulp . dest ( builtLocalDirectory ) ) ;
431+ } ) ;
432+
433+ // typingsInstallerFile.js
434+ const typingsInstallerJs = path . join ( builtLocalDirectory , "typingsInstaller.js" ) ;
435+ gulp . task ( typingsInstallerJs , false , [ servicesFile ] , ( ) => {
436+ const cancellationTokenProject = tsc . createProject ( "src/server/typingsInstaller/tsconfig.json" , getCompilerSettings ( { } , /*useBuiltCompiler*/ true ) ) ;
437+ return cancellationTokenProject . src ( )
438+ . pipe ( newer ( typingsInstallerJs ) )
439+ . pipe ( sourcemaps . init ( ) )
440+ . pipe ( cancellationTokenProject ( ) )
441+ . pipe ( prependCopyright ( ) )
442+ . pipe ( sourcemaps . write ( "." ) )
443+ . pipe ( gulp . dest ( "." ) ) ;
419444} ) ;
420445
421446const serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
422447
423- gulp . task ( serverFile , false , [ servicesFile ] , ( ) => {
448+ gulp . task ( serverFile , false , [ servicesFile , typingsInstallerJs , cancellationTokenJs ] , ( ) => {
424449 const serverProject = tsc . createProject ( "src/server/tsconfig.json" , getCompilerSettings ( { } , /*useBuiltCompiler*/ true ) ) ;
425450 return serverProject . src ( )
426451 . pipe ( newer ( serverFile ) )
427452 . pipe ( sourcemaps . init ( ) )
428- . pipe ( tsc ( serverProject ) )
453+ . pipe ( serverProject ( ) )
429454 . pipe ( prependCopyright ( ) )
430455 . pipe ( sourcemaps . write ( "." ) )
431- . pipe ( gulp . dest ( builtLocalDirectory ) ) ;
456+ . pipe ( gulp . dest ( "." ) ) ;
432457} ) ;
433458
434459const tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
@@ -439,22 +464,21 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
439464 const { js, dts} : { js : NodeJS . ReadableStream , dts : NodeJS . ReadableStream } = serverLibraryProject . src ( )
440465 . pipe ( sourcemaps . init ( ) )
441466 . pipe ( newer ( tsserverLibraryFile ) )
442- . pipe ( tsc ( serverLibraryProject ) ) ;
467+ . pipe ( serverLibraryProject ( ) ) ;
443468
444469 return merge2 ( [
445470 js . pipe ( prependCopyright ( ) )
446471 . pipe ( sourcemaps . write ( "." ) )
447- . pipe ( gulp . dest ( builtLocalDirectory ) ) ,
472+ . pipe ( gulp . dest ( "." ) ) ,
448473 dts . pipe ( prependCopyright ( ) )
449- . pipe ( gulp . dest ( builtLocalDirectory ) )
474+ . pipe ( gulp . dest ( "." ) )
450475 ] ) ;
451476} ) ;
452477
453478gulp . task ( "lssl" , "Builds language service server library" , [ tsserverLibraryFile ] ) ;
454479gulp . task ( "local" , "Builds the full compiler and services" , [ builtLocalCompiler , servicesFile , serverFile , builtGeneratedDiagnosticMessagesJSON , tsserverLibraryFile ] ) ;
455480gulp . task ( "tsc" , "Builds only the compiler" , [ builtLocalCompiler ] ) ;
456481
457-
458482// Generate Markdown spec
459483const word2mdJs = path . join ( scriptsDirectory , "word2md.js" ) ;
460484const word2mdTs = path . join ( scriptsDirectory , "word2md.ts" ) ;
@@ -493,7 +517,7 @@ gulp.task("useDebugMode", false, [], (done) => { useDebugMode = true; done(); })
493517gulp . task ( "dontUseDebugMode" , false , [ ] , ( done ) => { useDebugMode = false ; done ( ) ; } ) ;
494518
495519gulp . task ( "VerifyLKG" , false , [ ] , ( ) => {
496- const expectedFiles = [ builtLocalCompiler , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile ] . concat ( libraryTargets ) ;
520+ const expectedFiles = [ builtLocalCompiler , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile , typingsInstallerJs , cancellationTokenJs ] . concat ( libraryTargets ) ;
497521 const missingFiles = expectedFiles . filter ( function ( f ) {
498522 return ! fs . existsSync ( f ) ;
499523 } ) ;
@@ -519,9 +543,9 @@ gulp.task(run, false, [servicesFile], () => {
519543 return testProject . src ( )
520544 . pipe ( newer ( run ) )
521545 . pipe ( sourcemaps . init ( ) )
522- . pipe ( tsc ( testProject ) )
546+ . pipe ( testProject ( ) )
523547 . pipe ( sourcemaps . write ( "." , { includeContent : false , sourceRoot : "../../" } ) )
524- . pipe ( gulp . dest ( builtLocalDirectory ) ) ;
548+ . pipe ( gulp . dest ( "." ) ) ;
525549} ) ;
526550
527551const internalTests = "internal/" ;
@@ -705,7 +729,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
705729 return testProject . src ( )
706730 . pipe ( newer ( "built/local/bundle.js" ) )
707731 . pipe ( sourcemaps . init ( ) )
708- . pipe ( tsc ( testProject ) )
732+ . pipe ( testProject )
709733 . pipe ( through2 . obj ( ( file , enc , next ) => {
710734 const originalMap = file . sourceMap ;
711735 const prebundledContent = file . contents . toString ( ) ;
0 commit comments