@@ -8,7 +8,7 @@ import type {
88import { encodePackageName } from '#shared/utils/npm'
99import type { PackageAnalysisResponse } from './usePackageAnalysis'
1010import { isBinaryOnlyPackage } from '#shared/utils/binary-detection'
11- import { getDependencyCount } from '~/utils/npm/common '
11+ import { getDependencyCount } from '~/utils/npm/dependency-count '
1212
1313export interface PackageComparisonData {
1414 package : ComparisonPackage
@@ -114,6 +114,7 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
114114 ] )
115115
116116 const pkg = usePackage ( name , latestVersion )
117+ const requestedVersion = pkg . data . value ?. requestedVersion
117118
118119 const versionData = pkgData . versions [ latestVersion ]
119120 const packageSize = versionData ?. dist ?. unpackedSize
@@ -145,7 +146,7 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
145146 } ,
146147 downloads : downloads ?. downloads ,
147148 packageSize,
148- directDeps : getDependencyCount ( pkg . data . value ?. requestedVersion ?? null ) ,
149+ directDeps : getDependencyCount ( requestedVersion ?? null ) ,
149150 installSize : undefined , // Will be filled in second pass
150151 analysis : analysis ?? undefined ,
151152 vulnerabilities : {
@@ -367,11 +368,12 @@ function computeFacetValue(
367368 }
368369
369370 case 'dependencies' :
371+ if ( ! data . directDeps ) return null
370372 const depCount = data . directDeps
371373 return {
372374 raw : depCount ,
373375 display : String ( depCount ) ,
374- status : depCount > 50 ? 'warning' : 'neutral' ,
376+ status : depCount > 10 ? 'warning' : 'neutral' ,
375377 }
376378
377379 case 'deprecated' :
0 commit comments