@@ -127,6 +127,15 @@ 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 } projectPath
132
+ * @param {string } entrypoint
133
+ * @param {string } output
134
+ */
135
+ async function runDtsBundler ( projectPath , entrypoint , output ) {
136
+ await exec ( process . execPath , [ "./scripts/dtsBundler.js" , projectPath , entrypoint , output ] ) ;
137
+ }
138
+
130
139
/** @type {string | undefined } */
131
140
let copyrightHeader ;
132
141
function getCopyrightHeader ( ) {
@@ -143,6 +152,7 @@ function getCopyrightHeader() {
143
152
* @param {boolean } performanceMatters True if this is a bundle where performance matters, so should be optimized at the cost of build time.
144
153
*/
145
154
function esbuildTask ( entrypoint , outfile , exportIsTsObject = false , performanceMatters = false ) {
155
+ performanceMatters = false ;
146
156
const preBabel = `${ outfile } .tmp.js` ;
147
157
148
158
/** @type {esbuild.BuildOptions } */
@@ -251,10 +261,13 @@ const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;
251
261
const esbuildServices = esbuildTask ( "./src/typescript/typescript.ts" , "./built/local/typescript.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
252
262
253
263
// TODO(jakebailey): rename this; no longer "services".
264
+
265
+ const buildServicesProject = ( ) => buildProject ( "src/typescript" ) ;
266
+
254
267
const buildServices = ( ) => {
255
268
if ( cmdLineOptions . bundle ) return esbuildServices . build ( ) ;
256
269
writeCJSReexport ( "./built/local/typescript/typescript.js" , "./built/local/typescript.js" ) ;
257
- return buildProject ( "src/typescript" ) ;
270
+ return buildServicesProject ( ) ;
258
271
} ;
259
272
260
273
task ( "services" , series ( preBuild , buildServices ) ) ;
@@ -277,6 +290,9 @@ task("watch-services").flags = {
277
290
" --built" : "Compile using the built version of the compiler."
278
291
} ;
279
292
293
+ const dtsServices = ( ) => runDtsBundler ( "./src/typescript/tsconfig.json" , "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
294
+ task ( "dts-services" , series ( preBuild , buildServicesProject , dtsServices ) ) ;
295
+ task ( "dts-services" ) . description = "Builds typescript.d.ts" ;
280
296
281
297
const esbuildServer = esbuildTask ( "./src/tsserver/server.ts" , "./built/local/tsserver.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
282
298
@@ -323,10 +339,11 @@ task("watch-min").flags = {
323
339
324
340
const esbuildLssl = esbuildTask ( "./src/tsserverlibrary/tsserverlibrary.ts" , "./built/local/tsserverlibrary.js" , /* exportIsTsObject */ true , /* performanceMatters */ true ) ;
325
341
342
+ const buildLsslProject = ( ) => buildProject ( "src/tsserverlibrary" ) ;
326
343
const buildLssl = ( ) => {
327
344
if ( cmdLineOptions . bundle ) return esbuildLssl . build ( ) ;
328
345
writeCJSReexport ( "./built/local/tsserverlibrary/tsserverlibrary.js" , "./built/local/tsserverlibrary.js" ) ;
329
- return buildProject ( "src/tsserverlibrary" ) ;
346
+ return buildLsslProject ( ) ;
330
347
} ;
331
348
task ( "lssl" , series ( preBuild , buildLssl ) ) ;
332
349
task ( "lssl" ) . description = "Builds language service server library" ;
@@ -348,6 +365,14 @@ task("watch-lssl").flags = {
348
365
" --built" : "Compile using the built version of the compiler."
349
366
} ;
350
367
368
+ const dtsLssl = ( ) => runDtsBundler ( "./src/tsserverlibrary/tsconfig.json" , "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
369
+ task ( "dts-lssl" , series ( preBuild , buildLsslProject , dtsLssl ) ) ;
370
+ task ( "dts-lssl" ) . description = "Builds tsserverlibrary.d.ts" ;
371
+
372
+ // TODO(jakebailey): this is probably not efficient, but, gulp.
373
+ const dts = series ( preBuild , parallel ( dtsServices , dtsLssl ) ) ;
374
+ task ( "dts" , dts ) ;
375
+
351
376
const testRunner = "./built/local/run.js" ;
352
377
const esbuildTests = esbuildTask ( "./src/testRunner/_namespaces/Harness.ts" , testRunner ) ;
353
378
@@ -458,7 +483,7 @@ const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller
458
483
task ( "other-outputs" , series ( preBuild , buildOtherOutputs ) ) ;
459
484
task ( "other-outputs" ) . description = "Builds miscelaneous scripts and documents distributed with the LKG" ;
460
485
461
- task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) ) ) ;
486
+ task ( "local" , series ( preBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) ) ) ;
462
487
task ( "local" ) . description = "Builds the full compiler and services" ;
463
488
task ( "local" ) . flags = {
464
489
" --built" : "Compile using the built version of the compiler."
@@ -474,7 +499,7 @@ const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
474
499
preTest . displayName = "preTest" ;
475
500
476
501
const runTests = ( ) => runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , /*watchMode*/ false ) ;
477
- task ( "runtests" , series ( preBuild , preTest , runTests ) ) ;
502
+ task ( "runtests" , series ( preBuild , preTest , dts , runTests ) ) ;
478
503
task ( "runtests" ) . description = "Runs the tests using the built run.js file." ;
479
504
task ( "runtests" ) . flags = {
480
505
"-t --tests=<regex>" : "Pattern for tests to run." ,
@@ -493,7 +518,7 @@ task("runtests").flags = {
493
518
} ;
494
519
495
520
const runTestsParallel = ( ) => runConsoleTests ( testRunner , "min" , /*runInParallel*/ cmdLineOptions . workers > 1 , /*watchMode*/ false ) ;
496
- task ( "runtests-parallel" , series ( preBuild , preTest , runTestsParallel ) ) ;
521
+ task ( "runtests-parallel" , series ( preBuild , preTest , dts , runTestsParallel ) ) ;
497
522
task ( "runtests-parallel" ) . description = "Runs all the tests in parallel using the built run.js file." ;
498
523
task ( "runtests-parallel" ) . flags = {
499
524
" --light" : "Run tests in light mode (fewer verifications, but tests run faster)." ,
@@ -597,8 +622,7 @@ const produceLKG = async () => {
597
622
}
598
623
} ;
599
624
600
- // TODO(jakebailey): dependencies on dts
601
- task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs ) , produceLKG ) ) ;
625
+ task ( "LKG" , series ( lkgPreBuild , parallel ( localize , buildTsc , buildServer , buildServices , buildLssl , buildOtherOutputs , dts ) , produceLKG ) ) ;
602
626
task ( "LKG" ) . description = "Makes a new LKG out of the built js files" ;
603
627
task ( "LKG" ) . flags = {
604
628
" --built" : "Compile using the built version of the compiler." ,
0 commit comments