@@ -7,7 +7,13 @@ import _glob from "glob";
7
7
import util from "util" ;
8
8
import chalk from "chalk" ;
9
9
import { exec , readJson , getDiffTool , getDirSize , memoize , needsUpdate } from "./scripts/build/utils.mjs" ;
10
- import { runConsoleTests , refBaseline , localBaseline , refRwcBaseline , localRwcBaseline } from "./scripts/build/tests.mjs" ;
10
+ import {
11
+ runConsoleTests ,
12
+ refBaseline ,
13
+ localBaseline ,
14
+ refRwcBaseline ,
15
+ localRwcBaseline ,
16
+ } from "./scripts/build/tests.mjs" ;
11
17
import { buildProject as realBuildProject , cleanProject , watchProject } from "./scripts/build/projects.mjs" ;
12
18
import { localizationDirectories } from "./scripts/build/localization.mjs" ;
13
19
import cmdLineOptions from "./scripts/build/options.mjs" ;
@@ -37,7 +43,10 @@ const buildProjectWithEmit = async (...args) => {
37
43
38
44
if ( currentlyBuilding === 0 ) {
39
45
oldTsconfigBase = fs . readFileSync ( tsconfigBasePath , "utf-8" ) ;
40
- fs . writeFileSync ( tsconfigBasePath , oldTsconfigBase . replace ( `"emitDeclarationOnly": true,` , `"emitDeclarationOnly": false, // DO NOT COMMIT` ) ) ;
46
+ fs . writeFileSync (
47
+ tsconfigBasePath ,
48
+ oldTsconfigBase . replace ( `"emitDeclarationOnly": true,` , `"emitDeclarationOnly": false, // DO NOT COMMIT` ) ,
49
+ ) ;
41
50
}
42
51
43
52
currentlyBuilding ++ ;
@@ -135,7 +144,12 @@ const localize = task({
135
144
dependencies : [ generateDiagnostics ] ,
136
145
run : async ( ) => {
137
146
if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
138
- return exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
147
+ return exec ( process . execPath , [
148
+ "scripts/generateLocalizedDiagnosticMessages.mjs" ,
149
+ "src/loc/lcl" ,
150
+ "built/local" ,
151
+ diagnosticMessagesGeneratedJson ,
152
+ ] , { ignoreExitCode : true } ) ;
139
153
}
140
154
} ,
141
155
} ) ;
@@ -220,7 +234,9 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
220
234
//
221
235
// See: https://github.com/evanw/esbuild/issues/1958
222
236
return {
223
- errors : [ { text : 'Attempted to bundle from node_modules; ensure "external" is set correctly.' } ] ,
237
+ errors : [ {
238
+ text : 'Attempted to bundle from node_modules; ensure "external" is set correctly.' ,
239
+ } ] ,
224
240
} ;
225
241
} ) ;
226
242
} ,
@@ -326,13 +342,19 @@ function entrypointBuildTask(options) {
326
342
const watch = task ( {
327
343
name : `watch-${ options . name } ` ,
328
344
hiddenFromTaskList : true , // This is best effort.
329
- dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat ( cmdLineOptions . bundle ? [ ] : [ shim ] ) ,
345
+ dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat (
346
+ cmdLineOptions . bundle ? [ ] : [ shim ] ,
347
+ ) ,
330
348
run : ( ) => {
331
349
// These watch functions return promises that resolve once watch mode has started,
332
350
// allowing them to operate as regular tasks, while creating unresolved promises
333
351
// in the background that keep the process running after all tasks have exited.
334
352
if ( ! printedWatchWarning ) {
335
- console . error ( chalk . yellowBright ( "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ) ) ;
353
+ console . error (
354
+ chalk . yellowBright (
355
+ "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ,
356
+ ) ,
357
+ ) ;
336
358
printedWatchWarning = true ;
337
359
}
338
360
@@ -376,7 +398,12 @@ export const dtsServices = task({
376
398
description : "Bundles typescript.d.ts" ,
377
399
dependencies : [ buildServices ] ,
378
400
run : async ( ) => {
379
- if ( needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [ "./built/local/typescript.d.ts" , "./built/local/typescript.internal.d.ts" ] ) ) {
401
+ if (
402
+ needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [
403
+ "./built/local/typescript.d.ts" ,
404
+ "./built/local/typescript.internal.d.ts" ,
405
+ ] )
406
+ ) {
380
407
runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
381
408
}
382
409
} ,
@@ -430,8 +457,16 @@ export const dtsLssl = task({
430
457
description : "Bundles tsserverlibrary.d.ts" ,
431
458
dependencies : [ buildLssl ] ,
432
459
run : async ( ) => {
433
- if ( needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [ "./built/local/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.internal.d.ts" ] ) ) {
434
- await runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
460
+ if (
461
+ needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [
462
+ "./built/local/tsserverlibrary.d.ts" ,
463
+ "./built/local/tsserverlibrary.internal.d.ts" ,
464
+ ] )
465
+ ) {
466
+ await runDtsBundler (
467
+ "./built/local/tsserverlibrary/tsserverlibrary.d.ts" ,
468
+ "./built/local/tsserverlibrary.d.ts" ,
469
+ ) ;
435
470
}
436
471
} ,
437
472
} ) ;
@@ -559,7 +594,13 @@ export const watchOtherOutputs = task({
559
594
name : "watch-other-outputs" ,
560
595
description : "Builds miscelaneous scripts and documents distributed with the LKG" ,
561
596
hiddenFromTaskList : true ,
562
- dependencies : [ watchCancellationToken , watchTypingsInstaller , watchWatchGuard , generateTypesMap , copyBuiltLocalDiagnosticMessages ] ,
597
+ dependencies : [
598
+ watchCancellationToken ,
599
+ watchTypingsInstaller ,
600
+ watchWatchGuard ,
601
+ generateTypesMap ,
602
+ copyBuiltLocalDiagnosticMessages ,
603
+ ] ,
563
604
} ) ;
564
605
565
606
export const local = task ( {
@@ -683,7 +724,10 @@ export const updateSublime = task({
683
724
dependencies : [ tsserver ] ,
684
725
run : async ( ) => {
685
726
for ( const file of [ "built/local/tsserver.js" , "built/local/tsserver.js.map" ] ) {
686
- await fs . promises . copyFile ( file , path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ) ;
727
+ await fs . promises . copyFile (
728
+ file ,
729
+ path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ,
730
+ ) ;
687
731
}
688
732
} ,
689
733
} ) ;
@@ -719,7 +763,10 @@ export const produceLKG = task({
719
763
. concat ( localizationTargets )
720
764
. filter ( f => ! fs . existsSync ( f ) ) ;
721
765
if ( missingFiles . length > 0 ) {
722
- throw new Error ( "Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n" + missingFiles . join ( "\n" ) ) ;
766
+ throw new Error (
767
+ "Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
768
+ + missingFiles . join ( "\n" ) ,
769
+ ) ;
723
770
}
724
771
const sizeBefore = getDirSize ( "lib" ) ;
725
772
await exec ( process . execPath , [ "scripts/produceLKG.mjs" ] ) ;
@@ -740,7 +787,13 @@ export const generateSpec = task({
740
787
name : "generate-spec" ,
741
788
description : "Generates a Markdown version of the Language Specification" ,
742
789
hiddenFromTaskList : true ,
743
- run : ( ) => exec ( "cscript" , [ "//nologo" , "scripts/word2md.mjs" , path . resolve ( "doc/TypeScript Language Specification - ARCHIVED.docx" ) , path . resolve ( "doc/spec-ARCHIVED.md" ) ] ) ,
790
+ run : ( ) =>
791
+ exec ( "cscript" , [
792
+ "//nologo" ,
793
+ "scripts/word2md.mjs" ,
794
+ path . resolve ( "doc/TypeScript Language Specification - ARCHIVED.docx" ) ,
795
+ path . resolve ( "doc/spec-ARCHIVED.md" ) ,
796
+ ] ) ,
744
797
} ) ;
745
798
746
799
export const cleanBuilt = task ( {
@@ -758,19 +811,37 @@ export const clean = task({
758
811
export const configureNightly = task ( {
759
812
name : "configure-nightly" ,
760
813
description : "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing" ,
761
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "dev" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
814
+ run : ( ) =>
815
+ exec ( process . execPath , [
816
+ "scripts/configurePrerelease.mjs" ,
817
+ "dev" ,
818
+ "package.json" ,
819
+ "src/compiler/corePublic.ts" ,
820
+ ] ) ,
762
821
} ) ;
763
822
764
823
export const configureInsiders = task ( {
765
824
name : "configure-insiders" ,
766
825
description : "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing" ,
767
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "insiders" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
826
+ run : ( ) =>
827
+ exec ( process . execPath , [
828
+ "scripts/configurePrerelease.mjs" ,
829
+ "insiders" ,
830
+ "package.json" ,
831
+ "src/compiler/corePublic.ts" ,
832
+ ] ) ,
768
833
} ) ;
769
834
770
835
export const configureExperimental = task ( {
771
836
name : "configure-experimental" ,
772
837
description : "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing" ,
773
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "experimental" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
838
+ run : ( ) =>
839
+ exec ( process . execPath , [
840
+ "scripts/configurePrerelease.mjs" ,
841
+ "experimental" ,
842
+ "package.json" ,
843
+ "src/compiler/corePublic.ts" ,
844
+ ] ) ,
774
845
} ) ;
775
846
776
847
export const help = task ( {
0 commit comments