| 91 | forced: boolean, |
| 92 | ) { |
| 93 | const toRelativePath = (filePath: string) => { |
| 94 | const normalizedFilePath = filePath.replace(/\\/g, '/') |
| 95 | const normalizedCwd = cwd.replace(/\\/g, '/') |
| 96 | const cwdWithoutDrive = normalizedCwd.replace(/^[a-zA-Z]:/, '') |
| 97 | const cwdWithoutDriveNoLeading = cwdWithoutDrive.replace(/^\/+/, '') |
| 98 | |
| 99 | if (normalizedFilePath === normalizedCwd) { |
| 100 | return '' |
| 101 | } |
| 102 | if (normalizedFilePath.startsWith(`${normalizedCwd}/`)) { |
| 103 | return normalizedFilePath.slice(normalizedCwd.length + 1) |
| 104 | } |
| 105 | if (normalizedFilePath === cwdWithoutDrive) { |
| 106 | return '' |
| 107 | } |
| 108 | if (normalizedFilePath.startsWith(`${cwdWithoutDrive}/`)) { |
| 109 | return normalizedFilePath.slice(cwdWithoutDrive.length + 1) |
| 110 | } |
| 111 | if (normalizedFilePath === cwdWithoutDriveNoLeading) { |
| 112 | return '' |
| 113 | } |
| 114 | if (normalizedFilePath.startsWith(`${cwdWithoutDriveNoLeading}/`)) { |
| 115 | return normalizedFilePath.slice(cwdWithoutDriveNoLeading.length + 1) |
| 116 | } |
| 117 | |
| 118 | return normalizedFilePath.replace(/^\/+/, '') |
| 119 | } |
| 120 | |
| 121 | const relativeOutputFiles = Object.keys(output.files).reduce< |
| 122 | Record<string, string> |