Skip to content

Commit a9a8f12

Browse files
authored
feat: replace vite-plugin-pages by unplugin-vue-router (antfu-collective#43)
1 parent a512b60 commit a9a8f12

10 files changed

+208
-179
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ See [Vitesse](https://github.com/antfu/vitesse) for full featureset.
6565
### Plugins
6666

6767
- [Vue Router](https://github.com/vuejs/vue-router)
68-
- [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) - file system based routing
68+
- [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) - file system based routing
6969
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - Directly use Vue Composition API and others without importing
7070
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - components auto import
7171
- [`unplugin-vue-macros`](https://github.com/sxzz/unplugin-vue-macros) - Explore and extend more macros and syntax sugar to Vue.

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
### 插件
6565

6666
- [Vue Router](https://github.com/vuejs/vue-router)
67-
- [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) - 以文件系统为基础的路由
67+
- [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) - 以文件系统为基础的路由
6868
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - 直接使用 Composition API 等,无需导入
6969
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - 自动加载组件
7070
- [`unplugin-vue-macros`](https://github.com/sxzz/unplugin-vue-macros) - 探索并扩展更多的宏和语法糖到 Vue 中

auto-imports.d.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ declare global {
2929
const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
3030
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
3131
const defineComponent: typeof import('vue')['defineComponent']
32+
const defineLoader: typeof import('vue-router/auto')['defineLoader']
33+
const definePage: typeof import('unplugin-vue-router/runtime')['_definePage']
3234
const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
3335
const effectScope: typeof import('vue')['effectScope']
3436
const extendRef: typeof import('@vueuse/core')['extendRef']
@@ -49,8 +51,8 @@ declare global {
4951
const nextTick: typeof import('vue')['nextTick']
5052
const onActivated: typeof import('vue')['onActivated']
5153
const onBeforeMount: typeof import('vue')['onBeforeMount']
52-
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
53-
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
54+
const onBeforeRouteLeave: typeof import('vue-router/auto')['onBeforeRouteLeave']
55+
const onBeforeRouteUpdate: typeof import('vue-router/auto')['onBeforeRouteUpdate']
5456
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
5557
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
5658
const onClickOutside: typeof import('@vueuse/core')['onClickOutside']
@@ -182,7 +184,7 @@ declare global {
182184
const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
183185
const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']
184186
const useLastChanged: typeof import('@vueuse/core')['useLastChanged']
185-
const useLink: typeof import('vue-router')['useLink']
187+
const useLink: typeof import('vue-router/auto')['useLink']
186188
const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']
187189
const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']
188190
const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']
@@ -218,8 +220,8 @@ declare global {
218220
const useRafFn: typeof import('@vueuse/core')['useRafFn']
219221
const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
220222
const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
221-
const useRoute: typeof import('vue-router')['useRoute']
222-
const useRouter: typeof import('vue-router')['useRouter']
223+
const useRoute: typeof import('vue-router/auto')['useRoute']
224+
const useRouter: typeof import('vue-router/auto')['useRouter']
223225
const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
224226
const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
225227
const useScriptTag: typeof import('@vueuse/core')['useScriptTag']
@@ -318,6 +320,8 @@ declare module 'vue' {
318320
readonly debouncedWatch: UnwrapRef<typeof import('@vueuse/core')['debouncedWatch']>
319321
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
320322
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
323+
readonly defineLoader: UnwrapRef<typeof import('vue-router/auto')['defineLoader']>
324+
readonly definePage: UnwrapRef<typeof import('unplugin-vue-router/runtime')['_definePage']>
321325
readonly eagerComputed: UnwrapRef<typeof import('@vueuse/core')['eagerComputed']>
322326
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
323327
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
@@ -338,8 +342,8 @@ declare module 'vue' {
338342
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
339343
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
340344
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
341-
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
342-
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
345+
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router/auto')['onBeforeRouteLeave']>
346+
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router/auto')['onBeforeRouteUpdate']>
343347
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
344348
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
345349
readonly onClickOutside: UnwrapRef<typeof import('@vueuse/core')['onClickOutside']>
@@ -471,7 +475,7 @@ declare module 'vue' {
471475
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
472476
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
473477
readonly useLastChanged: UnwrapRef<typeof import('@vueuse/core')['useLastChanged']>
474-
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
478+
readonly useLink: UnwrapRef<typeof import('vue-router/auto')['useLink']>
475479
readonly useLocalStorage: UnwrapRef<typeof import('@vueuse/core')['useLocalStorage']>
476480
readonly useMagicKeys: UnwrapRef<typeof import('@vueuse/core')['useMagicKeys']>
477481
readonly useManualRefHistory: UnwrapRef<typeof import('@vueuse/core')['useManualRefHistory']>
@@ -507,8 +511,8 @@ declare module 'vue' {
507511
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
508512
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
509513
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
510-
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
511-
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
514+
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
515+
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
512516
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
513517
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
514518
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>
@@ -601,6 +605,8 @@ declare module '@vue/runtime-core' {
601605
readonly debouncedWatch: UnwrapRef<typeof import('@vueuse/core')['debouncedWatch']>
602606
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
603607
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
608+
readonly defineLoader: UnwrapRef<typeof import('vue-router/auto')['defineLoader']>
609+
readonly definePage: UnwrapRef<typeof import('unplugin-vue-router/runtime')['_definePage']>
604610
readonly eagerComputed: UnwrapRef<typeof import('@vueuse/core')['eagerComputed']>
605611
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
606612
readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
@@ -621,8 +627,8 @@ declare module '@vue/runtime-core' {
621627
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
622628
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
623629
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
624-
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
625-
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
630+
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router/auto')['onBeforeRouteLeave']>
631+
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router/auto')['onBeforeRouteUpdate']>
626632
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
627633
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
628634
readonly onClickOutside: UnwrapRef<typeof import('@vueuse/core')['onClickOutside']>
@@ -754,7 +760,7 @@ declare module '@vue/runtime-core' {
754760
readonly useIntervalFn: UnwrapRef<typeof import('@vueuse/core')['useIntervalFn']>
755761
readonly useKeyModifier: UnwrapRef<typeof import('@vueuse/core')['useKeyModifier']>
756762
readonly useLastChanged: UnwrapRef<typeof import('@vueuse/core')['useLastChanged']>
757-
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
763+
readonly useLink: UnwrapRef<typeof import('vue-router/auto')['useLink']>
758764
readonly useLocalStorage: UnwrapRef<typeof import('@vueuse/core')['useLocalStorage']>
759765
readonly useMagicKeys: UnwrapRef<typeof import('@vueuse/core')['useMagicKeys']>
760766
readonly useManualRefHistory: UnwrapRef<typeof import('@vueuse/core')['useManualRefHistory']>
@@ -790,8 +796,8 @@ declare module '@vue/runtime-core' {
790796
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
791797
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
792798
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
793-
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
794-
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
799+
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
800+
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
795801
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
796802
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
797803
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"unplugin-auto-import": "^0.16.7",
4040
"unplugin-vue-components": "^0.25.2",
4141
"unplugin-vue-macros": "^2.6.2",
42+
"unplugin-vue-router": "^0.7.0",
4243
"vite": "^4.5.0",
43-
"vite-plugin-pages": "^0.31.0",
4444
"vitest": "^0.34.6",
4545
"vue-tsc": "^1.8.22"
4646
},

0 commit comments

Comments
 (0)