File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,10 +5,7 @@ export default function routingMeta(nitro: Nitro) {
55 id : "#nitro/virtual/routing-meta" ,
66 template : ( ) => {
77 const handlers = Object . values ( nitro . routing . routes . routes ) . flatMap ( ( h ) => h . data ) ;
8- const routeHandlers = uniqueBy (
9- handlers ,
10- ( h ) => `${ h . _importHash } _${ h . method ?. toLowerCase ( ) || "" } _${ h . route || "" } `
11- ) ;
8+ const routeHandlers = uniqueBy ( handlers , "_importHash" ) ;
129
1310 return /* js */ `
1411 ${ routeHandlers
@@ -29,6 +26,6 @@ export const handlersMeta = [
2926 } ;
3027}
3128
32- function uniqueBy < T > ( arr : T [ ] , key : ( item : T ) => string ) : T [ ] {
33- return [ ...new Map ( arr . map ( ( item ) => [ key ( item ) , item ] ) ) . values ( ) ] ;
29+ function uniqueBy < T > ( arr : T [ ] , key : keyof T ) : T [ ] {
30+ return [ ...new Map ( arr . map ( ( item ) => [ item [ key ] , item ] ) ) . values ( ) ] ;
3431}
You can’t perform that action at this time.
0 commit comments