@tanstack/react-router 0.0.1-beta.18 → 0.0.1-beta.19

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":"d06b-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"d06b-61"},{"name":"react-router/src/index.tsx","uid":"d06b-63"}]}]}],"isRoot":true},"nodeParts":{"d06b-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"d06b-58"},"d06b-61":{"renderedLength":74402,"gzipLength":15504,"brotliLength":0,"mainUid":"d06b-60"},"d06b-63":{"renderedLength":11314,"gzipLength":2963,"brotliLength":0,"mainUid":"d06b-62"}},"nodeMetas":{"d06b-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"d06b-59"},"imported":[],"importedBy":[{"uid":"d06b-62"}]},"d06b-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"d06b-61"},"imported":[],"importedBy":[{"uid":"d06b-62"}]},"d06b-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"d06b-63"},"imported":[{"uid":"d06b-58"},{"uid":"d06b-64"},{"uid":"d06b-65"},{"uid":"d06b-60"},{"uid":"d06b-66"}],"importedBy":[],"isEntry":true},"d06b-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"d06b-62"}],"isExternal":true},"d06b-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"d06b-62"}],"isExternal":true},"d06b-66":{"id":"react-lazy-with-preload/lib/index","moduleParts":{},"imported":[],"importedBy":[{"uid":"d06b-62"}],"isExternal":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":"5c4d-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"5c4d-61"},{"name":"react-router/src/index.tsx","uid":"5c4d-63"}]}]}],"isRoot":true},"nodeParts":{"5c4d-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"5c4d-58"},"5c4d-61":{"renderedLength":75162,"gzipLength":15777,"brotliLength":0,"mainUid":"5c4d-60"},"5c4d-63":{"renderedLength":12237,"gzipLength":3143,"brotliLength":0,"mainUid":"5c4d-62"}},"nodeMetas":{"5c4d-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"5c4d-59"},"imported":[],"importedBy":[{"uid":"5c4d-62"}]},"5c4d-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"5c4d-61"},"imported":[],"importedBy":[{"uid":"5c4d-62"}]},"5c4d-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"5c4d-63"},"imported":[{"uid":"5c4d-58"},{"uid":"5c4d-64"},{"uid":"5c4d-65"},{"uid":"5c4d-60"}],"importedBy":[],"isEntry":true},"5c4d-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5c4d-62"}],"isExternal":true},"5c4d-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"5c4d-62"}],"isExternal":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": "d06b-68",
10
+ "uid": "5c4d-67",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,11 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "router-core/build/esm/index.js",
18
- "uid": "d06b-70"
18
+ "uid": "5c4d-69"
19
19
  },
20
20
  {
21
21
  "name": "react-router/src/index.tsx",
22
- "uid": "d06b-72"
22
+ "uid": "5c4d-71"
23
23
  }
24
24
  ]
25
25
  }
@@ -29,104 +29,90 @@
29
29
  "isRoot": true
30
30
  },
31
31
  "nodeParts": {
32
- "d06b-68": {
32
+ "5c4d-67": {
33
33
  "renderedLength": 798,
34
34
  "gzipLength": 366,
35
35
  "brotliLength": 0,
36
- "mainUid": "d06b-67"
36
+ "mainUid": "5c4d-66"
37
37
  },
38
- "d06b-70": {
39
- "renderedLength": 74402,
40
- "gzipLength": 15504,
38
+ "5c4d-69": {
39
+ "renderedLength": 75162,
40
+ "gzipLength": 15777,
41
41
  "brotliLength": 0,
42
- "mainUid": "d06b-69"
42
+ "mainUid": "5c4d-68"
43
43
  },
44
- "d06b-72": {
45
- "renderedLength": 11314,
46
- "gzipLength": 2963,
44
+ "5c4d-71": {
45
+ "renderedLength": 12237,
46
+ "gzipLength": 3143,
47
47
  "brotliLength": 0,
48
- "mainUid": "d06b-71"
48
+ "mainUid": "5c4d-70"
49
49
  }
50
50
  },
51
51
  "nodeMetas": {
52
- "d06b-67": {
52
+ "5c4d-66": {
53
53
  "id": "\u0000rollupPluginBabelHelpers.js",
54
54
  "moduleParts": {
55
- "index.production.js": "d06b-68"
55
+ "index.production.js": "5c4d-67"
56
56
  },
57
57
  "imported": [],
58
58
  "importedBy": [
59
59
  {
60
- "uid": "d06b-71"
60
+ "uid": "5c4d-70"
61
61
  }
62
62
  ]
63
63
  },
64
- "d06b-69": {
64
+ "5c4d-68": {
65
65
  "id": "/packages/router-core/build/esm/index.js",
66
66
  "moduleParts": {
67
- "index.production.js": "d06b-70"
67
+ "index.production.js": "5c4d-69"
68
68
  },
69
69
  "imported": [],
70
70
  "importedBy": [
71
71
  {
72
- "uid": "d06b-71"
72
+ "uid": "5c4d-70"
73
73
  }
74
74
  ]
75
75
  },
76
- "d06b-71": {
76
+ "5c4d-70": {
77
77
  "id": "/packages/react-router/src/index.tsx",
78
78
  "moduleParts": {
79
- "index.production.js": "d06b-72"
79
+ "index.production.js": "5c4d-71"
80
80
  },
81
81
  "imported": [
82
82
  {
83
- "uid": "d06b-67"
83
+ "uid": "5c4d-66"
84
84
  },
85
85
  {
86
- "uid": "d06b-73"
86
+ "uid": "5c4d-72"
87
87
  },
88
88
  {
89
- "uid": "d06b-74"
89
+ "uid": "5c4d-73"
90
90
  },
91
91
  {
92
- "uid": "d06b-69"
93
- },
94
- {
95
- "uid": "d06b-75"
92
+ "uid": "5c4d-68"
96
93
  }
97
94
  ],
98
95
  "importedBy": [],
99
96
  "isEntry": true
100
97
  },
101
- "d06b-73": {
98
+ "5c4d-72": {
102
99
  "id": "react",
103
100
  "moduleParts": {},
104
101
  "imported": [],
105
102
  "importedBy": [
106
103
  {
107
- "uid": "d06b-71"
104
+ "uid": "5c4d-70"
108
105
  }
109
106
  ],
110
107
  "isExternal": true
111
108
  },
112
- "d06b-74": {
109
+ "5c4d-73": {
113
110
  "id": "use-sync-external-store/shim",
114
111
  "moduleParts": {},
115
112
  "imported": [],
116
113
  "importedBy": [
117
114
  {
118
- "uid": "d06b-71"
119
- }
120
- ],
121
- "isExternal": true
122
- },
123
- "d06b-75": {
124
- "id": "react-lazy-with-preload/lib/index",
125
- "moduleParts": {},
126
- "imported": [],
127
- "importedBy": [
128
- {
129
- "uid": "d06b-71"
115
+ "uid": "5c4d-70"
130
116
  }
131
117
  ],
132
118
  "isExternal": true
@@ -9,17 +9,24 @@
9
9
  * @license MIT
10
10
  */
11
11
  import * as React from 'react';
12
- import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RouterState, RouteMatch, ToOptions, MatchRouteOptions, RouteInfoByPath, ResolveRelativePath, NoInfer, DefaultAllRouteInfo, AnyRouteInfo, RouteInfo, CheckId, ToIdOption, ValidFromPath, LinkOptions, RouterOptions, Router } from '@tanstack/router-core';
12
+ import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RouterState, RouteMatch, ToOptions, MatchRouteOptions, RouteInfoByPath, ResolveRelativePath, NoInfer, DefaultAllRouteInfo, AnyRouteInfo, RouteInfo, CheckId, ToIdOption, ValidFromPath, LinkOptions, Router, RouterOptions } from '@tanstack/router-core';
13
13
  export * from '@tanstack/router-core';
14
- export { lazyWithPreload as lazy } from 'react-lazy-with-preload/lib/index';
15
- export { PreloadableComponent as LazyComponent } from 'react-lazy-with-preload';
16
14
 
17
- declare type SyncRouteComponent = (props?: {}) => React.ReactNode;
18
- declare type RouteComponent = SyncRouteComponent & {
19
- preload?: () => Promise<{
20
- default: SyncRouteComponent;
21
- }>;
15
+ interface ResolveRouter {
16
+ }
17
+ type ResolvedRouter = ResolveRouter extends {
18
+ router: Router<infer TRouteConfig, infer TAllRouteInfo>;
19
+ } ? Router<TRouteConfig, TAllRouteInfo> : Router;
20
+ type ResolvedAllRouteInfo = ResolveRouter extends {
21
+ router: Router<infer TRouteConfig, infer TAllRouteInfo>;
22
+ } ? TAllRouteInfo : AnyAllRouteInfo;
23
+ type SyncRouteComponent = (props?: {}) => JSX.Element | React.ReactNode;
24
+ type RouteComponent = SyncRouteComponent & {
25
+ preload?: () => Promise<SyncRouteComponent>;
22
26
  };
27
+ declare function lazy(importer: () => Promise<{
28
+ default: SyncRouteComponent;
29
+ }>): RouteComponent;
23
30
  declare module '@tanstack/router-core' {
24
31
  interface FrameworkGenerics {
25
32
  Component: RouteComponent;
@@ -55,28 +62,40 @@ declare module '@tanstack/router-core' {
55
62
  }) => JSX.Element;
56
63
  }
57
64
  }
58
- declare type LinkPropsOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {
65
+ type LinkPropsOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {
59
66
  activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
60
67
  inactiveProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
61
68
  };
62
- declare type PromptProps = {
69
+ type PromptProps = {
63
70
  message: string;
64
71
  when?: boolean | any;
65
72
  children?: React.ReactNode;
66
73
  };
67
- declare type MatchesProviderProps = {
74
+ declare function Link<TTo extends string = '.'>(props: LinkPropsOptions<ResolvedAllRouteInfo, '/', TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
75
+ children?: React.ReactNode | ((state: {
76
+ isActive: boolean;
77
+ }) => React.ReactNode);
78
+ }): JSX.Element;
79
+ declare const matchesContext: React.Context<RouteMatch<DefaultAllRouteInfo, RouteInfo<string, string, string, string, {}, {}, {}, unknown, unknown, {}, {}, {}, {}, Record<never, string>, {}>>[]>;
80
+ declare const routerContext: React.Context<{
81
+ router: ResolvedRouter;
82
+ }>;
83
+ type MatchesProviderProps = {
68
84
  value: RouteMatch[];
69
85
  children: React.ReactNode;
70
86
  };
71
87
  declare function MatchesProvider(props: MatchesProviderProps): JSX.Element;
72
88
  declare function createReactRouter<TRouteConfig extends AnyRouteConfig = RouteConfig>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig>;
73
- declare type RouterProps<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = RouterOptions<TRouteConfig> & {
89
+ type RouterProps<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = RouterOptions<TRouteConfig> & {
74
90
  router: Router<TRouteConfig, TAllRouteInfo>;
75
91
  children?: React.ReactNode;
76
92
  };
77
93
  declare function RouterProvider<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>): JSX.Element;
78
- declare function useRouter(): Router;
94
+ declare function useRouter(): ResolvedRouter;
79
95
  declare function useMatches(): RouteMatch[];
96
+ declare function useMatch<TId extends keyof ResolvedAllRouteInfo['routeInfoById'], TStrict extends true | false = true>(routeId: TId, opts?: {
97
+ strict?: TStrict;
98
+ }): TStrict extends true ? RouteMatch<ResolvedAllRouteInfo, ResolvedAllRouteInfo['routeInfoById'][TId]> : RouteMatch<ResolvedAllRouteInfo, ResolvedAllRouteInfo['routeInfoById'][TId]> | undefined;
80
99
  declare function Outlet(): JSX.Element | null;
81
100
  declare function DefaultErrorBoundary({ error }: {
82
101
  error: any;
@@ -84,4 +103,4 @@ declare function DefaultErrorBoundary({ error }: {
84
103
  declare function usePrompt(message: string, when: boolean | any): void;
85
104
  declare function Prompt({ message, when, children }: PromptProps): React.ReactNode;
86
105
 
87
- export { DefaultErrorBoundary, MatchesProvider, MatchesProviderProps, Outlet, Prompt, PromptProps, RouteComponent, RouterProps, RouterProvider, createReactRouter, useMatches, usePrompt, useRouter };
106
+ export { DefaultErrorBoundary, Link, MatchesProvider, MatchesProviderProps, Outlet, Prompt, PromptProps, ResolveRouter, ResolvedAllRouteInfo, ResolvedRouter, RouteComponent, RouterProps, RouterProvider, SyncRouteComponent, createReactRouter, lazy, matchesContext, routerContext, useMatch, useMatches, usePrompt, useRouter };
@@ -9,10 +9,10 @@
9
9
  * @license MIT
10
10
  */
11
11
  (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim'), require('react-lazy-with-preload/lib/index')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim', 'react-lazy-with-preload/lib/index'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.React, global.shim, global.index));
15
- })(this, (function (exports, React, shim, index) { 'use strict';
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.React, global.shim));
15
+ })(this, (function (exports, React, shim) { 'use strict';
16
16
 
17
17
  function _interopNamespace(e) {
18
18
  if (e && e.__esModule) return e;
@@ -1549,11 +1549,19 @@
1549
1549
  }
1550
1550
  },
1551
1551
  fetch: async opts => {
1552
- const id = '' + Date.now() + Math.random();
1553
- routeMatch.__.latestId = id; // If the match was in an error state, set it
1552
+ const loadId = '' + Date.now() + Math.random();
1553
+ routeMatch.__.latestId = loadId;
1554
+
1555
+ const checkLatest = async () => {
1556
+ if (loadId !== routeMatch.__.latestId) {
1557
+ // warning(true, 'Data loader is out of date!')
1558
+ return new Promise(() => {});
1559
+ }
1560
+ }; // If the match was in an error state, set it
1554
1561
  // to a loading state again. Otherwise, keep it
1555
1562
  // as loading or resolved
1556
1563
 
1564
+
1557
1565
  if (routeMatch.status === 'idle') {
1558
1566
  routeMatch.status = 'loading';
1559
1567
  } // We started loading the route, so it's no longer invalid
@@ -1585,19 +1593,8 @@
1585
1593
  var _ref, _ref2, _opts$maxAge;
1586
1594
 
1587
1595
  if (routeMatch.options.loader) {
1588
- var _routeMatch$parentMat3;
1589
-
1590
- const data = await routeMatch.options.loader({
1591
- parentLoaderPromise: (_routeMatch$parentMat3 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat3.__.dataPromise,
1592
- params: routeMatch.params,
1593
- search: routeMatch.routeSearch,
1594
- signal: routeMatch.__.abortController.signal
1595
- });
1596
-
1597
- if (id !== routeMatch.__.latestId) {
1598
- return routeMatch.__.loadPromise;
1599
- }
1600
-
1596
+ const data = await router.loadMatchData(routeMatch);
1597
+ await checkLatest();
1601
1598
  routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1602
1599
  }
1603
1600
 
@@ -1607,9 +1604,7 @@
1607
1604
  routeMatch.invalidAt = routeMatch.updatedAt + ((_ref = (_ref2 = (_opts$maxAge = opts == null ? void 0 : opts.maxAge) != null ? _opts$maxAge : routeMatch.options.loaderMaxAge) != null ? _ref2 : router.options.defaultLoaderMaxAge) != null ? _ref : 0);
1608
1605
  return routeMatch.routeLoaderData;
1609
1606
  } catch (err) {
1610
- if (id !== routeMatch.__.latestId) {
1611
- return routeMatch.__.loadPromise;
1612
- }
1607
+ await checkLatest();
1613
1608
 
1614
1609
  {
1615
1610
  console.error(err);
@@ -1622,29 +1617,23 @@
1622
1617
  }
1623
1618
  });
1624
1619
 
1625
- try {
1626
- await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise.catch(() => {})]);
1627
-
1628
- if (id !== routeMatch.__.latestId) {
1629
- return routeMatch.__.loadPromise;
1630
- }
1631
- } finally {
1632
- if (id !== routeMatch.__.latestId) {
1633
- return routeMatch.__.loadPromise;
1634
- }
1635
-
1620
+ const after = async () => {
1621
+ await checkLatest();
1636
1622
  routeMatch.isFetching = false;
1623
+ delete routeMatch.__.loadPromise;
1637
1624
 
1638
1625
  routeMatch.__.notify();
1626
+ };
1627
+
1628
+ try {
1629
+ await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise.catch(() => {})]);
1630
+ after();
1631
+ } catch (_unused) {
1632
+ after();
1639
1633
  }
1640
1634
  });
1641
1635
  await routeMatch.__.loadPromise;
1642
-
1643
- if (id !== routeMatch.__.latestId) {
1644
- return routeMatch.__.loadPromise;
1645
- }
1646
-
1647
- delete routeMatch.__.loadPromise;
1636
+ await checkLatest();
1648
1637
  }
1649
1638
  });
1650
1639
 
@@ -1738,6 +1727,8 @@
1738
1727
  });
1739
1728
 
1740
1729
  let router = {
1730
+ types: undefined,
1731
+ // public api
1741
1732
  history,
1742
1733
  options: originalOptions,
1743
1734
  listeners: [],
@@ -1746,7 +1737,6 @@
1746
1737
  routeTree: undefined,
1747
1738
  routesById: {},
1748
1739
  location: undefined,
1749
- allRouteInfo: undefined,
1750
1740
  //
1751
1741
  navigationPromise: Promise.resolve(),
1752
1742
  resolveNavigation: () => {},
@@ -2129,6 +2119,11 @@
2129
2119
  match.__.validate();
2130
2120
 
2131
2121
  match.load(loaderOpts);
2122
+ const search = match.search;
2123
+
2124
+ if (search.__data && search.__data.matchId !== match.matchId) {
2125
+ return;
2126
+ }
2132
2127
 
2133
2128
  if (match.__.loadPromise) {
2134
2129
  // Wait for the first sign of activity from the match
@@ -2138,6 +2133,37 @@
2138
2133
  router.notify();
2139
2134
  await Promise.all(matchPromises);
2140
2135
  },
2136
+ loadMatchData: async routeMatch => {
2137
+ if (isServer || !router.options.useServerData) {
2138
+ var _await$routeMatch$opt;
2139
+
2140
+ return (_await$routeMatch$opt = await (routeMatch.options.loader == null ? void 0 : routeMatch.options.loader({
2141
+ // parentLoaderPromise: routeMatch.parentMatch?.__.dataPromise,
2142
+ params: routeMatch.params,
2143
+ search: routeMatch.routeSearch,
2144
+ signal: routeMatch.__.abortController.signal
2145
+ }))) != null ? _await$routeMatch$opt : {};
2146
+ } else {
2147
+ const next = router.buildNext({
2148
+ to: '.',
2149
+ search: d => _extends({}, d != null ? d : {}, {
2150
+ __data: {
2151
+ matchId: routeMatch.matchId
2152
+ }
2153
+ })
2154
+ });
2155
+ const res = await fetch(next.href, {
2156
+ method: 'GET' // signal: routeMatch.__.abortController.signal,
2157
+
2158
+ });
2159
+
2160
+ if (res.ok) {
2161
+ return res.json();
2162
+ }
2163
+
2164
+ throw new Error('Failed to fetch match data');
2165
+ }
2166
+ },
2141
2167
  invalidateRoute: opts => {
2142
2168
  var _router$state$pending5, _router$state$pending6;
2143
2169
 
@@ -2514,9 +2540,38 @@
2514
2540
  const _excluded = ["type", "children", "target", "activeProps", "inactiveProps", "activeOptions", "disabled", "hash", "search", "params", "to", "preload", "preloadDelay", "preloadMaxAge", "replace", "style", "className", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd"],
2515
2541
  _excluded2 = ["pending", "caseSensitive", "children"],
2516
2542
  _excluded3 = ["children", "router"];
2543
+ function lazy(importer) {
2544
+ const lazyComp = /*#__PURE__*/React__namespace.lazy(importer);
2545
+ let promise;
2546
+ let resolvedComp;
2547
+ const forwardedComp = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
2548
+ const resolvedCompRef = React__namespace.useRef(resolvedComp || lazyComp);
2549
+ return /*#__PURE__*/React__namespace.createElement(resolvedCompRef.current, _extends$2({}, ref ? {
2550
+ ref
2551
+ } : {}, props));
2552
+ });
2553
+ const finalComp = forwardedComp;
2554
+
2555
+ finalComp.preload = () => {
2556
+ if (!promise) {
2557
+ promise = importer().then(module => {
2558
+ resolvedComp = module.default;
2559
+ return resolvedComp;
2560
+ });
2561
+ }
2562
+
2563
+ return promise;
2564
+ };
2565
+
2566
+ return finalComp;
2567
+ }
2517
2568
  //
2569
+ function Link(props) {
2570
+ const router = useRouter();
2571
+ return /*#__PURE__*/React__namespace.createElement(router.Link, props);
2572
+ }
2518
2573
  const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
2519
- const routerContext = /*#__PURE__*/React__namespace.createContext(null); // Detect if we're in the DOM
2574
+ const routerContext = /*#__PURE__*/React__namespace.createContext(null);
2520
2575
  function MatchesProvider(props) {
2521
2576
  return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
2522
2577
  }
@@ -2699,11 +2754,12 @@
2699
2754
  router.update(rest);
2700
2755
  useRouterSubscription(router);
2701
2756
  React__namespace.useEffect(() => {
2757
+ console.log('hello');
2702
2758
  return router.mount();
2703
2759
  }, [router]);
2704
2760
  return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
2705
2761
  value: {
2706
- router
2762
+ router: router
2707
2763
  }
2708
2764
  }, /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2709
2765
  value: router.state.matches
@@ -2718,6 +2774,10 @@
2718
2774
  function useMatches() {
2719
2775
  return React__namespace.useContext(matchesContext);
2720
2776
  }
2777
+ function useMatch(routeId, opts) {
2778
+ const router = useRouter();
2779
+ return router.useMatch(routeId, opts);
2780
+ }
2721
2781
  function Outlet() {
2722
2782
  var _ref3, _match$__$pendingComp, _match$__$errorCompon;
2723
2783
 
@@ -2749,12 +2809,8 @@
2749
2809
  return /*#__PURE__*/React__namespace.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
2750
2810
  }
2751
2811
 
2752
- if (match.__.loadPromise) {
2753
- console.log(match.matchId, 'suspend');
2754
- throw match.__.loadPromise;
2755
- }
2756
-
2757
- invariant(false, 'This should never happen!');
2812
+ console.log(match.matchId, 'suspend');
2813
+ throw match.__.loadPromise;
2758
2814
  })())));
2759
2815
  }
2760
2816
 
@@ -2840,11 +2896,8 @@
2840
2896
  return children != null ? children : null;
2841
2897
  }
2842
2898
 
2843
- Object.defineProperty(exports, 'lazy', {
2844
- enumerable: true,
2845
- get: function () { return index.lazyWithPreload; }
2846
- });
2847
2899
  exports.DefaultErrorBoundary = DefaultErrorBoundary;
2900
+ exports.Link = Link;
2848
2901
  exports.MatchesProvider = MatchesProvider;
2849
2902
  exports.Outlet = Outlet;
2850
2903
  exports.Prompt = Prompt;
@@ -2867,18 +2920,22 @@
2867
2920
  exports.invariant = invariant;
2868
2921
  exports.joinPaths = joinPaths;
2869
2922
  exports.last = last;
2923
+ exports.lazy = lazy;
2870
2924
  exports.matchByPath = matchByPath;
2871
2925
  exports.matchPathname = matchPathname;
2926
+ exports.matchesContext = matchesContext;
2872
2927
  exports.parsePathname = parsePathname;
2873
2928
  exports.parseSearchWith = parseSearchWith;
2874
2929
  exports.pick = pick;
2875
2930
  exports.replaceEqualDeep = replaceEqualDeep;
2876
2931
  exports.resolvePath = resolvePath;
2877
2932
  exports.rootRouteId = rootRouteId;
2933
+ exports.routerContext = routerContext;
2878
2934
  exports.stringifySearchWith = stringifySearchWith;
2879
2935
  exports.trimPath = trimPath;
2880
2936
  exports.trimPathLeft = trimPathLeft;
2881
2937
  exports.trimPathRight = trimPathRight;
2938
+ exports.useMatch = useMatch;
2882
2939
  exports.useMatches = useMatches;
2883
2940
  exports.usePrompt = usePrompt;
2884
2941
  exports.useRouter = useRouter;