create-bubbles 0.1.2 → 0.1.3
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/dist/index.js +1 -1
- package/package.json +1 -1
- package/template-vue-rolldown-oxc/.gitlab-ci.yml +10 -2
- package/template-vue-rolldown-oxc/.oxlintrc.json +1 -14
- package/template-vue-rolldown-oxc/.vscode/settings.json +11 -0
- package/template-vue-rolldown-oxc/README.md +2 -30
- package/template-vue-rolldown-oxc/package.json +18 -16
- package/template-vue-rolldown-oxc/src/App.vue +12 -2
- package/template-vue-rolldown-oxc/src/utils/request/index.ts +1 -3
- package/template-vue-rolldown-oxc/src/views/home/index.vue +3 -2
- package/template-vue-rolldown-oxc/tsconfig.json +34 -2
- package/template-vue-rolldown-oxc/uno.config.ts +2 -5
- package/template-vue-rolldown-oxc/vite.config.ts +4 -3
- package/template-vue-vite-biome/.env +4 -0
- package/template-vue-vite-biome/.env.development +1 -0
- package/template-vue-vite-biome/.env.production +1 -0
- package/template-vue-vite-biome/.gitlab-ci.yml +84 -0
- package/template-vue-vite-biome/.vscode/settings.json +10 -0
- package/template-vue-vite-biome/README.md +3 -0
- package/template-vue-vite-biome/biome.json +104 -0
- package/template-vue-vite-biome/commitlint.config.js +1 -0
- package/template-vue-vite-biome/index.html +13 -0
- package/template-vue-vite-biome/lefthook.yml +11 -0
- package/template-vue-vite-biome/package.json +50 -0
- package/template-vue-vite-biome/public/vite.svg +1 -0
- package/template-vue-vite-biome/src/App.vue +19 -0
- package/template-vue-vite-biome/src/assets/icon/vue.svg +1 -0
- package/template-vue-vite-biome/src/components/Icon/svg-icon.vue +29 -0
- package/template-vue-vite-biome/src/layout/default/index.vue +3 -0
- package/template-vue-vite-biome/src/main.ts +15 -0
- package/template-vue-vite-biome/src/router/guard/index.ts +7 -0
- package/template-vue-vite-biome/src/router/guard/permissionGuard.ts +13 -0
- package/template-vue-vite-biome/src/router/index.ts +17 -0
- package/template-vue-vite-biome/src/router/modules/index.ts +31 -0
- package/template-vue-vite-biome/src/store/index.ts +10 -0
- package/template-vue-vite-biome/src/store/modules/user.ts +17 -0
- package/template-vue-vite-biome/src/styles/element-plus-variables.css +4 -0
- package/template-vue-vite-biome/src/styles/font.scss +0 -0
- package/template-vue-vite-biome/src/styles/index.scss +31 -0
- package/template-vue-vite-biome/src/styles/variables.scss +3 -0
- package/template-vue-vite-biome/src/types/vite-env.d.ts +13 -0
- package/template-vue-vite-biome/src/utils/env.ts +10 -0
- package/template-vue-vite-biome/src/utils/request/core/index.ts +166 -0
- package/template-vue-vite-biome/src/utils/request/core/utils.ts +38 -0
- package/template-vue-vite-biome/src/utils/request/index.ts +39 -0
- package/template-vue-vite-biome/src/views/home/index.vue +16 -0
- package/template-vue-vite-biome/src/views/login/index.vue +11 -0
- package/template-vue-vite-biome/src/views/model/index.vue +7 -0
- package/{template-vue-rolldown-oxc/tsconfig.app.json → template-vue-vite-biome/tsconfig.json} +15 -4
- package/template-vue-vite-biome/uno.config.ts +10 -0
- package/template-vue-vite-biome/vite.config.ts +51 -0
- package/template-vue-vite-eslint/.env +4 -0
- package/template-vue-vite-eslint/.env.development +1 -0
- package/template-vue-vite-eslint/.env.production +1 -0
- package/template-vue-vite-eslint/.gitlab-ci.yml +84 -0
- package/template-vue-vite-eslint/.vscode/settings.json +54 -0
- package/template-vue-vite-eslint/README.md +3 -0
- package/template-vue-vite-eslint/commitlint.config.js +1 -0
- package/template-vue-vite-eslint/eslint.config.js +64 -0
- package/template-vue-vite-eslint/index.html +13 -0
- package/template-vue-vite-eslint/lefthook.yml +11 -0
- package/template-vue-vite-eslint/package.json +54 -0
- package/template-vue-vite-eslint/public/vite.svg +1 -0
- package/template-vue-vite-eslint/src/App.vue +19 -0
- package/template-vue-vite-eslint/src/assets/icon/vue.svg +1 -0
- package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +29 -0
- package/template-vue-vite-eslint/src/layout/default/index.vue +3 -0
- package/template-vue-vite-eslint/src/main.ts +16 -0
- package/template-vue-vite-eslint/src/router/guard/index.ts +7 -0
- package/template-vue-vite-eslint/src/router/guard/permissionGuard.ts +13 -0
- package/template-vue-vite-eslint/src/router/index.ts +18 -0
- package/template-vue-vite-eslint/src/router/modules/index.ts +31 -0
- package/template-vue-vite-eslint/src/store/index.ts +11 -0
- package/template-vue-vite-eslint/src/store/modules/user.ts +20 -0
- package/template-vue-vite-eslint/src/styles/element-plus-variables.css +4 -0
- package/template-vue-vite-eslint/src/styles/font.scss +0 -0
- package/template-vue-vite-eslint/src/styles/index.scss +30 -0
- package/template-vue-vite-eslint/src/styles/variables.scss +3 -0
- package/template-vue-vite-eslint/src/types/vite-env.d.ts +15 -0
- package/template-vue-vite-eslint/src/utils/env.ts +10 -0
- package/template-vue-vite-eslint/src/utils/request/core/index.ts +172 -0
- package/template-vue-vite-eslint/src/utils/request/core/utils.ts +41 -0
- package/template-vue-vite-eslint/src/utils/request/index.ts +39 -0
- package/template-vue-vite-eslint/src/views/home/index.vue +24 -0
- package/template-vue-vite-eslint/src/views/login/index.vue +9 -0
- package/template-vue-vite-eslint/src/views/model/index.vue +7 -0
- package/{template-vue-rolldown-oxc/tsconfig.node.json → template-vue-vite-eslint/tsconfig.json} +20 -9
- package/template-vue-vite-eslint/uno.config.ts +17 -0
- package/template-vue-vite-eslint/vite.config.ts +53 -0
- package/template-vue-rolldown-oxc/components.d.ts +0 -18
- package/template-vue-rolldown-oxc/src/types/auto-import.d.ts +0 -78
- package/template-vue-rolldown-oxc/src/types/components.d.ts +0 -16
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { AlovaGenerics, AlovaOptions } from 'alova'
|
|
2
|
+
|
|
3
|
+
import { createAlova } from 'alova'
|
|
4
|
+
import adapterFetch from 'alova/fetch'
|
|
5
|
+
|
|
6
|
+
import { deepMergeObject, isReadableStream } from './utils'
|
|
7
|
+
|
|
8
|
+
interface statusMap {
|
|
9
|
+
success?: number
|
|
10
|
+
unAuthorized?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface codeMap {
|
|
14
|
+
success?: number[]
|
|
15
|
+
unAuthorized?: number[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface baseRequestOption<AG extends AlovaGenerics> {
|
|
19
|
+
baseUrl?: string
|
|
20
|
+
timeout?: number
|
|
21
|
+
commonHeaders?: Record<string, string | (() => string)>
|
|
22
|
+
statusMap?: statusMap
|
|
23
|
+
codeMap?: codeMap
|
|
24
|
+
responseDataKey?: string
|
|
25
|
+
responseMessageKey?: string
|
|
26
|
+
isTransformResponse?: boolean
|
|
27
|
+
isShowSuccessMessage?: boolean
|
|
28
|
+
successDefaultMessage?: string
|
|
29
|
+
isShowErrorMessage?: boolean
|
|
30
|
+
errorDefaultMessage?: string
|
|
31
|
+
statesHook?: AlovaOptions<AG>['statesHook']
|
|
32
|
+
successMessageFunc?: (message: string) => void
|
|
33
|
+
errorMessageFunc?: (message: string) => void
|
|
34
|
+
unAuthorizedResponseFunc?: () => void
|
|
35
|
+
requestAdapter?: AlovaOptions<AG>['requestAdapter']
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface CustomConfig {
|
|
39
|
+
isTransformResponse?: boolean
|
|
40
|
+
isShowSuccessMessage?: boolean
|
|
41
|
+
isShowErrorMessage?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type requestOption = baseRequestOption<AlovaGenerics> & CustomConfig
|
|
45
|
+
|
|
46
|
+
export function createInstance(option: requestOption) {
|
|
47
|
+
const defaultOption: requestOption = {
|
|
48
|
+
baseUrl: '/',
|
|
49
|
+
timeout: 0,
|
|
50
|
+
statusMap: {
|
|
51
|
+
success: 200,
|
|
52
|
+
unAuthorized: 401,
|
|
53
|
+
},
|
|
54
|
+
codeMap: {
|
|
55
|
+
success: [200],
|
|
56
|
+
unAuthorized: [401],
|
|
57
|
+
},
|
|
58
|
+
responseDataKey: 'data',
|
|
59
|
+
responseMessageKey: 'message',
|
|
60
|
+
isTransformResponse: true,
|
|
61
|
+
isShowSuccessMessage: false,
|
|
62
|
+
successDefaultMessage: '操作成功',
|
|
63
|
+
isShowErrorMessage: true,
|
|
64
|
+
errorDefaultMessage: '服务异常',
|
|
65
|
+
requestAdapter: adapterFetch(),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const mergeOption: baseRequestOption<AlovaGenerics> & CustomConfig = deepMergeObject(
|
|
69
|
+
defaultOption,
|
|
70
|
+
option,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
const instance = createAlova({
|
|
74
|
+
baseURL: mergeOption.baseUrl,
|
|
75
|
+
timeout: mergeOption.timeout,
|
|
76
|
+
statesHook: mergeOption?.statesHook,
|
|
77
|
+
requestAdapter: mergeOption.requestAdapter as AlovaOptions<AlovaGenerics>['requestAdapter'],
|
|
78
|
+
beforeRequest: async (method) => {
|
|
79
|
+
for (const [key, value] of Object.entries(option?.commonHeaders ?? {})) {
|
|
80
|
+
method.config.headers[key] = typeof value === 'function' ? value() : value
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
responded: {
|
|
84
|
+
onSuccess: async (response) => {
|
|
85
|
+
if (!mergeOption?.isTransformResponse)
|
|
86
|
+
return response
|
|
87
|
+
const { status } = response
|
|
88
|
+
|
|
89
|
+
// 判断响应类型:如果使用 adapterFetch,response.data 是可读流,则调用 json();否则直接使用 response.data
|
|
90
|
+
const data
|
|
91
|
+
= response?.body && isReadableStream(response.body)
|
|
92
|
+
? await response.json() // adapterFetch 的响应,使用 json() 解析可读流
|
|
93
|
+
: response.data // 其他适配器的响应
|
|
94
|
+
// 不成功的情况
|
|
95
|
+
if (status !== mergeOption.statusMap?.success) {
|
|
96
|
+
// 如果后端使用status 字段来表示未授权,则返回401
|
|
97
|
+
if (mergeOption?.statusMap?.unAuthorized === status) {
|
|
98
|
+
mergeOption?.unAuthorizedResponseFunc?.()
|
|
99
|
+
}
|
|
100
|
+
return Promise.reject(response)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const {
|
|
104
|
+
responseDataKey,
|
|
105
|
+
codeMap,
|
|
106
|
+
isShowSuccessMessage,
|
|
107
|
+
responseMessageKey,
|
|
108
|
+
isShowErrorMessage,
|
|
109
|
+
} = mergeOption
|
|
110
|
+
const {
|
|
111
|
+
code,
|
|
112
|
+
[responseDataKey as string]: responseData,
|
|
113
|
+
[responseMessageKey as string]: responseMessage,
|
|
114
|
+
} = data
|
|
115
|
+
if (!codeMap?.success?.includes(+code)) {
|
|
116
|
+
// code unAuthorized 处理
|
|
117
|
+
if (codeMap?.unAuthorized?.includes(+code)) {
|
|
118
|
+
mergeOption?.unAuthorizedResponseFunc?.()
|
|
119
|
+
return Promise.reject(response)
|
|
120
|
+
}
|
|
121
|
+
// 其他错误直接打印msg
|
|
122
|
+
|
|
123
|
+
const errorMessage = data[responseMessageKey as string] ?? mergeOption.errorDefaultMessage
|
|
124
|
+
if (isShowErrorMessage)
|
|
125
|
+
mergeOption?.errorMessageFunc?.(errorMessage)
|
|
126
|
+
return Promise.reject(response)
|
|
127
|
+
}
|
|
128
|
+
if (isShowSuccessMessage)
|
|
129
|
+
mergeOption?.successMessageFunc?.(responseMessage ?? mergeOption.successDefaultMessage)
|
|
130
|
+
return responseData
|
|
131
|
+
},
|
|
132
|
+
onError: (error) => {
|
|
133
|
+
if (mergeOption?.isShowErrorMessage) {
|
|
134
|
+
mergeOption.errorMessageFunc?.(
|
|
135
|
+
error.response?.data?.message ?? mergeOption?.errorDefaultMessage,
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// onComplete: (_method) => {},
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
return instance
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 🚀 创建双重调用实例的工厂函数
|
|
147
|
+
export function createDualCallInstance(baseConfig: baseRequestOption<AlovaGenerics>) {
|
|
148
|
+
// 创建默认实例
|
|
149
|
+
const defaultInstance = createInstance(baseConfig)
|
|
150
|
+
|
|
151
|
+
// 双重调用函数
|
|
152
|
+
const dualInstance = (option?: CustomConfig) => {
|
|
153
|
+
if (option) {
|
|
154
|
+
// 合并配置并创建新实例
|
|
155
|
+
const mergedConfig = { ...baseConfig, ...option }
|
|
156
|
+
return createInstance(mergedConfig)
|
|
157
|
+
}
|
|
158
|
+
return defaultInstance
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 🎯 直接绑定 HTTP 方法,无需复杂类型注释
|
|
162
|
+
dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
|
|
163
|
+
dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
|
|
164
|
+
dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
|
|
165
|
+
dualInstance.Delete = defaultInstance.Delete.bind(defaultInstance)
|
|
166
|
+
dualInstance.Patch = defaultInstance.Patch.bind(defaultInstance)
|
|
167
|
+
dualInstance.Head = defaultInstance.Head.bind(defaultInstance)
|
|
168
|
+
dualInstance.Options = defaultInstance.Options.bind(defaultInstance)
|
|
169
|
+
dualInstance.Request = defaultInstance.Request.bind(defaultInstance)
|
|
170
|
+
|
|
171
|
+
return dualInstance
|
|
172
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function deepMergeObject<T = any>(source: T, target: Partial<T>): T {
|
|
2
|
+
const isObject = (obj: any): obj is Record<string, any> =>
|
|
3
|
+
obj && typeof obj === 'object' && !Array.isArray(obj)
|
|
4
|
+
|
|
5
|
+
const merge = (src: any, tgt: any): any => {
|
|
6
|
+
if (isObject(src) && isObject(tgt)) {
|
|
7
|
+
Object.keys(tgt).forEach((key) => {
|
|
8
|
+
if (isObject(tgt[key])) {
|
|
9
|
+
src[key] = merge(src[key] || {}, tgt[key])
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
src[key] = tgt[key]
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
return src
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return merge({ ...source }, target)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 判断一个变量是不是可读流
|
|
24
|
+
* @param data
|
|
25
|
+
*/
|
|
26
|
+
export function isReadableStream(data: unknown): boolean {
|
|
27
|
+
if (!(data instanceof ReadableStream)) {
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
if (typeof data.locked !== 'boolean')
|
|
31
|
+
return false
|
|
32
|
+
|
|
33
|
+
const instanceFunc = ['cancel', 'getReader', 'pipeThrough', 'pipeTo', 'tee'] as const
|
|
34
|
+
|
|
35
|
+
for (const func of instanceFunc) {
|
|
36
|
+
if (typeof data[func] !== 'function')
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
|
2
|
+
import vueHook from 'alova/vue'
|
|
3
|
+
import { ElMessage } from 'element-plus'
|
|
4
|
+
import { router } from '@/router'
|
|
5
|
+
import { envVariables } from '../env'
|
|
6
|
+
import { createDualCallInstance } from './core'
|
|
7
|
+
import 'element-plus/es/components/message/style/css'
|
|
8
|
+
|
|
9
|
+
function getBaseConfig(): Parameters<typeof createDualCallInstance>[0] {
|
|
10
|
+
return {
|
|
11
|
+
baseUrl: `/${envVariables.PUBLIC_PORT}`,
|
|
12
|
+
statusMap: {
|
|
13
|
+
success: 200,
|
|
14
|
+
unAuthorized: 401,
|
|
15
|
+
},
|
|
16
|
+
codeMap: {
|
|
17
|
+
success: [200],
|
|
18
|
+
},
|
|
19
|
+
responseDataKey: 'data',
|
|
20
|
+
responseMessageKey: 'msg',
|
|
21
|
+
commonHeaders: {},
|
|
22
|
+
successMessageFunc: (msg: string) => {
|
|
23
|
+
ElMessage.success(msg)
|
|
24
|
+
},
|
|
25
|
+
errorMessageFunc: (msg: string) => {
|
|
26
|
+
ElMessage.error(msg)
|
|
27
|
+
},
|
|
28
|
+
unAuthorizedResponseFunc: () => {
|
|
29
|
+
router.push('/login')
|
|
30
|
+
ElMessage.error('登录过期或未登录')
|
|
31
|
+
},
|
|
32
|
+
statesHook: vueHook,
|
|
33
|
+
requestAdapter: axiosRequestAdapter(),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const alovaRequest = createDualCallInstance(getBaseConfig())
|
|
38
|
+
|
|
39
|
+
export default alovaRequest
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import SvgIcon from '@/components/Icon/svg-icon.vue'
|
|
3
|
+
|
|
4
|
+
const a = ref()
|
|
5
|
+
|
|
6
|
+
const b = ref([1, 3, 4])
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="relative z-1 m-2px p-[111px] p-3px p-4px text-red">
|
|
11
|
+
home
|
|
12
|
+
<el-date-picker v-model="a" type="date" value-format="yyyy-MM-dd" />
|
|
13
|
+
<SvgIcon name="vue" class="text-green" />
|
|
14
|
+
<el-button type="primary">
|
|
15
|
+
按钮
|
|
16
|
+
</el-button>
|
|
17
|
+
<div v-for="item in b" :key="item">
|
|
18
|
+
{{ item }}
|
|
19
|
+
</div>
|
|
20
|
+
<image src="https://img2.baidu.com/it/u=3422424222,2328894338&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" />
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style lang="scss" scoped></style>
|
package/{template-vue-rolldown-oxc/tsconfig.node.json → template-vue-vite-eslint/tsconfig.json}
RENAMED
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"moduleDetection": "force",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
|
|
8
|
+
"baseUrl": ".",
|
|
6
9
|
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
10
|
|
|
9
11
|
/* Bundler mode */
|
|
10
12
|
"moduleResolution": "bundler",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@/*": ["src/*"]
|
|
15
|
+
},
|
|
16
|
+
"types": ["vite/client", "vue"],
|
|
11
17
|
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
18
|
|
|
16
19
|
/* Linting */
|
|
17
20
|
"strict": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
22
|
"noUnusedLocals": true,
|
|
19
23
|
"noUnusedParameters": true,
|
|
24
|
+
"noEmit": true,
|
|
25
|
+
"verbatimModuleSyntax": true,
|
|
20
26
|
"erasableSyntaxOnly": true,
|
|
21
|
-
"
|
|
27
|
+
"skipLibCheck": true,
|
|
22
28
|
"noUncheckedSideEffectImports": true
|
|
23
29
|
},
|
|
24
|
-
"include": [
|
|
30
|
+
"include": [
|
|
31
|
+
"src/**/*.ts",
|
|
32
|
+
"src/**/*.d.ts",
|
|
33
|
+
"src/**/*.vue",
|
|
34
|
+
"./node_modules/element-plus/global.d.ts"
|
|
35
|
+
]
|
|
25
36
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig, presetUno } from 'unocss'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
// content: {
|
|
5
|
+
// filesystem: [
|
|
6
|
+
// '**/*.{html,js,ts,jsx,tsx,vue,svelte,astro}',
|
|
7
|
+
// ],
|
|
8
|
+
// },
|
|
9
|
+
shortcuts: [
|
|
10
|
+
{
|
|
11
|
+
'flex-center': 'flex justify-center items-center',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
presets: [
|
|
15
|
+
presetUno(),
|
|
16
|
+
],
|
|
17
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
|
|
4
|
+
import { PlusProComponentsResolver } from '@plus-pro-components/resolver'
|
|
5
|
+
import Vue from '@vitejs/plugin-vue'
|
|
6
|
+
import UnoCSS from 'unocss/vite'
|
|
7
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
8
|
+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
9
|
+
import Components from 'unplugin-vue-components/vite'
|
|
10
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
11
|
+
import Inspect from 'vite-plugin-inspect'
|
|
12
|
+
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
13
|
+
|
|
14
|
+
// https://vite.dev/config/
|
|
15
|
+
export default defineConfig(({ _command, mode }) => {
|
|
16
|
+
const root = process.cwd()
|
|
17
|
+
const env = loadEnv(mode, root)
|
|
18
|
+
const { VITE_PORT } = env
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
'@': path.resolve(__dirname, 'src'),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
server: {
|
|
27
|
+
port: Number(VITE_PORT),
|
|
28
|
+
host: '0.0.0.0',
|
|
29
|
+
open: false,
|
|
30
|
+
proxy: {},
|
|
31
|
+
},
|
|
32
|
+
plugins: [
|
|
33
|
+
Vue(),
|
|
34
|
+
AutoImport({
|
|
35
|
+
imports: ['vue', 'vue-router'],
|
|
36
|
+
resolvers: [ElementPlusResolver()],
|
|
37
|
+
dts: './src/types/auto-import.d.ts',
|
|
38
|
+
}),
|
|
39
|
+
Components({
|
|
40
|
+
resolvers: [ElementPlusResolver(), PlusProComponentsResolver()],
|
|
41
|
+
dts: './src/types/components.d.ts',
|
|
42
|
+
}),
|
|
43
|
+
createSvgIconsPlugin({
|
|
44
|
+
// Specify the icon folder to be cached
|
|
45
|
+
iconDirs: [path.resolve(__dirname, 'src/assets/icon')],
|
|
46
|
+
// Specify symbolId format
|
|
47
|
+
symbolId: 'icon-[dir]-[name]',
|
|
48
|
+
}),
|
|
49
|
+
UnoCSS(),
|
|
50
|
+
Inspect(),
|
|
51
|
+
],
|
|
52
|
+
}
|
|
53
|
+
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
// Generated by unplugin-vue-components
|
|
4
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
-
// biome-ignore lint: disable
|
|
6
|
-
export {}
|
|
7
|
-
|
|
8
|
-
/* prettier-ignore */
|
|
9
|
-
declare module 'vue' {
|
|
10
|
-
export interface GlobalComponents {
|
|
11
|
-
ElButton: typeof import('element-plus/es')['ElButton']
|
|
12
|
-
ElDrawer: typeof import('element-plus/es')['ElDrawer']
|
|
13
|
-
ElTable: typeof import('element-plus/es')['ElTable']
|
|
14
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
|
15
|
-
RouterView: typeof import('vue-router')['RouterView']
|
|
16
|
-
SvgIcon: typeof import('./src/components/Icon/svg-icon.vue')['default']
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
// Generated by unplugin-auto-import
|
|
6
|
-
// biome-ignore lint: disable
|
|
7
|
-
export {}
|
|
8
|
-
declare global {
|
|
9
|
-
const EffectScope: typeof import('vue')['EffectScope']
|
|
10
|
-
const computed: typeof import('vue')['computed']
|
|
11
|
-
const createApp: typeof import('vue')['createApp']
|
|
12
|
-
const customRef: typeof import('vue')['customRef']
|
|
13
|
-
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
|
14
|
-
const defineComponent: typeof import('vue')['defineComponent']
|
|
15
|
-
const effectScope: typeof import('vue')['effectScope']
|
|
16
|
-
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
|
17
|
-
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
|
18
|
-
const getCurrentWatcher: typeof import('vue')['getCurrentWatcher']
|
|
19
|
-
const h: typeof import('vue')['h']
|
|
20
|
-
const inject: typeof import('vue')['inject']
|
|
21
|
-
const isProxy: typeof import('vue')['isProxy']
|
|
22
|
-
const isReactive: typeof import('vue')['isReactive']
|
|
23
|
-
const isReadonly: typeof import('vue')['isReadonly']
|
|
24
|
-
const isRef: typeof import('vue')['isRef']
|
|
25
|
-
const isShallow: typeof import('vue')['isShallow']
|
|
26
|
-
const markRaw: typeof import('vue')['markRaw']
|
|
27
|
-
const nextTick: typeof import('vue')['nextTick']
|
|
28
|
-
const onActivated: typeof import('vue')['onActivated']
|
|
29
|
-
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
|
30
|
-
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
|
|
31
|
-
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
|
|
32
|
-
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
|
33
|
-
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
|
34
|
-
const onDeactivated: typeof import('vue')['onDeactivated']
|
|
35
|
-
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
|
36
|
-
const onMounted: typeof import('vue')['onMounted']
|
|
37
|
-
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
|
38
|
-
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
|
39
|
-
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
|
40
|
-
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
|
41
|
-
const onUnmounted: typeof import('vue')['onUnmounted']
|
|
42
|
-
const onUpdated: typeof import('vue')['onUpdated']
|
|
43
|
-
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
|
|
44
|
-
const provide: typeof import('vue')['provide']
|
|
45
|
-
const reactive: typeof import('vue')['reactive']
|
|
46
|
-
const readonly: typeof import('vue')['readonly']
|
|
47
|
-
const ref: typeof import('vue')['ref']
|
|
48
|
-
const resolveComponent: typeof import('vue')['resolveComponent']
|
|
49
|
-
const shallowReactive: typeof import('vue')['shallowReactive']
|
|
50
|
-
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
|
51
|
-
const shallowRef: typeof import('vue')['shallowRef']
|
|
52
|
-
const toRaw: typeof import('vue')['toRaw']
|
|
53
|
-
const toRef: typeof import('vue')['toRef']
|
|
54
|
-
const toRefs: typeof import('vue')['toRefs']
|
|
55
|
-
const toValue: typeof import('vue')['toValue']
|
|
56
|
-
const triggerRef: typeof import('vue')['triggerRef']
|
|
57
|
-
const unref: typeof import('vue')['unref']
|
|
58
|
-
const useAttrs: typeof import('vue')['useAttrs']
|
|
59
|
-
const useCssModule: typeof import('vue')['useCssModule']
|
|
60
|
-
const useCssVars: typeof import('vue')['useCssVars']
|
|
61
|
-
const useId: typeof import('vue')['useId']
|
|
62
|
-
const useLink: typeof import('vue-router')['useLink']
|
|
63
|
-
const useModel: typeof import('vue')['useModel']
|
|
64
|
-
const useRoute: typeof import('vue-router')['useRoute']
|
|
65
|
-
const useRouter: typeof import('vue-router')['useRouter']
|
|
66
|
-
const useSlots: typeof import('vue')['useSlots']
|
|
67
|
-
const useTemplateRef: typeof import('vue')['useTemplateRef']
|
|
68
|
-
const watch: typeof import('vue')['watch']
|
|
69
|
-
const watchEffect: typeof import('vue')['watchEffect']
|
|
70
|
-
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
|
71
|
-
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
|
72
|
-
}
|
|
73
|
-
// for type re-export
|
|
74
|
-
declare global {
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
|
|
77
|
-
import('vue')
|
|
78
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
// Generated by unplugin-vue-components
|
|
4
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
-
// biome-ignore lint: disable
|
|
6
|
-
export {}
|
|
7
|
-
|
|
8
|
-
/* prettier-ignore */
|
|
9
|
-
declare module 'vue' {
|
|
10
|
-
export interface GlobalComponents {
|
|
11
|
-
ElButton: typeof import('element-plus/es')['ElButton']
|
|
12
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
|
13
|
-
RouterView: typeof import('vue-router')['RouterView']
|
|
14
|
-
SvgIcon: typeof import('./../components/Icon/svg-icon.vue')['default']
|
|
15
|
-
}
|
|
16
|
-
}
|