@@ -128,6 +128,19 @@ task("build-src", series(preSrc, buildSrc));
128
128
const cleanSrc = ( ) => cleanProject ( "src" ) ;
129
129
task ( "clean-src" , cleanSrc ) ;
130
130
131
+ /**
132
+ * @param {string } entrypoint
133
+ * @param {string } output
134
+ */
135
+ async function runDtsBundler ( entrypoint , output ) {
136
+ await exec ( process . execPath , [
137
+ "./scripts/dtsBundler.mjs" ,
138
+ "--entrypoint" ,
139
+ entrypoint ,
140
+ "--output" ,
141
+ output ,
142
+ ] ) ;
143
+ }
131
144
132
145
/** @type {string | undefined } */
133
146
let copyrightHeader ;
@@ -275,6 +288,7 @@ const esbuildServices = esbuildTask("./src/typescript/typescript.ts", "./built/l
275
288
const writeServicesCJSShim = ( ) => writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
276
289
const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
277
290
291
+ // TODO(jakebailey): rename this; no longer "services".
278
292
const buildServices = ( ) => {
279
293
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
280
294
writeServicesCJSShim ( ) ;
@@ -304,6 +318,9 @@ task("watch-services").flags = {
304
318
" --built" : "Compile using the built version of the compiler."
305
319
} ;
306
320
321
+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
322
+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
323
+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
307
324
308
325
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
309
326
const writeServerCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserver/server.js" , "./built/local/tsserver.js" ) ;
@@ -355,10 +372,11 @@ task("watch-min").flags = {
355
372
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
356
373
const writeLsslCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
357
374
375
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
358
376
const buildLssl = ( ) => {
359
377
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
360
378
writeLsslCJSShim ( ) ;
361
- return buildProject ( "src/tsserverlibrary" ) ;
379
+ return buildLsslProject ( ) ;
362
380
} ;
363
381
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
364
382
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -382,6 +400,14 @@ task("watch-lssl").flags = {
382
400
" --built" : "Compile using the built version of the compiler."
383
401
} ;
384
402
403
+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
404
+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
405
+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
406
+
407
+ // TODO(jakebailey): this is probably not efficient, but, gulp.
408
+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
409
+ task ( "dts" , dts ) ;
410
+
385
411
const testRunner = "./built/local/run.js" ;
386
412
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
387
413
const writeTestsCJSShim = ( ) => writeCJSReexport ( "./built/local/testRunner/runner.js" , testRunner ) ;
@@ -492,7 +518,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
492
518
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
493
519
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
494
520
495
- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
521
+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
496
522
task ( "local" ) . description = "Builds the full compiler and services" ;
497
523
task ( "local" ) . flags = {
498
524
" --built" : "Compile using the built version of the compiler."
@@ -508,7 +534,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
508
534
preTest . displayName = "preTest" ;
509
535
510
536
const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
511
- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
537
+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
512
538
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
513
539
task ( "runtests" ) . flags = {
514
540
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -527,7 +553,7 @@ task("runtests").flags = {
527
553
} ;
528
554
529
555
const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
530
- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
556
+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
531
557
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
532
558
task ( "runtests-parallel" ) . flags = {
533
559
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -613,8 +639,7 @@ const produceLKG = async () => {
613
639
}
614
640
} ;
615
641
616
- // TODO(jakebailey): dependencies on dts
617
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
642
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
618
643
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
619
644
task ( "LKG" ) . flags = {
620
645
" --built" : "Compile using the built version of the compiler." ,
0 commit comments