@remix-run/router 1.14.1 → 1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # `@remix-run/router`
2
2
 
3
+ ## 1.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix bug where dashes were not picked up in dynamic parameter names ([#11160](https://github.com/remix-run/react-router/pull/11160))
8
+ - Do not attempt to deserialize empty JSON responses ([#11164](https://github.com/remix-run/react-router/pull/11164))
9
+
3
10
  ## 1.14.1
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.14.1
2
+ * @remix-run/router v1.14.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -889,7 +889,7 @@ function rankRouteBranches(branches) {
889
889
  branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first
890
890
  : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));
891
891
  }
892
- const paramRe = /^:\w+$/;
892
+ const paramRe = /^:[\w-]+$/;
893
893
  const dynamicSegmentValue = 3;
894
894
  const indexRouteValue = 2;
895
895
  const emptySegmentValue = 1;
@@ -979,7 +979,7 @@ function generatePath(originalPath, params) {
979
979
  // Apply the splat
980
980
  return stringify(params[star]);
981
981
  }
982
- const keyMatch = segment.match(/^:(\w+)(\??)$/);
982
+ const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
983
983
  if (keyMatch) {
984
984
  const [, key, optional] = keyMatch;
985
985
  let param = params[key];
@@ -1061,7 +1061,7 @@ function compilePath(path, caseSensitive, end) {
1061
1061
  let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below
1062
1062
  .replace(/^\/*/, "/") // Make sure it has a leading /
1063
1063
  .replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
1064
- .replace(/\/:(\w+)(\?)?/g, (_, paramName, isOptional) => {
1064
+ .replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
1065
1065
  params.push({
1066
1066
  paramName,
1067
1067
  isOptional: isOptional != null
@@ -4200,7 +4200,11 @@ async function callLoaderOrAction(type, request, match, matches, manifest, mapRo
4200
4200
  // Check between word boundaries instead of startsWith() due to the last
4201
4201
  // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type
4202
4202
  if (contentType && /\bapplication\/json\b/.test(contentType)) {
4203
- data = await result.json();
4203
+ if (result.body == null) {
4204
+ data = null;
4205
+ } else {
4206
+ data = await result.json();
4207
+ }
4204
4208
  } else {
4205
4209
  data = await result.text();
4206
4210
  }