vitarx-router 4.0.5 → 4.0.7
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CodeLocation, ElementView, type RenderChildren, type WithProps } from 'vitarx';
|
|
2
2
|
import { type NavigateResult } from '../core/index.js';
|
|
3
3
|
import { type UseLinkOptions } from '../core/shared/index.js';
|
|
4
|
-
export interface RouterLinkProps extends UseLinkOptions, WithProps<'a'> {
|
|
4
|
+
export interface RouterLinkProps extends UseLinkOptions, Omit<WithProps<'a'>, 'href' | 'onClick'> {
|
|
5
5
|
/**
|
|
6
6
|
* 子节点插槽
|
|
7
7
|
*/
|
|
@@ -99,6 +99,13 @@ export function parseDefinePage(content, filePath) {
|
|
|
99
99
|
* @returns 转换后的代码,无需转换返回 null
|
|
100
100
|
*/
|
|
101
101
|
export function removeDefinePage(code, filename) {
|
|
102
|
+
// 只处理 ts tsx js jsx 文件
|
|
103
|
+
if (!filename.endsWith('.ts') &&
|
|
104
|
+
!filename.endsWith('.tsx') &&
|
|
105
|
+
!filename.endsWith('.js') &&
|
|
106
|
+
!filename.endsWith('.jsx')) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
102
109
|
if (!code.includes('definePage')) {
|
|
103
110
|
return null;
|
|
104
111
|
}
|
|
@@ -63,6 +63,12 @@ export default function vitarxRouter(options = {}) {
|
|
|
63
63
|
*/
|
|
64
64
|
config(_config, env) {
|
|
65
65
|
state.isPreview = !!env.isPreview;
|
|
66
|
+
return {
|
|
67
|
+
optimizeDeps: {
|
|
68
|
+
// 排除自动路由生成模块,兼容 esbuild,修复 vite < 8.0.0 版本兼容性问题
|
|
69
|
+
exclude: ['vitarx-router/auto-routes']
|
|
70
|
+
}
|
|
71
|
+
};
|
|
66
72
|
},
|
|
67
73
|
/**
|
|
68
74
|
* 配置解析完成钩子
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitarx-router",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "Official routing solution for Vitarx framework with declarative routing, navigation guards, dynamic routes, file-based routing with HMR, and full TypeScript support.",
|
|
5
5
|
"author": "ZhuChonglin <8210856@qq.com>",
|
|
6
6
|
"license": "MIT",
|