@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.
@@ -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
  *
@@ -891,7 +891,7 @@
891
891
  branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first
892
892
  : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));
893
893
  }
894
- const paramRe = /^:\w+$/;
894
+ const paramRe = /^:[\w-]+$/;
895
895
  const dynamicSegmentValue = 3;
896
896
  const indexRouteValue = 2;
897
897
  const emptySegmentValue = 1;
@@ -981,7 +981,7 @@
981
981
  // Apply the splat
982
982
  return stringify(params[star]);
983
983
  }
984
- const keyMatch = segment.match(/^:(\w+)(\??)$/);
984
+ const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
985
985
  if (keyMatch) {
986
986
  const [, key, optional] = keyMatch;
987
987
  let param = params[key];
@@ -1063,7 +1063,7 @@
1063
1063
  let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below
1064
1064
  .replace(/^\/*/, "/") // Make sure it has a leading /
1065
1065
  .replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
1066
- .replace(/\/:(\w+)(\?)?/g, (_, paramName, isOptional) => {
1066
+ .replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
1067
1067
  params.push({
1068
1068
  paramName,
1069
1069
  isOptional: isOptional != null
@@ -4202,7 +4202,11 @@
4202
4202
  // Check between word boundaries instead of startsWith() due to the last
4203
4203
  // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type
4204
4204
  if (contentType && /\bapplication\/json\b/.test(contentType)) {
4205
- data = await result.json();
4205
+ if (result.body == null) {
4206
+ data = null;
4207
+ } else {
4208
+ data = await result.json();
4209
+ }
4206
4210
  } else {
4207
4211
  data = await result.text();
4208
4212
  }