summaryrefslogtreecommitdiff
path: root/ext/node/package_json.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-10-03 19:05:06 -0400
committerGitHub <noreply@github.com>2023-10-03 19:05:06 -0400
commit8c1677ecbcbb474fc6a5ac9b5f73b562677bb829 (patch)
tree885a45a67e6aed7dc70307df718b176a729c8655 /ext/node/package_json.rs
parent494822175fd69f8c20a2e21ddcedcb3287064cce (diff)
refactor(npm): break up `NpmModuleLoader` and move more methods into the managed `CliNpmResolver` (#20777)
Part of https://github.com/denoland/deno/issues/18967
Diffstat (limited to 'ext/node/package_json.rs')
-rw-r--r--ext/node/package_json.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/node/package_json.rs b/ext/node/package_json.rs
index 0f7cc5bb1..b24bfdef3 100644
--- a/ext/node/package_json.rs
+++ b/ext/node/package_json.rs
@@ -97,7 +97,13 @@ impl PackageJson {
return Ok(PackageJson::empty(path));
}
- Self::load_from_string(path, source)
+ let package_json = Self::load_from_string(path, source)?;
+ CACHE.with(|cache| {
+ cache
+ .borrow_mut()
+ .insert(package_json.path.clone(), package_json.clone());
+ });
+ Ok(package_json)
}
pub fn load_from_string(
@@ -199,11 +205,6 @@ impl PackageJson {
scripts,
};
- CACHE.with(|cache| {
- cache
- .borrow_mut()
- .insert(package_json.path.clone(), package_json.clone());
- });
Ok(package_json)
}