@@ -127,6 +127,22 @@ const buildSrc = () => buildProject("src");
127127// But, if we are bundling, we are running only d.ts emit, so maybe this is fast?
128128task ( "build-src" , series ( preSrc , buildSrc ) ) ;
129129
130+ /**
131+ * @param {string } entrypoint
132+ * @param {string } output
133+ */
134+ async function runDtsBundler ( entrypoint , output ) {
135+ // Want to preserve @internal ? Pass `--stripInternal=false` when running the dts task.
136+ await exec ( process . execPath , [
137+ "./scripts/dtsBundler.js" ,
138+ "--entrypoint" ,
139+ entrypoint ,
140+ "--output" ,
141+ output ,
142+ `--stripInternal=${ cmdLineOptions . stripInternal } ` ,
143+ ] ) ;
144+ }
145+
130146/** @type {string | undefined } */
131147let copyrightHeader ;
132148function getCopyrightHeader ( ) {
@@ -252,10 +268,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
252268const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
253269
254270// TODO(jakebailey): rename this; no longer "services".
271+
272+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
273+
255274const buildServices = ( ) => {
256275 if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
257276 writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
258- return buildProject ( "src/typescript" ) ;
277+ return buildServicesProject ( ) ;
259278} ;
260279
261280task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -278,6 +297,9 @@ task("watch-services").flags = {
278297 " --built" : "Compile using the built version of the compiler."
279298} ;
280299
300+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
301+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
302+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
281303
282304const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
283305
@@ -324,10 +346,11 @@ task("watch-min").flags = {
324346
325347const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
326348
349+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
327350const buildLssl = ( ) => {
328351 if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
329352 writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
330- return buildProject ( "src/tsserverlibrary" ) ;
353+ return buildLsslProject ( ) ;
331354} ;
332355task ( "lssl" , series ( preBuild , buildLssl ) ) ;
333356task ( "lssl" ) . description = "Builds language service server library" ;
@@ -349,6 +372,14 @@ task("watch-lssl").flags = {
349372 " --built" : "Compile using the built version of the compiler."
350373} ;
351374
375+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
376+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
377+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
378+
379+ // TODO(jakebailey): this is probably not efficient, but, gulp.
380+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
381+ task ( "dts" , dts ) ;
382+
352383const testRunner = "./built/local/run.js" ;
353384const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
354385
@@ -459,7 +490,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
459490task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
460491task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
461492
462- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
493+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
463494task ( "local" ) . description = "Builds the full compiler and services" ;
464495task ( "local" ) . flags = {
465496 " --built" : "Compile using the built version of the compiler."
@@ -475,7 +506,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
475506preTest . displayName = "preTest" ;
476507
477508const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
478- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
509+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
479510task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
480511task ( "runtests" ) . flags = {
481512 "-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -494,7 +525,7 @@ task("runtests").flags = {
494525} ;
495526
496527const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
497- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
528+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
498529task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
499530task ( "runtests-parallel" ) . flags = {
500531 " --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -581,8 +612,7 @@ const produceLKG = async () => {
581612 }
582613} ;
583614
584- // TODO(jakebailey): dependencies on dts
585- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
615+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
586616task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
587617task ( "LKG" ) . flags = {
588618 " --built" : "Compile using the built version of the compiler." ,
0 commit comments