@lytjs/router 4.1.0 → 5.0.0
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/README.md +253 -0
- package/dist/index.cjs +1 -1
- package/package.json +3 -3
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# @lytjs/router
|
|
2
|
+
|
|
3
|
+
Lyt.js 官方路由 - 提供 History / Hash 模式、导航守卫、动态路由等能力。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lytjs/router
|
|
9
|
+
|
|
10
|
+
# 或使用 pnpm
|
|
11
|
+
pnpm add @lytjs/router
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 特性
|
|
15
|
+
|
|
16
|
+
- 🚀 History / Hash 双模式
|
|
17
|
+
- 🔄 完整的导航守卫
|
|
18
|
+
- 📦 动态路由匹配
|
|
19
|
+
- 🎯 嵌套路由
|
|
20
|
+
- 📋 命名路由和命名视图
|
|
21
|
+
- 🔌 零运行时依赖
|
|
22
|
+
|
|
23
|
+
## 快速开始
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { createRouter, createWebHistory } from '@lytjs/router';
|
|
27
|
+
import { createApp } from '@lytjs/core';
|
|
28
|
+
import Home from './views/Home.vue';
|
|
29
|
+
import About from './views/About.vue';
|
|
30
|
+
|
|
31
|
+
// 1. 定义路由
|
|
32
|
+
const routes = [
|
|
33
|
+
{ path: '/', component: Home },
|
|
34
|
+
{ path: '/about', component: About }
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
// 2. 创建路由实例
|
|
38
|
+
const router = createRouter({
|
|
39
|
+
history: createWebHistory(),
|
|
40
|
+
routes
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// 3. 创建应用并使用路由
|
|
44
|
+
const app = createApp(App);
|
|
45
|
+
app.use(router);
|
|
46
|
+
app.mount('#app');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API 参考
|
|
50
|
+
|
|
51
|
+
### 路由创建
|
|
52
|
+
|
|
53
|
+
| API | 说明 |
|
|
54
|
+
|------|------|
|
|
55
|
+
| `createRouter(options)` | 创建路由实例 |
|
|
56
|
+
| `createWebHistory(base)` | HTML5 History 模式 |
|
|
57
|
+
| `createWebHashHistory(base)` | Hash 模式 |
|
|
58
|
+
| `createMemoryHistory(base)` | 内存模式(测试用) |
|
|
59
|
+
|
|
60
|
+
### 组件
|
|
61
|
+
|
|
62
|
+
| 组件 | 说明 |
|
|
63
|
+
|------|------|
|
|
64
|
+
| `<router-view>` | 路由视图出口 |
|
|
65
|
+
| `<router-link>` | 路由导航链接 |
|
|
66
|
+
|
|
67
|
+
### 组合式 API
|
|
68
|
+
|
|
69
|
+
| API | 说明 |
|
|
70
|
+
|------|------|
|
|
71
|
+
| `useRouter()` | 获取路由实例 |
|
|
72
|
+
| `useRoute()` | 获取当前路由信息 |
|
|
73
|
+
| `useLink(props)` | 创建导航链接 |
|
|
74
|
+
|
|
75
|
+
## 路由配置
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
const routes = [
|
|
79
|
+
{
|
|
80
|
+
path: '/',
|
|
81
|
+
name: 'home',
|
|
82
|
+
component: Home,
|
|
83
|
+
meta: { title: '首页' }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
path: '/user/:id',
|
|
87
|
+
name: 'user',
|
|
88
|
+
component: User,
|
|
89
|
+
props: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
path: '/parent',
|
|
93
|
+
component: Parent,
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
path: 'child',
|
|
97
|
+
component: Child
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 导航守卫
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
// 全局前置守卫
|
|
108
|
+
router.beforeEach((to, from) => {
|
|
109
|
+
if (!isAuthenticated && to.path !== '/login') {
|
|
110
|
+
return '/login';
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// 全局解析守卫
|
|
115
|
+
router.beforeResolve(async (to) => {
|
|
116
|
+
// 在导航被确认之前、所有组件内守卫和异步路由组件被解析之后调用
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// 全局后置钩子
|
|
120
|
+
router.afterEach((to, from) => {
|
|
121
|
+
document.title = to.meta.title;
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 组件内守卫
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
import { onBeforeRouteLeave, onBeforeRouteUpdate } from '@lytjs/router';
|
|
129
|
+
|
|
130
|
+
onBeforeRouteLeave((to, from) => {
|
|
131
|
+
const answer = window.confirm('确定要离开吗?');
|
|
132
|
+
if (!answer) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
onBeforeRouteUpdate((to, from) => {
|
|
138
|
+
// 在当前路由改变,但是该组件被复用时调用
|
|
139
|
+
console.log('路由更新了');
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 路由元信息
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
const routes = [
|
|
147
|
+
{
|
|
148
|
+
path: '/admin',
|
|
149
|
+
component: Admin,
|
|
150
|
+
meta: { requiresAuth: true }
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
router.beforeEach((to, from) => {
|
|
155
|
+
if (to.meta.requiresAuth && !isAuthenticated()) {
|
|
156
|
+
return {
|
|
157
|
+
path: '/login',
|
|
158
|
+
query: { redirect: to.fullPath }
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 示例
|
|
165
|
+
|
|
166
|
+
### 编程式导航
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
import { useRouter } from '@lytjs/router';
|
|
170
|
+
|
|
171
|
+
const router = useRouter();
|
|
172
|
+
|
|
173
|
+
// 字符串路径
|
|
174
|
+
router.push('/users');
|
|
175
|
+
|
|
176
|
+
// 带路径的对象
|
|
177
|
+
router.push({ path: '/users' });
|
|
178
|
+
|
|
179
|
+
// 命名的路由
|
|
180
|
+
router.push({ name: 'user', params: { id: '123' } });
|
|
181
|
+
|
|
182
|
+
// 带查询参数,变成 /register?plan=private
|
|
183
|
+
router.push({ path: '/register', query: { plan: 'private' } });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 获取路由信息
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
import { useRoute } from '@lytjs/router';
|
|
190
|
+
|
|
191
|
+
const route = useRoute();
|
|
192
|
+
|
|
193
|
+
console.log(route.path); // 当前路径
|
|
194
|
+
console.log(route.params); // 动态参数
|
|
195
|
+
console.log(route.query); // 查询参数
|
|
196
|
+
console.log(route.meta); // 元信息
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 嵌套路由
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
const routes = [
|
|
203
|
+
{
|
|
204
|
+
path: '/user/:id',
|
|
205
|
+
component: User,
|
|
206
|
+
children: [
|
|
207
|
+
{
|
|
208
|
+
// 当 /user/:id/profile 匹配成功
|
|
209
|
+
// UserProfile 会被渲染在 User 的 <router-view> 中
|
|
210
|
+
path: 'profile',
|
|
211
|
+
component: UserProfile
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
// 当 /user/:id/posts 匹配成功
|
|
215
|
+
// UserPosts 会被渲染在 User 的 <router-view> 中
|
|
216
|
+
path: 'posts',
|
|
217
|
+
component: UserPosts
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 重定向和别名
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
const routes = [
|
|
228
|
+
// 重定向
|
|
229
|
+
{ path: '/home', redirect: '/' },
|
|
230
|
+
{ path: '/home', redirect: { name: 'homepage' } },
|
|
231
|
+
|
|
232
|
+
// 别名
|
|
233
|
+
{ path: '/', component: Home, alias: '/home' }
|
|
234
|
+
];
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 性能
|
|
238
|
+
|
|
239
|
+
- 体积小,零运行时依赖
|
|
240
|
+
- 按需加载路由
|
|
241
|
+
- 高效的路径匹配算法
|
|
242
|
+
|
|
243
|
+
## 兼容性
|
|
244
|
+
|
|
245
|
+
- Node.js >= 18.0.0
|
|
246
|
+
- Chrome 64+
|
|
247
|
+
- Firefox 63+
|
|
248
|
+
- Safari 12+
|
|
249
|
+
- Edge 79+
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},A=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of W(t))!U.call(e,u)&&u!==r&&T(e,u,{get:()=>t[u],enumerable:!(i=S(t,u))||i.enumerable});return e};var D=e=>A(T({},"__esModule",{value:!0}),e);var j={};z(j,{createHashHistory:()=>x,createNavigationGuards:()=>N,createRouteMatcher:()=>m,createRouter:()=>O,createWebHistory:()=>w,runAfterGuards:()=>b,runGuards:()=>y});module.exports=D(j);var p=require("@lytjs/common");function H(e,t=""){let r=(0,p.normalizePath)(t,e.path),{regex:i,paramKeys:u,isWildcard:s}=(0,p.pathToRegex)(r);if(e._regex=i,e._paramKeys=u,e._isWildcard=s,e.children)for(let c of e.children)H(c,r)}function m(e){let t=[];function r(n,a=""){for(let o of n)if(H(o,a),t.push(o),o.children){let d=(0,p.normalizePath)(a,o.path);r(o.children,d)}}r(e);function i(n){let a=n.replace(/\/+$/,"")||"/";for(let o of t){if(!o._regex)continue;let d=a.match(o._regex);if(d){let f={};if(o._paramKeys)for(let g=0;g<o._paramKeys.length;g++){let v=o._paramKeys[g];f[v]=d[g+1]||""}return{record:o,params:f,matchedPath:a}}}return null}function u(n){if(H(n),t.push(n),n.children){let a=(0,p.normalizePath)("",n.path);r(n.children,a)}}function s(n){for(let a=t.length-1;a>=0;a--)t[a].name===n&&t.splice(a,1)}function c(){return[...t]}return{matchRoute:i,addRoute:u,removeRoute:s,getRoutes:c}}function K(e){let t={};if(!e||e==="?")return t;let i=(e.startsWith("?")?e.slice(1):e).split("&");for(let u of i){let s=u.indexOf("=");if(s===-1)t[decodeURIComponent(u)]="";else{let c=decodeURIComponent(u.slice(0,s)),n=decodeURIComponent(u.slice(s+1));t[c]=n}}return t}function q(e){let t=[];for(let r of Object.keys(e)){let i=e[r];i!=null&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return t.join("&")}function I(e){let t="",r=e,i=e.indexOf("#");i!==-1&&(t=e.slice(i+1),r=e.slice(0,i));let u=r,s={},c=r.indexOf("?");return c!==-1&&(u=r.slice(0,c),s=K(r.slice(c))),{path:u,query:s,hash:t}}function h(e){return e.startsWith("/")||(e="/"+e),e.replace(/\/+/g,"/")}function w(e="/"){let t=h(e),r=[],i=s(window.location.href);function u(n){let a=s(window.location.href);a.fromPopState=!0,a.state=n.state;let o=i;i=a,c(a,o)}function s(n){let a;try{a=new URL(n)}catch(v){a=new URL(n,window.location.origin)}let o=a.pathname;t!=="/"&&o.startsWith(t)&&(o=o.slice(t.length)||"/");let{path:d,query:f,hash:g}=I(o+a.hash);return{path:h(d),fullPath:h(d)+(Object.keys(f).length?"?"+q(f):"")+(g?"#"+g:""),query:f,hash:g,state:a.state||null,fromPopState:!1}}function c(n,a){for(let o of r)o(n,a)}return window.addEventListener("popstate",u),{base:t,get location(){return i},push(n,a){let o=h(n),d=i,f=(t+o).replace(/\/+/g,"/");window.history.pushState(a||null,"",f),i=s(window.location.href),i.state=a||null,c(i,d)},replace(n,a){let o=h(n),d=i,f=(t+o).replace(/\/+/g,"/");window.history.replaceState(a||null,"",f),i=s(window.location.href),i.state=a||null,c(i,d)},go(n){window.history.go(n)},back(){window.history.back()},forward(){window.history.forward()},getCurrentRoute(){return s(window.location.href)},listen(n){return r.push(n),()=>{let a=r.indexOf(n);a!==-1&&r.splice(a,1)}},destroy(){window.removeEventListener("popstate",u),r.length=0}}}function x(){let e=[],t=i();function r(){let s=i();s.fromPopState=!0;let c=t;t=s,u(s,c)}function i(){let c=window.location.hash.slice(1)||"/",{path:n,query:a,hash:o}=I(c);return{path:h(n),fullPath:h(n)+(Object.keys(a).length?"?"+q(a):"")+(o?"#"+o:""),query:a,hash:o,state:null,fromPopState:!1}}function u(s,c){for(let n of e)n(s,c)}return window.addEventListener("hashchange",r),{base:"",get location(){return t},push(s,c){let n=h(s),a=t;window.location.hash=n,t=i(),u(t,a)},replace(s,c){let n=h(s),a=t;window.location.replace(window.location.pathname+window.location.search+"#"+n),t=i(),u(t,a)},go(s){window.history.go(s)},back(){window.history.back()},forward(){window.history.forward()},getCurrentRoute(){return i()},listen(s){return e.push(s),()=>{let c=e.indexOf(s);c!==-1&&e.splice(c,1)}},destroy(){window.removeEventListener("hashchange",r),e.length=0}}}function N(){let e=[],t=[],r=[];function i(c){return e.push(c),()=>{let n=e.indexOf(c);n!==-1&&e.splice(n,1)}}function u(c){return t.push(c),()=>{let n=t.indexOf(c);n!==-1&&t.splice(n,1)}}function s(c){return r.push(c),()=>{let n=r.indexOf(c);n!==-1&&r.splice(n,1)}}return{_beforeEachGuards:e,_beforeResolveGuards:t,_afterEachGuards:r,beforeEach:i,beforeResolve:u,afterEach:s}}function y(e,t,r){return new Promise((i,u)=>{let s=0;function c(){let a=!1;return o=>{a||(a=!0,o===!1?u(new Error("\u5BFC\u822A\u88AB\u5B88\u536B\u4E2D\u6B62")):typeof o=="string"?u(new Error("REDIRECT:"+o)):(s++,n()))}}function n(){if(s>=e.length){i();return}let a=e[s],o=c();try{let d=a(t,r,o);d!=null&&typeof d=="object"&&typeof d.then=="function"&&d.then(()=>{}).catch(f=>{!f||typeof f.message!="string"||!f.message.startsWith("REDIRECT:")?u(new Error("\u5BFC\u822A\u88AB\u5B88\u536B\u4E2D\u6B62")):u(f)})}catch(d){u(new Error("\u5BFC\u822A\u5B88\u536B\u6267\u884C\u51FA\u9519"))}}n()})}function b(e,t,r){for(let i of e)try{i(t,r)}catch(u){}}var L=require("@lytjs/reactivity");function $(e,t){return{path:e.path,fullPath:e.fullPath,params:(t==null?void 0:t.params)||{},name:t==null?void 0:t.record.name,meta:(t==null?void 0:t.record.meta)||{},query:e.query,hash:e.hash}}function C(e,t){return(0,L.reactive)({path:e.path,fullPath:e.fullPath,params:(t==null?void 0:t.params)||{},name:t==null?void 0:t.record.name,meta:(t==null?void 0:t.record.meta)||{},query:e.query,hash:e.hash,matched:t?[t.record]:[]})}function O(e){let t=m(e.routes),r=e.mode==="hash"?x():w(e.base||"/"),i=N(),u=(0,L.ref)(C(r.location,t.matchRoute(r.location.path))),s=!1,c=r.listen(async(o,d)=>{await n(o.path,d,!0)});async function n(o,d,f=!1){var g,v;if(!s){s=!0;try{let _=t.matchRoute(o),M={path:o,fullPath:o,query:{},hash:"",state:null,fromPopState:f},G=$(M,_),R=u.value,P={path:R.path,fullPath:R.fullPath,params:R.params,name:R.name,meta:R.meta,query:R.query,hash:R.hash};try{await y(i._beforeEachGuards,G,P)}catch(l){if((g=l==null?void 0:l.message)!=null&&g.startsWith("REDIRECT:")){let E=l.message.replace("REDIRECT:","");s=!1,f||r.replace(E);return}return}try{await y(i._beforeResolveGuards,G,P)}catch(l){if((v=l==null?void 0:l.message)!=null&&v.startsWith("REDIRECT:")){let E=l.message.replace("REDIRECT:","");s=!1,f||r.replace(E);return}return}let k=C(M,_);u.value=k,b(i._afterEachGuards,G,P)}finally{s=!1}}}let a={currentRoute:u,async push(o){r.push(o)},async replace(o){r.replace(o)},go(o){r.go(o)},back(){r.back()},forward(){r.forward()},beforeEach(o){return i.beforeEach(o)},afterEach(o){return i.afterEach(o)},beforeResolve(o){return i.beforeResolve(o)},addRoute(o){t.addRoute(o)},removeRoute(o){t.removeRoute(o)},getRoutes(){return t.getRoutes()},install(o){o.config&&o.config.globalProperties&&(o.config.globalProperties.$router=a,Object.defineProperty(o.config.globalProperties,"$route",{get(){return u.value}})),o.provide&&(o.provide("router",a),o.provide("route",u));let d=t.matchRoute(r.location.path);u.value=C(r.location,d)},destroy(){c(),r.destroy()}};return a}
|
|
1
|
+
"use strict";var T=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},A=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of W(t))!U.call(e,u)&&u!==r&&T(e,u,{get:()=>t[u],enumerable:!(i=S(t,u))||i.enumerable});return e};var D=e=>A(T({},"__esModule",{value:!0}),e);var j={};z(j,{createHashHistory:()=>x,createNavigationGuards:()=>N,createRouteMatcher:()=>m,createRouter:()=>O,createWebHistory:()=>w,runAfterGuards:()=>b,runGuards:()=>y});module.exports=D(j);var p=require("@lytjs/common");function H(e,t=""){let r=(0,p.normalizePath)(t,e.path),{regex:i,paramKeys:u,isWildcard:s}=(0,p.pathToRegex)(r);if(e._regex=i,e._paramKeys=u,e._isWildcard=s,e.children)for(let c of e.children)H(c,r)}function m(e){let t=[];function r(n,a=""){for(let o of n)if(H(o,a),t.push(o),o.children){let d=(0,p.normalizePath)(a,o.path);r(o.children,d)}}r(e);function i(n){let a=n.replace(/\/+$/,"")||"/";for(let o of t){if(!o._regex)continue;let d=a.match(o._regex);if(d){let f={};if(o._paramKeys)for(let g=0;g<o._paramKeys.length;g++){let v=o._paramKeys[g];f[v]=d[g+1]||""}return{record:o,params:f,matchedPath:a}}}return null}function u(n){if(H(n),t.push(n),n.children){let a=(0,p.normalizePath)("",n.path);r(n.children,a)}}function s(n){for(let a=t.length-1;a>=0;a--)t[a].name===n&&t.splice(a,1)}function c(){return[...t]}return{matchRoute:i,addRoute:u,removeRoute:s,getRoutes:c}}function K(e){let t={};if(!e||e==="?")return t;let i=(e.startsWith("?")?e.slice(1):e).split("&");for(let u of i){let s=u.indexOf("=");if(s===-1)t[decodeURIComponent(u)]="";else{let c=decodeURIComponent(u.slice(0,s)),n=decodeURIComponent(u.slice(s+1));t[c]=n}}return t}function q(e){let t=[];for(let r of Object.keys(e)){let i=e[r];i!=null&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return t.join("&")}function I(e){let t="",r=e,i=e.indexOf("#");i!==-1&&(t=e.slice(i+1),r=e.slice(0,i));let u=r,s={},c=r.indexOf("?");return c!==-1&&(u=r.slice(0,c),s=K(r.slice(c))),{path:u,query:s,hash:t}}function h(e){return e.startsWith("/")||(e="/"+e),e.replace(/\/+/g,"/")}function w(e="/"){let t=h(e),r=[],i=s(window.location.href);function u(n){let a=s(window.location.href);a.fromPopState=!0,a.state=n.state;let o=i;i=a,c(a,o)}function s(n){let a;try{a=new URL(n)}catch(v){a=new URL(n,window.location.origin)}let o=a.pathname;t!=="/"&&o.startsWith(t)&&(o=o.slice(t.length)||"/");let{path:d,query:f,hash:g}=I(o+a.hash);return{path:h(d),fullPath:h(d)+(Object.keys(f).length?"?"+q(f):"")+(g?"#"+g:""),query:f,hash:g,state:a.state||null,fromPopState:!1}}function c(n,a){for(let o of r)o(n,a)}return window.addEventListener("popstate",u),{base:t,get location(){return i},push(n,a){let o=h(n),d=i,f=(t+o).replace(/\/+/g,"/");window.history.pushState(a||null,"",f),i=s(window.location.href),i.state=a||null,c(i,d)},replace(n,a){let o=h(n),d=i,f=(t+o).replace(/\/+/g,"/");window.history.replaceState(a||null,"",f),i=s(window.location.href),i.state=a||null,c(i,d)},go(n){window.history.go(n)},back(){window.history.back()},forward(){window.history.forward()},getCurrentRoute(){return s(window.location.href)},listen(n){return r.push(n),()=>{let a=r.indexOf(n);a!==-1&&r.splice(a,1)}},destroy(){window.removeEventListener("popstate",u),r.length=0}}}function x(){let e=[],t=i();function r(){let s=i();s.fromPopState=!0;let c=t;t=s,u(s,c)}function i(){let c=window.location.hash.slice(1)||"/",{path:n,query:a,hash:o}=I(c);return{path:h(n),fullPath:h(n)+(Object.keys(a).length?"?"+q(a):"")+(o?"#"+o:""),query:a,hash:o,state:null,fromPopState:!1}}function u(s,c){for(let n of e)n(s,c)}return window.addEventListener("hashchange",r),{base:"",get location(){return t},push(s,c){let n=h(s),a=t;window.location.hash=n,t=i(),u(t,a)},replace(s,c){let n=h(s),a=t;window.location.replace(window.location.pathname+window.location.search+"#"+n),t=i(),u(t,a)},go(s){window.history.go(s)},back(){window.history.back()},forward(){window.history.forward()},getCurrentRoute(){return i()},listen(s){return e.push(s),()=>{let c=e.indexOf(s);c!==-1&&e.splice(c,1)}},destroy(){window.removeEventListener("hashchange",r),e.length=0}}}function N(){let e=[],t=[],r=[];function i(c){return e.push(c),()=>{let n=e.indexOf(c);n!==-1&&e.splice(n,1)}}function u(c){return t.push(c),()=>{let n=t.indexOf(c);n!==-1&&t.splice(n,1)}}function s(c){return r.push(c),()=>{let n=r.indexOf(c);n!==-1&&r.splice(n,1)}}return{_beforeEachGuards:e,_beforeResolveGuards:t,_afterEachGuards:r,beforeEach:i,beforeResolve:u,afterEach:s}}function y(e,t,r){return new Promise((i,u)=>{let s=0;function c(){let a=!1;return o=>{a||(a=!0,o===!1?u(new Error("\u5BFC\u822A\u88AB\u5B88\u536B\u4E2D\u6B62")):typeof o=="string"?u(new Error("REDIRECT:"+o)):(s++,n()))}}function n(){if(s>=e.length){i();return}let a=e[s],o=c();try{let d=a(t,r,o);d!=null&&typeof d=="object"&&typeof d.then=="function"&&d.then(()=>{}).catch(f=>{!f||typeof f.message!="string"||!f.message.startsWith("REDIRECT:")?u(new Error("\u5BFC\u822A\u88AB\u5B88\u536B\u4E2D\u6B62")):u(f)})}catch(d){u(new Error("\u5BFC\u822A\u5B88\u536B\u6267\u884C\u51FA\u9519"))}}n()})}function b(e,t,r){for(let i of e)try{i(t,r)}catch(u){}}var L=require("@lytjs/reactivity");function $(e,t){return{path:e.path,fullPath:e.fullPath,params:(t==null?void 0:t.params)||{},name:t==null?void 0:t.record.name,meta:(t==null?void 0:t.record.meta)||{},query:e.query,hash:e.hash}}function C(e,t){return(0,L.reactive)({path:e.path,fullPath:e.fullPath,params:(t==null?void 0:t.params)||{},name:t==null?void 0:t.record.name,meta:(t==null?void 0:t.record.meta)||{},query:e.query,hash:e.hash,matched:t?[t.record]:[]})}function O(e){let t=m(e.routes),r=e.mode==="hash"?x():w(e.base||"/"),i=N(),u=(0,L.ref)(C(r.location,t.matchRoute(r.location.path))),s=!1,c=r.listen(async(o,d)=>{await n(o.path,d,!0)});async function n(o,d,f=!1){var g,v;if(!s){s=!0;try{let _=t.matchRoute(o),M={path:o,fullPath:o,query:{},hash:"",state:null,fromPopState:f},G=$(M,_),R=u.value,P={path:R.path,fullPath:R.fullPath,params:R.params,name:R.name,meta:R.meta,query:R.query,hash:R.hash};try{await y(i._beforeEachGuards,G,P)}catch(l){if((g=l==null?void 0:l.message)!=null&&g.startsWith("REDIRECT:")){let E=l.message.replace("REDIRECT:","");s=!1,f||r.replace(E);return}return}try{await y(i._beforeResolveGuards,G,P)}catch(l){if((v=l==null?void 0:l.message)!=null&&v.startsWith("REDIRECT:")){let E=l.message.replace("REDIRECT:","");s=!1,f||r.replace(E);return}return}let k=C(M,_);u.value=k,b(i._afterEachGuards,G,P)}finally{s=!1}}}let a={currentRoute:u,async push(o){r.push(o)},async replace(o){r.replace(o)},go(o){r.go(o)},back(){r.back()},forward(){r.forward()},beforeEach(o){return i.beforeEach(o)},afterEach(o){return i.afterEach(o)},beforeResolve(o){return i.beforeResolve(o)},addRoute(o){t.addRoute(o)},removeRoute(o){t.removeRoute(o)},getRoutes(){return t.getRoutes()},install(o){o.config&&o.config.globalProperties&&(o.config.globalProperties.$router=a,Object.defineProperty(o.config.globalProperties,"$route",{get(){return u.value}})),o.provide&&(o.provide("router",a),o.provide("route",u));let d=t.matchRoute(r.location.path);u.value=C(r.location,d)},destroy(){c(),r.destroy()}};return a}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytjs/router",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Lyt.js 内置路由 - History/Hash 模式、导航守卫、动态路由",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"hash"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@lytjs/common": "^
|
|
42
|
-
"@lytjs/reactivity": "^
|
|
41
|
+
"@lytjs/common": "^5.0.0",
|
|
42
|
+
"@lytjs/reactivity": "^5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.full.d.ts","../../common/dist/types/is.d.ts","../../common/dist/types/object.d.ts","../../common/dist/types/string.d.ts","../../common/dist/types/path.d.ts","../../common/dist/types/emitter.d.ts","../../common/dist/types/subscription.d.ts","../../common/dist/types/cache.d.ts","../../common/dist/types/timing.d.ts","../../common/dist/types/scheduler.d.ts","../../common/dist/types/error-codes.d.ts","../../common/dist/types/lyt-error.d.ts","../../common/dist/types/warn.d.ts","../../common/dist/types/algorithm.d.ts","../../common/dist/types/index.d.ts","../src/matcher.ts","../src/history.ts","../src/guards.ts","../../reactivity/dist/types/effect.d.ts","../../reactivity/dist/types/reactive.d.ts","../../reactivity/dist/types/ref.d.ts","../../reactivity/dist/types/computed.d.ts","../../reactivity/dist/types/watch.d.ts","../../reactivity/dist/types/signal.d.ts","../../reactivity/dist/types/signal-component.d.ts","../../reactivity/dist/types/index.d.ts","../src/create-router.ts","../src/index.ts"],"fileIdsList":[[64,65,66,67,68,69,70,71,72,73,74,75,76],[73],[83],[81,82,83,84,85,86,87],[86],[78,79,80,88],[78,79,80,89],[77]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"2a2de5b9459b3fc44decd9ce6100b72f1b002ef523126c1d3d8b2a4a63d74d78","affectsGlobalScope":true,"impliedFormat":1},{"version":"f13f4b465c99041e912db5c44129a94588e1aafee35a50eab51044833f50b4ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"01a30f9e8582b369075c0808df71121e6855cb06fd8d3d39511d9ebb66405205","impliedFormat":1},"0242b74c149e317117aa6c97acce4ad116212ebfd963ae50bcfe8bb4fa6410d2","8220087127ce86b259fdbc78efac6cf14064a970393dd72047205a559a67a4cd","a0c71b9e3689601665669b5ad5a43d6adb2310947a3ca8e63a8bea9bf0602c95","525e3e3f106504c4e62d3564c5fea77ab17d72725981f45042ce51e9f6ae0220","66558f40fbf300cbba390965583590c6e9a874c6f95f42549fe6bf10f2ec35dd","4addbf2b9b6fcad145efc10233ce211a220cbc6a35b069d0a0467dd10ec5d855","5ef34083e9d734dfc751b5a45e046219bc29d4d9b97c51b2fad58f4305b52d7f","290759e0e7e335e470cb0b8fb085232ba92bbf53e3a6d7dfdc65423a4baf644c","0db5120e2a3e67bc5892e63f1bcf4a3d933755d5ac15fb7e1c989deb34fafd61","df3112eeed1593533b757b55fba51326c3984752f79699bc3a9c919c6556e901","1e74c319ebca519283c6be7486b2f44f2bc180f4394b8191801294081169e459","5679cb7e73eb8c28182e6455e3146ec797942cdaa0b52ece0559f1997a1dc420","9555e351c5d92cadc1e3bee2ed9735874050d48f1ab0d2f9339ab6d83865566e","df0f6ffe3276b650678e05f472d35c46ef581bc2d402dcf2c3e452a8b773b7c9",{"version":"603793a9e51bf6c663520f9350d08617a337db2f5d59a596b3d5369e9fd17215","signature":"842b72647cf352b1f26095e20535daab5c5f27f4b9a9dacbd1ba70867e9d74cb"},{"version":"88784b908ff5f0e2209192dc2b067dc0332308e0ccaa30b04425f8bf8fdaad85","signature":"245f24f4b0bd45664b67524de3c79938c0b1344d95817a575c7d84c1dff5f2d1"},{"version":"9d701d84177477f90fe4b0914b50191b486114da93167208cf88fde22051fb56","signature":"54f7410ff42ce04e8cda05074832b2c4f3d5f0dfaa4031969e15bbf3cba91044"},"a931971a0aed3a04be8ef1ef78e4bdd05af6d408bec44f846d3a0794dda5d708","f39120ae19c79ceffa561da071bbf53b5cf418f3ad9c186e895fa55c3c42ae31","5fe944eec62fa00578c1b68dd15a46847218f15c35eca212f86caed1469108e9","1bb4fc70e4d98ca7ef67079adde1ee3bfa3b3829ae948cf2ce5b7a332430ee65","132b0d4b346da8f6d6004dc9eb4bfc09c0d292e9325aff621b2332a12973199f","ecd41394ecea0650d670ed4cdba72fac8f219fdfa1cdcbfdcdeb79413d712d15","fe965a8da8781e4e6cef466ccccd5430dc040ae5f17615301f4203434701237c","5142c441d5148e0b3d8aaa232af01166540bc049913ded34fe2065e0ebe2cf16",{"version":"ae155cec03bda7fd7b1de39faa7debd475c4635289bf9e208cbfdfee339c88b3","signature":"09229d9b51efd43a4d01707771fc370c3eea40b79d51f189d990954bb68d3d50"},{"version":"167be0e311b7688ab60a4c80c2a2ddea10ba0403b14f3293e681d0f51582864b","signature":"10634d26f433c674b659e3a4962e12b2cb3d70a8ef9097bc694f6d7ecd2418d3"}],"root":[[78,80],89,90],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":99,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"referencedMap":[[77,1],[74,2],[84,3],[88,4],[87,5],[85,3],[89,6],[90,7],[78,8]],"semanticDiagnosticsPerFile":[[78,[{"start":260,"length":12,"messageText":"'escapeRegExp' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":308,"length":9,"messageText":"'matchPath' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":4297,"length":3,"messageText":"Type 'undefined' cannot be used as an index type.","category":1,"code":2538},{"start":5074,"length":13,"messageText":"Object is possibly 'undefined'.","category":1,"code":2532}]],[79,[{"start":10511,"length":5,"messageText":"'state' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":10880,"length":5,"messageText":"'state' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true}]],[80,[{"start":5563,"length":5,"messageText":"Cannot invoke an object which is possibly 'undefined'.","category":1,"code":2722},{"start":5563,"length":5,"messageText":"'guard' is possibly 'undefined'.","category":1,"code":18048}]],[89,[{"start":2647,"length":6,"code":2375,"category":1,"messageText":{"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any>; query: Record<string, string>; hash: string; }' is not assignable to type 'NavigationTarget' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.","category":1,"code":2375,"next":[{"messageText":"Types of property 'name' are incompatible.","category":1,"code":2326,"next":[{"messageText":"Type 'string | undefined' is not assignable to type 'string'.","category":1,"code":2322,"next":[{"messageText":"Type 'undefined' is not assignable to type 'string'.","category":1,"code":2322}],"canonicalHead":{"code":2375,"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any>; query: Record<string, string>; hash: string; }' is not assignable to type 'NavigationTarget' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."}}]}]}},{"start":3086,"length":6,"code":2375,"category":1,"messageText":{"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any>; query: Record<string, string>; hash: string; matched: RouteRecord[]; }' is not assignable to type 'Route' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.","category":1,"code":2375,"next":[{"messageText":"Types of property 'name' are incompatible.","category":1,"code":2326,"next":[{"messageText":"Type 'string | undefined' is not assignable to type 'string'.","category":1,"code":2322,"next":[{"messageText":"Type 'undefined' is not assignable to type 'string'.","category":1,"code":2322}],"canonicalHead":{"code":2375,"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any>; query: Record<string, string>; hash: string; matched: RouteRecord[]; }' is not assignable to type 'Route' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."}}]}]}},{"start":5154,"length":12,"messageText":"'fromLocation' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":5746,"length":4,"code":2375,"category":1,"messageText":{"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any> | undefined; query: Record<string, string>; hash: string; }' is not assignable to type 'NavigationTarget' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.","category":1,"code":2375,"next":[{"messageText":"Types of property 'name' are incompatible.","category":1,"code":2326,"next":[{"messageText":"Type 'string | undefined' is not assignable to type 'string'.","category":1,"code":2322,"next":[{"messageText":"Type 'undefined' is not assignable to type 'string'.","category":1,"code":2322}],"canonicalHead":{"code":2375,"messageText":"Type '{ path: string; fullPath: string; params: Record<string, string>; name: string | undefined; meta: Record<string, any> | undefined; query: Record<string, string>; hash: string; }' is not assignable to type 'NavigationTarget' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."}}]}]}}]]],"latestChangedDtsFile":"./types/index.d.ts","version":"6.0.2"}
|