(...paths: string[])
| 85 | } |
| 86 | |
| 87 | export function resolve(...paths: string[]): string { |
| 88 | let parts: string[] = []; |
| 89 | let isAbsoluteResult = false; |
| 90 | for (const path of paths) { |
| 91 | if (isAbsolute(path)) { |
| 92 | parts = path.split(ANY_SLASH_REGEX); |
| 93 | isAbsoluteResult = true; |
| 94 | } else { |
| 95 | parts.push(...path.split(ANY_SLASH_REGEX)); |
| 96 | } |
| 97 | } |
| 98 | const normalized = normalizePathSegments(parts, isAbsoluteResult); |
| 99 | if (!isAbsoluteResult) return normalized || '/'; |
| 100 | // Windows absolute paths (e.g. "C:/path") must not get a leading "/" prepended. |
| 101 | // Unix absolute paths must start with "/". |
| 102 | return /^[A-Za-z]:/.test(normalized) ? normalized : '/' + normalized; |
| 103 | } |
| 104 | |
| 105 | // Used for running the browser build locally in Vite |
| 106 | export const win32 = {}; |
no test coverage detected
searching dependent graphs…