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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -163,34 +163,21 @@ function createReactRouter(opts) {
163
163
  useRoute: routeId => {
164
164
  const route = router.getRoute(routeId);
165
165
  useRouterSubscription(router);
166
-
167
- if (!route) {
168
- throw new Error("Could not find a route for route \"" + routeId + "\"! Did you forget to add it to your route config?");
169
- }
170
-
166
+ index.invariant(route, "Could not find a route for route \"" + routeId + "\"! Did you forget to add it to your route config?");
171
167
  return route;
172
168
  },
173
169
  useMatch: routeId => {
174
- if (routeId === index.rootRouteId) {
175
- throw new Error("\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
176
- }
170
+ index.invariant(routeId !== index.rootRouteId, "\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
177
171
 
178
172
  const runtimeMatch = _useMatch();
179
173
 
180
174
  const match = router.state.matches.find(d => d.routeId === routeId);
181
-
182
- if (!match) {
183
- throw new Error("Could not find a match for route \"" + routeId + "\" being rendered in this component!");
184
- }
185
-
186
- if (runtimeMatch.routeId !== (match == null ? void 0 : match.routeId)) {
187
- throw new Error("useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
188
- }
189
-
175
+ index.invariant(match, "Could not find a match for route \"" + routeId + "\" being rendered in this component!");
176
+ index.invariant(runtimeMatch.routeId == (match == null ? void 0 : match.routeId), "useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
190
177
  useRouterSubscription(router);
191
178
 
192
179
  if (!match) {
193
- throw new Error('Match not found!');
180
+ index.invariant('Match not found!');
194
181
  }
195
182
 
196
183
  return match;
@@ -396,6 +383,7 @@ exports.createRouter = index.createRouter;
396
383
  exports.defaultParseSearch = index.defaultParseSearch;
397
384
  exports.defaultStringifySearch = index.defaultStringifySearch;
398
385
  exports.functionalUpdate = index.functionalUpdate;
386
+ exports.invariant = index.invariant;
399
387
  exports.last = index.last;
400
388
  exports.matchByPath = index.matchByPath;
401
389
  exports.matchPathname = index.matchPathname;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n RootRouteId,\n rootRouteId,\n Route,\n Router,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([handleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n // useRouterSubscription(router)\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n if (!route) {\n throw new Error(\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n }\n return route\n },\n useMatch: (routeId) => {\n if (routeId === rootRouteId) {\n throw new Error(\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n }\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n if (!match) {\n throw new Error(\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\n )\n }\n\n if (runtimeMatch.routeId !== match?.routeId) {\n throw new Error(\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n }\n\n useRouterSubscription(router)\n\n if (!match) {\n throw new Error('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useParentMatches(): RouteMatch[] {\n const router = useRouter()\n const match = useMatch()\n const matches = router.state.matches\n return matches.slice(\n 0,\n matches.findIndex((d) => d.matchId === match.matchId) - 1,\n )\n}\n\nexport function useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = (((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultCatchBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element) ?? <Outlet />\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultCatchBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultCatchBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n <div style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useRoute","routeId","getRoute","Error","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","useParentMatches","slice","findIndex","matchId","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,E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;AACL8H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n RootRouteId,\n rootRouteId,\n Router,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([handleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n // useRouterSubscription(router)\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n invariant(\n route,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return route\n },\n useMatch: (routeId) => {\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n useRouterSubscription(router)\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useParentMatches(): RouteMatch[] {\n const router = useRouter()\n const match = useMatch()\n const matches = router.state.matches\n return matches.slice(\n 0,\n matches.findIndex((d) => d.matchId === match.matchId) - 1,\n )\n}\n\nexport function useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = (((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultCatchBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element) ?? <Outlet />\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultCatchBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultCatchBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n <div style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useRoute","routeId","getRoute","invariant","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","useParentMatches","slice","findIndex","matchId","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,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-849,6 +849,20 @@ function parsePath(path) {
849
849
  return parsedPath;
850
850
  }
851
851
 
852
+ var isProduction = process.env.NODE_ENV === 'production';
853
+ var prefix = 'Invariant failed';
854
+ function invariant(condition, message) {
855
+ if (condition) {
856
+ return;
857
+ }
858
+ if (isProduction) {
859
+ throw new Error(prefix);
860
+ }
861
+ var provided = typeof message === 'function' ? message() : message;
862
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
863
+ throw new Error(value);
864
+ }
865
+
852
866
  // @ts-nocheck
853
867
  // We're inlining qss here for compression's sake, but we've included it as a hard dependency for the MIT license it requires.
854
868
  function encode(obj, pfx) {
@@ -902,7 +916,7 @@ function decode(str) {
902
916
  return out;
903
917
  }
904
918
 
905
- const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId) {
919
+ const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId, parentPath) {
906
920
  if (options === void 0) {
907
921
  options = {};
908
922
  }
@@ -913,8 +927,6 @@ const createRouteConfig = function createRouteConfig(options, children, isRoot,
913
927
 
914
928
  if (isRoot) {
915
929
  options.path = rootRouteId;
916
- } else {
917
- warning(!options.path, 'Routes must have a path property.');
918
930
  } // Strip the root from parentIds
919
931
 
920
932
 
@@ -922,13 +934,14 @@ const createRouteConfig = function createRouteConfig(options, children, isRoot,
922
934
  parentId = '';
923
935
  }
924
936
 
925
- let path = String(isRoot ? rootRouteId : options.path); // If the path is anything other than an index path, trim it up
937
+ let path = isRoot ? rootRouteId : options.path; // If the path is anything other than an index path, trim it up
926
938
 
927
- if (path !== '/') {
939
+ if (path && path !== '/') {
928
940
  path = trimPath(path);
929
941
  }
930
942
 
931
- let id = joinPaths([parentId, path]);
943
+ const routeId = path || options.id;
944
+ let id = joinPaths([parentId, routeId]);
932
945
 
933
946
  if (path === rootRouteId) {
934
947
  path = '/';
@@ -938,14 +951,15 @@ const createRouteConfig = function createRouteConfig(options, children, isRoot,
938
951
  id = joinPaths(['/', id]);
939
952
  }
940
953
 
941
- const fullPath = id === rootRouteId ? '/' : trimPathRight(id);
954
+ const fullPath = id === rootRouteId ? '/' : trimPathRight(joinPaths([parentPath, path]));
942
955
  return {
943
956
  id: id,
957
+ routeId: routeId,
944
958
  path: path,
945
959
  fullPath: fullPath,
946
960
  options: options,
947
961
  children,
948
- addChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id)), false, parentId)
962
+ addChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)), false, parentId, parentPath)
949
963
  };
950
964
  };
951
965
  const rootRouteId = '__root__';
@@ -1321,55 +1335,76 @@ function createRouter(userOptions) {
1321
1335
 
1322
1336
  const existingMatches = [...router.state.matches, ...((_router$state$pending3 = (_router$state$pending4 = router.state.pending) == null ? void 0 : _router$state$pending4.matches) != null ? _router$state$pending3 : [])];
1323
1337
 
1324
- const recurse = async (routes, parentMatch) => {
1325
- var _parentMatch$params, _router$options$filte, _router$preloadCache$, _route$childRoutes2;
1338
+ const recurse = async routes => {
1339
+ var _parentMatch$params, _router$options$filte, _foundRoute$childRout;
1326
1340
 
1341
+ const parentMatch = last(matches);
1327
1342
  let params = (_parentMatch$params = parentMatch == null ? void 0 : parentMatch.params) != null ? _parentMatch$params : {};
1328
1343
  const filteredRoutes = (_router$options$filte = router.options.filterRoutes == null ? void 0 : router.options.filterRoutes(routes)) != null ? _router$options$filte : routes;
1329
- const route = filteredRoutes == null ? void 0 : filteredRoutes.find(route => {
1330
- var _route$childRoutes, _route$options$caseSe;
1331
-
1332
- const fuzzy = !!(route.routePath !== '/' || (_route$childRoutes = route.childRoutes) != null && _route$childRoutes.length);
1333
- const matchParams = matchPathname(pathname, {
1334
- to: route.fullPath,
1335
- fuzzy,
1336
- caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
1337
- });
1344
+ let foundRoutes = [];
1338
1345
 
1339
- if (matchParams) {
1340
- let parsedParams;
1346
+ const findMatchInRoutes = (parentRoutes, routes) => {
1347
+ routes.some(route => {
1348
+ var _route$childRoutes, _route$childRoutes2, _route$options$caseSe;
1341
1349
 
1342
- try {
1343
- var _route$options$parseP;
1350
+ if (!route.routePath && (_route$childRoutes = route.childRoutes) != null && _route$childRoutes.length) {
1351
+ return findMatchInRoutes([...foundRoutes, route], route.childRoutes);
1352
+ }
1344
1353
 
1345
- parsedParams = (_route$options$parseP = route.options.parseParams == null ? void 0 : route.options.parseParams(matchParams)) != null ? _route$options$parseP : matchParams;
1346
- } catch (err) {
1347
- if (opts != null && opts.strictParseParams) {
1348
- throw err;
1354
+ const fuzzy = !!(route.routePath !== '/' || (_route$childRoutes2 = route.childRoutes) != null && _route$childRoutes2.length);
1355
+ const matchParams = matchPathname(pathname, {
1356
+ to: route.fullPath,
1357
+ fuzzy,
1358
+ caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
1359
+ });
1360
+
1361
+ if (matchParams) {
1362
+ let parsedParams;
1363
+
1364
+ try {
1365
+ var _route$options$parseP;
1366
+
1367
+ parsedParams = (_route$options$parseP = route.options.parseParams == null ? void 0 : route.options.parseParams(matchParams)) != null ? _route$options$parseP : matchParams;
1368
+ } catch (err) {
1369
+ if (opts != null && opts.strictParseParams) {
1370
+ throw err;
1371
+ }
1349
1372
  }
1373
+
1374
+ params = _extends$1({}, params, parsedParams);
1350
1375
  }
1351
1376
 
1352
- params = _extends$1({}, params, parsedParams);
1353
- }
1377
+ if (!!matchParams) {
1378
+ foundRoutes = [...parentRoutes, route];
1379
+ }
1354
1380
 
1355
- return !!matchParams;
1356
- });
1381
+ return !!foundRoutes.length;
1382
+ });
1383
+ return !!foundRoutes.length;
1384
+ };
1357
1385
 
1358
- if (!route) {
1386
+ findMatchInRoutes([], filteredRoutes);
1387
+
1388
+ if (!foundRoutes.length) {
1359
1389
  return;
1360
1390
  }
1361
1391
 
1362
- const interpolatedPath = interpolatePath(route.routePath, params);
1363
- const matchId = interpolatePath(route.routeId, params, true);
1364
- const match = existingMatches.find(d => d.matchId === matchId) || ((_router$preloadCache$ = router.preloadCache[matchId]) == null ? void 0 : _router$preloadCache$.match) || createRouteMatch(router, route, {
1365
- matchId,
1366
- params,
1367
- pathname: joinPaths([pathname, interpolatedPath])
1392
+ foundRoutes.forEach(foundRoute => {
1393
+ var _router$preloadCache$;
1394
+
1395
+ const interpolatedPath = interpolatePath(foundRoute.routePath, params);
1396
+ const matchId = interpolatePath(foundRoute.routeId, params, true);
1397
+ const match = existingMatches.find(d => d.matchId === matchId) || ((_router$preloadCache$ = router.preloadCache[matchId]) == null ? void 0 : _router$preloadCache$.match) || createRouteMatch(router, foundRoute, {
1398
+ matchId,
1399
+ params,
1400
+ pathname: joinPaths([pathname, interpolatedPath])
1401
+ });
1402
+ matches.push(match);
1368
1403
  });
1369
- matches.push(match);
1404
+ const foundRoute = last(foundRoutes);
1370
1405
 
1371
- if ((_route$childRoutes2 = route.childRoutes) != null && _route$childRoutes2.length) {
1372
- recurse(route.childRoutes, match);
1406
+ if ((_foundRoute$childRout = foundRoute.childRoutes) != null && _foundRoute$childRout.length) {
1407
+ recurse(foundRoute.childRoutes);
1373
1408
  }
1374
1409
  };
1375
1410
 
@@ -1473,14 +1508,7 @@ function createRouter(userOptions) {
1473
1508
  isExternal = true;
1474
1509
  } catch (e) {}
1475
1510
 
1476
- if (isExternal) {
1477
- if (process.env.NODE_ENV !== 'production') {
1478
- throw new Error('Attempting to navigate to external url with router.navigate!');
1479
- }
1480
-
1481
- return;
1482
- }
1483
-
1511
+ invariant(!isExternal, 'Attempting to navigate to external url with router.navigate!');
1484
1512
  return router._navigate({
1485
1513
  from: fromString,
1486
1514
  to: toString,
@@ -1635,13 +1663,14 @@ function createRoute(routeConfig, options, parent, router) {
1635
1663
  // ]).replace(new RegExp(`^${rootRouteId}`), '')
1636
1664
  // ) as TRouteInfo['id']
1637
1665
  const {
1638
- id: routeId,
1666
+ id,
1667
+ routeId,
1639
1668
  path: routePath,
1640
1669
  fullPath
1641
1670
  } = routeConfig;
1642
1671
 
1643
- const action = router.state.actions[routeId] || (() => {
1644
- router.state.actions[routeId] = {
1672
+ const action = router.state.actions[id] || (() => {
1673
+ router.state.actions[id] = {
1645
1674
  pending: [],
1646
1675
  submit: async (submission, actionOpts) => {
1647
1676
  var _actionOpts$invalidat;
@@ -1692,11 +1721,12 @@ function createRoute(routeConfig, options, parent, router) {
1692
1721
  }
1693
1722
  }
1694
1723
  };
1695
- return router.state.actions[routeId];
1724
+ return router.state.actions[id];
1696
1725
  })();
1697
1726
 
1698
1727
  let route = {
1699
- routeId,
1728
+ routeId: id,
1729
+ routeRouteId: routeId,
1700
1730
  routePath,
1701
1731
  fullPath,
1702
1732
  options,
@@ -2317,6 +2347,7 @@ exports.createRouter = createRouter;
2317
2347
  exports.defaultParseSearch = defaultParseSearch;
2318
2348
  exports.defaultStringifySearch = defaultStringifySearch;
2319
2349
  exports.functionalUpdate = functionalUpdate;
2350
+ exports.invariant = invariant;
2320
2351
  exports.last = last;
2321
2352
  exports.matchByPath = matchByPath;
2322
2353
  exports.matchPathname = matchPathname;