diff --git a/build/plugins.ts b/build/plugins.ts index e23de458a..37c8278a4 100644 --- a/build/plugins.ts +++ b/build/plugins.ts @@ -4,6 +4,7 @@ import { pathResolve } from "./utils"; import { viteBuildInfo } from "./info"; import svgLoader from "vite-svg-loader"; import type { PluginOption } from "vite"; +import checker from "vite-plugin-checker"; import vueJsx from "@vitejs/plugin-vue-jsx"; import Inspector from "vite-plugin-vue-inspector"; import { configCompressPlugin } from "./compress"; @@ -28,6 +29,16 @@ export function getPluginsList( jitCompilation: false, include: [pathResolve("../locales/**")] }), + checker({ + typescript: true, + vueTsc: true, + eslint: { + lintCommand: `eslint ${pathResolve("../{src,mock,build}/**/*.{vue,js,ts,tsx}")}`, + useFlatConfig: true + }, + terminal: false, + enableBuild: false + }), // 按下Command(⌘)+Shift(⇧),然后点击页面元素会自动打开本地IDE并跳转到对应的代码位置 Inspector(), viteBuildInfo(), diff --git a/package.json b/package.json index 32db79e09..70127eb2b 100644 --- a/package.json +++ b/package.json @@ -162,6 +162,7 @@ "typescript": "^5.5.3", "vite": "^5.3.2", "vite-plugin-cdn-import": "^1.0.1", + "vite-plugin-checker": "^0.7.0", "vite-plugin-compression": "^0.5.1", "vite-plugin-fake-server": "^2.1.1", "vite-plugin-remove-console": "^2.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a04a16d20..1f103515d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -348,6 +348,9 @@ importers: vite-plugin-cdn-import: specifier: ^1.0.1 version: 1.0.1(rollup@4.18.0)(vite@5.3.2(@types/node@20.14.9)(sass@1.77.6)) + vite-plugin-checker: + specifier: ^0.7.0 + version: 0.7.0(eslint@9.6.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.5.3))(typescript@5.5.3)(vite@5.3.2(@types/node@20.14.9)(sass@1.77.6))(vue-tsc@2.0.24(typescript@5.5.3)) vite-plugin-compression: specifier: ^0.5.1 version: 0.5.1(vite@5.3.2(@types/node@20.14.9)(sass@1.77.6)) @@ -1569,12 +1572,21 @@ packages: vite: ^5.0.0 vue: ^3.2.25 + '@volar/language-core@2.3.4': + resolution: {integrity: sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==} + '@volar/language-core@2.4.0-alpha.12': resolution: {integrity: sha512-Dj9qTifcGGgzFLfMbU5dCo13kHyNuEyvPJhtWDnoVBBmgwW3GMwFmgWnNxBhjf63m5x0gux1okaxX2CLN7qSww==} + '@volar/source-map@2.3.4': + resolution: {integrity: sha512-C+t63nwcblqLIVTYXaVi/+gC8NukDaDIQI72J3R7aXGvtgaVB16c+J8Iz7/VfOy7kjYv7lf5GhBny6ACw9fTGQ==} + '@volar/source-map@2.4.0-alpha.12': resolution: {integrity: sha512-LXATFSj4D7T9sEm7FFj6iBgHjKjrdhAgRPcechVKiNCMQdr3r3GVkkeu8aM+1peaMH3LsCqoDxVZEmh2r7CHiw==} + '@volar/typescript@2.3.4': + resolution: {integrity: sha512-acCvt7dZECyKcvO5geNybmrqOsu9u8n5XP1rfiYsOLYGPxvHRav9BVmEdRyZ3vvY6mNyQ1wLL5Hday4IShe17w==} + '@volar/typescript@2.4.0-alpha.12': resolution: {integrity: sha512-mLg+OQauMTv/+08a7WBWJo1sev/wc8t2is0zhBZIlFU+j5mG89FM4+4089c2p/zoUFZ400Q/VNg2BPfhpZ8wSA==} @@ -2171,6 +2183,10 @@ packages: resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==} engines: {node: '>= 10'} + commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + commist@1.1.0: resolution: {integrity: sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==} @@ -5024,6 +5040,9 @@ packages: through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + tiny-invariant@1.3.3: + resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + tiny-warning@1.0.3: resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} @@ -5190,6 +5209,37 @@ packages: vite-plugin-cdn-import@1.0.1: resolution: {integrity: sha512-lgjLxgwFSKvJLbqjVBirUZ0rQo00GpUGJzRpgQu8RyBw9LA7jaqG6fUMQzBC9qWmTGabPC3iOzwCcoi7PseRAQ==} + vite-plugin-checker@0.7.0: + resolution: {integrity: sha512-F3MdUORNLcPC0oDB9zxmPDhUC8X/3fzDShU5Izk4bqE4uTgxbQdOuOCa99bS6OSyWVC0uhHG4yAtWUXM2jOx9A==} + engines: {node: '>=14.16'} + peerDependencies: + eslint: '>=7' + meow: ^9.0.0 + optionator: ^0.9.1 + stylelint: '>=13' + typescript: '*' + vite: '>=2.0.0' + vls: '*' + vti: '*' + vue-tsc: '>=2.0.0' + peerDependenciesMeta: + eslint: + optional: true + meow: + optional: true + optionator: + optional: true + stylelint: + optional: true + typescript: + optional: true + vls: + optional: true + vti: + optional: true + vue-tsc: + optional: true + vite-plugin-compression@0.5.1: resolution: {integrity: sha512-5QJKBDc+gNYVqL/skgFAP81Yuzo9R+EAf19d+EtsMF/i8kFUpNi3J/H01QD3Oo8zBQn+NzoCIFkpPLynoOzaJg==} peerDependencies: @@ -5248,6 +5298,27 @@ packages: terser: optional: true + vscode-jsonrpc@6.0.0: + resolution: {integrity: sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==} + engines: {node: '>=8.0.0 || >=10.0.0'} + + vscode-languageclient@7.0.0: + resolution: {integrity: sha512-P9AXdAPlsCgslpP9pRxYPqkNYV7Xq8300/aZDpO35j1fJm/ncize8iGswzYlcvFw5DQUx4eVk+KvfXdL0rehNg==} + engines: {vscode: ^1.52.0} + + vscode-languageserver-protocol@3.16.0: + resolution: {integrity: sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==} + + vscode-languageserver-textdocument@1.0.11: + resolution: {integrity: sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==} + + vscode-languageserver-types@3.16.0: + resolution: {integrity: sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==} + + vscode-languageserver@7.0.0: + resolution: {integrity: sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==} + hasBin: true + vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} @@ -6879,12 +6950,24 @@ snapshots: vite: 5.3.2(@types/node@20.14.9)(sass@1.77.6) vue: 3.4.31(typescript@5.5.3) + '@volar/language-core@2.3.4': + dependencies: + '@volar/source-map': 2.3.4 + '@volar/language-core@2.4.0-alpha.12': dependencies: '@volar/source-map': 2.4.0-alpha.12 + '@volar/source-map@2.3.4': {} + '@volar/source-map@2.4.0-alpha.12': {} + '@volar/typescript@2.3.4': + dependencies: + '@volar/language-core': 2.3.4 + path-browserify: 1.0.1 + vscode-uri: 3.0.8 + '@volar/typescript@2.4.0-alpha.12': dependencies: '@volar/language-core': 2.4.0-alpha.12 @@ -7626,6 +7709,8 @@ snapshots: commander@7.2.0: {} + commander@8.3.0: {} + commist@1.1.0: dependencies: leven: 2.1.0 @@ -10862,6 +10947,8 @@ snapshots: through@2.3.8: {} + tiny-invariant@1.3.3: {} + tiny-warning@1.0.3: {} tinycolor2@1.6.0: {} @@ -11045,6 +11132,31 @@ snapshots: - rollup - vite + vite-plugin-checker@0.7.0(eslint@9.6.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.5.3))(typescript@5.5.3)(vite@5.3.2(@types/node@20.14.9)(sass@1.77.6))(vue-tsc@2.0.24(typescript@5.5.3)): + dependencies: + '@babel/code-frame': 7.24.7 + '@volar/typescript': 2.3.4 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + chokidar: 3.6.0 + commander: 8.3.0 + fast-glob: 3.3.2 + fs-extra: 11.2.0 + npm-run-path: 4.0.1 + strip-ansi: 6.0.1 + tiny-invariant: 1.3.3 + vite: 5.3.2(@types/node@20.14.9)(sass@1.77.6) + vscode-languageclient: 7.0.0 + vscode-languageserver: 7.0.0 + vscode-languageserver-textdocument: 1.0.11 + vscode-uri: 3.0.8 + optionalDependencies: + eslint: 9.6.0 + optionator: 0.9.4 + stylelint: 16.6.1(typescript@5.5.3) + typescript: 5.5.3 + vue-tsc: 2.0.24(typescript@5.5.3) + vite-plugin-compression@0.5.1(vite@5.3.2(@types/node@20.14.9)(sass@1.77.6)): dependencies: chalk: 4.1.2 @@ -11104,6 +11216,27 @@ snapshots: fsevents: 2.3.3 sass: 1.77.6 + vscode-jsonrpc@6.0.0: {} + + vscode-languageclient@7.0.0: + dependencies: + minimatch: 3.1.2 + semver: 7.6.2 + vscode-languageserver-protocol: 3.16.0 + + vscode-languageserver-protocol@3.16.0: + dependencies: + vscode-jsonrpc: 6.0.0 + vscode-languageserver-types: 3.16.0 + + vscode-languageserver-textdocument@1.0.11: {} + + vscode-languageserver-types@3.16.0: {} + + vscode-languageserver@7.0.0: + dependencies: + vscode-languageserver-protocol: 3.16.0 + vscode-uri@3.0.8: {} vue-demi@0.14.8(vue@3.4.31(typescript@5.5.3)):