@@ -126,6 +126,22 @@ const buildSrc = () => buildProject("src");
126
126
127
127
task ( "build-src" , series ( preSrc , buildSrc ) ) ;
128
128
129
+ /**
130
+ * @param {string } entrypoint
131
+ * @param {string } output
132
+ */
133
+ async function runDtsBundler ( entrypoint , output ) {
134
+ // Want to preserve @internal ? Pass `--stripInternal=false` when running the dts task.
135
+ await exec ( process . execPath , [
136
+ "./scripts/dtsBundler.js" ,
137
+ "--entrypoint" ,
138
+ entrypoint ,
139
+ "--output" ,
140
+ output ,
141
+ `--stripInternal=${ cmdLineOptions . stripInternal } ` ,
142
+ ] ) ;
143
+ }
144
+
129
145
/** @type {string | undefined } */
130
146
let copyrightHeader ;
131
147
function getCopyrightHeader ( ) {
@@ -268,6 +284,7 @@ const esbuildServices = esbuildTask("./src/typescript/typescript.ts", "./built/l
268
284
const writeServicesCJSShim = ( ) => writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
269
285
const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
270
286
287
+ // TODO(jakebailey): rename this; no longer "services".
271
288
const buildServices = ( ) => {
272
289
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
273
290
writeServicesCJSShim ( ) ;
@@ -297,6 +314,9 @@ task("watch-services").flags = {
297
314
" --built" : "Compile using the built version of the compiler."
298
315
} ;
299
316
317
+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
318
+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
319
+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
300
320
301
321
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
302
322
const writeServerCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserver/server.js" , "./built/local/tsserver.js" ) ;
@@ -348,10 +368,11 @@ task("watch-min").flags = {
348
368
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
349
369
const writeLsslCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
350
370
371
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
351
372
const buildLssl = ( ) => {
352
373
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
353
374
writeLsslCJSShim ( ) ;
354
- return buildProject ( "src/tsserverlibrary" ) ;
375
+ return buildLsslProject ( ) ;
355
376
} ;
356
377
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
357
378
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -375,6 +396,14 @@ task("watch-lssl").flags = {
375
396
" --built" : "Compile using the built version of the compiler."
376
397
} ;
377
398
399
+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
400
+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
401
+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
402
+
403
+ // TODO(jakebailey): this is probably not efficient, but, gulp.
404
+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
405
+ task ( "dts" , dts ) ;
406
+
378
407
const testRunner = "./built/local/run.js" ;
379
408
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
380
409
const writeTestsCJSShim = ( ) => writeCJSReexport ( "./built/local/testRunner/runner.js" , testRunner ) ;
@@ -488,7 +517,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
488
517
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
489
518
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
490
519
491
- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
520
+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
492
521
task ( "local" ) . description = "Builds the full compiler and services" ;
493
522
task ( "local" ) . flags = {
494
523
" --built" : "Compile using the built version of the compiler."
@@ -504,7 +533,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
504
533
preTest . displayName = "preTest" ;
505
534
506
535
const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
507
- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
536
+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
508
537
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
509
538
task ( "runtests" ) . flags = {
510
539
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -523,7 +552,7 @@ task("runtests").flags = {
523
552
} ;
524
553
525
554
const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
526
- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
555
+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
527
556
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
528
557
task ( "runtests-parallel" ) . flags = {
529
558
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -613,8 +642,7 @@ const produceLKG = async () => {
613
642
}
614
643
} ;
615
644
616
- // TODO(jakebailey): dependencies on dts
617
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
645
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
618
646
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
619
647
task ( "LKG" ) . flags = {
620
648
" --built" : "Compile using the built version of the compiler." ,
0 commit comments