2022-03-16 12:13:50 +00:00
|
|
|
import { defineUnimportPreset, Preset } from 'unimport'
|
2022-03-11 08:09:11 +00:00
|
|
|
|
2022-08-17 15:23:13 +00:00
|
|
|
const commonPresets: Preset[] = [
|
2022-04-05 14:02:29 +00:00
|
|
|
// #head
|
2022-03-11 08:09:11 +00:00
|
|
|
defineUnimportPreset({
|
2022-04-05 14:02:29 +00:00
|
|
|
from: '#head',
|
2022-03-11 08:09:11 +00:00
|
|
|
imports: [
|
2022-04-05 14:02:29 +00:00
|
|
|
'useHead',
|
2022-03-11 08:09:11 +00:00
|
|
|
'useMeta'
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
// vue-demi (mocked)
|
|
|
|
defineUnimportPreset({
|
|
|
|
from: 'vue-demi',
|
|
|
|
imports: [
|
|
|
|
'isVue2',
|
|
|
|
'isVue3'
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
|
|
|
|
2022-08-17 15:23:13 +00:00
|
|
|
const appPreset = defineUnimportPreset({
|
2022-03-11 08:09:11 +00:00
|
|
|
from: '#app',
|
|
|
|
imports: [
|
|
|
|
'useAsyncData',
|
|
|
|
'useLazyAsyncData',
|
2022-03-28 17:12:41 +00:00
|
|
|
'refreshNuxtData',
|
2022-03-11 08:09:11 +00:00
|
|
|
'defineNuxtComponent',
|
|
|
|
'useNuxtApp',
|
|
|
|
'defineNuxtPlugin',
|
|
|
|
'useRuntimeConfig',
|
|
|
|
'useState',
|
|
|
|
'useFetch',
|
|
|
|
'useLazyFetch',
|
|
|
|
'useCookie',
|
|
|
|
'useRequestHeaders',
|
2022-04-07 11:28:04 +00:00
|
|
|
'useRequestEvent',
|
2022-08-02 16:01:59 +00:00
|
|
|
'setResponseStatus',
|
2022-08-31 08:02:48 +00:00
|
|
|
'setPageLayout',
|
2022-03-11 08:09:11 +00:00
|
|
|
'useRouter',
|
|
|
|
'useRoute',
|
2022-04-06 12:45:18 +00:00
|
|
|
'useActiveRoute',
|
2022-03-11 08:09:11 +00:00
|
|
|
'defineNuxtRouteMiddleware',
|
|
|
|
'navigateTo',
|
|
|
|
'abortNavigation',
|
2022-03-11 08:22:16 +00:00
|
|
|
'addRouteMiddleware',
|
|
|
|
'throwError',
|
2022-07-21 14:29:03 +00:00
|
|
|
'showError',
|
2022-03-11 08:22:16 +00:00
|
|
|
'clearError',
|
2022-07-21 14:29:03 +00:00
|
|
|
'isNuxtError',
|
2022-03-14 13:36:32 +00:00
|
|
|
'useError',
|
2022-07-21 14:29:03 +00:00
|
|
|
'createError',
|
2022-08-17 15:23:13 +00:00
|
|
|
'defineNuxtLink',
|
|
|
|
'useAppConfig',
|
2022-08-24 16:35:02 +00:00
|
|
|
'updateAppConfig',
|
2022-08-23 19:12:22 +00:00
|
|
|
'defineAppConfig',
|
|
|
|
'preloadComponents',
|
2022-09-10 13:57:16 +00:00
|
|
|
'prefetchComponents',
|
|
|
|
'loadPayload',
|
|
|
|
'preloadPayload',
|
|
|
|
'isPrerendered'
|
2022-03-11 08:09:11 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
// vue
|
2022-08-17 15:23:13 +00:00
|
|
|
const vuePreset = defineUnimportPreset({
|
2022-03-11 08:09:11 +00:00
|
|
|
from: 'vue',
|
|
|
|
imports: [
|
|
|
|
// <script setup>
|
|
|
|
'withCtx',
|
|
|
|
'withDirectives',
|
|
|
|
'withKeys',
|
|
|
|
'withMemo',
|
|
|
|
'withModifiers',
|
|
|
|
'withScopeId',
|
|
|
|
|
|
|
|
// Lifecycle
|
|
|
|
'onActivated',
|
|
|
|
'onBeforeMount',
|
|
|
|
'onBeforeUnmount',
|
|
|
|
'onBeforeUpdate',
|
|
|
|
'onDeactivated',
|
|
|
|
'onErrorCaptured',
|
|
|
|
'onMounted',
|
|
|
|
'onRenderTracked',
|
|
|
|
'onRenderTriggered',
|
|
|
|
'onServerPrefetch',
|
|
|
|
'onUnmounted',
|
|
|
|
'onUpdated',
|
|
|
|
|
|
|
|
// Reactivity
|
|
|
|
'computed',
|
|
|
|
'customRef',
|
|
|
|
'isProxy',
|
|
|
|
'isReactive',
|
|
|
|
'isReadonly',
|
|
|
|
'isRef',
|
|
|
|
'markRaw',
|
|
|
|
'proxyRefs',
|
|
|
|
'reactive',
|
|
|
|
'readonly',
|
|
|
|
'ref',
|
|
|
|
'shallowReactive',
|
|
|
|
'shallowReadonly',
|
|
|
|
'shallowRef',
|
|
|
|
'toRaw',
|
|
|
|
'toRef',
|
|
|
|
'toRefs',
|
|
|
|
'triggerRef',
|
|
|
|
'unref',
|
|
|
|
'watch',
|
|
|
|
'watchEffect',
|
|
|
|
'isShallow',
|
|
|
|
|
|
|
|
// effect
|
|
|
|
'effect',
|
|
|
|
'effectScope',
|
|
|
|
'getCurrentScope',
|
|
|
|
'onScopeDispose',
|
|
|
|
|
|
|
|
// Component
|
|
|
|
'defineComponent',
|
|
|
|
'defineAsyncComponent',
|
2022-03-22 17:04:31 +00:00
|
|
|
'resolveComponent',
|
2022-03-11 08:09:11 +00:00
|
|
|
'getCurrentInstance',
|
|
|
|
'h',
|
|
|
|
'inject',
|
|
|
|
'nextTick',
|
|
|
|
'provide',
|
|
|
|
'useAttrs',
|
|
|
|
'useCssModule',
|
|
|
|
'useCssVars',
|
|
|
|
'useSlots',
|
|
|
|
'useTransitionState'
|
|
|
|
] as Array<keyof typeof import('vue')>
|
|
|
|
})
|
|
|
|
|
|
|
|
export const defaultPresets = [
|
|
|
|
...commonPresets,
|
|
|
|
appPreset,
|
|
|
|
vuePreset
|
|
|
|
]
|