diff --git a/package.json b/package.json index 2c17dfd0..8ae1639c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "lint": "eslint", "lint:fix": "eslint --fix", "test": "vitest test", - "typecheck": "tsc", + "typecheck": "vue-tsc", "postinstall": "npx simple-git-hooks" }, "dependencies": { @@ -88,6 +88,7 @@ "vitest": "^1.5.1", "vue": "^3.4.25", "vue-demi": "^0.14.7", + "vue-tsc": "^2.0.14", "web-ext": "^7.11.0", "webext-bridge": "5.0.5", "webextension-polyfill": "^0.11.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 822cbcdb..682cef79 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -143,7 +143,7 @@ importers: version: 0.17.5(@vueuse/core@10.9.0(vue@3.4.25(typescript@5.4.5)))(rollup@4.16.4) unplugin-icons: specifier: ^0.18.5 - version: 0.18.5(@vue/compiler-sfc@3.4.25) + version: 0.18.5(@vue/compiler-sfc@3.4.25)(vue-template-compiler@2.7.16) unplugin-vue-components: specifier: ^0.26.0 version: 0.26.0(@babel/parser@7.24.4)(rollup@4.16.4)(vue@3.4.25(typescript@5.4.5)) @@ -159,6 +159,9 @@ importers: vue-demi: specifier: ^0.14.7 version: 0.14.7(vue@3.4.25(typescript@5.4.5)) + vue-tsc: + specifier: ^2.0.14 + version: 2.0.14(typescript@5.4.5) web-ext: specifier: ^7.11.0 version: 7.11.0 @@ -1253,6 +1256,15 @@ packages: '@vitest/utils@1.5.1': resolution: {integrity: sha512-92pE17bBXUxA0Y7goPcvnATMCuq4NQLOmqsG0e2BtzRi7KLwZB5jpiELi/8ybY8IQNWemKjSD5rMoO7xTdv8ug==} + '@volar/language-core@2.2.0-alpha.10': + resolution: {integrity: sha512-njVJLtpu0zMvDaEk7K5q4BRpOgbyEUljU++un9TfJoJNhxG0z/hWwpwgTRImO42EKvwIxF3XUzeMk+qatAFy7Q==} + + '@volar/source-map@2.2.0-alpha.10': + resolution: {integrity: sha512-nrdWApVkP5cksAnDEyy1JD9rKdwOJsEq1B+seWO4vNXmZNcxQQCx4DULLBvKt7AzRUAQiAuw5aQkb9RBaSqdVA==} + + '@volar/typescript@2.2.0-alpha.10': + resolution: {integrity: sha512-GCa0vTVVdA9ULUsu2Rx7jwsIuyZQPvPVT9o3NrANTbYv+523Ao1gv3glC5vzNSDPM6bUl37r94HbCj7KINQr+g==} + '@vue/compiler-core@3.4.25': resolution: {integrity: sha512-Y2pLLopaElgWnMNolgG8w3C5nNUVev80L7hdQ5iIKPtMJvhVpG0zhnBG/g3UajJmZdvW0fktyZTotEHD1Srhbg==} @@ -1268,6 +1280,14 @@ packages: '@vue/devtools-api@6.5.1': resolution: {integrity: sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==} + '@vue/language-core@2.0.14': + resolution: {integrity: sha512-3q8mHSNcGTR7sfp2X6jZdcb4yt8AjBXAfKk0qkZIh7GAJxOnoZ10h5HToZglw4ToFvAnq+xu/Z2FFbglh9Icag==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@vue/reactivity@3.4.25': resolution: {integrity: sha512-mKbEtKr1iTxZkAG3vm3BtKHAOhuI4zzsVcN0epDldU/THsrvfXRKzq+lZnjczZGnTdh3ojd86/WrP+u9M51pWQ==} @@ -1805,6 +1825,9 @@ packages: resolution: {integrity: sha512-eVw6n7CnEMFzc3duyFVrQEuY1BlHR3rYsSztyG32ibGMW722i3C6IizEGMFmfMU+A+fALvBIwxN3czffTcdA+Q==} engines: {node: '>= 6'} + computeds@0.0.1: + resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -1914,6 +1937,9 @@ packages: resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} engines: {node: '>=18'} + de-indent@1.0.2: + resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} + debounce@1.2.1: resolution: {integrity: sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==} @@ -2717,6 +2743,10 @@ packages: resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} engines: {node: '>= 0.4'} + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -3398,6 +3428,9 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + muggle-string@0.4.1: + resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==} + multimatch@6.0.0: resolution: {integrity: sha512-I7tSVxHGPlmPN/enE3mS1aOSo6bWBfls+3HmuEeCUBCE7gWnm3cBXCBkpurzFjVRwC6Kld8lLaZ1Iv5vOcjvcQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -3637,6 +3670,9 @@ packages: parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -4772,11 +4808,20 @@ packages: peerDependencies: vue: ^3.0.0 + vue-template-compiler@2.7.16: + resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} + vue-toastification@2.0.0-rc.5: resolution: {integrity: sha512-q73e5jy6gucEO/U+P48hqX+/qyXDozAGmaGgLFm5tXX4wJBcVsnGp4e/iJqlm9xzHETYOilUuwOUje2Qg1JdwA==} peerDependencies: vue: ^3.0.2 + vue-tsc@2.0.14: + resolution: {integrity: sha512-DgAO3U1cnCHOUO7yB35LENbkapeRsBZ7Ugq5hGz/QOHny0+1VQN8eSwSBjYbjLVPfvfw6EY7sNPjbuHHUhckcg==} + hasBin: true + peerDependencies: + typescript: '*' + vue@3.4.25: resolution: {integrity: sha512-HWyDqoBHMgav/OKiYA2ZQg+kjfMgLt/T0vg4cbIF7JbXAjDexRf5JRg+PWAfrAkSmTd2I8aPSXtooBFWHB98cg==} peerDependencies: @@ -6180,6 +6225,19 @@ snapshots: loupe: 2.3.7 pretty-format: 29.7.0 + '@volar/language-core@2.2.0-alpha.10': + dependencies: + '@volar/source-map': 2.2.0-alpha.10 + + '@volar/source-map@2.2.0-alpha.10': + dependencies: + muggle-string: 0.4.1 + + '@volar/typescript@2.2.0-alpha.10': + dependencies: + '@volar/language-core': 2.2.0-alpha.10 + path-browserify: 1.0.1 + '@vue/compiler-core@3.4.25': dependencies: '@babel/parser': 7.24.4 @@ -6212,6 +6270,18 @@ snapshots: '@vue/devtools-api@6.5.1': {} + '@vue/language-core@2.0.14(typescript@5.4.5)': + dependencies: + '@volar/language-core': 2.2.0-alpha.10 + '@vue/compiler-dom': 3.4.25 + '@vue/shared': 3.4.25 + computeds: 0.0.1 + minimatch: 9.0.4 + path-browserify: 1.0.1 + vue-template-compiler: 2.7.16 + optionalDependencies: + typescript: 5.4.5 + '@vue/reactivity@3.4.25': dependencies: '@vue/shared': 3.4.25 @@ -6834,6 +6904,8 @@ snapshots: normalize-path: 3.0.0 readable-stream: 2.3.8 + computeds@0.0.1: {} + concat-map@0.0.1: {} concat-stream@1.6.2: @@ -6953,6 +7025,8 @@ snapshots: whatwg-mimetype: 4.0.0 whatwg-url: 14.0.0 + de-indent@1.0.2: {} + debounce@1.2.1: {} debug@2.6.9: @@ -7955,6 +8029,8 @@ snapshots: dependencies: function-bind: 1.1.2 + he@1.2.0: {} + hosted-git-info@2.8.9: {} html-encoding-sniffer@4.0.0: @@ -8607,6 +8683,8 @@ snapshots: ms@2.1.3: {} + muggle-string@0.4.1: {} + multimatch@6.0.0: dependencies: '@types/minimatch': 3.0.5 @@ -8866,6 +8944,8 @@ snapshots: dependencies: entities: 4.5.0 + path-browserify@1.0.1: {} + path-exists@4.0.0: {} path-exists@5.0.0: {} @@ -9883,7 +9963,7 @@ snapshots: transitivePeerDependencies: - rollup - unplugin-icons@0.18.5(@vue/compiler-sfc@3.4.25): + unplugin-icons@0.18.5(@vue/compiler-sfc@3.4.25)(vue-template-compiler@2.7.16): dependencies: '@antfu/install-pkg': 0.3.2 '@antfu/utils': 0.7.7 @@ -9894,6 +9974,7 @@ snapshots: unplugin: 1.6.0 optionalDependencies: '@vue/compiler-sfc': 3.4.25 + vue-template-compiler: 2.7.16 transitivePeerDependencies: - supports-color @@ -10062,10 +10143,22 @@ snapshots: '@vue/devtools-api': 6.5.1 vue: 3.4.25(typescript@5.4.5) + vue-template-compiler@2.7.16: + dependencies: + de-indent: 1.0.2 + he: 1.2.0 + vue-toastification@2.0.0-rc.5(vue@3.4.25(typescript@5.4.5)): dependencies: vue: 3.4.25(typescript@5.4.5) + vue-tsc@2.0.14(typescript@5.4.5): + dependencies: + '@volar/typescript': 2.2.0-alpha.10 + '@vue/language-core': 2.0.14(typescript@5.4.5) + semver: 7.6.0 + typescript: 5.4.5 + vue@3.4.25(typescript@5.4.5): dependencies: '@vue/compiler-dom': 3.4.25 diff --git a/src/components/TopBar/TopBar.vue b/src/components/TopBar/TopBar.vue index 0c3ecc28..ab1c4460 100644 --- a/src/components/TopBar/TopBar.vue +++ b/src/components/TopBar/TopBar.vue @@ -305,7 +305,7 @@ async function getUnreadMessageCount() { try { let res - res = await useApiClient().NOTIFICATION.getUnreadMsg() + res = await useApiClient().notification.getUnreadMsg() if (res.code === 0) { Object.assign(unReadMessage, res.data) Object.entries(unReadMessage).forEach(([key, value]) => { @@ -316,7 +316,7 @@ async function getUnreadMessageCount() { }) } - res = await useApiClient().NOTIFICATION.getUnreadDm() + res = await useApiClient().notification.getUnreadDm() if (res.code === 0) { Object.assign(unReadDm, res.data) if (typeof unReadDm.follow_unread === 'number') @@ -338,7 +338,7 @@ async function getTopBarNewMomentsCount() { let result = 0 try { - const res = await useApiClient().MOMENT.getTopBarNewMomentsCount() + const res = await useApiClient().moment.getTopBarNewMomentsCount() if (res.code === 0) { if (typeof res.data.update_info.item.count === 'number') result = res.data.update_info.item.count diff --git a/src/components/TopBar/components/MomentsPop.vue b/src/components/TopBar/components/MomentsPop.vue index 688a07c4..5c123071 100644 --- a/src/components/TopBar/components/MomentsPop.vue +++ b/src/components/TopBar/components/MomentsPop.vue @@ -103,7 +103,7 @@ function checkIfHasNewMomentsThenUpdateMoments() { if (selectedMomentTab.value.type === 'live') return - api.MOMENT.getTopBarMoments({ + api.moment.getTopBarMoments({ type: selectedMomentTab.value.type, update_baseline: momentUpdateBaseline.value || undefined, }) diff --git a/src/components/TopBar/components/WatchLaterPop.vue b/src/components/TopBar/components/WatchLaterPop.vue index 84ef5e65..862078c4 100644 --- a/src/components/TopBar/components/WatchLaterPop.vue +++ b/src/components/TopBar/components/WatchLaterPop.vue @@ -34,7 +34,7 @@ function getAllWatchLaterList() { isLoading.value = true watchLaterList.length = 0 - api.watchlater.getAllWatchlaterList() + api.watchlater.getAllWatchLaterList() .then((res: WatchLaterResult) => { if (res.code === 0) Object.assign(watchLaterList, res.data.list) diff --git a/src/contentScripts/views/Video/types.ts b/src/contentScripts/views/Video/types.ts index 256456c0..8d9b1d86 100644 --- a/src/contentScripts/views/Video/types.ts +++ b/src/contentScripts/views/Video/types.ts @@ -292,6 +292,7 @@ export interface Comment { members: [] jump_url: NonNullable max_line: 6 + emote: any } replies?: Comment[] up_action: {