Skip to content

Commit b179ff4

Browse files
committed
feat: new routing schema - updated components and server utils
1 parent 1443037 commit b179ff4

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

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="`/${pkg}`"
97+
:to="`/package/${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/MetricsBadges.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const typesTooltip = computed(() => {
4545
const typesHref = computed(() => {
4646
if (!analysis.value) return null
4747
if (analysis.value.types?.kind === '@types') {
48-
return `/${analysis.value.types.packageName}`
48+
return `/package/${analysis.value.types.packageName}`
4949
}
5050
return null
5151
})

app/components/Package/SkillsModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const props = defineProps<{
88
}>()
99
1010
function getSkillSourceUrl(skill: SkillListItem): string {
11-
const base = `/code/${props.packageName}`
11+
const base = `/package-code/${props.packageName}`
1212
const versionPath = props.version ? `/v/${props.version}` : ''
1313
return `${base}${versionPath}/skills/${skill.dirName}/SKILL.md`
1414
}
@@ -101,7 +101,7 @@ function getWarningTooltip(skill: SkillListItem): string | undefined {
101101
</template>
102102
</i18n-t>
103103
<a
104-
href="/skills-npm"
104+
href="/package/skills-npm"
105105
class="inline-flex items-center gap-1 text-xs text-fg-subtle hover:text-fg transition-colors shrink-0"
106106
>
107107
{{ $t('package.skills.learn_more') }}

app/components/Terminal/Install.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const copyCreateCommand = () => copyCreate(getFullCreateCommand())
149149
></code
150150
>
151151
<NuxtLink
152-
:to="`/${typesPackageName}`"
152+
:to="`/package/${typesPackageName}`"
153153
class="text-fg-subtle hover:text-fg-muted text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
154154
:title="$t('package.get_started.view_types', { package: typesPackageName })"
155155
>
@@ -228,7 +228,7 @@ const copyCreateCommand = () => copyCreate(getFullCreateCommand())
228228
}}</span>
229229
</button>
230230
<NuxtLink
231-
:to="`/${createPackageInfo.packageName}`"
231+
:to="`/package/${createPackageInfo.packageName}`"
232232
class="text-fg-subtle hover:text-fg-muted text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
233233
:title="`View ${createPackageInfo.packageName}`"
234234
>

app/components/VersionSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ watch(
620620
<!-- Link to package page for full version list -->
621621
<div class="border-t border-border mt-1 pt-1 px-3 py-2">
622622
<NuxtLink
623-
:to="`/${packageName}`"
623+
:to="`/package/${packageName}`"
624624
class="text-xs text-fg-subtle hover:text-fg transition-[color] focus-visible:outline-none focus-visible:text-fg"
625625
@click="isOpen = false"
626626
>

app/components/compare/PackageSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function handleBlur() {
6464
class="inline-flex items-center gap-2 px-3 py-1.5 bg-bg-subtle border border-border rounded-md"
6565
>
6666
<NuxtLink
67-
:to="`/${pkg}`"
67+
:to="`/package/${pkg}`"
6868
class="font-mono text-sm text-fg hover:text-accent transition-colors"
6969
>
7070
{{ pkg }}

server/utils/code-highlight.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ function linkifyImports(html: string, options?: LinkifyOptions): string {
187187
const dep = dependencies?.[packageName]
188188
if (dep) {
189189
// Link to code browser with resolved version
190-
return `/code/${packageName}/v/${dep.version}`
190+
return `/package-code/${packageName}/v/${dep.version}`
191191
}
192192
// Fall back to package page if not a known dependency
193-
return `/${packageName}`
193+
return `/package/${packageName}`
194194
}
195195

196196
// Match: from keyword span followed by string span containing module specifier

server/utils/import-resolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export function createImportResolver(
212212
return (specifier: string) => {
213213
const resolved = resolveRelativeImport(specifier, currentFile, files)
214214
if (resolved) {
215-
return `/code/${packageName}/v/${version}/${resolved.path}`
215+
return `/package-code/${packageName}/v/${version}/${resolved.path}`
216216
}
217217
return null
218218
}

0 commit comments

Comments
 (0)