File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ pub struct CachedPathImpl {
2828 pub canonicalized : OnceLock < Weak < CachedPathImpl > > ,
2929 pub node_modules : OnceLock < Option < Weak < CachedPathImpl > > > ,
3030 pub package_json : OnceLock < Option < PackageJsonIndex > > ,
31+ /// `tsconfig.json` found at path.
3132 pub tsconfig : OnceLock < Option < Arc < TsConfig > > > ,
33+ /// `tsconfig.json` after resolving `references`, `files`, `include` and `extend`.
34+ pub resolved_tsconfig : OnceLock < Option < Arc < TsConfig > > > ,
3235}
3336
3437impl CachedPathImpl {
@@ -50,6 +53,7 @@ impl CachedPathImpl {
5053 node_modules : OnceLock :: new ( ) ,
5154 package_json : OnceLock :: new ( ) ,
5255 tsconfig : OnceLock :: new ( ) ,
56+ resolved_tsconfig : OnceLock :: new ( ) ,
5357 }
5458 }
5559}
Original file line number Diff line number Diff line change @@ -58,13 +58,18 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
5858 let span = tracing:: debug_span!( "find_tsconfig" , path = ?path) ;
5959 let _enter = span. enter ( ) ;
6060 let cached_path = self . cache . value ( path) ;
61- self . find_tsconfig_impl ( & cached_path, & mut Ctx :: default ( ) ) . map ( |option_tsconfig| {
62- option_tsconfig. map ( |tsconfig| {
63- let r = TsConfig :: resolve_tsconfig_solution ( tsconfig, path) ;
64- tracing:: debug!( path = ?path, ret = ?r) ;
65- r
61+ cached_path
62+ . resolved_tsconfig
63+ . get_or_try_init ( || {
64+ self . find_tsconfig_impl ( & cached_path, & mut Ctx :: default ( ) ) . map ( |option_tsconfig| {
65+ option_tsconfig. map ( |tsconfig| {
66+ let r = TsConfig :: resolve_tsconfig_solution ( tsconfig, path) ;
67+ tracing:: debug!( path = ?path, ret = ?r) ;
68+ r
69+ } )
70+ } )
6671 } )
67- } )
72+ . cloned ( )
6873 }
6974
7075 /// Find tsconfig.json of a path by traversing parent directories.
You can’t perform that action at this time.
0 commit comments