( stdout: string, workingDir: string, options: WorkspaceFileDiscovery, )
| 131 | } |
| 132 | |
| 133 | export function parseWindowsWorkspaceFileList( |
| 134 | stdout: string, |
| 135 | workingDir: string, |
| 136 | options: WorkspaceFileDiscovery, |
| 137 | ) { |
| 138 | const root = workingDir.replaceAll("/", "\\").replace(/\\+$/, ""); |
| 139 | const excluded = options.excludedPatterns |
| 140 | .filter((pattern) => !pattern.includes("/")) |
| 141 | .map((pattern) => pattern.toLowerCase()); |
| 142 | const relative = stdout |
| 143 | .split(/\r?\n/) |
| 144 | .map((line) => line.trim()) |
| 145 | .filter(Boolean) |
| 146 | .map((line) => |
| 147 | line.toLowerCase().startsWith(`${root.toLowerCase()}\\`) |
| 148 | ? line.slice(root.length + 1) |
| 149 | : line, |
| 150 | ) |
| 151 | .map((line) => line.replace(/\\/g, "/")) |
| 152 | .filter((line) => { |
| 153 | const dirs = line.toLowerCase().split("/").slice(0, -1); |
| 154 | return !dirs.some((dir) => excluded.includes(dir)); |
| 155 | }); |
| 156 | return parseWorkspaceFileList(relative.join("\n"), options.maxFiles); |
| 157 | } |
no test coverage detected