@tanstack/react-router 1.1.5 → 1.1.7

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
  }
@@ -13,7 +14,7 @@ export type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends strin
13
14
  export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
14
15
  path: TFilePath;
15
16
  constructor(path: TFilePath);
16
- createRoute: <TSearchSchemaInput extends import("./route").AnySearchSchema = {}, TSearchSchema extends import("./route").AnySearchSchema = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? TSearchSchemaInput : TSearchSchema, TFullSearchSchemaInput extends import("./route").AnySearchSchema = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends import("./route").AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends Record<string, any> = MergeFromFromParent<TParentRoute["types"]["allParams"], TParams>, TRouteContext extends RouteContext = RouteContext, TContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & {
17
+ createRoute: <TSearchSchemaInput extends import("./route").AnySearchSchema = {}, TSearchSchema extends import("./route").AnySearchSchema = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, "__TSearchSchemaInput__"> : TSearchSchema, TFullSearchSchemaInput extends import("./route").AnySearchSchema = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends import("./route").AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends Record<string, any> = MergeFromFromParent<TParentRoute["types"]["allParams"], TParams>, TRouteContext extends RouteContext = RouteContext, TContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & {
17
18
  meta?: import("./route").RouteMeta | undefined;
18
19
  } & {
19
20
  caseSensitive?: boolean | undefined;
@@ -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;