diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-10-25 18:13:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 18:13:22 -0400 |
commit | 842e29057d6e545c6b498c584a5366fff34f6aa7 (patch) | |
tree | aba1bb9d767945ba72be5f11c5c87027f65c5678 /cli/cache/mod.rs | |
parent | 79a9f2a77c1c517282a0e3ac77f8a1252b6c50b9 (diff) |
refactor: break out ModuleInfoCache from ParsedSourceCache (#20977)
As title. This will help use the two independently from the other, which
will help in an upcoming deno doc PR where I need to parse the source
files with scope analysis.
Diffstat (limited to 'cli/cache/mod.rs')
-rw-r--r-- | cli/cache/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs index 5cc91f50f..526236ace 100644 --- a/cli/cache/mod.rs +++ b/cli/cache/mod.rs @@ -32,6 +32,7 @@ mod deno_dir; mod disk_cache; mod emit; mod incremental; +mod module_info; mod node; mod parsed_source; @@ -43,6 +44,8 @@ pub use deno_dir::DenoDirProvider; pub use disk_cache::DiskCache; pub use emit::EmitCache; pub use incremental::IncrementalCache; +pub use module_info::ModuleInfoCache; +pub use module_info::ModuleInfoCacheModuleAnalyzer; pub use node::NodeAnalysisCache; pub use parsed_source::ParsedSourceCache; @@ -103,7 +106,7 @@ pub struct FetchCacher { file_header_overrides: HashMap<ModuleSpecifier, HashMap<String, String>>, global_http_cache: Arc<GlobalHttpCache>, npm_resolver: Arc<dyn CliNpmResolver>, - parsed_source_cache: Arc<ParsedSourceCache>, + module_info_cache: Arc<ModuleInfoCache>, permissions: PermissionsContainer, cache_info_enabled: bool, } @@ -115,7 +118,7 @@ impl FetchCacher { file_header_overrides: HashMap<ModuleSpecifier, HashMap<String, String>>, global_http_cache: Arc<GlobalHttpCache>, npm_resolver: Arc<dyn CliNpmResolver>, - parsed_source_cache: Arc<ParsedSourceCache>, + module_info_cache: Arc<ModuleInfoCache>, permissions: PermissionsContainer, ) -> Self { Self { @@ -124,7 +127,7 @@ impl FetchCacher { file_header_overrides, global_http_cache, npm_resolver, - parsed_source_cache, + module_info_cache, permissions, cache_info_enabled: false, } @@ -297,7 +300,7 @@ impl Loader for FetchCacher { source: &str, module_info: &deno_graph::ModuleInfo, ) { - let result = self.parsed_source_cache.cache_module_info( + let result = self.module_info_cache.set_module_info( specifier, MediaType::from_specifier(specifier), source, |