@@ -11,11 +11,7 @@ var ts = require("./lib/typescript");
11
11
12
12
// Variables
13
13
var compilerDirectory = "src/compiler/" ;
14
- var servicesDirectory = "src/services/" ;
15
14
var serverDirectory = "src/server/" ;
16
- var typingsInstallerDirectory = "src/server/typingsInstaller" ;
17
- var cancellationTokenDirectory = "src/server/cancellationToken" ;
18
- var watchGuardDirectory = "src/server/watchGuard" ;
19
15
var harnessDirectory = "src/harness/" ;
20
16
var libraryDirectory = "src/lib/" ;
21
17
var scriptsDirectory = "scripts/" ;
@@ -131,6 +127,7 @@ var harnessSources = harnessCoreSources.concat([
131
127
"matchFiles.ts" ,
132
128
"initializeTSConfig.ts" ,
133
129
"printer.ts" ,
130
+ "textChanges.ts" ,
134
131
"transform.ts" ,
135
132
"customTransforms.ts" ,
136
133
] . map ( function ( f ) {
@@ -328,8 +325,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
328
325
if ( opts . stripInternal ) {
329
326
options += " --stripInternal" ;
330
327
}
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" ;
333
336
334
337
var cmd = host + " " + compilerPath + " " + options + " " ;
335
338
cmd = cmd + sources . join ( " " ) ;
@@ -416,7 +419,7 @@ compileFile(buildProtocolJs,
416
419
[ buildProtocolTs ] ,
417
420
[ ] ,
418
421
/*useBuiltCompiler*/ false ,
419
- { noOutFile : true } ) ;
422
+ { noOutFile : true , lib : "es6" } ) ;
420
423
421
424
file ( buildProtocolDts , [ buildProtocolTs , buildProtocolJs , typescriptServicesDts ] , function ( ) {
422
425
@@ -578,16 +581,16 @@ compileFile(
578
581
file ( typescriptServicesDts , [ servicesFile ] ) ;
579
582
580
583
var 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" } ) ;
582
585
583
586
var 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" } ) ;
585
588
586
589
var 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" } ) ;
588
591
589
592
var 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" } ) ;
591
594
var tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
592
595
var tsserverLibraryDefinitionFile = path . join ( builtLocalDirectory , "tsserverlibrary.d.ts" ) ;
593
596
compileFile (
@@ -711,7 +714,7 @@ compileFile(
711
714
/*prereqs*/ [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( servicesSources ) . concat ( harnessSources ) ,
712
715
/*prefixes*/ [ ] ,
713
716
/*useBuiltCompiler:*/ true ,
714
- /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] } ) ;
717
+ /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] , lib : "es6" } ) ;
715
718
716
719
var internalTests = "internal/" ;
717
720
@@ -1098,7 +1101,8 @@ var tslintRules = [
1098
1101
"noInOperatorRule" ,
1099
1102
"noIncrementDecrementRule" ,
1100
1103
"objectLiteralSurroundingSpaceRule" ,
1101
- "noTypeAssertionWhitespaceRule"
1104
+ "noTypeAssertionWhitespaceRule" ,
1105
+ "noBomRule"
1102
1106
] ;
1103
1107
var tslintRulesFiles = tslintRules . map ( function ( p ) {
1104
1108
return path . join ( tslintRuleDir , p + ".ts" ) ;
@@ -1110,7 +1114,7 @@ desc("Compiles tslint rules to js");
1110
1114
task ( "build-rules" , [ "build-rules-start" ] . concat ( tslintRulesOutFiles ) . concat ( [ "build-rules-end" ] ) ) ;
1111
1115
tslintRulesFiles . forEach ( function ( ruleFile , i ) {
1112
1116
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" } ) ;
1114
1118
} ) ;
1115
1119
1116
1120
desc ( "Emit the start of the build-rules fold" ) ;
@@ -1173,43 +1177,16 @@ function spawnLintWorker(files, callback) {
1173
1177
}
1174
1178
1175
1179
desc ( "Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex" ) ;
1176
- task ( "lint" , [ "build-rules" ] , function ( ) {
1180
+ task ( "lint" , [ "build-rules" ] , ( ) => {
1177
1181
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 ( ) ;
1193
1191
} ) ;
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