From 6da14422ff3bdbfbebf68cb4425d2ac4c555b036 Mon Sep 17 00:00:00 2001 From: Mikhail Korotin Date: Thu, 5 Feb 2026 00:19:43 +0100 Subject: [PATCH] fix(case): apply using pnpm with store outside on mac filesystem is CaseInsensitive but repo mount is CaseSensitive and when pnpm has virtualStore outside, the typescript think that the system is CaseInsensitive, but it is CaseSensitive to fix that we use pnpm-patch ``` diff --git a/lib/typescript.js b/lib/typescript.js index 2643aa12aa6497ca0b90ecd99b202f37ea0e6330..34757f4fb1a2958bec5142c6e365c4214a2f36fb 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -8277,11 +8277,11 @@ var sys = (() => { const isLinuxOrMacOs = process.platform === "linux" || isMacOs; const statSyncOptions = { throwIfNoEntry: false }; const platform = _os.platform(); + const getCurrentDirectory = memoize(() => process.cwd()); const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive(); const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename; const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs; - const getCurrentDirectory = memoize(() => process.cwd()); const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({ pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime3, @@ -8484,7 +8484,7 @@ var sys = (() => { if (platform === "win32" || platform === "win64") { return false; } - return !fileExists(swapCase(__filename)); + return !fileExists(swapCase(getCurrentDirectory())); } function swapCase(s) { return s.replace(/\w/g, (ch) => { ``` may be the time to fix that in the upstream) --- src/compiler/sys.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index c8f176603002b..0a144dd74ce08 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1487,6 +1487,7 @@ export let sys: System = (() => { const statSyncOptions = { throwIfNoEntry: false } as const; const platform: string = _os.platform(); + const getCurrentDirectory = memoize(() => process.cwd()); const useCaseSensitiveFileNames = isFileSystemCaseSensitive(); const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; @@ -1498,7 +1499,6 @@ export let sys: System = (() => { const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename; const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs; - const getCurrentDirectory = memoize(() => process.cwd()); const { watchFile, watchDirectory } = createSystemWatchFunctions({ pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime, @@ -1725,7 +1725,7 @@ export let sys: System = (() => { return false; } // If this file exists under a different case, we must be case-insensitve. - return !fileExists(swapCase(__filename)); + return !fileExists(swapCase(getCurrentDirectory())); } /** Convert all lowercase chars to uppercase, and vice-versa */