@@ -126,6 +126,22 @@ const buildSrc = () => buildProject("src");
126
126
127
127
task ( "build-src" , series ( preSrc , buildSrc ) ) ;
128
128
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
+
129
145
/** @type {string | undefined } */
130
146
let copyrightHeader ;
131
147
function getCopyrightHeader ( ) {
@@ -261,10 +277,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
261
277
const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true ) ;
262
278
263
279
// TODO(jakebailey): rename this; no longer "services".
280
+
281
+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
282
+
264
283
const buildServices = ( ) => {
265
284
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
266
285
writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
267
- return buildProject ( "src/typescript" ) ;
286
+ return buildServicesProject ( ) ;
268
287
} ;
269
288
270
289
task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -287,6 +306,9 @@ task("watch-services").flags = {
287
306
" --built" : "Compile using the built version of the compiler."
288
307
} ;
289
308
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" ;
290
312
291
313
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true ) ;
292
314
@@ -333,10 +355,11 @@ task("watch-min").flags = {
333
355
334
356
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true ) ;
335
357
358
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
336
359
const buildLssl = ( ) => {
337
360
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
338
361
writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
339
- return buildProject ( "src/tsserverlibrary" ) ;
362
+ return buildLsslProject ( ) ;
340
363
} ;
341
364
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
342
365
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -358,6 +381,14 @@ task("watch-lssl").flags = {
358
381
" --built" : "Compile using the built version of the compiler."
359
382
} ;
360
383
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
+
361
392
const testRunner = "./built/local/run.js" ;
362
393
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
363
394
@@ -468,7 +499,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
468
499
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
469
500
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
470
501
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 ) ) ) ;
472
503
task ( "local" ) . description = "Builds the full compiler and services" ;
473
504
task ( "local" ) . flags = {
474
505
" --built" : "Compile using the built version of the compiler."
@@ -484,7 +515,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
484
515
preTest . displayName = "preTest" ;
485
516
486
517
const 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 ) ) ;
488
519
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
489
520
task ( "runtests" ) . flags = {
490
521
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -503,7 +534,7 @@ task("runtests").flags = {
503
534
} ;
504
535
505
536
const 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 ) ) ;
507
538
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
508
539
task ( "runtests-parallel" ) . flags = {
509
540
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -590,8 +621,7 @@ const produceLKG = async () => {
590
621
}
591
622
} ;
592
623
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 ) ) ;
595
625
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
596
626
task ( "LKG" ) . flags = {
597
627
" --built" : "Compile using the built version of the compiler." ,
0 commit comments