@tanstack/router-core 0.0.1-beta.5 → 0.0.1-beta.51

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/build/cjs/actions.js +94 -0
  3. package/build/cjs/actions.js.map +1 -0
  4. package/build/cjs/history.js +163 -0
  5. package/build/cjs/history.js.map +1 -0
  6. package/build/cjs/{packages/router-core/src/index.js → index.js} +26 -11
  7. package/build/cjs/{packages/router-core/src/index.js.map → index.js.map} +1 -1
  8. package/build/cjs/interop.js +175 -0
  9. package/build/cjs/interop.js.map +1 -0
  10. package/build/cjs/{packages/router-core/src/path.js → path.js} +23 -48
  11. package/build/cjs/path.js.map +1 -0
  12. package/build/cjs/{packages/router-core/src/qss.js → qss.js} +8 -13
  13. package/build/cjs/qss.js.map +1 -0
  14. package/build/cjs/route.js +33 -0
  15. package/build/cjs/route.js.map +1 -0
  16. package/build/cjs/{packages/router-core/src/routeConfig.js → routeConfig.js} +13 -18
  17. package/build/cjs/routeConfig.js.map +1 -0
  18. package/build/cjs/routeMatch.js +237 -0
  19. package/build/cjs/routeMatch.js.map +1 -0
  20. package/build/cjs/router.js +824 -0
  21. package/build/cjs/router.js.map +1 -0
  22. package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +10 -12
  23. package/build/cjs/searchParams.js.map +1 -0
  24. package/build/cjs/store.js +54 -0
  25. package/build/cjs/store.js.map +1 -0
  26. package/build/cjs/utils.js +47 -0
  27. package/build/cjs/utils.js.map +1 -0
  28. package/build/esm/index.js +1386 -2058
  29. package/build/esm/index.js.map +1 -1
  30. package/build/stats-html.html +59 -49
  31. package/build/stats-react.json +248 -193
  32. package/build/types/index.d.ts +385 -317
  33. package/build/umd/index.development.js +1489 -2142
  34. package/build/umd/index.development.js.map +1 -1
  35. package/build/umd/index.production.js +1 -1
  36. package/build/umd/index.production.js.map +1 -1
  37. package/package.json +6 -4
  38. package/src/actions.ts +157 -0
  39. package/src/frameworks.ts +2 -2
  40. package/src/history.ts +199 -0
  41. package/src/index.ts +4 -7
  42. package/src/interop.ts +169 -0
  43. package/src/link.ts +87 -44
  44. package/src/path.ts +12 -8
  45. package/src/route.ts +36 -229
  46. package/src/routeConfig.ts +99 -102
  47. package/src/routeInfo.ts +28 -25
  48. package/src/routeMatch.ts +293 -322
  49. package/src/router.ts +1060 -884
  50. package/src/store.ts +52 -0
  51. package/src/utils.ts +14 -72
  52. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
  53. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  54. package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -33
  55. package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
  56. package/build/cjs/node_modules/history/index.js +0 -815
  57. package/build/cjs/node_modules/history/index.js.map +0 -1
  58. package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -30
  59. package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +0 -1
  60. package/build/cjs/packages/router-core/src/path.js.map +0 -1
  61. package/build/cjs/packages/router-core/src/qss.js.map +0 -1
  62. package/build/cjs/packages/router-core/src/route.js +0 -161
  63. package/build/cjs/packages/router-core/src/route.js.map +0 -1
  64. package/build/cjs/packages/router-core/src/routeConfig.js.map +0 -1
  65. package/build/cjs/packages/router-core/src/routeMatch.js +0 -266
  66. package/build/cjs/packages/router-core/src/routeMatch.js.map +0 -1
  67. package/build/cjs/packages/router-core/src/router.js +0 -797
  68. package/build/cjs/packages/router-core/src/router.js.map +0 -1
  69. package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
  70. package/build/cjs/packages/router-core/src/utils.js +0 -118
  71. package/build/cjs/packages/router-core/src/utils.js.map +0 -1
@@ -31,8 +31,8 @@ function trimPath(path) {
31
31
  return trimPathRight(trimPathLeft(path));
32
32
  }
33
33
  function resolvePath(basepath, base, to) {
34
- base = base.replace(new RegExp("^" + basepath), '/');
35
- to = to.replace(new RegExp("^" + basepath), '/');
34
+ base = base.replace(new RegExp(`^${basepath}`), '/');
35
+ to = to.replace(new RegExp(`^${basepath}`), '/');
36
36
  let baseSegments = parsePathname(base);
37
37
  const toSegments = parsePathname(to);
38
38
  toSegments.forEach((toSegment, index) => {
@@ -45,13 +45,10 @@ function resolvePath(basepath, base, to) {
45
45
  baseSegments.push(toSegment);
46
46
  } else ;
47
47
  } else if (toSegment.value === '..') {
48
- var _last;
49
-
50
48
  // Extra trailing slash? pop it off
51
- if (baseSegments.length > 1 && ((_last = utils.last(baseSegments)) == null ? void 0 : _last.value) === '/') {
49
+ if (baseSegments.length > 1 && utils.last(baseSegments)?.value === '/') {
52
50
  baseSegments.pop();
53
51
  }
54
-
55
52
  baseSegments.pop();
56
53
  } else if (toSegment.value === '.') {
57
54
  return;
@@ -66,10 +63,8 @@ function parsePathname(pathname) {
66
63
  if (!pathname) {
67
64
  return [];
68
65
  }
69
-
70
66
  pathname = cleanPath(pathname);
71
67
  const segments = [];
72
-
73
68
  if (pathname.slice(0, 1) === '/') {
74
69
  pathname = pathname.substring(1);
75
70
  segments.push({
@@ -77,12 +72,11 @@ function parsePathname(pathname) {
77
72
  value: '/'
78
73
  });
79
74
  }
80
-
81
75
  if (!pathname) {
82
76
  return segments;
83
- } // Remove empty segments and '.' segments
84
-
77
+ }
85
78
 
79
+ // Remove empty segments and '.' segments
86
80
  const split = pathname.split('/').filter(Boolean);
87
81
  segments.push(...split.map(part => {
88
82
  if (part.startsWith('*')) {
@@ -91,20 +85,17 @@ function parsePathname(pathname) {
91
85
  value: part
92
86
  };
93
87
  }
94
-
95
- if (part.charAt(0) === ':') {
88
+ if (part.charAt(0) === '$') {
96
89
  return {
97
90
  type: 'param',
98
91
  value: part
99
92
  };
100
93
  }
101
-
102
94
  return {
103
95
  type: 'pathname',
104
96
  value: part
105
97
  };
106
98
  }));
107
-
108
99
  if (pathname.slice(-1) === '/') {
109
100
  pathname = pathname.substring(1);
110
101
  segments.push({
@@ -112,7 +103,6 @@ function parsePathname(pathname) {
112
103
  value: '/'
113
104
  });
114
105
  }
115
-
116
106
  return segments;
117
107
  }
118
108
  function interpolatePath(path, params, leaveWildcard) {
@@ -121,57 +111,48 @@ function interpolatePath(path, params, leaveWildcard) {
121
111
  if (segment.value === '*' && !leaveWildcard) {
122
112
  return '';
123
113
  }
124
-
125
114
  if (segment.type === 'param') {
126
- var _segment$value$substr;
127
-
128
- return (_segment$value$substr = params[segment.value.substring(1)]) != null ? _segment$value$substr : '';
115
+ return params[segment.value.substring(1)] ?? '';
129
116
  }
130
-
131
117
  return segment.value;
132
118
  }));
133
119
  }
134
- function matchPathname(currentPathname, matchLocation) {
135
- const pathParams = matchByPath(currentPathname, matchLocation); // const searchMatched = matchBySearch(currentLocation.search, matchLocation)
120
+ function matchPathname(basepath, currentPathname, matchLocation) {
121
+ const pathParams = matchByPath(basepath, currentPathname, matchLocation);
122
+ // const searchMatched = matchBySearch(currentLocation.search, matchLocation)
136
123
 
137
124
  if (matchLocation.to && !pathParams) {
138
125
  return;
139
- } // if (matchLocation.search && !searchMatched) {
140
- // return
141
- // }
142
-
143
-
144
- return pathParams != null ? pathParams : {};
126
+ }
127
+ return pathParams ?? {};
145
128
  }
146
- function matchByPath(from, matchLocation) {
147
- var _matchLocation$to;
148
-
129
+ function matchByPath(basepath, from, matchLocation) {
130
+ if (!from.startsWith(basepath)) {
131
+ return undefined;
132
+ }
133
+ from = basepath != '/' ? from.substring(basepath.length) : from;
149
134
  const baseSegments = parsePathname(from);
150
- const routeSegments = parsePathname("" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*'));
135
+ const to = `${matchLocation.to ?? '*'}`;
136
+ const routeSegments = parsePathname(to);
151
137
  const params = {};
152
-
153
138
  let isMatch = (() => {
154
139
  for (let i = 0; i < Math.max(baseSegments.length, routeSegments.length); i++) {
155
140
  const baseSegment = baseSegments[i];
156
141
  const routeSegment = routeSegments[i];
157
142
  const isLastRouteSegment = i === routeSegments.length - 1;
158
143
  const isLastBaseSegment = i === baseSegments.length - 1;
159
-
160
144
  if (routeSegment) {
161
145
  if (routeSegment.type === 'wildcard') {
162
- if (baseSegment != null && baseSegment.value) {
146
+ if (baseSegment?.value) {
163
147
  params['*'] = joinPaths(baseSegments.slice(i).map(d => d.value));
164
148
  return true;
165
149
  }
166
-
167
150
  return false;
168
151
  }
169
-
170
152
  if (routeSegment.type === 'pathname') {
171
- if (routeSegment.value === '/' && !(baseSegment != null && baseSegment.value)) {
153
+ if (routeSegment.value === '/' && !baseSegment?.value) {
172
154
  return true;
173
155
  }
174
-
175
156
  if (baseSegment) {
176
157
  if (matchLocation.caseSensitive) {
177
158
  if (routeSegment.value !== baseSegment.value) {
@@ -182,30 +163,24 @@ function matchByPath(from, matchLocation) {
182
163
  }
183
164
  }
184
165
  }
185
-
186
166
  if (!baseSegment) {
187
167
  return false;
188
168
  }
189
-
190
169
  if (routeSegment.type === 'param') {
191
- if ((baseSegment == null ? void 0 : baseSegment.value) === '/') {
170
+ if (baseSegment?.value === '/') {
192
171
  return false;
193
172
  }
194
-
195
- if (!baseSegment.value.startsWith(':')) {
173
+ if (baseSegment.value.charAt(0) !== '$') {
196
174
  params[routeSegment.value.substring(1)] = baseSegment.value;
197
175
  }
198
176
  }
199
177
  }
200
-
201
178
  if (isLastRouteSegment && !isLastBaseSegment) {
202
179
  return !!matchLocation.fuzzy;
203
180
  }
204
181
  }
205
-
206
182
  return true;
207
183
  })();
208
-
209
184
  return isMatch ? params : undefined;
210
185
  }
211
186
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sources":["../../src/path.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { AnyPathParams } from './routeConfig'\nimport { MatchLocation } from './router'\nimport { last } from './utils'\n\nexport interface Segment {\n type: 'pathname' | 'param' | 'wildcard'\n value: string\n}\n\nexport function joinPaths(paths: (string | undefined)[]) {\n return cleanPath(paths.filter(Boolean).join('/'))\n}\n\nexport function cleanPath(path: string) {\n // remove double slashes\n return path.replace(/\\/{2,}/g, '/')\n}\n\nexport function trimPathLeft(path: string) {\n return path === '/' ? path : path.replace(/^\\/{1,}/, '')\n}\n\nexport function trimPathRight(path: string) {\n return path === '/' ? path : path.replace(/\\/{1,}$/, '')\n}\n\nexport function trimPath(path: string) {\n return trimPathRight(trimPathLeft(path))\n}\n\nexport function resolvePath(basepath: string, base: string, to: string) {\n base = base.replace(new RegExp(`^${basepath}`), '/')\n to = to.replace(new RegExp(`^${basepath}`), '/')\n\n let baseSegments = parsePathname(base)\n const toSegments = parsePathname(to)\n\n toSegments.forEach((toSegment, index) => {\n if (toSegment.value === '/') {\n if (!index) {\n // Leading slash\n baseSegments = [toSegment]\n } else if (index === toSegments.length - 1) {\n // Trailing Slash\n baseSegments.push(toSegment)\n } else {\n // ignore inter-slashes\n }\n } else if (toSegment.value === '..') {\n // Extra trailing slash? pop it off\n if (baseSegments.length > 1 && last(baseSegments)?.value === '/') {\n baseSegments.pop()\n }\n baseSegments.pop()\n } else if (toSegment.value === '.') {\n return\n } else {\n baseSegments.push(toSegment)\n }\n })\n\n const joined = joinPaths([basepath, ...baseSegments.map((d) => d.value)])\n\n return cleanPath(joined)\n}\n\nexport function parsePathname(pathname?: string): Segment[] {\n if (!pathname) {\n return []\n }\n\n pathname = cleanPath(pathname)\n\n const segments: Segment[] = []\n\n if (pathname.slice(0, 1) === '/') {\n pathname = pathname.substring(1)\n segments.push({\n type: 'pathname',\n value: '/',\n })\n }\n\n if (!pathname) {\n return segments\n }\n\n // Remove empty segments and '.' segments\n const split = pathname.split('/').filter(Boolean)\n\n segments.push(\n ...split.map((part): Segment => {\n if (part.startsWith('*')) {\n return {\n type: 'wildcard',\n value: part,\n }\n }\n\n if (part.charAt(0) === '$') {\n return {\n type: 'param',\n value: part,\n }\n }\n\n return {\n type: 'pathname',\n value: part,\n }\n }),\n )\n\n if (pathname.slice(-1) === '/') {\n pathname = pathname.substring(1)\n segments.push({\n type: 'pathname',\n value: '/',\n })\n }\n\n return segments\n}\n\nexport function interpolatePath(\n path: string | undefined,\n params: any,\n leaveWildcard?: boolean,\n) {\n const interpolatedPathSegments = parsePathname(path)\n\n return joinPaths(\n interpolatedPathSegments.map((segment) => {\n if (segment.value === '*' && !leaveWildcard) {\n return ''\n }\n\n if (segment.type === 'param') {\n return params![segment.value.substring(1)] ?? ''\n }\n\n return segment.value\n }),\n )\n}\n\nexport function matchPathname(\n basepath: string,\n currentPathname: string,\n matchLocation: Pick<MatchLocation, 'to' | 'fuzzy' | 'caseSensitive'>,\n): AnyPathParams | undefined {\n const pathParams = matchByPath(basepath, currentPathname, matchLocation)\n // const searchMatched = matchBySearch(currentLocation.search, matchLocation)\n\n if (matchLocation.to && !pathParams) {\n return\n }\n\n return pathParams ?? {}\n}\n\nexport function matchByPath(\n basepath: string,\n from: string,\n matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>,\n): Record<string, string> | undefined {\n if (!from.startsWith(basepath)) {\n return undefined\n }\n from = basepath != '/' ? from.substring(basepath.length) : from\n const baseSegments = parsePathname(from)\n const to = `${matchLocation.to ?? '*'}`\n const routeSegments = parsePathname(to)\n\n const params: Record<string, string> = {}\n\n let isMatch = (() => {\n for (\n let i = 0;\n i < Math.max(baseSegments.length, routeSegments.length);\n i++\n ) {\n const baseSegment = baseSegments[i]\n const routeSegment = routeSegments[i]\n\n const isLastRouteSegment = i === routeSegments.length - 1\n const isLastBaseSegment = i === baseSegments.length - 1\n\n if (routeSegment) {\n if (routeSegment.type === 'wildcard') {\n if (baseSegment?.value) {\n params['*'] = joinPaths(baseSegments.slice(i).map((d) => d.value))\n return true\n }\n return false\n }\n\n if (routeSegment.type === 'pathname') {\n if (routeSegment.value === '/' && !baseSegment?.value) {\n return true\n }\n\n if (baseSegment) {\n if (matchLocation.caseSensitive) {\n if (routeSegment.value !== baseSegment.value) {\n return false\n }\n } else if (\n routeSegment.value.toLowerCase() !==\n baseSegment.value.toLowerCase()\n ) {\n return false\n }\n }\n }\n\n if (!baseSegment) {\n return false\n }\n\n if (routeSegment.type === 'param') {\n if (baseSegment?.value === '/') {\n return false\n }\n if (baseSegment.value.charAt(0) !== '$') {\n params[routeSegment.value.substring(1)] = baseSegment.value\n }\n }\n }\n\n if (isLastRouteSegment && !isLastBaseSegment) {\n return !!matchLocation.fuzzy\n }\n }\n return true\n })()\n\n return isMatch ? (params as Record<string, string>) : undefined\n}\n"],"names":["joinPaths","paths","cleanPath","filter","Boolean","join","path","replace","trimPathLeft","trimPathRight","trimPath","resolvePath","basepath","base","to","RegExp","baseSegments","parsePathname","toSegments","forEach","toSegment","index","value","length","push","last","pop","joined","map","d","pathname","segments","slice","substring","type","split","part","startsWith","charAt","interpolatePath","params","leaveWildcard","interpolatedPathSegments","segment","matchPathname","currentPathname","matchLocation","pathParams","matchByPath","from","undefined","routeSegments","isMatch","i","Math","max","baseSegment","routeSegment","isLastRouteSegment","isLastBaseSegment","caseSensitive","toLowerCase","fuzzy"],"mappings":";;;;;;;;;;;;;;;;AAUO,SAASA,SAAS,CAACC,KAA6B,EAAE;AACvD,EAAA,OAAOC,SAAS,CAACD,KAAK,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AACnD,CAAA;AAEO,SAASH,SAAS,CAACI,IAAY,EAAE;AACtC;AACA,EAAA,OAAOA,IAAI,CAACC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AACrC,CAAA;AAEO,SAASC,YAAY,CAACF,IAAY,EAAE;AACzC,EAAA,OAAOA,IAAI,KAAK,GAAG,GAAGA,IAAI,GAAGA,IAAI,CAACC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;AAC1D,CAAA;AAEO,SAASE,aAAa,CAACH,IAAY,EAAE;AAC1C,EAAA,OAAOA,IAAI,KAAK,GAAG,GAAGA,IAAI,GAAGA,IAAI,CAACC,OAAO,CAAC,SAAS,EAAE,E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OAAO,EAAE;AACjC,UAAA,IAAIsB,WAAW,EAAElC,KAAK,KAAK,GAAG,EAAE;AAC9B,YAAA,OAAO,KAAK,CAAA;AACd,WAAA;UACA,IAAIkC,WAAW,CAAClC,KAAK,CAACgB,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACvCE,YAAAA,MAAM,CAACiB,YAAY,CAACnC,KAAK,CAACW,SAAS,CAAC,CAAC,CAAC,CAAC,GAAGuB,WAAW,CAAClC,KAAK,CAAA;AAC7D,WAAA;AACF,SAAA;AACF,OAAA;AAEA,MAAA,IAAIoC,kBAAkB,IAAI,CAACC,iBAAiB,EAAE;AAC5C,QAAA,OAAO,CAAC,CAACb,aAAa,CAACgB,KAAK,CAAA;AAC9B,OAAA;AACF,KAAA;AACA,IAAA,OAAO,IAAI,CAAA;AACb,GAAC,GAAG,CAAA;AAEJ,EAAA,OAAOV,OAAO,GAAIZ,MAAM,GAA8BU,SAAS,CAAA;AACjE;;;;;;;;;;;;;"}
@@ -13,13 +13,14 @@
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
15
  // @ts-nocheck
16
+
16
17
  // qss has been slightly modified and inlined here for our use cases (and compression's sake). We've included it as a hard dependency for MIT license attribution.
18
+
17
19
  function encode(obj, pfx) {
18
20
  var k,
19
- i,
20
- tmp,
21
- str = '';
22
-
21
+ i,
22
+ tmp,
23
+ str = '';
23
24
  for (k in obj) {
24
25
  if ((tmp = obj[k]) !== void 0) {
25
26
  if (Array.isArray(tmp)) {
@@ -33,10 +34,8 @@ function encode(obj, pfx) {
33
34
  }
34
35
  }
35
36
  }
36
-
37
37
  return (pfx || '') + str;
38
38
  }
39
-
40
39
  function toValue(mix) {
41
40
  if (!mix) return '';
42
41
  var str = decodeURIComponent(mix);
@@ -45,24 +44,20 @@ function toValue(mix) {
45
44
  if (str.charAt(0) === '0') return str;
46
45
  return +str * 0 === 0 ? +str : str;
47
46
  }
48
-
49
47
  function decode(str) {
50
48
  var tmp,
51
- k,
52
- out = {},
53
- arr = str.split('&');
54
-
49
+ k,
50
+ out = {},
51
+ arr = str.split('&');
55
52
  while (tmp = arr.shift()) {
56
53
  tmp = tmp.split('=');
57
54
  k = tmp.shift();
58
-
59
55
  if (out[k] !== void 0) {
60
56
  out[k] = [].concat(out[k], toValue(tmp.shift()));
61
57
  } else {
62
58
  out[k] = toValue(tmp.shift());
63
59
  }
64
60
  }
65
-
66
61
  return out;
67
62
  }
68
63
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qss.js","sources":["../../src/qss.ts"],"sourcesContent":["// @ts-nocheck\n\n// qss has been slightly modified and inlined here for our use cases (and compression's sake). We've included it as a hard dependency for MIT license attribution.\n\nexport function encode(obj, pfx?: string) {\n var k,\n i,\n tmp,\n str = ''\n\n for (k in obj) {\n if ((tmp = obj[k]) !== void 0) {\n if (Array.isArray(tmp)) {\n for (i = 0; i < tmp.length; i++) {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i])\n }\n } else {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp)\n }\n }\n }\n\n return (pfx || '') + str\n}\n\nfunction toValue(mix) {\n if (!mix) return ''\n var str = decodeURIComponent(mix)\n if (str === 'false') return false\n if (str === 'true') return true\n if (str.charAt(0) === '0') return str\n return +str * 0 === 0 ? +str : str\n}\n\nexport function decode(str) {\n var tmp,\n k,\n out = {},\n arr = str.split('&')\n\n while ((tmp = arr.shift())) {\n tmp = tmp.split('=')\n k = tmp.shift()\n if (out[k] !== void 0) {\n out[k] = [].concat(out[k], toValue(tmp.shift()))\n } else {\n out[k] = toValue(tmp.shift())\n }\n }\n\n return out\n}\n"],"names":["encode","obj","pfx","k","i","tmp","str","Array","isArray","length","encodeURIComponent","toValue","mix","decodeURIComponent","charAt","decode","out","arr","split","shift","concat"],"mappings":";;;;;;;;;;;;;;AAAA;;AAEA;;AAEO,SAASA,MAAM,CAACC,GAAG,EAAEC,GAAY,EAAE;AACxC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CAAC,KAAK,CAAC,GAAG,CAACA,GAAG,GAAGA,GAAG,CAAA;AACpC,CAAA;AAEO,SAASS,MAAM,CAACT,GAAG,EAAE;AAC1B,EAAA,IAAID,GAAG;IACLF,CAAC;IACDa,GAAG,GAAG,EAAE;AACRC,IAAAA,GAAG,GAAGX,GAAG,CAACY,KAAK,CAAC,GAAG,CAAC,CAAA;AAEtB,EAAA,OAAQb,GAAG,GAAGY,GAAG,CAACE,KAAK,EAAE,EAAG;AAC1Bd,IAAAA,GAAG,GAAGA,GAAG,CAACa,KAAK,CAAC,GAAG,CAAC,CAAA;AACpBf,IAAAA,CAAC,GAAGE,GAAG,CAACc,KAAK,EAAE,CAAA;AACf,IAAA,IAAIH,GAAG,CAACb,CAAC,CAAC,KAAK,KAAK,CAAC,EAAE;MACrBa,GAAG,CAACb,CAAC,CAAC,GAAG,EAAE,CAACiB,MAAM,CAACJ,GAAG,CAACb,CAAC,CAAC,EAAEQ,OAAO,CAACN,GAAG,CAACc,KAAK,EAAE,CAAC,CAAC,CAAA;AAClD,KAAC,MAAM;MACLH,GAAG,CAACb,CAAC,CAAC,GAAGQ,OAAO,CAACN,GAAG,CAACc,KAAK,EAAE,CAAC,CAAA;AAC/B,KAAA;AACF,GAAA;AAEA,EAAA,OAAOH,GAAG,CAAA;AACZ;;;;;"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * router-core
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ class Route {
16
+ constructor(routeConfig, options, originalIndex, parent, router) {
17
+ Object.assign(this, {
18
+ ...routeConfig,
19
+ originalIndex,
20
+ options,
21
+ getRouter: () => router,
22
+ childRoutes: undefined,
23
+ getParentRoute: () => parent
24
+ });
25
+ router.options.createRoute?.({
26
+ router,
27
+ route: this
28
+ });
29
+ }
30
+ }
31
+
32
+ exports.Route = Route;
33
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import { Action, ActionOptions } from './actions'\nimport { RouteConfig, RouteOptions } from './routeConfig'\nimport {\n AnyAllRouteInfo,\n AnyRouteInfo,\n DefaultAllRouteInfo,\n RouteInfo,\n} from './routeInfo'\nimport { Router } from './router'\n\nexport interface AnyRoute extends Route<any, any, any> {}\n\nexport class Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n TRouterContext = unknown,\n> {\n routeInfo!: TRouteInfo\n id!: TRouteInfo['id']\n customId!: TRouteInfo['customId']\n path!: TRouteInfo['path']\n fullPath!: TRouteInfo['fullPath']\n getParentRoute!: () => undefined | AnyRoute\n childRoutes?: AnyRoute[]\n options!: RouteOptions\n originalIndex!: number\n getRouter!: () => Router<\n TAllRouteInfo['routeConfig'],\n TAllRouteInfo,\n TRouterContext\n >\n constructor(\n routeConfig: RouteConfig,\n options: TRouteInfo['options'],\n originalIndex: number,\n parent: undefined | Route<TAllRouteInfo, any>,\n router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo, TRouterContext>,\n ) {\n Object.assign(this, {\n ...routeConfig,\n originalIndex,\n options,\n getRouter: () => router,\n childRoutes: undefined!,\n getParentRoute: () => parent,\n })\n\n router.options.createRoute?.({ router, route: this })\n }\n}\n"],"names":["Route","constructor","routeConfig","options","originalIndex","parent","router","Object","assign","getRouter","childRoutes","undefined","getParentRoute","createRoute","route"],"mappings":";;;;;;;;;;;;;;AAYO,MAAMA,KAAK,CAIhB;EAeAC,WAAW,CACTC,WAAwB,EACxBC,OAA8B,EAC9BC,aAAqB,EACrBC,MAA6C,EAC7CC,MAA2E,EAC3E;AACAC,IAAAA,MAAM,CAACC,MAAM,CAAC,IAAI,EAAE;AAClB,MAAA,GAAGN,WAAW;MACdE,aAAa;MACbD,OAAO;MACPM,SAAS,EAAE,MAAMH,MAAM;AACvBI,MAAAA,WAAW,EAAEC,SAAU;AACvBC,MAAAA,cAAc,EAAE,MAAMP,MAAAA;AACxB,KAAC,CAAC,CAAA;AAEFC,IAAAA,MAAM,CAACH,OAAO,CAACU,WAAW,GAAG;MAAEP,MAAM;AAAEQ,MAAAA,KAAK,EAAE,IAAA;AAAK,KAAC,CAAC,CAAA;AACvD,GAAA;AACF;;;;"}
@@ -12,44 +12,37 @@
12
12
 
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
+ var invariant = require('tiny-invariant');
15
16
  var path = require('./path.js');
16
17
 
17
- const rootRouteId = '__root__';
18
- const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId, parentPath) {
19
- if (options === void 0) {
20
- options = {};
21
- }
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
19
 
23
- if (isRoot === void 0) {
24
- isRoot = true;
25
- }
20
+ var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
26
21
 
22
+ const rootRouteId = '__root__';
23
+ const createRouteConfig = (options = {}, children = [], isRoot = true, parentId, parentPath) => {
27
24
  if (isRoot) {
28
25
  options.path = rootRouteId;
29
- } // Strip the root from parentIds
30
-
26
+ }
31
27
 
28
+ // Strip the root from parentIds
32
29
  if (parentId === rootRouteId) {
33
30
  parentId = '';
34
31
  }
32
+ let path$1 = isRoot ? rootRouteId : options.path;
35
33
 
36
- let path$1 = isRoot ? rootRouteId : options.path; // If the path is anything other than an index path, trim it up
37
-
34
+ // If the path is anything other than an index path, trim it up
38
35
  if (path$1 && path$1 !== '/') {
39
36
  path$1 = path.trimPath(path$1);
40
37
  }
41
-
42
38
  const routeId = path$1 || options.id;
43
39
  let id = path.joinPaths([parentId, routeId]);
44
-
45
40
  if (path$1 === rootRouteId) {
46
41
  path$1 = '/';
47
42
  }
48
-
49
43
  if (id !== rootRouteId) {
50
44
  id = path.joinPaths(['/', id]);
51
45
  }
52
-
53
46
  const fullPath = id === rootRouteId ? '/' : path.trimPathRight(path.joinPaths([parentPath, path$1]));
54
47
  return {
55
48
  id: id,
@@ -58,9 +51,11 @@ const createRouteConfig = function createRouteConfig(options, children, isRoot,
58
51
  fullPath: fullPath,
59
52
  options: options,
60
53
  children,
61
- createChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)), false, parentId, parentPath),
62
54
  addChildren: children => createRouteConfig(options, children, false, parentId, parentPath),
63
- createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)
55
+ createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath),
56
+ generate: () => {
57
+ invariant__default["default"](false, `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `);
58
+ }
64
59
  };
65
60
  };
66
61
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routeConfig.js","sources":["../../src/routeConfig.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { GetFrameworkGeneric } from './frameworks'\nimport { ParsePathParams } from './link'\nimport { joinPaths, trimPath, trimPathRight } from './path'\nimport { RouteInfo } from './routeInfo'\nimport { RouteMatch } from './routeMatch'\nimport { AnyRouter, RegisteredRouter, Router } from './router'\nimport { Expand, IsAny, NoInfer, PickUnsafe } from './utils'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\n\nexport type AnyLoaderData = {}\nexport type AnyPathParams = {}\nexport type AnySearchSchema = {}\nexport interface RouteMeta {}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TReturn, TParentSchema> =\n | SearchSchemaValidatorObj<TReturn, TParentSchema>\n | SearchSchemaValidatorFn<TReturn, TParentSchema>\n\nexport type SearchSchemaValidatorObj<TReturn, TParentSchema> = {\n parse?: SearchSchemaValidatorFn<TReturn, TParentSchema>\n}\n\nexport type SearchSchemaValidatorFn<TReturn, TParentSchema> = (\n searchObj: Record<string, unknown>,\n) => {} extends TParentSchema\n ? TReturn\n : keyof TReturn extends keyof TParentSchema\n ? {\n error: 'Top level search params cannot be redefined by child routes!'\n keys: keyof TReturn & keyof TParentSchema\n }\n : TReturn\n\nexport type DefinedPathParamWarning =\n 'Path params cannot be redefined by child routes!'\n\nexport type ParentParams<TParentParams> = AnyPathParams extends TParentParams\n ? {}\n : {\n [Key in keyof TParentParams]?: DefinedPathParamWarning\n }\n\nexport type LoaderFn<\n TRouteLoaderData extends AnyLoaderData = {},\n TFullSearchSchema extends AnySearchSchema = {},\n TAllParams extends AnyPathParams = {},\n> = (\n loaderContext: LoaderContext<TFullSearchSchema, TAllParams>,\n) => TRouteLoaderData | Promise<TRouteLoaderData>\n\nexport interface LoaderContext<\n TFullSearchSchema extends AnySearchSchema = {},\n TAllParams extends AnyPathParams = {},\n> {\n params: TAllParams\n search: TFullSearchSchema\n signal?: AbortSignal\n // parentLoaderPromise?: Promise<TParentRouteLoaderData>\n}\n\nexport type UnloaderFn<TPath extends string> = (\n routeMatch: RouteMatch<any, RouteInfo<string, TPath>>,\n) => void\n\nexport type RouteOptions<\n TRouteId extends string = string,\n TPath extends string = string,\n TParentRouteLoaderData extends AnyLoaderData = {},\n TRouteLoaderData extends AnyLoaderData = {},\n TParentLoaderData extends AnyLoaderData = {},\n TLoaderData extends AnyLoaderData = {},\n TParentSearchSchema extends {} = {},\n TSearchSchema extends AnySearchSchema = {},\n TFullSearchSchema extends AnySearchSchema = TSearchSchema,\n TParentParams extends AnyPathParams = {},\n TParams extends Record<ParsePathParams<TPath>, unknown> = Record<\n ParsePathParams<TPath>,\n string\n >,\n TAllParams extends AnyPathParams = {},\n> = (\n | {\n // The path to match (relative to the nearest parent `Route` component or root basepath)\n path: TPath\n }\n | {\n id: TRouteId\n }\n) & {\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n validateSearch?: SearchSchemaValidator<TSearchSchema, TParentSearchSchema>\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: GetFrameworkGeneric<'Component'> // , NoInfer<TParentLoaderData>>\n // The content to be rendered when the route encounters an error\n errorComponent?: GetFrameworkGeneric<'ErrorComponent'> // , NoInfer<TParentLoaderData>>\n // If supported by your framework, the content to be rendered as the fallback content until the route is ready to render\n pendingComponent?: GetFrameworkGeneric<'Component'> //, NoInfer<TParentLoaderData>>\n // An asynchronous function responsible for preparing or fetching data for the route before it is rendered\n loader?: LoaderFn<TRouteLoaderData, TFullSearchSchema, TAllParams>\n // The max age to consider loader data fresh (not-stale) for this route in milliseconds from the time of fetch\n // Defaults to 0. Only stale loader data is refetched.\n loaderMaxAge?: number\n // The max age to cache the loader data for this route in milliseconds from the time of route inactivity\n // before it is garbage collected.\n loaderGcMaxAge?: number\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onLoadError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: (opts: {\n router: AnyRouter\n match: RouteMatch\n }) => Promise<void> | void\n // This function will be called if the route's loader throws an error **during an attempted navigation**.\n // If you want to redirect due to an error, call `router.navigate()` from within this function.\n onLoadError?: (err: any) => void\n // This function is called\n // when moving from an inactive state to an active one. Likewise, when moving from\n // an active to an inactive state, the return function (if provided) is called.\n onLoaded?: (matchContext: {\n params: TAllParams\n search: TFullSearchSchema\n }) =>\n | void\n | undefined\n | ((match: { params: TAllParams; search: TFullSearchSchema }) => void)\n // This function is called when the route remains active from one transition to the next.\n onTransition?: (match: {\n params: TAllParams\n search: TFullSearchSchema\n }) => void\n // An object of whatever you want! This object is accessible anywhere matches are.\n meta?: RouteMeta // TODO: Make this nested and mergeable\n} & (\n | {\n parseParams?: never\n stringifyParams?: never\n }\n | {\n // Parse params optionally receives path params as strings and returns them in a parsed format (like a number or boolean)\n parseParams: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams\n stringifyParams: (\n params: TParams,\n ) => Record<ParsePathParams<TPath>, string>\n }\n ) &\n (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never // Detect if an existing path param is being redefined\n ? {}\n : 'Cannot redefined path params in child routes!')\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport interface RouteConfig<\n TId extends string = string,\n TRouteId extends string = string,\n TPath extends string = string,\n TFullPath extends string = string,\n TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,\n TRouteLoaderData extends AnyLoaderData = AnyLoaderData,\n TParentLoaderData extends AnyLoaderData = {},\n TLoaderData extends AnyLoaderData = AnyLoaderData,\n TParentSearchSchema extends {} = {},\n TSearchSchema extends AnySearchSchema = {},\n TFullSearchSchema extends AnySearchSchema = {},\n TParentParams extends AnyPathParams = {},\n TParams extends AnyPathParams = {},\n TAllParams extends AnyPathParams = {},\n TKnownChildren = unknown,\n> {\n id: TId\n routeId: TRouteId\n path: NoInfer<TPath>\n fullPath: TFullPath\n options: RouteOptions<\n TRouteId,\n TPath,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n TLoaderData,\n TParentSearchSchema,\n TSearchSchema,\n TFullSearchSchema,\n TParentParams,\n TParams,\n TAllParams\n >\n children?: TKnownChildren\n addChildren: IsAny<\n TId,\n any,\n <TNewChildren extends any>(\n children: TNewChildren extends AnyRouteConfig[]\n ? TNewChildren\n : { error: 'Invalid route detected'; route: TNewChildren },\n ) => RouteConfig<\n TId,\n TRouteId,\n TPath,\n TFullPath,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n TLoaderData,\n TParentSearchSchema,\n TSearchSchema,\n TFullSearchSchema,\n TParentParams,\n TParams,\n TAllParams,\n TNewChildren\n >\n >\n createRoute: CreateRouteConfigFn<\n false,\n TId,\n TFullPath,\n TRouteLoaderData,\n TLoaderData,\n TFullSearchSchema,\n TAllParams\n >\n generate: GenerateFn<\n TRouteId,\n TPath,\n TParentRouteLoaderData,\n TParentLoaderData,\n TParentSearchSchema,\n TParentParams\n >\n}\n\ntype GenerateFn<\n TRouteId extends string = string,\n TPath extends string = string,\n TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,\n TParentLoaderData extends AnyLoaderData = {},\n TParentSearchSchema extends {} = {},\n TParentParams extends AnyPathParams = {},\n> = <\n TRouteLoaderData extends AnyLoaderData = AnyLoaderData,\n TSearchSchema extends AnySearchSchema = {},\n TParams extends Record<ParsePathParams<TPath>, unknown> = Record<\n ParsePathParams<TPath>,\n string\n >,\n TAllParams extends AnyPathParams extends TParams\n ? Record<ParsePathParams<TPath>, string>\n : NoInfer<TParams> = AnyPathParams extends TParams\n ? Record<ParsePathParams<TPath>, string>\n : NoInfer<TParams>,\n>(\n options: Omit<\n RouteOptions<\n TRouteId,\n TPath,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,\n TParentSearchSchema,\n TSearchSchema,\n Expand<TParentSearchSchema & TSearchSchema>,\n TParentParams,\n TParams,\n Expand<TParentParams & TAllParams>\n >,\n 'path'\n >,\n) => void\n\ntype CreateRouteConfigFn<\n TIsRoot extends boolean = false,\n TParentId extends string = string,\n TParentPath extends string = string,\n TParentRouteLoaderData extends AnyLoaderData = {},\n TParentLoaderData extends AnyLoaderData = {},\n TParentSearchSchema extends AnySearchSchema = {},\n TParentParams extends AnyPathParams = {},\n> = <\n TRouteId extends string,\n TPath extends string,\n TRouteLoaderData extends AnyLoaderData,\n TSearchSchema extends AnySearchSchema = AnySearchSchema,\n TParams extends Record<ParsePathParams<TPath>, unknown> = Record<\n ParsePathParams<TPath>,\n string\n >,\n TAllParams extends AnyPathParams extends TParams\n ? Record<ParsePathParams<TPath>, string>\n : NoInfer<TParams> = AnyPathParams extends TParams\n ? Record<ParsePathParams<TPath>, string>\n : NoInfer<TParams>,\n TKnownChildren extends RouteConfig[] = RouteConfig[],\n TResolvedId extends string = string extends TRouteId\n ? string extends TPath\n ? string\n : TPath\n : TRouteId,\n>(\n options?: TIsRoot extends true\n ? Omit<\n RouteOptions<\n TRouteId,\n TPath,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,\n TParentSearchSchema,\n TSearchSchema,\n Expand<TParentSearchSchema & TSearchSchema>,\n TParentParams,\n TParams,\n Expand<TParentParams & TAllParams>\n >,\n 'path'\n > & { path?: never }\n : RouteOptions<\n TRouteId,\n TPath,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,\n TParentSearchSchema,\n TSearchSchema,\n Expand<TParentSearchSchema & TSearchSchema>,\n TParentParams,\n TParams,\n Expand<TParentParams & TAllParams>\n >,\n children?: TKnownChildren,\n isRoot?: boolean,\n parentId?: string,\n parentPath?: string,\n) => RouteConfig<\n RoutePrefix<TParentId, TResolvedId>,\n TResolvedId,\n TPath,\n string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>,\n TParentRouteLoaderData,\n TRouteLoaderData,\n TParentLoaderData,\n Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,\n TParentSearchSchema,\n TSearchSchema,\n Expand<TParentSearchSchema & TSearchSchema>,\n TParentParams,\n TParams,\n Expand<TParentParams & TAllParams>,\n TKnownChildren\n>\n\ntype RoutePath<T extends string> = T extends RootRouteId\n ? '/'\n : TrimPathRight<`${T}`>\n\ntype RoutePrefix<\n TPrefix extends string,\n TId extends string,\n> = string extends TId\n ? RootRouteId\n : TId extends string\n ? `${TPrefix}/${TId}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TId>}`>}`\n : never\n\nexport interface AnyRouteConfig\n extends RouteConfig<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport interface AnyRouteConfigWithChildren<TChildren>\n extends RouteConfig<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n TChildren\n > {}\n\ntype TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\ntype TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\ntype TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport const createRouteConfig: CreateRouteConfigFn<true> = (\n options = {} as any,\n children = [] as any,\n isRoot = true,\n parentId,\n parentPath,\n) => {\n if (isRoot) {\n ;(options as any).path = rootRouteId\n }\n\n // Strip the root from parentIds\n if (parentId === rootRouteId) {\n parentId = ''\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPath(path)\n }\n\n const routeId = path || (options as { id?: string }).id\n\n let id = joinPaths([parentId, routeId])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : trimPathRight(joinPaths([parentPath, path]))\n\n return {\n id: id as any,\n routeId: routeId as any,\n path: path as any,\n fullPath: fullPath as any,\n options: options as any,\n children,\n addChildren: (children: any) =>\n createRouteConfig(options, children, false, parentId, parentPath),\n createRoute: (childOptions: any) =>\n createRouteConfig(childOptions, undefined, false, id, fullPath) as any,\n generate: () => {\n invariant(\n false,\n `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,\n )\n },\n }\n}\n"],"names":["rootRouteId","createRouteConfig","options","children","isRoot","parentId","parentPath","path","trimPath","routeId","id","joinPaths","fullPath","trimPathRight","addChildren","createRoute","childOptions","undefined","generate","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASO,MAAMA,WAAW,GAAG,WAAmB;AA0avC,MAAMC,iBAA4C,GAAG,CAC1DC,OAAO,GAAG,EAAS,EACnBC,QAAQ,GAAG,EAAS,EACpBC,MAAM,GAAG,IAAI,EACbC,QAAQ,EACRC,UAAU,KACP;AACH,EAAA,IAAIF,MAAM,EAAE;IACRF,OAAO,CAASK,IAAI,GAAGP,WAAW,CAAA;AACtC,GAAA;;AAEA;EACA,IAAIK,QAAQ,KAAKL,WAAW,EAAE;AAC5BK,IAAAA,QAAQ,GAAG,EAAE,CAAA;AACf,GAAA;EAEA,IAAIE,MAAwB,GAAGH,MAAM,GAAGJ,WAAW,GAAGE,OAAO,CAACK,IAAI,CAAA;;AAElE;AACA,EAAA,IAAIA,MAAI,IAAIA,MAAI,KAAK,GAAG,EAAE;AACxBA,IAAAA,MAAI,GAAGC,aAAQ,CAACD,MAAI,CAAC,CAAA;AACvB,GAAA;AAEA,EAAA,MAAME,OAAO,GAAGF,MAAI,IAAKL,OAAO,CAAqBQ,EAAE,CAAA;EAEvD,IAAIA,EAAE,GAAGC,cAAS,CAAC,CAACN,QAAQ,EAAEI,OAAO,CAAC,CAAC,CAAA;EAEvC,IAAIF,MAAI,KAAKP,WAAW,EAAE;AACxBO,IAAAA,MAAI,GAAG,GAAG,CAAA;AACZ,GAAA;EAEA,IAAIG,EAAE,KAAKV,WAAW,EAAE;IACtBU,EAAE,GAAGC,cAAS,CAAC,CAAC,GAAG,EAAED,EAAE,CAAC,CAAC,CAAA;AAC3B,GAAA;AAEA,EAAA,MAAME,QAAQ,GACZF,EAAE,KAAKV,WAAW,GAAG,GAAG,GAAGa,kBAAa,CAACF,cAAS,CAAC,CAACL,UAAU,EAAEC,MAAI,CAAC,CAAC,CAAC,CAAA;EAEzE,OAAO;AACLG,IAAAA,EAAE,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