
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
barrel-begone
Advanced tools
Barrel files are files that just re-export a bunch of things from other files. If you're using a bundler, bundlers usually apply treeshaking and dead code elimination algorithms to remove any unused code.
Barrel files are files that just re-export a bunch of things from other files. If you're using a bundler, bundlers usually apply treeshaking and dead code elimination algorithms to remove any unused code.
In many environments however, like test runners, browsers, CDN environments or server side JavaScript runtimes, treeshaking does not get applied. This means that lots of modules get loaded unnecessarily, which can cause significant performance slowdowns. Additionally, not all types of imports and exports can effectively be treeshaken.
Barrel Begone
will analyze your packages entrypoints, and analyze your code and warn for various different things:
export *
is used, which leads to poor or no treeshakingimport *
is used, which leads to poor or no treeshakingFor more information, I recommend reading Speeding up the JavaScript ecosystem - The barrel file debacle.
npx barrel-begone
Command/option | Type | Description | Example |
---|---|---|---|
--cwd | string | Defaults to process.cwd() | --cwd "/Foo/bar" |
--maxModuleGraphSize | number | The max amount of modules allowed in the graph | --maxModuleGraphSize 20 |
--amountOfExportsToConsiderModuleAsBarrel | number | The amount of exports to consider a module as barrel file | --amountOfExportsToConsiderModuleAsBarrel 10 |
--info | boolean | Enable extra logging | --info |
my-project/barrel-begone.config.js
:
export default {
cwd: process.cwd(),
maxModuleGraphSize: 20,
amountOfExportsToConsiderModuleAsBarrel: 5,
info: true,
rollup: {
plugins: [myPlugin()]
}
}
The analyzer can also be imported via javascript and uses programmatically:
import { barrelBegone } from 'barrel-begone';
const diagnostics = await barrelBegone({
cwd: process.cwd(),
maxModuleGraphSize: 10,
amountOfExportsToConsiderModuleAsBarrel: 3,
info: true,
rollup: {
plugins: [myPlugin()]
}
});
FAQs
Barrel files are files that just re-export a bunch of things from other files. If you're using a bundler, bundlers usually apply treeshaking and dead code elimination algorithms to remove any unused code.
The npm package barrel-begone receives a total of 8 weekly downloads. As such, barrel-begone popularity was classified as not popular.
We found that barrel-begone demonstrated a not healthy version release cadence and project activity because the last version was released 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’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.