react-router 8.2.0 → 8.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/development/dom-export.js +1 -1
  3. package/dist/development/index-react-server-client.js +1 -1
  4. package/dist/development/index-react-server.d.ts +114 -17
  5. package/dist/development/index-react-server.js +189 -54
  6. package/dist/development/index.js +1 -1
  7. package/dist/development/lib/actions.js +10 -5
  8. package/dist/development/lib/components.js +6 -3
  9. package/dist/development/lib/context.d.ts +1 -0
  10. package/dist/development/lib/context.js +1 -1
  11. package/dist/development/lib/dom/dom.d.ts +24 -24
  12. package/dist/development/lib/dom/dom.js +26 -26
  13. package/dist/development/lib/dom/lib.d.ts +2 -1
  14. package/dist/development/lib/dom/lib.js +23 -7
  15. package/dist/development/lib/dom/server.js +1 -1
  16. package/dist/development/lib/dom/ssr/components.js +2 -2
  17. package/dist/development/lib/dom/ssr/data.js +1 -1
  18. package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
  19. package/dist/development/lib/dom/ssr/fallback.js +1 -1
  20. package/dist/development/lib/dom/ssr/fog-of-war.js +27 -21
  21. package/dist/development/lib/dom/ssr/hydration.js +1 -1
  22. package/dist/development/lib/dom/ssr/invariant.js +1 -1
  23. package/dist/development/lib/dom/ssr/links.js +1 -1
  24. package/dist/development/lib/dom/ssr/markup.js +1 -1
  25. package/dist/development/lib/dom/ssr/routeModules.js +1 -1
  26. package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +13 -0
  27. package/dist/development/lib/dom/ssr/routes-test-stub.js +14 -1
  28. package/dist/development/lib/dom/ssr/routes.js +1 -1
  29. package/dist/development/lib/dom/ssr/server.js +1 -1
  30. package/dist/development/lib/dom/ssr/single-fetch.js +5 -5
  31. package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
  32. package/dist/development/lib/dom-export/hydrated-router.js +1 -1
  33. package/dist/development/lib/errors.js +1 -1
  34. package/dist/development/lib/hooks.js +6 -3
  35. package/dist/development/lib/href.d.ts +24 -8
  36. package/dist/development/lib/href.js +28 -11
  37. package/dist/development/lib/router/history.d.ts +6 -0
  38. package/dist/development/lib/router/history.js +8 -2
  39. package/dist/development/lib/router/instrumentation.js +1 -1
  40. package/dist/development/lib/router/navigation.js +45 -0
  41. package/dist/development/lib/router/router.d.ts +8 -0
  42. package/dist/development/lib/router/router.js +31 -17
  43. package/dist/development/lib/router/url.js +1 -1
  44. package/dist/development/lib/router/utils.d.ts +12 -0
  45. package/dist/development/lib/router/utils.js +66 -8
  46. package/dist/development/lib/rsc/browser.js +37 -24
  47. package/dist/development/lib/rsc/errorBoundaries.js +1 -1
  48. package/dist/development/lib/rsc/html-stream/browser.js +1 -1
  49. package/dist/development/lib/rsc/html-stream/server.js +30 -11
  50. package/dist/development/lib/rsc/route-modules.js +1 -1
  51. package/dist/development/lib/rsc/server.rsc.d.ts +5 -1
  52. package/dist/development/lib/rsc/server.ssr.d.ts +29 -6
  53. package/dist/development/lib/rsc/server.ssr.js +28 -13
  54. package/dist/development/lib/server-runtime/cookies.d.ts +28 -2
  55. package/dist/development/lib/server-runtime/cookies.js +18 -4
  56. package/dist/development/lib/server-runtime/crypto.js +2 -2
  57. package/dist/development/lib/server-runtime/data.js +1 -1
  58. package/dist/development/lib/server-runtime/dev.js +2 -2
  59. package/dist/development/lib/server-runtime/entry.js +1 -1
  60. package/dist/development/lib/server-runtime/errors.js +1 -1
  61. package/dist/development/lib/server-runtime/headers.js +1 -1
  62. package/dist/development/lib/server-runtime/invariant.js +1 -1
  63. package/dist/development/lib/server-runtime/mode.js +1 -1
  64. package/dist/development/lib/server-runtime/routeMatching.js +1 -1
  65. package/dist/development/lib/server-runtime/routes.js +1 -1
  66. package/dist/development/lib/server-runtime/server.d.ts +12 -0
  67. package/dist/development/lib/server-runtime/server.js +14 -2
  68. package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
  69. package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +8 -0
  70. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +9 -1
  71. package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +10 -4
  72. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +12 -6
  73. package/dist/development/lib/server-runtime/sessions.d.ts +31 -2
  74. package/dist/development/lib/server-runtime/sessions.js +20 -3
  75. package/dist/development/lib/server-runtime/single-fetch.js +2 -2
  76. package/dist/development/lib/server-runtime/urls.js +1 -1
  77. package/dist/development/lib/server-runtime/warnings.js +1 -1
  78. package/dist/development/lib/types/internal.js +1 -1
  79. package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
  80. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +4 -4
  81. package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
  82. package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
  83. package/dist/production/dom-export.js +1 -1
  84. package/dist/production/index-react-server-client.js +1 -1
  85. package/dist/production/index-react-server.d.ts +114 -17
  86. package/dist/production/index-react-server.js +189 -54
  87. package/dist/production/index.js +1 -1
  88. package/dist/production/lib/actions.js +10 -5
  89. package/dist/production/lib/components.js +6 -3
  90. package/dist/production/lib/context.d.ts +1 -0
  91. package/dist/production/lib/context.js +1 -1
  92. package/dist/production/lib/dom/dom.d.ts +24 -24
  93. package/dist/production/lib/dom/dom.js +26 -26
  94. package/dist/production/lib/dom/lib.d.ts +2 -1
  95. package/dist/production/lib/dom/lib.js +23 -7
  96. package/dist/production/lib/dom/server.js +1 -1
  97. package/dist/production/lib/dom/ssr/components.js +2 -2
  98. package/dist/production/lib/dom/ssr/data.js +1 -1
  99. package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
  100. package/dist/production/lib/dom/ssr/fallback.js +1 -1
  101. package/dist/production/lib/dom/ssr/fog-of-war.js +27 -21
  102. package/dist/production/lib/dom/ssr/hydration.js +1 -1
  103. package/dist/production/lib/dom/ssr/invariant.js +1 -1
  104. package/dist/production/lib/dom/ssr/links.js +1 -1
  105. package/dist/production/lib/dom/ssr/markup.js +1 -1
  106. package/dist/production/lib/dom/ssr/routeModules.js +1 -1
  107. package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +13 -0
  108. package/dist/production/lib/dom/ssr/routes-test-stub.js +14 -1
  109. package/dist/production/lib/dom/ssr/routes.js +1 -1
  110. package/dist/production/lib/dom/ssr/server.js +1 -1
  111. package/dist/production/lib/dom/ssr/single-fetch.js +5 -5
  112. package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
  113. package/dist/production/lib/dom-export/hydrated-router.js +1 -1
  114. package/dist/production/lib/errors.js +1 -1
  115. package/dist/production/lib/hooks.js +6 -3
  116. package/dist/production/lib/href.d.ts +24 -8
  117. package/dist/production/lib/href.js +28 -11
  118. package/dist/production/lib/router/history.d.ts +6 -0
  119. package/dist/production/lib/router/history.js +8 -2
  120. package/dist/production/lib/router/instrumentation.js +1 -1
  121. package/dist/production/lib/router/navigation.js +45 -0
  122. package/dist/production/lib/router/router.d.ts +8 -0
  123. package/dist/production/lib/router/router.js +31 -17
  124. package/dist/production/lib/router/url.js +1 -1
  125. package/dist/production/lib/router/utils.d.ts +12 -0
  126. package/dist/production/lib/router/utils.js +66 -8
  127. package/dist/production/lib/rsc/browser.js +37 -24
  128. package/dist/production/lib/rsc/errorBoundaries.js +1 -1
  129. package/dist/production/lib/rsc/html-stream/browser.js +1 -1
  130. package/dist/production/lib/rsc/html-stream/server.js +30 -11
  131. package/dist/production/lib/rsc/route-modules.js +1 -1
  132. package/dist/production/lib/rsc/server.rsc.d.ts +5 -1
  133. package/dist/production/lib/rsc/server.ssr.d.ts +29 -6
  134. package/dist/production/lib/rsc/server.ssr.js +28 -13
  135. package/dist/production/lib/server-runtime/cookies.d.ts +28 -2
  136. package/dist/production/lib/server-runtime/cookies.js +18 -4
  137. package/dist/production/lib/server-runtime/crypto.js +2 -2
  138. package/dist/production/lib/server-runtime/data.js +1 -1
  139. package/dist/production/lib/server-runtime/dev.js +2 -2
  140. package/dist/production/lib/server-runtime/entry.js +1 -1
  141. package/dist/production/lib/server-runtime/errors.js +1 -1
  142. package/dist/production/lib/server-runtime/headers.js +1 -1
  143. package/dist/production/lib/server-runtime/invariant.js +1 -1
  144. package/dist/production/lib/server-runtime/mode.js +1 -1
  145. package/dist/production/lib/server-runtime/routeMatching.js +1 -1
  146. package/dist/production/lib/server-runtime/routes.js +1 -1
  147. package/dist/production/lib/server-runtime/server.d.ts +12 -0
  148. package/dist/production/lib/server-runtime/server.js +14 -2
  149. package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
  150. package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +8 -0
  151. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +9 -1
  152. package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +10 -4
  153. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +12 -6
  154. package/dist/production/lib/server-runtime/sessions.d.ts +31 -2
  155. package/dist/production/lib/server-runtime/sessions.js +20 -3
  156. package/dist/production/lib/server-runtime/single-fetch.js +2 -2
  157. package/dist/production/lib/server-runtime/urls.js +1 -1
  158. package/dist/production/lib/server-runtime/warnings.js +1 -1
  159. package/dist/production/lib/types/internal.js +1 -1
  160. package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
  161. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +4 -4
  162. package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
  163. package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
  164. package/docs/explanation/sessions-and-cookies.md +13 -13
  165. package/docs/explanation/state-management.md +2 -2
  166. package/docs/how-to/presets.md +2 -2
  167. package/docs/how-to/react-server-components.md +53 -1
  168. package/docs/how-to/security.md +8 -1
  169. package/docs/how-to/server-bundles.md +2 -2
  170. package/docs/start/data/route-object.md +2 -2
  171. package/docs/start/data/routing.md +1 -1
  172. package/docs/start/framework/pending-ui.md +1 -1
  173. package/docs/start/framework/route-module.md +8 -8
  174. package/docs/start/framework/routing.md +1 -1
  175. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # `react-router`
2
2
 
3
+ ## v8.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `Expected fetcher: <key>` error thrown on navigation when a fetcher is aborted during its post-action revalidation ([#15365](https://github.com/remix-run/react-router/pull/15365))
8
+ - Fix lazy route discovery caching a path as discovered when the triggering navigation was aborted after the manifest response settled but before the route tree was patched, which permanently (for the session) shadowed the real route behind a catch-all or produced 404s on every subsequent visit ([#15399](https://github.com/remix-run/react-router/pull/15399))
9
+ - Improve route matching performance for long paths ([#15417](https://github.com/remix-run/react-router/pull/15417))
10
+ - Improve validation of action request origins ([#15419](https://github.com/remix-run/react-router/pull/15419))
11
+ - Fix `<ScrollRestoration>` leaving `history.scrollRestoration` set to `"auto"` after a bfcache restore, which let the browser restore scroll on subsequent history traversals before the destination route had rendered ([#15397](https://github.com/remix-run/react-router/pull/15397))
12
+ - Properly respect the `relative` option in `useSubmit`/`fetcher.submit` when resolivng the `action` path ([#15400](https://github.com/remix-run/react-router/pull/15400))
13
+ - Add additional URL validation on client side navigations/redirects ([#15445](https://github.com/remix-run/react-router/pull/15445))
14
+
15
+ ## v8.3.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Encode path params in `href`/`generatePath` per RFC 3986 path-segment rules instead of `encodeURIComponent` ([#15310](https://github.com/remix-run/react-router/pull/15310))
20
+ - Characters that are valid literally in a path segment (`$ & + , ; = : @` — RFC 3986 `pchar`) are no longer percent-encoded, so values like a semver build `1.0.0+1` interpolate unchanged instead of becoming `1.0.0%2B1`
21
+ - Structural/unsafe characters (`/ ? # %`, whitespace, non-ASCII) are still escaped exactly as before
22
+ - Use `crypto.randomUUID()` for `createMemorySessionStorage` session ids ([#15302](https://github.com/remix-run/react-router/pull/15302))
23
+ - `createMemorySessionStorage` is only intended for local development and testing - sessions are lost when the server restarts
24
+ - Fix `NavLink` not applying its `pending` state when `to` has a trailing slash ([#15300](https://github.com/remix-run/react-router/pull/15300))
25
+ - Preserve RSC route component metadata so routes with a `clientLoader` can skip unnecessary server requests once their components have rendered while still fetching missing server-rendered elements ([#15323](https://github.com/remix-run/react-router/pull/15323))
26
+ - Harden RSC CSRF code paths ([#15311](https://github.com/remix-run/react-router/pull/15311))
27
+ - Fix server crash (`TypeError: Invalid state: Unable to enqueue`) when a request is aborted while the RSC HTML stream has a pending flush ([#15286](https://github.com/remix-run/react-router/pull/15286))
28
+ - Handle cancellation of the `injectRSCPayload` readable side, clear the pending flush, and cancel the underlying RSC payload stream
29
+
30
+ ### Unstable Changes
31
+
32
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
33
+
34
+ - Detect stale RSC clients during lazy route discovery and reload the destination document ([#15318](https://github.com/remix-run/react-router/pull/15318))
35
+
36
+ #### Migration
37
+
38
+ Apps using the default RSC Framework entry do not need to make any changes. Apps with a custom `entry.rsc.tsx` should import the generated client version and pass it to `unstable_matchRSCServerRequest`:
39
+
40
+ ```tsx
41
+ import clientVersion from "virtual:react-router/unstable_rsc/client-version";
42
+
43
+ return unstable_matchRSCServerRequest({
44
+ // ...
45
+ clientVersion,
46
+ });
47
+ ```
48
+
49
+ - Add CSP nonce support to RSC document rendering ([#15320](https://github.com/remix-run/react-router/pull/15320))
50
+ - Add `nonce` options to `unstable_routeRSCServerRequest` and `unstable_RSCStaticRouter`
51
+ - Forward the nonce to the HTML renderer and apply it to injected RSC payload scripts and nonce-aware framework components
52
+
53
+ To adopt nonce-based CSP, update your `entry.ssr.tsx` (run `react-router reveal entry.ssr` first in RSC Framework Mode) to generate a fresh nonce for each request. Pass it to `routeRSCServerRequest`, spread the `renderHTML` options into React's HTML renderer, pass `options.nonce` to `RSCStaticRouter`, and use the same nonce in the `Content-Security-Policy` response header:
54
+
55
+ ```tsx
56
+ const nonce = crypto.randomUUID();
57
+ const response = await routeRSCServerRequest({
58
+ request,
59
+ serverResponse,
60
+ createFromReadableStream,
61
+ nonce,
62
+ async renderHTML(getPayload, options) {
63
+ const payload = getPayload();
64
+ return renderHTMLToReadableStream(
65
+ <RSCStaticRouter getPayload={getPayload} nonce={options.nonce} />,
66
+ {
67
+ ...options,
68
+ bootstrapScriptContent,
69
+ formState: await payload.formState,
70
+ signal: request.signal,
71
+ },
72
+ );
73
+ },
74
+ });
75
+ response.headers.set(
76
+ "Content-Security-Policy",
77
+ `script-src 'self' 'nonce-${nonce}'`,
78
+ );
79
+ ```
80
+
3
81
  ## v8.2.0
4
82
 
5
83
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.2.0
2
+ * react-router v8.3.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.2.0
2
+ * react-router v8.3.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1231,6 +1231,14 @@ interface Router$1 {
1231
1231
  * @param location
1232
1232
  */
1233
1233
  createHref(location: Location | URL): string;
1234
+ /**
1235
+ * @private
1236
+ * PRIVATE - DO NOT USE
1237
+ *
1238
+ * Utility function to create a URL for the given location
1239
+ * @param location
1240
+ */
1241
+ createURL?(to: To): URL;
1234
1242
  /**
1235
1243
  * @private
1236
1244
  * PRIVATE - DO NOT USE
@@ -2318,13 +2326,13 @@ type RSCRenderPayload = {
2318
2326
  type: "render";
2319
2327
  actionData: Record<string, any> | null;
2320
2328
  basename: string | undefined;
2329
+ clientVersion?: string;
2321
2330
  errors: Record<string, any> | null;
2322
2331
  loaderData: Record<string, any>;
2323
2332
  location: Location;
2324
2333
  routeDiscovery: RouteDiscovery;
2325
2334
  matches: RSCRouteMatch[];
2326
2335
  patches?: Promise<RSCRouteManifest[]>;
2327
- nonce?: string;
2328
2336
  formState?: ReactFormState;
2329
2337
  };
2330
2338
  type RSCManifestPayload = {
@@ -2421,6 +2429,8 @@ type RouteDiscovery = {
2421
2429
  * encoding the {@link unstable_RSCPayload}.
2422
2430
  * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
2423
2431
  * `loadServerAction` function, used to load a server action by ID.
2432
+ * @param opts.clientVersion A version derived from the client build output used
2433
+ * to detect stale clients during lazy route discovery.
2424
2434
  * @param opts.onError An optional error handler that will be called with any
2425
2435
  * errors that occur during the request processing.
2426
2436
  * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
@@ -2444,6 +2454,7 @@ declare function matchRSCServerRequest({
2444
2454
  loadServerAction,
2445
2455
  decodeAction,
2446
2456
  decodeFormState,
2457
+ clientVersion,
2447
2458
  onError,
2448
2459
  request,
2449
2460
  routes,
@@ -2457,6 +2468,7 @@ declare function matchRSCServerRequest({
2457
2468
  decodeFormState?: DecodeFormStateFunction;
2458
2469
  requestContext?: RouterContextProvider;
2459
2470
  loadServerAction?: LoadServerActionFunction;
2471
+ clientVersion?: string;
2460
2472
  onError?: (error: unknown) => void;
2461
2473
  request: Request;
2462
2474
  routes: RSCRouteConfigEntry[];
@@ -2490,14 +2502,30 @@ type Pages = Register extends {
2490
2502
  type Args = { [K in keyof Pages]: ToArgs<Pages[K]["params"]> };
2491
2503
  type ToArgs<Params extends Record<string, string | undefined>> = Equal<Params, {}> extends true ? [] : Partial<Params> extends Params ? [Params] | [] : [Params];
2492
2504
  /**
2493
- Returns a resolved URL path for the specified route.
2494
-
2495
- ```tsx
2496
- const h = href("/:lang?/about", { lang: "en" })
2497
- // -> `/en/about`
2498
-
2499
- <Link to={href("/products/:id", { id: "abc123" })} />
2500
- ```
2505
+ * Returns a resolved URL path for the specified route.
2506
+ *
2507
+ * Param values are percent-encoded for use in a path segment: characters that
2508
+ * would change the URL structure (`/`, `?`, `#`, `%`, whitespace, non-ASCII)
2509
+ * are escaped, while characters that RFC 3986 allows literally in a path
2510
+ * segment (`$ & + , ; = : @`) are kept as-is. Note this differs from query-string
2511
+ * encoding (`encodeURIComponent`/`URLSearchParams`), where those characters are
2512
+ * delimiters and must be escaped. Splat (`*`) values are encoded per segment,
2513
+ * preserving `/` separators.
2514
+ *
2515
+ * See [RFC 3986 §3.3](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3)
2516
+ *
2517
+ * @example
2518
+ * const h = href("/:lang?/about", { lang: "en" })
2519
+ * // -> `/en/about`
2520
+ *
2521
+ * <Link to={href("/products/:id", { id: "abc123" })} />
2522
+ *
2523
+ * @public
2524
+ * @category Utils
2525
+ * @mode framework
2526
+ * @param path The route path to resolve
2527
+ * @param args The route params to use when resolving the path
2528
+ * @returns The resolved URL path
2501
2529
  */
2502
2530
  declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
2503
2531
  //#endregion
@@ -2553,13 +2581,39 @@ interface Cookie {
2553
2581
  }
2554
2582
  /**
2555
2583
  * Creates a logical container for managing a browser cookie from the server.
2584
+ *
2585
+ * @public
2586
+ * @category Utils
2587
+ * @mode framework
2588
+ * @mode data
2589
+ * @param name The name of the cookie.
2590
+ * @param cookieOptions Options for parsing and serializing the cookie.
2591
+ * @returns A {@link Cookie} object for parsing and serializing the cookie.
2556
2592
  */
2557
2593
  declare const createCookie: (name: string, cookieOptions?: CookieOptions) => Cookie;
2594
+ /**
2595
+ * A function that determines whether a value is a React Router {@link Cookie}
2596
+ * object.
2597
+ *
2598
+ * @public
2599
+ * @category Utils
2600
+ * @mode framework
2601
+ * @mode data
2602
+ * @param object The value to check.
2603
+ * @returns `true` if the value is a React Router {@link Cookie} object;
2604
+ * otherwise, `false`.
2605
+ */
2558
2606
  type IsCookieFunction = (object: any) => object is Cookie;
2559
2607
  /**
2560
- * Returns true if an object is a Remix cookie container.
2608
+ * Returns `true` if a value is a React Router {@link Cookie} object.
2561
2609
  *
2562
- * @see https://remix.run/utils/cookies#iscookie
2610
+ * @public
2611
+ * @category Utils
2612
+ * @mode framework
2613
+ * @mode data
2614
+ * @param object The value to check.
2615
+ * @returns `true` if the value is a React Router {@link Cookie} object;
2616
+ * otherwise, `false`.
2563
2617
  */
2564
2618
  declare const isCookie: IsCookieFunction;
2565
2619
  //#endregion
@@ -2621,13 +2675,37 @@ type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?
2621
2675
  *
2622
2676
  * Note: This function is typically not invoked directly by application code.
2623
2677
  * Instead, use a `SessionStorage` object's `getSession` method.
2678
+ *
2679
+ * @category Utils
2680
+ * @param initialData The initial data for the session.
2681
+ * @param id The identifier for the session. Defaults to an empty string for a
2682
+ * new session.
2683
+ * @returns A new {@link Session} object.
2624
2684
  */
2625
2685
  declare const createSession: CreateSessionFunction;
2686
+ /**
2687
+ * A function that determines whether a value is a React Router {@link Session}
2688
+ * object.
2689
+ *
2690
+ * @public
2691
+ * @category Utils
2692
+ * @mode framework
2693
+ * @mode data
2694
+ * @param object The value to check.
2695
+ * @returns `true` if the value is a React Router {@link Session} object;
2696
+ * otherwise, `false`.
2697
+ */
2626
2698
  type IsSessionFunction = (object: any) => object is Session;
2627
2699
  /**
2628
- * Returns true if an object is a React Router session.
2700
+ * Returns `true` if a value is a React Router {@link Session} object.
2629
2701
  *
2630
- * @see https://reactrouter.com/api/utils/isSession
2702
+ * @public
2703
+ * @category Utils
2704
+ * @mode framework
2705
+ * @mode data
2706
+ * @param object The value to check.
2707
+ * @returns `true` if the value is a React Router {@link Session} object;
2708
+ * otherwise, `false`.
2631
2709
  */
2632
2710
  declare const isSession: IsSessionFunction;
2633
2711
  /**
@@ -2694,6 +2772,11 @@ interface SessionIdStorageStrategy<Data = SessionData, FlashData = Data> {
2694
2772
  *
2695
2773
  * Note: This is a low-level API that should only be used if none of the
2696
2774
  * existing session storage options meet your requirements.
2775
+ *
2776
+ * @category Utils
2777
+ * @param strategy The strategy used to store session identifiers and data.
2778
+ * @returns A {@link SessionStorage} object that persists session data using the
2779
+ * provided strategy.
2697
2780
  */
2698
2781
  declare function createSessionStorage<Data = SessionData, FlashData = Data>({
2699
2782
  cookie: cookieArg,
@@ -2719,6 +2802,14 @@ interface CookieSessionStorageOptions {
2719
2802
  * needed, and can help to simplify some load-balanced scenarios. However, it
2720
2803
  * also has the limitation that serialized session data may not exceed the
2721
2804
  * browser's maximum cookie size. Trade-offs!
2805
+ *
2806
+ * @public
2807
+ * @category Utils
2808
+ * @mode framework
2809
+ * @mode data
2810
+ * @param options Options for creating the cookie-backed session storage.
2811
+ * @returns A {@link SessionStorage} object that stores all session data in its
2812
+ * cookie.
2722
2813
  */
2723
2814
  declare function createCookieSessionStorage<Data = SessionData, FlashData = Data>({
2724
2815
  cookie: cookieArg
@@ -2733,11 +2824,17 @@ interface MemorySessionStorageOptions {
2733
2824
  cookie?: SessionIdStorageStrategy["cookie"];
2734
2825
  }
2735
2826
  /**
2736
- * Creates and returns a simple in-memory SessionStorage object, mostly useful
2737
- * for testing and as a reference implementation.
2827
+ * Creates and returns a simple in-memory SessionStorage object.
2738
2828
  *
2739
- * Note: This storage does not scale beyond a single process, so it is not
2740
- * suitable for most production scenarios.
2829
+ * Intended for local development and testing. It does not scale beyond a single
2830
+ * process, and all session data is lost when the server process stops/restarts.
2831
+ *
2832
+ * @public
2833
+ * @category Utils
2834
+ * @mode framework
2835
+ * @mode data
2836
+ * @param options Options for creating the in-memory session storage.
2837
+ * @returns A {@link SessionStorage} object that stores session data in memory.
2741
2838
  */
2742
2839
  declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({
2743
2840
  cookie