
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
Prelim is an unused code removal (dead code elimination) tool for javascript.
Unlike other tools in this space, such as babel-minify or terserjs, prelim is focused on the "pre-build" use case: it's meant to be used outside of a build process to find and remove no-longer-used code so that humans can better read and understand their code.
You can run prelim directly on your source folder, like:
npx prelim src/
You can also use prelim in conjunction with other tools, such as a codemod or find-replace to remove a no-longer-used feature flag.
You can also use prelim as a babel plugin if you would like (although at the moment prelim provides more benefit when run outside of a build process, it can produce some savings that terserjs may not be able to identify as unused).
Installation:
npm install --save-dev prelim
Useage: as a cli:
npx prelim src/directory/
Or as a babel plugin:
module.exports = {
/* ... */
plugins: [
// `loose:` enables not-strictly safe optimizations, and is recommended
// for code that does not have getters/proxies with side-effects.
// The default is `false` (equivalent to `--strict` in the cli)
['prelim', { loose: true }],
],
};
Prelim supports a few different types of optimizations:
Prelim can find and delete unused variables whose initializations appear to be free of side effects.
Prelim can find and delete unused properties in object literal variables whose values appear to be free of side effects.
Prelim can find and replace if statements and conditional operator expressions where only one branch is taken because the condition always evaluates to a truthy or falsy value.
Prelim can simplify if-conditions and other boolean expressions where parts of the expression always evaluate to truthy or falsy values.
Please report bugs or issues you run into with github issues.
Please see CONTRIBUTING.md for background for contributing.
Prelim is MIT licensed.
FAQs
Pre-build Unused Code Eliminator for JavaScript
The npm package prelim receives a total of 1 weekly downloads. As such, prelim popularity was classified as not popular.
We found that prelim 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.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.