@@ -128,6 +128,19 @@ task("build-src", series(preSrc, buildSrc));
128128const cleanSrc = ( ) => cleanProject ( "src" ) ;
129129task ( "clean-src" , cleanSrc ) ;
130130
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+ }
131144
132145/** @type {string | undefined } */
133146let copyrightHeader ;
@@ -275,6 +288,7 @@ const esbuildServices = esbuildTask("./src/typescript/typescript.ts", "./built/l
275288const writeServicesCJSShim = ( ) => writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
276289const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
277290
291+ // TODO(jakebailey): rename this; no longer "services".
278292const buildServices = ( ) => {
279293 if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
280294 writeServicesCJSShim ( ) ;
@@ -304,6 +318,9 @@ task("watch-services").flags = {
304318 " --built" : "Compile using the built version of the compiler."
305319} ;
306320
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" ;
307324
308325const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
309326const writeServerCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserver/server.js" , "./built/local/tsserver.js" ) ;
@@ -355,10 +372,11 @@ task("watch-min").flags = {
355372const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
356373const writeLsslCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
357374
375+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
358376const buildLssl = ( ) => {
359377 if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
360378 writeLsslCJSShim ( ) ;
361- return buildProject ( "src/tsserverlibrary" ) ;
379+ return buildLsslProject ( ) ;
362380} ;
363381task ( "lssl" , series ( preBuild , buildLssl ) ) ;
364382task ( "lssl" ) . description = "Builds language service server library" ;
@@ -382,6 +400,14 @@ task("watch-lssl").flags = {
382400 " --built" : "Compile using the built version of the compiler."
383401} ;
384402
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+
385411const testRunner = "./built/local/run.js" ;
386412const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
387413const writeTestsCJSShim = ( ) => writeCJSReexport ( "./built/local/testRunner/runner.js" , testRunner ) ;
@@ -492,7 +518,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
492518task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
493519task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
494520
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 ) ) ) ;
496522task ( "local" ) . description = "Builds the full compiler and services" ;
497523task ( "local" ) . flags = {
498524 " --built" : "Compile using the built version of the compiler."
@@ -508,7 +534,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
508534preTest . displayName = "preTest" ;
509535
510536const 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 ) ) ;
512538task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
513539task ( "runtests" ) . flags = {
514540 "-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -527,7 +553,7 @@ task("runtests").flags = {
527553} ;
528554
529555const 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 ) ) ;
531557task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
532558task ( "runtests-parallel" ) . flags = {
533559 " --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -613,8 +639,7 @@ const produceLKG = async () => {
613639 }
614640} ;
615641
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 ) ) ;
618643task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
619644task ( "LKG" ) . flags = {
620645 " --built" : "Compile using the built version of the compiler." ,
0 commit comments