@tanstack/virtual-file-routes
Advanced tools
Comparing version 1.56.0 to 1.64.0
@@ -6,3 +6,5 @@ import { IndexRoute, LayoutRoute, PhysicalSubtree, Route, VirtualRootRoute, VirtualRouteNode } from './types.js'; | ||
export declare function layout(id: string, file: string, children: Array<VirtualRouteNode>): LayoutRoute; | ||
export declare function route(path: string, file: string, children?: Array<VirtualRouteNode>): Route; | ||
export declare function route(path: string, children: Array<VirtualRouteNode>): Route; | ||
export declare function route(path: string, file: string): Route; | ||
export declare function route(path: string, file: string, children: Array<VirtualRouteNode>): Route; | ||
export declare function physical(pathPrefix: string, directory: string): PhysicalSubtree; |
@@ -30,8 +30,15 @@ function rootRoute(file, children) { | ||
} | ||
function route(path, file, children) { | ||
function route(path, fileOrChildren, children) { | ||
if (typeof fileOrChildren === "string") { | ||
return { | ||
type: "route", | ||
file: fileOrChildren, | ||
path, | ||
children | ||
}; | ||
} | ||
return { | ||
type: "route", | ||
file, | ||
path, | ||
children | ||
children: fileOrChildren | ||
}; | ||
@@ -38,0 +45,0 @@ } |
@@ -18,3 +18,3 @@ export type IndexRoute = { | ||
type: 'route'; | ||
file: string; | ||
file?: string; | ||
path: string; | ||
@@ -21,0 +21,0 @@ children?: Array<VirtualRouteNode>; |
{ | ||
"name": "@tanstack/virtual-file-routes", | ||
"version": "1.56.0", | ||
"version": "1.64.0", | ||
"description": "Modern and scalable routing for React applications", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -59,12 +59,26 @@ import type { | ||
export function route(path: string, children: Array<VirtualRouteNode>): Route | ||
export function route(path: string, file: string): Route | ||
export function route( | ||
path: string, | ||
file: string, | ||
children: Array<VirtualRouteNode>, | ||
): Route | ||
export function route( | ||
path: string, | ||
fileOrChildren: string | Array<VirtualRouteNode>, | ||
children?: Array<VirtualRouteNode>, | ||
): Route { | ||
if (typeof fileOrChildren === 'string') { | ||
return { | ||
type: 'route', | ||
file: fileOrChildren, | ||
path, | ||
children, | ||
} | ||
} | ||
return { | ||
type: 'route', | ||
file, | ||
path, | ||
children, | ||
children: fileOrChildren, | ||
} | ||
@@ -71,0 +85,0 @@ } |
@@ -21,3 +21,3 @@ export type IndexRoute = { | ||
type: 'route' | ||
file: string | ||
file?: string | ||
path: string | ||
@@ -24,0 +24,0 @@ children?: Array<VirtualRouteNode> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23816
378