From 473d82d49f412b7a8d9e736be2aac0c75d94fc8b Mon Sep 17 00:00:00 2001 From: ZvonimirSun Date: Wed, 21 Feb 2024 11:38:33 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=8A=BD=E5=8F=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 8 +- package.json | 1 + pnpm-lock.yaml | 192 +++++++++++++++++++++++++++++- src/App.vue | 3 +- src/config.ts | 36 ++++++ src/main.ts | 5 +- src/router/index.ts | 7 +- src/{ => types}/auto-imports.d.ts | 72 +++++------ src/{ => types}/components.d.ts | 20 ++-- uno.config.ts | 3 +- vite.config.ts | 40 ++++--- 11 files changed, 310 insertions(+), 77 deletions(-) create mode 100644 src/config.ts rename src/{ => types}/auto-imports.d.ts (95%) rename src/{ => types}/components.d.ts (84%) diff --git a/index.html b/index.html index 805967b08..2a68e37fb 100644 --- a/index.html +++ b/index.html @@ -6,19 +6,17 @@ - + - ISZY工具集合 + <%- zhName %>
- - diff --git a/package.json b/package.json index ae26d6560..0074732c3 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,7 @@ "unplugin-auto-import": "^0.17.5", "unplugin-vue-components": "^0.26.0", "vite": "^5.1.3", + "vite-plugin-html": "^3.2.2", "vite-plugin-pwa": "^0.19.0", "vite-plugin-vue-devtools": "^7.0.15", "vitest": "^1.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95478c853..052064c71 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -304,6 +304,9 @@ devDependencies: vite: specifier: ^5.1.3 version: 5.1.3(less@4.2.0)(sass@1.71.0) + vite-plugin-html: + specifier: ^3.2.2 + version: 3.2.2(vite@5.1.3) vite-plugin-pwa: specifier: ^0.19.0 version: 0.19.0(vite@5.1.3)(workbox-build@7.0.0)(workbox-window@7.0.0) @@ -2933,6 +2936,14 @@ packages: rollup: 2.79.1 dev: true + /@rollup/pluginutils@4.2.1: + resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} + engines: {node: '>= 8.0.0'} + dependencies: + estree-walker: 2.0.2 + picomatch: 2.3.1 + dev: true + /@rollup/pluginutils@5.1.0(rollup@2.79.1): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} @@ -5600,6 +5611,13 @@ packages: engines: {node: '>=6'} dev: true + /camel-case@4.1.2: + resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} + dependencies: + pascal-case: 3.1.2 + tslib: 2.6.2 + dev: true + /camelcase@5.3.1: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} @@ -5674,6 +5692,13 @@ packages: engines: {node: '>=8'} dev: true + /clean-css@5.3.3: + resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} + engines: {node: '>= 10.0'} + dependencies: + source-map: 0.6.1 + dev: true + /clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -5796,6 +5821,11 @@ packages: /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + /commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + dev: true + /common-tags@1.8.2: resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} engines: {node: '>=4.0.0'} @@ -5828,6 +5858,15 @@ packages: ini: 1.3.8 proto-list: 1.2.4 + /connect-history-api-fallback@1.6.0: + resolution: {integrity: sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==} + engines: {node: '>=0.8'} + dev: true + + /consola@2.15.3: + resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} + dev: true + /consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} @@ -5894,6 +5933,16 @@ packages: engines: {node: '>=8'} dev: true + /css-select@4.3.0: + resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} + dependencies: + boolbase: 1.0.0 + css-what: 6.1.0 + domhandler: 4.3.1 + domutils: 2.8.0 + nth-check: 2.1.1 + dev: true + /css-tree@2.3.1: resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} @@ -5901,6 +5950,11 @@ packages: mdn-data: 2.0.30 source-map-js: 1.0.2 + /css-what@6.1.0: + resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==} + engines: {node: '>= 6'} + dev: true + /csscolorparser@1.0.3: resolution: {integrity: sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==} dev: false @@ -6199,10 +6253,54 @@ packages: resolution: {integrity: sha512-bvVTQe1lfaUr1oFzZX80ce9KLDlZ3iU+XGNE/bz9HnGdklTieqsbmsLHe+rT2XWqopvL0PckkYqN7ksmm5pe3w==} dev: false + /dom-serializer@1.4.1: + resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==} + dependencies: + domelementtype: 2.3.0 + domhandler: 4.3.1 + entities: 2.2.0 + dev: true + /dom-to-image@2.6.0: resolution: {integrity: sha512-Dt0QdaHmLpjURjU7Tnu3AgYSF2LuOmksSGsUcE6ItvJoCWTBEmiMXcqBdNSAm9+QbbwD7JMoVsuuKX6ZVQv1qA==} dev: false + /domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + dev: true + + /domhandler@4.3.1: + resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} + engines: {node: '>= 4'} + dependencies: + domelementtype: 2.3.0 + dev: true + + /domutils@2.8.0: + resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + dependencies: + dom-serializer: 1.4.1 + domelementtype: 2.3.0 + domhandler: 4.3.1 + dev: true + + /dot-case@3.0.4: + resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} + dependencies: + no-case: 3.0.4 + tslib: 2.6.2 + dev: true + + /dotenv-expand@8.0.3: + resolution: {integrity: sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==} + engines: {node: '>=12'} + dev: true + + /dotenv@16.4.5: + resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + engines: {node: '>=12'} + dev: true + /duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} dev: true @@ -6301,6 +6399,10 @@ packages: engines: {node: '>= 0.11.14'} dev: false + /entities@2.2.0: + resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + dev: true + /entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -6983,6 +7085,15 @@ packages: pause-stream: 0.0.11 dev: false + /fs-extra@10.1.0: + resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} + engines: {node: '>=12'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 + dev: true + /fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} @@ -7296,6 +7407,20 @@ packages: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: true + /html-minifier-terser@6.1.0: + resolution: {integrity: sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==} + engines: {node: '>=12'} + hasBin: true + dependencies: + camel-case: 4.1.2 + clean-css: 5.3.3 + commander: 8.3.0 + he: 1.2.0 + param-case: 3.0.4 + relateurl: 0.2.7 + terser: 5.26.0 + dev: true + /html-tags@3.3.1: resolution: {integrity: sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==} engines: {node: '>=8'} @@ -8115,6 +8240,12 @@ packages: get-func-name: 2.0.2 dev: true + /lower-case@2.0.2: + resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} + dependencies: + tslib: 2.6.2 + dev: true + /lru-cache@10.1.0: resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} engines: {node: 14 || >=16.14} @@ -8445,7 +8576,7 @@ packages: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} dependencies: acorn: 8.11.3 - pathe: 1.1.1 + pathe: 1.1.2 pkg-types: 1.0.3 ufo: 1.3.2 dev: true @@ -8519,6 +8650,13 @@ packages: engines: {node: '>= 0.6'} dev: true + /no-case@3.0.4: + resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} + dependencies: + lower-case: 2.0.2 + tslib: 2.6.2 + dev: true + /node-fetch-native@1.6.1: resolution: {integrity: sha512-bW9T/uJDPAJB2YNYEpWzE54U5O3MQidXsOyTfnbKYtTtFexRvGzb1waphBN4ZwP6EcIvYYEOwW0b72BpAqydTw==} dev: true @@ -8542,6 +8680,13 @@ packages: - supports-color dev: true + /node-html-parser@5.4.2: + resolution: {integrity: sha512-RaBPP3+51hPne/OolXxcz89iYvQvKOydaqoePpOgXcrOKZhjVIzmpKZz+Hd/RBO2/zN2q6CNJhQzucVz+u3Jyw==} + dependencies: + css-select: 4.3.0 + he: 1.2.0 + dev: true + /node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true @@ -8878,6 +9023,13 @@ packages: resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} dev: false + /param-case@3.0.4: + resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} + dependencies: + dot-case: 3.0.4 + tslib: 2.6.2 + dev: true + /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -8900,6 +9052,13 @@ packages: entities: 4.5.0 dev: true + /pascal-case@3.1.2: + resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} + dependencies: + no-case: 3.0.4 + tslib: 2.6.2 + dev: true + /path-browserify@1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} dev: true @@ -8938,8 +9097,8 @@ packages: engines: {node: '>=8'} dev: true - /pathe@1.1.1: - resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} + /pathe@0.2.0: + resolution: {integrity: sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==} dev: true /pathe@1.1.2: @@ -9013,7 +9172,7 @@ packages: dependencies: jsonc-parser: 3.2.0 mlly: 1.4.2 - pathe: 1.1.1 + pathe: 1.1.2 dev: true /platform@1.3.6: @@ -9337,6 +9496,11 @@ packages: resolution: {integrity: sha512-bEAtp/qrtKucxXSJkD4ebopFZYP0q1+3Vb2WECWv/T8yQEgKxDxJ7ztO285tAMaYZVR6mM1GgI6CCn8FROtL1w==} dev: false + /relateurl@0.2.7: + resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==} + engines: {node: '>= 0.10'} + dev: true + /relationship.js@1.2.4: resolution: {integrity: sha512-6HTLFGBz4a1PZxPMIg3gPZ8SNak3zAK6UDZytjtyfkCeBXBf+eCymLbfgJieJtLbzUmLCxIm4xdYYQ/FxZxqTw==} dev: false @@ -10653,6 +10817,26 @@ packages: - terser dev: true + /vite-plugin-html@3.2.2(vite@5.1.3): + resolution: {integrity: sha512-vb9C9kcdzcIo/Oc3CLZVS03dL5pDlOFuhGlZYDCJ840BhWl/0nGeZWf3Qy7NlOayscY4Cm/QRgULCQkEZige5Q==} + peerDependencies: + vite: '>=2.0.0' + dependencies: + '@rollup/pluginutils': 4.2.1 + colorette: 2.0.20 + connect-history-api-fallback: 1.6.0 + consola: 2.15.3 + dotenv: 16.4.5 + dotenv-expand: 8.0.3 + ejs: 3.1.9 + fast-glob: 3.3.2 + fs-extra: 10.1.0 + html-minifier-terser: 6.1.0 + node-html-parser: 5.4.2 + pathe: 0.2.0 + vite: 5.1.3(less@4.2.0)(sass@1.71.0) + dev: true + /vite-plugin-inspect@0.8.3(rollup@2.79.1)(vite@5.1.3): resolution: {integrity: sha512-SBVzOIdP/kwe6hjkt7LSW4D0+REqqe58AumcnCfRNw4Kt3mbS9pEBkch+nupu2PBxv2tQi69EQHQ1ZA1vgB/Og==} engines: {node: '>=14'} diff --git a/src/App.vue b/src/App.vue index dd2612436..5dae6bbe3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,7 +21,7 @@ >
- ISZY工具集合 + {{ config.zhName }}
{ const pinia = createPinia() @@ -19,7 +20,7 @@ const $apiBase = import.meta.env.PROD ? 'https://api.iszy.xyz' : import.meta.env axios.$apiBase = $apiBase const piniaPersistPlugin = await createPiniaPersist({ - name: 'iszy_tools', + name: config.name, storeName: 'state', version: 3 }) diff --git a/src/router/index.ts b/src/router/index.ts index 0d609f7b1..365fe6c30 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -9,6 +9,7 @@ import { import { merge } from 'lodash-es' import type { DefineComponent } from 'vue' import { isExternalLink } from '@/utils/common' +import config from '@/config' const toolsStore = useToolsStore() @@ -145,10 +146,10 @@ async function checkAuth (to: RouteLocationNormalized, from: RouteLocationNormal } function getPageTitle (pageTitle: string | undefined | null) { - if (pageTitle && pageTitle !== 'ISZY工具集合') { - return `${pageTitle} - ISZY工具集合` + if (pageTitle && pageTitle !== config.zhName) { + return `${pageTitle} - ${config.zhName}` } - return 'ISZY工具集合' + return config.zhName } export default router diff --git a/src/auto-imports.d.ts b/src/types/auto-imports.d.ts similarity index 95% rename from src/auto-imports.d.ts rename to src/types/auto-imports.d.ts index 56eb9b734..4833322e7 100644 --- a/src/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -120,7 +120,7 @@ declare global { const unref: typeof import('vue')['unref'] const unrefElement: typeof import('@vueuse/core')['unrefElement'] const until: typeof import('@vueuse/core')['until'] - const use2048Store: typeof import('./stores/2048')['use2048Store'] + const use2048Store: typeof import('../stores/2048')['use2048Store'] const useActiveElement: typeof import('@vueuse/core')['useActiveElement'] const useAnimate: typeof import('@vueuse/core')['useAnimate'] const useArrayDifference: typeof import('@vueuse/core')['useArrayDifference'] @@ -150,7 +150,7 @@ declare global { const useCloned: typeof import('@vueuse/core')['useCloned'] const useColorMode: typeof import('@vueuse/core')['useColorMode'] const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog'] - const useCopy: typeof import('./composables/useCopy')['useCopy'] + const useCopy: typeof import('../composables/useCopy')['useCopy'] const useCounter: typeof import('@vueuse/core')['useCounter'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVar: typeof import('@vueuse/core')['useCssVar'] @@ -191,19 +191,19 @@ declare global { const useGeolocation: typeof import('@vueuse/core')['useGeolocation'] const useIdle: typeof import('@vueuse/core')['useIdle'] const useImage: typeof import('@vueuse/core')['useImage'] - const useImgHostingStore: typeof import('./stores/imgHosting')['useImgHostingStore'] + const useImgHostingStore: typeof import('../stores/imgHosting')['useImgHostingStore'] const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll'] const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver'] const useInterval: typeof import('@vueuse/core')['useInterval'] const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn'] - const useJsonEditorStore: typeof import('./stores/jsonEditor')['useJsonEditorStore'] + const useJsonEditorStore: typeof import('../stores/jsonEditor')['useJsonEditorStore'] const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier'] const useLastChanged: typeof import('@vueuse/core')['useLastChanged'] const useLink: typeof import('vue-router')['useLink'] - const useLinuxCommandStore: typeof import('./stores/linuxCommand')['useLinuxCommandStore'] + const useLinuxCommandStore: typeof import('../stores/linuxCommand')['useLinuxCommandStore'] const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage'] const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys'] - const useMainStore: typeof import('./stores/main')['useMainStore'] + const useMainStore: typeof import('../stores/main')['useMainStore'] const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory'] const useMediaControls: typeof import('@vueuse/core')['useMediaControls'] const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery'] @@ -245,7 +245,7 @@ declare global { const useScroll: typeof import('@vueuse/core')['useScroll'] const useScrollLock: typeof import('@vueuse/core')['useScrollLock'] const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage'] - const useSettingStore: typeof import('./stores/setting')['useSettingStore'] + const useSettingStore: typeof import('../stores/setting')['useSettingStore'] const useShare: typeof import('@vueuse/core')['useShare'] const useSlots: typeof import('vue')['useSlots'] const useSorted: typeof import('@vueuse/core')['useSorted'] @@ -254,8 +254,8 @@ declare global { const useStepper: typeof import('@vueuse/core')['useStepper'] const useStorage: typeof import('@vueuse/core')['useStorage'] const useStorageAsync: typeof import('@vueuse/core')['useStorageAsync'] - const useStore: typeof import('./stores/urlEncode')['useStore'] - const useStyleStore: typeof import('./stores/style')['useStyleStore'] + const useStore: typeof import('../stores/urlEncode')['useStore'] + const useStyleStore: typeof import('../stores/style')['useStyleStore'] const useStyleTag: typeof import('@vueuse/core')['useStyleTag'] const useSupported: typeof import('@vueuse/core')['useSupported'] const useSwipe: typeof import('@vueuse/core')['useSwipe'] @@ -271,16 +271,16 @@ declare global { const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn'] const useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll'] const useTimestamp: typeof import('@vueuse/core')['useTimestamp'] - const useTinyEditorStore: typeof import('./stores/tinyEditor')['useTinyEditorStore'] + const useTinyEditorStore: typeof import('../stores/tinyEditor')['useTinyEditorStore'] const useTitle: typeof import('@vueuse/core')['useTitle'] const useToNumber: typeof import('@vueuse/core')['useToNumber'] const useToString: typeof import('@vueuse/core')['useToString'] const useToggle: typeof import('@vueuse/core')['useToggle'] - const useToolsStore: typeof import('./stores/tools')['useToolsStore'] + const useToolsStore: typeof import('../stores/tools')['useToolsStore'] const useTransition: typeof import('@vueuse/core')['useTransition'] const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams'] const useUserMedia: typeof import('@vueuse/core')['useUserMedia'] - const useUserStore: typeof import('./stores/user')['useUserStore'] + const useUserStore: typeof import('../stores/user')['useUserStore'] const useVModel: typeof import('@vueuse/core')['useVModel'] const useVModels: typeof import('@vueuse/core')['useVModels'] const useVibrate: typeof import('@vueuse/core')['useVibrate'] @@ -436,7 +436,7 @@ declare module 'vue' { readonly unref: UnwrapRef readonly unrefElement: UnwrapRef readonly until: UnwrapRef - readonly use2048Store: UnwrapRef + readonly use2048Store: UnwrapRef readonly useActiveElement: UnwrapRef readonly useAnimate: UnwrapRef readonly useArrayDifference: UnwrapRef @@ -466,7 +466,7 @@ declare module 'vue' { readonly useCloned: UnwrapRef readonly useColorMode: UnwrapRef readonly useConfirmDialog: UnwrapRef - readonly useCopy: UnwrapRef + readonly useCopy: UnwrapRef readonly useCounter: UnwrapRef readonly useCssModule: UnwrapRef readonly useCssVar: UnwrapRef @@ -507,19 +507,19 @@ declare module 'vue' { readonly useGeolocation: UnwrapRef readonly useIdle: UnwrapRef readonly useImage: UnwrapRef - readonly useImgHostingStore: UnwrapRef + readonly useImgHostingStore: UnwrapRef readonly useInfiniteScroll: UnwrapRef readonly useIntersectionObserver: UnwrapRef readonly useInterval: UnwrapRef readonly useIntervalFn: UnwrapRef - readonly useJsonEditorStore: UnwrapRef + readonly useJsonEditorStore: UnwrapRef readonly useKeyModifier: UnwrapRef readonly useLastChanged: UnwrapRef readonly useLink: UnwrapRef - readonly useLinuxCommandStore: UnwrapRef + readonly useLinuxCommandStore: UnwrapRef readonly useLocalStorage: UnwrapRef readonly useMagicKeys: UnwrapRef - readonly useMainStore: UnwrapRef + readonly useMainStore: UnwrapRef readonly useManualRefHistory: UnwrapRef readonly useMediaControls: UnwrapRef readonly useMediaQuery: UnwrapRef @@ -561,7 +561,7 @@ declare module 'vue' { readonly useScroll: UnwrapRef readonly useScrollLock: UnwrapRef readonly useSessionStorage: UnwrapRef - readonly useSettingStore: UnwrapRef + readonly useSettingStore: UnwrapRef readonly useShare: UnwrapRef readonly useSlots: UnwrapRef readonly useSorted: UnwrapRef @@ -570,8 +570,8 @@ declare module 'vue' { readonly useStepper: UnwrapRef readonly useStorage: UnwrapRef readonly useStorageAsync: UnwrapRef - readonly useStore: UnwrapRef - readonly useStyleStore: UnwrapRef + readonly useStore: UnwrapRef + readonly useStyleStore: UnwrapRef readonly useStyleTag: UnwrapRef readonly useSupported: UnwrapRef readonly useSwipe: UnwrapRef @@ -587,16 +587,16 @@ declare module 'vue' { readonly useTimeoutFn: UnwrapRef readonly useTimeoutPoll: UnwrapRef readonly useTimestamp: UnwrapRef - readonly useTinyEditorStore: UnwrapRef + readonly useTinyEditorStore: UnwrapRef readonly useTitle: UnwrapRef readonly useToNumber: UnwrapRef readonly useToString: UnwrapRef readonly useToggle: UnwrapRef - readonly useToolsStore: UnwrapRef + readonly useToolsStore: UnwrapRef readonly useTransition: UnwrapRef readonly useUrlSearchParams: UnwrapRef readonly useUserMedia: UnwrapRef - readonly useUserStore: UnwrapRef + readonly useUserStore: UnwrapRef readonly useVModel: UnwrapRef readonly useVModels: UnwrapRef readonly useVibrate: UnwrapRef @@ -745,7 +745,7 @@ declare module '@vue/runtime-core' { readonly unref: UnwrapRef readonly unrefElement: UnwrapRef readonly until: UnwrapRef - readonly use2048Store: UnwrapRef + readonly use2048Store: UnwrapRef readonly useActiveElement: UnwrapRef readonly useAnimate: UnwrapRef readonly useArrayDifference: UnwrapRef @@ -775,7 +775,7 @@ declare module '@vue/runtime-core' { readonly useCloned: UnwrapRef readonly useColorMode: UnwrapRef readonly useConfirmDialog: UnwrapRef - readonly useCopy: UnwrapRef + readonly useCopy: UnwrapRef readonly useCounter: UnwrapRef readonly useCssModule: UnwrapRef readonly useCssVar: UnwrapRef @@ -816,19 +816,19 @@ declare module '@vue/runtime-core' { readonly useGeolocation: UnwrapRef readonly useIdle: UnwrapRef readonly useImage: UnwrapRef - readonly useImgHostingStore: UnwrapRef + readonly useImgHostingStore: UnwrapRef readonly useInfiniteScroll: UnwrapRef readonly useIntersectionObserver: UnwrapRef readonly useInterval: UnwrapRef readonly useIntervalFn: UnwrapRef - readonly useJsonEditorStore: UnwrapRef + readonly useJsonEditorStore: UnwrapRef readonly useKeyModifier: UnwrapRef readonly useLastChanged: UnwrapRef readonly useLink: UnwrapRef - readonly useLinuxCommandStore: UnwrapRef + readonly useLinuxCommandStore: UnwrapRef readonly useLocalStorage: UnwrapRef readonly useMagicKeys: UnwrapRef - readonly useMainStore: UnwrapRef + readonly useMainStore: UnwrapRef readonly useManualRefHistory: UnwrapRef readonly useMediaControls: UnwrapRef readonly useMediaQuery: UnwrapRef @@ -870,7 +870,7 @@ declare module '@vue/runtime-core' { readonly useScroll: UnwrapRef readonly useScrollLock: UnwrapRef readonly useSessionStorage: UnwrapRef - readonly useSettingStore: UnwrapRef + readonly useSettingStore: UnwrapRef readonly useShare: UnwrapRef readonly useSlots: UnwrapRef readonly useSorted: UnwrapRef @@ -879,8 +879,8 @@ declare module '@vue/runtime-core' { readonly useStepper: UnwrapRef readonly useStorage: UnwrapRef readonly useStorageAsync: UnwrapRef - readonly useStore: UnwrapRef - readonly useStyleStore: UnwrapRef + readonly useStore: UnwrapRef + readonly useStyleStore: UnwrapRef readonly useStyleTag: UnwrapRef readonly useSupported: UnwrapRef readonly useSwipe: UnwrapRef @@ -896,16 +896,16 @@ declare module '@vue/runtime-core' { readonly useTimeoutFn: UnwrapRef readonly useTimeoutPoll: UnwrapRef readonly useTimestamp: UnwrapRef - readonly useTinyEditorStore: UnwrapRef + readonly useTinyEditorStore: UnwrapRef readonly useTitle: UnwrapRef readonly useToNumber: UnwrapRef readonly useToString: UnwrapRef readonly useToggle: UnwrapRef - readonly useToolsStore: UnwrapRef + readonly useToolsStore: UnwrapRef readonly useTransition: UnwrapRef readonly useUrlSearchParams: UnwrapRef readonly useUserMedia: UnwrapRef - readonly useUserStore: UnwrapRef + readonly useUserStore: UnwrapRef readonly useVModel: UnwrapRef readonly useVModels: UnwrapRef readonly useVibrate: UnwrapRef diff --git a/src/components.d.ts b/src/types/components.d.ts similarity index 84% rename from src/components.d.ts rename to src/types/components.d.ts index c19e865d5..d2b606d80 100644 --- a/src/components.d.ts +++ b/src/types/components.d.ts @@ -18,11 +18,11 @@ declare module 'vue' { ATypographyParagraph: typeof import('ant-design-vue/es')['TypographyParagraph'] ATypographyText: typeof import('ant-design-vue/es')['TypographyText'] ATypographyTitle: typeof import('ant-design-vue/es')['TypographyTitle'] - Checkerboard: typeof import('./components/checkerboard.vue')['default'] - Container: typeof import('./components/container.vue')['default'] - CopyableText: typeof import('./components/CopyableText.vue')['default'] - Editor: typeof import('./components/editor/Editor.vue')['default'] - EditorMini: typeof import('./components/editor/EditorMini.vue')['default'] + Checkerboard: typeof import('./../components/checkerboard.vue')['default'] + Container: typeof import('./../components/container.vue')['default'] + CopyableText: typeof import('./../components/CopyableText.vue')['default'] + Editor: typeof import('./../components/editor/Editor.vue')['default'] + EditorMini: typeof import('./../components/editor/EditorMini.vue')['default'] ElAlert: typeof import('element-plus/es')['ElAlert'] ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] ElBacktop: typeof import('element-plus/es')['ElBacktop'] @@ -75,13 +75,13 @@ declare module 'vue' { ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElUpload: typeof import('element-plus/es')['ElUpload'] - FixedWidgets: typeof import('./components/fixed-widgets.vue')['default'] - FormatTransformer: typeof import('./components/FormatTransformer.vue')['default'] - HaveAccess: typeof import('./components/HaveAccess.vue')['default'] - JsonEditor: typeof import('./components/JsonEditor.vue')['default'] + FixedWidgets: typeof import('./../components/fixed-widgets.vue')['default'] + FormatTransformer: typeof import('./../components/FormatTransformer.vue')['default'] + HaveAccess: typeof import('./../components/HaveAccess.vue')['default'] + JsonEditor: typeof import('./../components/JsonEditor.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] - VanillaJsonEditor: typeof import('./components/VanillaJsonEditor.vue')['default'] + VanillaJsonEditor: typeof import('./../components/VanillaJsonEditor.vue')['default'] } export interface ComponentCustomProperties { vLoading: typeof import('element-plus/es')['ElLoadingDirective'] diff --git a/uno.config.ts b/uno.config.ts index 0add91c1e..3478d2b94 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -9,6 +9,7 @@ import { } from 'unocss' import axios from 'axios' import tools from './src/tools.json' +import config from './src/config' const iconClass = tools.map(item => item.icon).filter(item => item) @@ -23,7 +24,7 @@ export default defineConfig({ } }), presetWebFonts({ - customFetch: (url: string) => axios.get(url.replace('fonts.googleapis.com', 'fonts.cdn.iszy.xyz')).then(it => it.data), + customFetch: (url: string) => axios.get(url.replace('fonts.googleapis.com', `fonts.${config.cdnHost}`)).then(it => it.data), provider: 'google', fonts: { main: [ diff --git a/vite.config.ts b/vite.config.ts index 3b99ce2cb..c1579f5d6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,6 +11,8 @@ import Unocss from 'unocss/vite' import AutoImport from 'unplugin-auto-import/vite' import vueJsx from '@vitejs/plugin-vue-jsx' import VueDevTools from 'vite-plugin-vue-devtools' +import config from './src/config' +import { createHtmlPlugin } from 'vite-plugin-html' // https://vitejs.dev/config/ export default defineConfig({ @@ -24,6 +26,15 @@ export default defineConfig({ plugins: [ vue(), vueJsx(), + VueDevTools(), + createHtmlPlugin({ + entry: 'src/main.ts', + inject: { + data: { + ...config + } + } + }), AutoImport({ resolvers: [ ElementPlusResolver(), @@ -40,14 +51,14 @@ export default defineConfig({ }, dirs: ['src/composables', 'src/stores'], vueTemplate: true, - dts: 'src/auto-imports.d.ts' + dts: 'src/types/auto-imports.d.ts' }), Unocss(), Components({ include: [/\.vue$/, /\.vue\?vue/], dirs: ['src/components'], extensions: ['vue'], - dts: 'src/components.d.ts', + dts: 'src/types/components.d.ts', resolvers: [ ElementPlusResolver(), AntDesignVueResolver() @@ -56,9 +67,9 @@ export default defineConfig({ VitePWA({ scope: '/', manifest: { - id: 'iszy_tools', - name: 'ISZY工具集合', - short_name: 'ISZY TOOLS', + id: config.name, + name: config.zhName, + short_name: config.alias, icons: [ { src: '/images/android-chrome-192x192.png', @@ -95,10 +106,10 @@ export default defineConfig({ runtimeCaching: [ // api { - urlPattern: ({ url }) => url.origin === 'https://api.iszy.xyz', + urlPattern: ({ url }) => url.origin === config.apiOrigin, handler: 'NetworkFirst', options: { - cacheName: 'iszy-api', + cacheName: `${config.key}-api`, cacheableResponse: { statuses: [200] } @@ -106,10 +117,10 @@ export default defineConfig({ }, // cdn { - urlPattern: ({ url }) => url.hostname.endsWith('cdn.iszy.xyz'), + urlPattern: ({ url }) => url.hostname.endsWith(config.cdnHost), handler: 'CacheFirst', options: { - cacheName: 'iszy-cdn', + cacheName: `${config.key}-cdn`, expiration: { maxEntries: 30, maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days @@ -124,7 +135,7 @@ export default defineConfig({ urlPattern: /\.(?:png|jpg|jpeg|svg|ico)$/, handler: 'CacheFirst', options: { - cacheName: 'iszy-images', + cacheName: `${config.key}-images`, expiration: { // 最多30个图 maxEntries: 30 @@ -138,7 +149,7 @@ export default defineConfig({ urlPattern: /\.(?:woff|eot|otf|ttf|TTF)$/, handler: 'CacheFirst', options: { - cacheName: 'iszy-font', + cacheName: `${config.key}-font`, cacheableResponse: { statuses: [200] } @@ -148,7 +159,7 @@ export default defineConfig({ urlPattern: /.*\.css.*/, handler: 'CacheFirst', options: { - cacheName: 'iszy-css', + cacheName: `${config.key}-css`, cacheableResponse: { statuses: [200] } @@ -158,7 +169,7 @@ export default defineConfig({ urlPattern: /.*\.js.*/, handler: 'CacheFirst', options: { - cacheName: 'iszy-js', + cacheName: `${config.key}-js`, cacheableResponse: { statuses: [200] } @@ -167,8 +178,7 @@ export default defineConfig({ ] } }), - Sitemap({ tools, hostname: 'https://tools.iszy.xyz' }), - VueDevTools() + Sitemap({ tools, hostname: config.siteOrigin }) ], optimizeDeps: { include: ['vue', 'element-plus', 'ant-design-vue']