vitarx-router 4.0.0 → 4.0.1
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,22 +1,8 @@
|
|
|
1
|
+
import type { Route, Router } from '../core/index.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 该模块重新导出虚拟模块生成的路由配置。
|
|
5
|
-
* 开发者应该从 `vitarx-router/auto-routes` 导入 routes。
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { routes, handleHotUpdate } from 'vitarx-router/auto-routes'
|
|
10
|
-
*
|
|
11
|
-
* const router = createRouter({ routes })
|
|
12
|
-
*
|
|
13
|
-
* if (import.meta.hot) {
|
|
14
|
-
* handleHotUpdate(router)
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
3
|
+
* 自动生成的路线配置
|
|
17
4
|
*/
|
|
18
|
-
|
|
19
|
-
export { default as routes } from 'virtual:vitarx-router:routes';
|
|
5
|
+
export declare const routes: Route[];
|
|
20
6
|
/**
|
|
21
7
|
* 处理路由热更新函数
|
|
22
8
|
*
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 自动路由模块
|
|
3
|
+
*
|
|
4
|
+
* 该模块重新导出虚拟模块生成的路由配置。
|
|
5
|
+
* 开发者应该从 `vitarx-router/auto-routes` 导入 routes。
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { routes, handleHotUpdate } from 'vitarx-router/auto-routes'
|
|
10
|
+
*
|
|
11
|
+
* const router = createRouter({ routes })
|
|
12
|
+
*
|
|
13
|
+
* if (import.meta.hot) {
|
|
14
|
+
* handleHotUpdate(router)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import virtualRoutes from 'virtual:vitarx-router:routes';
|
|
19
|
+
/**
|
|
20
|
+
* 自动生成的路线配置
|
|
21
|
+
*/
|
|
22
|
+
export const routes = virtualRoutes;
|
|
2
23
|
/**
|
|
3
24
|
* 处理路由热更新函数
|
|
4
25
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Router } from '../router/index.js';
|
|
1
2
|
import { RouteManager, type RouteManagerOptions } from '../router/manager.js';
|
|
2
3
|
import { MemoryRouter } from '../router/memory.js';
|
|
3
4
|
import { WebRouter } from '../router/web.js';
|
|
@@ -68,6 +69,5 @@ export declare function createMemoryRouter(options: RouterOptions): MemoryRouter
|
|
|
68
69
|
* @param [options.onNotFound] - 导航不匹配时触发的回调函数
|
|
69
70
|
* @param [skipEnvWarn=false] - 是否跳过浏览器检查
|
|
70
71
|
* @returns {Router} 返回路由实例,根据环境返回不同类型的路由
|
|
71
|
-
*
|
|
72
72
|
*/
|
|
73
|
-
export declare function createRouter(options: RouterOptions, skipEnvWarn?: boolean):
|
|
73
|
+
export declare function createRouter(options: RouterOptions, skipEnvWarn?: boolean): Router;
|
|
@@ -79,7 +79,6 @@ export function createMemoryRouter(options) {
|
|
|
79
79
|
* @param [options.onNotFound] - 导航不匹配时触发的回调函数
|
|
80
80
|
* @param [skipEnvWarn=false] - 是否跳过浏览器检查
|
|
81
81
|
* @returns {Router} 返回路由实例,根据环境返回不同类型的路由
|
|
82
|
-
*
|
|
83
82
|
*/
|
|
84
83
|
export function createRouter(options, skipEnvWarn = false) {
|
|
85
84
|
if (typeof window === 'undefined' || typeof window.scrollTo !== 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitarx-router",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
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",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"@types/babel__generator": "^7.6.0",
|
|
73
73
|
"@types/babel__traverse": "^7.20.0",
|
|
74
74
|
"@types/micromatch": "^4.0.9",
|
|
75
|
-
"@types/node": "^25.4.0"
|
|
75
|
+
"@types/node": "^25.4.0",
|
|
76
|
+
"change-push": "^1.0.0"
|
|
76
77
|
},
|
|
77
78
|
"files": [
|
|
78
79
|
"dist",
|
|
@@ -87,6 +88,6 @@
|
|
|
87
88
|
"test:plugin-vite": "vitest run --project plugin-vite",
|
|
88
89
|
"test:watch": "vitest watch",
|
|
89
90
|
"test:coverage": "vitest run --coverage",
|
|
90
|
-
"release": "
|
|
91
|
+
"release": "npx change-push"
|
|
91
92
|
}
|
|
92
93
|
}
|