|
2 | 2 | import type { JsrPackageInfo } from '#shared/types/jsr' |
3 | 3 | import type { IconClass } from '~/types' |
4 | 4 | import { assertValidPackageName } from '#shared/utils/npm' |
5 | | -import { joinURL } from 'ufo' |
6 | 5 | import { areUrlsEquivalent } from '#shared/utils/url' |
7 | 6 | import { getDependencyCount } from '~/utils/npm/dependency-count' |
8 | 7 | import { detectPublishSecurityDowngradeForVersion } from '~/utils/publish-security' |
@@ -389,16 +388,7 @@ const totalDepsCount = computed(() => { |
389 | 388 | return null |
390 | 389 | }) |
391 | 390 |
|
392 | | -const repositoryUrl = computed(() => { |
393 | | - const repo = displayVersion.value?.repository |
394 | | - if (!repo?.url) return null |
395 | | - let url = normalizeGitUrl(repo.url) |
396 | | - // append `repository.directory` for monorepo packages |
397 | | - if (repo.directory) { |
398 | | - url = joinURL(`${url}/tree/HEAD`, repo.directory) |
399 | | - } |
400 | | - return url |
401 | | -}) |
| 391 | +const { repositoryUrl } = useRepositoryUrl(displayVersion) |
402 | 392 |
|
403 | 393 | const { meta: repoMeta, repoRef, stars, starsLink, forks, forksLink } = useRepoMeta(repositoryUrl) |
404 | 394 |
|
@@ -444,15 +434,6 @@ const fundingUrl = computed(() => { |
444 | 434 | return typeof funding === 'string' ? funding : funding.url |
445 | 435 | }) |
446 | 436 |
|
447 | | -function normalizeGitUrl(url: string): string { |
448 | | - return url |
449 | | - .replace(/^git\+/, '') |
450 | | - .replace(/^git:\/\//, 'https://') |
451 | | - .replace(/\.git$/, '') |
452 | | - .replace(/^ssh:\/\/git@github\.com/, 'https://github.com') |
453 | | - .replace(/^git@github\.com:/, 'https://github.com/') |
454 | | -} |
455 | | -
|
456 | 437 | // Check if a version has provenance/attestations |
457 | 438 | // The dist object may have attestations that aren't in the base type |
458 | 439 | function hasProvenance(version: PackumentVersion | null): boolean { |
|
0 commit comments