summaryrefslogtreecommitdiff
path: root/cli/cache/mod.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-01-13 20:56:56 -0500
committerGitHub <noreply@github.com>2024-01-13 20:56:56 -0500
commit3298ca06f58db3b0ed75c3853e5b603ef8bd5f4d (patch)
tree8fd2857a292c05371e09f7f63c4074a78ec84402 /cli/cache/mod.rs
parent248fb9c946545045e746029a35fd65f128f43351 (diff)
fix(jsr): ensure proper storage of ahead of time module infos (#21918)
This was incorrectly being stored so the AOT cache for JSR specifiers wasn't being used. I added a wrapper type to help prevent the API being used incorrectly.
Diffstat (limited to 'cli/cache/mod.rs')
-rw-r--r--cli/cache/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs
index 87ad23b10..13efc24ff 100644
--- a/cli/cache/mod.rs
+++ b/cli/cache/mod.rs
@@ -96,6 +96,8 @@ pub type LocalLspHttpCache =
deno_cache_dir::LocalLspHttpCache<RealDenoCacheEnv>;
pub use deno_cache_dir::HttpCache;
+use self::module_info::ModuleInfoCacheSourceHash;
+
/// A "wrapper" for the FileFetcher and DiskCache for the Deno CLI that provides
/// a concise interface to the DENO_DIR when building module graphs.
pub struct FetchCacher {
@@ -280,10 +282,11 @@ impl Loader for FetchCacher {
source: &str,
module_info: &deno_graph::ModuleInfo,
) {
+ let source_hash = ModuleInfoCacheSourceHash::from_source(source.as_bytes());
let result = self.module_info_cache.set_module_info(
specifier,
MediaType::from_specifier(specifier),
- source,
+ &source_hash,
module_info,
);
if let Err(err) = result {