From 71ea4ef2746d7d75623a821d4832d3531a8e1654 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 10 Jan 2023 15:28:10 +0000 Subject: fix(watch): preserve `ProcState::file_fetcher` between restarts (#15466) This commit changes "ProcState" to store "file_fetcher" field in an "Arc", allowing it to be preserved between restarts and thus keeping the state alive between the restarts. File watchers for "deno test" and "deno bench" now reset "ProcState" between restarts. --- cli/cache/parsed_source.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/cache/parsed_source.rs') diff --git a/cli/cache/parsed_source.rs b/cli/cache/parsed_source.rs index 9ab926874..28547dcf6 100644 --- a/cli/cache/parsed_source.rs +++ b/cli/cache/parsed_source.rs @@ -65,6 +65,14 @@ impl ParsedSourceCache { } } + pub fn reset_for_file_watcher(&self) -> Self { + Self { + db_cache_path: self.db_cache_path.clone(), + cli_version: self.cli_version.clone(), + sources: Default::default(), + } + } + pub fn get_parsed_source_from_module( &self, module: &deno_graph::Module, -- cgit v1.2.3