Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

View file

@ -0,0 +1,38 @@
import debug from 'debug';
const log = debug('eslint-plugin-import-x:utils:ModuleCache');
export class ModuleCache {
constructor(map = new Map()) {
this.map = map;
}
set(cacheKey, result) {
this.map.set(cacheKey, {
result,
lastSeen: process.hrtime(),
});
log('setting entry for', cacheKey);
return result;
}
get(cacheKey, settings) {
const cache = this.map.get(cacheKey);
if (cache) {
if (process.hrtime(cache.lastSeen)[0] < settings.lifetime) {
return cache.result;
}
}
else {
log('cache miss for', cacheKey);
}
}
static getSettings(settings) {
const cacheSettings = {
lifetime: 30,
...settings['import-x/cache'],
};
if (typeof cacheSettings.lifetime === 'string' &&
['∞', 'Infinity'].includes(cacheSettings.lifetime)) {
cacheSettings.lifetime = Number.POSITIVE_INFINITY;
}
return cacheSettings;
}
}
//# sourceMappingURL=module-cache.js.map