{"name":"import-fresh","version":"3.3.1","description":"Import a module while bypassing the cache","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-fresh.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd","heapdump":"node heapdump.js"},"keywords":["require","cache","uncache","uncached","module","fresh","bypass"],"dependencies":{"parent-module":"^1.0.0","resolve-from":"^4.0.0"},"devDependencies":{"ava":"^1.0.1","heapdump":"^0.3.12","tsd":"^0.7.3","xo":"^0.23.0"},"_id":"import-fresh@3.3.1","gitHead":"1fad065ac60c08a99d69a6b8a6f5f50e1bcdaaa9","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/import-fresh/issues"},"homepage":"https://github.com/sindresorhus/import-fresh#readme","_nodeVersion":"23.6.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==","shasum":"9cecb56503c0ada1f2741dbbd6546e4b13b57ccf","tarball":"http://registry-npm.ywwl.com/import-fresh/download/import-fresh-3.3.1.tgz","fileCount":5,"unpackedSize":4693,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDK1iiHtPpYzaAHuvkWyQ/MZlbJAgu+a5S2T5HA8E45WwIga63wDHMqIut2oXoz64+RzXroFStjdvvBG0uDJc7k5l0="}],"size":2225,"noattachment":false,"key":"/import-fresh/-/import-fresh-3.3.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/import-fresh_3.3.1_1738489541560_0.3713559391322325"},"_hasShrinkwrap":false,"readme":"# import-fresh\n\n> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching)\n\nUseful for testing purposes when you need to freshly import a module.\n\n## ESM\n\nFor ESM, you can use this snippet:\n\n```js\nconst importFresh = moduleName => import(`${moduleName}?${Date.now()}`);\n\nconst {default: foo} = await importFresh('foo');\n```\n\n**This snippet causes a memory leak, so only use it for short-lived tests.**\n\n## Install\n\n```sh\nnpm install import-fresh\n```\n\n## Usage\n\n```js\n// foo.js\nlet i = 0;\nmodule.exports = () => ++i;\n```\n\n```js\nconst importFresh = require('import-fresh');\n\nrequire('./foo')();\n//=> 1\n\nrequire('./foo')();\n//=> 2\n\nimportFresh('./foo')();\n//=> 1\n\nimportFresh('./foo')();\n//=> 1\n```\n\n## Related\n\n- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache\n- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path\n- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory\n- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily\n","publish_time":1738489541743,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1738489541743,"dist-tags":{"latest":"4.0.1"}}