mirror of
https://github.com/denoland/deno.git
synced 2025-10-06 17:10:22 +00:00
fix(check): should bust check cache when json module or npm resolution changes (#19941)
A small part of #19928.
This commit is contained in:
parent
53e077133f
commit
cf16df00d9
17 changed files with 223 additions and 58 deletions
|
@ -10,6 +10,8 @@ use std::sync::Arc;
|
|||
|
||||
use anyhow::Context;
|
||||
use lsp_types::Url;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::assertions::assert_wildcard_match;
|
||||
|
||||
|
@ -110,6 +112,10 @@ impl PathRef {
|
|||
.with_context(|| format!("Could not read file: {}", self))
|
||||
}
|
||||
|
||||
pub fn read_json<TValue: DeserializeOwned>(&self) -> TValue {
|
||||
serde_json::from_str(&self.read_to_string()).unwrap()
|
||||
}
|
||||
|
||||
pub fn rename(&self, to: impl AsRef<Path>) {
|
||||
fs::rename(self, self.join(to)).unwrap();
|
||||
}
|
||||
|
@ -118,6 +124,11 @@ impl PathRef {
|
|||
fs::write(self, text.as_ref()).unwrap();
|
||||
}
|
||||
|
||||
pub fn write_json<TValue: Serialize>(&self, value: &TValue) {
|
||||
let text = serde_json::to_string_pretty(value).unwrap();
|
||||
self.write(text);
|
||||
}
|
||||
|
||||
pub fn symlink_dir(
|
||||
&self,
|
||||
oldpath: impl AsRef<Path>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue