@tanstack/react-router 0.0.1-beta.32 → 0.0.1-beta.34

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.
@@ -4024,7 +4024,7 @@ var drawChart = (function (exports) {
4024
4024
  </script>
4025
4025
  <script>
4026
4026
  /*<!--*/
4027
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"7bea-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm","children":[{"name":"@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js","uid":"7bea-61"},{"name":"history@5.3.0/node_modules/history/index.js","uid":"7bea-63"},{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"7bea-65"}]},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"7bea-67"},{"name":"react-router/src/index.tsx","uid":"7bea-69"}]}]}],"isRoot":true},"nodeParts":{"7bea-59":{"renderedLength":793,"gzipLength":363,"brotliLength":0,"mainUid":"7bea-58"},"7bea-61":{"renderedLength":435,"gzipLength":241,"brotliLength":0,"mainUid":"7bea-60"},"7bea-63":{"renderedLength":20630,"gzipLength":3800,"brotliLength":0,"mainUid":"7bea-62"},"7bea-65":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"7bea-64"},"7bea-67":{"renderedLength":54705,"gzipLength":12303,"brotliLength":0,"mainUid":"7bea-66"},"7bea-69":{"renderedLength":14166,"gzipLength":3535,"brotliLength":0,"mainUid":"7bea-68"}},"nodeMetas":{"7bea-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"7bea-59"},"imported":[],"importedBy":[{"uid":"7bea-68"}]},"7bea-60":{"id":"/node_modules/.pnpm/@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"7bea-61"},"imported":[],"importedBy":[{"uid":"7bea-62"}]},"7bea-62":{"id":"/node_modules/.pnpm/history@5.3.0/node_modules/history/index.js","moduleParts":{"index.production.js":"7bea-63"},"imported":[{"uid":"7bea-60"}],"importedBy":[{"uid":"7bea-66"}]},"7bea-64":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"7bea-65"},"imported":[],"importedBy":[{"uid":"7bea-66"}]},"7bea-66":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"7bea-67"},"imported":[{"uid":"7bea-62"},{"uid":"7bea-64"}],"importedBy":[{"uid":"7bea-68"}]},"7bea-68":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"7bea-69"},"imported":[{"uid":"7bea-58"},{"uid":"7bea-70"},{"uid":"7bea-71"},{"uid":"7bea-66"}],"importedBy":[],"isEntry":true},"7bea-70":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"7bea-68"}],"isExternal":true},"7bea-71":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"7bea-68"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4027
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"3832-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm","children":[{"name":"@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js","uid":"3832-61"},{"name":"history@5.3.0/node_modules/history/index.js","uid":"3832-63"},{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"3832-65"}]},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"3832-67"},{"name":"react-router/src/index.tsx","uid":"3832-69"}]}]}],"isRoot":true},"nodeParts":{"3832-59":{"renderedLength":793,"gzipLength":363,"brotliLength":0,"mainUid":"3832-58"},"3832-61":{"renderedLength":435,"gzipLength":241,"brotliLength":0,"mainUid":"3832-60"},"3832-63":{"renderedLength":20630,"gzipLength":3800,"brotliLength":0,"mainUid":"3832-62"},"3832-65":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"3832-64"},"3832-67":{"renderedLength":55134,"gzipLength":12415,"brotliLength":0,"mainUid":"3832-66"},"3832-69":{"renderedLength":14166,"gzipLength":3535,"brotliLength":0,"mainUid":"3832-68"}},"nodeMetas":{"3832-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"3832-59"},"imported":[],"importedBy":[{"uid":"3832-68"}]},"3832-60":{"id":"/node_modules/.pnpm/@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js","moduleParts":{"index.production.js":"3832-61"},"imported":[],"importedBy":[{"uid":"3832-62"}]},"3832-62":{"id":"/node_modules/.pnpm/history@5.3.0/node_modules/history/index.js","moduleParts":{"index.production.js":"3832-63"},"imported":[{"uid":"3832-60"}],"importedBy":[{"uid":"3832-66"}]},"3832-64":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"3832-65"},"imported":[],"importedBy":[{"uid":"3832-66"}]},"3832-66":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"3832-67"},"imported":[{"uid":"3832-62"},{"uid":"3832-64"}],"importedBy":[{"uid":"3832-68"}]},"3832-68":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"3832-69"},"imported":[{"uid":"3832-58"},{"uid":"3832-70"},{"uid":"3832-71"},{"uid":"3832-66"}],"importedBy":[],"isEntry":true},"3832-70":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"3832-68"}],"isExternal":true},"3832-71":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"3832-68"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4028
4028
 
4029
4029
  const run = () => {
4030
4030
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "7bea-73",
10
+ "uid": "3832-73",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,15 +15,15 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js",
18
- "uid": "7bea-75"
18
+ "uid": "3832-75"
19
19
  },
20
20
  {
21
21
  "name": "history@5.3.0/node_modules/history/index.js",
22
- "uid": "7bea-77"
22
+ "uid": "3832-77"
23
23
  },
24
24
  {
25
25
  "name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
26
- "uid": "7bea-79"
26
+ "uid": "3832-79"
27
27
  }
28
28
  ]
29
29
  },
@@ -32,11 +32,11 @@
32
32
  "children": [
33
33
  {
34
34
  "name": "router-core/build/esm/index.js",
35
- "uid": "7bea-81"
35
+ "uid": "3832-81"
36
36
  },
37
37
  {
38
38
  "name": "react-router/src/index.tsx",
39
- "uid": "7bea-83"
39
+ "uid": "3832-83"
40
40
  }
41
41
  ]
42
42
  }
@@ -46,155 +46,155 @@
46
46
  "isRoot": true
47
47
  },
48
48
  "nodeParts": {
49
- "7bea-73": {
49
+ "3832-73": {
50
50
  "renderedLength": 793,
51
51
  "gzipLength": 363,
52
52
  "brotliLength": 0,
53
- "mainUid": "7bea-72"
53
+ "mainUid": "3832-72"
54
54
  },
55
- "7bea-75": {
55
+ "3832-75": {
56
56
  "renderedLength": 435,
57
57
  "gzipLength": 241,
58
58
  "brotliLength": 0,
59
- "mainUid": "7bea-74"
59
+ "mainUid": "3832-74"
60
60
  },
61
- "7bea-77": {
61
+ "3832-77": {
62
62
  "renderedLength": 20630,
63
63
  "gzipLength": 3800,
64
64
  "brotliLength": 0,
65
- "mainUid": "7bea-76"
65
+ "mainUid": "3832-76"
66
66
  },
67
- "7bea-79": {
67
+ "3832-79": {
68
68
  "renderedLength": 181,
69
69
  "gzipLength": 129,
70
70
  "brotliLength": 0,
71
- "mainUid": "7bea-78"
71
+ "mainUid": "3832-78"
72
72
  },
73
- "7bea-81": {
74
- "renderedLength": 54705,
75
- "gzipLength": 12303,
73
+ "3832-81": {
74
+ "renderedLength": 55134,
75
+ "gzipLength": 12415,
76
76
  "brotliLength": 0,
77
- "mainUid": "7bea-80"
77
+ "mainUid": "3832-80"
78
78
  },
79
- "7bea-83": {
79
+ "3832-83": {
80
80
  "renderedLength": 14166,
81
81
  "gzipLength": 3535,
82
82
  "brotliLength": 0,
83
- "mainUid": "7bea-82"
83
+ "mainUid": "3832-82"
84
84
  }
85
85
  },
86
86
  "nodeMetas": {
87
- "7bea-72": {
87
+ "3832-72": {
88
88
  "id": "\u0000rollupPluginBabelHelpers.js",
89
89
  "moduleParts": {
90
- "index.production.js": "7bea-73"
90
+ "index.production.js": "3832-73"
91
91
  },
92
92
  "imported": [],
93
93
  "importedBy": [
94
94
  {
95
- "uid": "7bea-82"
95
+ "uid": "3832-82"
96
96
  }
97
97
  ]
98
98
  },
99
- "7bea-74": {
99
+ "3832-74": {
100
100
  "id": "/node_modules/.pnpm/@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js",
101
101
  "moduleParts": {
102
- "index.production.js": "7bea-75"
102
+ "index.production.js": "3832-75"
103
103
  },
104
104
  "imported": [],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "7bea-76"
107
+ "uid": "3832-76"
108
108
  }
109
109
  ]
110
110
  },
111
- "7bea-76": {
111
+ "3832-76": {
112
112
  "id": "/node_modules/.pnpm/history@5.3.0/node_modules/history/index.js",
113
113
  "moduleParts": {
114
- "index.production.js": "7bea-77"
114
+ "index.production.js": "3832-77"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "7bea-74"
118
+ "uid": "3832-74"
119
119
  }
120
120
  ],
121
121
  "importedBy": [
122
122
  {
123
- "uid": "7bea-80"
123
+ "uid": "3832-80"
124
124
  }
125
125
  ]
126
126
  },
127
- "7bea-78": {
127
+ "3832-78": {
128
128
  "id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
129
129
  "moduleParts": {
130
- "index.production.js": "7bea-79"
130
+ "index.production.js": "3832-79"
131
131
  },
132
132
  "imported": [],
133
133
  "importedBy": [
134
134
  {
135
- "uid": "7bea-80"
135
+ "uid": "3832-80"
136
136
  }
137
137
  ]
138
138
  },
139
- "7bea-80": {
139
+ "3832-80": {
140
140
  "id": "/packages/router-core/build/esm/index.js",
141
141
  "moduleParts": {
142
- "index.production.js": "7bea-81"
142
+ "index.production.js": "3832-81"
143
143
  },
144
144
  "imported": [
145
145
  {
146
- "uid": "7bea-76"
146
+ "uid": "3832-76"
147
147
  },
148
148
  {
149
- "uid": "7bea-78"
149
+ "uid": "3832-78"
150
150
  }
151
151
  ],
152
152
  "importedBy": [
153
153
  {
154
- "uid": "7bea-82"
154
+ "uid": "3832-82"
155
155
  }
156
156
  ]
157
157
  },
158
- "7bea-82": {
158
+ "3832-82": {
159
159
  "id": "/packages/react-router/src/index.tsx",
160
160
  "moduleParts": {
161
- "index.production.js": "7bea-83"
161
+ "index.production.js": "3832-83"
162
162
  },
163
163
  "imported": [
164
164
  {
165
- "uid": "7bea-72"
165
+ "uid": "3832-72"
166
166
  },
167
167
  {
168
- "uid": "7bea-84"
168
+ "uid": "3832-84"
169
169
  },
170
170
  {
171
- "uid": "7bea-85"
171
+ "uid": "3832-85"
172
172
  },
173
173
  {
174
- "uid": "7bea-80"
174
+ "uid": "3832-80"
175
175
  }
176
176
  ],
177
177
  "importedBy": [],
178
178
  "isEntry": true
179
179
  },
180
- "7bea-84": {
180
+ "3832-84": {
181
181
  "id": "react",
182
182
  "moduleParts": {},
183
183
  "imported": [],
184
184
  "importedBy": [
185
185
  {
186
- "uid": "7bea-82"
186
+ "uid": "3832-82"
187
187
  }
188
188
  ],
189
189
  "isExternal": true
190
190
  },
191
- "7bea-85": {
191
+ "3832-85": {
192
192
  "id": "use-sync-external-store/shim",
193
193
  "moduleParts": {},
194
194
  "imported": [],
195
195
  "importedBy": [
196
196
  {
197
- "uid": "7bea-82"
197
+ "uid": "3832-82"
198
198
  }
199
199
  ],
200
200
  "isExternal": true
@@ -1078,8 +1078,8 @@
1078
1078
  return segment.value;
1079
1079
  }));
1080
1080
  }
1081
- function matchPathname(currentPathname, matchLocation) {
1082
- const pathParams = matchByPath(currentPathname, matchLocation);
1081
+ function matchPathname(basepath, currentPathname, matchLocation) {
1082
+ const pathParams = matchByPath(basepath, currentPathname, matchLocation);
1083
1083
  // const searchMatched = matchBySearch(currentLocation.search, matchLocation)
1084
1084
 
1085
1085
  if (matchLocation.to && !pathParams) {
@@ -1087,10 +1087,15 @@
1087
1087
  }
1088
1088
  return pathParams != null ? pathParams : {};
1089
1089
  }
1090
- function matchByPath(from, matchLocation) {
1090
+ function matchByPath(basepath, from, matchLocation) {
1091
1091
  var _matchLocation$to;
1092
+ if (basepath && !from.startsWith(basepath)) {
1093
+ return undefined;
1094
+ }
1095
+ from = from.startsWith(basepath) ? from.substring(basepath.length) : from;
1092
1096
  const baseSegments = parsePathname(from);
1093
- const routeSegments = parsePathname("" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*'));
1097
+ const to = "" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*');
1098
+ const routeSegments = parsePathname(to);
1094
1099
  const params = {};
1095
1100
  let isMatch = (() => {
1096
1101
  for (let i = 0; i < Math.max(baseSegments.length, routeSegments.length); i++) {
@@ -1701,7 +1706,7 @@
1701
1706
  });
1702
1707
  },
1703
1708
  mount: () => {
1704
- const next = router.__.buildLocation({
1709
+ router.__.buildLocation({
1705
1710
  to: '.',
1706
1711
  search: true,
1707
1712
  hash: true
@@ -1709,9 +1714,10 @@
1709
1714
 
1710
1715
  // If the current location isn't updated, trigger a navigation
1711
1716
  // to the current location. Otherwise, load the current location.
1712
- if (next.href !== router.__location.href) {
1713
- router.__.commitLocation(next, true);
1714
- }
1717
+ // if (next.href !== router.__location.href) {
1718
+ // router.__.commitLocation(next, true)
1719
+ // }
1720
+
1715
1721
  if (!router.state.matches.length) {
1716
1722
  router.load();
1717
1723
  }
@@ -1739,6 +1745,7 @@
1739
1745
  router.load();
1740
1746
  },
1741
1747
  update: opts => {
1748
+ var _trimPath;
1742
1749
  const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1743
1750
  if (!router.__location || newHistory) {
1744
1751
  if (opts != null && opts.history) {
@@ -1752,7 +1759,7 @@
1752
1759
  basepath,
1753
1760
  routeConfig
1754
1761
  } = router.options;
1755
- router.basepath = cleanPath("/" + (basepath != null ? basepath : ''));
1762
+ router.basepath = "/" + ((_trimPath = trimPath(basepath != null ? basepath : '')) != null ? _trimPath : '');
1756
1763
  if (routeConfig) {
1757
1764
  router.routesById = {};
1758
1765
  router.routeTree = router.__.buildRouteTree(routeConfig);
@@ -1950,7 +1957,7 @@
1950
1957
  return findMatchInRoutes([...foundRoutes, route], route.childRoutes);
1951
1958
  }
1952
1959
  const fuzzy = !!(route.routePath !== '/' || (_route$childRoutes2 = route.childRoutes) != null && _route$childRoutes2.length);
1953
- const matchParams = matchPathname(pathname, {
1960
+ const matchParams = matchPathname(router.basepath, pathname, {
1954
1961
  to: route.fullPath,
1955
1962
  fuzzy,
1956
1963
  caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
@@ -2001,14 +2008,15 @@
2001
2008
  },
2002
2009
  loadMatches: async (resolvedMatches, loaderOpts) => {
2003
2010
  const matchPromises = resolvedMatches.map(async match => {
2011
+ var _search$__data;
2004
2012
  // Validate the match (loads search params etc)
2005
2013
  match.__.validate();
2006
- match.load(loaderOpts);
2007
2014
  const search = match.search;
2008
- if (search.__data && search.__data.matchId !== match.matchId) {
2015
+ if ((_search$__data = search.__data) != null && _search$__data.matchId && search.__data.matchId !== match.matchId) {
2009
2016
  return;
2010
2017
  }
2011
- if (match.__.loadPromise) {
2018
+ match.load(loaderOpts);
2019
+ if (match.status !== 'success' && match.__.loadPromise) {
2012
2020
  // Wait for the first sign of activity from the match
2013
2021
  await match.__.loadPromise;
2014
2022
  }
@@ -2087,11 +2095,11 @@
2087
2095
  if (!((_router$state$pending7 = router.state.pending) != null && _router$state$pending7.location)) {
2088
2096
  return false;
2089
2097
  }
2090
- return !!matchPathname(router.state.pending.location.pathname, _extends({}, opts, {
2098
+ return !!matchPathname(router.basepath, router.state.pending.location.pathname, _extends({}, opts, {
2091
2099
  to: next.pathname
2092
2100
  }));
2093
2101
  }
2094
- return !!matchPathname(router.state.location.pathname, _extends({}, opts, {
2102
+ return !!matchPathname(router.basepath, router.state.location.pathname, _extends({}, opts, {
2095
2103
  to: next.pathname
2096
2104
  }));
2097
2105
  },