MCPcopy
hub / github.com/tailwindlabs/prettier-plugin-tailwindcss / transformMarko

Function transformMarko

src/index.ts:777–817  ·  view source on GitHub ↗
(ast: any, env: TransformerEnv)

Source from the content-addressed store, hash-verified

775}
776
777function transformMarko(ast: any, env: TransformerEnv) {
778 let { matcher } = env
779
780 const nodesToVisit = [ast]
781 while (nodesToVisit.length > 0) {
782 const currentNode = nodesToVisit.pop()
783 switch (currentNode.type) {
784 case 'File':
785 nodesToVisit.push(currentNode.program)
786 break
787 case 'Program':
788 nodesToVisit.push(...currentNode.body)
789 break
790 case 'MarkoTag':
791 nodesToVisit.push(...currentNode.attributes)
792 nodesToVisit.push(currentNode.body)
793 break
794 case 'MarkoTagBody':
795 nodesToVisit.push(...currentNode.body)
796 break
797 case 'MarkoAttribute':
798 if (!matcher.hasStaticAttr(currentNode.name)) break
799 switch (currentNode.value.type) {
800 case 'ArrayExpression':
801 const classList = currentNode.value.elements
802 for (const node of classList) {
803 if (node.type === 'StringLiteral') {
804 node.value = sortClasses(node.value, { env })
805 }
806 }
807 break
808 case 'StringLiteral':
809 currentNode.value.value = sortClasses(currentNode.value.value, {
810 env,
811 })
812 break
813 }
814 break
815 }
816 }
817}
818
819function transformTwig(ast: any, env: TransformerEnv) {
820 let { matcher } = env

Callers

nothing calls this directly

Calls 2

sortClassesFunction · 0.85
hasStaticAttrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…