@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 +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/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.14.
|
|
2
|
+
* @remix-run/router v1.14.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -653,7 +653,7 @@ function rankRouteBranches(branches) {
|
|
|
653
653
|
branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first
|
|
654
654
|
: compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));
|
|
655
655
|
}
|
|
656
|
-
const paramRe =
|
|
656
|
+
const paramRe = /^:[\w-]+$/;
|
|
657
657
|
const dynamicSegmentValue = 3;
|
|
658
658
|
const indexRouteValue = 2;
|
|
659
659
|
const emptySegmentValue = 1;
|
|
@@ -740,7 +740,7 @@ function generatePath(originalPath, params) {
|
|
|
740
740
|
// Apply the splat
|
|
741
741
|
return stringify(params[star]);
|
|
742
742
|
}
|
|
743
|
-
const keyMatch = segment.match(/^:(\w+)(\??)$/);
|
|
743
|
+
const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
|
|
744
744
|
if (keyMatch) {
|
|
745
745
|
const [, key, optional] = keyMatch;
|
|
746
746
|
let param = params[key];
|
|
@@ -812,7 +812,7 @@ function compilePath(path, caseSensitive, end) {
|
|
|
812
812
|
let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below
|
|
813
813
|
.replace(/^\/*/, "/") // Make sure it has a leading /
|
|
814
814
|
.replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
|
|
815
|
-
.replace(/\/:(\w+)(\?)?/g, (_, paramName, isOptional) => {
|
|
815
|
+
.replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
|
|
816
816
|
params.push({
|
|
817
817
|
paramName,
|
|
818
818
|
isOptional: isOptional != null
|
|
@@ -3707,7 +3707,11 @@ async function callLoaderOrAction(type, request, match, matches, manifest, mapRo
|
|
|
3707
3707
|
// Check between word boundaries instead of startsWith() due to the last
|
|
3708
3708
|
// paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type
|
|
3709
3709
|
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
3710
|
-
|
|
3710
|
+
if (result.body == null) {
|
|
3711
|
+
data = null;
|
|
3712
|
+
} else {
|
|
3713
|
+
data = await result.json();
|
|
3714
|
+
}
|
|
3711
3715
|
} else {
|
|
3712
3716
|
data = await result.text();
|
|
3713
3717
|
}
|