@tanstack/react-router 1.1.6 → 1.1.8

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,5 +1,6 @@
1
+ import { NoInfer } from '@tanstack/react-store';
1
2
  import { ParsePathParams } from './link';
2
- import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints, ResolveFullSearchSchemaInput, SearchSchemaInput } from './route';
3
+ import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints, ResolveFullSearchSchemaInput, SearchSchemaInput, RouteLoaderFn } from './route';
3
4
  import { Assign, Expand, IsAny } from './utils';
4
5
  export interface FileRoutesByPath {
5
6
  }
@@ -35,4 +36,5 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
35
36
  onLeave?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
36
37
  }) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
37
38
  }
39
+ export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderData extends any>(loaderFn: RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], TRoute['types']['routeContext'], TLoaderData>) => RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], TRoute['types']['routeContext'], NoInfer<TLoaderData>>;
38
40
  export {};
@@ -211,6 +211,9 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
211
211
  originalIndex: number;
212
212
  }) => void;
213
213
  addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TNewChildren, TRouteTree>;
214
+ updateLoader: <TNewLoaderData extends unknown = unknown>(options: {
215
+ loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TRouteContext, TNewLoaderData>;
216
+ }) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TNewLoaderData, TChildren, TRouteTree>;
214
217
  update: (options: UpdatableRouteOptions<TFullSearchSchema>) => this;
215
218
  useMatch: <TSelected = TAllContext>(opts?: {
216
219
  select?: ((search: TAllContext) => TSelected) | undefined;
@@ -178,7 +178,7 @@ export declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated
178
178
  dehydrate: () => DehydratedRouter;
179
179
  hydrate: (__do_not_use_server_ctx?: HydrationCtx) => Promise<void>;
180
180
  }
181
- export declare function lazyFn<T extends Record<string, (...args: any[]) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<ReturnType<T[TKey]>>;
181
+ export declare function lazyFn<T extends Record<string, (...args: any[]) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
182
182
  export declare class SearchParamError extends Error {
183
183
  }
184
184
  export declare class PathParamError extends Error {
@@ -1579,6 +1579,10 @@
1579
1579
  this.children = children;
1580
1580
  return this;
1581
1581
  };
1582
+ updateLoader = options => {
1583
+ Object.assign(this.options, options);
1584
+ return this;
1585
+ };
1582
1586
  update = options => {
1583
1587
  Object.assign(this.options, options);
1584
1588
  return this;
@@ -1656,6 +1660,9 @@
1656
1660
  return route;
1657
1661
  };
1658
1662
  }
1663
+ function FileRouteLoader(_path) {
1664
+ return loaderFn => loaderFn;
1665
+ }
1659
1666
 
1660
1667
  function lazyRouteComponent(importer, exportName) {
1661
1668
  let loadPromise;
@@ -3293,6 +3300,7 @@
3293
3300
  exports.CatchBoundaryImpl = CatchBoundaryImpl;
3294
3301
  exports.ErrorComponent = ErrorComponent;
3295
3302
  exports.FileRoute = FileRoute;
3303
+ exports.FileRouteLoader = FileRouteLoader;
3296
3304
  exports.Link = Link;
3297
3305
  exports.Match = Match;
3298
3306
  exports.MatchRoute = MatchRoute;