@@ -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 ( ) {
@@ -268,6 +284,7 @@ const esbuildServices = esbuildTask("./src/typescript/typescript.ts", "./built/l
268284const writeServicesCJSShim = ( ) => writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
269285const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
270286
287+ // TODO(jakebailey): rename this; no longer "services".
271288const buildServices = ( ) => {
272289 if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
273290 writeServicesCJSShim ( ) ;
@@ -297,6 +314,9 @@ task("watch-services").flags = {
297314 " --built" : "Compile using the built version of the compiler."
298315} ;
299316
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" ;
300320
301321const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
302322const writeServerCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserver/server.js" , "./built/local/tsserver.js" ) ;
@@ -348,10 +368,11 @@ task("watch-min").flags = {
348368const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
349369const writeLsslCJSShim = ( ) => writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
350370
371+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
351372const buildLssl = ( ) => {
352373 if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
353374 writeLsslCJSShim ( ) ;
354- return buildProject ( "src/tsserverlibrary" ) ;
375+ return buildLsslProject ( ) ;
355376} ;
356377task ( "lssl" , series ( preBuild , buildLssl ) ) ;
357378task ( "lssl" ) . description = "Builds language service server library" ;
@@ -375,6 +396,14 @@ task("watch-lssl").flags = {
375396 " --built" : "Compile using the built version of the compiler."
376397} ;
377398
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+
378407const testRunner = "./built/local/run.js" ;
379408const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
380409const writeTestsCJSShim = ( ) => writeCJSReexport ( "./built/local/testRunner/runner.js" , testRunner ) ;
@@ -488,7 +517,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
488517task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
489518task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
490519
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 ) ) ) ;
492521task ( "local" ) . description = "Builds the full compiler and services" ;
493522task ( "local" ) . flags = {
494523 " --built" : "Compile using the built version of the compiler."
@@ -504,7 +533,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
504533preTest . displayName = "preTest" ;
505534
506535const 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 ) ) ;
508537task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
509538task ( "runtests" ) . flags = {
510539 "-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -523,7 +552,7 @@ task("runtests").flags = {
523552} ;
524553
525554const 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 ) ) ;
527556task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
528557task ( "runtests-parallel" ) . flags = {
529558 " --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -613,8 +642,7 @@ const produceLKG = async () => {
613642 }
614643} ;
615644
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 ) ) ;
618646task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
619647task ( "LKG" ) . flags = {
620648 " --built" : "Compile using the built version of the compiler." ,
0 commit comments