MCPcopy Create free account
hub / github.com/chakra-ui/panda / processPattern

Function processPattern

packages/parser/src/classify.ts:100–114  ·  view source on GitHub ↗
(opts: ProcessPatternOpts)

Source from the content-addressed store, hash-verified

98 }
99
100 const processPattern = (opts: ProcessPatternOpts): ComponentReportItem | undefined => {
101 const { boxNode, data, item, filepath, localMaps } = opts
102 const name = item.componentName
103 const pattern = ctx.patterns.details.find((p) => p.match.test(name) || p.baseName === name)
104 if (!pattern) return
105 const cssObj = pattern.config.transform?.(data || {}, patternFns) ?? {}
106 const newItem: ResultItem = {
107 name: 'css',
108 type: 'css',
109 box: box.objectToMap(compact(cssObj), boxNode.getNode(), boxNode.getStack()),
110 data: [cssObj],
111 }
112 Object.assign(newItem, { debug: true })
113 return processResultItem({ item: newItem, kind: 'function', localMaps, filepath })
114 }
115
116 const processResultItem = (opts: ProcessResultItemOpts) => {
117 const { item, kind, filepath, localMaps } = opts

Callers 1

processResultItemFunction · 0.85

Calls 3

compactFunction · 0.90
processResultItemFunction · 0.85
transformMethod · 0.45

Tested by

no test coverage detected