@@ -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 ( ) {
@@ -265,10 +281,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
265
281
const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
266
282
267
283
// TODO(jakebailey): rename this; no longer "services".
284
+
285
+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
286
+
268
287
const buildServices = ( ) => {
269
288
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
270
289
writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
271
- return buildProject ( "src/typescript" ) ;
290
+ return buildServicesProject ( ) ;
272
291
} ;
273
292
274
293
task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -291,6 +310,9 @@ task("watch-services").flags = {
291
310
" --built" : "Compile using the built version of the compiler."
292
311
} ;
293
312
313
+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
314
+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
315
+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
294
316
295
317
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
296
318
@@ -337,10 +359,11 @@ task("watch-min").flags = {
337
359
338
360
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
339
361
362
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
340
363
const buildLssl = ( ) => {
341
364
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
342
365
writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
343
- return buildProject ( "src/tsserverlibrary" ) ;
366
+ return buildLsslProject ( ) ;
344
367
} ;
345
368
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
346
369
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -362,6 +385,14 @@ task("watch-lssl").flags = {
362
385
" --built" : "Compile using the built version of the compiler."
363
386
} ;
364
387
388
+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
389
+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
390
+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
391
+
392
+ // TODO(jakebailey): this is probably not efficient, but, gulp.
393
+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
394
+ task ( "dts" , dts ) ;
395
+
365
396
const testRunner = "./built/local/run.js" ;
366
397
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
367
398
@@ -472,7 +503,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
472
503
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
473
504
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
474
505
475
- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
506
+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
476
507
task ( "local" ) . description = "Builds the full compiler and services" ;
477
508
task ( "local" ) . flags = {
478
509
" --built" : "Compile using the built version of the compiler."
@@ -488,7 +519,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
488
519
preTest . displayName = "preTest" ;
489
520
490
521
const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
491
- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
522
+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
492
523
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
493
524
task ( "runtests" ) . flags = {
494
525
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -507,7 +538,7 @@ task("runtests").flags = {
507
538
} ;
508
539
509
540
const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
510
- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
541
+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
511
542
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
512
543
task ( "runtests-parallel" ) . flags = {
513
544
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -594,8 +625,7 @@ const produceLKG = async () => {
594
625
}
595
626
} ;
596
627
597
- // TODO(jakebailey): dependencies on dts
598
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
628
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
599
629
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
600
630
task ( "LKG" ) . flags = {
601
631
" --built" : "Compile using the built version of the compiler." ,
0 commit comments