Skip to content

Commit

Permalink
BREAKING: rename "deps" remote cache folder to "remote" (#25969)
Browse files Browse the repository at this point in the history
Closes #25967
Closes #25968
  • Loading branch information
dsherret authored Oct 1, 2024
1 parent 2910438 commit 4c8d57d
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 30 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ console_static_text = "=0.8.1"
dashmap = "5.5.3"
data-encoding = "2.3.3"
data-url = "=0.3.0"
deno_cache_dir = "=0.12.0"
deno_cache_dir = "=0.13.0"
deno_package_json = { version = "=0.1.1", default-features = false }
dlopen2 = "0.6.1"
ecb = "=0.1.2"
Expand Down
6 changes: 3 additions & 3 deletions cli/cache/deno_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ impl DenoDir {
self.root.join("registries")
}

/// Path to the dependencies cache folder.
pub fn deps_folder_path(&self) -> PathBuf {
self.root.join("deps")
/// Path to the remote cache folder.
pub fn remote_folder_path(&self) -> PathBuf {
self.root.join("remote")
}

/// Path to the origin data cache folder.
Expand Down
11 changes: 0 additions & 11 deletions cli/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ impl deno_cache_dir::DenoCacheEnv for RealDenoCacheEnv {
std::fs::create_dir_all(path)
}

fn remove_file(&self, path: &Path) -> std::io::Result<()> {
std::fs::remove_file(path)
}

fn modified(&self, path: &Path) -> std::io::Result<Option<SystemTime>> {
match std::fs::metadata(path) {
Ok(metadata) => Ok(Some(
Expand Down Expand Up @@ -149,13 +145,6 @@ impl<'a> deno_cache_dir::DenoCacheEnv for DenoCacheEnvFsAdapter<'a> {
.map_err(|e| e.into_io_error())
}

fn remove_file(&self, path: &Path) -> std::io::Result<()> {
self
.0
.remove_sync(path, false)
.map_err(|e| e.into_io_error())
}

fn modified(&self, path: &Path) -> std::io::Result<Option<SystemTime>> {
self
.0
Expand Down
2 changes: 1 addition & 1 deletion cli/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl CliFactory {
pub fn global_http_cache(&self) -> Result<&Arc<GlobalHttpCache>, AnyError> {
self.services.global_http_cache.get_or_try_init(|| {
Ok(Arc::new(GlobalHttpCache::new(
self.deno_dir()?.deps_folder_path(),
self.deno_dir()?.remote_folder_path(),
crate::cache::RealDenoCacheEnv,
)))
})
Expand Down
12 changes: 6 additions & 6 deletions cli/file_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ mod tests {
maybe_temp_dir: Option<TempDir>,
) -> (FileFetcher, TempDir, Arc<BlobStore>) {
let temp_dir = maybe_temp_dir.unwrap_or_default();
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let blob_store: Arc<BlobStore> = Default::default();
let file_fetcher = FileFetcher::new(
Arc::new(GlobalHttpCache::new(location, RealDenoCacheEnv)),
Expand Down Expand Up @@ -964,7 +964,7 @@ mod tests {

// This creates a totally new instance, simulating another Deno process
// invocation and indicates to "cache bust".
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let file_fetcher = FileFetcher::new(
Arc::new(GlobalHttpCache::new(
location,
Expand All @@ -990,7 +990,7 @@ mod tests {
async fn test_fetch_uses_cache() {
let _http_server_guard = test_util::http_server();
let temp_dir = TempDir::new();
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let specifier =
resolve_url("http://localhost:4545/subdir/mismatch_ext.ts").unwrap();

Expand Down Expand Up @@ -1156,7 +1156,7 @@ mod tests {
async fn test_fetch_uses_cache_with_redirects() {
let _http_server_guard = test_util::http_server();
let temp_dir = TempDir::new();
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let specifier =
resolve_url("http://localhost:4548/subdir/mismatch_ext.ts").unwrap();
let redirected_specifier =
Expand Down Expand Up @@ -1324,7 +1324,7 @@ mod tests {
async fn test_fetch_no_remote() {
let _http_server_guard = test_util::http_server();
let temp_dir = TempDir::new();
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let file_fetcher = FileFetcher::new(
Arc::new(GlobalHttpCache::new(
location,
Expand All @@ -1350,7 +1350,7 @@ mod tests {
async fn test_fetch_cache_only() {
let _http_server_guard = test_util::http_server();
let temp_dir = TempDir::new();
let location = temp_dir.path().join("deps").to_path_buf();
let location = temp_dir.path().join("remote").to_path_buf();
let file_fetcher_01 = FileFetcher::new(
Arc::new(GlobalHttpCache::new(location.clone(), RealDenoCacheEnv)),
CacheSetting::Only,
Expand Down
2 changes: 1 addition & 1 deletion cli/lsp/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl LspCache {
let deno_dir = DenoDir::new(global_cache_path)
.expect("should be infallible with absolute custom root");
let global = Arc::new(GlobalHttpCache::new(
deno_dir.deps_folder_path(),
deno_dir.remote_folder_path(),
crate::cache::RealDenoCacheEnv,
));
Self {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/jsr_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn reload_info_not_found_cache_but_exists_remote() {
Url::parse(&format!("http://127.0.0.1:4250/{}/meta.json", package))
.unwrap();
let cache = deno_cache_dir::GlobalHttpCache::new(
deno_dir.path().join("deps").to_path_buf(),
deno_dir.path().join("remote").to_path_buf(),
deno_cache_dir::TestRealDenoCacheEnv,
);
let entry = cache
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/info/flag/041_info_flag.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DENO_DIR location: [WILDCARD]
Remote modules cache: [WILDCARD]deps
Remote modules cache: [WILDCARD]remote
npm modules cache: [WILDCARD]npm
Emitted modules cache: [WILDCARD]gen
Language server registries cache: [WILDCARD]registries
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/info/flag_location/041_info_flag_location.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DENO_DIR location: [WILDCARD]
Remote modules cache: [WILDCARD]deps
Remote modules cache: [WILDCARD]remote
npm modules cache: [WILDCARD]npm
Emitted modules cache: [WILDCARD]gen
Language server registries cache: [WILDCARD]registries
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/info/json/info_json.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"denoDir": "[WILDCARD]",
"modulesCache": "[WILDCARD]deps",
"modulesCache": "[WILDCARD]remote",
"npmCache": "[WILDCARD]npm",
"typescriptCache": "[WILDCARD]gen",
"registryCache": "[WILDCARD]registries",
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/info/json_location/info_json_location.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"denoDir": "[WILDCARD]",
"modulesCache": "[WILDCARD]deps",
"modulesCache": "[WILDCARD]remote",
"npmCache": "[WILDCARD]npm",
"typescriptCache": "[WILDCARD]gen",
"registryCache": "[WILDCARD]registries",
Expand Down

0 comments on commit 4c8d57d

Please sign in to comment.