@@ -125,6 +125,22 @@ const buildSrc = () => buildProject("src");
125
125
126
126
task ( "build-src" , series ( preSrc , buildSrc ) ) ;
127
127
128
+ /**
129
+ * @param {string } entrypoint
130
+ * @param {string } output
131
+ */
132
+ async function runDtsBundler ( entrypoint , output ) {
133
+ // Want to preserve @internal ? Pass `--stripInternal=false` when running the dts task.
134
+ await exec ( process . execPath , [
135
+ "./scripts/dtsBundler.js" ,
136
+ "--entrypoint" ,
137
+ entrypoint ,
138
+ "--output" ,
139
+ output ,
140
+ `--stripInternal=${ cmdLineOptions . stripInternal } ` ,
141
+ ] ) ;
142
+ }
143
+
128
144
/** @type {string | undefined } */
129
145
let copyrightHeader ;
130
146
function getCopyrightHeader ( ) {
@@ -250,10 +266,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
250
266
const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
251
267
252
268
// TODO(jakebailey): rename this; no longer "services".
269
+
270
+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
271
+
253
272
const buildServices = ( ) => {
254
273
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
255
274
writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
256
- return buildProject ( "src/typescript" ) ;
275
+ return buildServicesProject ( ) ;
257
276
} ;
258
277
259
278
task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -276,6 +295,9 @@ task("watch-services").flags = {
276
295
" --built" : "Compile using the built version of the compiler."
277
296
} ;
278
297
298
+ const dtsServices = ( ) => runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
299
+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
300
+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
279
301
280
302
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
281
303
@@ -322,10 +344,11 @@ task("watch-min").flags = {
322
344
323
345
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
324
346
347
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
325
348
const buildLssl = ( ) => {
326
349
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
327
350
writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
328
- return buildProject ( "src/tsserverlibrary" ) ;
351
+ return buildLsslProject ( ) ;
329
352
} ;
330
353
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
331
354
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -347,6 +370,14 @@ task("watch-lssl").flags = {
347
370
" --built" : "Compile using the built version of the compiler."
348
371
} ;
349
372
373
+ const dtsLssl = ( ) => runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
374
+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
375
+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
376
+
377
+ // TODO(jakebailey): this is probably not efficient, but, gulp.
378
+ const dts = series ( preBuild , parallel ( buildServicesProject , buildLsslProject ) , parallel ( dtsServices , dtsLssl ) ) ;
379
+ task ( "dts" , dts ) ;
380
+
350
381
const testRunner = "./built/local/run.js" ;
351
382
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
352
383
@@ -457,7 +488,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
457
488
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
458
489
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
459
490
460
- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
491
+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
461
492
task ( "local" ) . description = "Builds the full compiler and services" ;
462
493
task ( "local" ) . flags = {
463
494
" --built" : "Compile using the built version of the compiler."
@@ -473,7 +504,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
473
504
preTest . displayName = "preTest" ;
474
505
475
506
const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
476
- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
507
+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
477
508
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
478
509
task ( "runtests" ) . flags = {
479
510
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -492,7 +523,7 @@ task("runtests").flags = {
492
523
} ;
493
524
494
525
const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
495
- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
526
+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
496
527
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
497
528
task ( "runtests-parallel" ) . flags = {
498
529
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -579,8 +610,7 @@ const produceLKG = async () => {
579
610
}
580
611
} ;
581
612
582
- // TODO(jakebailey): dependencies on dts
583
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
613
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
584
614
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
585
615
task ( "LKG" ) . flags = {
586
616
" --built" : "Compile using the built version of the compiler." ,
0 commit comments