11import * as path from "path" ;
22import fs from "fs" ;
33import * as utils from "./utils" ;
4- import readline from "readline" ;
54import { performance } from "perf_hooks" ;
65import * as p from "vscode-languageserver-protocol" ;
76import * as cp from "node:child_process" ;
@@ -41,9 +40,9 @@ export type IncrementallyCompiledFileInfo = {
4140 /** Namespaced module name of the source file. */
4241 moduleNameNamespaced : string ;
4342 /** Path to where the incremental file is saved. */
44- incrementalFilePath : string ;
43+ incrementalFilePath : NormalizedPath ;
4544 /** Location of the original type file. */
46- originalTypeFileLocation : string ;
45+ originalTypeFileLocation : NormalizedPath ;
4746 } ;
4847 buildSystem : "bsb" | "rewatch" ;
4948 /** Cache for build.ninja assets. */
@@ -55,7 +54,7 @@ export type IncrementallyCompiledFileInfo = {
5554 } | null ;
5655 /** Cache for rewatch compiler args. */
5756 buildRewatch : {
58- lastFile : string ;
57+ lastFile : NormalizedPath ;
5958 compilerArgs : RewatchCompilerArgs ;
6059 } | null ;
6160 /** Info of the currently active incremental compilation. `null` if no incremental compilation is active. */
@@ -88,8 +87,9 @@ const incrementallyCompiledFileInfo: Map<
8887 NormalizedPath ,
8988 IncrementallyCompiledFileInfo
9089> = new Map ( ) ;
91- const hasReportedFeatureFailedError : Set < string > = new Set ( ) ;
92- const originalTypeFileToFilePath : Map < string , NormalizedPath > = new Map ( ) ;
90+ const hasReportedFeatureFailedError : Set < NormalizedPath > = new Set ( ) ;
91+ const originalTypeFileToFilePath : Map < NormalizedPath , NormalizedPath > =
92+ new Map ( ) ;
9393
9494export function incrementalCompilationFileChanged ( changedPath : NormalizedPath ) {
9595 const filePath = originalTypeFileToFilePath . get ( changedPath ) ;
@@ -311,12 +311,12 @@ function triggerIncrementalCompilationOfFile(
311311 projectRootPath ,
312312 c . compilerDirPartialPath ,
313313 path . relative ( projectRootPath , filePath ) ,
314- ) ;
314+ ) as NormalizedPath ;
315315
316316 const parsed = path . parse ( originalTypeFileLocation ) ;
317317 parsed . ext = ext === ".res" ? ".cmt" : ".cmti" ;
318318 parsed . base = "" ;
319- originalTypeFileLocation = path . format ( parsed ) ;
319+ originalTypeFileLocation = path . format ( parsed ) as NormalizedPath ;
320320
321321 incrementalFileCacheEntry = {
322322 file : {
@@ -326,7 +326,10 @@ function triggerIncrementalCompilationOfFile(
326326 moduleNameNamespaced,
327327 sourceFileName : moduleName + ext ,
328328 sourceFilePath : filePath ,
329- incrementalFilePath : path . join ( incrementalFolderPath , moduleName + ext ) ,
329+ incrementalFilePath : path . join (
330+ incrementalFolderPath ,
331+ moduleName + ext ,
332+ ) as NormalizedPath ,
330333 } ,
331334 project : {
332335 workspaceRootPath,
0 commit comments