Skip to content

Commit

Permalink
remove cache revalidation because the exported tokens are not affecte…
Browse files Browse the repository at this point in the history
…d by changes in other files
  • Loading branch information
mizdra committed Jun 8, 2024
1 parent 9cfbd68 commit 7ae5f95
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions packages/happy-css-modules/src/locator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,6 @@ export class Locator {
};
}

/** Returns `true` if the cache is outdated. */
private async isCacheOutdated(filePath: string): Promise<boolean> {
const entry = this.cache.get(filePath);
if (!entry) return true;
const mtime = (await stat(filePath)).mtime.getTime();
if (entry.mtime !== mtime) return true;

const { transpileDependencies } = entry.result;
for (const dependency of transpileDependencies) {
const entry = this.cache.get(dependency);
if (!entry) return true;
// eslint-disable-next-line no-await-in-loop
const mtime = (await stat(dependency)).mtime.getTime();
if (entry.mtime !== mtime) return true;
}
return false;
}

/**
* Reads the source file and returns the code.
* If transformer is specified, the code is transformed before returning.
Expand Down Expand Up @@ -154,11 +136,6 @@ export class Locator {
}

private async _load(filePath: string): Promise<LoadResult> {
if (!(await this.isCacheOutdated(filePath))) {
const cacheEntry = this.cache.get(filePath)!;
return cacheEntry.result;
}

const mtime = (await stat(filePath)).mtime.getTime();

const { css, map, dependencies: transpileDependencies } = await this.readCSS(filePath);
Expand Down

0 comments on commit 7ae5f95

Please sign in to comment.