Skip to content

Commit 7aa607f

Browse files
committed
feat: display aliases in logs
1 parent a068bd3 commit 7aa607f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/router/src/unplugin/core/treeNodeValue.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ class _TreeNodeValueBase {
9999
return this.overrides.path ?? this.pathSegment
100100
}
101101

102+
/**
103+
* Aliases of the node if any.
104+
*/
105+
get alias(): string[] {
106+
return this.overrides.alias ?? []
107+
}
108+
102109
/**
103110
* Full path of the node including parent nodes.
104111
*/
@@ -156,13 +163,20 @@ class _TreeNodeValueBase {
156163
}
157164

158165
toString(): string {
166+
let value = ''
159167
// index.vue (home).vue
160168
if (!this.pathSegment) {
161-
return (
169+
value +=
162170
'<index>' + (this.rawSegment === 'index' ? '' : ' ' + this.rawSegment)
163-
)
171+
} else {
172+
value += this.pathSegment
173+
}
174+
175+
if (this.alias.length) {
176+
value += ` alias(${this.alias.join(', ')})`
164177
}
165-
return this.pathSegment
178+
179+
return value
166180
}
167181

168182
isParam(): this is TreeNodeValueParam {

0 commit comments

Comments
 (0)