react-router 7.14.1 → 7.14.2

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 +46 -0
  2. package/dist/development/{browser-CtktEGQs.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  3. package/dist/development/{browser-D-3-U2Jj.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  4. package/dist/development/{chunk-OE4NN4TA.mjs → chunk-EVOBXE3Y.mjs} +23 -7
  5. package/dist/{production/chunk-3SUPTI2U.js → development/chunk-PZFPF4X7.js} +7 -7
  6. package/dist/development/{chunk-BFXCU3MI.mjs → chunk-YQSHRJWW.mjs} +3 -3
  7. package/dist/development/{chunk-3F6IB66O.js → chunk-YZKCRDTN.js} +99 -99
  8. package/dist/development/{chunk-YMKMFAYZ.js → chunk-ZZNWZ5Q3.js} +60 -44
  9. package/dist/{production/context-BzhbVly6.d.mts → development/context-DGGUoDIu.d.mts} +1 -1
  10. package/dist/development/dom-export.d.mts +4 -4
  11. package/dist/development/dom-export.d.ts +4 -4
  12. package/dist/development/dom-export.js +27 -27
  13. package/dist/development/dom-export.mjs +3 -3
  14. package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-BBd0A0TL.d.ts} +2 -2
  15. package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-BjhKIe3u.d.mts} +2 -2
  16. package/dist/development/index-react-server-client.d.mts +3 -3
  17. package/dist/development/index-react-server-client.d.ts +3 -3
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.js +1 -1
  21. package/dist/development/index-react-server.mjs +1 -1
  22. package/dist/development/index.d.mts +11 -11
  23. package/dist/development/index.d.ts +11 -11
  24. package/dist/development/index.js +96 -96
  25. package/dist/development/index.mjs +3 -3
  26. package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-g0dG8UL0.d.ts} +1 -1
  27. package/dist/development/lib/types/internal.d.mts +2 -2
  28. package/dist/development/lib/types/internal.d.ts +2 -2
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/development/{register-aE9ob3TK.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  32. package/dist/development/{register-D1WlEpq9.d.ts → register-DcBltf5q.d.ts} +1 -1
  33. package/dist/{production/routeModules-CM_clkdE.d.ts → development/routeModules-7rtk67cd.d.ts} +26 -11
  34. package/dist/development/{routeModules-Djumx26z.d.mts → routeModules-BW4a8k3I.d.mts} +26 -11
  35. package/dist/production/{browser-CtktEGQs.d.ts → browser-C-UvoYvi.d.ts} +2 -2
  36. package/dist/production/{browser-D-3-U2Jj.d.mts → browser-I6n6wVSO.d.mts} +2 -2
  37. package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-2WLZNCK5.mjs} +3 -3
  38. package/dist/production/{chunk-SPR7R4GU.mjs → chunk-LK6U7ULH.mjs} +23 -7
  39. package/dist/{development/chunk-7VLQJKNG.js → production/chunk-PQL4HLVQ.js} +7 -7
  40. package/dist/production/{chunk-LIOP3ILM.js → chunk-UJQ4OJF4.js} +99 -99
  41. package/dist/production/{chunk-UVEQGZIH.js → chunk-X5SKXJ4A.js} +60 -44
  42. package/dist/{development/context-BzhbVly6.d.mts → production/context-DGGUoDIu.d.mts} +1 -1
  43. package/dist/production/dom-export.d.mts +4 -4
  44. package/dist/production/dom-export.d.ts +4 -4
  45. package/dist/production/dom-export.js +27 -27
  46. package/dist/production/dom-export.mjs +3 -3
  47. package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-BBd0A0TL.d.ts} +2 -2
  48. package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-BjhKIe3u.d.mts} +2 -2
  49. package/dist/production/index-react-server-client.d.mts +3 -3
  50. package/dist/production/index-react-server-client.d.ts +3 -3
  51. package/dist/production/index-react-server-client.js +4 -4
  52. package/dist/production/index-react-server-client.mjs +2 -2
  53. package/dist/production/index-react-server.js +1 -1
  54. package/dist/production/index-react-server.mjs +1 -1
  55. package/dist/production/index.d.mts +11 -11
  56. package/dist/production/index.d.ts +11 -11
  57. package/dist/production/index.js +96 -96
  58. package/dist/production/index.mjs +3 -3
  59. package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-g0dG8UL0.d.ts} +1 -1
  60. package/dist/production/lib/types/internal.d.mts +2 -2
  61. package/dist/production/lib/types/internal.d.ts +2 -2
  62. package/dist/production/lib/types/internal.js +1 -1
  63. package/dist/production/lib/types/internal.mjs +1 -1
  64. package/dist/production/{register-aE9ob3TK.d.mts → register-D9d2sMQ7.d.mts} +1 -1
  65. package/dist/production/{register-D1WlEpq9.d.ts → register-DcBltf5q.d.ts} +1 -1
  66. package/dist/{development/routeModules-CM_clkdE.d.ts → production/routeModules-7rtk67cd.d.ts} +26 -11
  67. package/dist/production/{routeModules-Djumx26z.d.mts → routeModules-BW4a8k3I.d.mts} +26 -11
  68. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # `react-router`
2
2
 
3
+ ## v7.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Remove the un-documented custom error serialization logic from the internal turbo-stream implementation. React Router only automatically handles serialization of `Error` and it's standard subtypes (`SyntaxError`, `TypeError`, etc.). ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
8
+
9
+ - Properly handle parent middleware redirects during `fetcher.load` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
10
+
11
+ - Remove redundant `Omit<RouterProviderProps, "flushSync">` from `react-router/dom` `RouterProvider` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
12
+
13
+ - Improved types for `generatePath`'s `param` arg ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
14
+
15
+ Type errors when required params are omitted:
16
+
17
+ ```ts
18
+ // Before
19
+ // Passes type checks, but throws at runtime 💥
20
+ generatePath(":required", { required: null });
21
+
22
+ // After
23
+ generatePath(":required", { required: null });
24
+ // ^^^^^^^^ Type 'null' is not assignable to type 'string'.ts(2322)
25
+ ```
26
+
27
+ Allow omission of optional params:
28
+
29
+ ```ts
30
+ // Before
31
+ generatePath(":optional?", {});
32
+ // ^^ Property 'optional' is missing in type '{}' but required in type '{ optional: string | null | undefined; }'.ts(2741)
33
+
34
+ // After
35
+ generatePath(":optional?", {});
36
+ ```
37
+
38
+ Allows extra keys:
39
+
40
+ ```ts
41
+ // Before
42
+ generatePath(":a", { a: "1", b: "2" });
43
+ // ^ Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.ts(2353)
44
+
45
+ // After
46
+ generatePath(":a", { a: "1", b: "2" });
47
+ ```
48
+
3
49
  ## v7.14.1
4
50
 
5
51
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './instrumentation-CMVbvxj9.js';
3
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-CM_clkdE.js';
2
+ import { R as RouterInit } from './instrumentation-g0dG8UL0.js';
3
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-7rtk67cd.js';
4
4
 
5
5
  declare function getRequest(): Request;
6
6
  type RSCRouteConfigEntryBase = {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './context-BzhbVly6.mjs';
3
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-Djumx26z.mjs';
2
+ import { R as RouterInit } from './context-DGGUoDIu.mjs';
3
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-BW4a8k3I.mjs';
4
4
 
5
5
  declare function getRequest(): Request;
6
6
  type RSCRouteConfigEntryBase = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.14.1
2
+ * react-router v7.14.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -723,8 +723,7 @@ function generatePath(originalPath, params = {}) {
723
723
  const segments = path.split(/\/+/).map((segment, index, array) => {
724
724
  const isLastSegment = index === array.length - 1;
725
725
  if (isLastSegment && segment === "*") {
726
- const star = "*";
727
- return stringify2(params[star]);
726
+ return stringify2(params["*"]);
728
727
  }
729
728
  const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
730
729
  if (keyMatch) {
@@ -2659,6 +2658,14 @@ function createRouter(init) {
2659
2658
  key
2660
2659
  );
2661
2660
  let result = results[match.route.id];
2661
+ if (!result) {
2662
+ for (let match2 of matches) {
2663
+ if (results[match2.route.id]) {
2664
+ result = results[match2.route.id];
2665
+ break;
2666
+ }
2667
+ }
2668
+ }
2662
2669
  if (fetchControllers.get(key) === abortController) {
2663
2670
  fetchControllers.delete(key);
2664
2671
  }
@@ -5735,7 +5742,7 @@ function useOutlet(context) {
5735
5742
  function useParams() {
5736
5743
  let { matches } = React2.useContext(RouteContext);
5737
5744
  let routeMatch = matches[matches.length - 1];
5738
- return routeMatch ? routeMatch.params : {};
5745
+ return routeMatch?.params ?? {};
5739
5746
  }
5740
5747
  function useResolvedPath(to, { relative } = {}) {
5741
5748
  let { matches } = React2.useContext(RouteContext);
@@ -7165,6 +7172,14 @@ var TYPE_SET = "S";
7165
7172
  var TYPE_SYMBOL = "Y";
7166
7173
  var TYPE_URL = "U";
7167
7174
  var TYPE_PREVIOUS_RESOLVED = "Z";
7175
+ var SUPPORTED_ERROR_TYPES = [
7176
+ "EvalError",
7177
+ "RangeError",
7178
+ "ReferenceError",
7179
+ "SyntaxError",
7180
+ "TypeError",
7181
+ "URIError"
7182
+ ];
7168
7183
  var Deferred2 = class {
7169
7184
  constructor() {
7170
7185
  this.promise = new Promise((resolve, reject) => {
@@ -7526,7 +7541,7 @@ function hydrate(index) {
7526
7541
  continue;
7527
7542
  case TYPE_ERROR:
7528
7543
  const [, message, errorType] = value;
7529
- let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
7544
+ let error = errorType && globalObj && SUPPORTED_ERROR_TYPES.includes(errorType) && errorType in globalObj && typeof globalObj[errorType] === "function" ? new globalObj[errorType](message) : new Error(message);
7530
7545
  hydrated[index2] = error;
7531
7546
  set(error);
7532
7547
  continue;
@@ -8309,7 +8324,8 @@ function decodeViaTurboStream(body, global) {
8309
8324
  if (type === "SanitizedError") {
8310
8325
  let [name, message, stack] = rest;
8311
8326
  let Constructor = Error;
8312
- if (name && name in global && typeof global[name] === "function") {
8327
+ if (name && SUPPORTED_ERROR_TYPES.includes(name) && name in global && // @ts-expect-error
8328
+ typeof global[name] === "function") {
8313
8329
  Constructor = global[name];
8314
8330
  }
8315
8331
  let error = new Constructor(message);
@@ -9980,7 +9996,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
9980
9996
  try {
9981
9997
  if (isBrowser2) {
9982
9998
  window.__reactRouterVersion = // @ts-expect-error
9983
- "7.14.1";
9999
+ "7.14.2";
9984
10000
  }
9985
10001
  } catch (e) {
9986
10002
  }
@@ -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.14.1
2
+ * react-router v7.14.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkUVEQGZIHjs = require('./chunk-UVEQGZIH.js');
17
+ var _chunkZZNWZ5Q3js = require('./chunk-ZZNWZ5Q3.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 = _chunkUVEQGZIHjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkZZNWZ5Q3js.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 (_chunkUVEQGZIHjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkZZNWZ5Q3js.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 (_chunkUVEQGZIHjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkZZNWZ5Q3js.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
- _chunkUVEQGZIHjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkZZNWZ5Q3js.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 = _chunkUVEQGZIHjs.useRouteError.call(void 0, );
149
+ let error = _chunkZZNWZ5Q3js.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.14.1
2
+ * react-router v7.14.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -51,7 +51,7 @@ import {
51
51
  withComponentProps,
52
52
  withErrorBoundaryProps,
53
53
  withHydrateFallbackProps
54
- } from "./chunk-OE4NN4TA.mjs";
54
+ } from "./chunk-EVOBXE3Y.mjs";
55
55
 
56
56
  // lib/dom/ssr/server.tsx
57
57
  import * as React from "react";
@@ -579,7 +579,7 @@ function getDevServerHooks() {
579
579
  function getBuildTimeHeader(request, headerName) {
580
580
  if (typeof process !== "undefined") {
581
581
  try {
582
- if (process.env?.IS_RR_BUILD_REQUEST === "yes") {
582
+ if (process.env.hasOwnProperty("IS_RR_BUILD_REQUEST") && process.env.IS_RR_BUILD_REQUEST === "yes") {
583
583
  return request.headers.get(headerName);
584
584
  }
585
585
  } catch (e) {