@tanstack/react-router 1.22.9 → 1.23.1
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.cjs +16 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +30 -28
- package/dist/cjs/redirects.cjs.map +1 -1
- package/dist/cjs/redirects.d.cts +1 -1
- package/dist/esm/index.d.ts +30 -28
- package/dist/esm/index.js +6 -6
- package/dist/esm/redirects.d.ts +1 -1
- package/dist/esm/redirects.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +279 -28
- package/src/redirects.ts +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,22 @@ const useRouter = require("./useRouter.cjs");
|
|
|
28
28
|
const useRouterState = require("./useRouterState.cjs");
|
|
29
29
|
const utils = require("./utils.cjs");
|
|
30
30
|
const notFound = require("./not-found.cjs");
|
|
31
|
+
Object.defineProperty(exports, "createBrowserHistory", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: () => history.createBrowserHistory
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "createHashHistory", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: () => history.createHashHistory
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "createHistory", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: () => history.createHistory
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "createMemoryHistory", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: () => history.createMemoryHistory
|
|
46
|
+
});
|
|
31
47
|
exports.invariant = invariant;
|
|
32
48
|
exports.warning = warning;
|
|
33
49
|
exports.Await = awaited.Await;
|
|
@@ -117,14 +133,10 @@ exports.useRouter = useRouter.useRouter;
|
|
|
117
133
|
exports.useRouterState = useRouterState.useRouterState;
|
|
118
134
|
exports.deepEqual = utils.deepEqual;
|
|
119
135
|
exports.escapeJSON = utils.escapeJSON;
|
|
120
|
-
exports.exactPathTest = utils.exactPathTest;
|
|
121
136
|
exports.functionalUpdate = utils.functionalUpdate;
|
|
122
137
|
exports.isPlainArray = utils.isPlainArray;
|
|
123
138
|
exports.isPlainObject = utils.isPlainObject;
|
|
124
|
-
exports.isServer = utils.isServer;
|
|
125
|
-
exports.last = utils.last;
|
|
126
139
|
exports.pick = utils.pick;
|
|
127
|
-
exports.removeTrailingSlash = utils.removeTrailingSlash;
|
|
128
140
|
exports.replaceEqualDeep = utils.replaceEqualDeep;
|
|
129
141
|
exports.shallow = utils.shallow;
|
|
130
142
|
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
@@ -133,11 +145,4 @@ exports.CatchNotFound = notFound.CatchNotFound;
|
|
|
133
145
|
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
134
146
|
exports.isNotFound = notFound.isNotFound;
|
|
135
147
|
exports.notFound = notFound.notFound;
|
|
136
|
-
Object.keys(history).forEach((k) => {
|
|
137
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
|
|
138
|
-
Object.defineProperty(exports, k, {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
get: () => history[k]
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
148
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, type BlockerFn, type HistoryLocation, type RouterHistory, type ParsedPath, type HistoryState, } from '@tanstack/history';
|
|
2
2
|
export { default as invariant } from 'tiny-invariant';
|
|
3
3
|
export { default as warning } from 'tiny-warning';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
4
|
+
export { useAwaited, Await, type AwaitOptions } from './awaited.cjs';
|
|
5
|
+
export { defer, isDehydratedDeferred, type DeferredPromiseState, type DeferredPromise, } from './defer.cjs';
|
|
6
|
+
export { CatchBoundary, CatchBoundaryImpl, ErrorComponent, } from './CatchBoundary.cjs';
|
|
7
|
+
export { FileRoute, createFileRoute, FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, type FileRoutesByPath, type Trim, type TrimLeft, type TrimRight, type RemoveUnderScores, type ResolveFilePath, type FileRoutePath, type LazyRouteOptions, } from './fileRoute.cjs';
|
|
8
8
|
export * from './history.cjs';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
|
|
9
|
+
export { lazyRouteComponent } from './lazyRouteComponent.cjs';
|
|
10
|
+
export { useLinkProps, createLink, Link, type CleanPath, type Split, type ParsePathParams, type Join, type Last, type RemoveTrailingSlashes, type RemoveLeadingSlashes, type SearchPaths, type SearchRelativePathAutoComplete, type RelativeToParentPathAutoComplete, type RelativeToCurrentPathAutoComplete, type AbsolutePathAutoComplete, type RelativeToPathAutoComplete, type NavigateOptions, type ToOptions, type ToMaskOptions, type ToSubOptions, type ResolveRoute, type ParamOptions, type SearchParamOptions, type PathParamOptions, type ToPathOption, type ActiveOptions, type LinkOptions, type CheckPath, type CheckPathError, type ResolveRelativePath, type UseLinkPropsOptions, type ActiveLinkOptions, type LinkProps, type LinkComponent, } from './link.cjs';
|
|
11
|
+
export { type ParsedLocation } from './location.cjs';
|
|
12
|
+
export { matchContext, Matches, Match, Outlet, useMatchRoute, MatchRoute, useMatch, useMatches, useParentMatches, useChildMatches, useLoaderDeps, useLoaderData, isServerSideError, defaultDeserializeError, getRenderedMatches, type RouteMatch, type AnyRouteMatch, type MatchRouteOptions, type UseMatchRouteOptions, type MakeMatchRouteOptions, } from './Matches.cjs';
|
|
13
|
+
export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, type Segment, } from './path.cjs';
|
|
14
|
+
export { encode, decode } from './qss.cjs';
|
|
15
|
+
export { redirect, isRedirect, type AnyRedirect, type Redirect, type ResolvedRedirect, } from './redirects.cjs';
|
|
16
|
+
export { rootRouteId, RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, type RootRouteId, type AnyPathParams, type SearchSchemaInput, type AnySearchSchema, type AnyContext, type RouteContext, type PreloadableObj, type RoutePathOptions, type StaticDataRouteOption, type RoutePathOptionsIntersection, type RouteOptions, type ParamsFallback, type FileBaseRouteOptions, type BaseRouteOptions, type UpdatableRouteOptions, type UpdatableStaticRouteOption, type MetaDescriptor, type RouteLinkEntry, type ParseParamsOption, type ParseParamsFn, type ParseParamsObj, type SearchSchemaValidator, type SearchSchemaValidatorObj, type SearchSchemaValidatorFn, type RouteLoaderFn, type LoaderFnContext, type SearchFilter, type ResolveId, type InferFullSearchSchema, type InferFullSearchSchemaInput, type ResolveFullSearchSchema, type ResolveFullSearchSchemaInput, type AnyRoute, type MergeFromFromParent, type ResolveAllParams, type RouteConstraints, type AnyRootRoute, type RootSearchSchema, type ResolveFullPath, type RouteMask, type ErrorRouteProps, type ErrorComponentProps, type NotFoundRouteProps, type ReactNode, type SyncRouteComponent, type AsyncRouteComponent, type RouteComponent, type ErrorRouteComponent, type NotFoundRouteComponent, type TrimPath, type TrimPathLeft, type TrimPathRight, } from './route.cjs';
|
|
17
|
+
export { type ParseRoute, type RoutesById, type RouteById, type RouteIds, type RoutesByPath, type RouteByPath, type RoutePaths, type RoutePathsAutoComplete, type FullSearchSchema, type AllParams, } from './routeInfo.cjs';
|
|
18
|
+
export { componentTypes, createRouter, Router, lazyFn, SearchParamError, PathParamError, getInitialRouterState, defaultSerializeError, type Register, type AnyRouter, type RegisteredRouter, type HydrationCtx, type RouterContextOptions, type RouterOptions, type RouterTransformer, type RouterErrorSerializer, type RouterState, type ListenerFn, type BuildNextOptions, type DehydratedRouterState, type DehydratedRouteMatch, type DehydratedRouter, type RouterConstructorOptions, type RouterEvents, type RouterEvent, type RouterListener, } from './router.cjs';
|
|
19
|
+
export { RouterProvider, getRouteMatch, type RouterProps, type CommitLocationOptions, type MatchLocation, type NavigateFn, type BuildLocationFn, type InjectedHtmlEntry, } from './RouterProvider.cjs';
|
|
20
|
+
export { useScrollRestoration, useElementScrollRestoration, ScrollRestoration, type ScrollRestorationOptions, } from './scroll-restoration.cjs';
|
|
21
|
+
export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, type SearchSerializer, type SearchParser, } from './searchParams.cjs';
|
|
22
|
+
export { useBlocker, Block } from './useBlocker.cjs';
|
|
23
|
+
export { useNavigate, Navigate, type UseNavigateResult } from './useNavigate.cjs';
|
|
24
|
+
export { useParams } from './useParams.cjs';
|
|
25
|
+
export { useSearch } from './useSearch.cjs';
|
|
26
|
+
export { getRouterContext, } from './routerContext.cjs';
|
|
27
|
+
export { useRouteContext } from './useRouteContext.cjs';
|
|
28
|
+
export { useRouter } from './useRouter.cjs';
|
|
29
|
+
export { useRouterState } from './useRouterState.cjs';
|
|
30
|
+
export { escapeJSON, // SSR
|
|
31
|
+
useLayoutEffect, // SSR
|
|
32
|
+
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
|
|
33
|
+
export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, type NotFoundError, } from './not-found.cjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.cjs","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter } from './router'\nimport type { PickAsRequired } from '
|
|
1
|
+
{"version":3,"file":"redirects.cjs","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter } from './router'\nimport type { PickAsRequired } from './utils'\n\nexport type AnyRedirect = Redirect<any, any, any, any, any>\n\nexport type Redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = {\n /**\n * @deprecated Use `statusCode` instead\n **/\n href?: string\n code?: number\n statusCode?: number\n throw?: any\n headers?: HeadersInit\n} & NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type ResolvedRedirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = PickAsRequired<\n Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n 'code' | 'statusCode' | 'href' | 'headers'\n>\n\nexport function redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n>(\n opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 301\n opts.headers = opts.headers || {}\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n"],"names":[],"mappings":";;AAoCO,SAAS,SAOd,MACsD;AACpD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAA;AAC/B,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EACR;AAEO,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;;;"}
|
package/dist/cjs/redirects.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import type { NavigateOptions } from './link.cjs';
|
|
|
2
2
|
import type { AnyRoute } from './route.cjs';
|
|
3
3
|
import type { RoutePaths } from './routeInfo.cjs';
|
|
4
4
|
import type { RegisteredRouter } from './router.cjs';
|
|
5
|
-
import type { PickAsRequired } from '.';
|
|
5
|
+
import type { PickAsRequired } from './utils.cjs';
|
|
6
6
|
export type AnyRedirect = Redirect<any, any, any, any, any>;
|
|
7
7
|
export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = {
|
|
8
8
|
/**
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, type BlockerFn, type HistoryLocation, type RouterHistory, type ParsedPath, type HistoryState, } from '@tanstack/history';
|
|
2
2
|
export { default as invariant } from 'tiny-invariant';
|
|
3
3
|
export { default as warning } from 'tiny-warning';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
4
|
+
export { useAwaited, Await, type AwaitOptions } from './awaited.js';
|
|
5
|
+
export { defer, isDehydratedDeferred, type DeferredPromiseState, type DeferredPromise, } from './defer.js';
|
|
6
|
+
export { CatchBoundary, CatchBoundaryImpl, ErrorComponent, } from './CatchBoundary.js';
|
|
7
|
+
export { FileRoute, createFileRoute, FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, type FileRoutesByPath, type Trim, type TrimLeft, type TrimRight, type RemoveUnderScores, type ResolveFilePath, type FileRoutePath, type LazyRouteOptions, } from './fileRoute.js';
|
|
8
8
|
export * from './history.js';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
|
|
9
|
+
export { lazyRouteComponent } from './lazyRouteComponent.js';
|
|
10
|
+
export { useLinkProps, createLink, Link, type CleanPath, type Split, type ParsePathParams, type Join, type Last, type RemoveTrailingSlashes, type RemoveLeadingSlashes, type SearchPaths, type SearchRelativePathAutoComplete, type RelativeToParentPathAutoComplete, type RelativeToCurrentPathAutoComplete, type AbsolutePathAutoComplete, type RelativeToPathAutoComplete, type NavigateOptions, type ToOptions, type ToMaskOptions, type ToSubOptions, type ResolveRoute, type ParamOptions, type SearchParamOptions, type PathParamOptions, type ToPathOption, type ActiveOptions, type LinkOptions, type CheckPath, type CheckPathError, type ResolveRelativePath, type UseLinkPropsOptions, type ActiveLinkOptions, type LinkProps, type LinkComponent, } from './link.js';
|
|
11
|
+
export { type ParsedLocation } from './location.js';
|
|
12
|
+
export { matchContext, Matches, Match, Outlet, useMatchRoute, MatchRoute, useMatch, useMatches, useParentMatches, useChildMatches, useLoaderDeps, useLoaderData, isServerSideError, defaultDeserializeError, getRenderedMatches, type RouteMatch, type AnyRouteMatch, type MatchRouteOptions, type UseMatchRouteOptions, type MakeMatchRouteOptions, } from './Matches.js';
|
|
13
|
+
export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, type Segment, } from './path.js';
|
|
14
|
+
export { encode, decode } from './qss.js';
|
|
15
|
+
export { redirect, isRedirect, type AnyRedirect, type Redirect, type ResolvedRedirect, } from './redirects.js';
|
|
16
|
+
export { rootRouteId, RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, type RootRouteId, type AnyPathParams, type SearchSchemaInput, type AnySearchSchema, type AnyContext, type RouteContext, type PreloadableObj, type RoutePathOptions, type StaticDataRouteOption, type RoutePathOptionsIntersection, type RouteOptions, type ParamsFallback, type FileBaseRouteOptions, type BaseRouteOptions, type UpdatableRouteOptions, type UpdatableStaticRouteOption, type MetaDescriptor, type RouteLinkEntry, type ParseParamsOption, type ParseParamsFn, type ParseParamsObj, type SearchSchemaValidator, type SearchSchemaValidatorObj, type SearchSchemaValidatorFn, type RouteLoaderFn, type LoaderFnContext, type SearchFilter, type ResolveId, type InferFullSearchSchema, type InferFullSearchSchemaInput, type ResolveFullSearchSchema, type ResolveFullSearchSchemaInput, type AnyRoute, type MergeFromFromParent, type ResolveAllParams, type RouteConstraints, type AnyRootRoute, type RootSearchSchema, type ResolveFullPath, type RouteMask, type ErrorRouteProps, type ErrorComponentProps, type NotFoundRouteProps, type ReactNode, type SyncRouteComponent, type AsyncRouteComponent, type RouteComponent, type ErrorRouteComponent, type NotFoundRouteComponent, type TrimPath, type TrimPathLeft, type TrimPathRight, } from './route.js';
|
|
17
|
+
export { type ParseRoute, type RoutesById, type RouteById, type RouteIds, type RoutesByPath, type RouteByPath, type RoutePaths, type RoutePathsAutoComplete, type FullSearchSchema, type AllParams, } from './routeInfo.js';
|
|
18
|
+
export { componentTypes, createRouter, Router, lazyFn, SearchParamError, PathParamError, getInitialRouterState, defaultSerializeError, type Register, type AnyRouter, type RegisteredRouter, type HydrationCtx, type RouterContextOptions, type RouterOptions, type RouterTransformer, type RouterErrorSerializer, type RouterState, type ListenerFn, type BuildNextOptions, type DehydratedRouterState, type DehydratedRouteMatch, type DehydratedRouter, type RouterConstructorOptions, type RouterEvents, type RouterEvent, type RouterListener, } from './router.js';
|
|
19
|
+
export { RouterProvider, getRouteMatch, type RouterProps, type CommitLocationOptions, type MatchLocation, type NavigateFn, type BuildLocationFn, type InjectedHtmlEntry, } from './RouterProvider.js';
|
|
20
|
+
export { useScrollRestoration, useElementScrollRestoration, ScrollRestoration, type ScrollRestorationOptions, } from './scroll-restoration.js';
|
|
21
|
+
export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, type SearchSerializer, type SearchParser, } from './searchParams.js';
|
|
22
|
+
export { useBlocker, Block } from './useBlocker.js';
|
|
23
|
+
export { useNavigate, Navigate, type UseNavigateResult } from './useNavigate.js';
|
|
24
|
+
export { useParams } from './useParams.js';
|
|
25
|
+
export { useSearch } from './useSearch.js';
|
|
26
|
+
export { getRouterContext, } from './routerContext.js';
|
|
27
|
+
export { useRouteContext } from './useRouteContext.js';
|
|
28
|
+
export { useRouter } from './useRouter.js';
|
|
29
|
+
export { useRouterState } from './useRouterState.js';
|
|
30
|
+
export { escapeJSON, // SSR
|
|
31
|
+
useLayoutEffect, // SSR
|
|
32
|
+
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
|
|
33
|
+
export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, type NotFoundError, } from './not-found.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
2
2
|
import { default as default2 } from "tiny-invariant";
|
|
3
3
|
import { default as default3 } from "tiny-warning";
|
|
4
4
|
import { Await, useAwaited } from "./awaited.js";
|
|
@@ -24,7 +24,7 @@ import { getRouterContext } from "./routerContext.js";
|
|
|
24
24
|
import { useRouteContext } from "./useRouteContext.js";
|
|
25
25
|
import { useRouter } from "./useRouter.js";
|
|
26
26
|
import { useRouterState } from "./useRouterState.js";
|
|
27
|
-
import { deepEqual, escapeJSON,
|
|
27
|
+
import { deepEqual, escapeJSON, functionalUpdate, isPlainArray, isPlainObject, pick, replaceEqualDeep, shallow, useLayoutEffect, useStableCallback } from "./utils.js";
|
|
28
28
|
import { CatchNotFound, DefaultGlobalNotFound, isNotFound, notFound } from "./not-found.js";
|
|
29
29
|
export {
|
|
30
30
|
Await,
|
|
@@ -54,10 +54,14 @@ export {
|
|
|
54
54
|
SearchParamError,
|
|
55
55
|
cleanPath,
|
|
56
56
|
componentTypes,
|
|
57
|
+
createBrowserHistory,
|
|
57
58
|
createFileRoute,
|
|
59
|
+
createHashHistory,
|
|
60
|
+
createHistory,
|
|
58
61
|
createLazyFileRoute,
|
|
59
62
|
createLazyRoute,
|
|
60
63
|
createLink,
|
|
64
|
+
createMemoryHistory,
|
|
61
65
|
createRootRoute,
|
|
62
66
|
createRootRouteWithContext,
|
|
63
67
|
createRoute,
|
|
@@ -72,7 +76,6 @@ export {
|
|
|
72
76
|
defer,
|
|
73
77
|
encode,
|
|
74
78
|
escapeJSON,
|
|
75
|
-
exactPathTest,
|
|
76
79
|
functionalUpdate,
|
|
77
80
|
getInitialRouterState,
|
|
78
81
|
getRenderedMatches,
|
|
@@ -86,10 +89,8 @@ export {
|
|
|
86
89
|
isPlainArray,
|
|
87
90
|
isPlainObject,
|
|
88
91
|
isRedirect,
|
|
89
|
-
isServer,
|
|
90
92
|
isServerSideError,
|
|
91
93
|
joinPaths,
|
|
92
|
-
last,
|
|
93
94
|
lazyFn,
|
|
94
95
|
lazyRouteComponent,
|
|
95
96
|
matchByPath,
|
|
@@ -101,7 +102,6 @@ export {
|
|
|
101
102
|
pick,
|
|
102
103
|
redirect,
|
|
103
104
|
removeBasepath,
|
|
104
|
-
removeTrailingSlash,
|
|
105
105
|
replaceEqualDeep,
|
|
106
106
|
resolvePath,
|
|
107
107
|
rootRouteId,
|
package/dist/esm/redirects.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { NavigateOptions } from './link.js';
|
|
|
2
2
|
import type { AnyRoute } from './route.js';
|
|
3
3
|
import type { RoutePaths } from './routeInfo.js';
|
|
4
4
|
import type { RegisteredRouter } from './router.js';
|
|
5
|
-
import type { PickAsRequired } from '.';
|
|
5
|
+
import type { PickAsRequired } from './utils.js';
|
|
6
6
|
export type AnyRedirect = Redirect<any, any, any, any, any>;
|
|
7
7
|
export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = {
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.js","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter } from './router'\nimport type { PickAsRequired } from '
|
|
1
|
+
{"version":3,"file":"redirects.js","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter } from './router'\nimport type { PickAsRequired } from './utils'\n\nexport type AnyRedirect = Redirect<any, any, any, any, any>\n\nexport type Redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = {\n /**\n * @deprecated Use `statusCode` instead\n **/\n href?: string\n code?: number\n statusCode?: number\n throw?: any\n headers?: HeadersInit\n} & NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type ResolvedRedirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = PickAsRequired<\n Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n 'code' | 'statusCode' | 'href' | 'headers'\n>\n\nexport function redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n>(\n opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 301\n opts.headers = opts.headers || {}\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n"],"names":[],"mappings":"AAoCO,SAAS,SAOd,MACsD;AACpD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAA;AAC/B,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EACR;AAEO,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,32 +1,283 @@
|
|
|
1
1
|
//
|
|
2
|
-
export
|
|
2
|
+
export {
|
|
3
|
+
createHistory,
|
|
4
|
+
createBrowserHistory,
|
|
5
|
+
createHashHistory,
|
|
6
|
+
createMemoryHistory,
|
|
7
|
+
type BlockerFn,
|
|
8
|
+
type HistoryLocation,
|
|
9
|
+
type RouterHistory,
|
|
10
|
+
type ParsedPath,
|
|
11
|
+
type HistoryState,
|
|
12
|
+
} from '@tanstack/history'
|
|
3
13
|
export { default as invariant } from 'tiny-invariant'
|
|
4
14
|
export { default as warning } from 'tiny-warning'
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
export { useAwaited, Await, type AwaitOptions } from './awaited'
|
|
16
|
+
export {
|
|
17
|
+
defer,
|
|
18
|
+
isDehydratedDeferred,
|
|
19
|
+
type DeferredPromiseState,
|
|
20
|
+
type DeferredPromise,
|
|
21
|
+
} from './defer'
|
|
22
|
+
export {
|
|
23
|
+
CatchBoundary,
|
|
24
|
+
CatchBoundaryImpl,
|
|
25
|
+
ErrorComponent,
|
|
26
|
+
} from './CatchBoundary'
|
|
27
|
+
export {
|
|
28
|
+
FileRoute,
|
|
29
|
+
createFileRoute,
|
|
30
|
+
FileRouteLoader,
|
|
31
|
+
LazyRoute,
|
|
32
|
+
createLazyRoute,
|
|
33
|
+
createLazyFileRoute,
|
|
34
|
+
type FileRoutesByPath,
|
|
35
|
+
type Trim,
|
|
36
|
+
type TrimLeft,
|
|
37
|
+
type TrimRight,
|
|
38
|
+
type RemoveUnderScores,
|
|
39
|
+
type ResolveFilePath,
|
|
40
|
+
type FileRoutePath,
|
|
41
|
+
type LazyRouteOptions,
|
|
42
|
+
} from './fileRoute'
|
|
9
43
|
export * from './history'
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
export { lazyRouteComponent } from './lazyRouteComponent'
|
|
45
|
+
export {
|
|
46
|
+
useLinkProps,
|
|
47
|
+
createLink,
|
|
48
|
+
Link,
|
|
49
|
+
type CleanPath,
|
|
50
|
+
type Split,
|
|
51
|
+
type ParsePathParams,
|
|
52
|
+
type Join,
|
|
53
|
+
type Last,
|
|
54
|
+
type RemoveTrailingSlashes,
|
|
55
|
+
type RemoveLeadingSlashes,
|
|
56
|
+
type SearchPaths,
|
|
57
|
+
type SearchRelativePathAutoComplete,
|
|
58
|
+
type RelativeToParentPathAutoComplete,
|
|
59
|
+
type RelativeToCurrentPathAutoComplete,
|
|
60
|
+
type AbsolutePathAutoComplete,
|
|
61
|
+
type RelativeToPathAutoComplete,
|
|
62
|
+
type NavigateOptions,
|
|
63
|
+
type ToOptions,
|
|
64
|
+
type ToMaskOptions,
|
|
65
|
+
type ToSubOptions,
|
|
66
|
+
type ResolveRoute,
|
|
67
|
+
type ParamOptions,
|
|
68
|
+
type SearchParamOptions,
|
|
69
|
+
type PathParamOptions,
|
|
70
|
+
type ToPathOption,
|
|
71
|
+
type ActiveOptions,
|
|
72
|
+
type LinkOptions,
|
|
73
|
+
type CheckPath,
|
|
74
|
+
type CheckPathError,
|
|
75
|
+
type ResolveRelativePath,
|
|
76
|
+
type UseLinkPropsOptions,
|
|
77
|
+
type ActiveLinkOptions,
|
|
78
|
+
type LinkProps,
|
|
79
|
+
type LinkComponent,
|
|
80
|
+
} from './link'
|
|
81
|
+
export { type ParsedLocation } from './location'
|
|
82
|
+
export {
|
|
83
|
+
matchContext,
|
|
84
|
+
Matches,
|
|
85
|
+
Match,
|
|
86
|
+
Outlet,
|
|
87
|
+
useMatchRoute,
|
|
88
|
+
MatchRoute,
|
|
89
|
+
useMatch,
|
|
90
|
+
useMatches,
|
|
91
|
+
useParentMatches,
|
|
92
|
+
useChildMatches,
|
|
93
|
+
useLoaderDeps,
|
|
94
|
+
useLoaderData,
|
|
95
|
+
isServerSideError,
|
|
96
|
+
defaultDeserializeError,
|
|
97
|
+
getRenderedMatches,
|
|
98
|
+
type RouteMatch,
|
|
99
|
+
type AnyRouteMatch,
|
|
100
|
+
type MatchRouteOptions,
|
|
101
|
+
type UseMatchRouteOptions,
|
|
102
|
+
type MakeMatchRouteOptions,
|
|
103
|
+
} from './Matches'
|
|
104
|
+
export {
|
|
105
|
+
joinPaths,
|
|
106
|
+
cleanPath,
|
|
107
|
+
trimPathLeft,
|
|
108
|
+
trimPathRight,
|
|
109
|
+
trimPath,
|
|
110
|
+
resolvePath,
|
|
111
|
+
parsePathname,
|
|
112
|
+
interpolatePath,
|
|
113
|
+
matchPathname,
|
|
114
|
+
removeBasepath,
|
|
115
|
+
matchByPath,
|
|
116
|
+
type Segment,
|
|
117
|
+
} from './path'
|
|
118
|
+
export { encode, decode } from './qss'
|
|
119
|
+
export {
|
|
120
|
+
redirect,
|
|
121
|
+
isRedirect,
|
|
122
|
+
type AnyRedirect,
|
|
123
|
+
type Redirect,
|
|
124
|
+
type ResolvedRedirect,
|
|
125
|
+
} from './redirects'
|
|
126
|
+
export {
|
|
127
|
+
rootRouteId,
|
|
128
|
+
RouteApi,
|
|
129
|
+
getRouteApi,
|
|
130
|
+
Route,
|
|
131
|
+
createRoute,
|
|
132
|
+
RootRoute,
|
|
133
|
+
rootRouteWithContext,
|
|
134
|
+
createRootRoute,
|
|
135
|
+
createRootRouteWithContext,
|
|
136
|
+
createRouteMask,
|
|
137
|
+
NotFoundRoute,
|
|
138
|
+
type RootRouteId,
|
|
139
|
+
type AnyPathParams,
|
|
140
|
+
type SearchSchemaInput,
|
|
141
|
+
type AnySearchSchema,
|
|
142
|
+
type AnyContext,
|
|
143
|
+
type RouteContext,
|
|
144
|
+
type PreloadableObj,
|
|
145
|
+
type RoutePathOptions,
|
|
146
|
+
type StaticDataRouteOption,
|
|
147
|
+
type RoutePathOptionsIntersection,
|
|
148
|
+
type RouteOptions,
|
|
149
|
+
type ParamsFallback,
|
|
150
|
+
type FileBaseRouteOptions,
|
|
151
|
+
type BaseRouteOptions,
|
|
152
|
+
type UpdatableRouteOptions,
|
|
153
|
+
type UpdatableStaticRouteOption,
|
|
154
|
+
type MetaDescriptor,
|
|
155
|
+
type RouteLinkEntry,
|
|
156
|
+
type ParseParamsOption,
|
|
157
|
+
type ParseParamsFn,
|
|
158
|
+
type ParseParamsObj,
|
|
159
|
+
type SearchSchemaValidator,
|
|
160
|
+
type SearchSchemaValidatorObj,
|
|
161
|
+
type SearchSchemaValidatorFn,
|
|
162
|
+
type RouteLoaderFn,
|
|
163
|
+
type LoaderFnContext,
|
|
164
|
+
type SearchFilter,
|
|
165
|
+
type ResolveId,
|
|
166
|
+
type InferFullSearchSchema,
|
|
167
|
+
type InferFullSearchSchemaInput,
|
|
168
|
+
type ResolveFullSearchSchema,
|
|
169
|
+
type ResolveFullSearchSchemaInput,
|
|
170
|
+
type AnyRoute,
|
|
171
|
+
type MergeFromFromParent,
|
|
172
|
+
type ResolveAllParams,
|
|
173
|
+
type RouteConstraints,
|
|
174
|
+
type AnyRootRoute,
|
|
175
|
+
type RootSearchSchema,
|
|
176
|
+
type ResolveFullPath,
|
|
177
|
+
type RouteMask,
|
|
178
|
+
type ErrorRouteProps,
|
|
179
|
+
type ErrorComponentProps,
|
|
180
|
+
type NotFoundRouteProps,
|
|
181
|
+
type ReactNode,
|
|
182
|
+
type SyncRouteComponent,
|
|
183
|
+
type AsyncRouteComponent,
|
|
184
|
+
type RouteComponent,
|
|
185
|
+
type ErrorRouteComponent,
|
|
186
|
+
type NotFoundRouteComponent,
|
|
187
|
+
type TrimPath,
|
|
188
|
+
type TrimPathLeft,
|
|
189
|
+
type TrimPathRight,
|
|
190
|
+
} from './route'
|
|
191
|
+
export {
|
|
192
|
+
type ParseRoute,
|
|
193
|
+
type RoutesById,
|
|
194
|
+
type RouteById,
|
|
195
|
+
type RouteIds,
|
|
196
|
+
type RoutesByPath,
|
|
197
|
+
type RouteByPath,
|
|
198
|
+
type RoutePaths,
|
|
199
|
+
type RoutePathsAutoComplete,
|
|
200
|
+
type FullSearchSchema,
|
|
201
|
+
type AllParams,
|
|
202
|
+
} from './routeInfo'
|
|
203
|
+
export {
|
|
204
|
+
componentTypes,
|
|
205
|
+
createRouter,
|
|
206
|
+
Router,
|
|
207
|
+
lazyFn,
|
|
208
|
+
SearchParamError,
|
|
209
|
+
PathParamError,
|
|
210
|
+
getInitialRouterState,
|
|
211
|
+
defaultSerializeError,
|
|
212
|
+
type Register,
|
|
213
|
+
type AnyRouter,
|
|
214
|
+
type RegisteredRouter,
|
|
215
|
+
type HydrationCtx,
|
|
216
|
+
type RouterContextOptions,
|
|
217
|
+
type RouterOptions,
|
|
218
|
+
type RouterTransformer,
|
|
219
|
+
type RouterErrorSerializer,
|
|
220
|
+
type RouterState,
|
|
221
|
+
type ListenerFn,
|
|
222
|
+
type BuildNextOptions,
|
|
223
|
+
type DehydratedRouterState,
|
|
224
|
+
type DehydratedRouteMatch,
|
|
225
|
+
type DehydratedRouter,
|
|
226
|
+
type RouterConstructorOptions,
|
|
227
|
+
type RouterEvents,
|
|
228
|
+
type RouterEvent,
|
|
229
|
+
type RouterListener,
|
|
230
|
+
} from './router'
|
|
231
|
+
export {
|
|
232
|
+
RouterProvider,
|
|
233
|
+
getRouteMatch,
|
|
234
|
+
type RouterProps,
|
|
235
|
+
type CommitLocationOptions,
|
|
236
|
+
type MatchLocation,
|
|
237
|
+
type NavigateFn,
|
|
238
|
+
type BuildLocationFn,
|
|
239
|
+
type InjectedHtmlEntry,
|
|
240
|
+
} from './RouterProvider'
|
|
241
|
+
export {
|
|
242
|
+
useScrollRestoration,
|
|
243
|
+
useElementScrollRestoration,
|
|
244
|
+
ScrollRestoration,
|
|
245
|
+
type ScrollRestorationOptions,
|
|
246
|
+
} from './scroll-restoration'
|
|
247
|
+
export {
|
|
248
|
+
defaultParseSearch,
|
|
249
|
+
defaultStringifySearch,
|
|
250
|
+
parseSearchWith,
|
|
251
|
+
stringifySearchWith,
|
|
252
|
+
type SearchSerializer,
|
|
253
|
+
type SearchParser,
|
|
254
|
+
} from './searchParams'
|
|
255
|
+
export { useBlocker, Block } from './useBlocker'
|
|
256
|
+
export { useNavigate, Navigate, type UseNavigateResult } from './useNavigate'
|
|
257
|
+
export { useParams } from './useParams'
|
|
258
|
+
export { useSearch } from './useSearch'
|
|
259
|
+
export {
|
|
260
|
+
getRouterContext, // SSR
|
|
261
|
+
} from './routerContext'
|
|
262
|
+
export { useRouteContext } from './useRouteContext'
|
|
263
|
+
export { useRouter } from './useRouter'
|
|
264
|
+
export { useRouterState } from './useRouterState'
|
|
265
|
+
export {
|
|
266
|
+
escapeJSON, // SSR
|
|
267
|
+
useLayoutEffect, // SSR
|
|
268
|
+
pick,
|
|
269
|
+
functionalUpdate,
|
|
270
|
+
replaceEqualDeep,
|
|
271
|
+
isPlainObject,
|
|
272
|
+
isPlainArray,
|
|
273
|
+
deepEqual,
|
|
274
|
+
useStableCallback,
|
|
275
|
+
shallow,
|
|
276
|
+
} from './utils'
|
|
277
|
+
export {
|
|
278
|
+
notFound,
|
|
279
|
+
isNotFound,
|
|
280
|
+
CatchNotFound,
|
|
281
|
+
DefaultGlobalNotFound,
|
|
282
|
+
type NotFoundError,
|
|
283
|
+
} from './not-found'
|
package/src/redirects.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { NavigateOptions } from './link'
|
|
|
2
2
|
import type { AnyRoute } from './route'
|
|
3
3
|
import type { RoutePaths } from './routeInfo'
|
|
4
4
|
import type { RegisteredRouter } from './router'
|
|
5
|
-
import type { PickAsRequired } from '
|
|
5
|
+
import type { PickAsRequired } from './utils'
|
|
6
6
|
|
|
7
7
|
export type AnyRedirect = Redirect<any, any, any, any, any>
|
|
8
8
|
|