Area restrita - Questionario
This commit is contained in:
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './instrumentation-BYr6ff5D.js';
|
||||
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './context-phCt_zmH.mjs';
|
||||
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-BRrCYrSL.mjs';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-2565
File diff suppressed because it is too large
Load Diff
-9963
File diff suppressed because one or more lines are too long
-1352
File diff suppressed because it is too large
Load Diff
-11252
File diff suppressed because it is too large
Load Diff
-188
@@ -1,188 +0,0 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
||||
* react-router v7.14.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
// lib/dom/ssr/hydration.tsx
|
||||
function getHydrationData({
|
||||
state,
|
||||
routes,
|
||||
getRouteInfo,
|
||||
location,
|
||||
basename,
|
||||
isSpaMode
|
||||
}) {
|
||||
let hydrationData = {
|
||||
...state,
|
||||
loaderData: { ...state.loaderData }
|
||||
};
|
||||
let initialMatches = _chunkIK6APEEGjs.matchRoutes.call(void 0, routes, location, basename);
|
||||
if (initialMatches) {
|
||||
for (let match of initialMatches) {
|
||||
let routeId = match.route.id;
|
||||
let routeInfo = getRouteInfo(routeId);
|
||||
if (_chunkIK6APEEGjs.shouldHydrateRouteLoader.call(void 0,
|
||||
routeId,
|
||||
routeInfo.clientLoader,
|
||||
routeInfo.hasLoader,
|
||||
isSpaMode
|
||||
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
||||
delete hydrationData.loaderData[routeId];
|
||||
} else if (!routeInfo.hasLoader) {
|
||||
hydrationData.loaderData[routeId] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hydrationData;
|
||||
}
|
||||
|
||||
// lib/rsc/errorBoundaries.tsx
|
||||
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
||||
var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { error: null, location: props.location };
|
||||
}
|
||||
static getDerivedStateFromError(error) {
|
||||
return { error };
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
if (state.location !== props.location) {
|
||||
return { error: null, location: props.location };
|
||||
}
|
||||
return { error: state.error, location: state.location };
|
||||
}
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
error: this.state.error,
|
||||
renderAppShell: true
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
};
|
||||
function ErrorWrapper({
|
||||
renderAppShell,
|
||||
title,
|
||||
children
|
||||
}) {
|
||||
if (!renderAppShell) {
|
||||
return children;
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement(
|
||||
"meta",
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
||||
}
|
||||
), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children)));
|
||||
}
|
||||
function RSCDefaultRootErrorBoundaryImpl({
|
||||
error,
|
||||
renderAppShell
|
||||
}) {
|
||||
console.error(error);
|
||||
let heyDeveloper = /* @__PURE__ */ _react2.default.createElement(
|
||||
"script",
|
||||
{
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: `
|
||||
console.log(
|
||||
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
||||
);
|
||||
`
|
||||
}
|
||||
}
|
||||
);
|
||||
if (_chunkIK6APEEGjs.isRouteErrorResponse.call(void 0, error)) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
ErrorWrapper,
|
||||
{
|
||||
renderAppShell,
|
||||
title: "Unhandled Thrown Response!"
|
||||
},
|
||||
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
||||
_chunkIK6APEEGjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
||||
);
|
||||
}
|
||||
let errorInstance;
|
||||
if (error instanceof Error) {
|
||||
errorInstance = error;
|
||||
} else {
|
||||
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
||||
errorInstance = new Error(errorString);
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement(
|
||||
"pre",
|
||||
{
|
||||
style: {
|
||||
padding: "2rem",
|
||||
background: "hsla(10, 50%, 50%, 0.1)",
|
||||
color: "red",
|
||||
overflow: "auto"
|
||||
}
|
||||
},
|
||||
errorInstance.stack
|
||||
), heyDeveloper);
|
||||
}
|
||||
function RSCDefaultRootErrorBoundary({
|
||||
hasRootLayout
|
||||
}) {
|
||||
let error = _chunkIK6APEEGjs.useRouteError.call(void 0, );
|
||||
if (hasRootLayout === void 0) {
|
||||
throw new Error("Missing 'hasRootLayout' prop");
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
renderAppShell: !hasRootLayout,
|
||||
error
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// lib/rsc/route-modules.ts
|
||||
function createRSCRouteModules(payload) {
|
||||
const routeModules = {};
|
||||
for (const match of payload.matches) {
|
||||
populateRSCRouteModules(routeModules, match);
|
||||
}
|
||||
return routeModules;
|
||||
}
|
||||
function populateRSCRouteModules(routeModules, matches) {
|
||||
matches = Array.isArray(matches) ? matches : [matches];
|
||||
for (const match of matches) {
|
||||
routeModules[match.id] = {
|
||||
links: match.links,
|
||||
meta: match.meta,
|
||||
default: noopComponent
|
||||
};
|
||||
}
|
||||
}
|
||||
var noopComponent = () => null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules;
|
||||
-1713
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -1,10 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, u as unstable_ClientInstrumentation, C as ClientOnErrorFunction } from './context-phCt_zmH.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-vtIR1Kpe.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CmHpk1Ws.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CGcs-0pD.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -65,12 +65,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -82,8 +82,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -106,9 +106,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
||||
import { u as unstable_ClientInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C9Ar1yxG.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js';
|
||||
import './data-D4xhSy90.js';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -66,12 +66,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -83,8 +83,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -107,9 +107,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+59
-64
@@ -1,5 +1,5 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunkWAVMRYR2js = require('./chunk-WAVMRYR2.js');
|
||||
var _chunkPBLBZ3QUjs = require('./chunk-PBLBZ3QU.js');
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ var _chunkWAVMRYR2js = require('./chunk-WAVMRYR2.js');
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
var _chunkKFNXW4ALjs = require('./chunk-KFNXW4AL.js');
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
||||
@@ -90,7 +91,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -163,10 +164,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
|
||||
() => router2,
|
||||
@@ -174,7 +175,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
|
||||
() => router2,
|
||||
@@ -200,7 +201,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
|
||||
}, []);
|
||||
React2.useEffect(() => {
|
||||
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
||||
document.querySelectorAll(`[${_chunkIK6APEEGjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
document.querySelectorAll(`[${_chunkKFNXW4ALjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
}
|
||||
}, [criticalCss]);
|
||||
let [location2, setLocation] = React2.useState(router.state.location);
|
||||
@@ -261,7 +262,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -392,7 +393,7 @@ function createRouterFromPayload({
|
||||
};
|
||||
if (payload.type !== "render") throw new Error("Invalid payload type");
|
||||
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
||||
_chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
_chunkPBLBZ3QUjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
let routes = payload.matches.reduceRight((previous, match) => {
|
||||
const route = createRouteFromServerManifest(
|
||||
match,
|
||||
@@ -406,12 +407,12 @@ function createRouterFromPayload({
|
||||
return [route];
|
||||
}, []);
|
||||
let applyPatchesPromise;
|
||||
globalVar.__reactRouterDataRouter = _chunkIK6APEEGjs.createRouter.call(void 0, {
|
||||
globalVar.__reactRouterDataRouter = _chunkKFNXW4ALjs.createRouter.call(void 0, {
|
||||
routes,
|
||||
getContext,
|
||||
basename: payload.basename,
|
||||
history: _chunkIK6APEEGjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunkWAVMRYR2js.getHydrationData.call(void 0, {
|
||||
history: _chunkKFNXW4ALjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunkPBLBZ3QUjs.getHydrationData.call(void 0, {
|
||||
state: {
|
||||
loaderData: payload.loaderData,
|
||||
actionData: payload.actionData,
|
||||
@@ -420,7 +421,7 @@ function createRouterFromPayload({
|
||||
routes,
|
||||
getRouteInfo: (routeId) => {
|
||||
let match = payload.matches.find((m) => m.id === routeId);
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
return {
|
||||
clientLoader: match.clientLoader,
|
||||
hasLoader: match.hasLoader,
|
||||
@@ -535,9 +536,9 @@ function createRouterFromPayload({
|
||||
routeModules: globalVar.__reactRouterRouteModules
|
||||
};
|
||||
}
|
||||
var renderedRoutesContext = _chunkIK6APEEGjs.createContext.call(void 0, );
|
||||
var renderedRoutesContext = _chunkKFNXW4ALjs.createContext.call(void 0, );
|
||||
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
||||
let dataStrategy = _chunkIK6APEEGjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
let dataStrategy = _chunkKFNXW4ALjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
getRouter,
|
||||
(match) => {
|
||||
let M = match;
|
||||
@@ -546,8 +547,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -595,20 +595,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
||||
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
||||
let { request, context } = args;
|
||||
let url = _chunkIK6APEEGjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
let url = _chunkKFNXW4ALjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
if (request.method === "GET") {
|
||||
url = _chunkIK6APEEGjs.stripIndexParam.call(void 0, url);
|
||||
url = _chunkKFNXW4ALjs.stripIndexParam.call(void 0, url);
|
||||
if (targetRoutes) {
|
||||
url.searchParams.set("_routes", targetRoutes.join(","));
|
||||
}
|
||||
}
|
||||
let res = await fetchImplementation(
|
||||
new Request(url, await _chunkIK6APEEGjs.createRequestInit.call(void 0, request))
|
||||
new Request(url, await _chunkKFNXW4ALjs.createRequestInit.call(void 0, request))
|
||||
);
|
||||
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
||||
throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
throw new (0, _chunkKFNXW4ALjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
}
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
try {
|
||||
const payload = await createFromReadableStream(res.body, {
|
||||
temporaryReferences: void 0
|
||||
@@ -632,7 +632,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
||||
}
|
||||
context.get(renderedRoutesContext).push(...payload.matches);
|
||||
let results = { routes: {} };
|
||||
const dataKey = _chunkIK6APEEGjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
const dataKey = _chunkKFNXW4ALjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
||||
results.routes[routeId] = { data };
|
||||
}
|
||||
@@ -665,7 +665,7 @@ function RSCHydratedRouter({
|
||||
[createFromReadableStream, payload, fetchImplementation, getContext]
|
||||
);
|
||||
React3.useEffect(() => {
|
||||
_chunkIK6APEEGjs.setIsHydrated.call(void 0, );
|
||||
_chunkKFNXW4ALjs.setIsHydrated.call(void 0, );
|
||||
}, []);
|
||||
React3.useLayoutEffect(() => {
|
||||
const globalVar = window;
|
||||
@@ -750,10 +750,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -774,8 +773,8 @@ function RSCHydratedRouter({
|
||||
},
|
||||
routeModules
|
||||
};
|
||||
return /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkWAVMRYR2js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunkIK6APEEGjs.RouterProvider,
|
||||
return /* @__PURE__ */ React3.createElement(_chunkKFNXW4ALjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkPBLBZ3QUjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkKFNXW4ALjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunkKFNXW4ALjs.RouterProvider,
|
||||
{
|
||||
router: transitionEnabledRouter,
|
||||
flushSync: ReactDOM2.flushSync
|
||||
@@ -791,8 +790,8 @@ function createRouteFromServerManifest(match, payload) {
|
||||
// the server loader flow regardless of whether the client loader calls
|
||||
// `serverLoader` or not, otherwise we'll have nothing to render.
|
||||
match.hasComponent && !match.element;
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunkPBLBZ3QUjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
let dataRoute = {
|
||||
id: match.id,
|
||||
element: match.element,
|
||||
@@ -802,30 +801,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -842,7 +839,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return await callSingleFetch(singleFetch);
|
||||
}
|
||||
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
||||
throw _chunkIK6APEEGjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
throw _chunkKFNXW4ALjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
},
|
||||
path: match.path,
|
||||
shouldRevalidate: match.shouldRevalidate,
|
||||
@@ -851,11 +848,10 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = _chunkIK6APEEGjs.shouldHydrateRouteLoader.call(void 0,
|
||||
dataRoute.loader.hydrate = _chunkKFNXW4ALjs.shouldHydrateRouteLoader.call(void 0,
|
||||
match.id,
|
||||
match.clientLoader,
|
||||
match.hasLoader,
|
||||
@@ -865,7 +861,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return dataRoute;
|
||||
}
|
||||
function callSingleFetch(singleFetch) {
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
return singleFetch();
|
||||
}
|
||||
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
@@ -873,13 +869,12 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
||||
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
||||
console.error(msg);
|
||||
throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
throw new (0, _chunkKFNXW4ALjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
}
|
||||
}
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
@@ -901,7 +896,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
if (url.toString().length > URL_LIMIT) {
|
||||
if (url.toString().length > _chunkKFNXW4ALjs.URL_LIMIT) {
|
||||
nextPaths.clear();
|
||||
return;
|
||||
}
|
||||
@@ -946,7 +941,7 @@ function isExternalLocation(location2) {
|
||||
}
|
||||
function hasInvalidProtocol(location2) {
|
||||
try {
|
||||
return _chunkIK6APEEGjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
return _chunkKFNXW4ALjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
} catch (e2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+34
-39
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
deserializeErrors,
|
||||
getHydrationData,
|
||||
populateRSCRouteModules
|
||||
} from "./chunk-2UH5WJXA.mjs";
|
||||
} from "./chunk-ASILSGTR.mjs";
|
||||
import {
|
||||
CRITICAL_CSS_DATA_ATTRIBUTE,
|
||||
ErrorResponseImpl,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
RSCRouterContext,
|
||||
RemixErrorBoundary,
|
||||
RouterProvider,
|
||||
URL_LIMIT,
|
||||
createBrowserHistory,
|
||||
createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut,
|
||||
@@ -43,7 +44,7 @@ import {
|
||||
singleFetchUrl,
|
||||
stripIndexParam,
|
||||
useFogOFWarDiscovery
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
import * as React from "react";
|
||||
@@ -82,7 +83,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -155,10 +156,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
||||
() => router2,
|
||||
@@ -166,7 +167,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
||||
() => router2,
|
||||
@@ -192,7 +193,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -253,7 +254,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -538,8 +539,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -742,10 +742,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -794,30 +793,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -843,8 +840,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
||||
@@ -871,7 +867,6 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
|
||||
Generated
Vendored
-2590
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-3645
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-phCt_zmH.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-CmHpk1Ws.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
import 'react';
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-luDbagNU.js';
|
||||
import './instrumentation-BYr6ff5D.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-CwU9bE5R.js';
|
||||
import './instrumentation-1q4YhLGP.js';
|
||||
import './data-D4xhSy90.js';
|
||||
import 'react';
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunkNXTEWSJOjs = require('./chunk-NXTEWSJO.js');
|
||||
var _chunkPULC7NLKjs = require('./chunk-PULC7NLK.js');
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ var _chunkNXTEWSJOjs = require('./chunk-NXTEWSJO.js');
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
var _chunkKFNXW4ALjs = require('./chunk-KFNXW4AL.js');
|
||||
|
||||
|
||||
|
||||
@@ -58,4 +58,4 @@ var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
|
||||
|
||||
exports.BrowserRouter = _chunkNXTEWSJOjs.BrowserRouter; exports.Form = _chunkNXTEWSJOjs.Form; exports.HashRouter = _chunkNXTEWSJOjs.HashRouter; exports.Link = _chunkNXTEWSJOjs.Link; exports.Links = _chunkIK6APEEGjs.Links; exports.MemoryRouter = _chunkIK6APEEGjs.MemoryRouter; exports.Meta = _chunkIK6APEEGjs.Meta; exports.NavLink = _chunkNXTEWSJOjs.NavLink; exports.Navigate = _chunkIK6APEEGjs.Navigate; exports.Outlet = _chunkIK6APEEGjs.Outlet; exports.Route = _chunkIK6APEEGjs.Route; exports.Router = _chunkIK6APEEGjs.Router; exports.RouterProvider = _chunkIK6APEEGjs.RouterProvider; exports.Routes = _chunkIK6APEEGjs.Routes; exports.ScrollRestoration = _chunkNXTEWSJOjs.ScrollRestoration; exports.StaticRouter = _chunkNXTEWSJOjs.StaticRouter; exports.StaticRouterProvider = _chunkNXTEWSJOjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkIK6APEEGjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkIK6APEEGjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkIK6APEEGjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkIK6APEEGjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkNXTEWSJOjs.HistoryRouter;
|
||||
exports.BrowserRouter = _chunkPULC7NLKjs.BrowserRouter; exports.Form = _chunkPULC7NLKjs.Form; exports.HashRouter = _chunkPULC7NLKjs.HashRouter; exports.Link = _chunkPULC7NLKjs.Link; exports.Links = _chunkKFNXW4ALjs.Links; exports.MemoryRouter = _chunkKFNXW4ALjs.MemoryRouter; exports.Meta = _chunkKFNXW4ALjs.Meta; exports.NavLink = _chunkPULC7NLKjs.NavLink; exports.Navigate = _chunkKFNXW4ALjs.Navigate; exports.Outlet = _chunkKFNXW4ALjs.Outlet; exports.Route = _chunkKFNXW4ALjs.Route; exports.Router = _chunkKFNXW4ALjs.Router; exports.RouterProvider = _chunkKFNXW4ALjs.RouterProvider; exports.Routes = _chunkKFNXW4ALjs.Routes; exports.ScrollRestoration = _chunkPULC7NLKjs.ScrollRestoration; exports.StaticRouter = _chunkPULC7NLKjs.StaticRouter; exports.StaticRouterProvider = _chunkPULC7NLKjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkKFNXW4ALjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkKFNXW4ALjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkKFNXW4ALjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkKFNXW4ALjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkPULC7NLKjs.HistoryRouter;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
WithComponentProps,
|
||||
WithErrorBoundaryProps,
|
||||
WithHydrateFallbackProps
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
export {
|
||||
BrowserRouter,
|
||||
Form,
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+71
-41
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
||||
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -73,7 +73,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -253,11 +253,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -427,17 +427,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -457,6 +456,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -728,7 +732,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -744,7 +748,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -815,8 +819,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -870,7 +876,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -903,11 +910,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -924,6 +930,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -931,12 +938,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -988,8 +1006,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1106,12 +1124,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1136,8 +1165,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1521,6 +1550,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1872,7 +1902,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1907,7 +1937,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1957,8 +1987,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1987,7 +2017,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -2014,8 +2044,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2894,7 +2924,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2950,12 +2980,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3463,7 +3493,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3564,7 +3594,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+71
-41
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
||||
import { serialize, parse } from 'cookie';
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -40,7 +40,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -52,7 +52,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -232,11 +232,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -406,17 +406,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -436,6 +435,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -707,7 +711,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -723,7 +727,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -794,8 +798,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -849,7 +855,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -882,11 +889,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -903,6 +909,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -910,12 +917,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -967,8 +985,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1085,12 +1103,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1115,8 +1144,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1500,6 +1529,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1851,7 +1881,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1886,7 +1916,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1936,8 +1966,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1966,7 +1996,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -1993,8 +2023,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2873,7 +2903,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2929,12 +2959,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3442,7 +3472,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3543,7 +3573,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { X as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, Y as SerializeFrom, L as Location, Z as ParamParseKey, I as Path, _ as PathPattern, $ as PathMatch, U as UIMatch, v as Action, P as Params, r as RouteObject, G as GetLoaderData, l as GetActionData, J as InitialEntry, Q as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, K as NonIndexRouteObject, a0 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './routeModules-BRrCYrSL.mjs';
|
||||
export { a1 as ActionFunctionArgs, a2 as BaseRouteObject, C as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunctionArgs, w as DataRouteMatch, a3 as DataStrategyFunctionArgs, a4 as DataStrategyMatch, D as DataStrategyResult, a6 as ErrorResponse, n as FormEncType, a7 as FormMethod, aw as Future, m as HTMLFormMethod, as as HeadersArgs, H as HeadersFunction, av as HtmlLinkDescriptor, O as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, at as MetaArgs, g as MetaDescriptor, a8 as MiddlewareFunction, au as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, V as RouteMatch, ac as RouterContext, S as ShouldRevalidateFunction, ad as ShouldRevalidateFunctionArgs, a5 as UNSAFE_DataWithResponseInit, aC as UNSAFE_ErrorResponseImpl, az as UNSAFE_createBrowserHistory, aA as UNSAFE_createHashHistory, ay as UNSAFE_createMemoryHistory, aB as UNSAFE_invariant, ae as createContext, af as createPath, ah as data, ai as generatePath, aj as isRouteErrorResponse, ak as matchPath, al as matchRoutes, ag as parsePath, am as redirect, an as redirectDocument, ao as replace, ap as resolvePath, ax as unstable_SerializesTo } from './routeModules-BRrCYrSL.mjs';
|
||||
import { b as Router, N as NavigateOptions, B as BlockerFunction, c as Blocker, d as RelativeRoutingType, e as Navigation, H as HydrationState, f as RouterState } from './context-phCt_zmH.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, g as GetScrollRestorationKeyFunction, t as IDLE_BLOCKER, s as IDLE_FETCHER, I as IDLE_NAVIGATION, x as IndexRouteProps, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, i as NavigationStates, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, m as RevalidationState, V as Route, D as RouteProps, W as Router, l as RouterFetchOptions, R as RouterInit, k as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, j as RouterSubscriber, Y as Routes, J as RoutesProps, S as StaticHandler, h as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches, u as unstable_ClientInstrumentation, o as unstable_InstrumentRequestHandlerFunction, q as unstable_InstrumentRouteFunction, p as unstable_InstrumentRouterFunction, r as unstable_InstrumentationHandlerResult, n as unstable_ServerInstrumentation } from './context-phCt_zmH.mjs';
|
||||
import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-U8FS-wNn.mjs';
|
||||
export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-U8FS-wNn.mjs';
|
||||
import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, H as HydrationState, g as RouterState } from './context-CmHpk1Ws.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, h as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, j as Navigation, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, i as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-CmHpk1Ws.mjs';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CTxsJBKQ.mjs';
|
||||
export { b as Register } from './register-CTxsJBKQ.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CqK96Zfk.mjs';
|
||||
export { b as Register } from './register-CqK96Zfk.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DPrDrCew.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-vtIR1Kpe.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-vtIR1Kpe.mjs';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-CGcs-0pD.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-CGcs-0pD.mjs';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { J as RouteModules, l as DataStrategyFunction, r as MiddlewareEnabled, c as RouterContextProvider, s as AppLoadContext, T as To, K as SerializeFrom, L as Location, O as ParamParseKey, p as Path, Q as PathPattern, V as PathMatch, U as UIMatch, i as Action, P as Params, e as RouteObject, G as GetLoaderData, I as GetActionData, W as InitialEntry, X as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Y as NonIndexRouteObject, Z as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './routeModules-CA7kSxJJ.js';
|
||||
export { _ as ActionFunctionArgs, $ as BaseRouteObject, C as ClientActionFunction, ap as ClientActionFunctionArgs, aq as ClientLoaderFunctionArgs, D as DataRouteMatch, a0 as DataStrategyFunctionArgs, a1 as DataStrategyMatch, B as DataStrategyResult, a3 as ErrorResponse, F as FormEncType, a4 as FormMethod, av as Future, o as HTMLFormMethod, ar as HeadersArgs, H as HeadersFunction, au as HtmlLinkDescriptor, a5 as LazyRouteFunction, t as LinkDescriptor, q as LoaderFunctionArgs, as as MetaArgs, w as MetaDescriptor, a6 as MiddlewareFunction, at as PageLinkDescriptor, a7 as PatchRoutesOnNavigationFunctionArgs, a8 as PathParam, a9 as RedirectFunction, aa as RouteMatch, ab as RouterContext, S as ShouldRevalidateFunction, ac as ShouldRevalidateFunctionArgs, a2 as UNSAFE_DataWithResponseInit, aB as UNSAFE_ErrorResponseImpl, ay as UNSAFE_createBrowserHistory, az as UNSAFE_createHashHistory, ax as UNSAFE_createMemoryHistory, aA as UNSAFE_invariant, ad as createContext, ae as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, af as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, aw as unstable_SerializesTo } from './routeModules-CA7kSxJJ.js';
|
||||
import { a as Router, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, N as Navigation, H as HydrationState, d as RouterState } from './instrumentation-BYr6ff5D.js';
|
||||
export { F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, I as IDLE_NAVIGATION, g as NavigationStates, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter, u as unstable_ClientInstrumentation, m as unstable_InstrumentRequestHandlerFunction, o as unstable_InstrumentRouteFunction, n as unstable_InstrumentRouterFunction, p as unstable_InstrumentationHandlerResult, l as unstable_ServerInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-luDbagNU.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-luDbagNU.js';
|
||||
import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-D4xhSy90.js';
|
||||
export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-D4xhSy90.js';
|
||||
import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, H as HydrationState, d as RouterState } from './instrumentation-1q4YhLGP.js';
|
||||
export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, g as Navigation, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-1q4YhLGP.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-CwU9bE5R.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-CwU9bE5R.js';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CkcGwv27.js';
|
||||
export { b as Register } from './register-CkcGwv27.js';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CNAx3TXj.js';
|
||||
export { b as Register } from './register-CNAx3TXj.js';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-C9Ar1yxG.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-C9Ar1yxG.js';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-D3uq9sI1.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-D3uq9sI1.js';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+196
-174
File diff suppressed because one or more lines are too long
+5
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
isSession,
|
||||
routeRSCServerRequest,
|
||||
setDevServerHooks
|
||||
} from "./chunk-2UH5WJXA.mjs";
|
||||
} from "./chunk-ASILSGTR.mjs";
|
||||
import {
|
||||
Action,
|
||||
Await,
|
||||
@@ -133,6 +133,7 @@ import {
|
||||
useRoute,
|
||||
useRouteError,
|
||||
useRouteLoaderData,
|
||||
useRouterState,
|
||||
useRoutes,
|
||||
useScrollRestoration,
|
||||
useSearchParams,
|
||||
@@ -141,7 +142,7 @@ import {
|
||||
withComponentProps,
|
||||
withErrorBoundaryProps,
|
||||
withHydrateFallbackProps
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
export {
|
||||
Await,
|
||||
BrowserRouter,
|
||||
@@ -243,6 +244,7 @@ export {
|
||||
setDevServerHooks as unstable_setDevServerHooks,
|
||||
usePrompt as unstable_usePrompt,
|
||||
useRoute as unstable_useRoute,
|
||||
useRouterState as unstable_useRouterState,
|
||||
useActionData,
|
||||
useAsyncError,
|
||||
useAsyncValue,
|
||||
|
||||
-657
@@ -1,657 +0,0 @@
|
||||
import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, U as UIMatch, T as To, o as HTMLFormMethod, F as FormEncType, p as Path, q as LoaderFunctionArgs, r as MiddlewareEnabled, s as AppLoadContext } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* A Router instance manages all navigation and data loading/mutations
|
||||
*/
|
||||
interface Router {
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the basename for the router
|
||||
*/
|
||||
get basename(): RouterInit["basename"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the future config for the router
|
||||
*/
|
||||
get future(): FutureConfig;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the current state of the router
|
||||
*/
|
||||
get state(): RouterState;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the window associated with the router
|
||||
*/
|
||||
get window(): RouterInit["window"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Initialize the router, including adding history listeners and kicking off
|
||||
* initial data fetches. Returns a function to cleanup listeners and abort
|
||||
* any in-progress loads
|
||||
*/
|
||||
initialize(): Router;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Subscribe to router.state updates
|
||||
*
|
||||
* @param fn function to call with the new state
|
||||
*/
|
||||
subscribe(fn: RouterSubscriber): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Enable scroll restoration behavior in the router
|
||||
*
|
||||
* @param savedScrollPositions Object that will manage positions, in case
|
||||
* it's being restored from sessionStorage
|
||||
* @param getScrollPosition Function to get the active Y scroll position
|
||||
* @param getKey Function to get the key to use for restoration
|
||||
*/
|
||||
enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Navigate forward/backward in the history stack
|
||||
* @param to Delta to move in the history stack
|
||||
*/
|
||||
navigate(to: number): Promise<void>;
|
||||
/**
|
||||
* Navigate to the given path
|
||||
* @param to Path to navigate to
|
||||
* @param opts Navigation options (method, submission, etc.)
|
||||
*/
|
||||
navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a fetcher load/submission
|
||||
*
|
||||
* @param key Fetcher key
|
||||
* @param routeId Route that owns the fetcher
|
||||
* @param href href to fetch
|
||||
* @param opts Fetcher options, (method, submission, etc.)
|
||||
*/
|
||||
fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a revalidation of all current route loaders and fetcher loads
|
||||
*/
|
||||
revalidate(): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to create an href for the given location
|
||||
* @param location
|
||||
*/
|
||||
createHref(location: Location | URL): string;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to URL encode a destination path according to the internal
|
||||
* history implementation
|
||||
* @param to
|
||||
*/
|
||||
encodeLocation(to: To): Path;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get/create a fetcher for the given key
|
||||
* @param key
|
||||
*/
|
||||
getFetcher<TData = any>(key: string): Fetcher<TData>;
|
||||
/**
|
||||
* @internal
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Reset the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
resetFetcher(key: string, opts?: {
|
||||
reason?: unknown;
|
||||
}): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
deleteFetcher(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cleanup listeners and abort any in-progress loads
|
||||
*/
|
||||
dispose(): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
* @param fn The blocker function implementation
|
||||
*/
|
||||
getBlocker(key: string, fn: BlockerFunction): Blocker;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
*/
|
||||
deleteBlocker(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE DO NOT USE
|
||||
*
|
||||
* Patch additional children routes into an existing parent route
|
||||
* @param routeId The parent route id or a callback function accepting `patch`
|
||||
* to perform batch patching
|
||||
* @param children The additional children routes
|
||||
* @param unstable_allowElementMutations Allow mutation or route elements on
|
||||
* existing routes. Intended for RSC-usage
|
||||
* only.
|
||||
*/
|
||||
patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* HMR needs to pass in-flight route updates to React Router
|
||||
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
|
||||
*/
|
||||
_internalSetRoutes(routes: RouteObject[]): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cause subscribers to re-render. This is used to force a re-render.
|
||||
*/
|
||||
_internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Internal fetch AbortControllers accessed by unit tests
|
||||
*/
|
||||
_internalFetchControllers: Map<string, AbortController>;
|
||||
}
|
||||
/**
|
||||
* State maintained internally by the router. During a navigation, all states
|
||||
* reflect the "old" location unless otherwise noted.
|
||||
*/
|
||||
interface RouterState {
|
||||
/**
|
||||
* The action of the most recent navigation
|
||||
*/
|
||||
historyAction: Action;
|
||||
/**
|
||||
* The current location reflected by the router
|
||||
*/
|
||||
location: Location;
|
||||
/**
|
||||
* The current set of route matches
|
||||
*/
|
||||
matches: DataRouteMatch[];
|
||||
/**
|
||||
* Tracks whether we've completed our initial data load
|
||||
*/
|
||||
initialized: boolean;
|
||||
/**
|
||||
* Tracks whether we should be rendering a HydrateFallback during hydration
|
||||
*/
|
||||
renderFallback: boolean;
|
||||
/**
|
||||
* Current scroll position we should start at for a new view
|
||||
* - number -> scroll position to restore to
|
||||
* - false -> do not restore scroll at all (used during submissions/revalidations)
|
||||
* - null -> don't have a saved position, scroll to hash or top of page
|
||||
*/
|
||||
restoreScrollPosition: number | false | null;
|
||||
/**
|
||||
* Indicate whether this navigation should skip resetting the scroll position
|
||||
* if we are unable to restore the scroll position
|
||||
*/
|
||||
preventScrollReset: boolean;
|
||||
/**
|
||||
* Tracks the state of the current navigation
|
||||
*/
|
||||
navigation: Navigation;
|
||||
/**
|
||||
* Tracks any in-progress revalidations
|
||||
*/
|
||||
revalidation: RevalidationState;
|
||||
/**
|
||||
* Data from the loaders for the current matches
|
||||
*/
|
||||
loaderData: RouteData;
|
||||
/**
|
||||
* Data from the action for the current matches
|
||||
*/
|
||||
actionData: RouteData | null;
|
||||
/**
|
||||
* Errors caught from loaders for the current matches
|
||||
*/
|
||||
errors: RouteData | null;
|
||||
/**
|
||||
* Map of current fetchers
|
||||
*/
|
||||
fetchers: Map<string, Fetcher>;
|
||||
/**
|
||||
* Map of current blockers
|
||||
*/
|
||||
blockers: Map<string, Blocker>;
|
||||
}
|
||||
/**
|
||||
* Data that can be passed into hydrate a Router from SSR
|
||||
*/
|
||||
type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
|
||||
/**
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
*/
|
||||
interface RouterInit {
|
||||
routes: RouteObject[];
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
hydrationData?: HydrationState;
|
||||
window?: Window;
|
||||
dataStrategy?: DataStrategyFunction;
|
||||
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
||||
}
|
||||
/**
|
||||
* State returned from a server-side query() call
|
||||
*/
|
||||
interface StaticHandlerContext {
|
||||
basename: Router["basename"];
|
||||
location: RouterState["location"];
|
||||
matches: RouterState["matches"];
|
||||
loaderData: RouterState["loaderData"];
|
||||
actionData: RouterState["actionData"];
|
||||
errors: RouterState["errors"];
|
||||
statusCode: number;
|
||||
loaderHeaders: Record<string, Headers>;
|
||||
actionHeaders: Record<string, Headers>;
|
||||
_deepestRenderedBoundaryId?: string | null;
|
||||
}
|
||||
/**
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
dataRoutes: DataRouteObject[];
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
skipLoaderErrorBubbling?: boolean;
|
||||
skipRevalidation?: boolean;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
};
|
||||
/**
|
||||
* Subscriber function signature for changes to router state
|
||||
*/
|
||||
interface RouterSubscriber {
|
||||
(state: RouterState, opts: {
|
||||
deletedFetchers: string[];
|
||||
newErrors: RouteData | null;
|
||||
viewTransitionOpts?: ViewTransitionOpts;
|
||||
flushSync: boolean;
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the key to be used in scroll restoration
|
||||
* for a given location
|
||||
*/
|
||||
interface GetScrollRestorationKeyFunction {
|
||||
(location: Location, matches: UIMatch[]): string | null;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the current scroll position
|
||||
*/
|
||||
interface GetScrollPositionFunction {
|
||||
(): number;
|
||||
}
|
||||
/**
|
||||
* - "route": relative to the route hierarchy so `..` means remove all segments
|
||||
* of the current route even if it has many. For example, a `route("posts/:id")`
|
||||
* would have both `:id` and `posts` removed from the url.
|
||||
* - "path": relative to the pathname so `..` means remove one segment of the
|
||||
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
||||
* from the url.
|
||||
*/
|
||||
type RelativeRoutingType = "route" | "path";
|
||||
type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
} & ({
|
||||
formData: FormData;
|
||||
body?: undefined;
|
||||
} | {
|
||||
formData?: undefined;
|
||||
body: any;
|
||||
});
|
||||
/**
|
||||
* Options for a navigate() call for a normal (non-submission) navigation
|
||||
*/
|
||||
type LinkNavigateOptions = BaseNavigateOptions;
|
||||
/**
|
||||
* Options for a navigate() call for a submission navigation
|
||||
*/
|
||||
type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to navigate() for a navigation
|
||||
*/
|
||||
type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
|
||||
/**
|
||||
* Options for a fetch() load
|
||||
*/
|
||||
type LoadFetchOptions = BaseNavigateOrFetchOptions;
|
||||
/**
|
||||
* Options for a fetch() submission
|
||||
*/
|
||||
type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to fetch()
|
||||
*/
|
||||
type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
|
||||
/**
|
||||
* Potential states for state.navigation
|
||||
*/
|
||||
type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
text: undefined;
|
||||
};
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
};
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
text: Submission["text"];
|
||||
};
|
||||
};
|
||||
type Navigation = NavigationStates[keyof NavigationStates];
|
||||
type RevalidationState = "idle" | "loading";
|
||||
/**
|
||||
* Potential states for fetchers
|
||||
*/
|
||||
type FetcherStates<TData = any> = {
|
||||
/**
|
||||
* The fetcher is not calling a loader or action
|
||||
*
|
||||
* ```tsx
|
||||
* fetcher.state === "idle"
|
||||
* ```
|
||||
*/
|
||||
Idle: {
|
||||
state: "idle";
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
text: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
/**
|
||||
* If the fetcher has never been called, this will be undefined.
|
||||
*/
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
* The fetcher is loading data from a {@link LoaderFunction | loader} from a
|
||||
* call to {@link FetcherWithComponents.load | `fetcher.load`}.
|
||||
*
|
||||
* ```tsx
|
||||
* // somewhere
|
||||
* <button onClick={() => fetcher.load("/some/route") }>Load</button>
|
||||
*
|
||||
* // the state will update
|
||||
* fetcher.state === "loading"
|
||||
* ```
|
||||
*/
|
||||
Loading: {
|
||||
state: "loading";
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
|
||||
|
||||
```tsx
|
||||
// somewhere
|
||||
<input
|
||||
onChange={e => {
|
||||
fetcher.submit(event.currentTarget.form, { method: "post" });
|
||||
}}
|
||||
/>
|
||||
|
||||
// the state will update
|
||||
fetcher.state === "submitting"
|
||||
|
||||
// and formData will be available
|
||||
fetcher.formData
|
||||
```
|
||||
*/
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
text: Submission["text"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
data: TData | undefined;
|
||||
};
|
||||
};
|
||||
type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
|
||||
interface BlockerBlocked {
|
||||
state: "blocked";
|
||||
reset: () => void;
|
||||
proceed: () => void;
|
||||
location: Location;
|
||||
}
|
||||
interface BlockerUnblocked {
|
||||
state: "unblocked";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: undefined;
|
||||
}
|
||||
interface BlockerProceeding {
|
||||
state: "proceeding";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: Location;
|
||||
}
|
||||
type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
||||
type BlockerFunction = (args: {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
historyAction: Action;
|
||||
}) => boolean;
|
||||
declare const IDLE_NAVIGATION: NavigationStates["Idle"];
|
||||
declare const IDLE_FETCHER: FetcherStates["Idle"];
|
||||
declare const IDLE_BLOCKER: BlockerUnblocked;
|
||||
/**
|
||||
* Create a router and listen to history POP navigations
|
||||
*/
|
||||
declare function createRouter(init: RouterInit): Router;
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Pick<Headers, "get">;
|
||||
};
|
||||
type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>;
|
||||
type InstrumentableRoute = {
|
||||
id: string;
|
||||
index: boolean | undefined;
|
||||
path: string | undefined;
|
||||
instrument(instrumentations: RouteInstrumentations): void;
|
||||
};
|
||||
type RouteInstrumentations = {
|
||||
lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
instrument(instrumentations: RouterInstrumentations): void;
|
||||
};
|
||||
type RouterInstrumentations = {
|
||||
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
||||
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
||||
};
|
||||
type RouterNavigationInstrumentationInfo = Readonly<{
|
||||
to: string | number;
|
||||
currentUrl: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type RouterFetchInstrumentationInfo = Readonly<{
|
||||
href: string;
|
||||
currentUrl: string;
|
||||
fetcherKey: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type InstrumentableRequestHandler = {
|
||||
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
||||
};
|
||||
type RequestHandlerInstrumentations = {
|
||||
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RequestHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
context: ReadonlyContext | undefined;
|
||||
}>;
|
||||
|
||||
export { type BlockerFunction as B, type CreateStaticHandlerOptions as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, IDLE_NAVIGATION as I, type Navigation as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type NavigationStates as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type unstable_ServerInstrumentation as l, type unstable_InstrumentRequestHandlerFunction as m, type unstable_InstrumentRouterFunction as n, type unstable_InstrumentRouteFunction as o, type unstable_InstrumentationHandlerResult as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type unstable_ClientInstrumentation as u };
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../routeModules-BRrCYrSL.mjs';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CTxsJBKQ.mjs';
|
||||
import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-U8FS-wNn.mjs';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { R as RouteModule, t as LinkDescriptor, L as Location, u as Func, v as Pretty, w as MetaDescriptor, G as GetLoaderData, x as ServerDataFunctionArgs, y as MiddlewareNextFunction, z as ClientDataFunctionArgs, B as DataStrategyResult, E as ServerDataFrom, N as Normalize, I as GetActionData } from '../../routeModules-CA7kSxJJ.js';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CkcGwv27.js';
|
||||
import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-D4xhSy90.js';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-BRrCYrSL.mjs';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-1693
File diff suppressed because it is too large
Load Diff
-1693
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user