@@ -127,6 +127,22 @@ const buildSrc = () => buildProject("src");
127
127
// But, if we are bundling, we are running only d.ts emit, so maybe this is fast?
128
128
task ( "build-src" , series ( preSrc , buildSrc ) ) ;
129
129
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
+
130
146
/** @type {string | undefined } */
131
147
let copyrightHeader ;
132
148
function getCopyrightHeader ( ) {
@@ -252,10 +268,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
252
268
const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
253
269
254
270
// TODO(jakebailey): rename this; no longer "services".
271
+
272
+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
273
+
255
274
const buildServices = ( ) => {
256
275
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
257
276
writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
258
- return buildProject ( "src/typescript" ) ;
277
+ return buildServicesProject ( ) ;
259
278
} ;
260
279
261
280
task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -278,6 +297,9 @@ task("watch-services").flags = {
278
297
" --built" : "Compile using the built version of the compiler."
279
298
} ;
280
299
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" ;
281
303
282
304
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
283
305
@@ -324,10 +346,11 @@ task("watch-min").flags = {
324
346
325
347
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
326
348
349
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
327
350
const buildLssl = ( ) => {
328
351
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
329
352
writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
330
- return buildProject ( "src/tsserverlibrary" ) ;
353
+ return buildLsslProject ( ) ;
331
354
} ;
332
355
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
333
356
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -349,6 +372,14 @@ task("watch-lssl").flags = {
349
372
" --built" : "Compile using the built version of the compiler."
350
373
} ;
351
374
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
+
352
383
const testRunner = "./built/local/run.js" ;
353
384
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
354
385
@@ -459,7 +490,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
459
490
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
460
491
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
461
492
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 ) ) ) ;
463
494
task ( "local" ) . description = "Builds the full compiler and services" ;
464
495
task ( "local" ) . flags = {
465
496
" --built" : "Compile using the built version of the compiler."
@@ -475,7 +506,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
475
506
preTest . displayName = "preTest" ;
476
507
477
508
const 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 ) ) ;
479
510
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
480
511
task ( "runtests" ) . flags = {
481
512
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -494,7 +525,7 @@ task("runtests").flags = {
494
525
} ;
495
526
496
527
const 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 ) ) ;
498
529
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
499
530
task ( "runtests-parallel" ) . flags = {
500
531
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -598,8 +629,7 @@ const produceLKG = async () => {
598
629
}
599
630
} ;
600
631
601
- // TODO(jakebailey): dependencies on dts
602
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
632
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
603
633
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
604
634
task ( "LKG" ) . flags = {
605
635
" --built" : "Compile using the built version of the compiler." ,
0 commit comments