@remix-run/router 1.14.1 → 1.14.2-pre.0
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 +7 -0
- package/dist/router.cjs.js +9 -5
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +9 -5
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +9 -5
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +5 -1
- package/utils.ts +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.14.2-pre.0
|
|
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
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.14.
|
|
2
|
+
* @remix-run/router v1.14.2-pre.0
|
|
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 =
|
|
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
|
-
|
|
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
|
}
|