File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " eslint-import-resolver-typescript " : patch
3+ ---
4+
5+ perf: add filesystem caching support
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url'
55import debug from 'debug'
66import {
77 FileSystem ,
8+ CachedInputFileSystem ,
89 ResolveOptions ,
910 Resolver ,
1011 ResolverFactory ,
@@ -113,6 +114,7 @@ const fileSystem = fs as FileSystem
113114const JS_EXT_PATTERN = / \. (?: [ c m ] j s | j s x ? ) $ /
114115const RELATIVE_PATH_PATTERN = / ^ \. { 1 , 2 } (?: \/ .* ) ? $ /
115116
117+ let previousOptions : TsResolverOptions | null | undefined
116118let cachedOptions : InternalResolverOptions | undefined
117119
118120let mappersCachedOptions : InternalResolverOptions
@@ -135,14 +137,15 @@ export function resolve(
135137 found : boolean
136138 path ?: string | null
137139} {
138- if ( ! cachedOptions || cachedOptions !== options ) {
140+ if ( ! cachedOptions || previousOptions !== options ) {
141+ previousOptions = options
139142 cachedOptions = {
140143 ...options ,
141144 conditionNames : options ?. conditionNames ?? defaultConditionNames ,
142145 extensions : options ?. extensions ?? defaultExtensions ,
143146 extensionAlias : options ?. extensionAlias ?? defaultExtensionAlias ,
144147 mainFields : options ?. mainFields ?? defaultMainFields ,
145- fileSystem,
148+ fileSystem : new CachedInputFileSystem ( fileSystem , 5 * 1000 ) ,
146149 useSyncFileSystemCalls : true ,
147150 }
148151 }
You can’t perform that action at this time.
0 commit comments