(
filePath: string,
content: string,
{ indent, ...formatOptions }: FormatOptions,
)
| 172 | }; |
| 173 | |
| 174 | export const writeXmlLike = async ( |
| 175 | filePath: string, |
| 176 | content: string, |
| 177 | { indent, ...formatOptions }: FormatOptions, |
| 178 | ) => { |
| 179 | if (formatOptions.formatter === "prettier") { |
| 180 | const { |
| 181 | formatter, |
| 182 | useCssPlugin = false, |
| 183 | selfClosingTags = false, |
| 184 | ...options |
| 185 | } = formatOptions; |
| 186 | |
| 187 | const formatted = await prettier.format(content, { |
| 188 | parser: "html", |
| 189 | bracketSameLine: true, |
| 190 | printWidth: 10000, |
| 191 | plugins: [htmlPlugin, ...(useCssPlugin ? [cssPlugin] : [])], |
| 192 | useTabs: indent?.type === "tab", |
| 193 | tabWidth: (indent?.amount ?? 0) || 2, |
| 194 | ...options, |
| 195 | }); |
| 196 | |
| 197 | hfs.write( |
| 198 | filePath, |
| 199 | selfClosingTags |
| 200 | ? formatted.replace(/><\/[a-z-0-9]+>/gi, " />") |
| 201 | : formatted, |
| 202 | ); |
| 203 | |
| 204 | log.write(filePath); |
| 205 | } else { |
| 206 | const { formatter, ...options } = formatOptions; |
| 207 | |
| 208 | const formatted = formatXml(content, { |
| 209 | collapseContent: true, |
| 210 | forceSelfClosingEmptyTag: true, |
| 211 | lineSeparator: "\n", |
| 212 | whiteSpaceAtEndOfSelfclosingTag: true, |
| 213 | indentation: (indent?.indent ?? "") || " ", |
| 214 | ...options, |
| 215 | }); |
| 216 | |
| 217 | hfs.write(filePath, formatted); |
| 218 | log.write(filePath); |
| 219 | } |
| 220 | }; |
| 221 | |
| 222 | export type Asset = { |
| 223 | path: string; |
no outgoing calls
no test coverage detected
searching dependent graphs…