Browse Source

chore: add auto-import plugin

main
刘凯 11 months ago
parent
commit
9ea528c3ad
  1. 6
      .gitignore
  2. 4
      build/vite/plugin/index.ts
  3. 1
      package.json
  4. 93
      pnpm-lock.yaml
  5. 3
      tsconfig.json

6
.gitignore vendored

@ -4,9 +4,6 @@ dist
.npmrc
.cache
tests/server/static
tests/server/static/upload
*.local
# local env files
.env.local
@ -28,7 +25,6 @@ pnpm-debug.log*
*.sln
*.sw?
package-lock.json
.history
/vite.config.ts.timestamp*
auto-imports.d.ts

4
build/vite/plugin/index.ts

@ -2,6 +2,7 @@ import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { configHtmlPlugin } from './html'
import { configCompressPlugin } from './compress'
import { configVisualizerConfig } from './visualizer'
@ -17,6 +18,9 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
vueJsx(),
// UnoCSS
UnoCSS(),
AutoImport({
imports: ['vue', 'vue-router'],
}),
]
// vite-vue-plugin-html

1
package.json

@ -96,6 +96,7 @@
"terser": "^5.31.2",
"typescript": "^5.5.3",
"unocss": "^0.61.3",
"unplugin-auto-import": "^0.18.0",
"vite": "^5.3.3",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-pwa": "^0.17.5",

93
pnpm-lock.yaml

@ -217,6 +217,9 @@ devDependencies:
unocss:
specifier: ^0.61.3
version: 0.61.3(postcss@8.4.39)(rollup@2.79.1)(vite@5.3.3)
unplugin-auto-import:
specifier: ^0.18.0
version: 0.18.0(@vueuse/core@10.11.0)(rollup@2.79.1)
vite:
specifier: ^5.3.3
version: 5.3.3(@types/node@20.14.10)(less@4.2.0)(terser@5.31.2)
@ -2647,7 +2650,6 @@ packages:
/@types/web-bluetooth@0.0.20:
resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==}
dev: false
/@typescript-eslint/eslint-plugin@8.0.0-alpha.40(@typescript-eslint/parser@8.0.0-alpha.40)(eslint@9.7.0)(typescript@5.5.3):
resolution: {integrity: sha512-yku4NjpP0UujYq8d1GWXYELpKYwuoESSgvXPd9uAiO24OszGxQhPsGWTe4fmZV05J47qILfaGANO9SCa9fEU0w==}
@ -3317,11 +3319,9 @@ packages:
transitivePeerDependencies:
- '@vue/composition-api'
- vue
dev: false
/@vueuse/metadata@10.11.0:
resolution: {integrity: sha512-kQX7l6l8dVWNqlqyN3ePW3KmjCQO3ZMgXuBMddIu83CmucrsBfXlH+JoviYyRBws/yLTQO8g3Pbw+bdIoVm4oQ==}
dev: false
/@vueuse/shared@10.11.0(vue@3.4.31):
resolution: {integrity: sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A==}
@ -3330,7 +3330,6 @@ packages:
transitivePeerDependencies:
- '@vue/composition-api'
- vue
dev: false
/@zxcvbn-ts/core@3.0.4:
resolution: {integrity: sha512-aQeiT0F09FuJaAqNrxynlAwZ2mW/1MdXakKWNmGM1Qp/VaY6CnB/GfnMS2T8gB2231Esp1/maCWd8vTG4OuShw==}
@ -4698,6 +4697,11 @@ packages:
engines: {node: '>=10'}
dev: true
/escape-string-regexp@5.0.0:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
dev: true
/eslint-compat-utils@0.5.1(eslint@9.7.0):
resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==}
engines: {node: '>=12'}
@ -5167,6 +5171,12 @@ packages:
/estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
/estree-walker@3.0.3:
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
dependencies:
'@types/estree': 1.0.5
dev: true
/esutils@2.0.3:
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
engines: {node: '>=0.10.0'}
@ -7779,6 +7789,10 @@ packages:
regexp-ast-analysis: 0.7.1
dev: true
/scule@1.3.0:
resolution: {integrity: sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==}
dev: true
/semver@5.7.2:
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
hasBin: true
@ -8210,6 +8224,12 @@ packages:
engines: {node: '>=8'}
dev: true
/strip-literal@2.1.0:
resolution: {integrity: sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==}
dependencies:
js-tokens: 9.0.0
dev: true
/style-mod@4.1.2:
resolution: {integrity: sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==}
dev: false
@ -8602,6 +8622,26 @@ packages:
engines: {node: '>=18'}
dev: true
/unimport@3.7.2(rollup@2.79.1):
resolution: {integrity: sha512-91mxcZTadgXyj3lFWmrGT8GyoRHWuE5fqPOjg5RVtF6vj+OfM5G6WCzXjuYtSgELE5ggB34RY4oiCSEP8I3AHw==}
dependencies:
'@rollup/pluginutils': 5.1.0(rollup@2.79.1)
acorn: 8.12.1
escape-string-regexp: 5.0.0
estree-walker: 3.0.3
fast-glob: 3.3.2
local-pkg: 0.5.0
magic-string: 0.30.10
mlly: 1.7.1
pathe: 1.1.2
pkg-types: 1.1.3
scule: 1.3.0
strip-literal: 2.1.0
unplugin: 1.11.0
transitivePeerDependencies:
- rollup
dev: true
/union-value@1.0.1:
resolution: {integrity: sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==}
engines: {node: '>=0.10.0'}
@ -8668,6 +8708,41 @@ packages:
- supports-color
dev: true
/unplugin-auto-import@0.18.0(@vueuse/core@10.11.0)(rollup@2.79.1):
resolution: {integrity: sha512-DZcj8tceMpwuZgBPM9hhKd7v05WAYCUc/qYjxV7vGbeVCGsQ8SHWumCyOYBDqYzkPd4FlQkuh+OH0cWgdCjcdw==}
engines: {node: '>=14'}
peerDependencies:
'@nuxt/kit': ^3.2.2
'@vueuse/core': '*'
peerDependenciesMeta:
'@nuxt/kit':
optional: true
'@vueuse/core':
optional: true
dependencies:
'@antfu/utils': 0.7.10
'@rollup/pluginutils': 5.1.0(rollup@2.79.1)
'@vueuse/core': 10.11.0(vue@3.4.31)
fast-glob: 3.3.2
local-pkg: 0.5.0
magic-string: 0.30.10
minimatch: 9.0.5
unimport: 3.7.2(rollup@2.79.1)
unplugin: 1.11.0
transitivePeerDependencies:
- rollup
dev: true
/unplugin@1.11.0:
resolution: {integrity: sha512-3r7VWZ/webh0SGgJScpWl2/MRCZK5d3ZYFcNaeci/GQ7Teop7zf0Nl2pUuz7G21BwPd9pcUPOC5KmJ2L3WgC5g==}
engines: {node: '>=14.0.0'}
dependencies:
acorn: 8.12.1
chokidar: 3.6.0
webpack-sources: 3.2.3
webpack-virtual-modules: 0.6.2
dev: true
/unset-value@1.0.0:
resolution: {integrity: sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==}
engines: {node: '>=0.10.0'}
@ -8875,7 +8950,6 @@ packages:
optional: true
dependencies:
vue: 3.4.31(typescript@5.5.3)
dev: false
/vue-eslint-parser@9.4.3(eslint@9.7.0):
resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==}
@ -9011,6 +9085,15 @@ packages:
resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
dev: true
/webpack-sources@3.2.3:
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
engines: {node: '>=10.13.0'}
dev: true
/webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
dev: true
/whatwg-url@7.1.0:
resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==}
dependencies:

3
tsconfig.json

@ -36,7 +36,8 @@
"src/types/**/*.ts",
"build/**/*.ts",
"build/**/*.d.ts",
"vite.config.ts"
"vite.config.ts",
"auto-imports.d.ts"
],
"exclude": ["node_modules", "dist"]
}

Loading…
Cancel
Save