@tanstack/react-router 1.33.7 → 1.33.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,4 +1,5 @@
1
1
  import { Store, NoInfer } from '@tanstack/react-store';
2
+ import { Manifest } from './manifest.cjs';
2
3
  import { HistoryState, RouterHistory } from '@tanstack/history';
3
4
  import { AnyContext, AnyRoute, AnySearchSchema, ErrorRouteComponent, NotFoundRouteComponent, RouteMask, RouteComponent } from './route.cjs';
4
5
  import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.cjs';
@@ -297,6 +298,7 @@ export interface DehydratedRouterState {
297
298
  export type DehydratedRouteMatch = Pick<MakeRouteMatch, 'id' | 'status' | 'updatedAt' | 'loaderData'>;
298
299
  export interface DehydratedRouter {
299
300
  state: DehydratedRouterState;
301
+ manifest?: Manifest;
300
302
  }
301
303
  export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDehydrated extends Record<string, any>, TSerializedError extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDehydrated, TSerializedError>, 'context'> & RouterContextOptions<TRouteTree>;
302
304
  export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
@@ -335,6 +337,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
335
337
  injectedHtml: Array<InjectedHtmlEntry>;
336
338
  dehydratedData?: TDehydrated;
337
339
  viewTransitionPromise?: ControlledPromise<true>;
340
+ manifest?: Manifest;
338
341
  __store: Store<RouterState<TRouteTree>>;
339
342
  options: PickAsRequired<Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDehydrated, TSerializedError>, 'transformer'> & {
340
343
  transformer: RouterTransformer;
@@ -36,3 +36,4 @@ export { escapeJSON, // SSR
36
36
  useLayoutEffect, // SSR
37
37
  pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
38
38
  export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, type NotFoundError, } from './not-found.js';
39
+ export { type Manifest, type RouterManagedTag } from './manifest.js';
@@ -0,0 +1,23 @@
1
+ export type Manifest = {
2
+ routes: Record<string, {
3
+ preloads?: Array<string>;
4
+ assets?: Array<RouterManagedTag>;
5
+ }>;
6
+ };
7
+ export type RouterManagedTag = {
8
+ tag: 'title';
9
+ attrs?: Record<string, any>;
10
+ children: string;
11
+ } | {
12
+ tag: 'meta' | 'link';
13
+ attrs?: Record<string, any>;
14
+ children?: never;
15
+ } | {
16
+ tag: 'script';
17
+ attrs?: Record<string, any>;
18
+ children?: string;
19
+ } | {
20
+ tag: 'style';
21
+ attrs?: Record<string, any>;
22
+ children?: string;
23
+ };
@@ -1,4 +1,5 @@
1
1
  import { Store, NoInfer } from '@tanstack/react-store';
2
+ import { Manifest } from './manifest.js';
2
3
  import { HistoryState, RouterHistory } from '@tanstack/history';
3
4
  import { AnyContext, AnyRoute, AnySearchSchema, ErrorRouteComponent, NotFoundRouteComponent, RouteMask, RouteComponent } from './route.js';
4
5
  import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.js';
@@ -297,6 +298,7 @@ export interface DehydratedRouterState {
297
298
  export type DehydratedRouteMatch = Pick<MakeRouteMatch, 'id' | 'status' | 'updatedAt' | 'loaderData'>;
298
299
  export interface DehydratedRouter {
299
300
  state: DehydratedRouterState;
301
+ manifest?: Manifest;
300
302
  }
301
303
  export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDehydrated extends Record<string, any>, TSerializedError extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDehydrated, TSerializedError>, 'context'> & RouterContextOptions<TRouteTree>;
302
304
  export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
@@ -335,6 +337,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
335
337
  injectedHtml: Array<InjectedHtmlEntry>;
336
338
  dehydratedData?: TDehydrated;
337
339
  viewTransitionPromise?: ControlledPromise<true>;
340
+ manifest?: Manifest;
338
341
  __store: Store<RouterState<TRouteTree>>;
339
342
  options: PickAsRequired<Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDehydrated, TSerializedError>, 'transformer'> & {
340
343
  transformer: RouterTransformer;
@@ -1205,7 +1205,8 @@ class Router {
1205
1205
  __isServerError: true
1206
1206
  } : void 0
1207
1207
  }))
1208
- }
1208
+ },
1209
+ manifest: this.manifest
1209
1210
  };
1210
1211
  };
1211
1212
  this.hydrate = async (__do_not_use_server_ctx) => {
@@ -1256,6 +1257,7 @@ class Router {
1256
1257
  matches
1257
1258
  };
1258
1259
  });
1260
+ this.manifest = ctx.router.manifest;
1259
1261
  };
1260
1262
  this.handleNotFound = (matches, err) => {
1261
1263
  const matchesByRouteId = Object.fromEntries(