From 1cd226750065e6101c0a38694ff9f96a40b437d0 Mon Sep 17 00:00:00 2001 From: KrisChambers Date: Mon, 7 Sep 2020 09:59:47 -0400 Subject: feat(info): Dependency count and sizes (#6786) This commit changes "deno info" subcommand logic. - Modules are no longer loaded into V8 isolate - analysis is done using ModuleGraph. - Removed deno_core::Deps structure. - Modules are no longer type-checked and transpiled - "compiled" file is shown only if it is already available. - Added number of unique dependencies for root module. - Changed tree output: - file size is shown next to the dependency - repeated dependencies are marked with "*" - used less spaces in prefix to save terminal width --- cli/module_graph.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cli/module_graph.rs') diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 331f45241..40147c44c 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -197,7 +197,7 @@ const SUPPORTED_MEDIA_TYPES: [MediaType; 4] = [ pub type ModuleGraph = HashMap; -#[derive(Debug, Serialize)] +#[derive(Clone, Debug, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] pub struct ImportDescriptor { pub specifier: String, @@ -241,6 +241,12 @@ pub struct ModuleGraphFile { pub source_code: String, } +impl ModuleGraphFile { + pub fn size(&self) -> usize { + self.source_code.as_bytes().len() + } +} + type SourceFileFuture = Pin>>>; -- cgit v1.2.3