@xfe-repo/web-router 1.2.7 → 1.2.8
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -99,6 +99,7 @@ type CreateNavigatorOptions = {
|
|
|
99
99
|
mode: 'static' | 'browser' | 'hash';
|
|
100
100
|
routes: RouteConfig[];
|
|
101
101
|
initPathname?: string;
|
|
102
|
+
basename?: string;
|
|
102
103
|
redirect?: (path: string) => void;
|
|
103
104
|
};
|
|
104
105
|
declare function createNavigator(options: CreateNavigatorOptions): NavigatorType;
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ type CreateNavigatorOptions = {
|
|
|
99
99
|
mode: 'static' | 'browser' | 'hash';
|
|
100
100
|
routes: RouteConfig[];
|
|
101
101
|
initPathname?: string;
|
|
102
|
+
basename?: string;
|
|
102
103
|
redirect?: (path: string) => void;
|
|
103
104
|
};
|
|
104
105
|
declare function createNavigator(options: CreateNavigatorOptions): NavigatorType;
|
package/dist/index.js
CHANGED
|
@@ -508,7 +508,7 @@ var getRoutes = function(config) {
|
|
|
508
508
|
// src/index.ts
|
|
509
509
|
var _navigator;
|
|
510
510
|
function createNavigator(options) {
|
|
511
|
-
var mode = options.mode, _options_initPathname = options.initPathname, initPathname = _options_initPathname === void 0 ? "/" : _options_initPathname, routes = options.routes;
|
|
511
|
+
var mode = options.mode, _options_initPathname = options.initPathname, initPathname = _options_initPathname === void 0 ? "/" : _options_initPathname, routes = options.routes, basename = options.basename;
|
|
512
512
|
var originHistory;
|
|
513
513
|
if (mode === "static") {
|
|
514
514
|
originHistory = (0, import_history.createMemoryHistory)({
|
|
@@ -530,7 +530,7 @@ function createNavigator(options) {
|
|
|
530
530
|
case 0:
|
|
531
531
|
_path_split = _sliced_to_array(path.split("?"), 2), tmp = _path_split[0], originPath = tmp === void 0 ? "" : tmp, tmp1 = _path_split[1], search = tmp1 === void 0 ? "" : tmp1;
|
|
532
532
|
matchPath = originPath.toLowerCase();
|
|
533
|
-
currentRoute = (_this = (0, import_react_router_dom3.matchRoutes)(routes, matchPath)) === null || _this === void 0 ? void 0 : (_ = _this[0]) === null || _ === void 0 ? void 0 : _.route;
|
|
533
|
+
currentRoute = (_this = (0, import_react_router_dom3.matchRoutes)(routes, matchPath, basename)) === null || _this === void 0 ? void 0 : (_ = _this[0]) === null || _ === void 0 ? void 0 : _.route;
|
|
534
534
|
query = query || import_tools.queryString.parse(search, {
|
|
535
535
|
parseBooleans: true,
|
|
536
536
|
parseNumbers: true
|
package/dist/index.mjs
CHANGED
|
@@ -406,7 +406,7 @@ var getRoutes = function(config) {
|
|
|
406
406
|
// src/index.ts
|
|
407
407
|
var _navigator;
|
|
408
408
|
function createNavigator(options) {
|
|
409
|
-
var mode = options.mode, _options_initPathname = options.initPathname, initPathname = _options_initPathname === void 0 ? "/" : _options_initPathname, routes = options.routes;
|
|
409
|
+
var mode = options.mode, _options_initPathname = options.initPathname, initPathname = _options_initPathname === void 0 ? "/" : _options_initPathname, routes = options.routes, basename = options.basename;
|
|
410
410
|
var originHistory;
|
|
411
411
|
if (mode === "static") {
|
|
412
412
|
originHistory = createMemoryHistory({
|
|
@@ -428,7 +428,7 @@ function createNavigator(options) {
|
|
|
428
428
|
case 0:
|
|
429
429
|
_path_split = _sliced_to_array(path.split("?"), 2), tmp = _path_split[0], originPath = tmp === void 0 ? "" : tmp, tmp1 = _path_split[1], search = tmp1 === void 0 ? "" : tmp1;
|
|
430
430
|
matchPath = originPath.toLowerCase();
|
|
431
|
-
currentRoute = (_matchRoutes = matchRoutes(routes, matchPath)) === null || _matchRoutes === void 0 ? void 0 : (_matchRoutes_ = _matchRoutes[0]) === null || _matchRoutes_ === void 0 ? void 0 : _matchRoutes_.route;
|
|
431
|
+
currentRoute = (_matchRoutes = matchRoutes(routes, matchPath, basename)) === null || _matchRoutes === void 0 ? void 0 : (_matchRoutes_ = _matchRoutes[0]) === null || _matchRoutes_ === void 0 ? void 0 : _matchRoutes_.route;
|
|
432
432
|
query = query || queryString.parse(search, {
|
|
433
433
|
parseBooleans: true,
|
|
434
434
|
parseNumbers: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-router",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@types/loadable__component": "^5.13.9",
|
|
29
29
|
"@types/node": "^20.16.5",
|
|
30
30
|
"@types/react": "^18",
|
|
31
|
-
"@xfe-repo/eslint-config": "0.0.5",
|
|
32
31
|
"@xfe-repo/web-register": "1.3.5",
|
|
33
|
-
"@xfe-repo/typescript-config": "0.0.6"
|
|
32
|
+
"@xfe-repo/typescript-config": "0.0.6",
|
|
33
|
+
"@xfe-repo/eslint-config": "0.0.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@xfe-repo/web-utils": "1.3.11"
|