perf: 优化 `pr` 代码

This commit is contained in:
ChenZhaoYu 2023-02-15 13:26:02 +08:00
parent b2977d8c44
commit 79eeb51537
10 changed files with 132 additions and 76 deletions

View File

@ -1,4 +1,4 @@
lockfileVersion: 5.3 lockfileVersion: 5.4
specifiers: specifiers:
'@antfu/eslint-config': ^0.35.2 '@antfu/eslint-config': ^0.35.2
@ -30,12 +30,12 @@ specifiers:
dependencies: dependencies:
highlight.js: 11.7.0 highlight.js: 11.7.0
naive-ui: 2.34.3_vue@3.2.47 naive-ui: 2.34.3_vue@3.2.47
pinia: 2.0.30_typescript@4.9.5+vue@3.2.47 pinia: 2.0.30_hmuptsblhheur2tugfgucj7gc4
vue: 3.2.47 vue: 3.2.47
vue-router: 4.1.6_vue@3.2.47 vue-router: 4.1.6_vue@3.2.47
devDependencies: devDependencies:
'@antfu/eslint-config': 0.35.2_eslint@8.34.0+typescript@4.9.5 '@antfu/eslint-config': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
'@commitlint/cli': 17.4.3 '@commitlint/cli': 17.4.3
'@commitlint/config-conventional': 17.4.3 '@commitlint/config-conventional': 17.4.3
'@iconify/vue': 4.1.0_vue@3.2.47 '@iconify/vue': 4.1.0_vue@3.2.47
@ -51,85 +51,93 @@ devDependencies:
npm-run-all: 4.1.5 npm-run-all: 4.1.5
postcss: 8.4.21 postcss: 8.4.21
rimraf: 4.1.2 rimraf: 4.1.2
tailwindcss: 3.2.6 tailwindcss: 3.2.6_postcss@8.4.21
typescript: 4.9.5 typescript: 4.9.5
vite: 4.1.1_@types+node@18.13.0 vite: 4.1.1_@types+node@18.13.0
vue-tsc: 1.0.24_typescript@4.9.5 vue-tsc: 1.0.24_typescript@4.9.5
packages: packages:
/@antfu/eslint-config-basic/0.35.2_b676bbf5f101a168ab75b3e568fc2dcd: /@antfu/eslint-config-basic/0.35.2_6ike4423xm2xnh233ikrbff5m4:
resolution: {integrity: sha512-2k7Ovkd8U/q0sgfjuT9KzAUV0q187yGxP7JzD2D4YifuJwL5Bh3JC49KpCv9PXMTeRUMJX2y/kOtGYPetocOug==} resolution: {integrity: sha512-2k7Ovkd8U/q0sgfjuT9KzAUV0q187yGxP7JzD2D4YifuJwL5Bh3JC49KpCv9PXMTeRUMJX2y/kOtGYPetocOug==}
peerDependencies: peerDependencies:
eslint: '>=7.4.0' eslint: '>=7.4.0'
dependencies: dependencies:
eslint: 8.34.0 eslint: 8.34.0
eslint-plugin-antfu: 0.35.2_eslint@8.34.0+typescript@4.9.5 eslint-plugin-antfu: 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0 eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
eslint-plugin-html: 7.1.0 eslint-plugin-html: 7.1.0
eslint-plugin-import: 2.27.5_eslint@8.34.0 eslint-plugin-import: 2.27.5_62tsymtiqxebhmxuag4hg3gx2m
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0 eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
eslint-plugin-markdown: 3.0.0_eslint@8.34.0 eslint-plugin-markdown: 3.0.0_eslint@8.34.0
eslint-plugin-n: 15.6.1_eslint@8.34.0 eslint-plugin-n: 15.6.1_eslint@8.34.0
eslint-plugin-no-only-tests: 3.1.0 eslint-plugin-no-only-tests: 3.1.0
eslint-plugin-promise: 6.1.1_eslint@8.34.0 eslint-plugin-promise: 6.1.1_eslint@8.34.0
eslint-plugin-unicorn: 45.0.2_eslint@8.34.0 eslint-plugin-unicorn: 45.0.2_eslint@8.34.0
eslint-plugin-unused-imports: 2.0.0_0f47fab7a5a87de3ae1cbe7c11f4c3bb eslint-plugin-unused-imports: 2.0.0_b5d7vn5fvb66hlq4xz6bd5gdxm
eslint-plugin-yml: 1.5.0_eslint@8.34.0 eslint-plugin-yml: 1.5.0_eslint@8.34.0
jsonc-eslint-parser: 2.1.0 jsonc-eslint-parser: 2.1.0
yaml-eslint-parser: 1.1.0 yaml-eslint-parser: 1.1.0
transitivePeerDependencies: transitivePeerDependencies:
- '@typescript-eslint/eslint-plugin' - '@typescript-eslint/eslint-plugin'
- '@typescript-eslint/parser'
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color - supports-color
- typescript - typescript
dev: true dev: true
/@antfu/eslint-config-ts/0.35.2_eslint@8.34.0+typescript@4.9.5: /@antfu/eslint-config-ts/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-GiJtTCQ83L/vMkJlWWg2l0buH/LIOXl5szrsqtr8/Hl6ssjAMXnug8sDZMCqCIZtztzQCewBPx8ufp/MpzA2cQ==} resolution: {integrity: sha512-GiJtTCQ83L/vMkJlWWg2l0buH/LIOXl5szrsqtr8/Hl6ssjAMXnug8sDZMCqCIZtztzQCewBPx8ufp/MpzA2cQ==}
peerDependencies: peerDependencies:
eslint: '>=7.4.0' eslint: '>=7.4.0'
typescript: '>=3.9' typescript: '>=3.9'
dependencies: dependencies:
'@antfu/eslint-config-basic': 0.35.2_b676bbf5f101a168ab75b3e568fc2dcd '@antfu/eslint-config-basic': 0.35.2_6ike4423xm2xnh233ikrbff5m4
'@typescript-eslint/eslint-plugin': 5.51.0_cf25694f76a520ae1d6c27009cc9663f '@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
'@typescript-eslint/parser': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0 eslint: 8.34.0
eslint-plugin-jest: 27.2.1_b676bbf5f101a168ab75b3e568fc2dcd eslint-plugin-jest: 27.2.1_wz3lx5pragqwrk3vwpswr7bnzu
typescript: 4.9.5 typescript: 4.9.5
transitivePeerDependencies: transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- jest - jest
- supports-color - supports-color
dev: true dev: true
/@antfu/eslint-config-vue/0.35.2_b676bbf5f101a168ab75b3e568fc2dcd: /@antfu/eslint-config-vue/0.35.2_6ike4423xm2xnh233ikrbff5m4:
resolution: {integrity: sha512-98k9D+n0bgr/9OqedAEOsflIWbXz4D92pejXqkUAtnRnB2Nq5dWrrFMJ59oJwTDKnEslpwANlgIXM11qdiTF0Q==} resolution: {integrity: sha512-98k9D+n0bgr/9OqedAEOsflIWbXz4D92pejXqkUAtnRnB2Nq5dWrrFMJ59oJwTDKnEslpwANlgIXM11qdiTF0Q==}
peerDependencies: peerDependencies:
eslint: '>=7.4.0' eslint: '>=7.4.0'
dependencies: dependencies:
'@antfu/eslint-config-basic': 0.35.2_b676bbf5f101a168ab75b3e568fc2dcd '@antfu/eslint-config-basic': 0.35.2_6ike4423xm2xnh233ikrbff5m4
'@antfu/eslint-config-ts': 0.35.2_eslint@8.34.0+typescript@4.9.5 '@antfu/eslint-config-ts': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0 eslint: 8.34.0
eslint-plugin-vue: 9.9.0_eslint@8.34.0 eslint-plugin-vue: 9.9.0_eslint@8.34.0
local-pkg: 0.4.3 local-pkg: 0.4.3
transitivePeerDependencies: transitivePeerDependencies:
- '@typescript-eslint/eslint-plugin' - '@typescript-eslint/eslint-plugin'
- '@typescript-eslint/parser'
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- jest - jest
- supports-color - supports-color
- typescript - typescript
dev: true dev: true
/@antfu/eslint-config/0.35.2_eslint@8.34.0+typescript@4.9.5: /@antfu/eslint-config/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-bbm7Yh7VgNI9ZaYs/L1oSTQwPMIdvlRtqxPfaBLpYdEvnsOuT4yX84TO0YaZ4RFjE4jqxQCSE/eioxydmWnl4w==} resolution: {integrity: sha512-bbm7Yh7VgNI9ZaYs/L1oSTQwPMIdvlRtqxPfaBLpYdEvnsOuT4yX84TO0YaZ4RFjE4jqxQCSE/eioxydmWnl4w==}
peerDependencies: peerDependencies:
eslint: '>=7.4.0' eslint: '>=7.4.0'
dependencies: dependencies:
'@antfu/eslint-config-vue': 0.35.2_b676bbf5f101a168ab75b3e568fc2dcd '@antfu/eslint-config-vue': 0.35.2_6ike4423xm2xnh233ikrbff5m4
'@typescript-eslint/eslint-plugin': 5.51.0_cf25694f76a520ae1d6c27009cc9663f '@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
'@typescript-eslint/parser': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0 eslint: 8.34.0
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0 eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
eslint-plugin-html: 7.1.0 eslint-plugin-html: 7.1.0
eslint-plugin-import: 2.27.5_eslint@8.34.0 eslint-plugin-import: 2.27.5_62tsymtiqxebhmxuag4hg3gx2m
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0 eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
eslint-plugin-n: 15.6.1_eslint@8.34.0 eslint-plugin-n: 15.6.1_eslint@8.34.0
eslint-plugin-promise: 6.1.1_eslint@8.34.0 eslint-plugin-promise: 6.1.1_eslint@8.34.0
@ -139,6 +147,8 @@ packages:
jsonc-eslint-parser: 2.1.0 jsonc-eslint-parser: 2.1.0
yaml-eslint-parser: 1.1.0 yaml-eslint-parser: 1.1.0
transitivePeerDependencies: transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- jest - jest
- supports-color - supports-color
- typescript - typescript
@ -272,12 +282,12 @@ packages:
'@types/node': 18.13.0 '@types/node': 18.13.0
chalk: 4.1.2 chalk: 4.1.2
cosmiconfig: 8.0.0 cosmiconfig: 8.0.0
cosmiconfig-typescript-loader: 4.3.0_7fc4ff0e4538e2b57d95a5c7bb386195 cosmiconfig-typescript-loader: 4.3.0_p7cp6dsfhdrlk7mvuxd3wodbsu
lodash.isplainobject: 4.0.6 lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2 lodash.merge: 4.6.2
lodash.uniq: 4.5.0 lodash.uniq: 4.5.0
resolve-from: 5.0.0 resolve-from: 5.0.0
ts-node: 10.9.1_e0496289fa41028b51cb1eba3f44c296 ts-node: 10.9.1_4bewfcp2iebiwuold25d6rgcsy
typescript: 4.9.5 typescript: 4.9.5
transitivePeerDependencies: transitivePeerDependencies:
- '@swc/core' - '@swc/core'
@ -745,7 +755,7 @@ packages:
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.51.0_cf25694f76a520ae1d6c27009cc9663f: /@typescript-eslint/eslint-plugin/5.51.0_z4swst3wuuqk4hlme4ajzslgh4:
resolution: {integrity: sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ==} resolution: {integrity: sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -756,10 +766,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/scope-manager': 5.51.0 '@typescript-eslint/scope-manager': 5.51.0
'@typescript-eslint/type-utils': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/type-utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/utils': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
debug: 4.3.4 debug: 4.3.4
eslint: 8.34.0 eslint: 8.34.0
grapheme-splitter: 1.0.4 grapheme-splitter: 1.0.4
@ -773,7 +783,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.51.0_eslint@8.34.0+typescript@4.9.5: /@typescript-eslint/parser/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA==} resolution: {integrity: sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -801,7 +811,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.51.0 '@typescript-eslint/visitor-keys': 5.51.0
dev: true dev: true
/@typescript-eslint/type-utils/5.51.0_eslint@8.34.0+typescript@4.9.5: /@typescript-eslint/type-utils/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ==} resolution: {integrity: sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -812,7 +822,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/typescript-estree': 5.51.0_typescript@4.9.5 '@typescript-eslint/typescript-estree': 5.51.0_typescript@4.9.5
'@typescript-eslint/utils': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
debug: 4.3.4 debug: 4.3.4
eslint: 8.34.0 eslint: 8.34.0
tsutils: 3.21.0_typescript@4.9.5 tsutils: 3.21.0_typescript@4.9.5
@ -847,7 +857,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.51.0_eslint@8.34.0+typescript@4.9.5: /@typescript-eslint/utils/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw==} resolution: {integrity: sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -982,7 +992,6 @@ packages:
dependencies: dependencies:
'@vue/reactivity': 3.2.47 '@vue/reactivity': 3.2.47
'@vue/shared': 3.2.47 '@vue/shared': 3.2.47
dev: false
/@vue/runtime-dom/3.2.47: /@vue/runtime-dom/3.2.47:
resolution: {integrity: sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA==} resolution: {integrity: sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA==}
@ -990,7 +999,6 @@ packages:
'@vue/runtime-core': 3.2.47 '@vue/runtime-core': 3.2.47
'@vue/shared': 3.2.47 '@vue/shared': 3.2.47
csstype: 2.6.21 csstype: 2.6.21
dev: false
/@vue/server-renderer/3.2.47_vue@3.2.47: /@vue/server-renderer/3.2.47_vue@3.2.47:
resolution: {integrity: sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA==} resolution: {integrity: sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA==}
@ -1000,7 +1008,6 @@ packages:
'@vue/compiler-ssr': 3.2.47 '@vue/compiler-ssr': 3.2.47
'@vue/shared': 3.2.47 '@vue/shared': 3.2.47
vue: 3.2.47 vue: 3.2.47
dev: false
/@vue/shared/3.2.47: /@vue/shared/3.2.47:
resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==} resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==}
@ -1475,15 +1482,15 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
hasBin: true hasBin: true
dependencies: dependencies:
is-text-path: 1.0.1
JSONStream: 1.3.5 JSONStream: 1.3.5
is-text-path: 1.0.1
lodash: 4.17.21 lodash: 4.17.21
meow: 8.1.2 meow: 8.1.2
split2: 3.2.2 split2: 3.2.2
through2: 4.0.2 through2: 4.0.2
dev: true dev: true
/cosmiconfig-typescript-loader/4.3.0_7fc4ff0e4538e2b57d95a5c7bb386195: /cosmiconfig-typescript-loader/4.3.0_p7cp6dsfhdrlk7mvuxd3wodbsu:
resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==} resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==}
engines: {node: '>=12', npm: '>=6'} engines: {node: '>=12', npm: '>=6'}
peerDependencies: peerDependencies:
@ -1494,7 +1501,7 @@ packages:
dependencies: dependencies:
'@types/node': 18.13.0 '@types/node': 18.13.0
cosmiconfig: 8.0.0 cosmiconfig: 8.0.0
ts-node: 10.9.1_e0496289fa41028b51cb1eba3f44c296 ts-node: 10.9.1_4bewfcp2iebiwuold25d6rgcsy
typescript: 4.9.5 typescript: 4.9.5
dev: true dev: true
@ -1551,7 +1558,6 @@ packages:
/csstype/2.6.21: /csstype/2.6.21:
resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==} resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==}
dev: false
/csstype/3.0.11: /csstype/3.0.11:
resolution: {integrity: sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==} resolution: {integrity: sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==}
@ -1581,6 +1587,11 @@ packages:
/debug/3.2.7: /debug/3.2.7:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies: dependencies:
ms: 2.1.3 ms: 2.1.3
dev: true dev: true
@ -1850,25 +1861,43 @@ packages:
debug: 3.2.7 debug: 3.2.7
is-core-module: 2.11.0 is-core-module: 2.11.0
resolve: 1.22.1 resolve: 1.22.1
transitivePeerDependencies:
- supports-color
dev: true dev: true
/eslint-module-utils/2.7.4_eslint@8.34.0: /eslint-module-utils/2.7.4_ithmlgmaospkvl4p7n7pyp3rgq:
resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==} resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': '*'
eslint: '*' eslint: '*'
eslint-import-resolver-node: '*'
eslint-import-resolver-typescript: '*'
eslint-import-resolver-webpack: '*'
peerDependenciesMeta: peerDependenciesMeta:
'@typescript-eslint/parser':
optional: true
eslint: eslint:
optional: true optional: true
eslint-import-resolver-node:
optional: true
eslint-import-resolver-typescript:
optional: true
eslint-import-resolver-webpack:
optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
debug: 3.2.7 debug: 3.2.7
eslint: 8.34.0 eslint: 8.34.0
eslint-import-resolver-node: 0.3.7
transitivePeerDependencies:
- supports-color
dev: true dev: true
/eslint-plugin-antfu/0.35.2_eslint@8.34.0+typescript@4.9.5: /eslint-plugin-antfu/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-Q6FOcOakafU49PDRlq7jkrWmlTJ4u3AW7aGX+FqeQNaMgjXq0RzPGvS0Vyp7q/XDRLLoe0BjbGkamTeZXg8waw==} resolution: {integrity: sha512-Q6FOcOakafU49PDRlq7jkrWmlTJ4u3AW7aGX+FqeQNaMgjXq0RzPGvS0Vyp7q/XDRLLoe0BjbGkamTeZXg8waw==}
dependencies: dependencies:
'@typescript-eslint/utils': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
transitivePeerDependencies: transitivePeerDependencies:
- eslint - eslint
- supports-color - supports-color
@ -1903,12 +1932,17 @@ packages:
htmlparser2: 8.0.1 htmlparser2: 8.0.1
dev: true dev: true
/eslint-plugin-import/2.27.5_eslint@8.34.0: /eslint-plugin-import/2.27.5_62tsymtiqxebhmxuag4hg3gx2m:
resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': '*'
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
peerDependenciesMeta:
'@typescript-eslint/parser':
optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
array-includes: 3.1.6 array-includes: 3.1.6
array.prototype.flat: 1.3.1 array.prototype.flat: 1.3.1
array.prototype.flatmap: 1.3.1 array.prototype.flatmap: 1.3.1
@ -1916,7 +1950,7 @@ packages:
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.34.0 eslint: 8.34.0
eslint-import-resolver-node: 0.3.7 eslint-import-resolver-node: 0.3.7
eslint-module-utils: 2.7.4_eslint@8.34.0 eslint-module-utils: 2.7.4_ithmlgmaospkvl4p7n7pyp3rgq
has: 1.0.3 has: 1.0.3
is-core-module: 2.11.0 is-core-module: 2.11.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -1925,9 +1959,13 @@ packages:
resolve: 1.22.1 resolve: 1.22.1
semver: 6.3.0 semver: 6.3.0
tsconfig-paths: 3.14.1 tsconfig-paths: 3.14.1
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color
dev: true dev: true
/eslint-plugin-jest/27.2.1_b676bbf5f101a168ab75b3e568fc2dcd: /eslint-plugin-jest/27.2.1_wz3lx5pragqwrk3vwpswr7bnzu:
resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==} resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies: peerDependencies:
@ -1940,8 +1978,8 @@ packages:
jest: jest:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/eslint-plugin': 5.51.0_cf25694f76a520ae1d6c27009cc9663f '@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
'@typescript-eslint/utils': 5.51.0_eslint@8.34.0+typescript@4.9.5 '@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0 eslint: 8.34.0
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -2028,7 +2066,7 @@ packages:
strip-indent: 3.0.0 strip-indent: 3.0.0
dev: true dev: true
/eslint-plugin-unused-imports/2.0.0_0f47fab7a5a87de3ae1cbe7c11f4c3bb: /eslint-plugin-unused-imports/2.0.0_b5d7vn5fvb66hlq4xz6bd5gdxm:
resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2038,7 +2076,7 @@ packages:
'@typescript-eslint/eslint-plugin': '@typescript-eslint/eslint-plugin':
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/eslint-plugin': 5.51.0_cf25694f76a520ae1d6c27009cc9663f '@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
eslint: 8.34.0 eslint: 8.34.0
eslint-rule-composer: 0.3.0 eslint-rule-composer: 0.3.0
dev: true dev: true
@ -3545,7 +3583,7 @@ packages:
engines: {node: '>=4'} engines: {node: '>=4'}
dev: true dev: true
/pinia/2.0.30_typescript@4.9.5+vue@3.2.47: /pinia/2.0.30_hmuptsblhheur2tugfgucj7gc4:
resolution: {integrity: sha512-q6DUmxWwe/mQgg+55QQjykpKC+aGeGdaJV3niminl19V08dE+LRTvSEuqi6/NLSGCKHI49KGL6tMNEOssFiMyA==} resolution: {integrity: sha512-q6DUmxWwe/mQgg+55QQjykpKC+aGeGdaJV3niminl19V08dE+LRTvSEuqi6/NLSGCKHI49KGL6tMNEOssFiMyA==}
peerDependencies: peerDependencies:
'@vue/composition-api': ^1.4.0 '@vue/composition-api': ^1.4.0
@ -4105,10 +4143,12 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dev: true dev: true
/tailwindcss/3.2.6: /tailwindcss/3.2.6_postcss@8.4.21:
resolution: {integrity: sha512-BfgQWZrtqowOQMC2bwaSNe7xcIjdDEgixWGYOd6AL0CbKHJlvhfdbINeAW76l1sO+1ov/MJ93ODJ9yluRituIw==} resolution: {integrity: sha512-BfgQWZrtqowOQMC2bwaSNe7xcIjdDEgixWGYOd6AL0CbKHJlvhfdbINeAW76l1sO+1ov/MJ93ODJ9yluRituIw==}
engines: {node: '>=12.13.0'} engines: {node: '>=12.13.0'}
hasBin: true hasBin: true
peerDependencies:
postcss: ^8.0.9
dependencies: dependencies:
arg: 5.0.2 arg: 5.0.2
chokidar: 3.5.3 chokidar: 3.5.3
@ -4176,7 +4216,7 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/ts-node/10.9.1_e0496289fa41028b51cb1eba3f44c296: /ts-node/10.9.1_4bewfcp2iebiwuold25d6rgcsy:
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -4278,7 +4318,6 @@ packages:
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
dev: true
/unbox-primitive/1.0.2: /unbox-primitive/1.0.2:
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
@ -4452,7 +4491,6 @@ packages:
'@vue/runtime-dom': 3.2.47 '@vue/runtime-dom': 3.2.47
'@vue/server-renderer': 3.2.47_vue@3.2.47 '@vue/server-renderer': 3.2.47_vue@3.2.47
'@vue/shared': 3.2.47 '@vue/shared': 3.2.47
dev: false
/vueuc/0.4.51_vue@3.2.47: /vueuc/0.4.51_vue@3.2.47:
resolution: {integrity: sha512-pLiMChM4f+W8czlIClGvGBYo656lc2Y0/mXFSCydcSmnCR1izlKPGMgiYBGjbY9FDkFG8a2HEVz7t0DNzBWbDw==} resolution: {integrity: sha512-pLiMChM4f+W8czlIClGvGBYo656lc2Y0/mXFSCydcSmnCR1izlKPGMgiYBGjbY9FDkFG8a2HEVz7t0DNzBWbDw==}

View File

@ -9,11 +9,14 @@ defineProps<Props>()
<template> <template>
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']"> <div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
<span v-if="!reversal" class="leading-relaxed whitespace-pre-wrap" :class="[{ 'text-red-500': error }]" v-hljs> <span v-highlight class="leading-relaxed whitespace-pre-wrap">
<slot />
</span>
<span v-else class="leading-relaxed whitespace-pre-wrap" :class="[{ 'text-red-500': error }]">
<slot /> <slot />
</span> </span>
</div> </div>
</template> </template>
<style>
.hljs {
background-color: #fff0 !important;
}
</style>

View File

@ -17,7 +17,7 @@ const historyStore = useHistoryStore()
const scrollRef = ref<HTMLDivElement>() const scrollRef = ref<HTMLDivElement>()
const { addChat, clearChat: handleClear } = useChat() const { addChat, clearChat } = useChat()
const prompt = ref('') const prompt = ref('')
const loading = ref(false) const loading = ref(false)
@ -54,7 +54,7 @@ async function handleSubmit() {
} }
catch (error: any) { catch (error: any) {
if (error.message !== 'cancelled') if (error.message !== 'cancelled')
addMessage(`Error: ${error.message ?? 'Request failed, please try again later.'}`, { error: true }) addMessage(`${error.message ?? 'Request failed, please try again later.'}`, { error: true })
} }
finally { finally {
loading.value = false loading.value = false
@ -79,8 +79,12 @@ function scrollToBottom() {
nextTick(() => scrollRef.value && (scrollRef.value.scrollTop = scrollRef.value.scrollHeight)) nextTick(() => scrollRef.value && (scrollRef.value.scrollTop = scrollRef.value.scrollHeight))
} }
function handleClear() {
handleCancel()
clearChat()
}
function handleCancel() { function handleCancel() {
//
controller.abort() controller.abort()
controller = new AbortController() controller = new AbortController()
loading.value = false loading.value = false

View File

@ -0,0 +1,15 @@
import type { App, Directive } from 'vue'
import hljs from 'highlight.js'
const regexp = /^(?:\s{4}|\t).+/gm
export default function setupHighlightDirective(app: App) {
const highLightDirective: Directive<HTMLElement> = {
mounted(el: HTMLElement) {
if (el.textContent?.indexOf(' = ') !== -1 || el.textContent.match(regexp))
hljs.highlightBlock(el)
},
}
app.directive('highlight', highLightDirective)
}

6
src/directives/index.ts Normal file
View File

@ -0,0 +1,6 @@
import type { App } from 'vue'
import setupHighlightDirective from './highlight'
export function setupDirectives(app: App) {
setupHighlightDirective(app)
}

View File

@ -1,26 +1,19 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import { setupDirectives } from './directives'
import { setupAssets } from '@/plugins' import { setupAssets } from '@/plugins'
import { setupStore } from '@/store' import { setupStore } from '@/store'
import { setupRouter } from '@/router' import { setupRouter } from '@/router'
import hljs from 'highlight.js'
import "highlight.js/styles/xcode.css"
async function bootstrap() { async function bootstrap() {
const app = createApp(App) const app = createApp(App)
setupAssets() setupAssets()
setupStore(app) setupStore(app)
await setupRouter(app) setupDirectives(app)
let regexp = /^(?:\s{4}|\t).+/gm await setupRouter(app)
app.directive('hljs', {
mounted: (el: HTMLElement) => {
if (el.textContent?.indexOf(" = ") != -1 || el.textContent.match(regexp)) {
hljs.highlightBlock(el)
}
}
})
app.mount('#app') app.mount('#app')
} }

View File

View File

@ -1,3 +1,4 @@
import 'highlight.js/styles/xcode.css'
import '@/styles/global.css' import '@/styles/global.css'
/** Tailwind's Preflight Style Override */ /** Tailwind's Preflight Style Override */

View File

@ -7,7 +7,3 @@ body,
#app { #app {
height: 100%; height: 100%;
} }
.hljs{
background-color: #fff0!important;
}

View File

@ -2,7 +2,7 @@ import axios, { type AxiosResponse } from 'axios'
const service = axios.create({ const service = axios.create({
baseURL: import.meta.env.VITE_GLOB_API_URL, baseURL: import.meta.env.VITE_GLOB_API_URL,
timeout: 60 * 1000, timeout: 30 * 1000,
}) })
service.interceptors.request.use( service.interceptors.request.use(