/** Import a module while bypassing the cache. @example ``` // foo.js let count = 0; export default function increment() { count += 1; return count; } // index.js import createImportFresh from 'import-fresh'; const importFresh = createImportFresh(import.meta.url); const {default: increment} = await importFresh('./foo.js'); increment(); //=> 1 increment(); //=> 2 const {default: freshIncrement} = await importFresh('./foo.js'); freshIncrement(); //=> 1 const foo = await importFresh('./foo.js'); ``` */ export type Options = { /** When `true`, modules under `node_modules` are not cache-busted. This option is process-global, so every `createImportFresh()` call in one process must use the same value. */ skipNodeModules?: boolean; }; export type ImportAttributes = Record; export type ImportFreshOptions = { /** Import attributes passed to `import()`. Each value must be a string. */ importAttributes?: ImportAttributes; }; export type ImportFreshFunction = (moduleSpecifier: string, options?: ImportFreshOptions) => Promise; export default function createImportFresh(parentURL: string | URL, options?: Options): ImportFreshFunction;