@tanstack/router-core 0.0.1-alpha.3 → 0.0.1-alpha.4

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.
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
4014
4014
  </script>
4015
4015
  <script>
4016
4016
  /*<!--*/
4017
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"b6e9-1","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules","children":[{"name":"@babel/runtime/helpers/esm/extends.js","uid":"b6e9-3"},{"name":"history/index.js","uid":"b6e9-5"}]},{"name":"packages/router-core/src","children":[{"uid":"b6e9-7","name":"qss.ts"},{"uid":"b6e9-9","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"b6e9-1":{"renderedLength":437,"gzipLength":243,"brotliLength":0,"mainUid":"b6e9-0"},"b6e9-3":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"b6e9-2"},"b6e9-5":{"renderedLength":20618,"gzipLength":3797,"brotliLength":0,"mainUid":"b6e9-4"},"b6e9-7":{"renderedLength":1241,"gzipLength":523,"brotliLength":0,"mainUid":"b6e9-6"},"b6e9-9":{"renderedLength":45660,"gzipLength":10084,"brotliLength":0,"mainUid":"b6e9-8"}},"nodeMetas":{"b6e9-0":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"b6e9-1"},"imported":[],"importedBy":[{"uid":"b6e9-8"}]},"b6e9-2":{"id":"/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"b6e9-3"},"imported":[],"importedBy":[{"uid":"b6e9-4"}]},"b6e9-4":{"id":"/node_modules/history/index.js","moduleParts":{"index.production.js":"b6e9-5"},"imported":[{"uid":"b6e9-2"}],"importedBy":[{"uid":"b6e9-8"}]},"b6e9-6":{"id":"/packages/router-core/src/qss.ts","moduleParts":{"index.production.js":"b6e9-7"},"imported":[],"importedBy":[{"uid":"b6e9-8"}]},"b6e9-8":{"id":"/packages/router-core/src/index.ts","moduleParts":{"index.production.js":"b6e9-9"},"imported":[{"uid":"b6e9-0"},{"uid":"b6e9-4"},{"uid":"b6e9-6"}],"importedBy":[],"isEntry":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"c4e0-1","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules","children":[{"name":"@babel/runtime/helpers/esm/extends.js","uid":"c4e0-3"},{"name":"history/index.js","uid":"c4e0-5"},{"name":"tiny-invariant/dist/esm/tiny-invariant.js","uid":"c4e0-7"}]},{"name":"packages/router-core/src","children":[{"uid":"c4e0-9","name":"qss.ts"},{"uid":"c4e0-11","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"c4e0-1":{"renderedLength":437,"gzipLength":243,"brotliLength":0,"mainUid":"c4e0-0"},"c4e0-3":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"c4e0-2"},"c4e0-5":{"renderedLength":20618,"gzipLength":3797,"brotliLength":0,"mainUid":"c4e0-4"},"c4e0-7":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"c4e0-6"},"c4e0-9":{"renderedLength":1241,"gzipLength":523,"brotliLength":0,"mainUid":"c4e0-8"},"c4e0-11":{"renderedLength":46465,"gzipLength":10249,"brotliLength":0,"mainUid":"c4e0-10"}},"nodeMetas":{"c4e0-0":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c4e0-1"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-2":{"id":"/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"c4e0-3"},"imported":[],"importedBy":[{"uid":"c4e0-4"}]},"c4e0-4":{"id":"/node_modules/history/index.js","moduleParts":{"index.production.js":"c4e0-5"},"imported":[{"uid":"c4e0-2"}],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-6":{"id":"/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"c4e0-7"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-8":{"id":"/packages/router-core/src/qss.ts","moduleParts":{"index.production.js":"c4e0-9"},"imported":[],"importedBy":[{"uid":"c4e0-10"}]},"c4e0-10":{"id":"/packages/router-core/src/index.ts","moduleParts":{"index.production.js":"c4e0-11"},"imported":[{"uid":"c4e0-0"},{"uid":"c4e0-4"},{"uid":"c4e0-6"},{"uid":"c4e0-8"}],"importedBy":[],"isEntry":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4018
4018
 
4019
4019
  const run = () => {
4020
4020
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "b6e9-11",
10
+ "uid": "c4e0-13",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,15 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "@babel/runtime/helpers/esm/extends.js",
18
- "uid": "b6e9-13"
18
+ "uid": "c4e0-15"
19
19
  },
20
20
  {
21
21
  "name": "history/index.js",
22
- "uid": "b6e9-15"
22
+ "uid": "c4e0-17"
23
+ },
24
+ {
25
+ "name": "tiny-invariant/dist/esm/tiny-invariant.js",
26
+ "uid": "c4e0-19"
23
27
  }
24
28
  ]
25
29
  },
@@ -27,11 +31,11 @@
27
31
  "name": "packages/router-core/src",
28
32
  "children": [
29
33
  {
30
- "uid": "b6e9-17",
34
+ "uid": "c4e0-21",
31
35
  "name": "qss.ts"
32
36
  },
33
37
  {
34
- "uid": "b6e9-19",
38
+ "uid": "c4e0-23",
35
39
  "name": "index.ts"
36
40
  }
37
41
  ]
@@ -42,104 +46,125 @@
42
46
  "isRoot": true
43
47
  },
44
48
  "nodeParts": {
45
- "b6e9-11": {
49
+ "c4e0-13": {
46
50
  "renderedLength": 437,
47
51
  "gzipLength": 243,
48
52
  "brotliLength": 0,
49
- "mainUid": "b6e9-10"
53
+ "mainUid": "c4e0-12"
50
54
  },
51
- "b6e9-13": {
55
+ "c4e0-15": {
52
56
  "renderedLength": 431,
53
57
  "gzipLength": 240,
54
58
  "brotliLength": 0,
55
- "mainUid": "b6e9-12"
59
+ "mainUid": "c4e0-14"
56
60
  },
57
- "b6e9-15": {
61
+ "c4e0-17": {
58
62
  "renderedLength": 20618,
59
63
  "gzipLength": 3797,
60
64
  "brotliLength": 0,
61
- "mainUid": "b6e9-14"
65
+ "mainUid": "c4e0-16"
66
+ },
67
+ "c4e0-19": {
68
+ "renderedLength": 181,
69
+ "gzipLength": 129,
70
+ "brotliLength": 0,
71
+ "mainUid": "c4e0-18"
62
72
  },
63
- "b6e9-17": {
73
+ "c4e0-21": {
64
74
  "renderedLength": 1241,
65
75
  "gzipLength": 523,
66
76
  "brotliLength": 0,
67
- "mainUid": "b6e9-16"
77
+ "mainUid": "c4e0-20"
68
78
  },
69
- "b6e9-19": {
70
- "renderedLength": 45660,
71
- "gzipLength": 10084,
79
+ "c4e0-23": {
80
+ "renderedLength": 46465,
81
+ "gzipLength": 10249,
72
82
  "brotliLength": 0,
73
- "mainUid": "b6e9-18"
83
+ "mainUid": "c4e0-22"
74
84
  }
75
85
  },
76
86
  "nodeMetas": {
77
- "b6e9-10": {
87
+ "c4e0-12": {
78
88
  "id": "\u0000rollupPluginBabelHelpers.js",
79
89
  "moduleParts": {
80
- "index.production.js": "b6e9-11"
90
+ "index.production.js": "c4e0-13"
81
91
  },
82
92
  "imported": [],
83
93
  "importedBy": [
84
94
  {
85
- "uid": "b6e9-18"
95
+ "uid": "c4e0-22"
86
96
  }
87
97
  ]
88
98
  },
89
- "b6e9-12": {
99
+ "c4e0-14": {
90
100
  "id": "/node_modules/@babel/runtime/helpers/esm/extends.js",
91
101
  "moduleParts": {
92
- "index.production.js": "b6e9-13"
102
+ "index.production.js": "c4e0-15"
93
103
  },
94
104
  "imported": [],
95
105
  "importedBy": [
96
106
  {
97
- "uid": "b6e9-14"
107
+ "uid": "c4e0-16"
98
108
  }
99
109
  ]
100
110
  },
101
- "b6e9-14": {
111
+ "c4e0-16": {
102
112
  "id": "/node_modules/history/index.js",
103
113
  "moduleParts": {
104
- "index.production.js": "b6e9-15"
114
+ "index.production.js": "c4e0-17"
105
115
  },
106
116
  "imported": [
107
117
  {
108
- "uid": "b6e9-12"
118
+ "uid": "c4e0-14"
109
119
  }
110
120
  ],
111
121
  "importedBy": [
112
122
  {
113
- "uid": "b6e9-18"
123
+ "uid": "c4e0-22"
124
+ }
125
+ ]
126
+ },
127
+ "c4e0-18": {
128
+ "id": "/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
129
+ "moduleParts": {
130
+ "index.production.js": "c4e0-19"
131
+ },
132
+ "imported": [],
133
+ "importedBy": [
134
+ {
135
+ "uid": "c4e0-22"
114
136
  }
115
137
  ]
116
138
  },
117
- "b6e9-16": {
139
+ "c4e0-20": {
118
140
  "id": "/packages/router-core/src/qss.ts",
119
141
  "moduleParts": {
120
- "index.production.js": "b6e9-17"
142
+ "index.production.js": "c4e0-21"
121
143
  },
122
144
  "imported": [],
123
145
  "importedBy": [
124
146
  {
125
- "uid": "b6e9-18"
147
+ "uid": "c4e0-22"
126
148
  }
127
149
  ]
128
150
  },
129
- "b6e9-18": {
151
+ "c4e0-22": {
130
152
  "id": "/packages/router-core/src/index.ts",
131
153
  "moduleParts": {
132
- "index.production.js": "b6e9-19"
154
+ "index.production.js": "c4e0-23"
133
155
  },
134
156
  "imported": [
135
157
  {
136
- "uid": "b6e9-10"
158
+ "uid": "c4e0-12"
159
+ },
160
+ {
161
+ "uid": "c4e0-16"
137
162
  },
138
163
  {
139
- "uid": "b6e9-14"
164
+ "uid": "c4e0-18"
140
165
  },
141
166
  {
142
- "uid": "b6e9-16"
167
+ "uid": "c4e0-20"
143
168
  }
144
169
  ],
145
170
  "importedBy": [],
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import { BrowserHistory, MemoryHistory, HashHistory, History } from 'history';
12
12
  export { createBrowserHistory, createHashHistory, createMemoryHistory } from 'history';
13
+ export { default as invariant } from 'tiny-invariant';
13
14
 
14
15
  declare type NoInfer<T> = [T][T extends any ? 0 : never];
15
16
  declare type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
@@ -30,57 +31,61 @@ declare type Expand<T> = T extends object ? T extends infer O ? {
30
31
  } : never : T;
31
32
  interface FrameworkGenerics {
32
33
  }
33
- interface RouteConfig<TId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
34
+ interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
34
35
  id: TId;
36
+ routeId: TRouteId;
35
37
  path: NoInfer<TPath>;
36
38
  fullPath: TFullPath;
37
- options: RouteOptions<TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
39
+ options: RouteOptions<TRouteId, TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
38
40
  children?: TKnownChildren;
39
- addChildren: IsAny<TId, any, <TNewChildren extends any>(cb: (createChildRoute: CreateRouteConfigFn<false, TId, TLoaderData, TFullSearchSchema, TAllParams>) => TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
41
+ addChildren: IsAny<TId, any, <TNewChildren extends any>(cb: (createChildRoute: CreateRouteConfigFn<false, TId, TFullPath, TLoaderData, TFullSearchSchema, TAllParams>) => TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
40
42
  error: 'Invalid route detected';
41
43
  route: TNewChildren;
42
- }) => RouteConfig<TId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
44
+ }) => RouteConfig<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
43
45
  }
44
- declare type CreateRouteConfigFn<TIsRoot extends boolean = false, TParentId extends string = string, TParentAllLoaderData extends AnyLoaderData = {}, TParentSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}> = <TPath extends string, TRouteLoaderData extends AnyLoaderData, TActionPayload, TActionResponse, TSearchSchema extends AnySearchSchema = AnySearchSchema, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams> = AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams>, TKnownChildren extends RouteConfig[] = RouteConfig[]>(options?: TIsRoot extends true ? Omit<RouteOptions<TPath, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, 'path'> & {
46
+ declare type CreateRouteConfigFn<TIsRoot extends boolean = false, TParentId extends string = string, TParentPath extends string = string, TParentAllLoaderData extends AnyLoaderData = {}, TParentSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}> = <TRouteId extends string, TPath extends string, TRouteLoaderData extends AnyLoaderData, TActionPayload, TActionResponse, TSearchSchema extends AnySearchSchema = AnySearchSchema, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams> = AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams>, TKnownChildren extends RouteConfig[] = RouteConfig[], TResolvedId extends string = string extends TRouteId ? string extends TPath ? string : TPath : TRouteId>(options?: TIsRoot extends true ? Omit<RouteOptions<TRouteId, TPath, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, 'path'> & {
45
47
  path?: never;
46
- } : RouteOptions<TPath, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, children?: TKnownChildren, isRoot?: boolean, parentId?: string) => RouteConfig<RouteId<TParentId, TPath>, TPath, RouteIdToPath<RouteId<TParentId, TPath>>, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>, TKnownChildren>;
48
+ } : RouteOptions<TRouteId, TPath, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, children?: TKnownChildren, isRoot?: boolean, parentId?: string, parentPath?: string) => RouteConfig<RoutePrefix<TParentId, TResolvedId>, TResolvedId, TPath, string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>, TRouteLoaderData, Expand<TParentAllLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>, TKnownChildren>;
47
49
  declare const createRouteConfig: CreateRouteConfigFn<true>;
48
- interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any> {
50
+ interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
49
51
  }
50
- interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
52
+ interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
51
53
  }
52
54
  interface AnyAllRouteInfo {
53
55
  routeConfig: AnyRouteConfig;
54
56
  routeInfo: AnyRouteInfo;
55
57
  routeInfoById: Record<string, AnyRouteInfo>;
56
58
  routeInfoByFullPath: Record<string, AnyRouteInfo>;
57
- fullPath: string;
59
+ routeIds: any;
60
+ routePaths: any;
58
61
  }
59
62
  interface DefaultAllRouteInfo {
60
63
  routeConfig: RouteConfig;
61
64
  routeInfo: RouteInfo;
62
65
  routeInfoById: Record<string, RouteInfo>;
63
66
  routeInfoByFullPath: Record<string, RouteInfo>;
64
- fullPath: string;
67
+ routeIds: string;
68
+ routePaths: string;
65
69
  }
66
70
  interface AllRouteInfo<TRouteConfig extends AnyRouteConfig = RouteConfig> extends RoutesInfoInner<TRouteConfig, ParseRouteConfig<TRouteConfig>> {
67
71
  }
68
- interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any> = RouteInfo> {
72
+ interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
73
+ [TInfo in TRouteInfo as TInfo['id']]: TInfo;
74
+ }, TRouteInfoByFullPath = {
75
+ [TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId ? never : string extends TInfo['fullPath'] ? never : TInfo['fullPath']]: TInfo;
76
+ }> {
69
77
  routeConfig: TRouteConfig;
70
78
  routeInfo: TRouteInfo;
71
- routeInfoById: {
72
- [TInfo in TRouteInfo as TInfo['id']]: TInfo;
73
- };
74
- routeInfoByFullPath: {
75
- [TInfo in TRouteInfo as TInfo['id'] extends RootRouteId ? never : RouteIdToPath<TInfo['id']>]: TInfo;
76
- };
77
- fullPath: RouteIdToPath<TRouteInfo['id']>;
79
+ routeInfoById: TRouteInfoById;
80
+ routeInfoByFullPath: TRouteInfoByFullPath;
81
+ routeIds: keyof TRouteInfoById;
82
+ routePaths: keyof TRouteInfoByFullPath;
78
83
  }
79
84
  interface AnyRoute extends Route<any, any> {
80
85
  }
81
- interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any> {
86
+ interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
82
87
  }
83
- declare type RouteIdToPath<T extends string> = T extends RootRouteId ? '/' : TrimPathRight<`${T}`>;
88
+ declare type RoutePath<T extends string> = T extends RootRouteId ? '/' : TrimPathRight<`${T}`>;
84
89
  declare type ParseRouteConfig<TRouteConfig = AnyRouteConfig> = TRouteConfig extends AnyRouteConfig ? RouteConfigRoute<TRouteConfig> | ParseRouteChildren<TRouteConfig> : never;
85
90
  declare type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteConfigWithChildren<infer TChildren> ? unknown extends TChildren ? never : TChildren extends AnyRouteConfig[] ? Values<{
86
91
  [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
@@ -90,9 +95,10 @@ declare type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
90
95
  } extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
91
96
  declare type Values<O> = O[ValueKeys<O>];
92
97
  declare type ValueKeys<O> = Extract<keyof O, PropertyKey>;
93
- declare type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TPath, infer TFullPath, infer TRouteLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TId ? never : RouteInfo<TId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
94
- interface RouteInfo<TId extends string = string, TPath extends string = string, TFullPath extends {} = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> {
98
+ declare type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TRouteLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
99
+ interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> {
95
100
  id: TId;
101
+ routeId: TRouteId;
96
102
  path: TPath;
97
103
  fullPath: TFullPath;
98
104
  routeLoaderData: TRouteLoaderData;
@@ -104,14 +110,14 @@ interface RouteInfo<TId extends string = string, TPath extends string = string,
104
110
  parentParams: TParentParams;
105
111
  params: TParams;
106
112
  allParams: TAllParams;
107
- options: RouteOptions<TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
113
+ options: RouteOptions<TRouteId, TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
108
114
  }
109
115
  declare type DeepAwaited<T> = T extends Promise<infer A> ? DeepAwaited<A> : T extends Record<infer A, Promise<infer B>> ? {
110
116
  [K in A]: DeepAwaited<B>;
111
117
  } : T;
112
118
  declare const rootRouteId: "__root__";
113
119
  declare type RootRouteId = typeof rootRouteId;
114
- declare type RouteId<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`;
120
+ declare type RoutePrefix<TPrefix extends string, TId extends string> = string extends TId ? RootRouteId : TId extends string ? `${TPrefix}/${TId}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TId>}`>}` : never;
115
121
  declare type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
116
122
  declare type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
117
123
  declare type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
@@ -160,8 +166,11 @@ declare type DefinedPathParamWarning = 'Path params cannot be redefined by child
160
166
  declare type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
161
167
  [Key in keyof TParentParams]?: DefinedPathParamWarning;
162
168
  };
163
- declare type RouteOptions<TPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = {
169
+ declare type RouteOptions<TRouteId extends string = string, TPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
164
170
  path: TPath;
171
+ } | {
172
+ id: TRouteId;
173
+ }) & {
165
174
  caseSensitive?: boolean;
166
175
  validateSearch?: SearchSchemaValidator<TSearchSchema, TParentSearchSchema>;
167
176
  preSearchFilters?: SearchFilter<TFullSearchSchema>[];
@@ -322,7 +331,7 @@ interface ActionState<TPayload = unknown, TResponse = unknown> {
322
331
  declare type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
323
332
  [K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
324
333
  };
325
- declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['fullPath'] ? string : TAllRouteInfo['fullPath']);
334
+ declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['routePaths'] ? string : TAllRouteInfo['routePaths']);
326
335
  interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
327
336
  options: PickAsRequired<RouterOptions<TRouteConfig>, 'stringifySearch' | 'parseSearch'>;
328
337
  basepath: string;
@@ -381,6 +390,7 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
381
390
  declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
382
391
  interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> {
383
392
  routeId: TRouteInfo['id'];
393
+ routeRouteId: TRouteInfo['routeId'];
384
394
  routePath: TRouteInfo['path'];
385
395
  fullPath: TRouteInfo['fullPath'];
386
396
  parentRoute?: AnyRoute;
@@ -388,7 +398,7 @@ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRo
388
398
  options: RouteOptions;
389
399
  router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo>;
390
400
  buildLink: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => LinkInfo;
391
- matchRoute: <TTo extends string = '.', TResolved extends string = ResolveRelativePath<TRouteInfo['id'], TTo>>(matchLocation: Omit<ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>, opts?: MatchRouteOptions) => RouteInfoByPath<TAllRouteInfo, TResolved>['allParams'];
401
+ matchRoute: <TTo extends string = '.', TResolved extends string = ResolveRelativePath<TRouteInfo['id'], TTo>>(matchLocation: CheckRelativePath<TAllRouteInfo, TRouteInfo['fullPath'], NoInfer<TTo>> & Omit<ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>, opts?: MatchRouteOptions) => RouteInfoByPath<TAllRouteInfo, TResolved>['allParams'];
392
402
  navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['id'], TTo>, 'from'>) => Promise<void>;
393
403
  action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
394
404
  }
@@ -411,9 +421,9 @@ declare type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteIn
411
421
  to?: ToPathOption<TAllRouteInfo, TFrom, TTo>;
412
422
  hash?: Updater<string>;
413
423
  from?: TFrom;
414
- } & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
415
- declare type ToPathOption<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = TTo | RelativeToPathAutoComplete<TAllRouteInfo['fullPath'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
416
- declare type ToIdOption<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = TTo | RelativeToPathAutoComplete<TAllRouteInfo['routeInfo']['id'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
424
+ } & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
425
+ declare type ToPathOption<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = TTo | RelativeToPathAutoComplete<TAllRouteInfo['routePaths'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
426
+ declare type ToIdOption<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = TTo | RelativeToPathAutoComplete<TAllRouteInfo['routeIds'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
417
427
  declare type LinkOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = NavigateOptionsAbsolute<TAllRouteInfo, TFrom, TTo> & {
418
428
  target?: HTMLAnchorElement['target'];
419
429
  activeOptions?: ActiveOptions;
@@ -422,11 +432,16 @@ declare type LinkOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRoute
422
432
  preloadDelay?: number;
423
433
  disabled?: boolean;
424
434
  };
425
- declare type CheckRelativePath<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends TAllRouteInfo['fullPath'] ? {} : {
435
+ declare type CheckRelativePath<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends TAllRouteInfo['routePaths'] ? {} : {
426
436
  Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
427
- 'Valid Route Paths': TAllRouteInfo['fullPath'];
437
+ 'Valid Route Paths': TAllRouteInfo['routePaths'];
428
438
  } : {} : {};
429
- declare type ResolveRelativePath<TFrom, TTo = '.', TRooted = false> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
439
+ declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ? {} : CheckPathError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routePaths']>>;
440
+ declare type CheckPathError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = {
441
+ Error: `${TInvalids extends string ? TInvalids : never} is not a valid route path.`;
442
+ 'Valid Route Paths': TAllRouteInfo['routePaths'];
443
+ };
444
+ declare type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
430
445
  declare type RouteInfoById<TAllRouteInfo extends AnyAllRouteInfo, TId> = TId extends keyof TAllRouteInfo['routeInfoById'] ? IsAny<TAllRouteInfo['routeInfoById'][TId]['id'], RouteInfo, TAllRouteInfo['routeInfoById'][TId]> : never;
431
446
  declare type RouteInfoByPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = TPath extends keyof TAllRouteInfo['routeInfoByFullPath'] ? IsAny<TAllRouteInfo['routeInfoByFullPath'][TPath]['id'], RouteInfo, TAllRouteInfo['routeInfoByFullPath'][TPath]> : never;
432
447
  declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
@@ -514,4 +529,4 @@ declare function parseSearchWith(parser: (str: string) => any): (searchStr: stri
514
529
  declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
515
530
  declare function last<T>(arr: T[]): T | undefined;
516
531
 
517
- export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckRelativePath, DefaultAllRouteInfo, DefinedPathParamWarning, FilterRoutesFn, FrameworkGenerics, FromLocation, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderFn, Location, LocationState, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickUnsafe, PreloadCacheEntry, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteLoaders, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesInfoInner, SearchFilter, SearchParser, SearchPredicate, SearchSchemaValidator, SearchSerializer, Segment, SnapshotRouteMatch, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, __Experimental__RouterSnapshot, createRoute, createRouteConfig, createRouteMatch, createRouter, defaultParseSearch, defaultStringifySearch, functionalUpdate, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, warning };
532
+ export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckPath, CheckPathError, CheckRelativePath, DefaultAllRouteInfo, DefinedPathParamWarning, FilterRoutesFn, FrameworkGenerics, FromLocation, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderFn, Location, LocationState, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickUnsafe, PreloadCacheEntry, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteLoaders, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesInfoInner, SearchFilter, SearchParser, SearchPredicate, SearchSchemaValidator, SearchSerializer, Segment, SnapshotRouteMatch, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, __Experimental__RouterSnapshot, createRoute, createRouteConfig, createRouteMatch, createRouter, defaultParseSearch, defaultStringifySearch, functionalUpdate, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, warning };