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

View File

@ -9,11 +9,14 @@ defineProps<Props>()
<template>
<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>
<slot />
</span>
<span v-else class="leading-relaxed whitespace-pre-wrap" :class="[{ 'text-red-500': error }]">
<span v-highlight class="leading-relaxed whitespace-pre-wrap">
<slot />
</span>
</div>
</template>
<style>
.hljs {
background-color: #fff0 !important;
}
</style>

View File

@ -17,7 +17,7 @@ const historyStore = useHistoryStore()
const scrollRef = ref<HTMLDivElement>()
const { addChat, clearChat: handleClear } = useChat()
const { addChat, clearChat } = useChat()
const prompt = ref('')
const loading = ref(false)
@ -54,7 +54,7 @@ async function handleSubmit() {
}
catch (error: any) {
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 {
loading.value = false
@ -79,8 +79,12 @@ function scrollToBottom() {
nextTick(() => scrollRef.value && (scrollRef.value.scrollTop = scrollRef.value.scrollHeight))
}
function handleClear() {
handleCancel()
clearChat()
}
function handleCancel() {
//
controller.abort()
controller = new AbortController()
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 App from './App.vue'
import { setupDirectives } from './directives'
import { setupAssets } from '@/plugins'
import { setupStore } from '@/store'
import { setupRouter } from '@/router'
import hljs from 'highlight.js'
import "highlight.js/styles/xcode.css"
async function bootstrap() {
const app = createApp(App)
setupAssets()
setupStore(app)
await setupRouter(app)
setupDirectives(app)
let regexp = /^(?:\s{4}|\t).+/gm
app.directive('hljs', {
mounted: (el: HTMLElement) => {
if (el.textContent?.indexOf(" = ") != -1 || el.textContent.match(regexp)) {
hljs.highlightBlock(el)
}
}
})
await setupRouter(app)
app.mount('#app')
}

View File

View File

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

View File

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

View File

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