File tree 2 files changed +10
-2
lines changed
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'
5
5
import debug from 'debug'
6
6
import {
7
7
FileSystem ,
8
+ CachedInputFileSystem ,
8
9
ResolveOptions ,
9
10
Resolver ,
10
11
ResolverFactory ,
@@ -113,6 +114,7 @@ const fileSystem = fs as FileSystem
113
114
const JS_EXT_PATTERN = / \. (?: [ c m ] j s | j s x ? ) $ /
114
115
const RELATIVE_PATH_PATTERN = / ^ \. { 1 , 2 } (?: \/ .* ) ? $ /
115
116
117
+ let previousOptions : TsResolverOptions | null | undefined
116
118
let cachedOptions : InternalResolverOptions | undefined
117
119
118
120
let mappersCachedOptions : InternalResolverOptions
@@ -135,14 +137,15 @@ export function resolve(
135
137
found : boolean
136
138
path ?: string | null
137
139
} {
138
- if ( ! cachedOptions || cachedOptions !== options ) {
140
+ if ( ! cachedOptions || previousOptions !== options ) {
141
+ previousOptions = options
139
142
cachedOptions = {
140
143
...options ,
141
144
conditionNames : options ?. conditionNames ?? defaultConditionNames ,
142
145
extensions : options ?. extensions ?? defaultExtensions ,
143
146
extensionAlias : options ?. extensionAlias ?? defaultExtensionAlias ,
144
147
mainFields : options ?. mainFields ?? defaultMainFields ,
145
- fileSystem,
148
+ fileSystem : new CachedInputFileSystem ( fileSystem , 5 * 1000 ) ,
146
149
useSyncFileSystemCalls : true ,
147
150
}
148
151
}
You can’t perform that action at this time.
0 commit comments