Skip to content
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ab61f5a
feat(search): show package link for invalid query length
MatteoGabriele Feb 2, 2026
6562338
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 2, 2026
ba044c9
refactor: move block next to no results found
MatteoGabriele Feb 2, 2026
7c5726b
Merge branch 'feat/invalid-query-length-message' of https://github.co…
MatteoGabriele Feb 2, 2026
d266f98
refactor: remove margin
MatteoGabriele Feb 2, 2026
e4e478e
refactor: use different hover state
MatteoGabriele Feb 2, 2026
64031f8
refactor: display package as a single search result
MatteoGabriele Feb 2, 2026
c17eb9c
Merge branch 'main' into feat/invalid-query-length-message
MatteoGabriele Feb 2, 2026
74f156c
refactor: remove unused copy
MatteoGabriele Feb 2, 2026
58d129c
Merge branch 'feat/invalid-query-length-message' of https://github.co…
MatteoGabriele Feb 2, 2026
2285e68
refactor: move check to useNpmSearch
MatteoGabriele Feb 2, 2026
df5b466
chore: delete unused component
MatteoGabriele Feb 2, 2026
c768c33
chore: delete unused composable
MatteoGabriele Feb 2, 2026
aafdc8f
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 2, 2026
d338167
refactor: return package response
MatteoGabriele Feb 2, 2026
16bbda3
Merge branch 'feat/invalid-query-length-message' of https://github.co…
MatteoGabriele Feb 2, 2026
b7db8e0
Merge branch 'main' into feat/invalid-query-length-message
MatteoGabriele Feb 2, 2026
8232384
fix: return search response
MatteoGabriele Feb 2, 2026
27f557f
Merge branch 'main' into feat/invalid-query-length-message
MatteoGabriele Feb 2, 2026
bf908d3
refactor: avoid search call with 1 letter
MatteoGabriele Feb 2, 2026
d667bae
Merge branch 'main' into feat/invalid-query-length-message
MatteoGabriele Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/composables/useNpmRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export function useNpmSearch(
() => `search:incremental:${toValue(query)}`,
async (_nuxtApp, { signal }) => {
const q = toValue(query)

if (!q.trim()) {
return emptySearchResponse
}
Expand All @@ -321,6 +322,35 @@ export function useNpmSearch(
// Use requested size for initial fetch
params.set('size', String(opts.size ?? 25))

if (q.length === 1) {
const encodedName = encodePackageName(q)
const [{ data: pkg, isStale }, { data: downloads }] = await Promise.all([
cachedFetch<Packument>(`${NPM_REGISTRY}/${encodedName}`, { signal }),
cachedFetch<NpmDownloadCount>(`${NPM_API}/downloads/point/last-week/${encodedName}`, {
signal,
}),
])

if (!pkg) {
return emptySearchResponse
}

const result = packumentToSearchResult(pkg, downloads?.downloads)

cache.value = {
query: q,
objects: [result],
total: 1,
}

return {
objects: [result],
total: 1,
isStale,
time: new Date().toISOString(),
}
}

const { data: response, isStale } = await cachedFetch<NpmSearchResponse>(
`${NPM_REGISTRY}/-/v1/search?${params.toString()}`,
{ signal },
Expand Down
Loading