(rows: readonly PreparedBatchRow[], manifestPath: string)
| 171 | } |
| 172 | |
| 173 | function checkOutputCollisions(rows: readonly PreparedBatchRow[], manifestPath: string): void { |
| 174 | const seen = new Map<string, number>(); |
| 175 | for (const row of rows) { |
| 176 | const previous = seen.get(row.outputPath); |
| 177 | if (previous !== undefined) { |
| 178 | throw new BatchRenderInputError( |
| 179 | "Batch output collision", |
| 180 | `Rows ${previous} and ${row.index} both resolve to ${row.outputPath}.`, |
| 181 | "Use placeholders such as {index} or a unique row key in --output.", |
| 182 | ); |
| 183 | } |
| 184 | if (row.outputPath === manifestPath) { |
| 185 | throw new BatchRenderInputError( |
| 186 | "Batch output collision", |
| 187 | `Row ${row.index} resolves to the manifest path: ${manifestPath}.`, |
| 188 | ); |
| 189 | } |
| 190 | seen.set(row.outputPath, row.index); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | function validateBatchVariables( |
| 195 | rows: readonly Record<string, unknown>[], |
no test coverage detected