@@ -34,6 +34,14 @@ const gulp = helpMaker(originalGulp);
34
34
35
35
Error . stackTraceLimit = 1000 ;
36
36
37
+ /**
38
+ * This regexp exists to capture our const enums and replace them with normal enums in our public API
39
+ * - this is fine since we compile with preserveConstEnums, and ensures our consumers are not locked
40
+ * to the TS version they compile with.
41
+ */
42
+ const constEnumCaptureRegexp = / ^ ( \s * ) ( e x p o r t ) ? c o n s t e n u m ( \S + ) { ( \s * ) $ / gm;
43
+ const constEnumReplacement = "$1$2enum $3 {$4" ;
44
+
37
45
const cmdLineOptions = minimist ( process . argv . slice ( 2 ) , {
38
46
boolean : [ "debug" , "inspect" , "light" , "colors" , "lint" , "soft" ] ,
39
47
string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" , "timeout" ] ,
@@ -261,8 +269,8 @@ function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): ts
261
269
}
262
270
if ( ! useDebugMode ) {
263
271
if ( copy . removeComments === undefined ) copy . removeComments = true ;
264
- copy . newLine = "lf" ;
265
272
}
273
+ copy . newLine = "lf" ;
266
274
if ( useBuiltCompiler === true ) {
267
275
copy . typescript = require ( "./built/local/typescript.js" ) ;
268
276
}
@@ -432,7 +440,7 @@ gulp.task(servicesFile, /*help*/ false, ["lib", "generate-diagnostics"], () => {
432
440
const completedDts = dts . pipe ( prependCopyright ( /*outputCopyright*/ true ) )
433
441
. pipe ( insert . transform ( ( contents , file ) => {
434
442
file . path = standaloneDefinitionsFile ;
435
- return contents . replace ( / ^ ( \s * ) ( e x p o r t ) ? c o n s t e n u m ( \S + ) { ( \s * ) $ / gm , "$1$2enum $3 {$4" ) ;
443
+ return contents . replace ( constEnumCaptureRegexp , constEnumReplacement ) ;
436
444
} ) ) ;
437
445
return merge2 ( [
438
446
completedJs ,
@@ -442,7 +450,7 @@ gulp.task(servicesFile, /*help*/ false, ["lib", "generate-diagnostics"], () => {
442
450
completedDts . pipe ( clone ( ) )
443
451
. pipe ( insert . transform ( ( content , file ) => {
444
452
file . path = nodeDefinitionsFile ;
445
- return content + "\r\ nexport = ts;" ;
453
+ return content + "\nexport = ts;" ;
446
454
} ) )
447
455
. pipe ( gulp . dest ( "src/services" ) ) ,
448
456
completedDts . pipe ( clone ( ) )
@@ -509,7 +517,7 @@ gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile, typesMapJson], (do
509
517
. pipe ( gulp . dest ( "src/server" ) ) ,
510
518
dts . pipe ( prependCopyright ( /*outputCopyright*/ true ) )
511
519
. pipe ( insert . transform ( ( content ) => {
512
- return content + "\r\ nexport = ts;\r \nexport as namespace ts;" ;
520
+ return content . replace ( constEnumCaptureRegexp , constEnumReplacement ) + "\nexport = ts;\nexport as namespace ts;" ;
513
521
} ) )
514
522
. pipe ( gulp . dest ( "src/server" ) )
515
523
] ) ;
@@ -588,7 +596,7 @@ gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUse
588
596
589
597
// Task to build the tests infrastructure using the built compiler
590
598
const run = path . join ( builtLocalDirectory , "run.js" ) ;
591
- gulp . task ( run , /*help*/ false , [ servicesFile ] , ( ) => {
599
+ gulp . task ( run , /*help*/ false , [ servicesFile , tsserverLibraryFile ] , ( ) => {
592
600
const testProject = tsc . createProject ( "src/harness/tsconfig.json" , getCompilerSettings ( { } , /*useBuiltCompiler*/ true ) ) ;
593
601
return testProject . src ( )
594
602
. pipe ( newer ( run ) )
0 commit comments