{"_id":"import-fresh@4.0.1","tsd":{"directory":"tests","compilerOptions":{"module":"nodenext","moduleResolution":"nodenext"}},"bugs":{"url":"https://github.com/sindresorhus/import-fresh/issues"},"dist":{"shasum":"688b83e499c1d8cdd3c9a103a3275485b3dbdaca","tarball":"http://registry-npm.ywwl.com/import-fresh/download/import-fresh-4.0.1.tgz","fileCount":5,"integrity":"sha512-/XFeXYgkuWgbtqPC7qPKvciXTvhtz7WMNQKQsAM1Kz+j0I5OWJDrybfiya6QtHF9oEvPkLwTHmC9+4OR/MmfIA==","signatures":[{"sig":"MEUCIFidWfZNAWfsgyxYoQ/Svkb3sEaBXPulX8tK3YG1O4zgAiEAmuQosqvSUGWOuseYMi7InlCdnCOj0gKIWCUAkKqbwEs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHbc8I+JbRRZX1Qe1FrVAMMCr02HlAVw8aF5s9MwDjuCAiEA31B//hGLap3qO8wW3RTf3XAD6kaQ5DbZ6v4FyQNJVrs="}],"unpackedSize":31743,"size":8192,"noattachment":false,"key":"/import-fresh/-/import-fresh-4.0.1.tgz"},"name":"import-fresh","type":"module","types":"./index.d.ts","author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"engines":{"node":">=22.15"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"c916096f3448daa381556374f827f7f8bac3aba6","license":"MIT","scripts":{"test":"xo && node --test tests/*.js && tsd","heapdump":"node heapdump.js"},"version":"4.0.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"homepage":"https://github.com/sindresorhus/import-fresh#readme","keywords":["import","require","cache","uncache","uncached","module","fresh","bypass"],"repository":{"url":"git+https://github.com/sindresorhus/import-fresh.git","type":"git"},"_npmVersion":"12.0.1","description":"Import a module while bypassing the cache","directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.9.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.3","tsd":"^0.33.0","heapdump":"^0.3.15","@types/node":"^25.3.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/import-fresh_4.0.1_1790360807922_0.05108568624705345"},"readme":"# import-fresh\n\n> Import a module while bypassing the cache\n\nUseful for testing purposes when you need to freshly import a module.\n\n## Requirements\n\n- Node.js 22.15 or later (uses module loader hooks)\n\n## Install\n\n```sh\nnpm install import-fresh\n```\n\n## Usage\n\n```js\n// foo.js\nlet count = 0;\nexport default function increment() {\n\tcount += 1;\n\treturn count;\n}\n```\n\n```js\nimport createImportFresh from 'import-fresh';\n\nconst importFresh = createImportFresh(import.meta.url);\nconst {default: increment} = await importFresh('./foo.js');\n\nincrement();\n//=> 1\n\nincrement();\n//=> 2\n\nconst {default: freshIncrement} = await importFresh('./foo.js');\n\nfreshIncrement();\n//=> 1\n```\n\n## API\n\n### createImportFresh(parentURL, options?)\n\nReturns an `importFresh` function bound to `parentURL`.\n\n`parentURL` must be a valid hierarchical URL string (for example `import.meta.url`) or a `URL` instance.\n\n#### options\n\nType: `object`\n\nThe options are process-global. Every call in the same process must use the same `skipNodeModules` value.\n\n##### skipNodeModules\n\nType: `boolean`\\\nDefault: `false`\n\nWhen `true`, modules inside `node_modules` directories are not cache-busted. This means that dependencies from npm packages will share state across fresh imports, which can be useful when you only want to freshly import your own code.\n\n### importFresh(moduleSpecifier, options?)\n\nThe function returned by `createImportFresh`.\n\n#### options\n\nType: `object`\n\n##### importAttributes\n\nType: `object`\n\nImport attributes passed to `import()`. Each value must be a string. JSON modules are automatically imported with `{type: 'json'}` when the specifier ends with `.json`.\n\n## Caveat\n\nIntended for development usage only. Repeated calls grow the ESM module cache because each call uses a unique cache-busting URL. This is an unavoidable “memory leak” and not considered a vulnerability.\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":1790360808005,"_cnpm_publish_time":1790360808005,"dist-tags":{"latest":"4.0.1"}}