diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-01-10 15:28:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 16:28:10 +0100 |
commit | 71ea4ef2746d7d75623a821d4832d3531a8e1654 (patch) | |
tree | 7d5d9676c5de9b32edcc2aee9a94394e4de2a19f /cli/cache/parsed_source.rs | |
parent | 0329bc69dabbcc4d57ff9d34d695ffd4ddb1de4f (diff) |
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.
Diffstat (limited to 'cli/cache/parsed_source.rs')
-rw-r--r-- | cli/cache/parsed_source.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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, |