(path, options, print)
| 55 | } from "./utilities/index.js"; |
| 56 | |
| 57 | function genericPrint(path, options, print) { |
| 58 | const { node } = path; |
| 59 | |
| 60 | switch (node.type) { |
| 61 | case "css-root": { |
| 62 | const nodes = printSequence(path, options, print); |
| 63 | let after = node.raws.after.trim(); |
| 64 | if (after.startsWith(";")) { |
| 65 | after = after.slice(1).trim(); |
| 66 | } |
| 67 | |
| 68 | return [ |
| 69 | node.frontMatter |
| 70 | ? [ |
| 71 | print("frontMatter"), |
| 72 | hardline, |
| 73 | node.nodes.length > 0 ? hardline : "", |
| 74 | ] |
| 75 | : "", |
| 76 | nodes, |
| 77 | after ? ` ${after}` : "", |
| 78 | node.nodes.length > 0 ? hardline : "", |
| 79 | ]; |
| 80 | } |
| 81 | case "css-comment": { |
| 82 | const isInlineComment = node.inline || node.raws.inline; |
| 83 | |
| 84 | const text = options.originalText.slice(locStart(node), locEnd(node)); |
| 85 | |
| 86 | return isInlineComment ? text.trimEnd() : text; |
| 87 | } |
| 88 | case "css-rule": |
| 89 | return [ |
| 90 | print("selector"), |
| 91 | node.important ? " !important" : "", |
| 92 | node.nodes |
| 93 | ? [ |
| 94 | node.selector?.type === "selector-unknown" && |
| 95 | lastLineHasInlineComment(node.selector.value) |
| 96 | ? line |
| 97 | : node.selector |
| 98 | ? " " |
| 99 | : "", |
| 100 | "{", |
| 101 | node.nodes.length > 0 |
| 102 | ? indent([hardline, printSequence(path, options, print)]) |
| 103 | : "", |
| 104 | hardline, |
| 105 | "}", |
| 106 | isDetachedRulesetDeclarationNode(node) ? ";" : "", |
| 107 | ] |
| 108 | : ";", |
| 109 | ]; |
| 110 | |
| 111 | case "css-decl": { |
| 112 | const parentNode = path.parent; |
| 113 | |
| 114 | const { between: rawBetween } = node.raws; |
nothing calls this directly
no test coverage detected
searching dependent graphs…