@remix-run/router 0.0.0-experimental-d90c8fb3 → 0.0.0-experimental-e7ce8959
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/dist/router.cjs.js +25 -11
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +1 -0
- package/dist/router.js +25 -11
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +25 -11
- 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 +17 -8
- package/utils.ts +28 -14
package/dist/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-e7ce8959
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -754,14 +754,14 @@
|
|
|
754
754
|
rankRouteBranches(branches);
|
|
755
755
|
let matches = null;
|
|
756
756
|
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
757
|
+
matches = matchRouteBranch(branches[i],
|
|
757
758
|
// Incoming pathnames are generally encoded from either window.location
|
|
758
759
|
// or from router.navigate, but we want to match against the unencoded
|
|
759
760
|
// paths in the route definitions. Memory router locations won't be
|
|
760
761
|
// encoded here but there also shouldn't be anything to decode so this
|
|
761
762
|
// should be a safe operation. This avoids needing matchRoutes to be
|
|
762
763
|
// history-aware.
|
|
763
|
-
|
|
764
|
-
matches = matchRouteBranch(branches[i], decoded);
|
|
764
|
+
safelyDecodeURI(pathname));
|
|
765
765
|
}
|
|
766
766
|
return matches;
|
|
767
767
|
}
|
|
@@ -1040,7 +1040,7 @@
|
|
|
1040
1040
|
if (isOptional && !value) {
|
|
1041
1041
|
memo[paramName] = undefined;
|
|
1042
1042
|
} else {
|
|
1043
|
-
memo[paramName] = (value || ""
|
|
1043
|
+
memo[paramName] = safelyDecodeURIComponent(value || "", paramName);
|
|
1044
1044
|
}
|
|
1045
1045
|
return memo;
|
|
1046
1046
|
}, {});
|
|
@@ -1092,14 +1092,22 @@
|
|
|
1092
1092
|
let matcher = new RegExp(regexpSource, caseSensitive ? undefined : "i");
|
|
1093
1093
|
return [matcher, params];
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function safelyDecodeURI(value) {
|
|
1096
1096
|
try {
|
|
1097
|
-
return value
|
|
1097
|
+
return decodeURI(value);
|
|
1098
1098
|
} catch (error) {
|
|
1099
1099
|
warning(false, "The URL path \"" + value + "\" could not be decoded because it is is a " + "malformed URL segment. This is probably due to a bad percent " + ("encoding (" + error + ")."));
|
|
1100
1100
|
return value;
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
|
+
function safelyDecodeURIComponent(value, paramName) {
|
|
1104
|
+
try {
|
|
1105
|
+
return decodeURIComponent(value);
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
warning(false, "The value for the URL param \"" + paramName + "\" will not be decoded because" + (" the string \"" + value + "\" is a malformed URL segment. This is probably") + (" due to a bad percent encoding (" + error + ")."));
|
|
1108
|
+
return value;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1103
1111
|
|
|
1104
1112
|
/**
|
|
1105
1113
|
* @private
|
|
@@ -3269,7 +3277,8 @@
|
|
|
3269
3277
|
}
|
|
3270
3278
|
// Config driven behavior flags
|
|
3271
3279
|
let future = _extends({
|
|
3272
|
-
v7_relativeSplatPath: false
|
|
3280
|
+
v7_relativeSplatPath: false,
|
|
3281
|
+
v7_throwAbortReason: false
|
|
3273
3282
|
}, opts ? opts.future : null);
|
|
3274
3283
|
let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);
|
|
3275
3284
|
|
|
@@ -3492,8 +3501,7 @@
|
|
|
3492
3501
|
requestContext
|
|
3493
3502
|
});
|
|
3494
3503
|
if (request.signal.aborted) {
|
|
3495
|
-
|
|
3496
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3504
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3497
3505
|
}
|
|
3498
3506
|
}
|
|
3499
3507
|
if (isRedirectResult(result)) {
|
|
@@ -3611,8 +3619,7 @@
|
|
|
3611
3619
|
requestContext
|
|
3612
3620
|
}))]);
|
|
3613
3621
|
if (request.signal.aborted) {
|
|
3614
|
-
|
|
3615
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3622
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3616
3623
|
}
|
|
3617
3624
|
|
|
3618
3625
|
// Process and commit output from loaders
|
|
@@ -3657,6 +3664,13 @@
|
|
|
3657
3664
|
});
|
|
3658
3665
|
return newContext;
|
|
3659
3666
|
}
|
|
3667
|
+
function throwStaticHandlerAbortedError(request, isRouteRequest, future) {
|
|
3668
|
+
if (future.v7_throwAbortReason && request.signal.reason !== undefined) {
|
|
3669
|
+
throw request.signal.reason;
|
|
3670
|
+
}
|
|
3671
|
+
let method = isRouteRequest ? "queryRoute" : "query";
|
|
3672
|
+
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3673
|
+
}
|
|
3660
3674
|
function isSubmissionNavigation(opts) {
|
|
3661
3675
|
return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined);
|
|
3662
3676
|
}
|