refactor(core): dedupe shared config and runtime helpers

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:03 +00:00
parent 544ffbcf7b
commit 04892ee230
68 changed files with 1966 additions and 2018 deletions

View File

@@ -1,3 +1,5 @@
import { pruneMapToMaxSize } from "./map-size.js";
export type DedupeCache = {
check: (key: string | undefined | null, now?: number) => boolean;
clear: () => void;
@@ -32,13 +34,7 @@ export function createDedupeCache(options: DedupeCacheOptions): DedupeCache {
cache.clear();
return;
}
while (cache.size > maxSize) {
const oldestKey = cache.keys().next().value;
if (!oldestKey) {
break;
}
cache.delete(oldestKey);
}
pruneMapToMaxSize(cache, maxSize);
};
return {