@@ -126,6 +126,22 @@ const buildSrc = () => buildProject("src");
126126
127127task ( "build-src" , series ( preSrc , buildSrc ) ) ;
128128
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+
129145/** @type {string | undefined } */
130146let copyrightHeader ;
131147function getCopyrightHeader ( ) {
@@ -261,10 +277,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
261277const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true ) ;
262278
263279// TODO(jakebailey): rename this; no longer "services".
280+
281+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
282+
264283const buildServices = ( ) => {
265284 if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
266285 writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
267- return buildProject ( "src/typescript" ) ;
286+ return buildServicesProject ( ) ;
268287} ;
269288
270289task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -287,6 +306,9 @@ task("watch-services").flags = {
287306 " --built" : "Compile using the built version of the compiler."
288307} ;
289308
309+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
310+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
311+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
290312
291313const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
292314
@@ -333,10 +355,11 @@ task("watch-min").flags = {
333355
334356const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
335357
358+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
336359const buildLssl = ( ) => {
337360 if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
338361 writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
339- return buildProject ( "src/tsserverlibrary" ) ;
362+ return buildLsslProject ( ) ;
340363} ;
341364task ( "lssl" , series ( preBuild , buildLssl ) ) ;
342365task ( "lssl" ) . description = "Builds language service server library" ;
@@ -358,6 +381,14 @@ task("watch-lssl").flags = {
358381 " --built" : "Compile using the built version of the compiler."
359382} ;
360383
384+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
385+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
386+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
387+
388+ // TODO(jakebailey): this is probably not efficient, but, gulp.
389+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
390+ task ( "dts" , dts ) ;
391+
361392const testRunner = "./built/local/run.js" ;
362393const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
363394
@@ -468,7 +499,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
468499task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
469500task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
470501
471- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
502+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
472503task ( "local" ) . description = "Builds the full compiler and services" ;
473504task ( "local" ) . flags = {
474505 " --built" : "Compile using the built version of the compiler."
@@ -484,7 +515,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
484515preTest . displayName = "preTest" ;
485516
486517const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
487- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
518+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
488519task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
489520task ( "runtests" ) . flags = {
490521 "-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -503,7 +534,7 @@ task("runtests").flags = {
503534} ;
504535
505536const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
506- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
537+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
507538task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
508539task ( "runtests-parallel" ) . flags = {
509540 " --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -590,8 +621,7 @@ const produceLKG = async () => {
590621 }
591622} ;
592623
593- // TODO(jakebailey): dependencies on dts
594- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
624+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
595625task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
596626task ( "LKG" ) . flags = {
597627 " --built" : "Compile using the built version of the compiler." ,
0 commit comments