File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed
package-code/[[org]]/[packageName]/v/[version] Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import { getOutdatedTooltip , getVersionClass } from ' ~/utils/npm/outdated-dependencies'
3+ import type { RouteLocationRaw } from ' vue-router'
34
45const props = defineProps <{
56 packageName: string
@@ -11,12 +12,26 @@ const props = defineProps<{
1112 }
1213}>()
1314
14- function getCodeLink(filePath : string ): string {
15- return ` /code/${props .packageName }/v/${props .version }/${filePath } `
15+ function getCodeLink(filePath : string ): RouteLocationRaw {
16+ const split = props .packageName .split (' /' )
17+
18+ console .log ({ split })
19+ return {
20+ name: ' code' ,
21+ params: {
22+ org: split .length === 2 ? split [0 ] : null ,
23+ packageName: split .length === 2 ? split [1 ]! : split [0 ]! ,
24+ version: props .version ,
25+ filePath: ' ' ,
26+ },
27+ }
1628}
1729
1830const scriptParts = computed (() => {
19- const parts: Record <string , { prefix: string | null ; filePath: string | null ; link: string }> = {}
31+ const parts: Record <
32+ string ,
33+ { prefix: string | null ; filePath: string | null ; link: RouteLocationRaw }
34+ > = {}
2035 for (const scriptName of props .installScripts .scripts ) {
2136 const content = props .installScripts .content ?.[scriptName ]
2237 if (! content ) continue
Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ import type {
77
88definePageMeta ({
99 name: ' code' ,
10- path: ' /package-code/@ :org?/:packageName/v/:version/:filePath(.*)?' ,
10+ path: ' /package-code/:org?/:packageName/v/:version/:filePath(.*)?' ,
1111 alias: [
12- ' /package/code/@:org?/:packageName/v/:version/:filePath(.*)?' ,
13- ' /code/@:org?/:packageName/v/:version/:filePath(.*)?' ,
12+ ' /package/code/:org?/:packageName/v/:version/:filePath(.*)?' ,
13+ ' /package/code/:packageName/v/:version/:filePath(.*)?' ,
14+ // '/code/@:org?/:packageName/v/:version/:filePath(.*)?',
1415 ],
1516})
1617
@@ -44,7 +45,7 @@ function getCodeUrl(args: {
4445 filePath? : string
4546}): string {
4647 const base = args .org
47- ? ` /package-code/@ ${args .org }/${args .packageName }/v/${args .version } `
48+ ? ` /package-code/${args .org }/${args .packageName }/v/${args .version } `
4849 : ` /package-code/${args .packageName }/v/${args .version } `
4950 return args .filePath ? ` ${base }/${args .filePath } ` : base
5051}
Original file line number Diff line number Diff line change @@ -525,7 +525,7 @@ const codeLink = computed((): RouteLocationRaw | null => {
525525 return {
526526 name: ' code' ,
527527 params: {
528- org: split .length === 2 ? split [0 ]?. replace ( / ^ @ / , ' ' ) : undefined ,
528+ org: split .length === 2 ? split [0 ] : undefined ,
529529 packageName: split .length === 2 ? split [1 ]! : split [0 ]! ,
530530 version: resolvedVersion .value ,
531531 filePath: ' ' ,
You can’t perform that action at this time.
0 commit comments