@tanstack/react-router 1.15.7 → 1.15.9

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.
@@ -1,25 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
3
5
  const warning = require("tiny-warning");
4
6
  const Matches = require("./Matches.cjs");
5
7
  const useRouter = require("./useRouter.cjs");
6
8
  const defer = require("./defer.cjs");
7
9
  const router = require("./router.cjs");
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
8
27
  function useAwaited({ promise }) {
9
28
  var _a, _b;
10
29
  const router$1 = useRouter.useRouter();
11
30
  let state = promise.__deferredState;
12
31
  const key = `__TSR__DEFERRED__${state.uid}`;
13
- if (defer.isDehydratedDeferred(promise)) {
14
- state = router$1.hydrateData(key);
32
+ if (defer.isDehydratedDeferred(promise) && state.status === "pending") {
33
+ const dehydratedState = router$1.hydrateData(key);
15
34
  if (!state)
16
35
  throw new Error("Could not find dehydrated data");
36
+ Object.assign(state, dehydratedState);
17
37
  promise = Promise.resolve(state.data);
18
38
  promise.__deferredState = state;
19
39
  }
20
- if (state.status === "pending") {
40
+ if (state.status === "pending")
21
41
  throw promise;
22
- }
23
42
  if (state.status === "error") {
24
43
  if (typeof document !== "undefined") {
25
44
  if (Matches.isServerSideError(state.error)) {
@@ -39,10 +58,19 @@ function useAwaited({ promise }) {
39
58
  };
40
59
  }
41
60
  }
42
- router$1.dehydrateData(key, state);
61
+ if (!defer.isDehydratedDeferred(promise)) {
62
+ router$1.dehydrateData(key, state);
63
+ }
43
64
  return [state.data];
44
65
  }
45
66
  function Await(props) {
67
+ const inner = /* @__PURE__ */ jsxRuntime.jsx(AwaitInner, { ...props });
68
+ if (props.fallback) {
69
+ return /* @__PURE__ */ jsxRuntime.jsx(React__namespace.Suspense, { fallback: props.fallback, children: inner });
70
+ }
71
+ return inner;
72
+ }
73
+ function AwaitInner(props) {
46
74
  const awaited = useAwaited(props);
47
75
  return props.children(...awaited);
48
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"awaited.cjs","sources":["../../src/awaited.tsx"],"sourcesContent":["import warning from 'tiny-warning'\nimport { defaultDeserializeError, isServerSideError } from './Matches'\nimport { useRouter } from './useRouter'\nimport { DeferredPromise, isDehydratedDeferred } from './defer'\nimport { defaultSerializeError } from './router'\n\nexport type AwaitOptions<T> = {\n promise: DeferredPromise<T>\n}\n\nexport function useAwaited<T>({ promise }: AwaitOptions<T>): [T] {\n const router = useRouter()\n\n let state = promise.__deferredState\n const key = `__TSR__DEFERRED__${state.uid}`\n\n if (isDehydratedDeferred(promise)) {\n state = router.hydrateData(key)!\n if (!state) throw new Error('Could not find dehydrated data')\n promise = Promise.resolve(state.data) as DeferredPromise<any>\n promise.__deferredState = state\n }\n\n if (state.status === 'pending') {\n throw promise\n }\n\n if (state.status === 'error') {\n if (typeof document !== 'undefined') {\n if (isServerSideError(state.error)) {\n throw (\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n )(state.error.data as any)\n } else {\n warning(\n false,\n \"Encountered a server-side error that doesn't fit the expected shape\",\n )\n throw state.error\n }\n } else {\n router.dehydrateData(key, state)\n throw {\n data: (\n router.options.errorSerializer?.serialize ?? defaultSerializeError\n )(state.error),\n __isServerError: true,\n }\n }\n }\n\n router.dehydrateData(key, state)\n\n return [state.data]\n}\n\nexport function Await<T>(\n props: AwaitOptions<T> & {\n children: (result: T) => JSX.Element\n },\n) {\n const awaited = useAwaited(props)\n return props.children(...awaited)\n}\n"],"names":["router","useRouter","isDehydratedDeferred","isServerSideError","defaultDeserializeError","defaultSerializeError"],"mappings":";;;;;;;AAUgB,SAAA,WAAc,EAAE,WAAiC;;AAC/D,QAAMA,WAASC,UAAAA;AAEf,MAAI,QAAQ,QAAQ;AACd,QAAA,MAAM,oBAAoB,MAAM,GAAG;AAErC,MAAAC,MAAAA,qBAAqB,OAAO,GAAG;AACzB,YAAAF,SAAO,YAAY,GAAG;AAC9B,QAAI,CAAC;AAAa,YAAA,IAAI,MAAM,gCAAgC;AAClD,cAAA,QAAQ,QAAQ,MAAM,IAAI;AACpC,YAAQ,kBAAkB;AAAA,EAC5B;AAEI,MAAA,MAAM,WAAW,WAAW;AACxB,UAAA;AAAA,EACR;AAEI,MAAA,MAAM,WAAW,SAAS;AACxB,QAAA,OAAO,aAAa,aAAa;AAC/B,UAAAG,QAAA,kBAAkB,MAAM,KAAK,GAAG;AAClC,iBACEH,cAAO,QAAQ,oBAAfA,mBAAgC,gBAAeI,QAAAA,yBAC/C,MAAM,MAAM,IAAW;AAAA,MAAA,OACpB;AACL;AAAA,UACE;AAAA,UACA;AAAA,QAAA;AAEF,cAAM,MAAM;AAAA,MACd;AAAA,IAAA,OACK;AACEJ,eAAA,cAAc,KAAK,KAAK;AACzB,YAAA;AAAA,QACJ,SACEA,cAAO,QAAQ,oBAAfA,mBAAgC,cAAaK,OAAA,uBAC7C,MAAM,KAAK;AAAA,QACb,iBAAiB;AAAA,MAAA;AAAA,IAErB;AAAA,EACF;AAEOL,WAAA,cAAc,KAAK,KAAK;AAExB,SAAA,CAAC,MAAM,IAAI;AACpB;AAEO,SAAS,MACd,OAGA;AACM,QAAA,UAAU,WAAW,KAAK;AACzB,SAAA,MAAM,SAAS,GAAG,OAAO;AAClC;;;"}
1
+ {"version":3,"file":"awaited.cjs","sources":["../../src/awaited.tsx"],"sourcesContent":["import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { defaultDeserializeError, isServerSideError } from './Matches'\nimport { useRouter } from './useRouter'\nimport { DeferredPromise, isDehydratedDeferred } from './defer'\nimport { defaultSerializeError } from './router'\nimport invariant from 'tiny-invariant'\n\nexport type AwaitOptions<T> = {\n promise: DeferredPromise<T>\n}\n\nexport function useAwaited<T>({ promise }: AwaitOptions<T>): [T] {\n const router = useRouter()\n\n let state = promise.__deferredState\n const key = `__TSR__DEFERRED__${state.uid}`\n\n // There's a chance that the promise was resolved before rendering\n // on the server which means that it was be dehydrated in the critical\n // JSON with the rest of the router state. If that's the case\n // it's status will be 'success' and we can just use the data as is\n // and skip streamed hydration.\n\n if (isDehydratedDeferred(promise) && state.status === 'pending') {\n const dehydratedState = router.hydrateData(key)\n if (!state) throw new Error('Could not find dehydrated data')\n Object.assign(state, dehydratedState)\n promise = Promise.resolve(state.data) as DeferredPromise<any>\n promise.__deferredState = state\n }\n\n if (state.status === 'pending') throw promise\n\n if (state.status === 'error') {\n if (typeof document !== 'undefined') {\n if (isServerSideError(state.error)) {\n throw (\n router.options.errorSerializer?.deserialize ?? defaultDeserializeError\n )(state.error.data as any)\n } else {\n warning(\n false,\n \"Encountered a server-side error that doesn't fit the expected shape\",\n )\n throw state.error\n }\n } else {\n router.dehydrateData(key, state)\n throw {\n data: (\n router.options.errorSerializer?.serialize ?? defaultSerializeError\n )(state.error),\n __isServerError: true,\n }\n }\n }\n\n // TODO: This should only happen on the server\n if (!isDehydratedDeferred(promise)) {\n router.dehydrateData(key, state)\n }\n\n return [state.data as any]\n}\n\nexport function Await<T>(\n props: AwaitOptions<T> & {\n fallback?: JSX.Element\n children: (result: T) => JSX.Element\n },\n) {\n const inner = <AwaitInner {...props} />\n if (props.fallback) {\n return <React.Suspense fallback={props.fallback}>{inner}</React.Suspense>\n }\n return inner\n}\n\nfunction AwaitInner<T>(\n props: AwaitOptions<T> & {\n fallback?: JSX.Element\n children: (result: T) => JSX.Element\n },\n) {\n const awaited = useAwaited(props)\n return props.children(...awaited)\n}\n"],"names":["router","useRouter","isDehydratedDeferred","isServerSideError","defaultDeserializeError","defaultSerializeError","jsx","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAYgB,SAAA,WAAc,EAAE,WAAiC;;AAC/D,QAAMA,WAASC,UAAAA;AAEf,MAAI,QAAQ,QAAQ;AACd,QAAA,MAAM,oBAAoB,MAAM,GAAG;AAQzC,MAAIC,MAAqB,qBAAA,OAAO,KAAK,MAAM,WAAW,WAAW;AACzD,UAAA,kBAAkBF,SAAO,YAAY,GAAG;AAC9C,QAAI,CAAC;AAAa,YAAA,IAAI,MAAM,gCAAgC;AACrD,WAAA,OAAO,OAAO,eAAe;AAC1B,cAAA,QAAQ,QAAQ,MAAM,IAAI;AACpC,YAAQ,kBAAkB;AAAA,EAC5B;AAEA,MAAI,MAAM,WAAW;AAAiB,UAAA;AAElC,MAAA,MAAM,WAAW,SAAS;AACxB,QAAA,OAAO,aAAa,aAAa;AAC/B,UAAAG,QAAA,kBAAkB,MAAM,KAAK,GAAG;AAClC,iBACEH,cAAO,QAAQ,oBAAfA,mBAAgC,gBAAeI,QAAAA,yBAC/C,MAAM,MAAM,IAAW;AAAA,MAAA,OACpB;AACL;AAAA,UACE;AAAA,UACA;AAAA,QAAA;AAEF,cAAM,MAAM;AAAA,MACd;AAAA,IAAA,OACK;AACEJ,eAAA,cAAc,KAAK,KAAK;AACzB,YAAA;AAAA,QACJ,SACEA,cAAO,QAAQ,oBAAfA,mBAAgC,cAAaK,OAAA,uBAC7C,MAAM,KAAK;AAAA,QACb,iBAAiB;AAAA,MAAA;AAAA,IAErB;AAAA,EACF;AAGI,MAAA,CAACH,MAAAA,qBAAqB,OAAO,GAAG;AAC3BF,aAAA,cAAc,KAAK,KAAK;AAAA,EACjC;AAEO,SAAA,CAAC,MAAM,IAAW;AAC3B;AAEO,SAAS,MACd,OAIA;AACA,QAAM,QAAQM,2BAAAA,IAAC,YAAY,EAAA,GAAG,MAAO,CAAA;AACrC,MAAI,MAAM,UAAU;AAClB,0CAAQC,iBAAM,UAAN,EAAe,UAAU,MAAM,UAAW,UAAM,MAAA,CAAA;AAAA,EAC1D;AACO,SAAA;AACT;AAEA,SAAS,WACP,OAIA;AACM,QAAA,UAAU,WAAW,KAAK;AACzB,SAAA,MAAM,SAAS,GAAG,OAAO;AAClC;;;"}
@@ -1,9 +1,10 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { DeferredPromise } from './defer.cjs';
3
3
  export type AwaitOptions<T> = {
4
4
  promise: DeferredPromise<T>;
5
5
  };
6
6
  export declare function useAwaited<T>({ promise }: AwaitOptions<T>): [T];
7
7
  export declare function Await<T>(props: AwaitOptions<T> & {
8
+ fallback?: JSX.Element;
8
9
  children: (result: T) => JSX.Element;
9
- }): JSX.Element;
10
+ }): React.JSX.Element;
@@ -4,11 +4,6 @@ const invariant = require("tiny-invariant");
4
4
  const XTSROrigin = "x-tsr-origin";
5
5
  function createServerFn(method, fn) {
6
6
  const compiledFn = fn;
7
- console.log(
8
- compiledFn,
9
- compiledFn.toString(),
10
- JSON.stringify(compiledFn, null, 2)
11
- );
12
7
  invariant(
13
8
  compiledFn.url,
14
9
  `createServerFn must be called with a function that is marked with the 'use server' pragma.`
@@ -17,8 +12,7 @@ function createServerFn(method, fn) {
17
12
  async (payload, opts) => {
18
13
  return compiledFn({
19
14
  method,
20
- type: payload instanceof Request ? "request" : "payload",
21
- payload,
15
+ payload: payload || void 0,
22
16
  requestInit: opts == null ? void 0 : opts.requestInit
23
17
  });
24
18
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createServerFn.cjs","sources":["../../src/createServerFn.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\n\nexport const XTSROrigin = 'x-tsr-origin'\n\nexport interface JsonResponse<TData> extends Response {\n json(): Promise<TData>\n}\n\nexport type FetcherOptionsBase = {\n method?: 'GET' | 'POST'\n}\n\nexport type FetcherOptions = FetcherOptionsBase & {\n requestInit?: RequestInit\n}\n\nexport type FetchFnCtx = {\n method: 'GET' | 'POST'\n request: Request\n}\n\nexport type FetchFn<TPayload, TResponse> = {\n (payload: TPayload, ctx: FetchFnCtx): TResponse\n url?: string\n}\n\n// export type AnyFetchFn = FetchFn<any, any>\n\n// export type FetchFnReturn<T extends AnyFetchFn> =\n// Awaited<ReturnType<T>> extends JsonResponse<infer R> ? R : ReturnType<T>\n\n// export type FetcherFn<T extends AnyFetchFn> = Parameters<T>[0] extends undefined\n// ? (\n// payload?: Parameters<T>['0'],\n// opts?: FetchFnCtx,\n// ) => Promise<Awaited<FetchFnReturn<T>>>\n// : (\n// payload: Parameters<T>['0'],\n// opts?: FetchFnCtx,\n// ) => Promise<Awaited<FetchFnReturn<T>>>\n\n// export type FetcherMethods<T extends AnyFetchFn> = {\n// url: string\n// fetch: (\n// init: RequestInit,\n// opts?: FetcherOptions,\n// ) => Promise<Awaited<FetchFnReturn<T>>>\n// }\n\n// export type Fetcher<T extends AnyFetchFn> = FetcherFn<T> & FetcherMethods<T>\n\nexport type CompiledFetcherFnOptions<TPayload> = {\n method: 'GET' | 'POST'\n type: 'request' | 'payload'\n payload: TPayload\n requestInit?: RequestInit\n}\n\nexport type CompiledFetcherFn<TPayload, TResponse> = {\n (opts: CompiledFetcherFnOptions<TPayload>): Promise<TResponse>\n url: string\n}\n\nexport type Fetcher<TPayload, TResponse> = (TPayload extends undefined\n ? {\n (payload?: TPayload, opts?: FetcherOptions): Promise<TResponse>\n }\n : {\n (payload: TPayload, opts?: FetcherOptions): Promise<TResponse>\n }) & {\n url: string\n}\n\nexport function createServerFn<TPayload, TResponse>(\n method: 'GET' | 'POST',\n fn: FetchFn<TPayload, TResponse>,\n): Fetcher<TPayload, TResponse> {\n // Cast the compiled function that will be injected by vinxi\n const compiledFn = fn as unknown as CompiledFetcherFn<TPayload, TResponse>\n\n console.log(\n compiledFn,\n compiledFn.toString(),\n JSON.stringify(compiledFn, null, 2),\n )\n\n invariant(\n compiledFn.url,\n `createServerFn must be called with a function that is marked with the 'use server' pragma.`,\n )\n\n return Object.assign(\n async (payload: TPayload, opts?: FetcherOptions) => {\n return compiledFn({\n method,\n type: payload instanceof Request ? 'request' : 'payload',\n payload,\n requestInit: opts?.requestInit,\n })\n },\n {\n url: fn.url!,\n },\n ) as Fetcher<TPayload, TResponse>\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,aAAa;AAuEV,SAAA,eACd,QACA,IAC8B;AAE9B,QAAM,aAAa;AAEX,UAAA;AAAA,IACN;AAAA,IACA,WAAW,SAAS;AAAA,IACpB,KAAK,UAAU,YAAY,MAAM,CAAC;AAAA,EAAA;AAGpC;AAAA,IACE,WAAW;AAAA,IACX;AAAA,EAAA;AAGF,SAAO,OAAO;AAAA,IACZ,OAAO,SAAmB,SAA0B;AAClD,aAAO,WAAW;AAAA,QAChB;AAAA,QACA,MAAM,mBAAmB,UAAU,YAAY;AAAA,QAC/C;AAAA,QACA,aAAa,6BAAM;AAAA,MAAA,CACpB;AAAA,IACH;AAAA,IACA;AAAA,MACE,KAAK,GAAG;AAAA,IACV;AAAA,EAAA;AAEJ;;;"}
1
+ {"version":3,"file":"createServerFn.cjs","sources":["../../src/createServerFn.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\n\nexport const XTSROrigin = 'x-tsr-origin'\n\nexport interface JsonResponse<TData> extends Response {\n json(): Promise<TData>\n}\n\nexport type FetcherOptionsBase = {\n method?: 'GET' | 'POST'\n}\n\nexport type FetcherOptions = FetcherOptionsBase & {\n requestInit?: RequestInit\n}\n\nexport type FetchFnCtx = {\n method: 'GET' | 'POST'\n request: Request\n}\n\nexport type FetchFn<TPayload, TResponse> = {\n (payload: TPayload, ctx: FetchFnCtx): Promise<TResponse> | TResponse\n url?: string\n}\n\nexport type CompiledFetcherFnOptions<TPayload> = {\n method: 'GET' | 'POST'\n payload: TPayload | undefined\n requestInit?: RequestInit\n}\n\nexport type CompiledFetcherFn<TPayload, TResponse> = {\n (opts: CompiledFetcherFnOptions<TPayload>): Promise<TResponse>\n url: string\n}\n\ntype IsPayloadOptional<T> = [T] extends [undefined] ? true : false\n\nexport type Fetcher<TPayload, TResponse> =\n (IsPayloadOptional<TPayload> extends true\n ? {\n (payload?: TPayload, opts?: FetcherOptions): Promise<TResponse>\n }\n : {\n (payload: TPayload, opts?: FetcherOptions): Promise<TResponse>\n }) & {\n url: string\n }\n\nexport function createServerFn<\n TPayload extends any = undefined,\n TResponse = unknown,\n>(\n method: 'GET' | 'POST',\n fn: FetchFn<TPayload, TResponse>,\n): Fetcher<TPayload, TResponse> {\n // Cast the compiled function that will be injected by vinxi\n const compiledFn = fn as unknown as CompiledFetcherFn<TPayload, TResponse>\n\n invariant(\n compiledFn.url,\n `createServerFn must be called with a function that is marked with the 'use server' pragma.`,\n )\n\n return Object.assign(\n async (payload: TPayload, opts?: FetcherOptions) => {\n return compiledFn({\n method,\n payload: payload || undefined,\n requestInit: opts?.requestInit,\n })\n },\n {\n url: fn.url!,\n },\n ) as Fetcher<TPayload, TResponse>\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,aAAa;AAgDV,SAAA,eAId,QACA,IAC8B;AAE9B,QAAM,aAAa;AAEnB;AAAA,IACE,WAAW;AAAA,IACX;AAAA,EAAA;AAGF,SAAO,OAAO;AAAA,IACZ,OAAO,SAAmB,SAA0B;AAClD,aAAO,WAAW;AAAA,QAChB;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,aAAa,6BAAM;AAAA,MAAA,CACpB;AAAA,IACH;AAAA,IACA;AAAA,MACE,KAAK,GAAG;AAAA,IACV;AAAA,EAAA;AAEJ;;;"}
@@ -13,24 +13,25 @@ export type FetchFnCtx = {
13
13
  request: Request;
14
14
  };
15
15
  export type FetchFn<TPayload, TResponse> = {
16
- (payload: TPayload, ctx: FetchFnCtx): TResponse;
16
+ (payload: TPayload, ctx: FetchFnCtx): Promise<TResponse> | TResponse;
17
17
  url?: string;
18
18
  };
19
19
  export type CompiledFetcherFnOptions<TPayload> = {
20
20
  method: 'GET' | 'POST';
21
- type: 'request' | 'payload';
22
- payload: TPayload;
21
+ payload: TPayload | undefined;
23
22
  requestInit?: RequestInit;
24
23
  };
25
24
  export type CompiledFetcherFn<TPayload, TResponse> = {
26
25
  (opts: CompiledFetcherFnOptions<TPayload>): Promise<TResponse>;
27
26
  url: string;
28
27
  };
29
- export type Fetcher<TPayload, TResponse> = (TPayload extends undefined ? {
28
+ type IsPayloadOptional<T> = [T] extends [undefined] ? true : false;
29
+ export type Fetcher<TPayload, TResponse> = (IsPayloadOptional<TPayload> extends true ? {
30
30
  (payload?: TPayload, opts?: FetcherOptions): Promise<TResponse>;
31
31
  } : {
32
32
  (payload: TPayload, opts?: FetcherOptions): Promise<TResponse>;
33
33
  }) & {
34
34
  url: string;
35
35
  };
36
- export declare function createServerFn<TPayload, TResponse>(method: 'GET' | 'POST', fn: FetchFn<TPayload, TResponse>): Fetcher<TPayload, TResponse>;
36
+ export declare function createServerFn<TPayload extends any = undefined, TResponse = unknown>(method: 'GET' | 'POST', fn: FetchFn<TPayload, TResponse>): Fetcher<TPayload, TResponse>;
37
+ export {};
@@ -35,7 +35,7 @@ export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath
35
35
  onLeave?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
36
36
  meta?: ((ctx: {
37
37
  loaderData: TLoaderData;
38
- }) => import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[]) | undefined;
38
+ }) => import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[] | Promise<import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[]>) | undefined;
39
39
  links?: (() => import("react").DetailedHTMLProps<import("react").LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>[]) | undefined;
40
40
  scripts?: (() => import("react").DetailedHTMLProps<import("react").ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>[]) | undefined;
41
41
  } & {
@@ -72,7 +72,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
72
72
  onLeave?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
73
73
  meta?: ((ctx: {
74
74
  loaderData: TLoaderData;
75
- }) => import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[]) | undefined;
75
+ }) => import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[] | Promise<import("react").DetailedHTMLProps<import("react").MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>[]>) | undefined;
76
76
  links?: (() => import("react").DetailedHTMLProps<import("react").LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>[]) | undefined;
77
77
  scripts?: (() => import("react").DetailedHTMLProps<import("react").ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>[]) | undefined;
78
78
  } & {
package/dist/cjs/qss.cjs CHANGED
@@ -27,8 +27,8 @@ function toValue(mix) {
27
27
  return true;
28
28
  return +str * 0 === 0 && +str + "" === str ? +str : str;
29
29
  }
30
- function decode(str) {
31
- var tmp, k, out = {}, arr = str.split("&");
30
+ function decode(str, pfx) {
31
+ var tmp, k, out = {}, arr = (pfx ? str.substr(pfx.length) : str).split("&");
32
32
  while (tmp = arr.shift()) {
33
33
  tmp = tmp.split("=");
34
34
  k = tmp.shift();
@@ -1 +1 @@
1
- {"version":3,"file":"qss.cjs","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":[],"mappings":";;AAIgB,SAAA,OAAO,KAAK,KAAc;AACpC,MAAA,GACF,GACA,KACA,MAAM;AAER,OAAK,KAAK,KAAK;AACb,SAAK,MAAM,IAAI,CAAC,OAAO,QAAQ;AACzB,UAAA,MAAM,QAAQ,GAAG,GAAG;AACtB,aAAK,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAC/B,kBAAQ,OAAO;AACf,iBAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,IAAI,CAAC,CAAC;AAAA,QAChE;AAAA,MAAA,OACK;AACL,gBAAQ,OAAO;AACf,eAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,GAAG;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAEA,UAAQ,OAAO,MAAM;AACvB;AAEA,SAAS,QAAQ,KAAK;AACpB,MAAI,CAAC;AAAY,WAAA;AACb,MAAA,MAAM,mBAAmB,GAAG;AAChC,MAAI,QAAQ;AAAgB,WAAA;AAC5B,MAAI,QAAQ;AAAe,WAAA;AACpB,SAAA,CAAC,MAAM,MAAM,KAAK,CAAC,MAAM,OAAO,MAAM,CAAC,MAAM;AACtD;AAEO,SAAS,OAAO,KAAK;AACtB,MAAA,KACF,GACA,MAAM,CAAA,GACN,MAAM,IAAI,MAAM,GAAG;AAEb,SAAA,MAAM,IAAI,SAAU;AACpB,UAAA,IAAI,MAAM,GAAG;AACnB,QAAI,IAAI;AACJ,QAAA,IAAI,CAAC,MAAM,QAAQ;AACrB,UAAI,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,QAAQ,IAAI,MAAM,CAAC,CAAC;AAAA,IAAA,OAC1C;AACL,UAAI,CAAC,IAAI,QAAQ,IAAI,MAAO,CAAA;AAAA,IAC9B;AAAA,EACF;AAEO,SAAA;AACT;;;"}
1
+ {"version":3,"file":"qss.cjs","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, pfx?: string) {\n var tmp,\n k,\n out = {},\n arr = (pfx ? str.substr(pfx.length) : 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":[],"mappings":";;AAIgB,SAAA,OAAO,KAAK,KAAc;AACpC,MAAA,GACF,GACA,KACA,MAAM;AAER,OAAK,KAAK,KAAK;AACb,SAAK,MAAM,IAAI,CAAC,OAAO,QAAQ;AACzB,UAAA,MAAM,QAAQ,GAAG,GAAG;AACtB,aAAK,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAC/B,kBAAQ,OAAO;AACf,iBAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,IAAI,CAAC,CAAC;AAAA,QAChE;AAAA,MAAA,OACK;AACL,gBAAQ,OAAO;AACf,eAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,GAAG;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAEA,UAAQ,OAAO,MAAM;AACvB;AAEA,SAAS,QAAQ,KAAK;AACpB,MAAI,CAAC;AAAY,WAAA;AACb,MAAA,MAAM,mBAAmB,GAAG;AAChC,MAAI,QAAQ;AAAgB,WAAA;AAC5B,MAAI,QAAQ;AAAe,WAAA;AACpB,SAAA,CAAC,MAAM,MAAM,KAAK,CAAC,MAAM,OAAO,MAAM,CAAC,MAAM;AACtD;AAEgB,SAAA,OAAO,KAAK,KAAc;AACxC,MAAI,KACF,GACA,MAAM,CAAA,GACN,OAAO,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,KAAK,MAAM,GAAG;AAE9C,SAAA,MAAM,IAAI,SAAU;AACpB,UAAA,IAAI,MAAM,GAAG;AACnB,QAAI,IAAI;AACJ,QAAA,IAAI,CAAC,MAAM,QAAQ;AACrB,UAAI,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,QAAQ,IAAI,MAAM,CAAC,CAAC;AAAA,IAAA,OAC1C;AACL,UAAI,CAAC,IAAI,QAAQ,IAAI,MAAO,CAAA;AAAA,IAC9B;AAAA,EACF;AAEO,SAAA;AACT;;;"}
@@ -1,2 +1,2 @@
1
1
  export declare function encode(obj: any, pfx?: string): string;
2
- export declare function decode(str: any): {};
2
+ export declare function decode(str: any, pfx?: string): {};
@@ -13,6 +13,9 @@ function getRouteApi(id) {
13
13
  return new RouteApi({ id });
14
14
  }
15
15
  class RouteApi {
16
+ /**
17
+ * @deprecated Use the `getRouteApi` function instead.
18
+ */
16
19
  constructor({ id }) {
17
20
  this.useMatch = (opts) => {
18
21
  return Matches.useMatch({ select: opts == null ? void 0 : opts.select, from: this.id });
@@ -135,6 +138,9 @@ function createRootRouteWithContext() {
135
138
  }
136
139
  const rootRouteWithContext = createRootRouteWithContext;
137
140
  class RootRoute extends Route {
141
+ /**
142
+ * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
143
+ */
138
144
  constructor(options) {
139
145
  super(options);
140
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport { useLoaderData, useLoaderDeps, useMatch } from './Matches'\nimport { AnyRouteMatch } from './Matches'\nimport { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport { ParsedLocation } from './location'\nimport { joinPaths, trimPathLeft } from './path'\nimport { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport { AnyRouter, RegisteredRouter } from './router'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport {\n Assign,\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n} from './utils'\nimport { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport { LazyRoute } from '.'\nimport warning from 'tiny-warning'\nimport { NotFoundError, notFound } from '.'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = AnyPathParams,\n TAllParams extends AnyPathParams = TParams,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n> &\n UpdatableRouteOptions<NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>>\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = RoutePathOptions<TCustomId, TPath> & {\n getParentRoute: () => TParentRoute\n validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteContext\n >,\n ) => any)\n} & {\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteContextReturn,\n TRouterContext\n >\n} & {\n loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps\n loader?: RouteLoaderFn<\n TAllParams,\n NoInfer<TLoaderDeps>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n TLoaderData\n >\n} & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n )\n\ntype BeforeLoadFn<\n TFullSearchSchema extends Record<string, any>,\n TParentRoute extends AnyRoute,\n TAllParams,\n TRouteContextReturn extends RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n context: TContext\n location: ParsedLocation\n navigate: NavigateFn<AnyRoute>\n buildLocation: BuildLocationFn<TParentRoute>\n cause: 'preload' | 'enter' | 'stay'\n}) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n\nexport type UpdatableRouteOptions<\n TFullSearchSchema extends Record<string, any>,\n TLoaderData extends any,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: AnyRouteMatch) => void\n onStay?: (match: AnyRouteMatch) => void\n onLeave?: (match: AnyRouteMatch) => void\n meta?: (ctx: { loaderData: TLoaderData }) => JSX.IntrinsicElements['meta'][]\n links?: () => JSX.IntrinsicElements['link'][]\n scripts?: () => JSX.IntrinsicElements['script'][]\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | { [name: string]: unknown }\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = LdJsonValue[] | readonly LdJsonValue[]\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type RouteLoaderFn<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n TLoaderData extends any = unknown,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,\n) => Promise<TLoaderData> | TLoaderData\n\nexport interface LoaderFnContext<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n deps: TLoaderDeps\n context: Expand<Assign<TAllContext, TRouteContext>>\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n}\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<\n Assign<\n Omit<InferFullSearchSchema<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchema\n >\n>\n\nexport type ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed> =\n Expand<\n Assign<\n Omit<InferFullSearchSchemaInput<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchemaUsed\n >\n >\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type ResolveAllParams<\n TParentRoute extends AnyRoute,\n TParams extends AnyPathParams,\n> = Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : Expand<\n UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n >\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\n// TODO: This is part of a future APi to move away from classes and\n// towards a more functional API. It's not ready yet.\n\n// type RouteApiInstance<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// > = {\n// id: TId\n// useMatch: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useRouteContext: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useSearch: <TSelected = TFullSearchSchema>(opts?: {\n// select?: (s: TFullSearchSchema) => TSelected\n// }) => TSelected\n\n// useParams: <TSelected = TAllParams>(opts?: {\n// select?: (s: TAllParams) => TSelected\n// }) => TSelected\n\n// useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {\n// select?: (s: TLoaderDeps) => TSelected\n// }) => TSelected\n\n// useLoaderData: <TSelected = TLoaderData>(opts?: {\n// select?: (s: TLoaderData) => TSelected\n// }) => TSelected\n// }\n\n// export function RouteApi_v2<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// >({\n// id,\n// }: {\n// id: TId\n// }): RouteApiInstance<\n// TId,\n// TRoute,\n// TFullSearchSchema,\n// TAllParams,\n// TAllContext,\n// TLoaderDeps,\n// TLoaderData\n// > {\n// return {\n// id,\n\n// useMatch: (opts) => {\n// return useMatch({ ...opts, from: id })\n// },\n\n// useRouteContext: (opts) => {\n// return useMatch({\n// ...opts,\n// from: id,\n// select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n// } as any)\n// },\n\n// useSearch: (opts) => {\n// return useSearch({ ...opts, from: id } as any)\n// },\n\n// useParams: (opts) => {\n// return useParams({ ...opts, from: id } as any)\n// },\n\n// useLoaderDeps: (opts) => {\n// return useLoaderDeps({ ...opts, from: id } as any) as any\n// },\n\n// useLoaderData: (opts) => {\n// return useLoaderData({ ...opts, from: id } as any) as any\n// },\n// }\n// }\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema extends Record<\n string,\n any\n > = TRoute['types']['fullSearchSchema'],\n TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n TLoaderData extends any = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\n/**\n * @deprecated Use the `getRouteApi` function instead.\n */\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema extends Record<\n string,\n any\n > = TRoute['types']['fullSearchSchema'],\n TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n TLoaderData extends any = TRoute['types']['loaderData'],\n> {\n id: TId\n\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (s: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (s: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ route: this.id as string, ...opts })\n }\n}\n\n/**\n * @deprecated Use the `createRoute` function instead.\n */\nexport class Route<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends Record<\n string,\n any\n > = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n\n constructor(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n routeTree: TRouteTree\n routerContext: TRouterContext\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }) => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n (this.parentRoute.id as any) === rootRouteId\n ? ''\n : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <TNewChildren extends AnyRoute[]>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TNewChildren,\n TRouteTree\n > => {\n this.children = children as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData extends any = unknown>(options: {\n loader: RouteLoaderFn<\n TAllParams,\n TLoaderDeps,\n TAllContext,\n TRouteContext,\n TNewLoaderData\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren,\n TRouteTree\n >\n }\n\n update = (options: UpdatableRouteOptions<TFullSearchSchema, TLoaderData>) => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>) => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends Record<\n string,\n any\n > = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n >(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, //TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) => {\n return createRootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext;\n\nexport type RootSearchSchema = {\n __TRootSearchSchema__: '__TRootSearchSchema__'\n}\n\n/**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\nexport class RootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext\n TRouterContext, // TRouterContext\n TLoaderDeps,\n TLoaderData,\n any, // TChildren\n any // TRouteTree\n> {\n constructor(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n>(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n) {\n return new RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info: { componentStack: string }\n}\n\nexport type ErrorComponentProps = {\n error: unknown\n info: { componentStack: string }\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = SyncRouteComponent<TProps> &\n AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","notFound","options","path","trimPathLeft","joinPaths"],"mappings":"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"}
1
+ {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport { useLoaderData, useLoaderDeps, useMatch } from './Matches'\nimport { AnyRouteMatch } from './Matches'\nimport { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport { ParsedLocation } from './location'\nimport { joinPaths, trimPathLeft } from './path'\nimport { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport { AnyRouter, RegisteredRouter } from './router'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport {\n Assign,\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n} from './utils'\nimport { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport { LazyRoute } from '.'\nimport warning from 'tiny-warning'\nimport { NotFoundError, notFound } from '.'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = AnyPathParams,\n TAllParams extends AnyPathParams = TParams,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n> &\n UpdatableRouteOptions<NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>>\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = RoutePathOptions<TCustomId, TPath> & {\n getParentRoute: () => TParentRoute\n validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteContext\n >,\n ) => any)\n} & {\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteContextReturn,\n TRouterContext\n >\n} & {\n loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps\n loader?: RouteLoaderFn<\n TAllParams,\n NoInfer<TLoaderDeps>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n TLoaderData\n >\n} & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n )\n\ntype BeforeLoadFn<\n TFullSearchSchema extends Record<string, any>,\n TParentRoute extends AnyRoute,\n TAllParams,\n TRouteContextReturn extends RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n context: TContext\n location: ParsedLocation\n navigate: NavigateFn<AnyRoute>\n buildLocation: BuildLocationFn<TParentRoute>\n cause: 'preload' | 'enter' | 'stay'\n}) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n\nexport type UpdatableRouteOptions<\n TFullSearchSchema extends Record<string, any>,\n TLoaderData extends any,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: AnyRouteMatch) => void\n onStay?: (match: AnyRouteMatch) => void\n onLeave?: (match: AnyRouteMatch) => void\n meta?: (ctx: {\n loaderData: TLoaderData\n }) =>\n | JSX.IntrinsicElements['meta'][]\n | Promise<JSX.IntrinsicElements['meta'][]>\n links?: () => JSX.IntrinsicElements['link'][]\n scripts?: () => JSX.IntrinsicElements['script'][]\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | { [name: string]: unknown }\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = LdJsonValue[] | readonly LdJsonValue[]\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type RouteLoaderFn<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n TLoaderData extends any = unknown,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,\n) => Promise<TLoaderData> | TLoaderData\n\nexport interface LoaderFnContext<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n deps: TLoaderDeps\n context: Expand<Assign<TAllContext, TRouteContext>>\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n}\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<\n Assign<\n Omit<InferFullSearchSchema<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchema\n >\n>\n\nexport type ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed> =\n Expand<\n Assign<\n Omit<InferFullSearchSchemaInput<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchemaUsed\n >\n >\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type ResolveAllParams<\n TParentRoute extends AnyRoute,\n TParams extends AnyPathParams,\n> =\n Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : Expand<\n UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n >\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\n// TODO: This is part of a future APi to move away from classes and\n// towards a more functional API. It's not ready yet.\n\n// type RouteApiInstance<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// > = {\n// id: TId\n// useMatch: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useRouteContext: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useSearch: <TSelected = TFullSearchSchema>(opts?: {\n// select?: (s: TFullSearchSchema) => TSelected\n// }) => TSelected\n\n// useParams: <TSelected = TAllParams>(opts?: {\n// select?: (s: TAllParams) => TSelected\n// }) => TSelected\n\n// useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {\n// select?: (s: TLoaderDeps) => TSelected\n// }) => TSelected\n\n// useLoaderData: <TSelected = TLoaderData>(opts?: {\n// select?: (s: TLoaderData) => TSelected\n// }) => TSelected\n// }\n\n// export function RouteApi_v2<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// >({\n// id,\n// }: {\n// id: TId\n// }): RouteApiInstance<\n// TId,\n// TRoute,\n// TFullSearchSchema,\n// TAllParams,\n// TAllContext,\n// TLoaderDeps,\n// TLoaderData\n// > {\n// return {\n// id,\n\n// useMatch: (opts) => {\n// return useMatch({ ...opts, from: id })\n// },\n\n// useRouteContext: (opts) => {\n// return useMatch({\n// ...opts,\n// from: id,\n// select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n// } as any)\n// },\n\n// useSearch: (opts) => {\n// return useSearch({ ...opts, from: id } as any)\n// },\n\n// useParams: (opts) => {\n// return useParams({ ...opts, from: id } as any)\n// },\n\n// useLoaderDeps: (opts) => {\n// return useLoaderDeps({ ...opts, from: id } as any) as any\n// },\n\n// useLoaderData: (opts) => {\n// return useLoaderData({ ...opts, from: id } as any) as any\n// },\n// }\n// }\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema extends Record<\n string,\n any\n > = TRoute['types']['fullSearchSchema'],\n TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n TLoaderData extends any = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema extends Record<\n string,\n any\n > = TRoute['types']['fullSearchSchema'],\n TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n TLoaderData extends any = TRoute['types']['loaderData'],\n> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (s: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (s: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ route: this.id as string, ...opts })\n }\n}\n\n/**\n * @deprecated Use the `createRoute` function instead.\n */\nexport class Route<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends Record<\n string,\n any\n > = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n\n constructor(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n routeTree: TRouteTree\n routerContext: TRouterContext\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }) => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n (this.parentRoute.id as any) === rootRouteId\n ? ''\n : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <TNewChildren extends AnyRoute[]>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TNewChildren,\n TRouteTree\n > => {\n this.children = children as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData extends any = unknown>(options: {\n loader: RouteLoaderFn<\n TAllParams,\n TLoaderDeps,\n TAllContext,\n TRouteContext,\n TNewLoaderData\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren,\n TRouteTree\n >\n }\n\n update = (options: UpdatableRouteOptions<TFullSearchSchema, TLoaderData>) => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>) => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends Record<\n string,\n any\n > = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n >(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, //TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) => {\n return createRootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport type RootSearchSchema = {\n __TRootSearchSchema__: '__TRootSearchSchema__'\n}\n\nexport class RootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext\n TRouterContext, // TRouterContext\n TLoaderDeps,\n TLoaderData,\n any, // TChildren\n any // TRouteTree\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n>(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n) {\n return new RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info: { componentStack: string }\n}\n\nexport type ErrorComponentProps = {\n error: unknown\n info: { componentStack: string }\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = SyncRouteComponent<TProps> &\n AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","notFound","options","path","trimPathLeft","joinPaths"],"mappings":"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"}
@@ -81,7 +81,7 @@ export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>,
81
81
  onLeave?: (match: AnyRouteMatch) => void;
82
82
  meta?: (ctx: {
83
83
  loaderData: TLoaderData;
84
- }) => JSX.IntrinsicElements['meta'][];
84
+ }) => JSX.IntrinsicElements['meta'][] | Promise<JSX.IntrinsicElements['meta'][]>;
85
85
  links?: () => JSX.IntrinsicElements['link'][];
86
86
  scripts?: () => JSX.IntrinsicElements['script'][];
87
87
  } & UpdatableStaticRouteOption;
@@ -180,11 +180,11 @@ export type RouteConstraints = {
180
180
  TRouteTree: AnyRoute;
181
181
  };
182
182
  export declare function getRouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']>(id: TId): RouteApi<TId, TRoute, TFullSearchSchema, TAllParams, TAllContext, TLoaderDeps, TLoaderData>;
183
- /**
184
- * @deprecated Use the `getRouteApi` function instead.
185
- */
186
183
  export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']> {
187
184
  id: TId;
185
+ /**
186
+ * @deprecated Use the `getRouteApi` function instead.
187
+ */
188
188
  constructor({ id }: {
189
189
  id: TId;
190
190
  });
@@ -289,9 +289,6 @@ export declare const rootRouteWithContext: typeof createRootRouteWithContext;
289
289
  export type RootSearchSchema = {
290
290
  __TRootSearchSchema__: '__TRootSearchSchema__';
291
291
  };
292
- /**
293
- * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
294
- */
295
292
  export declare class RootRoute<TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> extends Route<any, // TParentRoute
296
293
  '/', // TPath
297
294
  '/', // TFullPath
@@ -309,6 +306,9 @@ Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext
309
306
  TRouterContext, // TRouterContext
310
307
  TLoaderDeps, TLoaderData, any, // TChildren
311
308
  any> {
309
+ /**
310
+ * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
311
+ */
312
312
  constructor(options?: Omit<RouteOptions<AnyRoute, // TParentRoute
313
313
  RootRouteId, // TCustomId
314
314
  '', // TPath
@@ -733,9 +733,9 @@ class Router {
733
733
  }
734
734
  if (latestPromise = checkLatest())
735
735
  return await latestPromise;
736
- const meta = (_d = (_c = route2.options).meta) == null ? void 0 : _d.call(_c, {
736
+ const meta = await ((_d = (_c = route2.options).meta) == null ? void 0 : _d.call(_c, {
737
737
  loaderData
738
- });
738
+ }));
739
739
  matches[index] = match = {
740
740
  ...match,
741
741
  error: void 0,
@@ -993,14 +993,11 @@ class Router {
993
993
  this.injectHtml(async () => {
994
994
  const id = `__TSR_DEHYDRATED__${strKey}`;
995
995
  const data = typeof getData === "function" ? await getData() : getData;
996
- return `<script id='${id}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${utils.escapeJSON(
996
+ return `<script id='${id}' suppressHydrationWarning>
997
+ window["__TSR_DEHYDRATED__${utils.escapeJSON(
997
998
  strKey
998
999
  )}"] = ${JSON.stringify(this.options.transformer.stringify(data))}
999
- ;(() => {
1000
- var el = document.getElementById('${id}')
1001
- el.parentElement.removeChild(el)
1002
- })()
1003
- <\/script>`;
1000
+ <\/script>`;
1004
1001
  });
1005
1002
  return () => this.hydrateData(key);
1006
1003
  }