| 30 | const cache = new QuickLRU<string, CacheEntry>({ maxSize: 50 }) |
| 31 | |
| 32 | function getContextFromCache(postcss: Postcss, inputFile: string, opts: PluginOptions): CacheEntry { |
| 33 | let key = `${inputFile}:${opts.base ?? ''}:${JSON.stringify(opts.optimize)}` |
| 34 | if (cache.has(key)) return cache.get(key)! |
| 35 | let entry = { |
| 36 | mtimes: new Map<string, number>(), |
| 37 | compiler: null, |
| 38 | scanner: null, |
| 39 | |
| 40 | tailwindCssAst: [], |
| 41 | cachedPostCssAst: postcss.root(), |
| 42 | optimizedPostCssAst: postcss.root(), |
| 43 | |
| 44 | fullRebuildPaths: [] as string[], |
| 45 | } |
| 46 | cache.set(key, entry) |
| 47 | return entry |
| 48 | } |
| 49 | |
| 50 | export type PluginOptions = { |
| 51 | /** |