@@ -15,6 +15,7 @@ var servicesDirectory = "src/services/";
15
15
var serverDirectory = "src/server/" ;
16
16
var typingsInstallerDirectory = "src/server/typingsInstaller" ;
17
17
var cancellationTokenDirectory = "src/server/cancellationToken" ;
18
+ var watchGuardDirectory = "src/server/watchGuard" ;
18
19
var harnessDirectory = "src/harness/" ;
19
20
var libraryDirectory = "src/lib/" ;
20
21
var scriptsDirectory = "scripts/" ;
@@ -80,6 +81,7 @@ var compilerSources = filesFromConfig("./src/compiler/tsconfig.json");
80
81
var servicesSources = filesFromConfig ( "./src/services/tsconfig.json" ) ;
81
82
var cancellationTokenSources = filesFromConfig ( path . join ( serverDirectory , "cancellationToken/tsconfig.json" ) ) ;
82
83
var typingsInstallerSources = filesFromConfig ( path . join ( serverDirectory , "typingsInstaller/tsconfig.json" ) ) ;
84
+ var watchGuardSources = filesFromConfig ( path . join ( serverDirectory , "watchGuard/tsconfig.json" ) ) ;
83
85
var serverSources = filesFromConfig ( path . join ( serverDirectory , "tsconfig.json" ) )
84
86
var languageServiceLibrarySources = filesFromConfig ( path . join ( serverDirectory , "tsconfig.library.json" ) ) ;
85
87
@@ -129,6 +131,8 @@ var harnessSources = harnessCoreSources.concat([
129
131
"matchFiles.ts" ,
130
132
"initializeTSConfig.ts" ,
131
133
"printer.ts" ,
134
+ "transform.ts" ,
135
+ "customTransforms.ts" ,
132
136
] . map ( function ( f ) {
133
137
return path . join ( unittestsDirectory , f ) ;
134
138
} ) ) . concat ( [
@@ -170,13 +174,21 @@ var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
170
174
var es2017LibrarySource = [
171
175
"es2017.object.d.ts" ,
172
176
"es2017.sharedmemory.d.ts" ,
173
- "es2017.string.d.ts" ,
177
+ "es2017.string.d.ts"
174
178
] ;
175
179
176
180
var es2017LibrarySourceMap = es2017LibrarySource . map ( function ( source ) {
177
181
return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
178
182
} ) ;
179
183
184
+ var esnextLibrarySource = [
185
+ "esnext.asynciterable.d.ts"
186
+ ] ;
187
+
188
+ var esnextLibrarySourceMap = esnextLibrarySource . map ( function ( source ) {
189
+ return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
190
+ } ) ;
191
+
180
192
var hostsLibrarySources = [ "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scripthost.d.ts" ] ;
181
193
182
194
var librarySourceMap = [
@@ -191,11 +203,12 @@ var librarySourceMap = [
191
203
{ target : "lib.es2015.d.ts" , sources : [ "header.d.ts" , "es2015.d.ts" ] } ,
192
204
{ target : "lib.es2016.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] } ,
193
205
{ target : "lib.es2017.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] } ,
206
+ { target : "lib.esnext.d.ts" , sources : [ "header.d.ts" , "esnext.d.ts" ] } ,
194
207
195
208
// JavaScript + all host library
196
209
{ target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) } ,
197
210
{ target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) }
198
- ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap ) ;
211
+ ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap , esnextLibrarySourceMap ) ;
199
212
200
213
var libraryTargets = librarySourceMap . map ( function ( f ) {
201
214
return path . join ( builtLocalDirectory , f . target ) ;
@@ -315,8 +328,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
315
328
if ( opts . stripInternal ) {
316
329
options += " --stripInternal" ;
317
330
}
318
-
319
- options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters" ;
331
+ options += " --target es5" ;
332
+ if ( opts . lib ) {
333
+ options += " --lib " + opts . lib
334
+ }
335
+ else {
336
+ options += " --lib es5,scripthost"
337
+ }
338
+ options += " --noUnusedLocals --noUnusedParameters" ;
320
339
321
340
var cmd = host + " " + compilerPath + " " + options + " " ;
322
341
cmd = cmd + sources . join ( " " ) ;
@@ -570,8 +589,11 @@ compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirector
570
589
var typingsInstallerFile = path . join ( builtLocalDirectory , "typingsInstaller.js" ) ;
571
590
compileFile ( typingsInstallerFile , typingsInstallerSources , [ builtLocalDirectory ] . concat ( typingsInstallerSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { outDir : builtLocalDirectory , noOutFile : false } ) ;
572
591
592
+ var watchGuardFile = path . join ( builtLocalDirectory , "watchGuard.js" ) ;
593
+ compileFile ( watchGuardFile , watchGuardSources , [ builtLocalDirectory ] . concat ( watchGuardSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { outDir : builtLocalDirectory , noOutFile : false } ) ;
594
+
573
595
var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
574
- compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true } ) ;
596
+ compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile , watchGuardFile ] . concat ( serverSources ) . concat ( servicesSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true } ) ;
575
597
var tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
576
598
var tsserverLibraryDefinitionFile = path . join ( builtLocalDirectory , "tsserverlibrary.d.ts" ) ;
577
599
compileFile (
@@ -665,7 +687,7 @@ task("generate-spec", [specMd]);
665
687
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
666
688
desc ( "Makes a new LKG out of the built js files" ) ;
667
689
task ( "LKG" , [ "clean" , "release" , "local" ] . concat ( libraryTargets ) , function ( ) {
668
- var expectedFiles = [ tscFile , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile , cancellationTokenFile , typingsInstallerFile , buildProtocolDts ] . concat ( libraryTargets ) ;
690
+ var expectedFiles = [ tscFile , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile , cancellationTokenFile , typingsInstallerFile , buildProtocolDts , watchGuardFile ] . concat ( libraryTargets ) ;
669
691
var missingFiles = expectedFiles . filter ( function ( f ) {
670
692
return ! fs . existsSync ( f ) ;
671
693
} ) ;
@@ -778,6 +800,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
778
800
}
779
801
780
802
var debug = process . env . debug || process . env . d ;
803
+ var inspect = process . env . inspect ;
781
804
tests = process . env . test || process . env . tests || process . env . t ;
782
805
var light = process . env . light || false ;
783
806
var stackTraceLimit = process . env . stackTraceLimit ;
@@ -807,18 +830,39 @@ function runConsoleTests(defaultReporter, runInParallel) {
807
830
testTimeout = 800000 ;
808
831
}
809
832
810
- colors = process . env . colors || process . env . color ;
811
- colors = colors ? ' --no-colors ' : ' --colors ' ;
812
- reporter = process . env . reporter || process . env . r || defaultReporter ;
813
- var bail = ( process . env . bail || process . env . b ) ? "--bail" : "" ;
833
+ var colors = process . env . colors || process . env . color || true ;
834
+ var reporter = process . env . reporter || process . env . r || defaultReporter ;
835
+ var bail = process . env . bail || process . env . b ;
814
836
var lintFlag = process . env . lint !== 'false' ;
815
837
816
838
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
817
839
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
818
840
if ( ! runInParallel ) {
819
841
var startTime = mark ( ) ;
820
- tests = tests ? ' -g "' + tests + '"' : '' ;
821
- var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run ;
842
+ var args = [ ] ;
843
+ if ( inspect ) {
844
+ args . push ( "--inspect" ) ;
845
+ }
846
+ if ( inspect || debug ) {
847
+ args . push ( "--debug-brk" ) ;
848
+ }
849
+ args . push ( "-R" , reporter ) ;
850
+ if ( tests ) {
851
+ args . push ( "-g" , `"${ tests } "` ) ;
852
+ }
853
+ if ( colors ) {
854
+ args . push ( "--colors" ) ;
855
+ }
856
+ else {
857
+ args . push ( "--no-colors" ) ;
858
+ }
859
+ if ( bail ) {
860
+ args . push ( "--bail" ) ;
861
+ }
862
+ args . push ( "-t" , testTimeout ) ;
863
+ args . push ( run ) ;
864
+
865
+ var cmd = "mocha " + args . join ( " " ) ;
822
866
console . log ( cmd ) ;
823
867
824
868
var savedNodeEnv = process . env . NODE_ENV ;
@@ -839,7 +883,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
839
883
var savedNodeEnv = process . env . NODE_ENV ;
840
884
process . env . NODE_ENV = "development" ;
841
885
var startTime = mark ( ) ;
842
- runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
886
+ runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : ! colors } , function ( err ) {
843
887
process . env . NODE_ENV = savedNodeEnv ;
844
888
measure ( startTime ) ;
845
889
// last worker clean everything and runs linter in case if there were no errors
@@ -1072,7 +1116,7 @@ desc("Compiles tslint rules to js");
1072
1116
task ( "build-rules" , [ "build-rules-start" ] . concat ( tslintRulesOutFiles ) . concat ( [ "build-rules-end" ] ) ) ;
1073
1117
tslintRulesFiles . forEach ( function ( ruleFile , i ) {
1074
1118
compileFile ( tslintRulesOutFiles [ i ] , [ ruleFile ] , [ ruleFile ] , [ ] , /*useBuiltCompiler*/ false ,
1075
- { noOutFile : true , generateDeclarations : false , outDir : path . join ( builtLocalDirectory , "tslint" ) } ) ;
1119
+ { noOutFile : true , generateDeclarations : false , outDir : path . join ( builtLocalDirectory , "tslint" ) , lib : "es6" } ) ;
1076
1120
} ) ;
1077
1121
1078
1122
desc ( "Emit the start of the build-rules fold" ) ;
0 commit comments