File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,7 +307,8 @@ async function fetchOrgPackageNames(orgName: string): Promise<string[]> {
307307interface MinimalPackument {
308308 'name' : string
309309 'description' ?: string
310- 'dist-tags' : Record < string , string >
310+ // `dist-tags` can be missing in some later unpublished packages
311+ 'dist-tags' ?: Record < string , string >
311312 'time' : Record < string , string >
312313 'maintainers' ?: NpmPerson [ ]
313314}
@@ -333,7 +334,10 @@ async function fetchMinimalPackument(name: string): Promise<MinimalPackument | n
333334 * Convert packument to search result format for display
334335 */
335336function packumentToSearchResult ( pkg : MinimalPackument ) : NpmSearchResult {
336- const latestVersion = pkg [ 'dist-tags' ] . latest || Object . values ( pkg [ 'dist-tags' ] ) [ 0 ] || ''
337+ let latestVersion = ''
338+ if ( pkg [ 'dist-tags' ] ) {
339+ latestVersion = pkg [ 'dist-tags' ] . latest || Object . values ( pkg [ 'dist-tags' ] ) [ 0 ] || ''
340+ }
337341 const modified = pkg . time . modified || pkg . time [ latestVersion ] || ''
338342
339343 return {
@@ -382,7 +386,8 @@ export function useOrgPackages(orgName: MaybeRefOrGetter<string>) {
382386 const packuments = await Promise . all ( batch . map ( name => fetchMinimalPackument ( name ) ) )
383387
384388 for ( const pkg of packuments ) {
385- if ( pkg ) {
389+ // Filter out any unpublished packages (missing dist-tags)
390+ if ( pkg && pkg [ 'dist-tags' ] ) {
386391 results . push ( packumentToSearchResult ( pkg ) )
387392 }
388393 }
You can’t perform that action at this time.
0 commit comments