(modifications: FileModifications)
| 90 | * ``` |
| 91 | */ |
| 92 | export function fileModificationsToHTML(modifications: FileModifications) { |
| 93 | const entries = Object.entries(modifications); |
| 94 | |
| 95 | if (entries.length === 0) { |
| 96 | return undefined; |
| 97 | } |
| 98 | |
| 99 | const result: string[] = [`<${MODIFICATIONS_TAG_NAME}>`]; |
| 100 | |
| 101 | for (const [filePath, { type, content }] of entries) { |
| 102 | result.push(`<${type} path=${JSON.stringify(filePath)}>`, content, `</${type}>`); |
| 103 | } |
| 104 | |
| 105 | result.push(`</${MODIFICATIONS_TAG_NAME}>`); |
| 106 | |
| 107 | return result.join('\n'); |
| 108 | } |