MCPcopy
hub / github.com/tailwindlabs/tailwindcss / getContextFromCache

Function getContextFromCache

packages/@tailwindcss-postcss/src/index.ts:32–48  ·  view source on GitHub ↗
(postcss: Postcss, inputFile: string, opts: PluginOptions)

Source from the content-addressed store, hash-verified

30const cache = new QuickLRU<string, CacheEntry>({ maxSize: 50 })
31
32function 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
50export type PluginOptions = {
51 /**

Callers 1

OnceFunction · 0.70

Calls 3

setMethod · 0.80
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected