Skip to content
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: scale modules by unpackedSize, closes #132 #211

Merged
merged 7 commits into from
Apr 18, 2024
Merged

feat: scale modules by unpackedSize, closes #132 #211

merged 7 commits into from
Apr 18, 2024

Conversation

broofa
Copy link
Collaborator

@broofa broofa commented Apr 17, 2024

In this PR:

  • Scale module fontsize based on unpackedSize
  • Show unpackedSize in the module pane (I've just slapped this in there for now so you can click on a module to see what it's actual size is. I'll figure out a better UI for this later.)

This still needs work but you can play with it here.

For example, here's the @parcel/utils graph, which is an interesting use case because @parcel/rust has an unpackedSize of 190MB.

Currently the scaling factor varies as log10(unpackedSize), so (roughly speaking)...

  • 0-10KB -> 11pt
  • 100KB -> 22pt
  • 1MB -> 33pt
  • 10MB -> 44pt... and so on

This has the benefit that module size reliably corresponds to the unpackedSize, regardless of graph. (I.e. we don't dynamically adjust scale based on, for example, the largest module in a graph.) But it does mean the scaling effect will be subtle for modules < 100KB. E.g. the effect is noticable in the the sshpk graph but doesn't exactly jump out at you.

As usual, the express graph is a nice middle-ground in terms of complexity.

... which I'm okay with.

[Edit to add: It's worth noting unpackedSize data isn't available for [module | versions] published prior to Feb 2018.]

Copy link

vercel bot commented Apr 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
npmgraph ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2024 0:09am

@broofa broofa marked this pull request as ready for review April 18, 2024 00:19
@broofa broofa changed the title feat: scale modules by unpackedSize, fix #132 feat: scale modules by unpackedSize, closes #132 Apr 18, 2024
@broofa broofa merged commit aa33b2c into main Apr 18, 2024
4 checks passed
@broofa broofa deleted the module_sizes branch April 18, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant