react-router 7.0.0-pre.2 → 7.0.0-pre.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunk-FT3T2DDR.mjs +9617 -0
  3. package/dist/dom-export.d.mts +13 -0
  4. package/dist/dom-export.d.ts +13 -3
  5. package/dist/dom-export.js +5502 -0
  6. package/dist/dom-export.mjs +112 -126
  7. package/dist/{lib/dom/lib.d.ts → fog-of-war-BijhfqFM.d.ts} +699 -45
  8. package/dist/fog-of-war-Bz_EDtxF.d.mts +1595 -0
  9. package/dist/index.d.mts +839 -0
  10. package/dist/index.d.ts +839 -73
  11. package/dist/index.js +9763 -0
  12. package/dist/index.mjs +225 -12689
  13. package/dist/lib/types.d.mts +2 -0
  14. package/dist/lib/types.d.ts +2 -83
  15. package/dist/lib/types.js +28 -0
  16. package/dist/lib/types.mjs +1 -1
  17. package/dist/types-BlYP8xpH.d.mts +1620 -0
  18. package/dist/types-BlYP8xpH.d.ts +1620 -0
  19. package/package.json +52 -12
  20. package/dist/dom-export.mjs.map +0 -1
  21. package/dist/index.mjs.map +0 -1
  22. package/dist/lib/components.d.ts +0 -372
  23. package/dist/lib/context.d.ts +0 -115
  24. package/dist/lib/dom/dom.d.ts +0 -123
  25. package/dist/lib/dom/global.d.ts +0 -40
  26. package/dist/lib/dom/server.d.ts +0 -41
  27. package/dist/lib/dom/ssr/components.d.ts +0 -122
  28. package/dist/lib/dom/ssr/data.d.ts +0 -2
  29. package/dist/lib/dom/ssr/entry.d.ts +0 -48
  30. package/dist/lib/dom/ssr/errorBoundaries.d.ts +0 -36
  31. package/dist/lib/dom/ssr/errors.d.ts +0 -2
  32. package/dist/lib/dom/ssr/fallback.d.ts +0 -2
  33. package/dist/lib/dom/ssr/fog-of-war.d.ts +0 -28
  34. package/dist/lib/dom/ssr/invariant.d.ts +0 -2
  35. package/dist/lib/dom/ssr/links.d.ts +0 -25
  36. package/dist/lib/dom/ssr/markup.d.ts +0 -5
  37. package/dist/lib/dom/ssr/routeModules.d.ts +0 -183
  38. package/dist/lib/dom/ssr/routes-test-stub.d.ts +0 -59
  39. package/dist/lib/dom/ssr/routes.d.ts +0 -29
  40. package/dist/lib/dom/ssr/server.d.ts +0 -16
  41. package/dist/lib/dom/ssr/single-fetch.d.ts +0 -37
  42. package/dist/lib/dom-export/dom-router-provider.d.ts +0 -5
  43. package/dist/lib/dom-export/hydrated-router.d.ts +0 -5
  44. package/dist/lib/dom-export.d.ts +0 -3
  45. package/dist/lib/hooks.d.ts +0 -411
  46. package/dist/lib/router/history.d.ts +0 -253
  47. package/dist/lib/router/links.d.ts +0 -104
  48. package/dist/lib/router/router.d.ts +0 -544
  49. package/dist/lib/router/utils.d.ts +0 -497
  50. package/dist/lib/server-runtime/build.d.ts +0 -38
  51. package/dist/lib/server-runtime/cookies.d.ts +0 -62
  52. package/dist/lib/server-runtime/crypto.d.ts +0 -2
  53. package/dist/lib/server-runtime/data.d.ts +0 -11
  54. package/dist/lib/server-runtime/dev.d.ts +0 -8
  55. package/dist/lib/server-runtime/entry.d.ts +0 -3
  56. package/dist/lib/server-runtime/errors.d.ts +0 -51
  57. package/dist/lib/server-runtime/headers.d.ts +0 -3
  58. package/dist/lib/server-runtime/invariant.d.ts +0 -2
  59. package/dist/lib/server-runtime/markup.d.ts +0 -1
  60. package/dist/lib/server-runtime/mode.d.ts +0 -9
  61. package/dist/lib/server-runtime/routeMatching.d.ts +0 -8
  62. package/dist/lib/server-runtime/routeModules.d.ts +0 -40
  63. package/dist/lib/server-runtime/routes.d.ts +0 -11
  64. package/dist/lib/server-runtime/server.d.ts +0 -5
  65. package/dist/lib/server-runtime/serverHandoff.d.ts +0 -11
  66. package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +0 -19
  67. package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +0 -17
  68. package/dist/lib/server-runtime/sessions.d.ts +0 -140
  69. package/dist/lib/server-runtime/single-fetch.d.ts +0 -30
  70. package/dist/lib/server-runtime/typecheck.d.ts +0 -4
  71. package/dist/lib/server-runtime/warnings.d.ts +0 -1
  72. package/dist/main-dom-export.js +0 -19
  73. package/dist/main.js +0 -19
  74. package/dist/react-router-dom.development.js +0 -199
  75. package/dist/react-router-dom.development.js.map +0 -1
  76. package/dist/react-router-dom.production.min.js +0 -12
  77. package/dist/react-router-dom.production.min.js.map +0 -1
  78. package/dist/react-router.development.js +0 -12528
  79. package/dist/react-router.development.js.map +0 -1
  80. package/dist/react-router.production.min.js +0 -12
  81. package/dist/react-router.production.min.js.map +0 -1
  82. package/dist/umd/react-router-dom.development.js +0 -241
  83. package/dist/umd/react-router-dom.development.js.map +0 -1
  84. package/dist/umd/react-router-dom.production.min.js +0 -12
  85. package/dist/umd/react-router-dom.production.min.js.map +0 -1
  86. package/dist/umd/react-router.development.js +0 -12834
  87. package/dist/umd/react-router.development.js.map +0 -1
  88. package/dist/umd/react-router.production.min.js +0 -12
  89. package/dist/umd/react-router.production.min.js.map +0 -1
@@ -1 +0,0 @@
1
- export declare function escapeHtml(html: string): string;
@@ -1,9 +0,0 @@
1
- /**
2
- * The mode to use when running the server.
3
- */
4
- export declare enum ServerMode {
5
- Development = "development",
6
- Production = "production",
7
- Test = "test"
8
- }
9
- export declare function isServerMode(value: any): value is ServerMode;
@@ -1,8 +0,0 @@
1
- import type { Params } from "../router/utils";
2
- import type { ServerRoute } from "./routes";
3
- export interface RouteMatch<Route> {
4
- params: Params;
5
- pathname: string;
6
- route: Route;
7
- }
8
- export declare function matchServerRoutes(routes: ServerRoute[], pathname: string, basename?: string): RouteMatch<ServerRoute>[] | null;
@@ -1,40 +0,0 @@
1
- import type { ActionFunction, LoaderFunction } from "../router/utils";
2
- import type { ClientActionFunction, ClientLoaderFunction, LinksFunction, MetaFunction } from "../dom/ssr/routeModules";
3
- export interface RouteModules<RouteModule> {
4
- [routeId: string]: RouteModule | undefined;
5
- }
6
- export type HeadersArgs = {
7
- loaderHeaders: Headers;
8
- parentHeaders: Headers;
9
- actionHeaders: Headers;
10
- errorHeaders: Headers | undefined;
11
- };
12
- /**
13
- * A function that returns HTTP headers to be used for a route. These headers
14
- * will be merged with (and take precedence over) headers from parent routes.
15
- */
16
- export interface HeadersFunction {
17
- (args: HeadersArgs): Headers | HeadersInit;
18
- }
19
- /**
20
- * An arbitrary object that is associated with a route.
21
- */
22
- export type RouteHandle = unknown;
23
- export interface EntryRouteModule {
24
- clientAction?: ClientActionFunction;
25
- clientLoader?: ClientLoaderFunction;
26
- ErrorBoundary?: any;
27
- HydrateFallback?: any;
28
- Layout?: any;
29
- default: any;
30
- handle?: RouteHandle;
31
- links?: LinksFunction;
32
- meta?: MetaFunction;
33
- }
34
- export interface ServerRouteModule extends EntryRouteModule {
35
- action?: ActionFunction;
36
- headers?: HeadersFunction | {
37
- [name: string]: string;
38
- };
39
- loader?: LoaderFunction;
40
- }
@@ -1,11 +0,0 @@
1
- import type { AgnosticDataRouteObject, RouteManifest } from "../router/utils";
2
- import type { FutureConfig } from "../dom/ssr/entry";
3
- import type { Route } from "../dom/ssr/routes";
4
- import type { ServerRouteModule } from "./routeModules";
5
- export type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
6
- export interface ServerRoute extends Route {
7
- children: ServerRoute[];
8
- module: ServerRouteModule;
9
- }
10
- export declare function createRoutes(manifest: ServerRouteManifest, parentId?: string, routesByParentId?: Record<string, Omit<ServerRoute, "children">[]>): ServerRoute[];
11
- export declare function createStaticHandlerDataRoutes(manifest: ServerRouteManifest, future: FutureConfig, parentId?: string, routesByParentId?: Record<string, Omit<ServerRoute, "children">[]>): AgnosticDataRouteObject[];
@@ -1,5 +0,0 @@
1
- import type { AppLoadContext } from "./data";
2
- import type { ServerBuild } from "./build";
3
- export type RequestHandler = (request: Request, loadContext?: AppLoadContext) => Promise<Response>;
4
- export type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
5
- export declare const createRequestHandler: CreateRequestHandlerFunction;
@@ -1,11 +0,0 @@
1
- import type { HydrationState } from "../router/router";
2
- import type { FutureConfig } from "../dom/ssr/entry";
3
- type ValidateShape<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
4
- export declare function createServerHandoffString<T>(serverHandoff: {
5
- state?: ValidateShape<T, HydrationState>;
6
- criticalCss?: string;
7
- basename: string | undefined;
8
- future: FutureConfig;
9
- isSpaMode: boolean;
10
- }): string;
11
- export {};
@@ -1,19 +0,0 @@
1
- import type { SessionStorage, SessionIdStorageStrategy, SessionData } from "../sessions";
2
- interface CookieSessionStorageOptions {
3
- /**
4
- * The Cookie used to store the session data on the client, or options used
5
- * to automatically create one.
6
- */
7
- cookie?: SessionIdStorageStrategy["cookie"];
8
- }
9
- /**
10
- * Creates and returns a SessionStorage object that stores all session data
11
- * directly in the session cookie itself.
12
- *
13
- * This has the advantage that no database or other backend services are
14
- * needed, and can help to simplify some load-balanced scenarios. However, it
15
- * also has the limitation that serialized session data may not exceed the
16
- * browser's maximum cookie size. Trade-offs!
17
- */
18
- export declare function createCookieSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg }?: CookieSessionStorageOptions): SessionStorage<Data, FlashData>;
19
- export {};
@@ -1,17 +0,0 @@
1
- import type { SessionData, SessionStorage, SessionIdStorageStrategy } from "../sessions";
2
- interface MemorySessionStorageOptions {
3
- /**
4
- * The Cookie used to store the session id on the client, or options used
5
- * to automatically create one.
6
- */
7
- cookie?: SessionIdStorageStrategy["cookie"];
8
- }
9
- /**
10
- * Creates and returns a simple in-memory SessionStorage object, mostly useful
11
- * for testing and as a reference implementation.
12
- *
13
- * Note: This storage does not scale beyond a single process, so it is not
14
- * suitable for most production scenarios.
15
- */
16
- export declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({ cookie }?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
17
- export {};
@@ -1,140 +0,0 @@
1
- import type { ParseOptions, SerializeOptions } from "cookie";
2
- import type { Cookie, CookieOptions } from "./cookies";
3
- /**
4
- * An object of name/value pairs to be used in the session.
5
- */
6
- export interface SessionData {
7
- [name: string]: any;
8
- }
9
- /**
10
- * Session persists data across HTTP requests.
11
- *
12
- * @see https://remix.run/utils/sessions#session-api
13
- */
14
- export interface Session<Data = SessionData, FlashData = Data> {
15
- /**
16
- * A unique identifier for this session.
17
- *
18
- * Note: This will be the empty string for newly created sessions and
19
- * sessions that are not backed by a database (i.e. cookie-based sessions).
20
- */
21
- readonly id: string;
22
- /**
23
- * The raw data contained in this session.
24
- *
25
- * This is useful mostly for SessionStorage internally to access the raw
26
- * session data to persist.
27
- */
28
- readonly data: FlashSessionData<Data, FlashData>;
29
- /**
30
- * Returns `true` if the session has a value for the given `name`, `false`
31
- * otherwise.
32
- */
33
- has(name: (keyof Data | keyof FlashData) & string): boolean;
34
- /**
35
- * Returns the value for the given `name` in this session.
36
- */
37
- get<Key extends (keyof Data | keyof FlashData) & string>(name: Key): (Key extends keyof Data ? Data[Key] : undefined) | (Key extends keyof FlashData ? FlashData[Key] : undefined) | undefined;
38
- /**
39
- * Sets a value in the session for the given `name`.
40
- */
41
- set<Key extends keyof Data & string>(name: Key, value: Data[Key]): void;
42
- /**
43
- * Sets a value in the session that is only valid until the next `get()`.
44
- * This can be useful for temporary values, like error messages.
45
- */
46
- flash<Key extends keyof FlashData & string>(name: Key, value: FlashData[Key]): void;
47
- /**
48
- * Removes a value from the session.
49
- */
50
- unset(name: keyof Data & string): void;
51
- }
52
- export type FlashSessionData<Data, FlashData> = Partial<Data & {
53
- [Key in keyof FlashData as FlashDataKey<Key & string>]: FlashData[Key];
54
- }>;
55
- type FlashDataKey<Key extends string> = `__flash_${Key}__`;
56
- export type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?: Data, id?: string) => Session<Data, FlashData>;
57
- /**
58
- * Creates a new Session object.
59
- *
60
- * Note: This function is typically not invoked directly by application code.
61
- * Instead, use a `SessionStorage` object's `getSession` method.
62
- *
63
- * @see https://remix.run/utils/sessions#createsession
64
- */
65
- export declare const createSession: CreateSessionFunction;
66
- export type IsSessionFunction = (object: any) => object is Session;
67
- /**
68
- * Returns true if an object is a Remix session.
69
- *
70
- * @see https://remix.run/utils/sessions#issession
71
- */
72
- export declare const isSession: IsSessionFunction;
73
- /**
74
- * SessionStorage stores session data between HTTP requests and knows how to
75
- * parse and create cookies.
76
- *
77
- * A SessionStorage creates Session objects using a `Cookie` header as input.
78
- * Then, later it generates the `Set-Cookie` header to be used in the response.
79
- */
80
- export interface SessionStorage<Data = SessionData, FlashData = Data> {
81
- /**
82
- * Parses a Cookie header from a HTTP request and returns the associated
83
- * Session. If there is no session associated with the cookie, this will
84
- * return a new Session with no data.
85
- */
86
- getSession: (cookieHeader?: string | null, options?: ParseOptions) => Promise<Session<Data, FlashData>>;
87
- /**
88
- * Stores all data in the Session and returns the Set-Cookie header to be
89
- * used in the HTTP response.
90
- */
91
- commitSession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
92
- /**
93
- * Deletes all data associated with the Session and returns the Set-Cookie
94
- * header to be used in the HTTP response.
95
- */
96
- destroySession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
97
- }
98
- /**
99
- * SessionIdStorageStrategy is designed to allow anyone to easily build their
100
- * own SessionStorage using `createSessionStorage(strategy)`.
101
- *
102
- * This strategy describes a common scenario where the session id is stored in
103
- * a cookie but the actual session data is stored elsewhere, usually in a
104
- * database or on disk. A set of create, read, update, and delete operations
105
- * are provided for managing the session data.
106
- */
107
- export interface SessionIdStorageStrategy<Data = SessionData, FlashData = Data> {
108
- /**
109
- * The Cookie used to store the session id, or options used to automatically
110
- * create one.
111
- */
112
- cookie?: Cookie | (CookieOptions & {
113
- name?: string;
114
- });
115
- /**
116
- * Creates a new record with the given data and returns the session id.
117
- */
118
- createData: (data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<string>;
119
- /**
120
- * Returns data for a given session id, or `null` if there isn't any.
121
- */
122
- readData: (id: string) => Promise<FlashSessionData<Data, FlashData> | null>;
123
- /**
124
- * Updates data for the given session id.
125
- */
126
- updateData: (id: string, data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<void>;
127
- /**
128
- * Deletes data for a given session id from the data store.
129
- */
130
- deleteData: (id: string) => Promise<void>;
131
- }
132
- /**
133
- * Creates a SessionStorage object using a SessionIdStorageStrategy.
134
- *
135
- * Note: This is a low-level API that should only be used if none of the
136
- * existing session storage options meet your requirements.
137
- */
138
- export declare function createSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg, createData, readData, updateData, deleteData, }: SessionIdStorageStrategy<Data, FlashData>): SessionStorage<Data, FlashData>;
139
- export declare function warnOnceAboutSigningSessionCookie(cookie: Cookie): void;
140
- export {};
@@ -1,30 +0,0 @@
1
- import type { StaticHandler } from "../router/router";
2
- import type { DataStrategyFunction } from "../router/utils";
3
- import type { SingleFetchRedirectResult, SingleFetchResult, SingleFetchResults } from "../dom/ssr/single-fetch";
4
- import { SingleFetchRedirectSymbol } from "../dom/ssr/single-fetch";
5
- import type { AppLoadContext } from "./data";
6
- import { ServerMode } from "./mode";
7
- import type { ServerBuild } from "./build";
8
- export type { SingleFetchResult, SingleFetchResults };
9
- export { SingleFetchRedirectSymbol };
10
- export declare const SINGLE_FETCH_REDIRECT_STATUS = 202;
11
- export declare function getSingleFetchDataStrategy({ isActionDataRequest, loadRouteIds, }?: {
12
- isActionDataRequest?: boolean;
13
- loadRouteIds?: string[];
14
- }): DataStrategyFunction;
15
- export declare function singleFetchAction(build: ServerBuild, serverMode: ServerMode, staticHandler: StaticHandler, request: Request, handlerUrl: URL, loadContext: AppLoadContext, handleError: (err: unknown) => void): Promise<{
16
- result: SingleFetchResult;
17
- headers: Headers;
18
- status: number;
19
- }>;
20
- export declare function singleFetchLoaders(build: ServerBuild, serverMode: ServerMode, staticHandler: StaticHandler, request: Request, handlerUrl: URL, loadContext: AppLoadContext, handleError: (err: unknown) => void): Promise<{
21
- result: SingleFetchResults;
22
- headers: Headers;
23
- status: number;
24
- }>;
25
- export declare function getSingleFetchRedirect(status: number, headers: Headers, basename: string | undefined): SingleFetchRedirectResult;
26
- export type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
27
- [key: PropertyKey]: Serializable;
28
- } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
29
- export declare function data(value: Serializable, init?: number | ResponseInit): import("../router/utils").DataWithResponseInit<Serializable>;
30
- export declare function encodeViaTurboStream(data: any, requestSignal: AbortSignal, streamTimeout: number | undefined, serverMode: ServerMode): ReadableStream<Uint8Array>;
@@ -1,4 +0,0 @@
1
- export declare function expectType<T>(_expression: T): void;
2
- export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
3
- export type Expect<T extends true> = T;
4
- export type MutualExtends<A, B> = [A] extends [B] ? [B] extends [A] ? true : false : false;
@@ -1 +0,0 @@
1
- export declare function warnOnce(condition: boolean, message: string): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * React Router v7.0.0-pre.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- /* eslint-env node */
14
-
15
- if (process.env.NODE_ENV === "production") {
16
- module.exports = require("./umd/react-router-dom.production.min.js");
17
- } else {
18
- module.exports = require("./umd/react-router-dom.development.js");
19
- }
package/dist/main.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * React Router v7.0.0-pre.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- /* eslint-env node */
14
-
15
- if (process.env.NODE_ENV === "production") {
16
- module.exports = require("./umd/react-router.production.min.js");
17
- } else {
18
- module.exports = require("./umd/react-router.development.js");
19
- }
@@ -1,199 +0,0 @@
1
- /**
2
- * React Router v7.0.0-pre.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- import * as React from 'react';
12
- import * as ReactDOM from 'react-dom';
13
- import { UNSAFE_invariant, UNSAFE_useFogOFWarDiscovery, UNSAFE_FrameworkContext, UNSAFE_RemixErrorBoundary, UNSAFE_decodeViaTurboStream, UNSAFE_createClientRoutes, matchRoutes, UNSAFE_shouldHydrateRouteLoader, UNSAFE_deserializeErrors, UNSAFE_createRouter, UNSAFE_createBrowserHistory, UNSAFE_mapRouteProperties, UNSAFE_getSingleFetchDataStrategy, UNSAFE_getPatchRoutesOnNavigationFunction, UNSAFE_createClientRoutesWithHMRRevalidationOptOut, RouterProvider as RouterProvider$1 } from 'react-router';
14
-
15
- let ssrInfo = null;
16
- let router = null;
17
- function initSsrInfo() {
18
- if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
19
- ssrInfo = {
20
- context: window.__reactRouterContext,
21
- manifest: window.__reactRouterManifest,
22
- routeModules: window.__reactRouterRouteModules,
23
- stateDecodingPromise: undefined,
24
- router: undefined,
25
- routerInitialized: false
26
- };
27
- }
28
- }
29
- function createHydratedRouter() {
30
- initSsrInfo();
31
- if (!ssrInfo) {
32
- throw new Error("You must be using the SSR features of React Router in order to skip " + "passing a `router` prop to `<RouterProvider>`");
33
- }
34
-
35
- // We need to suspend until the initial state snapshot is decoded into
36
- // window.__reactRouterContext.state
37
-
38
- let localSsrInfo = ssrInfo;
39
- // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this
40
- // code potentially many times waiting for our state to arrive, but we'll
41
- // then only get past here and create the `router` one time
42
- if (!ssrInfo.stateDecodingPromise) {
43
- let stream = ssrInfo.context.stream;
44
- !stream ? UNSAFE_invariant(false, "No stream found for single fetch decoding") : void 0;
45
- ssrInfo.context.stream = undefined;
46
- ssrInfo.stateDecodingPromise = UNSAFE_decodeViaTurboStream(stream, window).then(value => {
47
- ssrInfo.context.state = value.value;
48
- localSsrInfo.stateDecodingPromise.value = true;
49
- }).catch(e => {
50
- localSsrInfo.stateDecodingPromise.error = e;
51
- });
52
- }
53
- if (ssrInfo.stateDecodingPromise.error) {
54
- throw ssrInfo.stateDecodingPromise.error;
55
- }
56
- if (!ssrInfo.stateDecodingPromise.value) {
57
- throw ssrInfo.stateDecodingPromise;
58
- }
59
- let routes = UNSAFE_createClientRoutes(ssrInfo.manifest.routes, ssrInfo.routeModules, ssrInfo.context.state, ssrInfo.context.isSpaMode);
60
- let hydrationData = undefined;
61
- if (!ssrInfo.context.isSpaMode) {
62
- // Create a shallow clone of `loaderData` we can mutate for partial hydration.
63
- // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will
64
- // render the fallback so we need the client to do the same for hydration.
65
- // The server loader data has already been exposed to these route `clientLoader`'s
66
- // in `createClientRoutes` above, so we need to clear out the version we pass to
67
- // `createBrowserRouter` so it initializes and runs the client loaders.
68
- hydrationData = {
69
- ...ssrInfo.context.state,
70
- loaderData: {
71
- ...ssrInfo.context.state.loaderData
72
- }
73
- };
74
- let initialMatches = matchRoutes(routes, window.location, window.__reactRouterContext?.basename);
75
- if (initialMatches) {
76
- for (let match of initialMatches) {
77
- let routeId = match.route.id;
78
- let route = ssrInfo.routeModules[routeId];
79
- let manifestRoute = ssrInfo.manifest.routes[routeId];
80
- // Clear out the loaderData to avoid rendering the route component when the
81
- // route opted into clientLoader hydration and either:
82
- // * gave us a HydrateFallback
83
- // * or doesn't have a server loader and we have no data to render
84
- if (route && manifestRoute && UNSAFE_shouldHydrateRouteLoader(manifestRoute, route, ssrInfo.context.isSpaMode) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
85
- delete hydrationData.loaderData[routeId];
86
- } else if (manifestRoute && !manifestRoute.hasLoader) {
87
- // Since every Remix route gets a `loader` on the client side to load
88
- // the route JS module, we need to add a `null` value to `loaderData`
89
- // for any routes that don't have server loaders so our partial
90
- // hydration logic doesn't kick off the route module loaders during
91
- // hydration
92
- hydrationData.loaderData[routeId] = null;
93
- }
94
- }
95
- }
96
- if (hydrationData && hydrationData.errors) {
97
- // TODO: De-dup this or remove entirely in v7 where single fetch is the
98
- // only approach and we have already serialized or deserialized on the server
99
- hydrationData.errors = UNSAFE_deserializeErrors(hydrationData.errors);
100
- }
101
- }
102
-
103
- // We don't use createBrowserRouter here because we need fine-grained control
104
- // over initialization to support synchronous `clientLoader` flows.
105
- let router = UNSAFE_createRouter({
106
- routes,
107
- history: UNSAFE_createBrowserHistory(),
108
- basename: ssrInfo.context.basename,
109
- hydrationData,
110
- mapRouteProperties: UNSAFE_mapRouteProperties,
111
- dataStrategy: UNSAFE_getSingleFetchDataStrategy(ssrInfo.manifest, ssrInfo.routeModules, () => router),
112
- patchRoutesOnNavigation: UNSAFE_getPatchRoutesOnNavigationFunction(ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode, ssrInfo.context.basename)
113
- });
114
- ssrInfo.router = router;
115
-
116
- // We can call initialize() immediately if the router doesn't have any
117
- // loaders to run on hydration
118
- if (router.state.initialized) {
119
- ssrInfo.routerInitialized = true;
120
- router.initialize();
121
- }
122
-
123
- // @ts-ignore
124
- router.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
125
- UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
126
- window.__reactRouterDataRouter = router;
127
- return router;
128
- }
129
-
130
- /**
131
- * @category Router Components
132
- */
133
- function HydratedRouter() {
134
- if (!router) {
135
- router = createHydratedRouter();
136
- }
137
-
138
- // Critical CSS can become stale after code changes, e.g. styles might be
139
- // removed from a component, but the styles will still be present in the
140
- // server HTML. This allows our HMR logic to clear the critical CSS state.
141
- let [criticalCss, setCriticalCss] = React.useState(ssrInfo?.context.criticalCss );
142
- {
143
- if (ssrInfo) {
144
- window.__reactRouterClearCriticalCss = () => setCriticalCss(undefined);
145
- }
146
- }
147
- let [location, setLocation] = React.useState(router.state.location);
148
- React.useLayoutEffect(() => {
149
- // If we had to run clientLoaders on hydration, we delay initialization until
150
- // after we've hydrated to avoid hydration issues from synchronous client loaders
151
- if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
152
- ssrInfo.routerInitialized = true;
153
- ssrInfo.router.initialize();
154
- }
155
- }, []);
156
- React.useLayoutEffect(() => {
157
- if (ssrInfo && ssrInfo.router) {
158
- return ssrInfo.router.subscribe(newState => {
159
- if (newState.location !== location) {
160
- setLocation(newState.location);
161
- }
162
- });
163
- }
164
- }, [location]);
165
- !ssrInfo ? UNSAFE_invariant(false, "ssrInfo unavailable for HydratedRouter") : void 0;
166
- UNSAFE_useFogOFWarDiscovery(router, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode);
167
-
168
- // We need to include a wrapper RemixErrorBoundary here in case the root error
169
- // boundary also throws and we need to bubble up outside of the router entirely.
170
- // Then we need a stateful location here so the user can back-button navigate
171
- // out of there
172
- return (
173
- /*#__PURE__*/
174
- // This fragment is important to ensure we match the <ServerRouter> JSX
175
- // structure so that useId values hydrate correctly
176
- React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_FrameworkContext.Provider, {
177
- value: {
178
- manifest: ssrInfo.manifest,
179
- routeModules: ssrInfo.routeModules,
180
- future: ssrInfo.context.future,
181
- criticalCss,
182
- isSpaMode: ssrInfo.context.isSpaMode
183
- }
184
- }, /*#__PURE__*/React.createElement(UNSAFE_RemixErrorBoundary, {
185
- location: location
186
- }, /*#__PURE__*/React.createElement(RouterProvider, {
187
- router: router
188
- }))), /*#__PURE__*/React.createElement(React.Fragment, null))
189
- );
190
- }
191
-
192
- function RouterProvider(props) {
193
- return /*#__PURE__*/React.createElement(RouterProvider$1, Object.assign({
194
- flushSync: ReactDOM.flushSync
195
- }, props));
196
- }
197
-
198
- export { HydratedRouter, RouterProvider };
199
- //# sourceMappingURL=react-router-dom.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-router-dom.development.js","sources":["../lib/dom-export/hydrated-router.tsx","../lib/dom-export/dom-router-provider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n UNSAFE_AssetsManifest as AssetsManifest,\n UNSAFE_RouteModules as RouteModules,\n DataRouter,\n HydrationState,\n} from \"react-router\";\nimport {\n UNSAFE_invariant as invariant,\n UNSAFE_FrameworkContext as FrameworkContext,\n UNSAFE_decodeViaTurboStream as decodeViaTurboStream,\n UNSAFE_RemixErrorBoundary as RemixErrorBoundary,\n UNSAFE_createBrowserHistory as createBrowserHistory,\n UNSAFE_createClientRoutes as createClientRoutes,\n UNSAFE_createRouter as createRouter,\n UNSAFE_deserializeErrors as deserializeErrors,\n UNSAFE_getSingleFetchDataStrategy as getSingleFetchDataStrategy,\n UNSAFE_getPatchRoutesOnNavigationFunction as getPatchRoutesOnNavigationFunction,\n UNSAFE_shouldHydrateRouteLoader as shouldHydrateRouteLoader,\n UNSAFE_useFogOFWarDiscovery as useFogOFWarDiscovery,\n UNSAFE_mapRouteProperties as mapRouteProperties,\n UNSAFE_createClientRoutesWithHMRRevalidationOptOut as createClientRoutesWithHMRRevalidationOptOut,\n matchRoutes,\n} from \"react-router\";\nimport { RouterProvider } from \"./dom-router-provider\";\n\ntype SSRInfo = {\n context: NonNullable<(typeof window)[\"__reactRouterContext\"]>;\n routeModules: RouteModules;\n manifest: AssetsManifest;\n stateDecodingPromise:\n | (Promise<void> & {\n value?: unknown;\n error?: unknown;\n })\n | undefined;\n router: DataRouter | undefined;\n routerInitialized: boolean;\n};\n\nlet ssrInfo: SSRInfo | null = null;\nlet router: DataRouter | null = null;\n\nfunction initSsrInfo(): void {\n if (\n !ssrInfo &&\n window.__reactRouterContext &&\n window.__reactRouterManifest &&\n window.__reactRouterRouteModules\n ) {\n ssrInfo = {\n context: window.__reactRouterContext,\n manifest: window.__reactRouterManifest,\n routeModules: window.__reactRouterRouteModules,\n stateDecodingPromise: undefined,\n router: undefined,\n routerInitialized: false,\n };\n }\n}\n\nfunction createHydratedRouter(): DataRouter {\n initSsrInfo();\n\n if (!ssrInfo) {\n throw new Error(\n \"You must be using the SSR features of React Router in order to skip \" +\n \"passing a `router` prop to `<RouterProvider>`\"\n );\n }\n\n // We need to suspend until the initial state snapshot is decoded into\n // window.__reactRouterContext.state\n\n let localSsrInfo = ssrInfo;\n // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this\n // code potentially many times waiting for our state to arrive, but we'll\n // then only get past here and create the `router` one time\n if (!ssrInfo.stateDecodingPromise) {\n let stream = ssrInfo.context.stream;\n invariant(stream, \"No stream found for single fetch decoding\");\n ssrInfo.context.stream = undefined;\n ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window)\n .then((value) => {\n ssrInfo!.context.state =\n value.value as typeof localSsrInfo.context.state;\n localSsrInfo.stateDecodingPromise!.value = true;\n })\n .catch((e) => {\n localSsrInfo.stateDecodingPromise!.error = e;\n });\n }\n if (ssrInfo.stateDecodingPromise.error) {\n throw ssrInfo.stateDecodingPromise.error;\n }\n if (!ssrInfo.stateDecodingPromise.value) {\n throw ssrInfo.stateDecodingPromise;\n }\n\n let routes = createClientRoutes(\n ssrInfo.manifest.routes,\n ssrInfo.routeModules,\n ssrInfo.context.state,\n ssrInfo.context.isSpaMode\n );\n\n let hydrationData: HydrationState | undefined = undefined;\n if (!ssrInfo.context.isSpaMode) {\n // Create a shallow clone of `loaderData` we can mutate for partial hydration.\n // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will\n // render the fallback so we need the client to do the same for hydration.\n // The server loader data has already been exposed to these route `clientLoader`'s\n // in `createClientRoutes` above, so we need to clear out the version we pass to\n // `createBrowserRouter` so it initializes and runs the client loaders.\n hydrationData = {\n ...ssrInfo.context.state,\n loaderData: { ...ssrInfo.context.state.loaderData },\n };\n let initialMatches = matchRoutes(\n routes,\n window.location,\n window.__reactRouterContext?.basename\n );\n if (initialMatches) {\n for (let match of initialMatches) {\n let routeId = match.route.id;\n let route = ssrInfo.routeModules[routeId];\n let manifestRoute = ssrInfo.manifest.routes[routeId];\n // Clear out the loaderData to avoid rendering the route component when the\n // route opted into clientLoader hydration and either:\n // * gave us a HydrateFallback\n // * or doesn't have a server loader and we have no data to render\n if (\n route &&\n manifestRoute &&\n shouldHydrateRouteLoader(\n manifestRoute,\n route,\n ssrInfo.context.isSpaMode\n ) &&\n (route.HydrateFallback || !manifestRoute.hasLoader)\n ) {\n delete hydrationData.loaderData![routeId];\n } else if (manifestRoute && !manifestRoute.hasLoader) {\n // Since every Remix route gets a `loader` on the client side to load\n // the route JS module, we need to add a `null` value to `loaderData`\n // for any routes that don't have server loaders so our partial\n // hydration logic doesn't kick off the route module loaders during\n // hydration\n hydrationData.loaderData![routeId] = null;\n }\n }\n }\n\n if (hydrationData && hydrationData.errors) {\n // TODO: De-dup this or remove entirely in v7 where single fetch is the\n // only approach and we have already serialized or deserialized on the server\n hydrationData.errors = deserializeErrors(hydrationData.errors);\n }\n }\n\n // We don't use createBrowserRouter here because we need fine-grained control\n // over initialization to support synchronous `clientLoader` flows.\n let router = createRouter({\n routes,\n history: createBrowserHistory(),\n basename: ssrInfo.context.basename,\n hydrationData,\n mapRouteProperties,\n dataStrategy: getSingleFetchDataStrategy(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n () => router\n ),\n patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode,\n ssrInfo.context.basename\n ),\n });\n ssrInfo.router = router;\n\n // We can call initialize() immediately if the router doesn't have any\n // loaders to run on hydration\n if (router.state.initialized) {\n ssrInfo.routerInitialized = true;\n router.initialize();\n }\n\n // @ts-ignore\n router.createRoutesForHMR =\n /* spacer so ts-ignore does not affect the right hand of the assignment */\n createClientRoutesWithHMRRevalidationOptOut;\n window.__reactRouterDataRouter = router;\n\n return router;\n}\n\n/**\n * @category Router Components\n */\nexport function HydratedRouter() {\n if (!router) {\n router = createHydratedRouter();\n }\n\n // Critical CSS can become stale after code changes, e.g. styles might be\n // removed from a component, but the styles will still be present in the\n // server HTML. This allows our HMR logic to clear the critical CSS state.\n let [criticalCss, setCriticalCss] = React.useState(\n process.env.NODE_ENV === \"development\"\n ? ssrInfo?.context.criticalCss\n : undefined\n );\n if (process.env.NODE_ENV === \"development\") {\n if (ssrInfo) {\n window.__reactRouterClearCriticalCss = () => setCriticalCss(undefined);\n }\n }\n\n let [location, setLocation] = React.useState(router.state.location);\n\n React.useLayoutEffect(() => {\n // If we had to run clientLoaders on hydration, we delay initialization until\n // after we've hydrated to avoid hydration issues from synchronous client loaders\n if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {\n ssrInfo.routerInitialized = true;\n ssrInfo.router.initialize();\n }\n }, []);\n\n React.useLayoutEffect(() => {\n if (ssrInfo && ssrInfo.router) {\n return ssrInfo.router.subscribe((newState) => {\n if (newState.location !== location) {\n setLocation(newState.location);\n }\n });\n }\n }, [location]);\n\n invariant(ssrInfo, \"ssrInfo unavailable for HydratedRouter\");\n\n useFogOFWarDiscovery(\n router,\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode\n );\n\n // We need to include a wrapper RemixErrorBoundary here in case the root error\n // boundary also throws and we need to bubble up outside of the router entirely.\n // Then we need a stateful location here so the user can back-button navigate\n // out of there\n return (\n // This fragment is important to ensure we match the <ServerRouter> JSX\n // structure so that useId values hydrate correctly\n <>\n <FrameworkContext.Provider\n value={{\n manifest: ssrInfo.manifest,\n routeModules: ssrInfo.routeModules,\n future: ssrInfo.context.future,\n criticalCss,\n isSpaMode: ssrInfo.context.isSpaMode,\n }}\n >\n <RemixErrorBoundary location={location}>\n <RouterProvider router={router} />\n </RemixErrorBoundary>\n </FrameworkContext.Provider>\n {/*\n This fragment is important to ensure we match the <ServerRouter> JSX\n structure so that useId values hydrate correctly\n */}\n <></>\n </>\n );\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport type { RouterProviderProps as BaseRouterProviderProps } from \"react-router\";\nimport { RouterProvider as BaseRouterProvider } from \"react-router\";\n\nexport { HydratedRouter } from \"./hydrated-router\";\n\nexport type RouterProviderProps = Omit<BaseRouterProviderProps, \"flushSync\">;\n\nexport function RouterProvider(props: Omit<RouterProviderProps, \"flushSync\">) {\n return <BaseRouterProvider flushSync={ReactDOM.flushSync} {...props} />;\n}\n"],"names":["ssrInfo","router","initSsrInfo","window","__reactRouterContext","__reactRouterManifest","__reactRouterRouteModules","context","manifest","routeModules","stateDecodingPromise","undefined","routerInitialized","createHydratedRouter","Error","localSsrInfo","stream","invariant","decodeViaTurboStream","then","value","state","catch","e","error","routes","createClientRoutes","isSpaMode","hydrationData","loaderData","initialMatches","matchRoutes","location","basename","match","routeId","route","id","manifestRoute","shouldHydrateRouteLoader","HydrateFallback","hasLoader","errors","deserializeErrors","createRouter","history","createBrowserHistory","mapRouteProperties","dataStrategy","getSingleFetchDataStrategy","patchRoutesOnNavigation","getPatchRoutesOnNavigationFunction","initialized","initialize","createRoutesForHMR","createClientRoutesWithHMRRevalidationOptOut","__reactRouterDataRouter","HydratedRouter","criticalCss","setCriticalCss","React","useState","__reactRouterClearCriticalCss","setLocation","useLayoutEffect","subscribe","newState","useFogOFWarDiscovery","createElement","Fragment","FrameworkContext","Provider","future","RemixErrorBoundary","RouterProvider","props","BaseRouterProvider","Object","assign","flushSync","ReactDOM"],"mappings":";;;;;;;;;;;;;;AAyCA,IAAIA,OAAuB,GAAG,IAAI,CAAA;AAClC,IAAIC,MAAyB,GAAG,IAAI,CAAA;AAEpC,SAASC,WAAWA,GAAS;AAC3B,EAAA,IACE,CAACF,OAAO,IACRG,MAAM,CAACC,oBAAoB,IAC3BD,MAAM,CAACE,qBAAqB,IAC5BF,MAAM,CAACG,yBAAyB,EAChC;AACAN,IAAAA,OAAO,GAAG;MACRO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AA6C,EAAE;EAC5E,oBAAOf,KAAA,CAAAQ,aAAA,CAACQ,gBAAkB,EAAAC,MAAA,CAAAC,MAAA,CAAA;IAAAC,SAAA,EAAYC,QAAQ,CAACD,SAAAA;GAAeJ,EAAAA,KAAK,CAAG,CAAC,CAAA;AACzE;;;;"}
@@ -1,12 +0,0 @@
1
- /**
2
- * React Router v7.0.0-pre.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- import*as e from"react";import*as t from"react-dom";import{UNSAFE_invariant as o,UNSAFE_useFogOFWarDiscovery as r,UNSAFE_FrameworkContext as a,UNSAFE_RemixErrorBoundary as i,UNSAFE_decodeViaTurboStream as n,UNSAFE_createClientRoutes as s,matchRoutes as u,UNSAFE_shouldHydrateRouteLoader as c,UNSAFE_deserializeErrors as d,UNSAFE_createRouter as l,UNSAFE_createBrowserHistory as m,UNSAFE_mapRouteProperties as f,UNSAFE_getSingleFetchDataStrategy as w,UNSAFE_getPatchRoutesOnNavigationFunction as x,UNSAFE_createClientRoutesWithHMRRevalidationOptOut as M,RouterProvider as R}from"react-router";let p=null,g=null;function _(){if(!p&&window.__reactRouterContext&&window.__reactRouterManifest&&window.__reactRouterRouteModules&&(p={context:window.__reactRouterContext,manifest:window.__reactRouterManifest,routeModules:window.__reactRouterRouteModules,stateDecodingPromise:void 0,router:void 0,routerInitialized:!1}),!p)throw new Error("You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`");let e=p;if(!p.stateDecodingPromise){let t=p.context.stream;t||o(!1),p.context.stream=void 0,p.stateDecodingPromise=n(t,window).then((t=>{p.context.state=t.value,e.stateDecodingPromise.value=!0})).catch((t=>{e.stateDecodingPromise.error=t}))}if(p.stateDecodingPromise.error)throw p.stateDecodingPromise.error;if(!p.stateDecodingPromise.value)throw p.stateDecodingPromise;let t,r=s(p.manifest.routes,p.routeModules,p.context.state,p.context.isSpaMode);if(!p.context.isSpaMode){t={...p.context.state,loaderData:{...p.context.state.loaderData}};let e=u(r,window.location,window.__reactRouterContext?.basename);if(e)for(let o of e){let e=o.route.id,r=p.routeModules[e],a=p.manifest.routes[e];r&&a&&c(a,r,p.context.isSpaMode)&&(r.HydrateFallback||!a.hasLoader)?delete t.loaderData[e]:a&&!a.hasLoader&&(t.loaderData[e]=null)}t&&t.errors&&(t.errors=d(t.errors))}let a=l({routes:r,history:m(),basename:p.context.basename,hydrationData:t,mapRouteProperties:f,dataStrategy:w(p.manifest,p.routeModules,(()=>a)),patchRoutesOnNavigation:x(p.manifest,p.routeModules,p.context.isSpaMode,p.context.basename)});return p.router=a,a.state.initialized&&(p.routerInitialized=!0,a.initialize()),a.createRoutesForHMR=M,window.__reactRouterDataRouter=a,a}function D(){g||(g=_());let[t,n]=e.useState(void 0),[s,u]=e.useState(g.state.location);return e.useLayoutEffect((()=>{p&&p.router&&!p.routerInitialized&&(p.routerInitialized=!0,p.router.initialize())}),[]),e.useLayoutEffect((()=>{if(p&&p.router)return p.router.subscribe((e=>{e.location!==s&&u(e.location)}))}),[s]),p||o(!1),r(g,p.manifest,p.routeModules,p.context.isSpaMode),e.createElement(e.Fragment,null,e.createElement(a.Provider,{value:{manifest:p.manifest,routeModules:p.routeModules,future:p.context.future,criticalCss:t,isSpaMode:p.context.isSpaMode}},e.createElement(i,{location:s},e.createElement(S,{router:g}))),e.createElement(e.Fragment,null))}function S(o){return e.createElement(R,Object.assign({flushSync:t.flushSync},o))}export{D as HydratedRouter,S as RouterProvider};
12
- //# sourceMappingURL=react-router-dom.production.min.js.map