| 1264 | } |
| 1265 | |
| 1266 | function getGlobBaseDirectory(filePath: string): string { |
| 1267 | const globMatch = filePath.match(GLOB_PATTERN_REGEX) |
| 1268 | if (!globMatch || globMatch.index === undefined) { |
| 1269 | return filePath |
| 1270 | } |
| 1271 | const beforeGlob = filePath.substring(0, globMatch.index) |
| 1272 | const lastSepIndex = Math.max( |
| 1273 | beforeGlob.lastIndexOf('/'), |
| 1274 | beforeGlob.lastIndexOf('\\'), |
| 1275 | ) |
| 1276 | if (lastSepIndex === -1) return '.' |
| 1277 | return beforeGlob.substring(0, lastSepIndex + 1) || '/' |
| 1278 | } |
| 1279 | |
| 1280 | /** |
| 1281 | * Element types that are safe to extract as literal path strings. |