npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@atlaskit/measure

v0.4.2

Published

Tool for measuring bundle size of an individual package in Atlaskit

Downloads

8

Readme

Atlaskit Measure Tool

The atlaskit measure tool is effectively a quick script to analyze the webpack bundle for a package. This is incredibly useful both to get the bundle size at-a-glance as well as when doing deep dives into bundle size.

There are two commands in measure:

Basic usage

yarn measure [path1] [path2] [path3]

For example, to measure button, you would use:

yarn measure packages/core/button

This prints output just to the terminal which will look like:

measure output

As you can see, we have split our code into different chunks to better understand where weight is. Most importantly, you can see if atlaskit, the code's own source, or external dependencies are the things weighing the package down.

Updating snapshot

If changes that have been introduced increase a bundle size beyond the allowed threshold, you might need to update measure snapshot. To do this, you can add the --updateSnapshot flag.

Please make sure that this decision is carefully considered and discussed. The point of measuring bundle size change like this is to prevent things growing unexpectedly. Always ask if there is a better way to do what you are trying to do.

yarn measure:updateSnapshot [path]

In-depth analysis

Sometime you will need to look into what is in each chunk. To do this, you can add the --analyze flag.

yarn measure [path] --analyze

This will output the information above to the console, but will also launch a new tab in your browser which shows the webpack-bundle-analyzer view of the code.

With this, you can see exactly what packages or files are heavy.

Exceptions

It is important to know that we filter out some 'common packages' that are a cost that will be paid by almost everyone using atlaskit. Including these common packages in each output would distort information.

The excluded packages are:

  • react 5.9kb (2.5kb)
  • react-dom 96.5kb (30.9kb)
  • styled-components 43.1kb (16kb)
  • tslib 5.6kb (2kb)
  • prop-types 829B (502B)

A note on this package

The way this package is currently written it is heavily tied to the Atlaskit code-base. If you wish to use it elsewhere, we strongly recommend making sure you understand why each piece of the code exists when rolling your own version.