react-router
Version:
Declarative routing for React
45 lines (43 loc) • 15.2 kB
TypeScript
import { Action, InitialEntry, Location, Path, To, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, invariant, parsePath } from "./lib/router/history.js";
import { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MiddlewareFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
import { Blocker, BlockerFunction, Fetcher, GetScrollPositionFunction, GetScrollRestorationKeyFunction, HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Navigation, NavigationStates, RelativeRoutingType, RevalidationState, Router, RouterFetchOptions, RouterInit, RouterNavigateOptions, RouterState, RouterSubscriber, StaticHandler, StaticHandlerContext, createRouter, createStaticHandler } from "./lib/router/router.js";
import { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "./lib/router/links.js";
import { Await, AwaitProps, ClientOnErrorFunction, IndexRouteProps, LayoutRouteProps, MemoryRouter, MemoryRouterOpts, MemoryRouterProps, Navigate, NavigateProps, Outlet, OutletProps, PathRouteProps, Route, RouteProps, Router as Router$1, RouterProps, RouterProvider, RouterProviderProps, Routes, RoutesProps, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
import { AwaitContextProvider, DataRouterContext, DataRouterStateContext, FetchersContext, LocationContext, NavigateOptions, NavigationContext, Navigator, RouteContext, ViewTransitionContext } from "./lib/context.js";
import { Register } from "./lib/types/register.js";
import { NavigateFunction, unstable_RouterState, unstable_RouterStateActiveVariant, unstable_RouterStatePendingVariant, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes } from "./lib/hooks.js";
import { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, SubmitTarget, URLSearchParamsInit, createSearchParams } from "./lib/dom/dom.js";
import { DiscoverBehavior, FrameworkContext, Links, LinksProps, Meta, PrefetchBehavior, PrefetchPageLinks, Scripts, ScriptsProps } from "./lib/dom/ssr/components.js";
import { BrowserRouter, BrowserRouterProps, DOMRouterOpts, FetcherFormProps, FetcherSubmitFunction, FetcherWithComponents, Form, FormProps, HashRouter, HashRouterProps, HistoryRouter, HistoryRouterProps, Link, LinkProps, NavLink, NavLinkProps, NavLinkRenderProps, ScrollRestoration, ScrollRestorationProps, SetURLSearchParams, SubmitFunction, createBrowserRouter, createHashRouter, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, usePrompt, useScrollRestoration, useSearchParams, useSubmit, useViewTransitionState } from "./lib/dom/lib.js";
import { StaticRouter, StaticRouterProps, StaticRouterProvider, StaticRouterProviderProps, createStaticRouter } from "./lib/dom/server.js";
import { ServerRouter, ServerRouterProps } from "./lib/dom/ssr/server.js";
import { RoutesTestStubProps, createRoutesStub } from "./lib/dom/ssr/routes-test-stub.js";
import { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, IsCookieFunction, createCookie, isCookie } from "./lib/server-runtime/cookies.js";
import { FlashSessionData, IsSessionFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, createSession, createSessionStorage, isSession } from "./lib/server-runtime/sessions.js";
import { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookieStorage.js";
import { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage.js";
import { setDevServerHooks } from "./lib/server-runtime/dev.js";
import { AppLoadContext } from "./lib/server-runtime/data.js";
import { Future } from "./lib/types/future.js";
import { unstable_SerializesTo } from "./lib/types/serializes-to.js";
import { href } from "./lib/href.js";
import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, LoadServerActionFunction, RSCManifestPayload, RSCMatch, RSCPayload, RSCRenderPayload, RSCRouteConfig, RSCRouteConfigEntry, RSCRouteManifest, RSCRouteMatch, getRequest, matchRSCServerRequest } from "./lib/rsc/server.rsc.js";
import { BrowserCreateFromReadableStreamFunction, EncodeReplyFunction, RSCHydratedRouterProps } from "./lib/rsc/browser.js";
import { RSCStaticRouter, RSCStaticRouterProps, SSRCreateFromReadableStreamFunction, routeRSCServerRequest } from "./lib/rsc/server.ssr.js";
import { RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries.js";
import { RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries.js";
import { getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery } from "./lib/dom/ssr/fog-of-war.js";
import { getHydrationData } from "./lib/dom/ssr/hydration.js";
import { SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch.js";
import { ServerMode } from "./lib/server-runtime/mode.js";
import { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, MetaArgs, MetaDescriptor, MetaFunction, RouteModules } from "./lib/dom/ssr/routeModules.js";
import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader } from "./lib/dom/ssr/routes.js";
import { AssetsManifest, EntryContext } from "./lib/dom/ssr/entry.js";
import { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule } from "./lib/server-runtime/build.js";
import { CreateRequestHandlerFunction, RequestHandler, createRequestHandler } from "./lib/server-runtime/server.js";
import { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRouteFunction, InstrumentRouterFunction, InstrumentationHandlerResult, ServerInstrumentation } from "./lib/router/instrumentation.js";
//#region index.d.ts
declare const unstable_getRequest: typeof getRequest;
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
//#endregion
export { type ActionFunction, type ActionFunctionArgs, type AppLoadContext, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };