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/module_loader.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/module_loader.rs')
-rw-r--r-- | cli/module_loader.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/module_loader.rs b/cli/module_loader.rs index f193c7e15..c8b2a36df 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -3,6 +3,7 @@ use crate::args::CliOptions; use crate::args::DenoSubcommand; use crate::args::TsTypeLib; +use crate::cache::ModuleInfoCache; use crate::cache::ParsedSourceCache; use crate::emit::Emitter; use crate::graph_util::graph_lock_or_exit; @@ -66,6 +67,7 @@ pub struct ModuleLoadPreparer { lockfile: Option<Arc<Mutex<Lockfile>>>, maybe_file_watcher_reporter: Option<FileWatcherReporter>, module_graph_builder: Arc<ModuleGraphBuilder>, + module_info_cache: Arc<ModuleInfoCache>, parsed_source_cache: Arc<ParsedSourceCache>, progress_bar: ProgressBar, resolver: Arc<CliGraphResolver>, @@ -80,6 +82,7 @@ impl ModuleLoadPreparer { lockfile: Option<Arc<Mutex<Lockfile>>>, maybe_file_watcher_reporter: Option<FileWatcherReporter>, module_graph_builder: Arc<ModuleGraphBuilder>, + module_info_cache: Arc<ModuleInfoCache>, parsed_source_cache: Arc<ParsedSourceCache>, progress_bar: ProgressBar, resolver: Arc<CliGraphResolver>, @@ -91,6 +94,7 @@ impl ModuleLoadPreparer { lockfile, maybe_file_watcher_reporter, module_graph_builder, + module_info_cache, parsed_source_cache, progress_bar, resolver, @@ -122,7 +126,8 @@ impl ModuleLoadPreparer { .as_ref() .map(|r| r.as_reporter()); - let analyzer = self.parsed_source_cache.as_analyzer(); + let store = self.parsed_source_cache.as_store(); + let analyzer = self.module_info_cache.as_module_analyzer(None, &*store); log::debug!("Creating module graph."); let mut graph_update_permit = @@ -145,7 +150,7 @@ impl ModuleLoadPreparer { imports: maybe_imports, resolver: Some(graph_resolver), npm_resolver: Some(graph_npm_resolver), - module_analyzer: Some(&*analyzer), + module_analyzer: Some(&analyzer), reporter: maybe_file_watcher_reporter, // todo(dsherret): workspace support workspace_members: vec![], |