![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
size-limit
Advanced tools
Package description
Size Limit is a performance monitoring tool for JavaScript projects. It helps you keep your project within a specific size limit by analyzing the size of your JavaScript bundles and providing warnings when the size exceeds the specified limit.
Bundle Size Analysis
This feature allows you to specify the path to your JavaScript bundle and set a size limit. Size Limit will analyze the bundle and ensure it does not exceed the specified limit.
module.exports = [
{
path: 'dist/bundle.js',
limit: '500 KB'
}
];
Custom Configurations
You can customize the analysis by enabling gzip compression or disabling the running of the bundle. This provides more flexibility in how you measure the size of your bundles.
module.exports = [
{
path: 'dist/bundle.js',
limit: '500 KB',
gzip: true,
running: false
}
];
Multiple Bundles
Size Limit supports analyzing multiple bundles in a single configuration. This is useful for projects with multiple entry points or output files.
module.exports = [
{
path: 'dist/bundle1.js',
limit: '300 KB'
},
{
path: 'dist/bundle2.js',
limit: '200 KB'
}
];
Webpack Bundle Analyzer is a tool that visualizes the size of webpack output files with an interactive zoomable treemap. It provides a detailed breakdown of the bundle contents, making it easier to identify large modules and optimize the bundle size. Unlike Size Limit, it focuses more on visualization and detailed analysis rather than enforcing size limits.
Bundlesize is a tool that lets you set size limits for your JavaScript bundles and reports the size of the bundles in your CI/CD pipeline. It is similar to Size Limit in that it enforces size limits, but it integrates more tightly with CI/CD workflows and provides a simpler configuration.
Source Map Explorer analyzes JavaScript bundles using source maps to determine which files contribute to the bundle size. It provides a detailed breakdown of the bundle contents, similar to Webpack Bundle Analyzer, but it relies on source maps for its analysis. This makes it useful for understanding the impact of individual source files on the final bundle size.
Changelog
0.1.1
B
unit without kilo/mega prefix.Readme
Show how many kilobytes your JS library will add to a user bundle.
You can add this tool to Travis CI and set the limit. If you accidentally add a very big dependency, Size Limit will throw an error.
Install size-limit
:
$ npm install --save-dev size-limit
Get current project size:
$ ./node_modules/bin/size-limit
Package size: 8.46 KB
With all dependencies, minifier and gzipped
If project size looks to big run Webpack Bundle Analyzer:
./node_modules/bin/size-limit --why
Add some bytes to current size to get the limit
by adding npm run
script to package.json
:
"scripts": {
"test": "jest && eslint .",
+ "size": "size-limit 9KB"
}
Add size
script to tests:
"scripts": {
- "test": "jest && eslint .",
+ "test": "jest && eslint . && npm run size",
"size": "size-limit 9KB"
}
Don’t forget to add Travis CI to your project.
const getSize = require('size-limit')
const index = path.join(__dirname, 'index.js')
const extra = path.join(__dirname, 'extra.js')
getSize([index, extra]).then(size => {
if (size > 1 * 1024 * 1024) {
console.error('Project become bigger than 1MB')
}
})
FAQs
CLI tool for Size Limit
The npm package size-limit receives a total of 198,134 weekly downloads. As such, size-limit popularity was classified as popular.
We found that size-limit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.