(input: { url: URL; remote: string })
| 121 | } |
| 122 | |
| 123 | function buildFileReference(input: { url: URL; remote: string }) { |
| 124 | const filePath = path.normalize(fileURLToPath(input.url)) |
| 125 | const segments = filePath.split(/[\\/]+/).filter(Boolean) |
| 126 | if (!segments.length) return null |
| 127 | return { |
| 128 | host: "file", |
| 129 | path: filePath, |
| 130 | segments: segments.map((segment) => segment.replace(/:$/, "")), |
| 131 | owner: undefined, |
| 132 | repo: trimGitSuffix(segments[segments.length - 1]), |
| 133 | remote: input.remote, |
| 134 | label: filePath, |
| 135 | protocol: "file:", |
| 136 | } satisfies FileReference |
| 137 | } |
| 138 | |
| 139 | export function parseRepositoryReference(input: string) { |
| 140 | const cleaned = normalizeRepositoryInput(input) |
no test coverage detected