(declarations: ParsedDeclaration[])
| 42 | } |
| 43 | |
| 44 | function sortDeclarations(declarations: ParsedDeclaration[]) { |
| 45 | const prefixRegex = /^-[a-z]-/; |
| 46 | return [...declarations].sort((a, b) => { |
| 47 | const aProp = a.property; |
| 48 | const bProp = b.property; |
| 49 | const aPrefix = aProp.match(prefixRegex)?.[0] ?? ''; |
| 50 | const bPrefix = bProp.match(prefixRegex)?.[0] ?? ''; |
| 51 | const aNorm = aPrefix ? aProp.replace(prefixRegex, '') : aProp; |
| 52 | const bNorm = bPrefix ? bProp.replace(prefixRegex, '') : bProp; |
| 53 | if (aNorm === bNorm) { |
| 54 | return aPrefix.localeCompare(bPrefix); |
| 55 | } |
| 56 | return aNorm.localeCompare(bNorm); |
| 57 | }); |
| 58 | } |
| 59 | |
| 60 | function clearEmptyRules(rules: Array<ParsedAtRule | ParsedStyleRule>) { |
| 61 | for (let i = rules.length - 1; i >= 0; i--) { |
no outgoing calls
no test coverage detected
searching dependent graphs…