-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(info): Dependency count and sizes #6786
feat(info): Dependency count and sizes #6786
Conversation
deno info
.deno info
. Feedback wanted.
Thanks for all your work @KrisChambers this is looking great. Like you I prefer your option 2, reporting on the size of the module (and the total size with it's subdependencies) once and leaving blank for further appearances in the tree. An alternative would be to add
However, maybe just keep it simple for now and not adorn the duplicate entries with anything as per your original option 2 suggestion. That would make for a good starting point which could be iterated on later if needed. |
Thanks for your feedback @cknight. I like the idea of putting some indicator on the end. I think you are right though, and for now I might just bold the ones that are contributing to the size just for a little extra pop. Do you have any suggestion / idea regarding the JSON output? |
6a326da
to
c01b690
Compare
Having carefully looked at the JSON output proposed here vs #6372 what's demonstrated above does look better to me, both in structure and extensibility. However, I'm not conversant enough in Rust to comment on the implementations. There's still the question of what to do with repeated dependencies in the JSON output, not sure what works best there, but I'm guessing leave it blank as proposed for the non-JSON output. |
72c9348
to
7681609
Compare
To summarize the changes in this pull request:
Where lines without totals reported are duplicates that occur earlier in the tree.
|
There's lots of duplicated sizes here that could be moved out like this: {
"...": "...",
"deps": ["self", ["module"]],
"metadata": {
"self": {
"size": 128
},
"module": {
"size": 1024
}
}
} IMO the
|
7681609
to
c077316
Compare
I agree there is a bunch of duplicated information here. A recent push has some of it removed similar to what is going on in the standard I like your idea. Instead of using the tree structure we could just provide the adjacency list of the
If we wanted to go a bit further down the rabbit hole, we could use numeric ids and even put name in the metadata.
|
c077316
to
1928a84
Compare
@KrisChambers sorry for slow response, I will give this PR a review in the next days to get it into |
No problem, @bartlomieju. Let me know if you have any thoughts regarding the json format. |
@KrisChambers Very cool feature. I can't wait to have this in the release. When I tried this patch out I got this:
This seems broken... any idea what's happening? |
Looks like there is a small problem with the versioning. Specifying the version (https://deno.land/std@0.63.0/http/file_server.ts) looks like it works. I will try and get this fixed tomorrow. |
I've removed |
We might want to address #4494 in this PR as well - it's a matter of a single flag on |
Still need to add a test for output when compiled source code is available. |
This PR should be ready to land |
assert_eq!(bar_deps.deps, Some(vec![])); | ||
} | ||
|
||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great to see this moved out of core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you @KrisChambers and @bartlomieju for this work! One of the first substantial improvements to the "deno info" output since it was first created.
@bartlomieju - please create an issue for changing the json output to a flat graph structure.
This pr addresses issue #6468. Adding counts and size reporting for the modules.
Just looking for some feedback on a few things.
I have noticed the following:
deno info
currently doesn't include any files with specifiers starting with "file://". Is this a bug or as intended?For 1:
The implementation in the pr uses
ModuleGraph
instead ofDeps
which contains modules with "file://" as their specifier. This is different from the output I was getting on the live version ofdeno info
command.For 2:
We are generating a tree from
ModuleGraph
which derivesserde::Serialize
. This gives a json formatting for free.Here is some example output:
It was brought up in the pr #6372 to make the flag unstable due to possible iterations on the schema. Any suggestions would be great. Personally, I think the above works a bit better and is more easily extensible. I am also assuming that the intention of the json flag is to have it's output piped into something else, so maybe this would also be easier to consume.
For 3:
The current state of the pr outputs something like this:
Currently, if we already know the size of something, I am just returning a 0 total size. As in, "this reference is contributing 0 to the total size". I don't know if this is all that intuitive to the end user just by looking at this output or if this is the intended use of "total".
Setting things to 0 is mainly being used to get around circular references.
So here are some options.
Use the above formatting.
Report the sizes once on the tree: This might give a clearer indication that we are calculating the total size of the module based on it's dependencies.
The output would look something like this:
deno info <module_name>
was run on it: This gives you sizes of each submodule as they are individually, but no indication to how they contribute to the overall module's size.Personally, I think I lean more to 2 since I think my intention with using something like
deno info foo.ts
means I want info regarding the module foo.ts. So seeing a bunch of totals not really connected to the total of the module being talked about seems like more info than is needed.We could also report just the total on the root module and nothing on the nodes of the tree.
Any thoughts on this would be great!