@tanstack/react-router 0.0.1-beta.83 → 1.0.0

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 (225) hide show
  1. package/LICENSE +1 -1
  2. package/build/cjs/CatchBoundary.js +128 -0
  3. package/build/cjs/CatchBoundary.js.map +1 -0
  4. package/build/cjs/Matches.js +233 -0
  5. package/build/cjs/Matches.js.map +1 -0
  6. package/build/cjs/RouterProvider.js +170 -0
  7. package/build/cjs/RouterProvider.js.map +1 -0
  8. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -4
  9. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  10. package/build/cjs/_virtual/with-selector.development.js +16 -0
  11. package/build/cjs/_virtual/with-selector.development.js.map +1 -0
  12. package/build/cjs/_virtual/with-selector.js +16 -0
  13. package/build/cjs/_virtual/with-selector.js.map +1 -0
  14. package/build/cjs/_virtual/with-selector.production.min.js +16 -0
  15. package/build/cjs/_virtual/with-selector.production.min.js.map +1 -0
  16. package/build/cjs/awaited.js +43 -0
  17. package/build/cjs/awaited.js.map +1 -0
  18. package/build/cjs/build/esm/index.js +79 -0
  19. package/build/cjs/build/esm/index.js.map +1 -0
  20. package/build/cjs/defer.js +37 -0
  21. package/build/cjs/defer.js.map +1 -0
  22. package/build/cjs/fileRoute.js +27 -0
  23. package/build/cjs/fileRoute.js.map +1 -0
  24. package/build/cjs/index.js +113 -451
  25. package/build/cjs/index.js.map +1 -1
  26. package/build/cjs/lazyRouteComponent.js +54 -0
  27. package/build/cjs/lazyRouteComponent.js.map +1 -0
  28. package/build/cjs/link.js +223 -0
  29. package/build/cjs/link.js.map +1 -0
  30. package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js +47 -0
  31. package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js.map +1 -0
  32. package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js +70 -0
  33. package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js.map +1 -0
  34. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +188 -0
  35. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
  36. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +39 -0
  37. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -0
  38. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js +26 -0
  39. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
  40. package/build/cjs/packages/react-router/src/CatchBoundary.js +123 -0
  41. package/build/cjs/packages/react-router/src/CatchBoundary.js.map +1 -0
  42. package/build/cjs/packages/react-router/src/Matches.js +235 -0
  43. package/build/cjs/packages/react-router/src/Matches.js.map +1 -0
  44. package/build/cjs/packages/react-router/src/RouterProvider.js +144 -0
  45. package/build/cjs/packages/react-router/src/RouterProvider.js.map +1 -0
  46. package/build/cjs/packages/react-router/src/awaited.js +43 -0
  47. package/build/cjs/packages/react-router/src/awaited.js.map +1 -0
  48. package/build/cjs/packages/react-router/src/defer.js +37 -0
  49. package/build/cjs/packages/react-router/src/defer.js.map +1 -0
  50. package/build/cjs/packages/react-router/src/fileRoute.js +27 -0
  51. package/build/cjs/packages/react-router/src/fileRoute.js.map +1 -0
  52. package/build/cjs/packages/react-router/src/index.js +61 -0
  53. package/build/cjs/packages/react-router/src/index.js.map +1 -0
  54. package/build/cjs/packages/react-router/src/lazyRouteComponent.js +54 -0
  55. package/build/cjs/packages/react-router/src/lazyRouteComponent.js.map +1 -0
  56. package/build/cjs/packages/react-router/src/link.js +148 -0
  57. package/build/cjs/packages/react-router/src/link.js.map +1 -0
  58. package/build/cjs/packages/react-router/src/path.js +209 -0
  59. package/build/cjs/packages/react-router/src/path.js.map +1 -0
  60. package/build/cjs/packages/react-router/src/qss.js +63 -0
  61. package/build/cjs/packages/react-router/src/qss.js.map +1 -0
  62. package/build/cjs/packages/react-router/src/react.js +634 -0
  63. package/build/cjs/packages/react-router/src/react.js.map +1 -0
  64. package/build/cjs/packages/react-router/src/redirects.js +25 -0
  65. package/build/cjs/packages/react-router/src/redirects.js.map +1 -0
  66. package/build/cjs/packages/react-router/src/route.js +134 -0
  67. package/build/cjs/packages/react-router/src/route.js.map +1 -0
  68. package/build/cjs/packages/react-router/src/router.js +1111 -0
  69. package/build/cjs/packages/react-router/src/router.js.map +1 -0
  70. package/build/cjs/packages/react-router/src/scroll-restoration.js +53 -0
  71. package/build/cjs/packages/react-router/src/scroll-restoration.js.map +1 -0
  72. package/build/cjs/packages/react-router/src/searchParams.js +81 -0
  73. package/build/cjs/packages/react-router/src/searchParams.js.map +1 -0
  74. package/build/cjs/packages/react-router/src/useBlocker.js +61 -0
  75. package/build/cjs/packages/react-router/src/useBlocker.js.map +1 -0
  76. package/build/cjs/packages/react-router/src/useNavigate.js +75 -0
  77. package/build/cjs/packages/react-router/src/useNavigate.js.map +1 -0
  78. package/build/cjs/packages/react-router/src/useParams.js +26 -0
  79. package/build/cjs/packages/react-router/src/useParams.js.map +1 -0
  80. package/build/cjs/packages/react-router/src/useSearch.js +25 -0
  81. package/build/cjs/packages/react-router/src/useSearch.js.map +1 -0
  82. package/build/cjs/packages/react-router/src/utils.js +239 -0
  83. package/build/cjs/packages/react-router/src/utils.js.map +1 -0
  84. package/build/cjs/path.js +214 -0
  85. package/build/cjs/path.js.map +1 -0
  86. package/build/cjs/qss.js +63 -0
  87. package/build/cjs/qss.js.map +1 -0
  88. package/build/cjs/react/CatchBoundary.js +123 -0
  89. package/build/cjs/react/CatchBoundary.js.map +1 -0
  90. package/build/cjs/react/awaited.js +43 -0
  91. package/build/cjs/react/awaited.js.map +1 -0
  92. package/build/cjs/react/defer.js +37 -0
  93. package/build/cjs/react/defer.js.map +1 -0
  94. package/build/cjs/react.js +650 -0
  95. package/build/cjs/react.js.map +1 -0
  96. package/build/cjs/redirects.js +28 -0
  97. package/build/cjs/redirects.js.map +1 -0
  98. package/build/cjs/route.js +191 -0
  99. package/build/cjs/route.js.map +1 -0
  100. package/build/cjs/router.js +1085 -0
  101. package/build/cjs/router.js.map +1 -0
  102. package/build/cjs/routerConfig.js +209 -0
  103. package/build/cjs/routerConfig.js.map +1 -0
  104. package/build/cjs/scroll-restoration.js +202 -0
  105. package/build/cjs/scroll-restoration.js.map +1 -0
  106. package/build/cjs/searchParams.js +81 -0
  107. package/build/cjs/searchParams.js.map +1 -0
  108. package/build/cjs/src/CatchBoundary.js +126 -0
  109. package/build/cjs/src/CatchBoundary.js.map +1 -0
  110. package/build/cjs/src/Matches.js +235 -0
  111. package/build/cjs/src/Matches.js.map +1 -0
  112. package/build/cjs/src/RouterProvider.js +1051 -0
  113. package/build/cjs/src/RouterProvider.js.map +1 -0
  114. package/build/cjs/src/awaited.js +45 -0
  115. package/build/cjs/src/awaited.js.map +1 -0
  116. package/build/cjs/src/defer.js +39 -0
  117. package/build/cjs/src/defer.js.map +1 -0
  118. package/build/cjs/src/fileRoute.js +29 -0
  119. package/build/cjs/src/fileRoute.js.map +1 -0
  120. package/build/cjs/src/index.js +134 -0
  121. package/build/cjs/src/index.js.map +1 -0
  122. package/build/cjs/src/lazyRouteComponent.js +57 -0
  123. package/build/cjs/src/lazyRouteComponent.js.map +1 -0
  124. package/build/cjs/src/link.js +151 -0
  125. package/build/cjs/src/link.js.map +1 -0
  126. package/build/cjs/src/path.js +211 -0
  127. package/build/cjs/src/path.js.map +1 -0
  128. package/build/cjs/src/qss.js +65 -0
  129. package/build/cjs/src/qss.js.map +1 -0
  130. package/build/cjs/src/redirects.js +27 -0
  131. package/build/cjs/src/redirects.js.map +1 -0
  132. package/build/cjs/src/route.js +139 -0
  133. package/build/cjs/src/route.js.map +1 -0
  134. package/build/cjs/src/router.js +203 -0
  135. package/build/cjs/src/router.js.map +1 -0
  136. package/build/cjs/src/scroll-restoration.js +186 -0
  137. package/build/cjs/src/scroll-restoration.js.map +1 -0
  138. package/build/cjs/src/searchParams.js +83 -0
  139. package/build/cjs/src/searchParams.js.map +1 -0
  140. package/build/cjs/src/useBlocker.js +64 -0
  141. package/build/cjs/src/useBlocker.js.map +1 -0
  142. package/build/cjs/src/useNavigate.js +78 -0
  143. package/build/cjs/src/useNavigate.js.map +1 -0
  144. package/build/cjs/src/useParams.js +28 -0
  145. package/build/cjs/src/useParams.js.map +1 -0
  146. package/build/cjs/src/useSearch.js +27 -0
  147. package/build/cjs/src/useSearch.js.map +1 -0
  148. package/build/cjs/src/utils.js +230 -0
  149. package/build/cjs/src/utils.js.map +1 -0
  150. package/build/cjs/useBlocker.js +55 -0
  151. package/build/cjs/useBlocker.js.map +1 -0
  152. package/build/cjs/useNavigate.js +86 -0
  153. package/build/cjs/useNavigate.js.map +1 -0
  154. package/build/cjs/useParams.js +26 -0
  155. package/build/cjs/useParams.js.map +1 -0
  156. package/build/cjs/useSearch.js +25 -0
  157. package/build/cjs/useSearch.js.map +1 -0
  158. package/build/cjs/useStore.js +99 -0
  159. package/build/cjs/useStore.js.map +1 -0
  160. package/build/cjs/utils.js +241 -0
  161. package/build/cjs/utils.js.map +1 -0
  162. package/build/esm/index.js +2581 -337
  163. package/build/esm/index.js.map +1 -1
  164. package/build/stats-html.html +3494 -2700
  165. package/build/stats-react.json +1134 -87
  166. package/build/types/CatchBoundary.d.ts +36 -0
  167. package/build/types/Matches.d.ts +64 -0
  168. package/build/types/RouteMatch.d.ts +23 -0
  169. package/build/types/RouterProvider.d.ts +35 -0
  170. package/build/types/awaited.d.ts +9 -0
  171. package/build/types/defer.d.ts +19 -0
  172. package/build/types/fileRoute.d.ts +38 -0
  173. package/build/types/history.d.ts +7 -0
  174. package/build/types/index.d.ts +911 -88
  175. package/build/types/injectHtml.d.ts +0 -0
  176. package/build/types/lazyRouteComponent.d.ts +2 -0
  177. package/build/types/link.d.ts +93 -0
  178. package/build/types/location.d.ts +12 -0
  179. package/build/types/path.d.ts +17 -0
  180. package/build/types/qss.d.ts +2 -0
  181. package/build/types/react/CatchBoundary.d.ts +33 -0
  182. package/build/types/react/awaited.d.ts +9 -0
  183. package/build/types/react/defer.d.ts +19 -0
  184. package/build/types/react.d.ts +141 -0
  185. package/build/types/redirects.d.ts +11 -0
  186. package/build/types/route.d.ts +283 -0
  187. package/build/types/routeInfo.d.ts +31 -0
  188. package/build/types/router.d.ts +186 -0
  189. package/build/types/scroll-restoration.d.ts +18 -0
  190. package/build/types/searchParams.d.ts +7 -0
  191. package/build/types/useBlocker.d.ts +9 -0
  192. package/build/types/useNavigate.d.ts +19 -0
  193. package/build/types/useParams.d.ts +7 -0
  194. package/build/types/useSearch.d.ts +7 -0
  195. package/build/types/useStore.d.ts +12 -0
  196. package/build/types/utils.d.ts +69 -0
  197. package/build/umd/index.development.js +2829 -1796
  198. package/build/umd/index.development.js.map +1 -1
  199. package/build/umd/index.production.js +4 -24
  200. package/build/umd/index.production.js.map +1 -1
  201. package/package.json +9 -7
  202. package/src/CatchBoundary.tsx +101 -0
  203. package/src/Matches.tsx +423 -0
  204. package/src/RouterProvider.tsx +252 -0
  205. package/src/awaited.tsx +40 -0
  206. package/src/defer.ts +55 -0
  207. package/src/fileRoute.ts +152 -0
  208. package/src/history.ts +8 -0
  209. package/src/index.tsx +28 -747
  210. package/src/lazyRouteComponent.tsx +33 -0
  211. package/src/link.tsx +603 -0
  212. package/src/location.ts +13 -0
  213. package/src/path.ts +261 -0
  214. package/src/qss.ts +53 -0
  215. package/src/redirects.ts +39 -0
  216. package/src/route.ts +882 -0
  217. package/src/routeInfo.ts +84 -0
  218. package/src/router.ts +1671 -0
  219. package/src/scroll-restoration.tsx +230 -0
  220. package/src/searchParams.ts +79 -0
  221. package/src/useBlocker.tsx +27 -0
  222. package/src/useNavigate.tsx +111 -0
  223. package/src/useParams.tsx +25 -0
  224. package/src/useSearch.tsx +25 -0
  225. package/src/utils.ts +360 -0
@@ -0,0 +1,209 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
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
+ var utils = require('./utils.js');
14
+
15
+ function joinPaths(paths) {
16
+ return cleanPath(paths.filter(Boolean).join('/'));
17
+ }
18
+ function cleanPath(path) {
19
+ // remove double slashes
20
+ return path.replace(/\/{2,}/g, '/');
21
+ }
22
+ function trimPathLeft(path) {
23
+ return path === '/' ? path : path.replace(/^\/{1,}/, '');
24
+ }
25
+ function trimPathRight(path) {
26
+ return path === '/' ? path : path.replace(/\/{1,}$/, '');
27
+ }
28
+ function trimPath(path) {
29
+ return trimPathRight(trimPathLeft(path));
30
+ }
31
+ function resolvePath(basepath, base, to) {
32
+ base = base.replace(new RegExp(`^${basepath}`), '/');
33
+ to = to.replace(new RegExp(`^${basepath}`), '/');
34
+ let baseSegments = parsePathname(base);
35
+ const toSegments = parsePathname(to);
36
+ toSegments.forEach((toSegment, index) => {
37
+ if (toSegment.value === '/') {
38
+ if (!index) {
39
+ // Leading slash
40
+ baseSegments = [toSegment];
41
+ } else if (index === toSegments.length - 1) {
42
+ // Trailing Slash
43
+ baseSegments.push(toSegment);
44
+ } else ;
45
+ } else if (toSegment.value === '..') {
46
+ // Extra trailing slash? pop it off
47
+ if (baseSegments.length > 1 && utils.last(baseSegments)?.value === '/') {
48
+ baseSegments.pop();
49
+ }
50
+ baseSegments.pop();
51
+ } else if (toSegment.value === '.') {
52
+ return;
53
+ } else {
54
+ baseSegments.push(toSegment);
55
+ }
56
+ });
57
+ const joined = joinPaths([basepath, ...baseSegments.map(d => d.value)]);
58
+ return cleanPath(joined);
59
+ }
60
+ function parsePathname(pathname) {
61
+ if (!pathname) {
62
+ return [];
63
+ }
64
+ pathname = cleanPath(pathname);
65
+ const segments = [];
66
+ if (pathname.slice(0, 1) === '/') {
67
+ pathname = pathname.substring(1);
68
+ segments.push({
69
+ type: 'pathname',
70
+ value: '/'
71
+ });
72
+ }
73
+ if (!pathname) {
74
+ return segments;
75
+ }
76
+
77
+ // Remove empty segments and '.' segments
78
+ const split = pathname.split('/').filter(Boolean);
79
+ segments.push(...split.map(part => {
80
+ if (part === '$' || part === '*') {
81
+ return {
82
+ type: 'wildcard',
83
+ value: part
84
+ };
85
+ }
86
+ if (part.charAt(0) === '$') {
87
+ return {
88
+ type: 'param',
89
+ value: part
90
+ };
91
+ }
92
+ return {
93
+ type: 'pathname',
94
+ value: part
95
+ };
96
+ }));
97
+ if (pathname.slice(-1) === '/') {
98
+ pathname = pathname.substring(1);
99
+ segments.push({
100
+ type: 'pathname',
101
+ value: '/'
102
+ });
103
+ }
104
+ return segments;
105
+ }
106
+ function interpolatePath(path, params, leaveWildcards = false) {
107
+ const interpolatedPathSegments = parsePathname(path);
108
+ return joinPaths(interpolatedPathSegments.map(segment => {
109
+ if (segment.type === 'wildcard') {
110
+ const value = params[segment.value];
111
+ if (leaveWildcards) return `${segment.value}${value ?? ''}`;
112
+ return value;
113
+ }
114
+ if (segment.type === 'param') {
115
+ return params[segment.value.substring(1)] ?? '';
116
+ }
117
+ return segment.value;
118
+ }));
119
+ }
120
+ function matchPathname(basepath, currentPathname, matchLocation) {
121
+ const pathParams = matchByPath(basepath, currentPathname, matchLocation);
122
+ // const searchMatched = matchBySearch(location.search, matchLocation)
123
+
124
+ if (matchLocation.to && !pathParams) {
125
+ return;
126
+ }
127
+ return pathParams ?? {};
128
+ }
129
+ function matchByPath(basepath, from, matchLocation) {
130
+ // Remove the base path from the pathname
131
+ from = basepath != '/' ? from.substring(basepath.length) : from;
132
+ // Default to to $ (wildcard)
133
+ const to = `${matchLocation.to ?? '$'}`;
134
+ // Parse the from and to
135
+ const baseSegments = parsePathname(from);
136
+ const routeSegments = parsePathname(to);
137
+ if (!from.startsWith('/')) {
138
+ baseSegments.unshift({
139
+ type: 'pathname',
140
+ value: '/'
141
+ });
142
+ }
143
+ if (!to.startsWith('/')) {
144
+ routeSegments.unshift({
145
+ type: 'pathname',
146
+ value: '/'
147
+ });
148
+ }
149
+ const params = {};
150
+ let isMatch = (() => {
151
+ for (let i = 0; i < Math.max(baseSegments.length, routeSegments.length); i++) {
152
+ const baseSegment = baseSegments[i];
153
+ const routeSegment = routeSegments[i];
154
+ const isLastBaseSegment = i >= baseSegments.length - 1;
155
+ const isLastRouteSegment = i >= routeSegments.length - 1;
156
+ if (routeSegment) {
157
+ if (routeSegment.type === 'wildcard') {
158
+ if (baseSegment?.value) {
159
+ params['*'] = joinPaths(baseSegments.slice(i).map(d => d.value));
160
+ return true;
161
+ }
162
+ return false;
163
+ }
164
+ if (routeSegment.type === 'pathname') {
165
+ if (routeSegment.value === '/' && !baseSegment?.value) {
166
+ return true;
167
+ }
168
+ if (baseSegment) {
169
+ if (matchLocation.caseSensitive) {
170
+ if (routeSegment.value !== baseSegment.value) {
171
+ return false;
172
+ }
173
+ } else if (routeSegment.value.toLowerCase() !== baseSegment.value.toLowerCase()) {
174
+ return false;
175
+ }
176
+ }
177
+ }
178
+ if (!baseSegment) {
179
+ return false;
180
+ }
181
+ if (routeSegment.type === 'param') {
182
+ if (baseSegment?.value === '/') {
183
+ return false;
184
+ }
185
+ if (baseSegment.value.charAt(0) !== '$') {
186
+ params[routeSegment.value.substring(1)] = baseSegment.value;
187
+ }
188
+ }
189
+ }
190
+ if (!isLastBaseSegment && isLastRouteSegment) {
191
+ return !!matchLocation.fuzzy;
192
+ }
193
+ }
194
+ return true;
195
+ })();
196
+ return isMatch ? params : undefined;
197
+ }
198
+
199
+ exports.cleanPath = cleanPath;
200
+ exports.interpolatePath = interpolatePath;
201
+ exports.joinPaths = joinPaths;
202
+ exports.matchByPath = matchByPath;
203
+ exports.matchPathname = matchPathname;
204
+ exports.parsePathname = parsePathname;
205
+ exports.resolvePath = resolvePath;
206
+ exports.trimPath = trimPath;
207
+ exports.trimPathLeft = trimPathLeft;
208
+ exports.trimPathRight = trimPathRight;
209
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sources":["../../../../../src/path.ts"],"sourcesContent":["import { MatchLocation } from './RouterProvider'\nimport { AnyPathParams } from './route'\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 === '$' || part === '*') {\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 leaveWildcards: boolean = false,\n) {\n const interpolatedPathSegments = parsePathname(path)\n\n return joinPaths(\n interpolatedPathSegments.map((segment) => {\n if (segment.type === 'wildcard') {\n const value = params[segment.value]\n if (leaveWildcards) return `${segment.value}${value ?? ''}`\n return value\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(location.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 // Remove the base path from the pathname\n from = basepath != '/' ? from.substring(basepath.length) : from\n // Default to to $ (wildcard)\n const to = `${matchLocation.to ?? '$'}`\n // Parse the from and to\n const baseSegments = parsePathname(from)\n const routeSegments = parsePathname(to)\n\n if (!from.startsWith('/')) {\n baseSegments.unshift({\n type: 'pathname',\n value: '/',\n })\n }\n\n if (!to.startsWith('/')) {\n routeSegments.unshift({\n type: 'pathname',\n value: '/',\n })\n }\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 isLastBaseSegment = i >= baseSegments.length - 1\n const isLastRouteSegment = i >= routeSegments.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 (!isLastBaseSegment && isLastRouteSegment) {\n return !!matchLocation.fuzzy\n }\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","charAt","interpolatePath","params","leaveWildcards","interpolatedPathSegments","segment","matchPathname","currentPathname","matchLocation","pathParams","matchByPath","from","routeSegments","startsWith","unshift","isMatch","i","Math","max","baseSegment","routeSegment","isLastBaseSegment","isLastRouteSegment","caseSensitive","toLowerCase","fuzzy","undefined"],"mappings":";;;;;;;;;;;;;;AASO,SAASA,SAASA,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,SAASA,CAACI,IAAY,EAAE;AACtC;AACA,EAAA,OAAOA,IAAI,CAACC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AACrC,CAAA;AAEO,SAASC,YAAYA,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,aAAaA,CAACH,IAAY,EAAE;AAC1C,EAAA,OAAOA,IAAI,KAAK,GAAG,GAAGA,IAAI,GAAGA,IAAI,CAACC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;AAC1D,CAAA;AAEO,SAASG,QAAQA,CAACJ,IAAY,EAAE;AACrC,EAAA,OAAOG,aAAa,CAACD,YAAY,CAACF,IAAI,CAAC,CAAC,CAAA;AAC1C,CAAA;AAEO,SAASK,WAAWA,CAACC,QAAgB,EAAEC,IAAY,EAAEC,EAAU,EAAE;AACtED,EAAAA,IAAI,GAAGA,IAAI,CAACN,OAAO,CAAC,IAAIQ,MAAM,CAAE,CAAA,CAAA,EAAGH,QAAS,CAAA,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AACpDE,EAAAA,EAAE,GAA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ACF,WAAA;AACF,SAAA;QAEA,IAAI,CAACL,WAAW,EAAE;AAChB,UAAA,OAAO,KAAK,CAAA;AACd,SAAA;AAEA,QAAA,IAAIC,YAAY,CAACvB,IAAI,KAAK,OAAO,EAAE;AACjC,UAAA,IAAIsB,WAAW,EAAElC,KAAK,KAAK,GAAG,EAAE;AAC9B,YAAA,OAAO,KAAK,CAAA;AACd,WAAA;UACA,IAAIkC,WAAW,CAAClC,KAAK,CAACe,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACvCE,YAAAA,MAAM,CAACkB,YAAY,CAACnC,KAAK,CAACW,SAAS,CAAC,CAAC,CAAC,CAAC,GAAGuB,WAAW,CAAClC,KAAK,CAAA;AAC7D,WAAA;AACF,SAAA;AACF,OAAA;AAEA,MAAA,IAAI,CAACoC,iBAAiB,IAAIC,kBAAkB,EAAE;AAC5C,QAAA,OAAO,CAAC,CAACd,aAAa,CAACiB,KAAK,CAAA;AAC9B,OAAA;AACF,KAAA;AAEA,IAAA,OAAO,IAAI,CAAA;AACb,GAAC,GAAG,CAAA;AAEJ,EAAA,OAAOV,OAAO,GAAIb,MAAM,GAA8BwB,SAAS,CAAA;AACjE;;;;;;;;;;;;;"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
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
+ // @ts-nocheck
14
+
15
+ // 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.
16
+
17
+ function encode(obj, pfx) {
18
+ var k,
19
+ i,
20
+ tmp,
21
+ str = '';
22
+ for (k in obj) {
23
+ if ((tmp = obj[k]) !== void 0) {
24
+ if (Array.isArray(tmp)) {
25
+ for (i = 0; i < tmp.length; i++) {
26
+ str && (str += '&');
27
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i]);
28
+ }
29
+ } else {
30
+ str && (str += '&');
31
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp);
32
+ }
33
+ }
34
+ }
35
+ return (pfx || '') + str;
36
+ }
37
+ function toValue(mix) {
38
+ if (!mix) return '';
39
+ var str = decodeURIComponent(mix);
40
+ if (str === 'false') return false;
41
+ if (str === 'true') return true;
42
+ return +str * 0 === 0 && +str + '' === str ? +str : str;
43
+ }
44
+ function decode(str) {
45
+ var tmp,
46
+ k,
47
+ out = {},
48
+ arr = str.split('&');
49
+ while (tmp = arr.shift()) {
50
+ tmp = tmp.split('=');
51
+ k = tmp.shift();
52
+ if (out[k] !== void 0) {
53
+ out[k] = [].concat(out[k], toValue(tmp.shift()));
54
+ } else {
55
+ out[k] = toValue(tmp.shift());
56
+ }
57
+ }
58
+ return out;
59
+ }
60
+
61
+ exports.decode = decode;
62
+ exports.encode = encode;
63
+ //# sourceMappingURL=qss.js.map
@@ -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 return +str * 0 === 0 && +str + '' === str ? +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","decode","out","arr","split","shift","concat"],"mappings":";;;;;;;;;;;;AAAA;;AAEA;;AAEO,SAASA,MAAMA,CAACC,GAAG,EAAEC,GAAY,EAAE;AACxC,EAAA,IAAIC,CAAC;IACHC,CAAC;IACDC,GAAG;AACHC,IAAAA,GAAG,GAAG,EAAE,CAAA;EAEV,KAAKH,CAAC,IAAIF,GAAG,EAAE;IACb,IAAI,CAACI,GAAG,GAAGJ,GAAG,CAACE,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7B,MAAA,IAAII,KAAK,CAACC,OAAO,CAACH,GAAG,CAAC,EAAE;AACtB,QAAA,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,GAAG,CAACI,MAAM,EAAEL,CAAC,EAAE,EAAE;AAC/BE,UAAAA,GAAG,KAAKA,GAAG,IAAI,GAAG,CAAC,CAAA;AACnBA,UAAAA,GAAG,IAAII,kBAAkB,CAACP,CAAC,CAAC,GAAG,GAAG,GAAGO,kBAAkB,CAACL,GAAG,CAACD,CAAC,CAAC,CAAC,CAAA;AACjE,SAAA;AACF,OAAC,MAAM;AACLE,QAAAA,GAAG,KAAKA,GAAG,IAAI,GAAG,CAAC,CAAA;QACnBA,GAAG,IAAII,kBAAkB,CAACP,CAAC,CAAC,GAAG,GAAG,GAAGO,kBAAkB,CAACL,GAAG,CAAC,CAAA;AAC9D,OAAA;AACF,KAAA;AACF,GAAA;AAEA,EAAA,OAAO,CAACH,GAAG,IAAI,EAAE,IAAII,GAAG,CAAA;AAC1B,CAAA;AAEA,SAASK,OAAOA,CAACC,GAAG,EAAE;AACpB,EAAA,IAAI,CAACA,GAAG,EAAE,OAAO,EAAE,CAAA;AAC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