Skip to content

Commit fe73494

Browse files
committed
Merge remote-tracking branch 'origin/main' into perf/fast-latest-version
2 parents 5ef661a + 0df32a3 commit fe73494

21 files changed

Lines changed: 2369 additions & 285 deletions

File tree

app/components/Package/DownloadAnalytics.vue

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,9 @@ const rootEl = shallowRef<HTMLElement | null>(null)
1919
2020
const { width } = useElementSize(rootEl)
2121
22-
const chartKey = ref(0)
23-
24-
let chartRemountTimeoutId: ReturnType<typeof setTimeout> | null = null
25-
2622
onMounted(() => {
2723
rootEl.value = document.documentElement
2824
resolvedMode.value = colorMode.value === 'dark' ? 'dark' : 'light'
29-
30-
// If the chart is painted too early, built-in auto-sizing does not adapt to the final container size
31-
chartRemountTimeoutId = setTimeout(() => {
32-
chartKey.value += 1
33-
chartRemountTimeoutId = null
34-
}, 10)
35-
})
36-
37-
onBeforeUnmount(() => {
38-
if (chartRemountTimeoutId !== null) {
39-
clearTimeout(chartRemountTimeoutId)
40-
chartRemountTimeoutId = null
41-
}
4225
})
4326
4427
const { colors } = useCssVariables(
@@ -705,12 +688,7 @@ const config = computed(() => {
705688
</div>
706689

707690
<ClientOnly v-if="inModal && chartData.dataset">
708-
<VueUiXy
709-
:dataset="chartData.dataset"
710-
:config="config"
711-
class="[direction:ltr]"
712-
:key="chartKey"
713-
>
691+
<VueUiXy :dataset="chartData.dataset" :config="config" class="[direction:ltr]">
714692
<template #menuIcon="{ isOpen }">
715693
<span v-if="isOpen" class="i-carbon:close w-6 h-6" aria-hidden="true" />
716694
<span v-else class="i-carbon:overflow-menu-vertical w-6 h-6" aria-hidden="true" />

app/components/Readme.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defineProps<{
55
</script>
66

77
<template>
8-
<article class="readme prose prose-invert max-w-[70ch]" v-html="html" />
8+
<article class="readme prose prose-invert max-w-[70ch] lg:max-w-none" v-html="html" />
99
</template>
1010

1111
<style scoped>

app/composables/useNpmRegistry.ts

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010
} from '#shared/types'
1111
import type { PackageVersionsInfoWithMetadata } from 'fast-npm-meta'
1212
import type { ReleaseType } from 'semver'
13+
import { mapWithConcurrency } from '#shared/utils/async'
1314
import { maxSatisfying, prerelease, major, minor, diff, gt, compare } from 'semver'
1415
import { isExactVersion } from '~/utils/versions'
1516
import { extractInstallScriptsInfo } from '~/utils/install-scripts'
@@ -537,34 +538,28 @@ export function useOrgPackages(orgName: MaybeRefOrGetter<string>) {
537538

538539
// Fetch packuments and downloads in parallel
539540
const [packuments, downloads] = await Promise.all([
540-
// Fetch packuments in parallel (with concurrency limit)
541+
// Fetch packuments with concurrency limit
541542
(async () => {
542-
const concurrency = 10
543-
const results: MinimalPackument[] = []
544-
for (let i = 0; i < packageNames.length; i += concurrency) {
545-
const batch = packageNames.slice(i, i + concurrency)
546-
const batchResults = await Promise.all(
547-
batch.map(async name => {
548-
try {
549-
const encoded = encodePackageName(name)
550-
const { data: pkg } = await cachedFetch<MinimalPackument>(
551-
`${NPM_REGISTRY}/${encoded}`,
552-
{ signal },
553-
)
554-
return pkg
555-
} catch {
556-
return null
557-
}
558-
}),
559-
)
560-
for (const pkg of batchResults) {
561-
// Filter out any unpublished packages (missing dist-tags)
562-
if (pkg && pkg['dist-tags']) {
563-
results.push(pkg)
543+
const results = await mapWithConcurrency(
544+
packageNames,
545+
async name => {
546+
try {
547+
const encoded = encodePackageName(name)
548+
const { data: pkg } = await cachedFetch<MinimalPackument>(
549+
`${NPM_REGISTRY}/${encoded}`,
550+
{ signal },
551+
)
552+
return pkg
553+
} catch {
554+
return null
564555
}
565-
}
566-
}
567-
return results
556+
},
557+
10,
558+
)
559+
// Filter out any unpublished packages (missing dist-tags)
560+
return results.filter(
561+
(pkg): pkg is MinimalPackument => pkg !== null && !!pkg['dist-tags'],
562+
)
568563
})(),
569564
// Fetch downloads in bulk
570565
fetchBulkDownloads(packageNames, { signal }),
@@ -762,23 +757,20 @@ export function useOutdatedDependencies(
762757
return
763758
}
764759

765-
const results: Record<string, OutdatedDependencyInfo> = {}
766760
const entries = Object.entries(deps)
767-
const batchSize = 5
768-
769-
for (let i = 0; i < entries.length; i += batchSize) {
770-
const batch = entries.slice(i, i + batchSize)
771-
const batchResults = await Promise.all(
772-
batch.map(async ([name, constraint]) => {
773-
const info = await checkDependencyOutdated(cachedFetch, name, constraint)
774-
return [name, info] as const
775-
}),
776-
)
761+
const batchResults = await mapWithConcurrency(
762+
entries,
763+
async ([name, constraint]) => {
764+
const info = await checkDependencyOutdated(cachedFetch, name, constraint)
765+
return [name, info] as const
766+
},
767+
5,
768+
)
777769

778-
for (const [name, info] of batchResults) {
779-
if (info) {
780-
results[name] = info
781-
}
770+
const results: Record<string, OutdatedDependencyInfo> = {}
771+
for (const [name, info] of batchResults) {
772+
if (info) {
773+
results[name] = info
782774
}
783775
}
784776

app/pages/about.vue

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,23 @@ const { data: contributors, status: contributorsStatus } = useFetch<GitHubContri
189189
target="_blank"
190190
rel="noopener noreferrer"
191191
class="group relative"
192-
:title="$t('about.contributors.view_profile', { name: contributor.login })"
192+
:aria-label="$t('about.contributors.view_profile', { name: contributor.login })"
193193
>
194-
<img
195-
:src="`${contributor.avatar_url}&s=64`"
196-
:alt="contributor.login"
197-
width="32"
198-
height="32"
199-
class="w-8 h-8 rounded-full ring-2 ring-transparent group-hover:ring-accent transition-all duration-200"
200-
loading="lazy"
201-
/>
194+
<div class="relative flex items-center">
195+
<img
196+
:src="`${contributor.avatar_url}&s=64`"
197+
:alt="contributor.login"
198+
width="32"
199+
height="32"
200+
class="w-12 h-12 rounded-lg ring-2 ring-transparent group-hover:ring-accent transition-all duration-200 ease-out hover:scale-125 will-change-transform"
201+
loading="lazy"
202+
/>
203+
<span
204+
class="pointer-events-none absolute -top-9 inset-is-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900 text-xs px-2 py-1 shadow-lg opacity-0 scale-95 transition-all duration-150 group-hover:opacity-100 group-hover:scale-100"
205+
>
206+
@{{ contributor.login }}
207+
</span>
208+
</div>
202209
</a>
203210
</div>
204211
</div>

app/pages/settings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const setLocale: typeof setNuxti18nLocale = locale => {
131131
<div class="space-y-2">
132132
<SettingsToggle
133133
:label="$t('settings.hide_platform_packages')"
134-
:description="$t('settings.hide_platform_packages')"
134+
:description="$t('settings.hide_platform_packages_description')"
135135
v-model="settings.hidePlatformPackages"
136136
/>
137137
</div>

config/i18n.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,16 @@ const locales: (LocaleObjectData | (Omit<LocaleObjectData, 'code'> & { code: str
211211
const name = new Intl.PluralRules('ru-RU').select(choice)
212212
return { zero: 2 /!* not used *!/, one: 0, two: 1 /!* not used *!/, few: 1, many: 2, other: 3 }[name]
213213
},
214+
},*/
215+
{
216+
code: 'cs-CZ',
217+
file: 'cs-CZ.json',
218+
name: 'Čeština',
219+
pluralRule: (choice: number) => {
220+
const name = new Intl.PluralRules('cs-CZ').select(choice)
221+
return { zero: 2, one: 0, two: 1, few: 1, many: 2, other: 2 }[name]
214222
},
215-
{
216-
code: 'cs-CZ',
217-
file: 'cs-CZ.json',
218-
name: 'Česky',
219-
},
223+
} /*
220224
{
221225
code: 'pl-PL',
222226
file: 'pl-PL.json',
@@ -258,7 +262,7 @@ const locales: (LocaleObjectData | (Omit<LocaleObjectData, 'code'> & { code: str
258262
code: 'ko-KR',
259263
file: 'ko-KR.json',
260264
name: '한국어',
261-
},*/
265+
},*/,
262266
{
263267
code: 'id-ID',
264268
file: 'id-ID.json',

0 commit comments

Comments
 (0)