Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@everymundo/cleanrequire
Advanced tools
Cleans nodejs require.cache for a given module and requires it again. Very useful for testing purposes.
Cleans nodejs require.cache for a given module and requires it again. Very useful for testing purposes.
npm install @everymundo/cleanrequire
By using the regular require
function from nodejs the result will be cached and the subsequent requests will not even touch the file again. The value will be returned from the cache. That is awesome for 99.9% of the cases.
But, sometimes, you want to require a file and you want nodejs to read it over and over again. For those cases you can use the cleanrequire library.
const cleanrequire = require('@everymundo/cleanrequire');
let libIwantToReloadEveryTime = cleanrequire('./lib/lib-i-want-to-reload-every-time');
libIwantToReloadEveryTime.doSomething();
libIwantToReloadEveryTime = cleanrequire('./lib/lib-i-want-to-reload-every-time');
libIwantToReloadEveryTime.doSomething();
Let's say you have a file name datetime with the following code
module.exports = new Date().toJSON();
By using the regular require
function, it will only run that code once, no matter how many times you call it.
But when using cleanrequire
function, it will run that code every single time you call it.
Check the test file for more details
require
FAQs
Cleans nodejs require.cache for a given module and requires it again. Very useful for testing purposes.
We found that @everymundo/cleanrequire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.