@tanstack/react-router 1.33.6 → 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.
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/manifest.d.cts +23 -0
- package/dist/cjs/router.cjs +7 -5
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/manifest.d.ts +23 -0
- package/dist/esm/router.d.ts +3 -0
- package/dist/esm/router.js +7 -5
- package/dist/esm/router.js.map +1 -1
- package/package.json +2 -1
- package/src/index.tsx +1 -0
- package/src/manifest.ts +31 -0
- package/src/router.ts +10 -4
|
@@ -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
|
+
};
|
package/dist/esm/router.d.ts
CHANGED
|
@@ -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;
|
package/dist/esm/router.js
CHANGED
|
@@ -803,13 +803,13 @@ class Router {
|
|
|
803
803
|
err = errorHandlerErr;
|
|
804
804
|
handleRedirectAndNotFound(match, err);
|
|
805
805
|
}
|
|
806
|
-
matches[index] = match = {
|
|
806
|
+
matches[index] = match = updateMatch(match.id, () => ({
|
|
807
807
|
...match,
|
|
808
808
|
error: err,
|
|
809
809
|
status: "error",
|
|
810
810
|
updatedAt: Date.now(),
|
|
811
811
|
abortController: new AbortController()
|
|
812
|
-
};
|
|
812
|
+
}));
|
|
813
813
|
};
|
|
814
814
|
if (match.paramsError) {
|
|
815
815
|
handleSerialError(match.paramsError, "PARSE_PARAMS");
|
|
@@ -819,8 +819,8 @@ class Router {
|
|
|
819
819
|
}
|
|
820
820
|
try {
|
|
821
821
|
const parentContext = (parentMatch == null ? void 0 : parentMatch.context) ?? this.options.context ?? {};
|
|
822
|
-
matches[index] = match = updateMatch(match.id, (
|
|
823
|
-
...
|
|
822
|
+
matches[index] = match = updateMatch(match.id, () => ({
|
|
823
|
+
...match,
|
|
824
824
|
routeContext: replaceEqualDeep(
|
|
825
825
|
match.routeContext,
|
|
826
826
|
parentContext
|
|
@@ -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(
|