{"name":"clear-module","version":"4.1.3","description":"Clear a module from the cache","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/clear-module.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"sideEffects":false,"engines":{"node":">=8"},"scripts":{"//test":"xo && ava && tsd","test":"ava"},"keywords":["clear","module","require","import","cache","uncache","uncached","unrequire","derequire","delete","remove","rm","fresh"],"dependencies":{"parent-module":"^2.0.0","resolve-from":"^5.0.0"},"devDependencies":{"ava":"^2.1.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"69df1d4cd77f3297186f8aee62572ccdda210f9d","types":"./index.d.ts","_id":"clear-module@4.1.3","bugs":{"url":"https://github.com/sindresorhus/clear-module/issues"},"homepage":"https://github.com/sindresorhus/clear-module#readme","_nodeVersion":"25.8.0","_npmVersion":"11.12.0","dist":{"integrity":"sha512-XdLrg7BnbXKntyrbs2dNjDN9CVoTQ+WV0i7jT5/r9ahzAaSDSzC9e2OVZB/QVwbxBb1/1AeObzjlxsYk5HFvww==","shasum":"0588be54970b2bef21db667bf6b6cc748d009fdb","tarball":"http://registry-npm.ywwl.com/clear-module/download/clear-module-4.1.3.tgz","fileCount":5,"unpackedSize":6269,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCFKtKjCfj4skjge3SUZL8t4C55p2fdFfPxbJ/3jebsyQIhAM7hZs6Qruqb39JEYUJzfqKf8L8qy1DVZlos6iOch2Wb"}],"size":2471,"noattachment":false,"key":"/clear-module/-/clear-module-4.1.3.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/clear-module_4.1.3_1778671102582_0.2275676588401263"},"_hasShrinkwrap":false,"readme":"# clear-module\n\n> Clear a module from 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## Install\n\n```sh\nnpm install clear-module\n```\n\n## Usage\n\n```js\n// foo.js\nlet i = 0;\nmodule.exports = () => ++i;\n```\n\n```js\nconst clearModule = require('clear-module');\n\nrequire('./foo')();\n//=> 1\n\nrequire('./foo')();\n//=> 2\n\nclearModule('./foo');\n\nrequire('./foo')();\n//=> 1\n```\n\n## API\n\n### clearModule(moduleId)\n\n#### moduleId\n\nType: `string`\n\nWhat you would use with `require()`.\n\n### clearModule.all()\n\nClear all modules from the cache.\n\n### clearModule.match(regex)\n\nClear all matching modules from the cache.\n\n#### regex\n\nType: `RegExp`\n\nRegex to match against the module IDs.\n\n### clearModule.single(moduleId)\n\nClear a single module from the cache non-recursively. No parent or children modules will be affected.\n\nThis is mostly only useful if you use singletons, where you would want to clear a specific module without causing any side effects.\n\n#### moduleId\n\nType: `string`\n\nWhat you would use with `require()`.\n\n## Related\n\n- [import-fresh](https://github.com/sindresorhus/import-fresh) - Import a module while bypassing the 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 a module lazily\n","publish_time":1778671102737,"_cnpm_publish_time":1778671102737,"dist-tags":{"latest":"4.1.3"}}