@tanstack/virtual-file-routes 1.56.0 → 1.81.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api.cjs +10 -3
- package/dist/cjs/api.cjs.map +1 -1
- package/dist/cjs/api.d.cts +3 -1
- package/dist/cjs/types.d.cts +1 -1
- package/dist/esm/api.d.ts +3 -1
- package/dist/esm/api.js +10 -3
- package/dist/esm/api.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/api.ts +16 -2
- package/src/types.ts +1 -1
package/dist/cjs/api.cjs
CHANGED
|
@@ -29,12 +29,19 @@ function layout(idOrFile, fileOrChildren, children) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function route(path,
|
|
32
|
+
function route(path, fileOrChildren, children) {
|
|
33
|
+
if (typeof fileOrChildren === "string") {
|
|
34
|
+
return {
|
|
35
|
+
type: "route",
|
|
36
|
+
file: fileOrChildren,
|
|
37
|
+
path,
|
|
38
|
+
children
|
|
39
|
+
};
|
|
40
|
+
}
|
|
33
41
|
return {
|
|
34
42
|
type: "route",
|
|
35
|
-
file,
|
|
36
43
|
path,
|
|
37
|
-
children
|
|
44
|
+
children: fileOrChildren
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
function physical(pathPrefix, directory) {
|
package/dist/cjs/api.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","sources":["../../src/api.ts"],"sourcesContent":["import type {\n IndexRoute,\n LayoutRoute,\n PhysicalSubtree,\n Route,\n VirtualRootRoute,\n VirtualRouteNode,\n} from './types'\n\nexport function rootRoute(\n file: string,\n children?: Array<VirtualRouteNode>,\n): VirtualRootRoute {\n return {\n type: 'root',\n file,\n children,\n }\n}\n\nexport function index(file: string): IndexRoute {\n return {\n type: 'index',\n file,\n }\n}\n\nexport function layout(\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\nexport function layout(\n id: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\n\nexport function layout(\n idOrFile: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): LayoutRoute {\n if (Array.isArray(fileOrChildren)) {\n return {\n type: 'layout',\n file: idOrFile,\n children: fileOrChildren,\n }\n } else {\n return {\n type: 'layout',\n id: idOrFile,\n file: fileOrChildren,\n children,\n }\n }\n}\n\nexport function route(\n path: string,\n file: string,\n children?: Array<VirtualRouteNode>,\n): Route {\n return {\n
|
|
1
|
+
{"version":3,"file":"api.cjs","sources":["../../src/api.ts"],"sourcesContent":["import type {\n IndexRoute,\n LayoutRoute,\n PhysicalSubtree,\n Route,\n VirtualRootRoute,\n VirtualRouteNode,\n} from './types'\n\nexport function rootRoute(\n file: string,\n children?: Array<VirtualRouteNode>,\n): VirtualRootRoute {\n return {\n type: 'root',\n file,\n children,\n }\n}\n\nexport function index(file: string): IndexRoute {\n return {\n type: 'index',\n file,\n }\n}\n\nexport function layout(\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\nexport function layout(\n id: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\n\nexport function layout(\n idOrFile: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): LayoutRoute {\n if (Array.isArray(fileOrChildren)) {\n return {\n type: 'layout',\n file: idOrFile,\n children: fileOrChildren,\n }\n } else {\n return {\n type: 'layout',\n id: idOrFile,\n file: fileOrChildren,\n children,\n }\n }\n}\n\nexport function route(path: string, children: Array<VirtualRouteNode>): Route\nexport function route(path: string, file: string): Route\nexport function route(\n path: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): Route\nexport function route(\n path: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): Route {\n if (typeof fileOrChildren === 'string') {\n return {\n type: 'route',\n file: fileOrChildren,\n path,\n children,\n }\n }\n return {\n type: 'route',\n path,\n children: fileOrChildren,\n }\n}\n\nexport function physical(\n pathPrefix: string,\n directory: string,\n): PhysicalSubtree {\n return {\n type: 'physical',\n directory,\n pathPrefix,\n }\n}\n"],"names":[],"mappings":";;AASgB,SAAA,UACd,MACA,UACkB;AACX,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,MAAM,MAA0B;AACvC,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;AAYgB,SAAA,OACd,UACA,gBACA,UACa;AACT,MAAA,MAAM,QAAQ,cAAc,GAAG;AAC1B,WAAA;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,EAAA,OACK;AACE,WAAA;AAAA,MACL,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EAAA;AAEJ;AASgB,SAAA,MACd,MACA,gBACA,UACO;AACH,MAAA,OAAO,mBAAmB,UAAU;AAC/B,WAAA;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAEK,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEgB,SAAA,SACd,YACA,WACiB;AACV,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;;;;"}
|
package/dist/cjs/api.d.cts
CHANGED
|
@@ -3,5 +3,7 @@ export declare function rootRoute(file: string, children?: Array<VirtualRouteNod
|
|
|
3
3
|
export declare function index(file: string): IndexRoute;
|
|
4
4
|
export declare function layout(file: string, children: Array<VirtualRouteNode>): LayoutRoute;
|
|
5
5
|
export declare function layout(id: string, file: string, children: Array<VirtualRouteNode>): LayoutRoute;
|
|
6
|
-
export declare function route(path: string,
|
|
6
|
+
export declare function route(path: string, children: Array<VirtualRouteNode>): Route;
|
|
7
|
+
export declare function route(path: string, file: string): Route;
|
|
8
|
+
export declare function route(path: string, file: string, children: Array<VirtualRouteNode>): Route;
|
|
7
9
|
export declare function physical(pathPrefix: string, directory: string): PhysicalSubtree;
|
package/dist/cjs/types.d.cts
CHANGED
package/dist/esm/api.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export declare function rootRoute(file: string, children?: Array<VirtualRouteNod
|
|
|
3
3
|
export declare function index(file: string): IndexRoute;
|
|
4
4
|
export declare function layout(file: string, children: Array<VirtualRouteNode>): LayoutRoute;
|
|
5
5
|
export declare function layout(id: string, file: string, children: Array<VirtualRouteNode>): LayoutRoute;
|
|
6
|
-
export declare function route(path: string,
|
|
6
|
+
export declare function route(path: string, children: Array<VirtualRouteNode>): Route;
|
|
7
|
+
export declare function route(path: string, file: string): Route;
|
|
8
|
+
export declare function route(path: string, file: string, children: Array<VirtualRouteNode>): Route;
|
|
7
9
|
export declare function physical(pathPrefix: string, directory: string): PhysicalSubtree;
|
package/dist/esm/api.js
CHANGED
|
@@ -27,12 +27,19 @@ function layout(idOrFile, fileOrChildren, children) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function route(path,
|
|
30
|
+
function route(path, fileOrChildren, children) {
|
|
31
|
+
if (typeof fileOrChildren === "string") {
|
|
32
|
+
return {
|
|
33
|
+
type: "route",
|
|
34
|
+
file: fileOrChildren,
|
|
35
|
+
path,
|
|
36
|
+
children
|
|
37
|
+
};
|
|
38
|
+
}
|
|
31
39
|
return {
|
|
32
40
|
type: "route",
|
|
33
|
-
file,
|
|
34
41
|
path,
|
|
35
|
-
children
|
|
42
|
+
children: fileOrChildren
|
|
36
43
|
};
|
|
37
44
|
}
|
|
38
45
|
function physical(pathPrefix, directory) {
|
package/dist/esm/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["../../src/api.ts"],"sourcesContent":["import type {\n IndexRoute,\n LayoutRoute,\n PhysicalSubtree,\n Route,\n VirtualRootRoute,\n VirtualRouteNode,\n} from './types'\n\nexport function rootRoute(\n file: string,\n children?: Array<VirtualRouteNode>,\n): VirtualRootRoute {\n return {\n type: 'root',\n file,\n children,\n }\n}\n\nexport function index(file: string): IndexRoute {\n return {\n type: 'index',\n file,\n }\n}\n\nexport function layout(\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\nexport function layout(\n id: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\n\nexport function layout(\n idOrFile: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): LayoutRoute {\n if (Array.isArray(fileOrChildren)) {\n return {\n type: 'layout',\n file: idOrFile,\n children: fileOrChildren,\n }\n } else {\n return {\n type: 'layout',\n id: idOrFile,\n file: fileOrChildren,\n children,\n }\n }\n}\n\nexport function route(\n path: string,\n file: string,\n children?: Array<VirtualRouteNode>,\n): Route {\n return {\n
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../src/api.ts"],"sourcesContent":["import type {\n IndexRoute,\n LayoutRoute,\n PhysicalSubtree,\n Route,\n VirtualRootRoute,\n VirtualRouteNode,\n} from './types'\n\nexport function rootRoute(\n file: string,\n children?: Array<VirtualRouteNode>,\n): VirtualRootRoute {\n return {\n type: 'root',\n file,\n children,\n }\n}\n\nexport function index(file: string): IndexRoute {\n return {\n type: 'index',\n file,\n }\n}\n\nexport function layout(\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\nexport function layout(\n id: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): LayoutRoute\n\nexport function layout(\n idOrFile: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): LayoutRoute {\n if (Array.isArray(fileOrChildren)) {\n return {\n type: 'layout',\n file: idOrFile,\n children: fileOrChildren,\n }\n } else {\n return {\n type: 'layout',\n id: idOrFile,\n file: fileOrChildren,\n children,\n }\n }\n}\n\nexport function route(path: string, children: Array<VirtualRouteNode>): Route\nexport function route(path: string, file: string): Route\nexport function route(\n path: string,\n file: string,\n children: Array<VirtualRouteNode>,\n): Route\nexport function route(\n path: string,\n fileOrChildren: string | Array<VirtualRouteNode>,\n children?: Array<VirtualRouteNode>,\n): Route {\n if (typeof fileOrChildren === 'string') {\n return {\n type: 'route',\n file: fileOrChildren,\n path,\n children,\n }\n }\n return {\n type: 'route',\n path,\n children: fileOrChildren,\n }\n}\n\nexport function physical(\n pathPrefix: string,\n directory: string,\n): PhysicalSubtree {\n return {\n type: 'physical',\n directory,\n pathPrefix,\n }\n}\n"],"names":[],"mappings":"AASgB,SAAA,UACd,MACA,UACkB;AACX,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,MAAM,MAA0B;AACvC,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;AAYgB,SAAA,OACd,UACA,gBACA,UACa;AACT,MAAA,MAAM,QAAQ,cAAc,GAAG;AAC1B,WAAA;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,EAAA,OACK;AACE,WAAA;AAAA,MACL,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EAAA;AAEJ;AASgB,SAAA,MACd,MACA,gBACA,UACO;AACH,MAAA,OAAO,mBAAmB,UAAU;AAC/B,WAAA;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAEK,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEgB,SAAA,SACd,YACA,WACiB;AACV,SAAA;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;"}
|
package/dist/esm/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -56,16 +56,30 @@ export function layout(
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export function route(path: string, children: Array<VirtualRouteNode>): Route
|
|
60
|
+
export function route(path: string, file: string): Route
|
|
59
61
|
export function route(
|
|
60
62
|
path: string,
|
|
61
63
|
file: string,
|
|
64
|
+
children: Array<VirtualRouteNode>,
|
|
65
|
+
): Route
|
|
66
|
+
export function route(
|
|
67
|
+
path: string,
|
|
68
|
+
fileOrChildren: string | Array<VirtualRouteNode>,
|
|
62
69
|
children?: Array<VirtualRouteNode>,
|
|
63
70
|
): Route {
|
|
71
|
+
if (typeof fileOrChildren === 'string') {
|
|
72
|
+
return {
|
|
73
|
+
type: 'route',
|
|
74
|
+
file: fileOrChildren,
|
|
75
|
+
path,
|
|
76
|
+
children,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
return {
|
|
65
80
|
type: 'route',
|
|
66
|
-
file,
|
|
67
81
|
path,
|
|
68
|
-
children,
|
|
82
|
+
children: fileOrChildren,
|
|
69
83
|
}
|
|
70
84
|
}
|
|
71
85
|
|