From 5d1f25e771d529d5f616e03845614c1b69ebe552 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 5 Dec 2023 12:48:09 +0800 Subject: [PATCH] chore: use @halo-dev/ui-plugin-bundler-kit to refactor vite config (#17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 Halo 新提供的 `@halo-dev/ui-plugin-bundler-kit` 包重构 Vite 打包配置。 see https://github.com/halo-dev/halo/pull/4916 ```release-note None ``` --- console/package.json | 3 +- console/pnpm-lock.yaml | 368 +++++++++++++++++++++++++++++++++++------ console/vite.config.ts | 66 ++------ 3 files changed, 330 insertions(+), 107 deletions(-) diff --git a/console/package.json b/console/package.json index 6ef9bc5..d53763a 100644 --- a/console/package.json +++ b/console/package.json @@ -17,6 +17,7 @@ "vue": "^3.3.4" }, "devDependencies": { + "@halo-dev/ui-plugin-bundler-kit": "^1.0.0", "@iconify/json": "^2.2.76", "@rushstack/eslint-patch": "^1.3.1", "@types/canvas-confetti": "^1.6.0", @@ -36,7 +37,7 @@ "sass": "^1.63.3", "typescript": "~4.7.4", "unplugin-icons": "^0.15.3", - "vite": "^3.2.7", + "vite": "^4.5.0", "vitest": "^0.24.5", "vue-tsc": "^1.6.5" } diff --git a/console/pnpm-lock.yaml b/console/pnpm-lock.yaml index ac65abc..a9abe6d 100644 --- a/console/pnpm-lock.yaml +++ b/console/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: '@halo-dev/components': specifier: ^1.5.0 @@ -15,6 +19,9 @@ dependencies: version: 3.3.4 devDependencies: + '@halo-dev/ui-plugin-bundler-kit': + specifier: ^1.0.0 + version: 1.0.0(vite@4.5.0) '@iconify/json': specifier: ^2.2.76 version: 2.2.76 @@ -32,10 +39,10 @@ devDependencies: version: 16.18.35 '@vitejs/plugin-vue': specifier: ^3.2.0 - version: 3.2.0(vite@3.2.7)(vue@3.3.4) + version: 3.2.0(vite@4.5.0)(vue@3.3.4) '@vitejs/plugin-vue-jsx': specifier: ^2.1.1 - version: 2.1.1(vite@3.2.7)(vue@3.3.4) + version: 2.1.1(vite@4.5.0)(vue@3.3.4) '@vue/eslint-config-prettier': specifier: ^7.1.0 version: 7.1.0(eslint@8.42.0)(prettier@2.8.8) @@ -73,8 +80,8 @@ devDependencies: specifier: ^0.15.3 version: 0.15.3 vite: - specifier: ^3.2.7 - version: 3.2.7(@types/node@16.18.35)(sass@1.63.3) + specifier: ^4.5.0 + version: 4.5.0(@types/node@16.18.35)(sass@1.63.3) vitest: specifier: ^0.24.5 version: 0.24.5(jsdom@19.0.0)(sass@1.63.3) @@ -475,6 +482,15 @@ packages: '@babel/helper-validator-identifier': 7.22.5 to-fast-properties: 2.0.0 + /@esbuild/android-arm64@0.18.20: + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.15.12: resolution: {integrity: sha512-IC7TqIqiyE0MmvAhWkl/8AEzpOtbhRNDo7aph47We1NbE5w2bt/Q+giAhe0YYeVpYnIhGMcuZY92qDK6dQauvA==} engines: {node: '>=12'} @@ -484,6 +500,87 @@ packages: dev: true optional: true + /@esbuild/android-arm@0.18.20: + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.18.20: + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.18.20: + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.18.20: + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.18.20: + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.18.20: + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.18.20: + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.18.20: + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.18.20: + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.15.12: resolution: {integrity: sha512-tZEowDjvU7O7I04GYvWQOS4yyP9E/7YlsB0jjw1Ycukgr2ycEzKyIk5tms5WnLBymaewc6VmRKnn5IJWgK4eFw==} engines: {node: '>=12'} @@ -493,6 +590,114 @@ packages: dev: true optional: true + /@esbuild/linux-loong64@0.18.20: + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.18.20: + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.18.20: + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.18.20: + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.18.20: + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.18.20: + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.18.20: + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.18.20: + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.18.20: + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.18.20: + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.18.20: + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.18.20: + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@eslint-community/eslint-utils@4.4.0(eslint@8.42.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -561,6 +766,15 @@ packages: vue-router: 4.2.0(vue@3.3.4) dev: false + /@halo-dev/ui-plugin-bundler-kit@1.0.0(vite@4.5.0): + resolution: {integrity: sha512-K6D2jPJnLLl0gsiTzRoqXyr4pDl0+venTHW0hbk+cTuB9TNMEEFelBvYefrKQNjK9NpW4wVqviw4QLDXrrY3Vw==} + engines: {node: ^18.0.0 || >=20.0.0} + peerDependencies: + vite: ^4.0.0 || ^5.0.0 + dependencies: + vite: 4.5.0(@types/node@16.18.35)(sass@1.63.3) + dev: true + /@humanwhocodes/config-array@0.11.10: resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} engines: {node: '>=10.10.0'} @@ -856,7 +1070,7 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue-jsx@2.1.1(vite@3.2.7)(vue@3.3.4): + /@vitejs/plugin-vue-jsx@2.1.1(vite@4.5.0)(vue@3.3.4): resolution: {integrity: sha512-JgDhxstQlwnHBvZ1BSnU5mbmyQ14/t5JhREc6YH5kWyu2QdAAOsLF6xgHoIWarj8tddaiwFrNzLbWJPudpXKYA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -866,20 +1080,20 @@ packages: '@babel/core': 7.19.6 '@babel/plugin-transform-typescript': 7.22.5(@babel/core@7.19.6) '@vue/babel-plugin-jsx': 1.1.1(@babel/core@7.19.6) - vite: 3.2.7(@types/node@16.18.35)(sass@1.63.3) + vite: 4.5.0(@types/node@16.18.35)(sass@1.63.3) vue: 3.3.4 transitivePeerDependencies: - supports-color dev: true - /@vitejs/plugin-vue@3.2.0(vite@3.2.7)(vue@3.3.4): + /@vitejs/plugin-vue@3.2.0(vite@4.5.0)(vue@3.3.4): resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^3.0.0 vue: ^3.2.25 dependencies: - vite: 3.2.7(@types/node@16.18.35)(sass@1.63.3) + vite: 4.5.0(@types/node@16.18.35)(sass@1.63.3) vue: 3.3.4 dev: true @@ -949,16 +1163,6 @@ packages: - supports-color dev: true - /@vue/compiler-core@3.2.41: - resolution: {integrity: sha512-oA4mH6SA78DT+96/nsi4p9DX97PHcNROxs51lYk7gb9Z4BPKQ3Mh+BLn6CQZBw857Iuhu28BfMSRHAlPvD4vlw==} - dependencies: - '@babel/parser': 7.22.5 - '@vue/shared': 3.2.41 - estree-walker: 2.0.2 - source-map: 0.6.1 - dev: true - optional: true - /@vue/compiler-core@3.3.4: resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==} dependencies: @@ -967,14 +1171,6 @@ packages: estree-walker: 2.0.2 source-map-js: 1.0.2 - /@vue/compiler-dom@3.2.41: - resolution: {integrity: sha512-xe5TbbIsonjENxJsYRbDJvthzqxLNk+tb3d/c47zgREDa/PCp6/Y4gC/skM4H6PIuX5DAxm7fFJdbjjUH2QTMw==} - dependencies: - '@vue/compiler-core': 3.2.41 - '@vue/shared': 3.2.41 - dev: true - optional: true - /@vue/compiler-dom@3.3.4: resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==} dependencies: @@ -995,14 +1191,6 @@ packages: postcss: 8.4.18 source-map-js: 1.0.2 - /@vue/compiler-ssr@3.2.41: - resolution: {integrity: sha512-Y5wPiNIiaMz/sps8+DmhaKfDm1xgj6GrH99z4gq2LQenfVQcYXmHIOBcs5qPwl7jaW3SUQWjkAPKMfQemEQZwQ==} - dependencies: - '@vue/compiler-dom': 3.2.41 - '@vue/shared': 3.2.41 - dev: true - optional: true - /@vue/compiler-ssr@3.3.4: resolution: {integrity: sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==} dependencies: @@ -1073,18 +1261,6 @@ packages: '@vue/shared': 3.3.4 csstype: 3.1.2 - /@vue/server-renderer@3.2.41(vue@3.3.4): - resolution: {integrity: sha512-7YHLkfJdTlsZTV0ae5sPwl9Gn/EGr2hrlbcS/8naXm2CDpnKUwC68i1wGlrYAfIgYWL7vUZwk2GkYLQH5CvFig==} - requiresBuild: true - peerDependencies: - vue: 3.2.41 - dependencies: - '@vue/compiler-ssr': 3.2.41 - '@vue/shared': 3.2.41 - vue: 3.3.4 - dev: true - optional: true - /@vue/server-renderer@3.3.4(vue@3.3.4): resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==} peerDependencies: @@ -1094,11 +1270,6 @@ packages: '@vue/shared': 3.3.4 vue: 3.3.4 - /@vue/shared@3.2.41: - resolution: {integrity: sha512-W9mfWLHmJhkfAmV+7gDjcHeAWALQtgGT3JErxULl0oz6R6+3ug91I7IErs93eCFhPCZPHBs4QJS7YWEV7A3sxw==} - dev: true - optional: true - /@vue/shared@3.3.4: resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==} @@ -1110,8 +1281,8 @@ packages: js-beautify: 1.14.6 vue: 3.3.4 optionalDependencies: - '@vue/compiler-dom': 3.2.41 - '@vue/server-renderer': 3.2.41(vue@3.3.4) + '@vue/compiler-dom': 3.3.4 + '@vue/server-renderer': 3.3.4(vue@3.3.4) dev: true /@vue/tsconfig@0.1.3(@types/node@16.18.35): @@ -1795,6 +1966,36 @@ packages: esbuild-windows-arm64: 0.15.12 dev: true + /esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -2753,6 +2954,12 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -2998,6 +3205,15 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postcss@8.4.31: + resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + /prelude-ls@1.1.2: resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} engines: {node: '>= 0.8.0'} @@ -3110,6 +3326,14 @@ packages: fsevents: 2.3.2 dev: true + /rollup@3.29.4: + resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.2 + dev: true + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -3223,6 +3447,7 @@ packages: /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + requiresBuild: true dev: true optional: true @@ -3531,6 +3756,43 @@ packages: fsevents: 2.3.2 dev: true + /vite@4.5.0(@types/node@16.18.35)(sass@1.63.3): + resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 16.18.35 + esbuild: 0.18.20 + postcss: 8.4.31 + rollup: 3.29.4 + sass: 1.63.3 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /vitest@0.24.5(jsdom@19.0.0)(sass@1.63.3): resolution: {integrity: sha512-zw6JhPUHtLILQDe5Q39b/SzoITkG+R7hcFjuthp4xsi6zpmfQPOZcHodZ+3bqoWl4EdGK/p1fuMiEwdxgbGLOA==} engines: {node: '>=v14.16.0'} diff --git a/console/vite.config.ts b/console/vite.config.ts index 9b1126c..dd2433d 100644 --- a/console/vite.config.ts +++ b/console/vite.config.ts @@ -4,58 +4,18 @@ import { defineConfig } from "vite"; import Vue from "@vitejs/plugin-vue"; import VueJsx from "@vitejs/plugin-vue-jsx"; import Icons from "unplugin-icons/vite"; +import { HaloUIPluginBundlerKit } from "@halo-dev/ui-plugin-bundler-kit"; -const pluginEntryName = "PluginStarter"; - -// https://vitejs.dev/config/ -export default ({ mode }: { mode: string }) => { - const isProduction = mode === "production"; - const outDir = isProduction - ? "../src/main/resources/console" - : "../build/resources/main/console"; - - return defineConfig({ - plugins: [Vue(), VueJsx(), Icons({ compiler: "vue3" })], - resolve: { - alias: { - "@": fileURLToPath(new URL("./src", import.meta.url)), - }, - }, - define: { - "process.env": process.env, - }, - build: { - outDir, - emptyOutDir: true, - lib: { - entry: "src/index.ts", - name: pluginEntryName, - formats: ["iife"], - fileName: () => "main.js", - }, - rollupOptions: { - external: [ - "vue", - "vue-router", - "@vueuse/core", - "@vueuse/components", - "@vueuse/router", - "@halo-dev/shared", - "@halo-dev/components", - ], - output: { - globals: { - vue: "Vue", - "vue-router": "VueRouter", - "@vueuse/core": "VueUse", - "@vueuse/components": "VueUse", - "@vueuse/router": "VueUse", - "@halo-dev/console-shared": "HaloConsoleShared", - "@halo-dev/components": "HaloComponents", - }, - extend: true, - }, - }, +export default defineConfig({ + plugins: [ + Vue(), + VueJsx(), + Icons({ compiler: "vue3" }), + HaloUIPluginBundlerKit(), + ], + resolve: { + alias: { + "@": fileURLToPath(new URL("./src", import.meta.url)), }, - }); -}; + }, +});