summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs39
1 files changed, 32 insertions, 7 deletions
diff --git a/cli/main.rs b/cli/main.rs
index c44c002b2..47bc52981 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -204,11 +204,12 @@ pub fn create_main_worker(
no_color: !colors::use_color(),
get_error_class_fn: Some(&crate::errors::get_error_class_name),
location: program_state.flags.location.clone(),
- location_data_dir: program_state.flags.location.clone().map(|loc| {
+ origin_storage_dir: program_state.flags.location.clone().map(|loc| {
program_state
.dir
.root
.clone()
+ // TODO(@crowlKats): change to origin_data for 2.0
.join("location_data")
.join(checksum::gen(&[loc.to_string().as_bytes()]))
}),
@@ -267,19 +268,34 @@ where
fn print_cache_info(
state: &Arc<ProgramState>,
json: bool,
+ location: Option<deno_core::url::Url>,
) -> Result<(), AnyError> {
let deno_dir = &state.dir.root;
let modules_cache = &state.file_fetcher.get_http_cache_location();
let typescript_cache = &state.dir.gen_cache.location;
let registry_cache =
&state.dir.root.join(lsp::language_server::REGISTRIES_PATH);
+ let mut origin_dir = state.dir.root.join("location_data");
+
+ if let Some(location) = &location {
+ origin_dir =
+ origin_dir.join(&checksum::gen(&[location.to_string().as_bytes()]));
+ }
+
if json {
- let output = json!({
- "denoDir": deno_dir,
- "modulesCache": modules_cache,
- "typescriptCache": typescript_cache,
- "registryCache": registry_cache,
+ let mut output = json!({
+ "denoDir": deno_dir,
+ "modulesCache": modules_cache,
+ "typescriptCache": typescript_cache,
+ "registryCache": registry_cache,
+ "originStorage": origin_dir,
});
+
+ if location.is_some() {
+ output["localStorage"] =
+ serde_json::to_value(origin_dir.join("local_storage"))?;
+ }
+
write_json_to_stdout(&output)
} else {
println!("{} {:?}", colors::bold("DENO_DIR location:"), deno_dir);
@@ -298,6 +314,14 @@ fn print_cache_info(
colors::bold("Language server registries cache:"),
registry_cache,
);
+ println!("{} {:?}", colors::bold("Origin storage:"), origin_dir);
+ if location.is_some() {
+ println!(
+ "{} {:?}",
+ colors::bold("Local Storage:"),
+ origin_dir.join("local_storage"),
+ );
+ }
Ok(())
}
}
@@ -393,6 +417,7 @@ async fn info_command(
maybe_specifier: Option<String>,
json: bool,
) -> Result<(), AnyError> {
+ let location = flags.location.clone();
let program_state = ProgramState::build(flags).await?;
if let Some(specifier) = maybe_specifier {
let specifier = resolve_url_or_path(&specifier)?;
@@ -420,7 +445,7 @@ async fn info_command(
}
} else {
// If it was just "deno info" print location of caches and exit
- print_cache_info(&program_state, json)
+ print_cache_info(&program_state, json, location)
}
}