react-router 7.9.6 → 7.10.0-pre.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 (68) hide show
  1. package/CHANGELOG.md +75 -10
  2. package/dist/development/{browser-BbBXFHbO.d.ts → browser-BpxEZgZC.d.ts} +1 -1
  3. package/dist/development/{browser-C07r42Tt.d.mts → browser-C5z6FZmz.d.mts} +1 -1
  4. package/dist/development/{chunk-4WY6JWTD.mjs → chunk-GIMUO62I.mjs} +208 -221
  5. package/dist/development/{chunk-AMVS5XVJ.js → chunk-KQLPIZ7E.js} +201 -258
  6. package/dist/development/{chunk-PZWDWJAY.js → chunk-RHWHYDYZ.js} +7 -7
  7. package/dist/development/{chunk-G3INQAYP.mjs → chunk-V5RTLP6E.mjs} +15 -5
  8. package/dist/development/{chunk-O4JVZSOY.js → chunk-XHWAND4X.js} +167 -123
  9. package/dist/development/dom-export.d.mts +29 -10
  10. package/dist/development/dom-export.d.ts +29 -10
  11. package/dist/development/dom-export.js +158 -103
  12. package/dist/development/dom-export.mjs +133 -79
  13. package/dist/{production/index-react-server-client-Da3kmxNd.d.ts → development/index-react-server-client-CCjKYJTH.d.ts} +75 -180
  14. package/dist/development/{index-react-server-client-rcoGPJhU.d.mts → index-react-server-client-CipGfVBI.d.mts} +75 -180
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +19 -4
  20. package/dist/development/index-react-server.d.ts +19 -4
  21. package/dist/development/index-react-server.js +30 -24
  22. package/dist/development/index-react-server.mjs +30 -24
  23. package/dist/development/index.d.mts +19 -15
  24. package/dist/development/index.d.ts +19 -15
  25. package/dist/development/index.js +92 -82
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/{production/instrumentation-Unc20tLk.d.ts → development/instrumentation-BB0wRuqz.d.ts} +93 -11
  28. package/dist/development/lib/types/internal.d.mts +2 -2
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-QkB3HGjm.d.mts → register-C1RwVJAt.d.mts} +1 -1
  33. package/dist/development/{register-BpU9rFBJ.d.ts → register-ODDAAYlf.d.ts} +1 -1
  34. package/dist/development/{router-CAvh_Drx.d.mts → router-CwNp5l9u.d.mts} +93 -11
  35. package/dist/production/{browser-BbBXFHbO.d.ts → browser-BpxEZgZC.d.ts} +1 -1
  36. package/dist/production/{browser-C07r42Tt.d.mts → browser-C5z6FZmz.d.mts} +1 -1
  37. package/dist/production/{chunk-QN64DHI4.js → chunk-3MVZKESN.js} +167 -123
  38. package/dist/production/{chunk-FUSXQSWG.mjs → chunk-7F5XUDXM.mjs} +208 -221
  39. package/dist/production/{chunk-EAIF67OW.js → chunk-C7S4I3K5.js} +201 -258
  40. package/dist/production/{chunk-FDUMZGKM.mjs → chunk-ISOIFGFA.mjs} +15 -5
  41. package/dist/production/{chunk-G5A35OQU.js → chunk-YU3WNS3T.js} +7 -7
  42. package/dist/production/dom-export.d.mts +29 -10
  43. package/dist/production/dom-export.d.ts +29 -10
  44. package/dist/production/dom-export.js +158 -103
  45. package/dist/production/dom-export.mjs +133 -79
  46. package/dist/{development/index-react-server-client-Da3kmxNd.d.ts → production/index-react-server-client-CCjKYJTH.d.ts} +75 -180
  47. package/dist/production/{index-react-server-client-rcoGPJhU.d.mts → index-react-server-client-CipGfVBI.d.mts} +75 -180
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +19 -4
  53. package/dist/production/index-react-server.d.ts +19 -4
  54. package/dist/production/index-react-server.js +30 -24
  55. package/dist/production/index-react-server.mjs +30 -24
  56. package/dist/production/index.d.mts +19 -15
  57. package/dist/production/index.d.ts +19 -15
  58. package/dist/production/index.js +92 -82
  59. package/dist/production/index.mjs +3 -3
  60. package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-BB0wRuqz.d.ts} +93 -11
  61. package/dist/production/lib/types/internal.d.mts +2 -2
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-QkB3HGjm.d.mts → register-C1RwVJAt.d.mts} +1 -1
  66. package/dist/production/{register-BpU9rFBJ.d.ts → register-ODDAAYlf.d.ts} +1 -1
  67. package/dist/production/{router-CAvh_Drx.d.mts → router-CwNp5l9u.d.mts} +93 -11
  68. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.6
2
+ * react-router v7.10.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -49,7 +49,7 @@ import {
49
49
  withComponentProps,
50
50
  withErrorBoundaryProps,
51
51
  withHydrateFallbackProps
52
- } from "./chunk-FUSXQSWG.mjs";
52
+ } from "./chunk-7F5XUDXM.mjs";
53
53
 
54
54
  // lib/dom/ssr/server.tsx
55
55
  import * as React from "react";
@@ -1655,12 +1655,12 @@ function createMemorySessionStorage({ cookie } = {}) {
1655
1655
  // lib/href.ts
1656
1656
  function href(path, ...args) {
1657
1657
  let params = args[0];
1658
- let result = path.replace(/\/*\*?$/, "").replace(
1658
+ let result = trimTrailingSplat(path).replace(
1659
1659
  /\/:([\w-]+)(\?)?/g,
1660
1660
  // same regex as in .\router\utils.ts: compilePath().
1661
1661
  (_, param, questionMark) => {
1662
1662
  const isRequired = questionMark === void 0;
1663
- const value = params ? params[param] : void 0;
1663
+ const value = params?.[param];
1664
1664
  if (isRequired && value === void 0) {
1665
1665
  throw new Error(
1666
1666
  `Path '${path}' requires param '${param}' but it was not provided`
@@ -1670,13 +1670,23 @@ function href(path, ...args) {
1670
1670
  }
1671
1671
  );
1672
1672
  if (path.endsWith("*")) {
1673
- const value = params ? params["*"] : void 0;
1673
+ const value = params?.["*"];
1674
1674
  if (value !== void 0) {
1675
1675
  result += "/" + value;
1676
1676
  }
1677
1677
  }
1678
1678
  return result || "/";
1679
1679
  }
1680
+ function trimTrailingSplat(path) {
1681
+ let i = path.length - 1;
1682
+ let char = path[i];
1683
+ if (char !== "*" && char !== "/") return path;
1684
+ i--;
1685
+ for (; i >= 0; i--) {
1686
+ if (path[i] !== "/") break;
1687
+ }
1688
+ return path.slice(0, i + 1);
1689
+ }
1680
1690
 
1681
1691
  // lib/rsc/server.ssr.tsx
1682
1692
  import * as React4 from "react";
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
2
- * react-router v7.9.6
2
+ * react-router v7.10.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkEAIF67OWjs = require('./chunk-EAIF67OW.js');
17
+ var _chunkC7S4I3K5js = require('./chunk-C7S4I3K5.js');
18
18
 
19
19
  // lib/dom/ssr/hydration.tsx
20
20
  function getHydrationData({
@@ -29,12 +29,12 @@ function getHydrationData({
29
29
  ...state,
30
30
  loaderData: { ...state.loaderData }
31
31
  };
32
- let initialMatches = _chunkEAIF67OWjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkC7S4I3K5js.matchRoutes.call(void 0, routes, location, basename);
33
33
  if (initialMatches) {
34
34
  for (let match of initialMatches) {
35
35
  let routeId = match.route.id;
36
36
  let routeInfo = getRouteInfo(routeId);
37
- if (_chunkEAIF67OWjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkC7S4I3K5js.shouldHydrateRouteLoader.call(void 0,
38
38
  routeId,
39
39
  routeInfo.clientLoader,
40
40
  routeInfo.hasLoader,
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
112
112
  }
113
113
  }
114
114
  );
115
- if (_chunkEAIF67OWjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkC7S4I3K5js.isRouteErrorResponse.call(void 0, error)) {
116
116
  return /* @__PURE__ */ _react2.default.createElement(
117
117
  ErrorWrapper,
118
118
  {
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
120
120
  title: "Unhandled Thrown Response!"
121
121
  },
122
122
  /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
123
- _chunkEAIF67OWjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkC7S4I3K5js.ENABLE_DEV_WARNINGS ? heyDeveloper : null
124
124
  );
125
125
  }
126
126
  let errorInstance;
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
146
146
  function RSCDefaultRootErrorBoundary({
147
147
  hasRootLayout
148
148
  }) {
149
- let error = _chunkEAIF67OWjs.useRouteError.call(void 0, );
149
+ let error = _chunkC7S4I3K5js.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CAvh_Drx.mjs';
3
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C07r42Tt.mjs';
2
+ import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CwNp5l9u.mjs';
3
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C5z6FZmz.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -25,16 +25,9 @@ interface HydratedRouterProps {
25
25
  * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
26
26
  * mostly useful for observability such as wrapping navigations, fetches,
27
27
  * as well as route loaders/actions/middlewares with logging and/or performance
28
- * tracing.
28
+ * tracing. See the [docs](../../how-to/instrumentation) for more information.
29
29
  *
30
30
  * ```tsx
31
- * startTransition(() => {
32
- * hydrateRoot(
33
- * document,
34
- * <HydratedRouter unstable_instrumentations={[logging]} />
35
- * );
36
- * });
37
- *
38
31
  * const logging = {
39
32
  * router({ instrument }) {
40
33
  * instrument({
@@ -67,6 +60,13 @@ interface HydratedRouterProps {
67
60
  * let duration = Math.round(performance.now() - start);
68
61
  * console.log(`end ${label} (${duration}ms)`);
69
62
  * }
63
+ *
64
+ * startTransition(() => {
65
+ * hydrateRoot(
66
+ * document,
67
+ * <HydratedRouter unstable_instrumentations={[logging]} />
68
+ * );
69
+ * });
70
70
  * ```
71
71
  */
72
72
  unstable_instrumentations?: unstable_ClientInstrumentation[];
@@ -88,6 +88,25 @@ interface HydratedRouterProps {
88
88
  * ```
89
89
  */
90
90
  unstable_onError?: unstable_ClientOnErrorFunction;
91
+ /**
92
+ * Control whether router state updates are internally wrapped in
93
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
94
+ *
95
+ * - When left `undefined`, all state updates are wrapped in
96
+ * `React.startTransition`
97
+ * - This can lead to buggy behaviors if you are wrapping your own
98
+ * navigations/fetchers in `startTransition`.
99
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
100
+ * in `React.startTransition` and router state changes will be wrapped in
101
+ * `React.startTransition` and also sent through
102
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
103
+ * surface mid-navigation router state changes to the UI.
104
+ * - When set to `false`, the router will not leverage `React.startTransition` or
105
+ * `React.useOptimistic` on any navigations or state changes.
106
+ *
107
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
108
+ */
109
+ unstable_useTransitions?: boolean;
91
110
  }
92
111
  /**
93
112
  * Framework-mode router component to be used to hydrate a router from a
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router';
3
- import { u as unstable_ClientInstrumentation } from './instrumentation-Unc20tLk.js';
4
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BbBXFHbO.js';
3
+ import { u as unstable_ClientInstrumentation } from './instrumentation-BB0wRuqz.js';
4
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BpxEZgZC.js';
5
5
 
6
6
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
7
7
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -26,16 +26,9 @@ interface HydratedRouterProps {
26
26
  * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
27
27
  * mostly useful for observability such as wrapping navigations, fetches,
28
28
  * as well as route loaders/actions/middlewares with logging and/or performance
29
- * tracing.
29
+ * tracing. See the [docs](../../how-to/instrumentation) for more information.
30
30
  *
31
31
  * ```tsx
32
- * startTransition(() => {
33
- * hydrateRoot(
34
- * document,
35
- * <HydratedRouter unstable_instrumentations={[logging]} />
36
- * );
37
- * });
38
- *
39
32
  * const logging = {
40
33
  * router({ instrument }) {
41
34
  * instrument({
@@ -68,6 +61,13 @@ interface HydratedRouterProps {
68
61
  * let duration = Math.round(performance.now() - start);
69
62
  * console.log(`end ${label} (${duration}ms)`);
70
63
  * }
64
+ *
65
+ * startTransition(() => {
66
+ * hydrateRoot(
67
+ * document,
68
+ * <HydratedRouter unstable_instrumentations={[logging]} />
69
+ * );
70
+ * });
71
71
  * ```
72
72
  */
73
73
  unstable_instrumentations?: unstable_ClientInstrumentation[];
@@ -89,6 +89,25 @@ interface HydratedRouterProps {
89
89
  * ```
90
90
  */
91
91
  unstable_onError?: unstable_ClientOnErrorFunction;
92
+ /**
93
+ * Control whether router state updates are internally wrapped in
94
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
95
+ *
96
+ * - When left `undefined`, all state updates are wrapped in
97
+ * `React.startTransition`
98
+ * - This can lead to buggy behaviors if you are wrapping your own
99
+ * navigations/fetchers in `startTransition`.
100
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
101
+ * in `React.startTransition` and router state changes will be wrapped in
102
+ * `React.startTransition` and also sent through
103
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
104
+ * surface mid-navigation router state changes to the UI.
105
+ * - When set to `false`, the router will not leverage `React.startTransition` or
106
+ * `React.useOptimistic` on any navigations or state changes.
107
+ *
108
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
109
+ */
110
+ unstable_useTransitions?: boolean;
92
111
  }
93
112
  /**
94
113
  * Framework-mode router component to be used to hydrate a router from a