Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@umijs/route-utils

Package Overview
Dependencies
Maintainers
14
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umijs/route-utils - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

25

dist/getMatchMenu/getMatchMenu.js

@@ -26,3 +26,3 @@ import { pathToRegexp } from '@qixian.cs/path-to-regexp';

export const getMenuMatches = (flatMenuKeys = [], path, flatMenus) => flatMenuKeys
.filter(item => {
.filter((item) => {
// 如果配置了 hideInMenu 就不需要选中了

@@ -35,10 +35,15 @@ if (flatMenus[item].hideInMenu) {

}
if (item !== '/' && item && !isUrl(item)) {
// /a
if (pathToRegexp(`${item}`, []).test(path)) {
return true;
if (item !== '/' && item !== '/*' && item && !isUrl(item)) {
try {
// /a
if (pathToRegexp(`${item}`, []).test(path)) {
return true;
}
// /a/b/b
if (pathToRegexp(`${item}(.*)`).test(path)) {
return true;
}
}
// /a/b/b
if (pathToRegexp(`${item}(.*)`).test(path)) {
return true;
catch (error) {
console.log(error, path);
}

@@ -79,3 +84,3 @@ }

const parentItems = (menuItem.pro_layout_parentKeys || [])
.map(key => {
.map((key) => {
if (map.has(key)) {

@@ -87,3 +92,3 @@ return null;

})
.filter(item => item);
.filter((item) => item);
if (menuItem.key) {

@@ -90,0 +95,0 @@ parentItems.push(menuItem);

@@ -274,2 +274,7 @@ import getMatchMenu from './getMatchMenu';

{ path: '/tech-ui-preview/:category/:id', unaccessible: false },
{
// 其它路由情况, 用于兜底
path: '/*',
redirect: './Exception/404',
},
];

@@ -276,0 +281,0 @@ test('test layout config', () => {

18

es/getMatchMenu/getMatchMenu.js

@@ -41,11 +41,15 @@ import { pathToRegexp } from '@qixian.cs/path-to-regexp';

if (item !== '/' && item && !isUrl(item)) {
// /a
if (pathToRegexp("".concat(item), []).test(path)) {
return true;
} // /a/b/b
if (item !== '/' && item !== '/*' && item && !isUrl(item)) {
try {
// /a
if (pathToRegexp("".concat(item), []).test(path)) {
return true;
} // /a/b/b
if (pathToRegexp("".concat(item, "(.*)")).test(path)) {
return true;
if (pathToRegexp("".concat(item, "(.*)")).test(path)) {
return true;
}
} catch (error) {
console.log(error, path);
}

@@ -52,0 +56,0 @@ }

@@ -55,11 +55,15 @@ "use strict";

if (item !== '/' && item && !(0, _transformRoute.isUrl)(item)) {
// /a
if ((0, _pathToRegexp.pathToRegexp)("".concat(item), []).test(path)) {
return true;
} // /a/b/b
if (item !== '/' && item !== '/*' && item && !(0, _transformRoute.isUrl)(item)) {
try {
// /a
if ((0, _pathToRegexp.pathToRegexp)("".concat(item), []).test(path)) {
return true;
} // /a/b/b
if ((0, _pathToRegexp.pathToRegexp)("".concat(item, "(.*)")).test(path)) {
return true;
if ((0, _pathToRegexp.pathToRegexp)("".concat(item, "(.*)")).test(path)) {
return true;
}
} catch (error) {
console.log(error, path);
}

@@ -66,0 +70,0 @@ }

{
"name": "@umijs/route-utils",
"version": "1.0.24",
"version": "1.0.25",
"description": "Quickly process the routing of umi",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc