Skip to content

Commit 4713069

Browse files
authored
fix: avoid iterator helpers for Node 20 compat (#2635)
Fix #2633
1 parent 5f7bbf1 commit 4713069

File tree

1 file changed

+14
-17
lines changed
  • packages/router/src/unplugin/core

1 file changed

+14
-17
lines changed

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -623,23 +623,20 @@ export function collectDuplicatedRouteNodes(
623623
nodes.push({ filePath, node })
624624
}
625625

626-
const dups = Array.from(
627-
seen
628-
.values()
629-
.filter(nodes => Object.keys(nodes).length > 1)
630-
.map(nodes =>
631-
nodes.toSorted(({ node: a }, { node: b }) => {
632-
// put the one that takes precedence at the end of the list
633-
if (treeNodes.has(a) && !treeNodes.has(b)) {
634-
return -1
635-
} else if (!treeNodes.has(a) && treeNodes.has(b)) {
636-
return 1
637-
} else {
638-
return 0
639-
}
640-
})
641-
)
642-
)
626+
const dups = Array.from(seen.values())
627+
.filter(nodes => Object.keys(nodes).length > 1)
628+
.map(nodes =>
629+
nodes.toSorted(({ node: a }, { node: b }) => {
630+
// put the one that takes precedence at the end of the list
631+
if (treeNodes.has(a) && !treeNodes.has(b)) {
632+
return -1
633+
} else if (!treeNodes.has(a) && treeNodes.has(b)) {
634+
return 1
635+
} else {
636+
return 0
637+
}
638+
})
639+
)
643640

644641
return dups
645642
}

0 commit comments

Comments
 (0)