fix: clear dep analysis when module loading is done (#27204)

Closes https://github.com/denoland/deno/issues/26663
This commit is contained in:
Bartek Iwańczuk 2024-12-05 15:48:50 +00:00 committed by GitHub
parent 3bae68eda6
commit ab4568a03d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 111 additions and 7 deletions

View file

@ -95,11 +95,21 @@ impl ParsedSourceCache {
self.sources.lock().remove(specifier);
}
/// Fress all parsed sources from memory.
pub fn free_all(&self) {
self.sources.lock().clear();
}
/// Creates a parser that will reuse a ParsedSource from the store
/// if it exists, or else parse.
pub fn as_capturing_parser(&self) -> CapturingEsParser {
CapturingEsParser::new(None, self)
}
#[cfg(test)]
pub fn len(&self) -> usize {
self.sources.lock().len()
}
}
/// It's ok that this is racy since in non-LSP situations