chore(projects): update deps & fix vue-router type
This commit is contained in:
parent
cb1d44525d
commit
968370b1aa
24
package.json
24
package.json
@ -62,25 +62,25 @@
|
|||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"pinia": "2.2.0",
|
"pinia": "2.2.0",
|
||||||
"tailwind-merge": "2.4.0",
|
"tailwind-merge": "2.4.0",
|
||||||
"vue": "3.4.34",
|
"vue": "3.4.35",
|
||||||
"vue-draggable-plus": "0.5.2",
|
"vue-draggable-plus": "0.5.2",
|
||||||
"vue-i18n": "9.13.1",
|
"vue-i18n": "9.13.1",
|
||||||
"vue-router": "4.4.0"
|
"vue-router": "4.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@elegant-router/vue": "0.3.7",
|
"@elegant-router/vue": "0.3.8",
|
||||||
"@iconify/json": "2.2.232",
|
"@iconify/json": "2.2.232",
|
||||||
"@sa/scripts": "workspace:*",
|
"@sa/scripts": "workspace:*",
|
||||||
"@sa/uno-preset": "workspace:*",
|
"@sa/uno-preset": "workspace:*",
|
||||||
"@soybeanjs/eslint-config": "1.3.7",
|
"@soybeanjs/eslint-config": "1.4.0",
|
||||||
"@types/node": "22.0.0",
|
"@types/node": "22.0.1",
|
||||||
"@types/nprogress": "0.2.3",
|
"@types/nprogress": "0.2.3",
|
||||||
"@unocss/eslint-config": "0.61.7",
|
"@unocss/eslint-config": "0.61.9",
|
||||||
"@unocss/preset-icons": "0.61.7",
|
"@unocss/preset-icons": "0.61.9",
|
||||||
"@unocss/preset-uno": "0.61.7",
|
"@unocss/preset-uno": "0.61.9",
|
||||||
"@unocss/transformer-directives": "0.61.7",
|
"@unocss/transformer-directives": "0.61.9",
|
||||||
"@unocss/transformer-variant-group": "0.61.7",
|
"@unocss/transformer-variant-group": "0.61.9",
|
||||||
"@unocss/vite": "0.61.7",
|
"@unocss/vite": "0.61.9",
|
||||||
"@vitejs/plugin-vue": "5.1.1",
|
"@vitejs/plugin-vue": "5.1.1",
|
||||||
"@vitejs/plugin-vue-jsx": "4.0.0",
|
"@vitejs/plugin-vue-jsx": "4.0.0",
|
||||||
"eslint": "9.8.0",
|
"eslint": "9.8.0",
|
||||||
@ -88,7 +88,7 @@
|
|||||||
"lint-staged": "15.2.7",
|
"lint-staged": "15.2.7",
|
||||||
"sass": "1.77.8",
|
"sass": "1.77.8",
|
||||||
"simple-git-hooks": "2.11.1",
|
"simple-git-hooks": "2.11.1",
|
||||||
"tsx": "4.16.2",
|
"tsx": "4.16.3",
|
||||||
"typescript": "5.5.4",
|
"typescript": "5.5.4",
|
||||||
"unplugin-icons": "0.19.1",
|
"unplugin-icons": "0.19.1",
|
||||||
"unplugin-vue-components": "0.27.3",
|
"unplugin-vue-components": "0.27.3",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"enquirer": "2.4.1",
|
"enquirer": "2.4.1",
|
||||||
"execa": "9.3.0",
|
"execa": "9.3.0",
|
||||||
"kolorist": "1.8.0",
|
"kolorist": "1.8.0",
|
||||||
"npm-check-updates": "16.14.20",
|
"npm-check-updates": "17.0.0",
|
||||||
"rimraf": "6.0.1"
|
"rimraf": "6.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2514
pnpm-lock.yaml
2514
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -97,10 +97,13 @@ function transformElegantRouteToVueRoute(
|
|||||||
if (component) {
|
if (component) {
|
||||||
if (isSingleLevelRoute(route)) {
|
if (isSingleLevelRoute(route)) {
|
||||||
const { layout, view } = getSingleLevelRouteComponent(component);
|
const { layout, view } = getSingleLevelRouteComponent(component);
|
||||||
|
|
||||||
const singleLevelRoute: RouteRecordRaw = {
|
const singleLevelRoute: RouteRecordRaw = {
|
||||||
path,
|
path,
|
||||||
component: layouts[layout],
|
component: layouts[layout],
|
||||||
|
meta: {
|
||||||
|
title: route.meta?.title || ''
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
@ -110,36 +113,35 @@ function transformElegantRouteToVueRoute(
|
|||||||
} as RouteRecordRaw
|
} as RouteRecordRaw
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
return [singleLevelRoute];
|
return [singleLevelRoute];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLayout(component)) {
|
if (isLayout(component)) {
|
||||||
const layoutName = getLayoutName(component);
|
const layoutName = getLayoutName(component);
|
||||||
|
|
||||||
vueRoute.component = layouts[layoutName];
|
vueRoute.component = layouts[layoutName];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isView(component)) {
|
if (isView(component)) {
|
||||||
const viewName = getViewName(component);
|
const viewName = getViewName(component);
|
||||||
|
|
||||||
vueRoute.component = views[viewName];
|
vueRoute.component = views[viewName];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error(`Error transforming route "${route.name}": ${error.toString()}`);
|
console.error(`Error transforming route "${route.name}": ${error.toString()}`);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add redirect to child
|
// add redirect to child
|
||||||
if (children?.length && !vueRoute.redirect) {
|
if (children?.length && !vueRoute.redirect) {
|
||||||
vueRoute.redirect = {
|
vueRoute.redirect = {
|
||||||
name: children[0].name
|
name: children[0].name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (children?.length) {
|
if (children?.length) {
|
||||||
const childRoutes = children.flatMap(child => transformElegantRouteToVueRoute(child, layouts, views));
|
const childRoutes = children.flatMap(child => transformElegantRouteToVueRoute(child, layouts, views));
|
||||||
|
|
||||||
|
4
src/typings/elegant-router.d.ts
vendored
4
src/typings/elegant-router.d.ts
vendored
@ -37,7 +37,7 @@ declare module "@elegant-router/types" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* custom route key
|
* custom route key
|
||||||
*/
|
*/
|
||||||
export type CustomRouteKey = Extract<
|
export type CustomRouteKey = Extract<
|
||||||
RouteKey,
|
RouteKey,
|
||||||
| "root"
|
| "root"
|
||||||
@ -46,7 +46,7 @@ declare module "@elegant-router/types" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* the generated route key
|
* the generated route key
|
||||||
*/
|
*/
|
||||||
export type GeneratedRouteKey = Exclude<RouteKey, CustomRouteKey>;
|
export type GeneratedRouteKey = Exclude<RouteKey, CustomRouteKey>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user