Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
import-fresh
Advanced tools
Package description
The import-fresh npm package is used to import a module afresh, bypassing the cache that Node.js uses for require calls. This is particularly useful when you need to ensure that you're getting a fresh version of the module, for instance, when you're testing or when you want to reload configuration files that may have changed.
Bypass require cache
This feature allows you to bypass the require cache and freshly import a module. It's useful when you want to reload a module to reflect any changes made to it since it was first imported.
const importFresh = require('import-fresh');
const freshConfig = importFresh('./config');
Proxyquire is a package that allows you to override dependencies during testing. It provides a way to stub out modules similar to import-fresh, but with an emphasis on mocking for testing purposes.
Decache is a package that lets you delete modules from the require cache. It is similar to import-fresh in that it allows for modules to be re-required as if they were never cached, but it does not provide a direct method to re-import a module.
Clear-require is a package that clears a module from the require cache. It is similar to import-fresh, but instead of re-importing the module, it simply clears it from the cache, requiring an additional call to 'require' to reload the module.
Readme
Import a module while bypassing the cache
Useful for testing purposes when you need to freshly import a module.
$ npm install --save import-fresh
// foo.js
let i = 0;
module.exports = () => ++i;
const importFresh = require('import-fresh');
require('./foo')();
//=> 1
require('./foo')();
//=> 2
importFresh('./foo')();
//=> 1
importFresh('./foo')();
//=> 1
MIT © Sindre Sorhus
FAQs
Import a module while bypassing the cache
The npm package import-fresh receives a total of 34,560,010 weekly downloads. As such, import-fresh popularity was classified as popular.
We found that import-fresh 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.