Skip to content

Commit b6d27e2

Browse files
committed
refactor: use /package/ and /org prefixes by default
1 parent bfc5a57 commit b6d27e2

27 files changed

+148
-197
lines changed

app/components/Compare/ComparisonGrid.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function getReplacementTooltip(col: ComparisonGridColumn): string {
4545
>
4646
<span class="inline-flex items-center gap-1.5 truncate">
4747
<NuxtLink
48-
:to="{ name: 'package', params: { package: [col.header] } }"
48+
:to="packageRoute(col.header)"
4949
class="link-subtle font-mono text-sm font-medium text-fg truncate"
5050
:title="col.header"
5151
>

app/components/Compare/PackageSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function handleBlur() {
106106
</template>
107107
<NuxtLink
108108
v-else
109-
:to="{ name: 'package', params: { package: [pkg] } }"
109+
:to="packageRoute(pkg)"
110110
class="font-mono text-sm text-fg hover:text-accent transition-colors"
111111
>
112112
{{ pkg }}

app/components/DependencyPathPopup.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,12 @@ function parsePackageString(pkg: string): { name: string; version: string } {
9393
>
9494
<span v-if="idx > 0" class="text-fg-subtle me-1">└─</span>
9595
<NuxtLink
96-
:to="{
97-
name: 'package',
98-
params: {
99-
package: [
100-
...parsePackageString(pathItem).name.split('/'),
101-
'v',
102-
parsePackageString(pathItem).version,
103-
],
104-
},
105-
}"
96+
:to="
97+
packageRoute(
98+
parsePackageString(pathItem).name,
99+
parsePackageString(pathItem).version,
100+
)
101+
"
106102
class="hover:underline"
107103
:class="idx === path.length - 1 ? 'text-fg font-medium' : 'text-fg-muted'"
108104
@click="closePopup"

app/components/Header/PackagesDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function handleKeydown(event: KeyboardEvent) {
9494
<ul v-else-if="packages.length > 0" class="py-1 max-h-80 overflow-y-auto">
9595
<li v-for="pkg in packages" :key="pkg">
9696
<NuxtLink
97-
:to="{ name: 'package', params: { package: [pkg] } }"
97+
:to="packageRoute(pkg)"
9898
class="block px-3 py-2 font-mono text-sm text-fg hover:bg-bg-subtle transition-colors truncate"
9999
>
100100
{{ pkg }}

app/components/Package/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const pkgDescription = useMarkdown(() => ({
4444
class="font-mono text-sm sm:text-base font-medium text-fg group-hover:text-fg transition-colors duration-200 min-w-0 break-all"
4545
>
4646
<NuxtLink
47-
:to="{ name: 'package', params: { package: result.package.name.split('/') } }"
47+
:to="packageRoute(result.package.name)"
4848
:prefetch-on="prefetch ? 'visibility' : 'interaction'"
4949
class="decoration-none scroll-mt-48 scroll-mb-6 after:content-[''] after:absolute after:inset-0"
5050
:data-result-index="index"

app/components/Package/ClaimPackageModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const previewPackageJson = computed(() => {
173173

174174
<div class="flex gap-3">
175175
<NuxtLink
176-
:to="{ name: 'package', params: { package: [packageName] } }"
176+
:to="packageRoute(packageName)"
177177
class="flex-1 px-4 py-2 font-mono text-sm text-center text-bg bg-fg rounded-md transition-colors duration-200 hover:bg-fg/90 focus-visible:outline-accent/70"
178178
@click="close"
179179
>
@@ -277,7 +277,7 @@ const previewPackageJson = computed(() => {
277277
<span v-else class="w-4 h-4 shrink-0" />
278278
<div class="min-w-0">
279279
<NuxtLink
280-
:to="{ name: 'package', params: { package: [pkg.name] } }"
280+
:to="packageRoute(pkg.name)"
281281
class="font-mono text-sm text-fg hover:underline focus-visible:outline-accent/70 rounded"
282282
target="_blank"
283283
>

app/components/Package/Dependencies.vue

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const sortedOptionalDependencies = computed(() => {
8282
class="flex items-center justify-between py-1 text-sm gap-2"
8383
>
8484
<NuxtLink
85-
:to="{ name: 'package', params: { package: dep.split('/') } }"
85+
:to="packageRoute(dep)"
8686
class="font-mono text-fg-muted hover:text-fg transition-colors duration-200 truncate min-w-0 flex-1"
8787
>
8888
{{ dep }}
@@ -99,10 +99,7 @@ const sortedOptionalDependencies = computed(() => {
9999
</span>
100100
<NuxtLink
101101
v-if="getVulnerableDepInfo(dep)"
102-
:to="{
103-
name: 'package',
104-
params: { package: [...dep.split('/'), 'v', getVulnerableDepInfo(dep)!.version] },
105-
}"
102+
:to="packageRoute(dep, getVulnerableDepInfo(dep)!.version)"
106103
class="shrink-0"
107104
:class="SEVERITY_TEXT_COLORS[getHighestSeverity(getVulnerableDepInfo(dep)!.counts)]"
108105
:title="`${getVulnerableDepInfo(dep)!.counts.total} vulnerabilities`"
@@ -112,21 +109,15 @@ const sortedOptionalDependencies = computed(() => {
112109
</NuxtLink>
113110
<NuxtLink
114111
v-if="getDeprecatedDepInfo(dep)"
115-
:to="{
116-
name: 'package',
117-
params: { package: [...dep.split('/'), 'v', getDeprecatedDepInfo(dep)!.version] },
118-
}"
112+
:to="packageRoute(dep, getDeprecatedDepInfo(dep)!.version)"
119113
class="shrink-0 text-purple-500"
120114
:title="getDeprecatedDepInfo(dep)!.message"
121115
>
122116
<span class="i-carbon-warning-hex w-3 h-3" aria-hidden="true" />
123117
<span class="sr-only">{{ $t('package.deprecated.label') }}</span>
124118
</NuxtLink>
125119
<NuxtLink
126-
:to="{
127-
name: 'package',
128-
params: { package: [...dep.split('/'), 'v', version] },
129-
}"
120+
:to="packageRoute(dep, version)"
130121
class="font-mono text-xs text-end truncate"
131122
:class="getVersionClass(outdatedDeps[dep])"
132123
:title="outdatedDeps[dep] ? getOutdatedTooltip(outdatedDeps[dep], $t) : version"
@@ -174,10 +165,7 @@ const sortedOptionalDependencies = computed(() => {
174165
>
175166
<div class="flex items-center gap-1 min-w-0 flex-1">
176167
<NuxtLink
177-
:to="{
178-
name: 'package',
179-
params: { package: peer.name.split('/') },
180-
}"
168+
:to="packageRoute(peer.name)"
181169
class="font-mono text-fg-muted hover:text-fg transition-colors duration-200 truncate"
182170
>
183171
{{ peer.name }}
@@ -191,10 +179,7 @@ const sortedOptionalDependencies = computed(() => {
191179
</span>
192180
</div>
193181
<NuxtLink
194-
:to="{
195-
name: 'package',
196-
params: { package: [...peer.name.split('/'), 'v', peer.version] },
197-
}"
182+
:to="packageRoute(peer.name, peer.version)"
198183
class="font-mono text-xs text-fg-subtle max-w-[40%] truncate"
199184
:title="peer.version"
200185
>
@@ -239,16 +224,13 @@ const sortedOptionalDependencies = computed(() => {
239224
class="flex items-center justify-between py-1 text-sm gap-2"
240225
>
241226
<NuxtLink
242-
:to="{ name: 'package', params: { package: dep.split('/') } }"
227+
:to="packageRoute(dep)"
243228
class="font-mono text-fg-muted hover:text-fg transition-colors duration-200 truncate min-w-0 flex-1"
244229
>
245230
{{ dep }}
246231
</NuxtLink>
247232
<NuxtLink
248-
:to="{
249-
name: 'package',
250-
params: { package: [...dep.split('/'), 'v', version] },
251-
}"
233+
:to="packageRoute(dep, version)"
252234
class="font-mono text-xs text-fg-subtle max-w-[40%] text-end truncate"
253235
:title="version"
254236
>

app/components/Package/DeprecatedTree.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ function getDepthStyle(depth: DependencyDepth) {
8484
<DependencyPathPopup v-if="pkg.path && pkg.path.length > 1" :path="pkg.path" />
8585

8686
<NuxtLink
87-
:to="{
88-
name: 'package',
89-
params: { package: [...pkg.name.split('/'), 'v', pkg.version] },
90-
}"
87+
:to="packageRoute(pkg.name, pkg.version)"
9188
class="font-mono text-sm font-medium hover:underline truncate py-4"
9289
:class="getDepthStyle(pkg.depth).text"
9390
>

app/components/Package/InstallScripts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const isExpanded = shallowRef(false)
7373
class="flex items-center justify-between py-0.5 text-sm gap-2"
7474
>
7575
<NuxtLink
76-
:to="{ name: 'package', params: { package: dep.split('/') } }"
76+
:to="packageRoute(dep)"
7777
class="font-mono text-fg-muted hover:text-fg transition-colors duration-200 truncate min-w-0"
7878
>
7979
{{ dep }}

app/components/Package/TableRow.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function isColumnVisible(id: string): boolean {
3434
return props.columns.find(c => c.id === id)?.visible ?? false
3535
}
3636
37-
const packageUrl = computed(() => `/package/${pkg.value.name}`)
37+
const packageUrl = computed(() => packageRoute(pkg.value.name))
3838
3939
const allMaintainersText = computed(() => {
4040
if (!pkg.value.maintainers?.length) return ''

0 commit comments

Comments
 (0)