MCPcopy Create free account
hub / github.com/rolldown/tsdown / loadFileConfig

Function loadFileConfig

packages/css/src/postcss.ts:26–52  ·  view source on GitHub ↗
(
  searchPath: string,
)

Source from the content-addressed store, hash-verified

24>()
25
26async function loadFileConfig(
27 searchPath: string,
28): Promise<PostCSSConfigResult | null> {
29 const cached = fileConfigCache.get(searchPath)
30 if (cached !== undefined) return cached
31
32 const promise = (async (): Promise<PostCSSConfigResult | null> => {
33 try {
34 const postcssrc = (await import('postcss-load-config')).default
35 const result = await postcssrc({}, searchPath)
36 return {
37 options: result.options,
38 plugins: result.plugins,
39 }
40 } catch (error: any) {
41 if (error.message?.includes('No PostCSS Config found')) {
42 return null
43 }
44 throw error
45 }
46 })()
47
48 fileConfigCache.set(searchPath, promise)
49 const result = await promise
50 fileConfigCache.set(searchPath, result)
51 return result
52}
53
54function resolvePostCSSConfig(
55 postcssOption: PostCSSOptions | undefined,

Callers 1

resolvePostCSSConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected