@@ -7,6 +7,7 @@ const { t } = useI18n()
77const props = defineProps <{
88 packageName: string
99 version: string
10+ packageSize? : InstallSizeResult | null
1011 dependencies? : Record <string , string >
1112 peerDependencies? : Record <string , string >
1213 peerDependenciesMeta? : Record <string , { optional? : boolean }>
@@ -37,6 +38,11 @@ function getDeprecatedDepInfo(depName: string) {
3738 return vulnTree .value .deprecatedPackages .find (p => p .name === depName && p .depth === ' direct' )
3839}
3940
41+ // Get dependency size (only direct deps)
42+ function getSizeDepInfo(depName : string ) {
43+ return props .packageSize ?.dependencies ?.find (p => p .name === depName )?.size ?? null
44+ }
45+
4046// Sort dependencies alphabetically
4147const sortedDependencies = computed (() => {
4248 if (! props .dependencies ) return []
@@ -103,6 +109,7 @@ const {
103109} = useVisibleItems (sortedOptionalDependencies , 10 )
104110
105111const numberFormatter = useNumberFormatter ()
112+ const bytesFormatter = useBytesFormatter ()
106113 </script >
107114
108115<template >
@@ -189,6 +196,28 @@ const numberFormatter = useNumberFormatter()
189196 >
190197 {{ version }}
191198 </LinkBase >
199+ <TooltipApp
200+ v-if =" getSizeDepInfo(dep)"
201+ class =" shrink-0"
202+ :class =" getVersionClass(undefined)"
203+ :text ="
204+ $t('package.stats.size_tooltip.unpacked', {
205+ size: bytesFormatter.format(getSizeDepInfo(dep)!),
206+ })
207+ "
208+ >
209+ <button
210+ type =" button"
211+ class =" inline-flex items-center justify-center p-2 -m-2"
212+ :aria-label ="
213+ $t('package.stats.size_tooltip.unpacked', {
214+ size: bytesFormatter.format(getSizeDepInfo(dep)!),
215+ })
216+ "
217+ >
218+ <span class =" i-lucide:info w-3 h-3" aria-hidden =" true" />
219+ </button >
220+ </TooltipApp >
192221 <span v-if =" outdatedDeps[dep]" class =" sr-only" >
193222 ({{ getOutdatedTooltip(outdatedDeps[dep], $t) }})
194223 </span >
0 commit comments