@@ -108,6 +108,7 @@ function transformPackument(pkg: Packument, requestedVersion?: string | null): S
108108 }
109109}
110110
111+ /** @public */
111112export function usePackage (
112113 name : MaybeRefOrGetter < string > ,
113114 requestedVersion ?: MaybeRefOrGetter < string | null > ,
@@ -147,6 +148,7 @@ function getResolvedVersion(pkg: SlimPackument, reqVer?: string | null): string
147148 return resolved
148149}
149150
151+ /** @public */
150152export function usePackageDownloads (
151153 name : MaybeRefOrGetter < string > ,
152154 period : MaybeRefOrGetter < 'last-day' | 'last-week' | 'last-month' | 'last-year' > = 'last-week' ,
@@ -174,6 +176,7 @@ type NpmDownloadsRangeResponse = {
174176/**
175177 * Fetch download range data from npm API.
176178 * Exported for external use (e.g., in components).
179+ * @public
177180 */
178181export async function fetchNpmDownloadsRange (
179182 packageName : string ,
@@ -186,48 +189,13 @@ export async function fetchNpmDownloadsRange(
186189 )
187190}
188191
189- export function usePackageWeeklyDownloadEvolution (
190- name : MaybeRefOrGetter < string > ,
191- options : MaybeRefOrGetter < {
192- weeks ?: number
193- endDate ?: string
194- } > = { } ,
195- ) {
196- const cachedFetch = useCachedFetch ( )
197-
198- return useLazyAsyncData (
199- ( ) => `downloads-weekly-evolution:${ toValue ( name ) } :${ JSON . stringify ( toValue ( options ) ) } ` ,
200- async ( ) => {
201- const packageName = toValue ( name )
202- const { weeks = 12 , endDate } = toValue ( options ) ?? { }
203-
204- const today = new Date ( )
205- const yesterday = new Date (
206- Date . UTC ( today . getUTCFullYear ( ) , today . getUTCMonth ( ) , today . getUTCDate ( ) - 1 ) ,
207- )
208-
209- const end = endDate ? new Date ( `${ endDate } T00:00:00.000Z` ) : yesterday
210-
211- const start = addDays ( end , - ( weeks * 7 ) + 1 )
212- const startIso = toIsoDateString ( start )
213- const endIso = toIsoDateString ( end )
214-
215- const encodedName = encodePackageName ( packageName )
216- const range = await cachedFetch < NpmDownloadsRangeResponse > (
217- `${ NPM_API } /downloads/range/${ startIso } :${ endIso } /${ encodedName } ` ,
218- )
219- const sortedDaily = [ ...range . downloads ] . sort ( ( a , b ) => a . day . localeCompare ( b . day ) )
220- return buildWeeklyEvolutionFromDaily ( sortedDaily )
221- } ,
222- )
223- }
224-
225192const emptySearchResponse = {
226193 objects : [ ] ,
227194 total : 0 ,
228195 time : new Date ( ) . toISOString ( ) ,
229196} satisfies NpmSearchResponse
230197
198+ /** @public */
231199export function useNpmSearch (
232200 query : MaybeRefOrGetter < string > ,
233201 options : MaybeRefOrGetter < {
@@ -305,6 +273,7 @@ function packumentToSearchResult(pkg: MinimalPackument): NpmSearchResult {
305273/**
306274 * Fetch all packages for an npm organization
307275 * Returns search-result-like objects for compatibility with PackageList
276+ * @public
308277 */
309278export function useOrgPackages ( orgName : MaybeRefOrGetter < string > ) {
310279 const cachedFetch = useCachedFetch ( )
@@ -418,35 +387,6 @@ export async function fetchAllPackageVersions(packageName: string): Promise<Pack
418387 return promise
419388}
420389
421- /**
422- * Composable to fetch all versions of a package.
423- * Uses SWR caching on the server.
424- */
425- export function useAllPackageVersions ( packageName : MaybeRefOrGetter < string > ) {
426- const cachedFetch = useCachedFetch ( )
427-
428- return useLazyAsyncData (
429- ( ) => `all-versions:${ toValue ( packageName ) } ` ,
430- async ( ) => {
431- const encodedName = encodePackageName ( toValue ( packageName ) )
432- const data = await cachedFetch < {
433- versions : Record < string , { deprecated ?: string } >
434- time : Record < string , string >
435- } > ( `${ NPM_REGISTRY } /${ encodedName } ` )
436-
437- return Object . entries ( data . versions )
438- . filter ( ( [ v ] ) => data . time [ v ] )
439- . map ( ( [ version , versionData ] ) => ( {
440- version,
441- time : data . time [ version ] ,
442- hasProvenance : false , // Would need to check dist.attestations for each version
443- deprecated : versionData . deprecated ,
444- } ) )
445- . sort ( ( a , b ) => compare ( b . version , a . version ) ) as PackageVersionInfo [ ]
446- } ,
447- )
448- }
449-
450390// ============================================================================
451391// Outdated Dependencies
452392// ============================================================================
@@ -567,6 +507,7 @@ async function checkDependencyOutdated(
567507/**
568508 * Composable to check for outdated dependencies.
569509 * Returns a reactive map of dependency name to outdated info.
510+ * @public
570511 */
571512export function useOutdatedDependencies (
572513 dependencies : MaybeRefOrGetter < Record < string , string > | undefined > ,
@@ -616,6 +557,7 @@ export function useOutdatedDependencies(
616557
617558/**
618559 * Get tooltip text for an outdated dependency
560+ * @public
619561 */
620562export function getOutdatedTooltip ( info : OutdatedDependencyInfo ) : string {
621563 if ( info . majorsBehind > 0 ) {
@@ -631,6 +573,7 @@ export function getOutdatedTooltip(info: OutdatedDependencyInfo): string {
631573
632574/**
633575 * Get CSS class for a dependency version based on outdated status
576+ * @public
634577 */
635578export function getVersionClass ( info : OutdatedDependencyInfo | undefined ) : string {
636579 if ( ! info ) return 'text-fg-subtle'
0 commit comments