mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-28 11:42:38 +08:00
Initial commit
This commit is contained in:
commit
153a4e9fd7
345 changed files with 359185 additions and 0 deletions
117
node_modules/react-router-dom/dist/dom.d.ts
generated
vendored
Normal file
117
node_modules/react-router-dom/dist/dom.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
import type { FormEncType, HTMLFormMethod, RelativeRoutingType } from "@remix-run/router";
|
||||
export declare const defaultMethod: HTMLFormMethod;
|
||||
export declare function isHtmlElement(object: any): object is HTMLElement;
|
||||
export declare function isButtonElement(object: any): object is HTMLButtonElement;
|
||||
export declare function isFormElement(object: any): object is HTMLFormElement;
|
||||
export declare function isInputElement(object: any): object is HTMLInputElement;
|
||||
type LimitedMouseEvent = Pick<MouseEvent, "button" | "metaKey" | "altKey" | "ctrlKey" | "shiftKey">;
|
||||
export declare function shouldProcessLinkClick(event: LimitedMouseEvent, target?: string): boolean;
|
||||
export type ParamKeyValuePair = [string, string];
|
||||
export type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
||||
/**
|
||||
* Creates a URLSearchParams object using the given initializer.
|
||||
*
|
||||
* This is identical to `new URLSearchParams(init)` except it also
|
||||
* supports arrays as values in the object form of the initializer
|
||||
* instead of just strings. This is convenient when you need multiple
|
||||
* values for a given key, but don't want to use an array initializer.
|
||||
*
|
||||
* For example, instead of:
|
||||
*
|
||||
* let searchParams = new URLSearchParams([
|
||||
* ['sort', 'name'],
|
||||
* ['sort', 'price']
|
||||
* ]);
|
||||
*
|
||||
* you can do:
|
||||
*
|
||||
* let searchParams = createSearchParams({
|
||||
* sort: ['name', 'price']
|
||||
* });
|
||||
*/
|
||||
export declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;
|
||||
export declare function getSearchParamsForLocation(locationSearch: string, defaultSearchParams: URLSearchParams | null): URLSearchParams;
|
||||
type JsonObject = {
|
||||
[Key in string]: JsonValue;
|
||||
} & {
|
||||
[Key in string]?: JsonValue | undefined;
|
||||
};
|
||||
type JsonArray = JsonValue[] | readonly JsonValue[];
|
||||
type JsonPrimitive = string | number | boolean | null;
|
||||
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
||||
export type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
|
||||
/**
|
||||
* Submit options shared by both navigations and fetchers
|
||||
*/
|
||||
interface SharedSubmitOptions {
|
||||
/**
|
||||
* The HTTP method used to submit the form. Overrides `<form method>`.
|
||||
* Defaults to "GET".
|
||||
*/
|
||||
method?: HTMLFormMethod;
|
||||
/**
|
||||
* The action URL path used to submit the form. Overrides `<form action>`.
|
||||
* Defaults to the path of the current route.
|
||||
*/
|
||||
action?: string;
|
||||
/**
|
||||
* The encoding used to submit the form. Overrides `<form encType>`.
|
||||
* Defaults to "application/x-www-form-urlencoded".
|
||||
*/
|
||||
encType?: FormEncType;
|
||||
/**
|
||||
* Determines whether the form action is relative to the route hierarchy or
|
||||
* the pathname. Use this if you want to opt out of navigating the route
|
||||
* hierarchy and want to instead route based on /-delimited URL segments
|
||||
*/
|
||||
relative?: RelativeRoutingType;
|
||||
/**
|
||||
* In browser-based environments, prevent resetting scroll after this
|
||||
* navigation when using the <ScrollRestoration> component
|
||||
*/
|
||||
preventScrollReset?: boolean;
|
||||
/**
|
||||
* Enable flushSync for this submission's state updates
|
||||
*/
|
||||
flushSync?: boolean;
|
||||
}
|
||||
/**
|
||||
* Submit options available to fetchers
|
||||
*/
|
||||
export interface FetcherSubmitOptions extends SharedSubmitOptions {
|
||||
}
|
||||
/**
|
||||
* Submit options available to navigations
|
||||
*/
|
||||
export interface SubmitOptions extends FetcherSubmitOptions {
|
||||
/**
|
||||
* Set `true` to replace the current entry in the browser's history stack
|
||||
* instead of creating a new one (i.e. stay on "the same page"). Defaults
|
||||
* to `false`.
|
||||
*/
|
||||
replace?: boolean;
|
||||
/**
|
||||
* State object to add to the history stack entry for this navigation
|
||||
*/
|
||||
state?: any;
|
||||
/**
|
||||
* Indicate a specific fetcherKey to use when using navigate=false
|
||||
*/
|
||||
fetcherKey?: string;
|
||||
/**
|
||||
* navigate=false will use a fetcher instead of a navigation
|
||||
*/
|
||||
navigate?: boolean;
|
||||
/**
|
||||
* Enable view transitions on this submission navigation
|
||||
*/
|
||||
viewTransition?: boolean;
|
||||
}
|
||||
export declare function getFormSubmissionInfo(target: SubmitTarget, basename: string): {
|
||||
action: string | null;
|
||||
method: string;
|
||||
encType: string;
|
||||
formData: FormData | undefined;
|
||||
body: any;
|
||||
};
|
||||
export {};
|
331
node_modules/react-router-dom/dist/index.d.ts
generated
vendored
Normal file
331
node_modules/react-router-dom/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,331 @@
|
|||
/**
|
||||
* NOTE: If you refactor this to split up the modules into separate files,
|
||||
* you'll need to update the rollup config for react-router-dom-v5-compat.
|
||||
*/
|
||||
import * as React from "react";
|
||||
import type { FutureConfig, Location, NavigateOptions, RelativeRoutingType, RouteObject, RouterProviderProps, To, DataStrategyFunction, PatchRoutesOnNavigationFunction } from "react-router";
|
||||
import type { Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod, BlockerFunction } from "@remix-run/router";
|
||||
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@remix-run/router";
|
||||
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget, FetcherSubmitOptions } from "./dom";
|
||||
import { createSearchParams } from "./dom";
|
||||
export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, };
|
||||
export { createSearchParams, ErrorResponseImpl as UNSAFE_ErrorResponseImpl };
|
||||
export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, } from "react-router";
|
||||
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
|
||||
/** @internal */
|
||||
export { UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, } from "react-router";
|
||||
declare global {
|
||||
var __staticRouterHydrationData: HydrationState | undefined;
|
||||
var __reactRouterVersion: string;
|
||||
interface Document {
|
||||
startViewTransition(cb: () => Promise<void> | void): ViewTransition;
|
||||
}
|
||||
}
|
||||
interface DOMRouterOpts {
|
||||
basename?: string;
|
||||
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
|
||||
hydrationData?: HydrationState;
|
||||
dataStrategy?: DataStrategyFunction;
|
||||
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
||||
window?: Window;
|
||||
}
|
||||
export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
|
||||
export declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
|
||||
type ViewTransitionContextObject = {
|
||||
isTransitioning: false;
|
||||
} | {
|
||||
isTransitioning: true;
|
||||
flushSync: boolean;
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
};
|
||||
declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
|
||||
export { ViewTransitionContext as UNSAFE_ViewTransitionContext };
|
||||
type FetchersContextObject = Map<string, any>;
|
||||
declare const FetchersContext: React.Context<FetchersContextObject>;
|
||||
export { FetchersContext as UNSAFE_FetchersContext };
|
||||
interface ViewTransition {
|
||||
finished: Promise<void>;
|
||||
ready: Promise<void>;
|
||||
updateCallbackDone: Promise<void>;
|
||||
skipTransition(): void;
|
||||
}
|
||||
/**
|
||||
* Given a Remix Router instance, render the appropriate UI
|
||||
*/
|
||||
export declare function RouterProvider({ fallbackElement, router, future, }: RouterProviderProps): React.ReactElement;
|
||||
export interface BrowserRouterProps {
|
||||
basename?: string;
|
||||
children?: React.ReactNode;
|
||||
future?: Partial<FutureConfig>;
|
||||
window?: Window;
|
||||
}
|
||||
/**
|
||||
* A `<Router>` for use in web browsers. Provides the cleanest URLs.
|
||||
*/
|
||||
export declare function BrowserRouter({ basename, children, future, window, }: BrowserRouterProps): React.JSX.Element;
|
||||
export interface HashRouterProps {
|
||||
basename?: string;
|
||||
children?: React.ReactNode;
|
||||
future?: Partial<FutureConfig>;
|
||||
window?: Window;
|
||||
}
|
||||
/**
|
||||
* A `<Router>` for use in web browsers. Stores the location in the hash
|
||||
* portion of the URL so it is not sent to the server.
|
||||
*/
|
||||
export declare function HashRouter({ basename, children, future, window, }: HashRouterProps): React.JSX.Element;
|
||||
export interface HistoryRouterProps {
|
||||
basename?: string;
|
||||
children?: React.ReactNode;
|
||||
future?: FutureConfig;
|
||||
history: History;
|
||||
}
|
||||
/**
|
||||
* A `<Router>` that accepts a pre-instantiated history object. It's important
|
||||
* to note that using your own history object is highly discouraged and may add
|
||||
* two versions of the history library to your bundles unless you use the same
|
||||
* version of the history library that React Router uses internally.
|
||||
*/
|
||||
declare function HistoryRouter({ basename, children, future, history, }: HistoryRouterProps): React.JSX.Element;
|
||||
declare namespace HistoryRouter {
|
||||
var displayName: string;
|
||||
}
|
||||
export { HistoryRouter as unstable_HistoryRouter };
|
||||
export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
|
||||
reloadDocument?: boolean;
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
to: To;
|
||||
viewTransition?: boolean;
|
||||
}
|
||||
/**
|
||||
* The public API for rendering a history-aware `<a>`.
|
||||
*/
|
||||
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
||||
export type NavLinkRenderProps = {
|
||||
isActive: boolean;
|
||||
isPending: boolean;
|
||||
isTransitioning: boolean;
|
||||
};
|
||||
export interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "children"> {
|
||||
children?: React.ReactNode | ((props: NavLinkRenderProps) => React.ReactNode);
|
||||
caseSensitive?: boolean;
|
||||
className?: string | ((props: NavLinkRenderProps) => string | undefined);
|
||||
end?: boolean;
|
||||
style?: React.CSSProperties | ((props: NavLinkRenderProps) => React.CSSProperties | undefined);
|
||||
}
|
||||
/**
|
||||
* A `<Link>` wrapper that knows if it's "active" or not.
|
||||
*/
|
||||
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
||||
/**
|
||||
* Form props shared by navigations and fetchers
|
||||
*/
|
||||
interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
||||
/**
|
||||
* The HTTP verb to use when the form is submit. Supports "get", "post",
|
||||
* "put", "delete", "patch".
|
||||
*/
|
||||
method?: HTMLFormMethod;
|
||||
/**
|
||||
* `<form encType>` - enhancing beyond the normal string type and limiting
|
||||
* to the built-in browser supported values
|
||||
*/
|
||||
encType?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain";
|
||||
/**
|
||||
* Normal `<form action>` but supports React Router's relative paths.
|
||||
*/
|
||||
action?: string;
|
||||
/**
|
||||
* Determines whether the form action is relative to the route hierarchy or
|
||||
* the pathname. Use this if you want to opt out of navigating the route
|
||||
* hierarchy and want to instead route based on /-delimited URL segments
|
||||
*/
|
||||
relative?: RelativeRoutingType;
|
||||
/**
|
||||
* Prevent the scroll position from resetting to the top of the viewport on
|
||||
* completion of the navigation when using the <ScrollRestoration> component
|
||||
*/
|
||||
preventScrollReset?: boolean;
|
||||
/**
|
||||
* A function to call when the form is submitted. If you call
|
||||
* `event.preventDefault()` then this form will not do anything.
|
||||
*/
|
||||
onSubmit?: React.FormEventHandler<HTMLFormElement>;
|
||||
}
|
||||
/**
|
||||
* Form props available to fetchers
|
||||
*/
|
||||
export interface FetcherFormProps extends SharedFormProps {
|
||||
}
|
||||
/**
|
||||
* Form props available to navigations
|
||||
*/
|
||||
export interface FormProps extends SharedFormProps {
|
||||
/**
|
||||
* Indicate a specific fetcherKey to use when using navigate=false
|
||||
*/
|
||||
fetcherKey?: string;
|
||||
/**
|
||||
* navigate=false will use a fetcher instead of a navigation
|
||||
*/
|
||||
navigate?: boolean;
|
||||
/**
|
||||
* Forces a full document navigation instead of a fetch.
|
||||
*/
|
||||
reloadDocument?: boolean;
|
||||
/**
|
||||
* Replaces the current entry in the browser history stack when the form
|
||||
* navigates. Use this if you don't want the user to be able to click "back"
|
||||
* to the page with the form on it.
|
||||
*/
|
||||
replace?: boolean;
|
||||
/**
|
||||
* State object to add to the history stack entry for this navigation
|
||||
*/
|
||||
state?: any;
|
||||
/**
|
||||
* Enable view transitions on this Form navigation
|
||||
*/
|
||||
viewTransition?: boolean;
|
||||
}
|
||||
/**
|
||||
* A `@remix-run/router`-aware `<form>`. It behaves like a normal form except
|
||||
* that the interaction with the server is with `fetch` instead of new document
|
||||
* requests, allowing components to add nicer UX to the page as the form is
|
||||
* submitted and returns with data.
|
||||
*/
|
||||
export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
||||
export interface ScrollRestorationProps {
|
||||
getKey?: GetScrollRestorationKeyFunction;
|
||||
storageKey?: string;
|
||||
}
|
||||
/**
|
||||
* This component will emulate the browser's scroll restoration on location
|
||||
* changes.
|
||||
*/
|
||||
export declare function ScrollRestoration({ getKey, storageKey, }: ScrollRestorationProps): null;
|
||||
export declare namespace ScrollRestoration {
|
||||
var displayName: string;
|
||||
}
|
||||
/**
|
||||
* Handles the click behavior for router `<Link>` components. This is useful if
|
||||
* you need to create custom `<Link>` components with the same click behavior we
|
||||
* use in our exported `<Link>`.
|
||||
*/
|
||||
export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, }?: {
|
||||
target?: React.HTMLAttributeAnchorTarget;
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
viewTransition?: boolean;
|
||||
}): (event: React.MouseEvent<E, MouseEvent>) => void;
|
||||
/**
|
||||
* A convenient wrapper for reading and writing search parameters via the
|
||||
* URLSearchParams interface.
|
||||
*/
|
||||
export declare function useSearchParams(defaultInit?: URLSearchParamsInit): [URLSearchParams, SetURLSearchParams];
|
||||
export type SetURLSearchParams = (nextInit?: URLSearchParamsInit | ((prev: URLSearchParams) => URLSearchParamsInit), navigateOpts?: NavigateOptions) => void;
|
||||
/**
|
||||
* Submits a HTML `<form>` to the server without reloading the page.
|
||||
*/
|
||||
export interface SubmitFunction {
|
||||
(
|
||||
/**
|
||||
* Specifies the `<form>` to be submitted to the server, a specific
|
||||
* `<button>` or `<input type="submit">` to use to submit the form, or some
|
||||
* arbitrary data to submit.
|
||||
*
|
||||
* Note: When using a `<button>` its `name` and `value` will also be
|
||||
* included in the form data that is submitted.
|
||||
*/
|
||||
target: SubmitTarget,
|
||||
/**
|
||||
* Options that override the `<form>`'s own attributes. Required when
|
||||
* submitting arbitrary data without a backing `<form>`.
|
||||
*/
|
||||
options?: SubmitOptions): void;
|
||||
}
|
||||
/**
|
||||
* Submits a fetcher `<form>` to the server without reloading the page.
|
||||
*/
|
||||
export interface FetcherSubmitFunction {
|
||||
(target: SubmitTarget, options?: FetcherSubmitOptions): void;
|
||||
}
|
||||
/**
|
||||
* Returns a function that may be used to programmatically submit a form (or
|
||||
* some arbitrary data) to the server.
|
||||
*/
|
||||
export declare function useSubmit(): SubmitFunction;
|
||||
export declare function useFormAction(action?: string, { relative }?: {
|
||||
relative?: RelativeRoutingType;
|
||||
}): string;
|
||||
export type FetcherWithComponents<TData> = Fetcher<TData> & {
|
||||
Form: React.ForwardRefExoticComponent<FetcherFormProps & React.RefAttributes<HTMLFormElement>>;
|
||||
submit: FetcherSubmitFunction;
|
||||
load: (href: string, opts?: {
|
||||
flushSync?: boolean;
|
||||
}) => void;
|
||||
};
|
||||
/**
|
||||
* Interacts with route loaders and actions without causing a navigation. Great
|
||||
* for any interaction that stays on the same page.
|
||||
*/
|
||||
export declare function useFetcher<TData = any>({ key, }?: {
|
||||
key?: string;
|
||||
}): FetcherWithComponents<TData>;
|
||||
/**
|
||||
* Provides all fetchers currently on the page. Useful for layouts and parent
|
||||
* routes that need to provide pending/optimistic UI regarding the fetch.
|
||||
*/
|
||||
export declare function useFetchers(): (Fetcher & {
|
||||
key: string;
|
||||
})[];
|
||||
/**
|
||||
* When rendered inside a RouterProvider, will restore scroll positions on navigations
|
||||
*/
|
||||
declare function useScrollRestoration({ getKey, storageKey, }?: {
|
||||
getKey?: GetScrollRestorationKeyFunction;
|
||||
storageKey?: string;
|
||||
}): void;
|
||||
export { useScrollRestoration as UNSAFE_useScrollRestoration };
|
||||
/**
|
||||
* Setup a callback to be fired on the window's `beforeunload` event. This is
|
||||
* useful for saving some data to `window.localStorage` just before the page
|
||||
* refreshes.
|
||||
*
|
||||
* Note: The `callback` argument should be a function created with
|
||||
* `React.useCallback()`.
|
||||
*/
|
||||
export declare function useBeforeUnload(callback: (event: BeforeUnloadEvent) => any, options?: {
|
||||
capture?: boolean;
|
||||
}): void;
|
||||
/**
|
||||
* Wrapper around useBlocker to show a window.confirm prompt to users instead
|
||||
* of building a custom UI with useBlocker.
|
||||
*
|
||||
* Warning: This has *a lot of rough edges* and behaves very differently (and
|
||||
* very incorrectly in some cases) across browsers if user click addition
|
||||
* back/forward navigations while the confirm is open. Use at your own risk.
|
||||
*/
|
||||
declare function usePrompt({ when, message, }: {
|
||||
when: boolean | BlockerFunction;
|
||||
message: string;
|
||||
}): void;
|
||||
export { usePrompt as unstable_usePrompt };
|
||||
/**
|
||||
* Return a boolean indicating if there is an active view transition to the
|
||||
* given href. You can use this value to render CSS classes or viewTransitionName
|
||||
* styles onto your elements
|
||||
*
|
||||
* @param href The destination href
|
||||
* @param [opts.relative] Relative routing type ("route" | "path")
|
||||
*/
|
||||
declare function useViewTransitionState(to: To, opts?: {
|
||||
relative?: RelativeRoutingType;
|
||||
}): boolean;
|
||||
export { useViewTransitionState as useViewTransitionState };
|
1458
node_modules/react-router-dom/dist/index.js
generated
vendored
Normal file
1458
node_modules/react-router-dom/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/react-router-dom/dist/index.js.map
generated
vendored
Normal file
1
node_modules/react-router-dom/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19
node_modules/react-router-dom/dist/main.js
generated
vendored
Normal file
19
node_modules/react-router-dom/dist/main.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* React Router DOM v6.30.1
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/* eslint-env node */
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
module.exports = require("./umd/react-router-dom.production.min.js");
|
||||
} else {
|
||||
module.exports = require("./umd/react-router-dom.development.js");
|
||||
}
|
1526
node_modules/react-router-dom/dist/react-router-dom.development.js
generated
vendored
Normal file
1526
node_modules/react-router-dom/dist/react-router-dom.development.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/react-router-dom/dist/react-router-dom.development.js.map
generated
vendored
Normal file
1
node_modules/react-router-dom/dist/react-router-dom.development.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/react-router-dom/dist/react-router-dom.production.min.js
generated
vendored
Normal file
12
node_modules/react-router-dom/dist/react-router-dom.production.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/react-router-dom/dist/react-router-dom.production.min.js.map
generated
vendored
Normal file
1
node_modules/react-router-dom/dist/react-router-dom.production.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
node_modules/react-router-dom/dist/server.d.ts
generated
vendored
Normal file
31
node_modules/react-router-dom/dist/server.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
import * as React from "react";
|
||||
import type { Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, FutureConfig as RouterFutureConfig } from "@remix-run/router";
|
||||
import type { FutureConfig, Location, RouteObject } from "react-router-dom";
|
||||
export interface StaticRouterProps {
|
||||
basename?: string;
|
||||
children?: React.ReactNode;
|
||||
location: Partial<Location> | string;
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
/**
|
||||
* A `<Router>` that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
export declare function StaticRouter({ basename, children, location: locationProp, future, }: StaticRouterProps): React.JSX.Element;
|
||||
export { StaticHandlerContext };
|
||||
export interface StaticRouterProviderProps {
|
||||
context: StaticHandlerContext;
|
||||
router: RemixRouter;
|
||||
hydrate?: boolean;
|
||||
nonce?: string;
|
||||
}
|
||||
/**
|
||||
* A Data Router that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
export declare function StaticRouterProvider({ context, router, hydrate, nonce, }: StaticRouterProviderProps): React.JSX.Element;
|
||||
type CreateStaticHandlerOptions = Omit<RouterCreateStaticHandlerOptions, "detectErrorBoundary" | "mapRouteProperties">;
|
||||
export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("@remix-run/router").StaticHandler;
|
||||
export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
|
||||
future?: Partial<Pick<RouterFutureConfig, "v7_partialHydration" | "v7_relativeSplatPath">>;
|
||||
}): RemixRouter;
|
322
node_modules/react-router-dom/dist/server.js
generated
vendored
Normal file
322
node_modules/react-router-dom/dist/server.js
generated
vendored
Normal file
|
@ -0,0 +1,322 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var React = require('react');
|
||||
var router = require('@remix-run/router');
|
||||
var reactRouter = require('react-router');
|
||||
var reactRouterDom = require('react-router-dom');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
|
||||
/**
|
||||
* A `<Router>` that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
function StaticRouter({
|
||||
basename,
|
||||
children,
|
||||
location: locationProp = "/",
|
||||
future
|
||||
}) {
|
||||
if (typeof locationProp === "string") {
|
||||
locationProp = reactRouterDom.parsePath(locationProp);
|
||||
}
|
||||
let action = router.Action.Pop;
|
||||
let location = {
|
||||
pathname: locationProp.pathname || "/",
|
||||
search: locationProp.search || "",
|
||||
hash: locationProp.hash || "",
|
||||
state: locationProp.state != null ? locationProp.state : null,
|
||||
key: locationProp.key || "default"
|
||||
};
|
||||
let staticNavigator = getStatelessNavigator();
|
||||
return /*#__PURE__*/React__namespace.createElement(reactRouterDom.Router, {
|
||||
basename: basename,
|
||||
children: children,
|
||||
location: location,
|
||||
navigationType: action,
|
||||
navigator: staticNavigator,
|
||||
future: future,
|
||||
static: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A Data Router that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
function StaticRouterProvider({
|
||||
context,
|
||||
router: router$1,
|
||||
hydrate = true,
|
||||
nonce
|
||||
}) {
|
||||
!(router$1 && context) ? process.env.NODE_ENV !== "production" ? router.UNSAFE_invariant(false, "You must provide `router` and `context` to <StaticRouterProvider>") : router.UNSAFE_invariant(false) : void 0;
|
||||
let dataRouterContext = {
|
||||
router: router$1,
|
||||
navigator: getStatelessNavigator(),
|
||||
static: true,
|
||||
staticContext: context,
|
||||
basename: context.basename || "/"
|
||||
};
|
||||
let fetchersContext = new Map();
|
||||
let hydrateScript = "";
|
||||
if (hydrate !== false) {
|
||||
let data = {
|
||||
loaderData: context.loaderData,
|
||||
actionData: context.actionData,
|
||||
errors: serializeErrors(context.errors)
|
||||
};
|
||||
// Use JSON.parse here instead of embedding a raw JS object here to speed
|
||||
// up parsing on the client. Dual-stringify is needed to ensure all quotes
|
||||
// are properly escaped in the resulting string. See:
|
||||
// https://v8.dev/blog/cost-of-javascript-2019#json
|
||||
let json = htmlEscape(JSON.stringify(JSON.stringify(data)));
|
||||
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
||||
}
|
||||
let {
|
||||
state
|
||||
} = dataRouterContext.router;
|
||||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterContext.Provider, {
|
||||
value: dataRouterContext
|
||||
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_DataRouterStateContext.Provider, {
|
||||
value: state
|
||||
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_FetchersContext.Provider, {
|
||||
value: fetchersContext
|
||||
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.UNSAFE_ViewTransitionContext.Provider, {
|
||||
value: {
|
||||
isTransitioning: false
|
||||
}
|
||||
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Router, {
|
||||
basename: dataRouterContext.basename,
|
||||
location: state.location,
|
||||
navigationType: state.historyAction,
|
||||
navigator: dataRouterContext.navigator,
|
||||
static: dataRouterContext.static,
|
||||
future: {
|
||||
v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
|
||||
}
|
||||
}, /*#__PURE__*/React__namespace.createElement(DataRoutes, {
|
||||
routes: router$1.routes,
|
||||
future: router$1.future,
|
||||
state: state
|
||||
})))))), hydrateScript ? /*#__PURE__*/React__namespace.createElement("script", {
|
||||
suppressHydrationWarning: true,
|
||||
nonce: nonce,
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: hydrateScript
|
||||
}
|
||||
}) : null);
|
||||
}
|
||||
function DataRoutes({
|
||||
routes,
|
||||
future,
|
||||
state
|
||||
}) {
|
||||
return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state, future);
|
||||
}
|
||||
function serializeErrors(errors) {
|
||||
if (!errors) return null;
|
||||
let entries = Object.entries(errors);
|
||||
let serialized = {};
|
||||
for (let [key, val] of entries) {
|
||||
// Hey you! If you change this, please change the corresponding logic in
|
||||
// deserializeErrors in react-router-dom/index.tsx :)
|
||||
if (router.isRouteErrorResponse(val)) {
|
||||
serialized[key] = {
|
||||
...val,
|
||||
__type: "RouteErrorResponse"
|
||||
};
|
||||
} else if (val instanceof Error) {
|
||||
// Do not serialize stack traces from SSR for security reasons
|
||||
serialized[key] = {
|
||||
message: val.message,
|
||||
__type: "Error",
|
||||
// If this is a subclass (i.e., ReferenceError), send up the type so we
|
||||
// can re-create the same type during hydration.
|
||||
...(val.name !== "Error" ? {
|
||||
__subType: val.name
|
||||
} : {})
|
||||
};
|
||||
} else {
|
||||
serialized[key] = val;
|
||||
}
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
function getStatelessNavigator() {
|
||||
return {
|
||||
createHref,
|
||||
encodeLocation,
|
||||
push(to) {
|
||||
throw new Error(`You cannot use navigator.push() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)})\` somewhere in your app.`);
|
||||
},
|
||||
replace(to) {
|
||||
throw new Error(`You cannot use navigator.replace() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere ` + `in your app.`);
|
||||
},
|
||||
go(delta) {
|
||||
throw new Error(`You cannot use navigator.go() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${delta})\` somewhere in your app.`);
|
||||
},
|
||||
back() {
|
||||
throw new Error(`You cannot use navigator.back() on the server because it is a stateless ` + `environment.`);
|
||||
},
|
||||
forward() {
|
||||
throw new Error(`You cannot use navigator.forward() on the server because it is a stateless ` + `environment.`);
|
||||
}
|
||||
};
|
||||
}
|
||||
function createStaticHandler(routes, opts) {
|
||||
return router.createStaticHandler(routes, {
|
||||
...opts,
|
||||
mapRouteProperties: reactRouter.UNSAFE_mapRouteProperties
|
||||
});
|
||||
}
|
||||
function createStaticRouter(routes, context, opts = {}) {
|
||||
let manifest = {};
|
||||
let dataRoutes = router.UNSAFE_convertRoutesToDataRoutes(routes, reactRouter.UNSAFE_mapRouteProperties, undefined, manifest);
|
||||
// Because our context matches may be from a framework-agnostic set of
|
||||
// routes passed to createStaticHandler(), we update them here with our
|
||||
// newly created/enhanced data routes
|
||||
let matches = context.matches.map(match => {
|
||||
let route = manifest[match.route.id] || match.route;
|
||||
return {
|
||||
...match,
|
||||
route
|
||||
};
|
||||
});
|
||||
let msg = method => `You cannot use router.${method}() on the server because it is a stateless environment`;
|
||||
return {
|
||||
get basename() {
|
||||
return context.basename;
|
||||
},
|
||||
get future() {
|
||||
return {
|
||||
v7_fetcherPersist: false,
|
||||
v7_normalizeFormMethod: false,
|
||||
v7_partialHydration: opts.future?.v7_partialHydration === true,
|
||||
v7_prependBasename: false,
|
||||
v7_relativeSplatPath: opts.future?.v7_relativeSplatPath === true,
|
||||
v7_skipActionErrorRevalidation: false
|
||||
};
|
||||
},
|
||||
get state() {
|
||||
return {
|
||||
historyAction: router.Action.Pop,
|
||||
location: context.location,
|
||||
matches,
|
||||
loaderData: context.loaderData,
|
||||
actionData: context.actionData,
|
||||
errors: context.errors,
|
||||
initialized: true,
|
||||
navigation: router.IDLE_NAVIGATION,
|
||||
restoreScrollPosition: null,
|
||||
preventScrollReset: false,
|
||||
revalidation: "idle",
|
||||
fetchers: new Map(),
|
||||
blockers: new Map()
|
||||
};
|
||||
},
|
||||
get routes() {
|
||||
return dataRoutes;
|
||||
},
|
||||
get window() {
|
||||
return undefined;
|
||||
},
|
||||
initialize() {
|
||||
throw msg("initialize");
|
||||
},
|
||||
subscribe() {
|
||||
throw msg("subscribe");
|
||||
},
|
||||
enableScrollRestoration() {
|
||||
throw msg("enableScrollRestoration");
|
||||
},
|
||||
navigate() {
|
||||
throw msg("navigate");
|
||||
},
|
||||
fetch() {
|
||||
throw msg("fetch");
|
||||
},
|
||||
revalidate() {
|
||||
throw msg("revalidate");
|
||||
},
|
||||
createHref,
|
||||
encodeLocation,
|
||||
getFetcher() {
|
||||
return router.IDLE_FETCHER;
|
||||
},
|
||||
deleteFetcher() {
|
||||
throw msg("deleteFetcher");
|
||||
},
|
||||
dispose() {
|
||||
throw msg("dispose");
|
||||
},
|
||||
getBlocker() {
|
||||
return router.IDLE_BLOCKER;
|
||||
},
|
||||
deleteBlocker() {
|
||||
throw msg("deleteBlocker");
|
||||
},
|
||||
patchRoutes() {
|
||||
throw msg("patchRoutes");
|
||||
},
|
||||
_internalFetchControllers: new Map(),
|
||||
_internalActiveDeferreds: new Map(),
|
||||
_internalSetRoutes() {
|
||||
throw msg("_internalSetRoutes");
|
||||
}
|
||||
};
|
||||
}
|
||||
function createHref(to) {
|
||||
return typeof to === "string" ? to : reactRouterDom.createPath(to);
|
||||
}
|
||||
function encodeLocation(to) {
|
||||
let href = typeof to === "string" ? to : reactRouterDom.createPath(to);
|
||||
// Treating this as a full URL will strip any trailing spaces so we need to
|
||||
// pre-encode them since they might be part of a matching splat param from
|
||||
// an ancestor route
|
||||
href = href.replace(/ $/, "%20");
|
||||
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
||||
return {
|
||||
pathname: encoded.pathname,
|
||||
search: encoded.search,
|
||||
hash: encoded.hash
|
||||
};
|
||||
}
|
||||
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
||||
// This utility is based on https://github.com/zertosh/htmlescape
|
||||
// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
|
||||
const ESCAPE_LOOKUP = {
|
||||
"&": "\\u0026",
|
||||
">": "\\u003e",
|
||||
"<": "\\u003c",
|
||||
"\u2028": "\\u2028",
|
||||
"\u2029": "\\u2029"
|
||||
};
|
||||
const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
||||
function htmlEscape(str) {
|
||||
return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
||||
}
|
||||
|
||||
exports.StaticRouter = StaticRouter;
|
||||
exports.StaticRouterProvider = StaticRouterProvider;
|
||||
exports.createStaticHandler = createStaticHandler;
|
||||
exports.createStaticRouter = createStaticRouter;
|
297
node_modules/react-router-dom/dist/server.mjs
generated
vendored
Normal file
297
node_modules/react-router-dom/dist/server.mjs
generated
vendored
Normal file
|
@ -0,0 +1,297 @@
|
|||
import * as React from 'react';
|
||||
import { Action, UNSAFE_invariant, isRouteErrorResponse, createStaticHandler as createStaticHandler$1, UNSAFE_convertRoutesToDataRoutes, IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER } from '@remix-run/router';
|
||||
import { UNSAFE_useRoutesImpl, UNSAFE_mapRouteProperties } from 'react-router';
|
||||
import { parsePath, Router, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_FetchersContext, UNSAFE_ViewTransitionContext, createPath } from 'react-router-dom';
|
||||
|
||||
/**
|
||||
* A `<Router>` that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
function StaticRouter({
|
||||
basename,
|
||||
children,
|
||||
location: locationProp = "/",
|
||||
future
|
||||
}) {
|
||||
if (typeof locationProp === "string") {
|
||||
locationProp = parsePath(locationProp);
|
||||
}
|
||||
let action = Action.Pop;
|
||||
let location = {
|
||||
pathname: locationProp.pathname || "/",
|
||||
search: locationProp.search || "",
|
||||
hash: locationProp.hash || "",
|
||||
state: locationProp.state != null ? locationProp.state : null,
|
||||
key: locationProp.key || "default"
|
||||
};
|
||||
let staticNavigator = getStatelessNavigator();
|
||||
return /*#__PURE__*/React.createElement(Router, {
|
||||
basename: basename,
|
||||
children: children,
|
||||
location: location,
|
||||
navigationType: action,
|
||||
navigator: staticNavigator,
|
||||
future: future,
|
||||
static: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A Data Router that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*/
|
||||
function StaticRouterProvider({
|
||||
context,
|
||||
router,
|
||||
hydrate = true,
|
||||
nonce
|
||||
}) {
|
||||
!(router && context) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "You must provide `router` and `context` to <StaticRouterProvider>") : UNSAFE_invariant(false) : void 0;
|
||||
let dataRouterContext = {
|
||||
router,
|
||||
navigator: getStatelessNavigator(),
|
||||
static: true,
|
||||
staticContext: context,
|
||||
basename: context.basename || "/"
|
||||
};
|
||||
let fetchersContext = new Map();
|
||||
let hydrateScript = "";
|
||||
if (hydrate !== false) {
|
||||
let data = {
|
||||
loaderData: context.loaderData,
|
||||
actionData: context.actionData,
|
||||
errors: serializeErrors(context.errors)
|
||||
};
|
||||
// Use JSON.parse here instead of embedding a raw JS object here to speed
|
||||
// up parsing on the client. Dual-stringify is needed to ensure all quotes
|
||||
// are properly escaped in the resulting string. See:
|
||||
// https://v8.dev/blog/cost-of-javascript-2019#json
|
||||
let json = htmlEscape(JSON.stringify(JSON.stringify(data)));
|
||||
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
||||
}
|
||||
let {
|
||||
state
|
||||
} = dataRouterContext.router;
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_DataRouterContext.Provider, {
|
||||
value: dataRouterContext
|
||||
}, /*#__PURE__*/React.createElement(UNSAFE_DataRouterStateContext.Provider, {
|
||||
value: state
|
||||
}, /*#__PURE__*/React.createElement(UNSAFE_FetchersContext.Provider, {
|
||||
value: fetchersContext
|
||||
}, /*#__PURE__*/React.createElement(UNSAFE_ViewTransitionContext.Provider, {
|
||||
value: {
|
||||
isTransitioning: false
|
||||
}
|
||||
}, /*#__PURE__*/React.createElement(Router, {
|
||||
basename: dataRouterContext.basename,
|
||||
location: state.location,
|
||||
navigationType: state.historyAction,
|
||||
navigator: dataRouterContext.navigator,
|
||||
static: dataRouterContext.static,
|
||||
future: {
|
||||
v7_relativeSplatPath: router.future.v7_relativeSplatPath
|
||||
}
|
||||
}, /*#__PURE__*/React.createElement(DataRoutes, {
|
||||
routes: router.routes,
|
||||
future: router.future,
|
||||
state: state
|
||||
})))))), hydrateScript ? /*#__PURE__*/React.createElement("script", {
|
||||
suppressHydrationWarning: true,
|
||||
nonce: nonce,
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: hydrateScript
|
||||
}
|
||||
}) : null);
|
||||
}
|
||||
function DataRoutes({
|
||||
routes,
|
||||
future,
|
||||
state
|
||||
}) {
|
||||
return UNSAFE_useRoutesImpl(routes, undefined, state, future);
|
||||
}
|
||||
function serializeErrors(errors) {
|
||||
if (!errors) return null;
|
||||
let entries = Object.entries(errors);
|
||||
let serialized = {};
|
||||
for (let [key, val] of entries) {
|
||||
// Hey you! If you change this, please change the corresponding logic in
|
||||
// deserializeErrors in react-router-dom/index.tsx :)
|
||||
if (isRouteErrorResponse(val)) {
|
||||
serialized[key] = {
|
||||
...val,
|
||||
__type: "RouteErrorResponse"
|
||||
};
|
||||
} else if (val instanceof Error) {
|
||||
// Do not serialize stack traces from SSR for security reasons
|
||||
serialized[key] = {
|
||||
message: val.message,
|
||||
__type: "Error",
|
||||
// If this is a subclass (i.e., ReferenceError), send up the type so we
|
||||
// can re-create the same type during hydration.
|
||||
...(val.name !== "Error" ? {
|
||||
__subType: val.name
|
||||
} : {})
|
||||
};
|
||||
} else {
|
||||
serialized[key] = val;
|
||||
}
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
function getStatelessNavigator() {
|
||||
return {
|
||||
createHref,
|
||||
encodeLocation,
|
||||
push(to) {
|
||||
throw new Error(`You cannot use navigator.push() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)})\` somewhere in your app.`);
|
||||
},
|
||||
replace(to) {
|
||||
throw new Error(`You cannot use navigator.replace() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere ` + `in your app.`);
|
||||
},
|
||||
go(delta) {
|
||||
throw new Error(`You cannot use navigator.go() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${delta})\` somewhere in your app.`);
|
||||
},
|
||||
back() {
|
||||
throw new Error(`You cannot use navigator.back() on the server because it is a stateless ` + `environment.`);
|
||||
},
|
||||
forward() {
|
||||
throw new Error(`You cannot use navigator.forward() on the server because it is a stateless ` + `environment.`);
|
||||
}
|
||||
};
|
||||
}
|
||||
function createStaticHandler(routes, opts) {
|
||||
return createStaticHandler$1(routes, {
|
||||
...opts,
|
||||
mapRouteProperties: UNSAFE_mapRouteProperties
|
||||
});
|
||||
}
|
||||
function createStaticRouter(routes, context, opts = {}) {
|
||||
let manifest = {};
|
||||
let dataRoutes = UNSAFE_convertRoutesToDataRoutes(routes, UNSAFE_mapRouteProperties, undefined, manifest);
|
||||
|
||||
// Because our context matches may be from a framework-agnostic set of
|
||||
// routes passed to createStaticHandler(), we update them here with our
|
||||
// newly created/enhanced data routes
|
||||
let matches = context.matches.map(match => {
|
||||
let route = manifest[match.route.id] || match.route;
|
||||
return {
|
||||
...match,
|
||||
route
|
||||
};
|
||||
});
|
||||
let msg = method => `You cannot use router.${method}() on the server because it is a stateless environment`;
|
||||
return {
|
||||
get basename() {
|
||||
return context.basename;
|
||||
},
|
||||
get future() {
|
||||
return {
|
||||
v7_fetcherPersist: false,
|
||||
v7_normalizeFormMethod: false,
|
||||
v7_partialHydration: opts.future?.v7_partialHydration === true,
|
||||
v7_prependBasename: false,
|
||||
v7_relativeSplatPath: opts.future?.v7_relativeSplatPath === true,
|
||||
v7_skipActionErrorRevalidation: false
|
||||
};
|
||||
},
|
||||
get state() {
|
||||
return {
|
||||
historyAction: Action.Pop,
|
||||
location: context.location,
|
||||
matches,
|
||||
loaderData: context.loaderData,
|
||||
actionData: context.actionData,
|
||||
errors: context.errors,
|
||||
initialized: true,
|
||||
navigation: IDLE_NAVIGATION,
|
||||
restoreScrollPosition: null,
|
||||
preventScrollReset: false,
|
||||
revalidation: "idle",
|
||||
fetchers: new Map(),
|
||||
blockers: new Map()
|
||||
};
|
||||
},
|
||||
get routes() {
|
||||
return dataRoutes;
|
||||
},
|
||||
get window() {
|
||||
return undefined;
|
||||
},
|
||||
initialize() {
|
||||
throw msg("initialize");
|
||||
},
|
||||
subscribe() {
|
||||
throw msg("subscribe");
|
||||
},
|
||||
enableScrollRestoration() {
|
||||
throw msg("enableScrollRestoration");
|
||||
},
|
||||
navigate() {
|
||||
throw msg("navigate");
|
||||
},
|
||||
fetch() {
|
||||
throw msg("fetch");
|
||||
},
|
||||
revalidate() {
|
||||
throw msg("revalidate");
|
||||
},
|
||||
createHref,
|
||||
encodeLocation,
|
||||
getFetcher() {
|
||||
return IDLE_FETCHER;
|
||||
},
|
||||
deleteFetcher() {
|
||||
throw msg("deleteFetcher");
|
||||
},
|
||||
dispose() {
|
||||
throw msg("dispose");
|
||||
},
|
||||
getBlocker() {
|
||||
return IDLE_BLOCKER;
|
||||
},
|
||||
deleteBlocker() {
|
||||
throw msg("deleteBlocker");
|
||||
},
|
||||
patchRoutes() {
|
||||
throw msg("patchRoutes");
|
||||
},
|
||||
_internalFetchControllers: new Map(),
|
||||
_internalActiveDeferreds: new Map(),
|
||||
_internalSetRoutes() {
|
||||
throw msg("_internalSetRoutes");
|
||||
}
|
||||
};
|
||||
}
|
||||
function createHref(to) {
|
||||
return typeof to === "string" ? to : createPath(to);
|
||||
}
|
||||
function encodeLocation(to) {
|
||||
let href = typeof to === "string" ? to : createPath(to);
|
||||
// Treating this as a full URL will strip any trailing spaces so we need to
|
||||
// pre-encode them since they might be part of a matching splat param from
|
||||
// an ancestor route
|
||||
href = href.replace(/ $/, "%20");
|
||||
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
||||
return {
|
||||
pathname: encoded.pathname,
|
||||
search: encoded.search,
|
||||
hash: encoded.hash
|
||||
};
|
||||
}
|
||||
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
||||
|
||||
// This utility is based on https://github.com/zertosh/htmlescape
|
||||
// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
|
||||
const ESCAPE_LOOKUP = {
|
||||
"&": "\\u0026",
|
||||
">": "\\u003e",
|
||||
"<": "\\u003c",
|
||||
"\u2028": "\\u2028",
|
||||
"\u2029": "\\u2029"
|
||||
};
|
||||
const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
||||
function htmlEscape(str) {
|
||||
return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
||||
}
|
||||
|
||||
export { StaticRouter, StaticRouterProvider, createStaticHandler, createStaticRouter };
|
1829
node_modules/react-router-dom/dist/umd/react-router-dom.development.js
generated
vendored
Normal file
1829
node_modules/react-router-dom/dist/umd/react-router-dom.development.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/react-router-dom/dist/umd/react-router-dom.development.js.map
generated
vendored
Normal file
1
node_modules/react-router-dom/dist/umd/react-router-dom.development.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/react-router-dom/dist/umd/react-router-dom.production.min.js
generated
vendored
Normal file
12
node_modules/react-router-dom/dist/umd/react-router-dom.production.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/react-router-dom/dist/umd/react-router-dom.production.min.js.map
generated
vendored
Normal file
1
node_modules/react-router-dom/dist/umd/react-router-dom.production.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue