feat: enable composable auto import

This commit is contained in:
Anthony Fu 2022-05-24 15:20:14 +08:00
parent 00a2808e8a
commit 503e5b5473
5 changed files with 696 additions and 463 deletions

262
auto-imports.d.ts vendored
View File

@ -1,13 +1,14 @@
// Generated by 'unplugin-auto-import'
// We suggest you to commit this file into source control
export {}
declare global {
const $: typeof import('vue/macros')['$']
const $$: typeof import('vue/macros')['$$']
const $: typeof import('vue/macros')['$']
const $computed: typeof import('vue/macros')['$computed']
const $customRef: typeof import('vue/macros')['$customRef']
const $ref: typeof import('vue/macros')['$ref']
const $shallowRef: typeof import('vue/macros')['$shallowRef']
const $toRef: typeof import('vue/macros')['$toRef']
const EffectScope: typeof import('vue')['EffectScope']
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
const computed: typeof import('vue')['computed']
@ -31,13 +32,13 @@ declare global {
const defineComponent: typeof import('vue')['defineComponent']
const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
const effectScope: typeof import('vue')['effectScope']
const EffectScope: typeof import('vue')['EffectScope']
const extendRef: typeof import('@vueuse/core')['extendRef']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
const inject: typeof import('vue')['inject']
const isDark: typeof import('./src/composables/dark')['isDark']
const isDefined: typeof import('@vueuse/core')['isDefined']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
@ -92,6 +93,7 @@ declare global {
const toReactive: typeof import('@vueuse/core')['toReactive']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toggleDark: typeof import('./src/composables/dark')['toggleDark']
const triggerRef: typeof import('vue')['triggerRef']
const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
@ -124,8 +126,8 @@ declare global {
const useDark: typeof import('@vueuse/core')['useDark']
const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
const useDebounce: typeof import('@vueuse/core')['useDebounce']
const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
@ -205,8 +207,8 @@ declare global {
const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
const useThrottle: typeof import('@vueuse/core')['useThrottle']
const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
const useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']
const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
const useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']
const useTimeout: typeof import('@vueuse/core')['useTimeout']
const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']
@ -217,10 +219,10 @@ declare global {
const useTransition: typeof import('@vueuse/core')['useTransition']
const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']
const useUserMedia: typeof import('@vueuse/core')['useUserMedia']
const useVibrate: typeof import('@vueuse/core')['useVibrate']
const useVirtualList: typeof import('@vueuse/core')['useVirtualList']
const useVModel: typeof import('@vueuse/core')['useVModel']
const useVModels: typeof import('@vueuse/core')['useVModels']
const useVibrate: typeof import('@vueuse/core')['useVibrate']
const useVirtualList: typeof import('@vueuse/core')['useVirtualList']
const useWakeLock: typeof import('@vueuse/core')['useWakeLock']
const useWebNotification: typeof import('@vueuse/core')['useWebNotification']
const useWebSocket: typeof import('@vueuse/core')['useWebSocket']
@ -240,4 +242,248 @@ declare global {
const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
const whenever: typeof import('@vueuse/core')['whenever']
}
export {}
// for vue template auto import
declare module 'vue' {
interface ComponentCustomProperties {
$$: typeof import('vue/macros')['$$']
$: typeof import('vue/macros')['$']
$computed: typeof import('vue/macros')['$computed']
$customRef: typeof import('vue/macros')['$customRef']
$ref: typeof import('vue/macros')['$ref']
$shallowRef: typeof import('vue/macros')['$shallowRef']
$toRef: typeof import('vue/macros')['$toRef']
EffectScope: typeof import('vue')['EffectScope']
asyncComputed: typeof import('@vueuse/core')['asyncComputed']
autoResetRef: typeof import('@vueuse/core')['autoResetRef']
computed: typeof import('vue')['computed']
computedAsync: typeof import('@vueuse/core')['computedAsync']
computedEager: typeof import('@vueuse/core')['computedEager']
computedInject: typeof import('@vueuse/core')['computedInject']
computedWithControl: typeof import('@vueuse/core')['computedWithControl']
controlledComputed: typeof import('@vueuse/core')['controlledComputed']
controlledRef: typeof import('@vueuse/core')['controlledRef']
createApp: typeof import('vue')['createApp']
createEventHook: typeof import('@vueuse/core')['createEventHook']
createGlobalState: typeof import('@vueuse/core')['createGlobalState']
createInjectionState: typeof import('@vueuse/core')['createInjectionState']
createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']
createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']
createUnrefFn: typeof import('@vueuse/core')['createUnrefFn']
customRef: typeof import('vue')['customRef']
debouncedRef: typeof import('@vueuse/core')['debouncedRef']
debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
defineComponent: typeof import('vue')['defineComponent']
eagerComputed: typeof import('@vueuse/core')['eagerComputed']
effectScope: typeof import('vue')['effectScope']
extendRef: typeof import('@vueuse/core')['extendRef']
getCurrentInstance: typeof import('vue')['getCurrentInstance']
getCurrentScope: typeof import('vue')['getCurrentScope']
h: typeof import('vue')['h']
ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
inject: typeof import('vue')['inject']
isDark: typeof import('./src/composables/dark')['isDark']
isDefined: typeof import('@vueuse/core')['isDefined']
isReadonly: typeof import('vue')['isReadonly']
isRef: typeof import('vue')['isRef']
logicAnd: typeof import('@vueuse/core')['logicAnd']
logicNot: typeof import('@vueuse/core')['logicNot']
logicOr: typeof import('@vueuse/core')['logicOr']
makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']
markRaw: typeof import('vue')['markRaw']
nextTick: typeof import('vue')['nextTick']
onActivated: typeof import('vue')['onActivated']
onBeforeMount: typeof import('vue')['onBeforeMount']
onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
onClickOutside: typeof import('@vueuse/core')['onClickOutside']
onDeactivated: typeof import('vue')['onDeactivated']
onErrorCaptured: typeof import('vue')['onErrorCaptured']
onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']
onLongPress: typeof import('@vueuse/core')['onLongPress']
onMounted: typeof import('vue')['onMounted']
onRenderTracked: typeof import('vue')['onRenderTracked']
onRenderTriggered: typeof import('vue')['onRenderTriggered']
onScopeDispose: typeof import('vue')['onScopeDispose']
onServerPrefetch: typeof import('vue')['onServerPrefetch']
onStartTyping: typeof import('@vueuse/core')['onStartTyping']
onUnmounted: typeof import('vue')['onUnmounted']
onUpdated: typeof import('vue')['onUpdated']
pausableWatch: typeof import('@vueuse/core')['pausableWatch']
provide: typeof import('vue')['provide']
reactify: typeof import('@vueuse/core')['reactify']
reactifyObject: typeof import('@vueuse/core')['reactifyObject']
reactive: typeof import('vue')['reactive']
reactiveComputed: typeof import('@vueuse/core')['reactiveComputed']
reactiveOmit: typeof import('@vueuse/core')['reactiveOmit']
reactivePick: typeof import('@vueuse/core')['reactivePick']
readonly: typeof import('vue')['readonly']
ref: typeof import('vue')['ref']
refAutoReset: typeof import('@vueuse/core')['refAutoReset']
refDebounced: typeof import('@vueuse/core')['refDebounced']
refDefault: typeof import('@vueuse/core')['refDefault']
refThrottled: typeof import('@vueuse/core')['refThrottled']
refWithControl: typeof import('@vueuse/core')['refWithControl']
resolveComponent: typeof import('vue')['resolveComponent']
shallowReactive: typeof import('vue')['shallowReactive']
shallowReadonly: typeof import('vue')['shallowReadonly']
shallowRef: typeof import('vue')['shallowRef']
syncRef: typeof import('@vueuse/core')['syncRef']
syncRefs: typeof import('@vueuse/core')['syncRefs']
templateRef: typeof import('@vueuse/core')['templateRef']
throttledRef: typeof import('@vueuse/core')['throttledRef']
throttledWatch: typeof import('@vueuse/core')['throttledWatch']
toRaw: typeof import('vue')['toRaw']
toReactive: typeof import('@vueuse/core')['toReactive']
toRef: typeof import('vue')['toRef']
toRefs: typeof import('vue')['toRefs']
toggleDark: typeof import('./src/composables/dark')['toggleDark']
triggerRef: typeof import('vue')['triggerRef']
tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
tryOnMounted: typeof import('@vueuse/core')['tryOnMounted']
tryOnScopeDispose: typeof import('@vueuse/core')['tryOnScopeDispose']
tryOnUnmounted: typeof import('@vueuse/core')['tryOnUnmounted']
unref: typeof import('vue')['unref']
unrefElement: typeof import('@vueuse/core')['unrefElement']
until: typeof import('@vueuse/core')['until']
useActiveElement: typeof import('@vueuse/core')['useActiveElement']
useAsyncQueue: typeof import('@vueuse/core')['useAsyncQueue']
useAsyncState: typeof import('@vueuse/core')['useAsyncState']
useAttrs: typeof import('vue')['useAttrs']
useBase64: typeof import('@vueuse/core')['useBase64']
useBattery: typeof import('@vueuse/core')['useBattery']
useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
useCached: typeof import('@vueuse/core')['useCached']
useClamp: typeof import('@vueuse/core')['useClamp']
useClipboard: typeof import('@vueuse/core')['useClipboard']
useColorMode: typeof import('@vueuse/core')['useColorMode']
useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
useCounter: typeof import('@vueuse/core')['useCounter']
useCssModule: typeof import('vue')['useCssModule']
useCssVar: typeof import('@vueuse/core')['useCssVar']
useCssVars: typeof import('vue')['useCssVars']
useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
useCycleList: typeof import('@vueuse/core')['useCycleList']
useDark: typeof import('@vueuse/core')['useDark']
useDateFormat: typeof import('@vueuse/core')['useDateFormat']
useDebounce: typeof import('@vueuse/core')['useDebounce']
useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
useDevicesList: typeof import('@vueuse/core')['useDevicesList']
useDisplayMedia: typeof import('@vueuse/core')['useDisplayMedia']
useDocumentVisibility: typeof import('@vueuse/core')['useDocumentVisibility']
useDraggable: typeof import('@vueuse/core')['useDraggable']
useElementBounding: typeof import('@vueuse/core')['useElementBounding']
useElementByPoint: typeof import('@vueuse/core')['useElementByPoint']
useElementHover: typeof import('@vueuse/core')['useElementHover']
useElementSize: typeof import('@vueuse/core')['useElementSize']
useElementVisibility: typeof import('@vueuse/core')['useElementVisibility']
useEventBus: typeof import('@vueuse/core')['useEventBus']
useEventListener: typeof import('@vueuse/core')['useEventListener']
useEventSource: typeof import('@vueuse/core')['useEventSource']
useEyeDropper: typeof import('@vueuse/core')['useEyeDropper']
useFavicon: typeof import('@vueuse/core')['useFavicon']
useFetch: typeof import('@vueuse/core')['useFetch']
useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
useFocus: typeof import('@vueuse/core')['useFocus']
useFocusWithin: typeof import('@vueuse/core')['useFocusWithin']
useFps: typeof import('@vueuse/core')['useFps']
useFullscreen: typeof import('@vueuse/core')['useFullscreen']
useGamepad: typeof import('@vueuse/core')['useGamepad']
useGeolocation: typeof import('@vueuse/core')['useGeolocation']
useIdle: typeof import('@vueuse/core')['useIdle']
useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']
useInterval: typeof import('@vueuse/core')['useInterval']
useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']
useLastChanged: typeof import('@vueuse/core')['useLastChanged']
useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']
useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']
useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']
useMediaControls: typeof import('@vueuse/core')['useMediaControls']
useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
useMemoize: typeof import('@vueuse/core')['useMemoize']
useMemory: typeof import('@vueuse/core')['useMemory']
useMounted: typeof import('@vueuse/core')['useMounted']
useMouse: typeof import('@vueuse/core')['useMouse']
useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
useMousePressed: typeof import('@vueuse/core')['useMousePressed']
useMutationObserver: typeof import('@vueuse/core')['useMutationObserver']
useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']
useNetwork: typeof import('@vueuse/core')['useNetwork']
useNow: typeof import('@vueuse/core')['useNow']
useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
useOnline: typeof import('@vueuse/core')['useOnline']
usePageLeave: typeof import('@vueuse/core')['usePageLeave']
useParallax: typeof import('@vueuse/core')['useParallax']
usePermission: typeof import('@vueuse/core')['usePermission']
usePointer: typeof import('@vueuse/core')['usePointer']
usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']
usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
useRafFn: typeof import('@vueuse/core')['useRafFn']
useRefHistory: typeof import('@vueuse/core')['useRefHistory']
useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
useRoute: typeof import('vue-router')['useRoute']
useRouter: typeof import('vue-router')['useRouter']
useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
useScriptTag: typeof import('@vueuse/core')['useScriptTag']
useScroll: typeof import('@vueuse/core')['useScroll']
useScrollLock: typeof import('@vueuse/core')['useScrollLock']
useSessionStorage: typeof import('@vueuse/core')['useSessionStorage']
useShare: typeof import('@vueuse/core')['useShare']
useSlots: typeof import('vue')['useSlots']
useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition']
useSpeechSynthesis: typeof import('@vueuse/core')['useSpeechSynthesis']
useStorage: typeof import('@vueuse/core')['useStorage']
useStorageAsync: typeof import('@vueuse/core')['useStorageAsync']
useStyleTag: typeof import('@vueuse/core')['useStyleTag']
useSwipe: typeof import('@vueuse/core')['useSwipe']
useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
useTextSelection: typeof import('@vueuse/core')['useTextSelection']
useThrottle: typeof import('@vueuse/core')['useThrottle']
useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']
useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']
useTimeout: typeof import('@vueuse/core')['useTimeout']
useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']
useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll']
useTimestamp: typeof import('@vueuse/core')['useTimestamp']
useTitle: typeof import('@vueuse/core')['useTitle']
useToggle: typeof import('@vueuse/core')['useToggle']
useTransition: typeof import('@vueuse/core')['useTransition']
useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']
useUserMedia: typeof import('@vueuse/core')['useUserMedia']
useVModel: typeof import('@vueuse/core')['useVModel']
useVModels: typeof import('@vueuse/core')['useVModels']
useVibrate: typeof import('@vueuse/core')['useVibrate']
useVirtualList: typeof import('@vueuse/core')['useVirtualList']
useWakeLock: typeof import('@vueuse/core')['useWakeLock']
useWebNotification: typeof import('@vueuse/core')['useWebNotification']
useWebSocket: typeof import('@vueuse/core')['useWebSocket']
useWebWorker: typeof import('@vueuse/core')['useWebWorker']
useWebWorkerFn: typeof import('@vueuse/core')['useWebWorkerFn']
useWindowFocus: typeof import('@vueuse/core')['useWindowFocus']
useWindowScroll: typeof import('@vueuse/core')['useWindowScroll']
useWindowSize: typeof import('@vueuse/core')['useWindowSize']
watch: typeof import('vue')['watch']
watchAtMost: typeof import('@vueuse/core')['watchAtMost']
watchDebounced: typeof import('@vueuse/core')['watchDebounced']
watchEffect: typeof import('vue')['watchEffect']
watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']
watchOnce: typeof import('@vueuse/core')['watchOnce']
watchPausable: typeof import('@vueuse/core')['watchPausable']
watchThrottled: typeof import('@vueuse/core')['watchThrottled']
watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
whenever: typeof import('@vueuse/core')['whenever']
}
}

View File

@ -10,28 +10,28 @@
"test": "vitest"
},
"dependencies": {
"@vueuse/core": "^8.4.2",
"vue": "^3.2.33",
"@vueuse/core": "^8.5.0",
"vue": "^3.2.36",
"vue-router": "^4.0.15"
},
"devDependencies": {
"@antfu/eslint-config": "^0.23.0",
"@iconify-json/carbon": "^1.1.4",
"@types/node": "^17.0.32",
"@unocss/reset": "^0.33.2",
"@vitejs/plugin-vue": "^2.3.2",
"@vue/test-utils": "^2.0.0-rc.21",
"eslint": "^8.15.0",
"@antfu/eslint-config": "^0.23.1",
"@iconify-json/carbon": "^1.1.5",
"@types/node": "^17.0.35",
"@unocss/reset": "^0.34.1",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/test-utils": "^2.0.0",
"eslint": "^8.16.0",
"jsdom": "^19.0.0",
"pnpm": "^7.0.1",
"pnpm": "^7.1.5",
"typescript": "^4.6.4",
"unocss": "^0.33.2",
"unplugin-auto-import": "^0.7.1",
"unocss": "^0.34.1",
"unplugin-auto-import": "^0.8.1",
"unplugin-vue-components": "^0.19.5",
"vite": "^2.9.8",
"vite": "^2.9.9",
"vite-plugin-pages": "^0.23.0",
"vitest": "^0.12.4",
"vue-tsc": "^0.34.12"
"vitest": "^0.12.9",
"vue-tsc": "^0.34.16"
},
"eslintConfig": {
"extends": "@antfu"

859
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,3 @@
<script setup lang="ts">
import { isDark, toggleDark } from '~/composables'
</script>
<template>
<nav text-xl mt-6 inline-flex gap-2>
<button class="icon-btn !outline-none" @click="toggleDark()">

View File

@ -31,6 +31,10 @@ export default defineConfig({
'@vueuse/core',
],
dts: true,
dirs: [
'./src/composables'
],
vueTemplate: true
}),
// https://github.com/antfu/vite-plugin-components