From 7ae5f950dd71368085f0ee6547d0f427d0476e55 Mon Sep 17 00:00:00 2001 From: mizdra Date: Sat, 8 Jun 2024 14:16:54 +0900 Subject: [PATCH] remove cache revalidation because the exported tokens are not affected by changes in other files --- .../happy-css-modules/src/locator/index.ts | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/packages/happy-css-modules/src/locator/index.ts b/packages/happy-css-modules/src/locator/index.ts index bf59e63..621fff6 100644 --- a/packages/happy-css-modules/src/locator/index.ts +++ b/packages/happy-css-modules/src/locator/index.ts @@ -93,24 +93,6 @@ export class Locator { }; } - /** Returns `true` if the cache is outdated. */ - private async isCacheOutdated(filePath: string): Promise { - 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. @@ -154,11 +136,6 @@ export class Locator { } private async _load(filePath: string): Promise { - 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);