@file-services/typescript
Advanced tools
Comparing version 5.4.0 to 5.4.3
@@ -8,2 +8,3 @@ import ts from 'typescript'; | ||
export interface IBaseHost extends ts.ParseConfigHost, ts.FormatDiagnosticsHost, ts.ModuleResolutionHost { | ||
useCaseSensitiveFileNames: boolean; | ||
getCurrentDirectory: IFileSystemSync['cwd']; | ||
@@ -10,0 +11,0 @@ directoryExists: IFileSystemSync['directoryExistsSync']; |
@@ -26,17 +26,10 @@ "use strict"; | ||
const directories = []; | ||
const { stackTraceLimit } = Error; | ||
try { | ||
Error.stackTraceLimit = 0; | ||
const dirEntries = readdirSync(path); | ||
for (const entryName of dirEntries) { | ||
const entryStats = statSync(join(path, entryName)); | ||
if (!entryStats) { | ||
continue; | ||
for (const entry of readdirSync(path, { withFileTypes: true })) { | ||
if (entry.isFile()) { | ||
files.push(entry.name); | ||
} | ||
if (entryStats.isFile()) { | ||
files.push(entryName); | ||
else if (entry.isDirectory()) { | ||
directories.push(entry.name); | ||
} | ||
else if (entryStats.isDirectory()) { | ||
directories.push(entryName); | ||
} | ||
} | ||
@@ -47,8 +40,5 @@ } | ||
} | ||
finally { | ||
Error.stackTraceLimit = stackTraceLimit; | ||
} | ||
return { files, directories }; | ||
} | ||
function realpath(path) { | ||
function realpathSyncSafe(path) { | ||
const { stackTraceLimit } = Error; | ||
@@ -68,3 +58,3 @@ try { | ||
readDirectory(rootDir, extensions, excludes, includes, depth) { | ||
return typescript_1.default.matchFiles(rootDir, extensions, excludes, includes, caseSensitive, rootDir, depth, getFileSystemEntries, realpath, directoryExistsSync); | ||
return typescript_1.default.matchFiles(rootDir, extensions, excludes, includes, caseSensitive, rootDir, depth, getFileSystemEntries, realpathSyncSafe, directoryExistsSync); | ||
}, | ||
@@ -106,3 +96,3 @@ getDirectories(path) { | ||
getNewLine: defaultGetNewLine, | ||
realpath, | ||
realpath: realpathSyncSafe, | ||
dirname, | ||
@@ -109,0 +99,0 @@ normalize, |
{ | ||
"name": "@file-services/typescript", | ||
"description": "Helpers for creation of TypeScript hosts", | ||
"version": "5.4.0", | ||
"version": "5.4.3", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "peerDependencies": { |
@@ -13,2 +13,3 @@ import ts from 'typescript'; | ||
export interface IBaseHost extends ts.ParseConfigHost, ts.FormatDiagnosticsHost, ts.ModuleResolutionHost { | ||
useCaseSensitiveFileNames: boolean; | ||
getCurrentDirectory: IFileSystemSync['cwd']; | ||
@@ -55,27 +56,17 @@ directoryExists: IFileSystemSync['directoryExistsSync']; | ||
const { stackTraceLimit } = Error; | ||
try { | ||
Error.stackTraceLimit = 0; | ||
const dirEntries = readdirSync(path); | ||
for (const entryName of dirEntries) { | ||
const entryStats = statSync(join(path, entryName)); | ||
if (!entryStats) { | ||
continue; | ||
for (const entry of readdirSync(path, { withFileTypes: true })) { | ||
if (entry.isFile()) { | ||
files.push(entry.name); | ||
} else if (entry.isDirectory()) { | ||
directories.push(entry.name); | ||
} | ||
if (entryStats.isFile()) { | ||
files.push(entryName); | ||
} else if (entryStats.isDirectory()) { | ||
directories.push(entryName); | ||
} | ||
} | ||
} catch { | ||
/* */ | ||
} finally { | ||
Error.stackTraceLimit = stackTraceLimit; | ||
} | ||
return { files, directories }; | ||
} | ||
function realpath(path: string): string { | ||
function realpathSyncSafe(path: string): string { | ||
const { stackTraceLimit } = Error; | ||
@@ -103,3 +94,3 @@ try { | ||
getFileSystemEntries, | ||
realpath, | ||
realpathSyncSafe, | ||
directoryExistsSync | ||
@@ -139,3 +130,3 @@ ); | ||
getNewLine: defaultGetNewLine, | ||
realpath, | ||
realpath: realpathSyncSafe, | ||
dirname, | ||
@@ -142,0 +133,0 @@ normalize, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23182
368