@@ -11,11 +11,7 @@ var ts = require("./lib/typescript");
1111
1212// Variables
1313var compilerDirectory = "src/compiler/" ;
14- var servicesDirectory = "src/services/" ;
1514var serverDirectory = "src/server/" ;
16- var typingsInstallerDirectory = "src/server/typingsInstaller" ;
17- var cancellationTokenDirectory = "src/server/cancellationToken" ;
18- var watchGuardDirectory = "src/server/watchGuard" ;
1915var harnessDirectory = "src/harness/" ;
2016var libraryDirectory = "src/lib/" ;
2117var scriptsDirectory = "scripts/" ;
@@ -131,6 +127,7 @@ var harnessSources = harnessCoreSources.concat([
131127 "matchFiles.ts" ,
132128 "initializeTSConfig.ts" ,
133129 "printer.ts" ,
130+ "textChanges.ts" ,
134131 "transform.ts" ,
135132 "customTransforms.ts" ,
136133] . map ( function ( f ) {
@@ -328,8 +325,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
328325 if ( opts . stripInternal ) {
329326 options += " --stripInternal" ;
330327 }
331-
332- options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters" ;
328+ options += " --target es5" ;
329+ if ( opts . lib ) {
330+ options += " --lib " + opts . lib
331+ }
332+ else {
333+ options += " --lib es5"
334+ }
335+ options += " --noUnusedLocals --noUnusedParameters" ;
333336
334337 var cmd = host + " " + compilerPath + " " + options + " " ;
335338 cmd = cmd + sources . join ( " " ) ;
@@ -416,7 +419,7 @@ compileFile(buildProtocolJs,
416419 [ buildProtocolTs ] ,
417420 [ ] ,
418421 /*useBuiltCompiler*/ false ,
419- { noOutFile : true } ) ;
422+ { noOutFile : true , lib : "es6" } ) ;
420423
421424file ( buildProtocolDts , [ buildProtocolTs , buildProtocolJs , typescriptServicesDts ] , function ( ) {
422425
@@ -578,16 +581,16 @@ compileFile(
578581file ( typescriptServicesDts , [ servicesFile ] ) ;
579582
580583var cancellationTokenFile = path . join ( builtLocalDirectory , "cancellationToken.js" ) ;
581- compileFile ( cancellationTokenFile , cancellationTokenSources , [ builtLocalDirectory ] . concat ( cancellationTokenSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { outDir : builtLocalDirectory , noOutFile : true } ) ;
584+ compileFile ( cancellationTokenFile , cancellationTokenSources , [ builtLocalDirectory ] . concat ( cancellationTokenSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : true , lib : "es6" } ) ;
582585
583586var typingsInstallerFile = path . join ( builtLocalDirectory , "typingsInstaller.js" ) ;
584- compileFile ( typingsInstallerFile , typingsInstallerSources , [ builtLocalDirectory ] . concat ( typingsInstallerSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { outDir : builtLocalDirectory , noOutFile : false } ) ;
587+ compileFile ( typingsInstallerFile , typingsInstallerSources , [ builtLocalDirectory ] . concat ( typingsInstallerSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : false , lib : "es6" } ) ;
585588
586589var watchGuardFile = path . join ( builtLocalDirectory , "watchGuard.js" ) ;
587- compileFile ( watchGuardFile , watchGuardSources , [ builtLocalDirectory ] . concat ( watchGuardSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { outDir : builtLocalDirectory , noOutFile : false } ) ;
590+ compileFile ( watchGuardFile , watchGuardSources , [ builtLocalDirectory ] . concat ( watchGuardSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : false , lib : "es6" } ) ;
588591
589592var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
590- compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile , watchGuardFile ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true } ) ;
593+ compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile , watchGuardFile ] . concat ( serverSources ) . concat ( servicesSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true , lib : "es6" } ) ;
591594var tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
592595var tsserverLibraryDefinitionFile = path . join ( builtLocalDirectory , "tsserverlibrary.d.ts" ) ;
593596compileFile (
@@ -711,7 +714,7 @@ compileFile(
711714 /*prereqs*/ [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( servicesSources ) . concat ( harnessSources ) ,
712715 /*prefixes*/ [ ] ,
713716 /*useBuiltCompiler:*/ true ,
714- /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] } ) ;
717+ /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] , lib : "es6" } ) ;
715718
716719var internalTests = "internal/" ;
717720
@@ -1098,7 +1101,8 @@ var tslintRules = [
10981101 "noInOperatorRule" ,
10991102 "noIncrementDecrementRule" ,
11001103 "objectLiteralSurroundingSpaceRule" ,
1101- "noTypeAssertionWhitespaceRule"
1104+ "noTypeAssertionWhitespaceRule" ,
1105+ "noBomRule"
11021106] ;
11031107var tslintRulesFiles = tslintRules . map ( function ( p ) {
11041108 return path . join ( tslintRuleDir , p + ".ts" ) ;
@@ -1110,7 +1114,7 @@ desc("Compiles tslint rules to js");
11101114task ( "build-rules" , [ "build-rules-start" ] . concat ( tslintRulesOutFiles ) . concat ( [ "build-rules-end" ] ) ) ;
11111115tslintRulesFiles . forEach ( function ( ruleFile , i ) {
11121116 compileFile ( tslintRulesOutFiles [ i ] , [ ruleFile ] , [ ruleFile ] , [ ] , /*useBuiltCompiler*/ false ,
1113- { noOutFile : true , generateDeclarations : false , outDir : path . join ( builtLocalDirectory , "tslint" ) } ) ;
1117+ { noOutFile : true , generateDeclarations : false , outDir : path . join ( builtLocalDirectory , "tslint" ) , lib : "es6" } ) ;
11141118} ) ;
11151119
11161120desc ( "Emit the start of the build-rules fold" ) ;
@@ -1173,43 +1177,16 @@ function spawnLintWorker(files, callback) {
11731177}
11741178
11751179desc ( "Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex" ) ;
1176- task ( "lint" , [ "build-rules" ] , function ( ) {
1180+ task ( "lint" , [ "build-rules" ] , ( ) => {
11771181 if ( fold . isTravis ( ) ) console . log ( fold . start ( "lint" ) ) ;
1178- var startTime = mark ( ) ;
1179- var failed = 0 ;
1180- var fileMatcher = RegExp ( process . env . f || process . env . file || process . env . files || "" ) ;
1181- var done = { } ;
1182- for ( var i in lintTargets ) {
1183- var target = lintTargets [ i ] ;
1184- if ( ! done [ target ] && fileMatcher . test ( target ) ) {
1185- done [ target ] = fs . statSync ( target ) . size ;
1186- }
1187- }
1188-
1189- var workerCount = ( process . env . workerCount && + process . env . workerCount ) || os . cpus ( ) . length ;
1190-
1191- var names = Object . keys ( done ) . sort ( function ( namea , nameb ) {
1192- return done [ namea ] - done [ nameb ] ;
1182+ const fileMatcher = process . env . f || process . env . file || process . env . files ;
1183+ const files = fileMatcher
1184+ ? `src/**/${ fileMatcher } `
1185+ : "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts' --exclude 'src/harness/unittests/services/**/*.ts'" ;
1186+ const cmd = `node node_modules/tslint/bin/tslint ${ files } --format stylish` ;
1187+ console . log ( "Linting: " + cmd ) ;
1188+ jake . exec ( [ cmd ] , { interactive : true } , ( ) => {
1189+ if ( fold . isTravis ( ) ) console . log ( fold . end ( "lint" ) ) ;
1190+ complete ( ) ;
11931191 } ) ;
1194-
1195- for ( var i = 0 ; i < workerCount ; i ++ ) {
1196- spawnLintWorker ( names , finished ) ;
1197- }
1198-
1199- var completed = 0 ;
1200- var failures = 0 ;
1201- function finished ( fails ) {
1202- completed ++ ;
1203- failures += fails ;
1204- if ( completed === workerCount ) {
1205- measure ( startTime ) ;
1206- if ( fold . isTravis ( ) ) console . log ( fold . end ( "lint" ) ) ;
1207- if ( failures > 0 ) {
1208- fail ( 'Linter errors.' , failed ) ;
1209- }
1210- else {
1211- complete ( ) ;
1212- }
1213- }
1214- }
1215- } , { async : true } ) ;
1192+ } ) ;
0 commit comments