11<script setup lang="ts">
2- import type { PackageVersionInfo , PackumentVersion } from ' #shared/types'
2+ import type { PackageVersionInfo , SlimVersion } from ' #shared/types'
33import { compare } from ' semver'
44import type { RouteLocationRaw } from ' vue-router'
55import { fetchAllPackageVersions } from ' ~/composables/useNpmRegistry'
@@ -14,7 +14,7 @@ import {
1414
1515const props = defineProps <{
1616 packageName: string
17- versions: Record <string , PackumentVersion >
17+ versions: Record <string , SlimVersion >
1818 distTags: Record <string , string >
1919 time: Record <string , string >
2020}>()
@@ -31,13 +31,6 @@ interface VersionDisplay {
3131 deprecated? : string
3232}
3333
34- // Check if a version has provenance/attestations
35- function hasProvenance(version : PackumentVersion | undefined ): boolean {
36- if (! version ?.dist ) return false
37- const dist = version .dist as { attestations? : unknown }
38- return !! dist .attestations
39- }
40-
4134// Build route object for package version link
4235function versionRoute(version : string ): RouteLocationRaw {
4336 return {
@@ -53,10 +46,7 @@ const versionToTags = computed(() => buildVersionToTagsMap(props.distTags))
5346// Deduplicates so each version appears only once, with all its tags
5447const allTagRows = computed (() => {
5548 // Group tags by version with their metadata
56- const versionMap = new Map <
57- string ,
58- { tags : string []; versionData : PackumentVersion | undefined }
59- > ()
49+ const versionMap = new Map <string , { tags: string []; versionData: SlimVersion | undefined }>()
6050 for (const [tag, version] of Object .entries (props .distTags )) {
6151 const existing = versionMap .get (version )
6252 if (existing ) {
@@ -88,7 +78,7 @@ const allTagRows = computed(() => {
8878 version ,
8979 time: props .time [version ],
9080 tags ,
91- hasProvenance: hasProvenance ( versionData ) ,
81+ hasProvenance: versionData ?. hasProvenance ,
9282 deprecated: versionData ?.deprecated ,
9383 } as VersionDisplay ,
9484 }))
0 commit comments