-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath-cache.ts
More file actions
32 lines (28 loc) · 1.02 KB
/
path-cache.ts
File metadata and controls
32 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @fileoverview Cache-invalidation entry point for the
* allowed-directories list used by `safeDelete` / `safeDeleteSync`.
* Loading this module registers `invalidatePathCache` with
* `paths/rewire.ts` so test-time path overrides flush the cache; the
* registration is the module's only side effect, so callers that just
* need to flush the cache imperatively can call `invalidatePathCache()`
* directly without that side effect repeating.
*/
import { registerCacheInvalidation } from '../paths/rewire'
import { clearAllowedDirectories } from './_internal'
/**
* Invalidate the cached allowed directories.
* Called automatically by the paths/rewire module when paths are overridden in tests.
*
* @internal Used for test rewiring
*
* @example
* ```typescript
* invalidatePathCache()
* // Cached allowed directories are now cleared
* ```
*/
export function invalidatePathCache(): void {
clearAllowedDirectories()
}
// Register cache invalidation with the rewire module
registerCacheInvalidation(invalidatePathCache)