@@ -7,8 +7,23 @@ import _glob from "glob";
77import util from "util" ;
88import chalk from "chalk" ;
99import fsExtra from "fs-extra" ;
10- import { Debouncer , Deferred , exec , getDiffTool , getDirSize , memoize , needsUpdate , readJson } from "./scripts/build/utils.mjs" ;
11- import { localBaseline , localRwcBaseline , refBaseline , refRwcBaseline , runConsoleTests } from "./scripts/build/tests.mjs" ;
10+ import {
11+ Debouncer ,
12+ Deferred ,
13+ exec ,
14+ getDiffTool ,
15+ getDirSize ,
16+ memoize ,
17+ needsUpdate ,
18+ readJson ,
19+ } from "./scripts/build/utils.mjs" ;
20+ import {
21+ localBaseline ,
22+ localRwcBaseline ,
23+ refBaseline ,
24+ refRwcBaseline ,
25+ runConsoleTests ,
26+ } from "./scripts/build/tests.mjs" ;
1227import { buildProject , cleanProject , watchProject } from "./scripts/build/projects.mjs" ;
1328import { localizationDirectories } from "./scripts/build/localization.mjs" ;
1429import cmdLineOptions from "./scripts/build/options.mjs" ;
@@ -110,7 +125,12 @@ const localize = task({
110125 dependencies : [ generateDiagnostics ] ,
111126 run : async ( ) => {
112127 if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
113- await exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
128+ await exec ( process . execPath , [
129+ "scripts/generateLocalizedDiagnosticMessages.mjs" ,
130+ "src/loc/lcl" ,
131+ "built/local" ,
132+ diagnosticMessagesGeneratedJson ,
133+ ] , { ignoreExitCode : true } ) ;
114134 }
115135 } ,
116136} ) ;
@@ -289,7 +309,10 @@ function entrypointBuildTask(options) {
289309 const outDir = path . dirname ( options . output ) ;
290310 await fs . promises . mkdir ( outDir , { recursive : true } ) ;
291311 const moduleSpecifier = path . relative ( outDir , options . builtEntrypoint ) ;
292- await fs . promises . writeFile ( options . output , `module.exports = require("./${ moduleSpecifier . replace ( / [ \\ / ] / g, "/" ) } ")` ) ;
312+ await fs . promises . writeFile (
313+ options . output ,
314+ `module.exports = require("./${ moduleSpecifier . replace ( / [ \\ / ] / g, "/" ) } ")` ,
315+ ) ;
293316 } ,
294317 } ) ;
295318
@@ -313,13 +336,19 @@ function entrypointBuildTask(options) {
313336 const watch = task ( {
314337 name : `watch-${ options . name } ` ,
315338 hiddenFromTaskList : true , // This is best effort.
316- dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat ( cmdLineOptions . bundle ? [ ] : [ shim ] ) ,
339+ dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat (
340+ cmdLineOptions . bundle ? [ ] : [ shim ] ,
341+ ) ,
317342 run : ( ) => {
318343 // These watch functions return promises that resolve once watch mode has started,
319344 // allowing them to operate as regular tasks, while creating unresolved promises
320345 // in the background that keep the process running after all tasks have exited.
321346 if ( ! printedWatchWarning ) {
322- console . error ( chalk . yellowBright ( "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ) ) ;
347+ console . error (
348+ chalk . yellowBright (
349+ "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ,
350+ ) ,
351+ ) ;
323352 printedWatchWarning = true ;
324353 }
325354
@@ -363,7 +392,12 @@ export const dtsServices = task({
363392 description : "Bundles typescript.d.ts" ,
364393 dependencies : [ buildServices ] ,
365394 run : async ( ) => {
366- if ( needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [ "./built/local/typescript.d.ts" , "./built/local/typescript.internal.d.ts" ] ) ) {
395+ if (
396+ needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [
397+ "./built/local/typescript.d.ts" ,
398+ "./built/local/typescript.internal.d.ts" ,
399+ ] )
400+ ) {
367401 await runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
368402 }
369403 } ,
@@ -412,8 +446,16 @@ export const dtsLssl = task({
412446 description : "Bundles tsserverlibrary.d.ts" ,
413447 dependencies : [ buildLssl ] ,
414448 run : async ( ) => {
415- if ( needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [ "./built/local/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.internal.d.ts" ] ) ) {
416- await runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
449+ if (
450+ needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [
451+ "./built/local/tsserverlibrary.d.ts" ,
452+ "./built/local/tsserverlibrary.internal.d.ts" ,
453+ ] )
454+ ) {
455+ await runDtsBundler (
456+ "./built/local/tsserverlibrary/tsserverlibrary.d.ts" ,
457+ "./built/local/tsserverlibrary.d.ts" ,
458+ ) ;
417459 }
418460 } ,
419461} ) ;
@@ -536,7 +578,13 @@ export const watchOtherOutputs = task({
536578 name : "watch-other-outputs" ,
537579 description : "Builds miscelaneous scripts and documents distributed with the LKG" ,
538580 hiddenFromTaskList : true ,
539- dependencies : [ watchCancellationToken , watchTypingsInstaller , watchWatchGuard , generateTypesMap , copyBuiltLocalDiagnosticMessages ] ,
581+ dependencies : [
582+ watchCancellationToken ,
583+ watchTypingsInstaller ,
584+ watchWatchGuard ,
585+ generateTypesMap ,
586+ copyBuiltLocalDiagnosticMessages ,
587+ ] ,
540588} ) ;
541589
542590export const local = task ( {
@@ -614,7 +662,10 @@ export const runTestsAndWatch = task({
614662 if ( ! token . signaled ) {
615663 running = true ;
616664 try {
617- await runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , { token, watching : true } ) ;
665+ await runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , {
666+ token,
667+ watching : true ,
668+ } ) ;
618669 }
619670 catch {
620671 // ignore
@@ -773,7 +824,10 @@ export const updateSublime = task({
773824 dependencies : [ tsserver ] ,
774825 run : async ( ) => {
775826 for ( const file of [ "built/local/tsserver.js" , "built/local/tsserver.js.map" ] ) {
776- await fs . promises . copyFile ( file , path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ) ;
827+ await fs . promises . copyFile (
828+ file ,
829+ path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ,
830+ ) ;
777831 }
778832 } ,
779833} ) ;
@@ -809,7 +863,10 @@ export const produceLKG = task({
809863 . concat ( localizationTargets )
810864 . filter ( f => ! fs . existsSync ( f ) ) ;
811865 if ( missingFiles . length > 0 ) {
812- 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" ) ) ;
866+ throw new Error (
867+ "Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
868+ + missingFiles . join ( "\n" ) ,
869+ ) ;
813870 }
814871 const sizeBefore = getDirSize ( "lib" ) ;
815872 await exec ( process . execPath , [ "scripts/produceLKG.mjs" ] ) ;
@@ -841,19 +898,37 @@ export const clean = task({
841898export const configureNightly = task ( {
842899 name : "configure-nightly" ,
843900 description : "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing" ,
844- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "dev" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
901+ run : ( ) =>
902+ exec ( process . execPath , [
903+ "scripts/configurePrerelease.mjs" ,
904+ "dev" ,
905+ "package.json" ,
906+ "src/compiler/corePublic.ts" ,
907+ ] ) ,
845908} ) ;
846909
847910export const configureInsiders = task ( {
848911 name : "configure-insiders" ,
849912 description : "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing" ,
850- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "insiders" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
913+ run : ( ) =>
914+ exec ( process . execPath , [
915+ "scripts/configurePrerelease.mjs" ,
916+ "insiders" ,
917+ "package.json" ,
918+ "src/compiler/corePublic.ts" ,
919+ ] ) ,
851920} ) ;
852921
853922export const configureExperimental = task ( {
854923 name : "configure-experimental" ,
855924 description : "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing" ,
856- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "experimental" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
925+ run : ( ) =>
926+ exec ( process . execPath , [
927+ "scripts/configurePrerelease.mjs" ,
928+ "experimental" ,
929+ "package.json" ,
930+ "src/compiler/corePublic.ts" ,
931+ ] ) ,
857932} ) ;
858933
859934export const help = task ( {
0 commit comments