From 4ff2dce87f5541ada22be2b566b483c4ca6ac236 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 5 Feb 2023 16:47:21 -0800 Subject: [PATCH 001/121] chore(deps): update dependency vitest to ^0.28.4 (#1649) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 73 +++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 2c354ed1..c8235e50 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "unplugin-vue-inspector": "^0.0.2", "vite-plugin-inspect": "^0.7.14", "vite-plugin-pwa": "^0.14.1", - "vitest": "^0.28.3", + "vitest": "^0.28.4", "vue-tsc": "^1.0.24", "workbox-build": "^6.5.4", "workbox-window": "^6.5.4" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 66178fe1..1cb60381 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: unplugin-vue-inspector: ^0.0.2 vite-plugin-inspect: ^0.7.14 vite-plugin-pwa: ^0.14.1 - vitest: ^0.28.3 + vitest: ^0.28.4 vue-advanced-cropper: ^2.8.8 vue-tsc: ^1.0.24 vue-virtual-scroller: 2.0.0-beta.7 @@ -217,8 +217,8 @@ importers: unplugin-auto-import: 0.13.0_@vueuse+core@9.11.1 unplugin-vue-inspector: 0.0.2 vite-plugin-inspect: 0.7.14 - vite-plugin-pwa: 0.14.1_tz3vz2xt4jvid2diblkpydcyn4 - vitest: 0.28.3 + vite-plugin-pwa: 0.14.1 + vitest: 0.28.4 vue-tsc: 1.0.24_typescript@4.9.4 workbox-build: 6.5.4 workbox-window: 6.5.4 @@ -3928,24 +3928,24 @@ packages: vue: 3.2.45 dev: true - /@vitest/expect/0.28.3: - resolution: {integrity: sha512-dnxllhfln88DOvpAK1fuI7/xHwRgTgR4wdxHldPaoTaBu6Rh9zK5b//v/cjTkhOfNP/AJ8evbNO8H7c3biwd1g==} + /@vitest/expect/0.28.4: + resolution: {integrity: sha512-JqK0NZ4brjvOSL8hXAnIsfi+jxDF7rH/ZWCGCt0FAqRnVFc1hXsfwXksQvEnKqD84avRt3gmeXoK4tNbmkoVsQ==} dependencies: - '@vitest/spy': 0.28.3 - '@vitest/utils': 0.28.3 + '@vitest/spy': 0.28.4 + '@vitest/utils': 0.28.4 chai: 4.3.7 dev: true - /@vitest/runner/0.28.3: - resolution: {integrity: sha512-P0qYbATaemy1midOLkw7qf8jraJszCoEvjQOSlseiXZyEDaZTZ50J+lolz2hWiWv6RwDu1iNseL9XLsG0Jm2KQ==} + /@vitest/runner/0.28.4: + resolution: {integrity: sha512-Q8UV6GjDvBSTfUoq0QXVCNpNOUrWu4P2qvRq7ssJWzn0+S0ojbVOxEjMt+8a32X6SdkhF8ak+2nkppsqV0JyNQ==} dependencies: - '@vitest/utils': 0.28.3 + '@vitest/utils': 0.28.4 p-limit: 4.0.0 pathe: 1.1.0 dev: true - /@vitest/spy/0.28.3: - resolution: {integrity: sha512-jULA6suS6CCr9VZfr7/9x97pZ0hC55prnUNHNrg5/q16ARBY38RsjsfhuUXt6QOwvIN3BhSS0QqPzyh5Di8g6w==} + /@vitest/spy/0.28.4: + resolution: {integrity: sha512-8WuhfXLlvCXpNXEGJW6Gc+IKWI32435fQJLh43u70HnZ1otJOa2Cmg2Wy2Aym47ZnNCP4NolF+8cUPwd0MigKQ==} dependencies: tinyspy: 1.0.2 dev: true @@ -3960,8 +3960,8 @@ packages: sirv: 2.0.2 dev: true - /@vitest/utils/0.28.3: - resolution: {integrity: sha512-YHiQEHQqXyIbhDqETOJUKx9/psybF7SFFVCNfOvap0FvyUqbzTSDCa3S5lL4C0CLXkwVZttz9xknDoyHMguFRQ==} + /@vitest/utils/0.28.4: + resolution: {integrity: sha512-l2QztOLdc2LkR+w/lP52RGh8hW+Ul4KESmCAgVE8q737I7e7bQoAfkARKpkPJ4JQtGpwW4deqlj1732VZD7TFw==} dependencies: cli-truncate: 3.1.0 diff: 5.1.0 @@ -9318,8 +9318,8 @@ packages: get-port-please: 3.0.1 perfect-debounce: 0.1.3 std-env: 3.3.1 - vitest: 0.28.3_@vitest+ui@0.28.3 - vitest-environment-nuxt: 0.6.4_vitest@0.28.3 + vitest: 0.28.4_@vitest+ui@0.28.3 + vitest-environment-nuxt: 0.6.4_vitest@0.28.4 transitivePeerDependencies: - '@edge-runtime/vm' - '@vitest/browser' @@ -12236,8 +12236,8 @@ packages: - terser dev: true - /vite-node/0.28.3_@types+node@18.11.18: - resolution: {integrity: sha512-uJJAOkgVwdfCX8PUQhqLyDOpkBS5+j+FdbsXoPVPDlvVjRkb/W/mLYQPSL6J+t8R0UV8tJSe8c9VyxVQNsDSyg==} + /vite-node/0.28.4_@types+node@18.11.18: + resolution: {integrity: sha512-KM0Q0uSG/xHHKOJvVHc5xDBabgt0l70y7/lWTR7Q0pR5/MrYxadT+y32cJOE65FfjGmJgxpVEEY+69btJgcXOQ==} engines: {node: '>=v14.16.0'} hasBin: true dependencies: @@ -12378,12 +12378,10 @@ packages: - supports-color dev: true - /vite-plugin-pwa/0.14.1_tz3vz2xt4jvid2diblkpydcyn4: + /vite-plugin-pwa/0.14.1: resolution: {integrity: sha512-5zx7yhQ8RTLwV71+GA9YsQQ63ALKG8XXIMqRJDdZkR8ZYftFcRgnzM7wOWmQZ/DATspyhPih5wCdcZnAIsM+mA==} peerDependencies: vite: ^3.1.0 || ^4.0.0 - workbox-build: ^6.5.4 - workbox-window: ^6.5.4 dependencies: '@rollup/plugin-replace': 5.0.2_rollup@3.10.1 debug: 4.3.4 @@ -12393,6 +12391,7 @@ packages: workbox-build: 6.5.4 workbox-window: 6.5.4 transitivePeerDependencies: + - '@types/babel__core' - supports-color dev: true @@ -12515,7 +12514,7 @@ packages: fsevents: 2.3.2 dev: true - /vitest-environment-nuxt/0.6.4_vitest@0.28.3: + /vitest-environment-nuxt/0.6.4_vitest@0.28.4: resolution: {integrity: sha512-cM65pFMFf6xJzF7pTwGKd092yV96brzaK7PoYs60DzL1pe8WJNPKuoQTtf2409mlA07dI7U4MxS5Pnwe4hWbzQ==} peerDependencies: vitest: ^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 @@ -12529,7 +12528,7 @@ packages: magic-string: 0.27.0 ofetch: 1.0.0 unenv: 1.0.2 - vitest: 0.28.3_@vitest+ui@0.28.3 + vitest: 0.28.4_@vitest+ui@0.28.3 transitivePeerDependencies: - '@vue/compiler-dom' - encoding @@ -12537,8 +12536,8 @@ packages: - supports-color dev: true - /vitest/0.28.3: - resolution: {integrity: sha512-N41VPNf3VGJlWQizGvl1P5MGyv3ZZA2Zvh+2V8L6tYBAAuqqDK4zExunT1Cdb6dGfZ4gr+IMrnG8d4Z6j9ctPw==} + /vitest/0.28.4: + resolution: {integrity: sha512-sfWIy0AdlbyGRhunm+TLQEJrFH9XuRPdApfubsyLcDbCRrUX717BRQKInTgzEfyl2Ipi1HWoHB84Nqtcwxogcg==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -12562,10 +12561,10 @@ packages: '@types/chai': 4.3.4 '@types/chai-subset': 1.3.3 '@types/node': 18.11.18 - '@vitest/expect': 0.28.3 - '@vitest/runner': 0.28.3 - '@vitest/spy': 0.28.3 - '@vitest/utils': 0.28.3 + '@vitest/expect': 0.28.4 + '@vitest/runner': 0.28.4 + '@vitest/spy': 0.28.4 + '@vitest/utils': 0.28.4 acorn: 8.8.2 acorn-walk: 8.2.0 cac: 6.7.14 @@ -12581,7 +12580,7 @@ packages: tinypool: 0.3.1 tinyspy: 1.0.2 vite: 3.2.5_@types+node@18.11.18 - vite-node: 0.28.3_@types+node@18.11.18 + vite-node: 0.28.4_@types+node@18.11.18 why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -12592,8 +12591,8 @@ packages: - terser dev: true - /vitest/0.28.3_@vitest+ui@0.28.3: - resolution: {integrity: sha512-N41VPNf3VGJlWQizGvl1P5MGyv3ZZA2Zvh+2V8L6tYBAAuqqDK4zExunT1Cdb6dGfZ4gr+IMrnG8d4Z6j9ctPw==} + /vitest/0.28.4_@vitest+ui@0.28.3: + resolution: {integrity: sha512-sfWIy0AdlbyGRhunm+TLQEJrFH9XuRPdApfubsyLcDbCRrUX717BRQKInTgzEfyl2Ipi1HWoHB84Nqtcwxogcg==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -12617,11 +12616,11 @@ packages: '@types/chai': 4.3.4 '@types/chai-subset': 1.3.3 '@types/node': 18.11.18 - '@vitest/expect': 0.28.3 - '@vitest/runner': 0.28.3 - '@vitest/spy': 0.28.3 + '@vitest/expect': 0.28.4 + '@vitest/runner': 0.28.4 + '@vitest/spy': 0.28.4 '@vitest/ui': 0.28.3 - '@vitest/utils': 0.28.3 + '@vitest/utils': 0.28.4 acorn: 8.8.2 acorn-walk: 8.2.0 cac: 6.7.14 @@ -12637,7 +12636,7 @@ packages: tinypool: 0.3.1 tinyspy: 1.0.2 vite: 3.2.5_@types+node@18.11.18 - vite-node: 0.28.3_@types+node@18.11.18 + vite-node: 0.28.4_@types+node@18.11.18 why-is-node-running: 2.2.2 transitivePeerDependencies: - less From 357dff2140dc6eb37ca6a367b1d8d56820c59a76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 5 Feb 2023 16:55:11 -0800 Subject: [PATCH 002/121] chore(deps): update dependency typescript to ^4.9.5 (#1648) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 236 +++++++++++++++++++++++++------------------------ 2 files changed, 122 insertions(+), 116 deletions(-) diff --git a/package.json b/package.json index c8235e50..baa33002 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "stale-dep": "^0.3.1", "std-env": "^3.3.1", "theme-vitesse": "^0.6.0", - "typescript": "^4.9.4", + "typescript": "^4.9.5", "unimport": "^2.1.0", "unplugin-auto-import": "^0.13.0", "unplugin-vue-inspector": "^0.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cb60381..8533916e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -111,7 +111,7 @@ importers: theme-vitesse: ^0.6.0 tiny-decode: ^0.1.3 tippy.js: ^6.3.7 - typescript: ^4.9.4 + typescript: ^4.9.5 ufo: ^1.0.1 ultrahtml: ^1.2.0 unimport: ^2.1.0 @@ -155,7 +155,7 @@ importers: js-yaml: 4.1.0 lru-cache: 7.14.1 masto: 5.6.1 - pinia: 2.0.29_typescript@4.9.4 + pinia: 2.0.29_typescript@4.9.5 shiki: 0.12.1 shiki-es: 0.2.0 slimeform: 0.9.0 @@ -169,7 +169,7 @@ importers: vue-advanced-cropper: 2.8.8 vue-virtual-scroller: 2.0.0-beta.7 devDependencies: - '@antfu/eslint-config': 0.34.1_7uibuqfxkfaozanbtbziikiqje + '@antfu/eslint-config': 0.34.1_et5x32uxl7z5ldub3ye5rhlyqm '@antfu/ni': 0.19.0 '@emoji-mart/data': 1.1.2 '@iconify-json/carbon': 1.1.14 @@ -181,7 +181,7 @@ importers: '@iconify-json/twemoji': 1.1.10 '@nuxtjs/color-mode': 3.2.0 '@nuxtjs/i18n': 8.0.0-beta.9 - '@pinia/nuxt': 0.4.6_typescript@4.9.4 + '@pinia/nuxt': 0.4.6_typescript@4.9.5 '@types/chroma-js': 2.1.4 '@types/file-saver': 2.0.5 '@types/fnando__sparkline': 0.3.4 @@ -201,7 +201,7 @@ importers: file-saver: 2.0.5 fs-extra: 11.1.0 lint-staged: 13.1.0 - nuxt: 3.1.1_no2el4fe4ggitllzolcgczmlgq + nuxt: 3.1.1_7rz7g5sqfnn6wuv5lem37retty nuxt-security: 0.10.1 nuxt-vitest: 0.6.4 postcss-nested: 6.0.0 @@ -212,14 +212,14 @@ importers: stale-dep: 0.3.1 std-env: 3.3.1 theme-vitesse: 0.6.0 - typescript: 4.9.4 + typescript: 4.9.5 unimport: 2.1.0 unplugin-auto-import: 0.13.0_@vueuse+core@9.11.1 unplugin-vue-inspector: 0.0.2 vite-plugin-inspect: 0.7.14 vite-plugin-pwa: 0.14.1 vitest: 0.28.4 - vue-tsc: 1.0.24_typescript@4.9.4 + vue-tsc: 1.0.24_typescript@4.9.5 workbox-build: 6.5.4 workbox-window: 6.5.4 @@ -241,13 +241,13 @@ packages: '@jridgewell/trace-mapping': 0.3.17 dev: true - /@antfu/eslint-config-basic/0.34.1_iu322prlnwsygkcra5kbpy22si: + /@antfu/eslint-config-basic/0.34.1_uuava45uwav2f2r3waokl3sbum: resolution: {integrity: sha512-kMxVDjjBv3yDQJ2GdpPZDnV7iI+0mygxqLRrhydcppIf5RSfVHwtyFvWfWUJNpQI77Gg/ujeEYOZQE0BI+ndTg==} peerDependencies: eslint: '>=7.4.0' dependencies: eslint: 8.32.0 - eslint-plugin-antfu: 0.34.1_7uibuqfxkfaozanbtbziikiqje + eslint-plugin-antfu: 0.34.1_et5x32uxl7z5ldub3ye5rhlyqm eslint-plugin-eslint-comments: 3.2.0_eslint@8.32.0 eslint-plugin-html: 7.1.0 eslint-plugin-import: 2.27.5_6savw6y3b7jng6f64kgkyoij64 @@ -268,18 +268,18 @@ packages: - typescript dev: true - /@antfu/eslint-config-ts/0.34.1_7uibuqfxkfaozanbtbziikiqje: + /@antfu/eslint-config-ts/0.34.1_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-YpuB+FhHRFpUzNoJI7JWLRgXNegZuaq4ONQl4lVzYG7YjxvKfXox2EfKhtE98i28ozwbsD8kFjYysmCD8SupHQ==} peerDependencies: eslint: '>=7.4.0' typescript: '>=3.9' dependencies: - '@antfu/eslint-config-basic': 0.34.1_iu322prlnwsygkcra5kbpy22si - '@typescript-eslint/eslint-plugin': 5.49.0_iu322prlnwsygkcra5kbpy22si - '@typescript-eslint/parser': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@antfu/eslint-config-basic': 0.34.1_uuava45uwav2f2r3waokl3sbum + '@typescript-eslint/eslint-plugin': 5.49.0_uuava45uwav2f2r3waokl3sbum + '@typescript-eslint/parser': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm eslint: 8.32.0 - eslint-plugin-jest: 27.2.1_sa4tfo476gi7rdzbz5wa2vwvhe - typescript: 4.9.4 + eslint-plugin-jest: 27.2.1_7lzpa56u3hsxrw6qqav6cjjoee + typescript: 4.9.5 transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -287,13 +287,13 @@ packages: - supports-color dev: true - /@antfu/eslint-config-vue/0.34.1_iu322prlnwsygkcra5kbpy22si: + /@antfu/eslint-config-vue/0.34.1_uuava45uwav2f2r3waokl3sbum: resolution: {integrity: sha512-wrYaQCKSH35y/pMKZ9lDRn4n0xkY3DB22FwucmpAgGVQM8Sj7OD1EbaFR3vXyCR7hL2kBtFnFrfeRuzRz6Frrg==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@antfu/eslint-config-basic': 0.34.1_iu322prlnwsygkcra5kbpy22si - '@antfu/eslint-config-ts': 0.34.1_7uibuqfxkfaozanbtbziikiqje + '@antfu/eslint-config-basic': 0.34.1_uuava45uwav2f2r3waokl3sbum + '@antfu/eslint-config-ts': 0.34.1_et5x32uxl7z5ldub3ye5rhlyqm eslint: 8.32.0 eslint-plugin-vue: 9.9.0_eslint@8.32.0 local-pkg: 0.4.3 @@ -306,14 +306,14 @@ packages: - typescript dev: true - /@antfu/eslint-config/0.34.1_7uibuqfxkfaozanbtbziikiqje: + /@antfu/eslint-config/0.34.1_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-Qz3s6n6Z2urePvOJCFxXpzDdaR7pcXX0jadbc0CI9mtzPAWaDDazXPH+AQ55tqJU7zTHYpccrgz0xWgsKqkYTw==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@antfu/eslint-config-vue': 0.34.1_iu322prlnwsygkcra5kbpy22si - '@typescript-eslint/eslint-plugin': 5.49.0_iu322prlnwsygkcra5kbpy22si - '@typescript-eslint/parser': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@antfu/eslint-config-vue': 0.34.1_uuava45uwav2f2r3waokl3sbum + '@typescript-eslint/eslint-plugin': 5.49.0_uuava45uwav2f2r3waokl3sbum + '@typescript-eslint/parser': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm eslint: 8.32.0 eslint-plugin-eslint-comments: 3.2.0_eslint@8.32.0 eslint-plugin-html: 7.1.0 @@ -2673,7 +2673,7 @@ packages: resolution: {integrity: sha512-KffiTNdVaZlkx0tgwopmy627WQclWO0kqFD1R646wawDbNlWkpmwj5qI5qoh2Rx13/O+KkYdc28H3JsQdQmXJw==} dev: true - /@nuxt/vite-builder/3.1.1_khfc6yoidgmzfko3kyvtza3rzq: + /@nuxt/vite-builder/3.1.1_vshnhw7h4tuo6ge5ck2wv7vfrm: resolution: {integrity: sha512-tTV369sIURut6z+t36ib3J2GbgiazMc4VO9wB372A5hnd+faLtapknswMvzF23M+4z1/5tGaV/kkU/ZrO3V1Ag==} engines: {node: ^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0} peerDependencies: @@ -2710,7 +2710,7 @@ packages: unplugin: 1.0.1 vite: 4.0.4 vite-node: 0.28.3 - vite-plugin-checker: 0.5.4_x3aldvjfkbjbaq3ogboucfmn4y + vite-plugin-checker: 0.5.4_h3si5tluig4ewnb7qcro3a3fhu vue: 3.2.45 vue-bundle-renderer: 1.0.0 transitivePeerDependencies: @@ -2850,11 +2850,11 @@ packages: - vue-router dev: true - /@pinia/nuxt/0.4.6_typescript@4.9.4: + /@pinia/nuxt/0.4.6_typescript@4.9.5: resolution: {integrity: sha512-HjrYEfLdFpmsjhicPJgL36jVhzHWukIQPFFHGTSF84Cplu+f2nY2XHKqe9ToHzE9rLee2RjLOwAzOnXa/I/u6A==} dependencies: '@nuxt/kit': 3.1.1 - pinia: 2.0.29_typescript@4.9.4 + pinia: 2.0.29_typescript@4.9.5 transitivePeerDependencies: - '@vue/composition-api' - rollup @@ -3520,7 +3520,7 @@ packages: resolution: {integrity: sha512-UYK244awtmcUYQfs7FR8710MJcefL2WvkyHMjA8yJzxd1mo0Gfn88sRZ1Bls7hiUhA2w7ne1gpJ9T5g3G0wOyA==} dev: true - /@typescript-eslint/eslint-plugin/5.49.0_iu322prlnwsygkcra5kbpy22si: + /@typescript-eslint/eslint-plugin/5.49.0_uuava45uwav2f2r3waokl3sbum: resolution: {integrity: sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3531,23 +3531,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/parser': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm '@typescript-eslint/scope-manager': 5.49.0 - '@typescript-eslint/type-utils': 5.49.0_7uibuqfxkfaozanbtbziikiqje - '@typescript-eslint/utils': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/type-utils': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm + '@typescript-eslint/utils': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm debug: 4.3.4 eslint: 8.32.0 ignore: 5.2.4 natural-compare-lite: 1.4.0 regexpp: 3.2.0 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.49.0_7uibuqfxkfaozanbtbziikiqje: + /@typescript-eslint/parser/5.49.0_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3559,10 +3559,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.49.0 '@typescript-eslint/types': 5.49.0 - '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4 + '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.5 debug: 4.3.4 eslint: 8.32.0 - typescript: 4.9.4 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true @@ -3575,7 +3575,7 @@ packages: '@typescript-eslint/visitor-keys': 5.49.0 dev: true - /@typescript-eslint/type-utils/5.49.0_7uibuqfxkfaozanbtbziikiqje: + /@typescript-eslint/type-utils/5.49.0_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3585,12 +3585,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4 - '@typescript-eslint/utils': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.5 + '@typescript-eslint/utils': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm debug: 4.3.4 eslint: 8.32.0 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true @@ -3600,7 +3600,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.49.0_typescript@4.9.4: + /@typescript-eslint/typescript-estree/5.49.0_typescript@4.9.5: resolution: {integrity: sha512-PBdx+V7deZT/3GjNYPVQv1Nc0U46dAHbIuOG8AZ3on3vuEKiPDwFE/lG1snN2eUB9IhF7EyF7K1hmTcLztNIsA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3615,13 +3615,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.8 - tsutils: 3.21.0_typescript@4.9.4 - typescript: 4.9.4 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.49.0_7uibuqfxkfaozanbtbziikiqje: + /@typescript-eslint/utils/5.49.0_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3631,7 +3631,7 @@ packages: '@types/semver': 7.3.13 '@typescript-eslint/scope-manager': 5.49.0 '@typescript-eslint/types': 5.49.0 - '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4 + '@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.5 eslint: 8.32.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.32.0 @@ -4152,7 +4152,7 @@ packages: '@nuxt/kit': 3.1.1 '@vue-macros/short-vmodel': 1.0.6 '@vue-macros/volar': 0.7.1_vue-tsc@1.0.24 - nuxt: 3.1.1_no2el4fe4ggitllzolcgczmlgq + nuxt: 3.1.1_7rz7g5sqfnn6wuv5lem37retty unplugin-vue-macros: 1.6.4_@vueuse+core@9.11.1 transitivePeerDependencies: - '@vueuse/core' @@ -4254,7 +4254,7 @@ packages: '@vue-macros/define-props': 0.2.4 '@vue-macros/short-vmodel': 1.0.6 muggle-string: 0.2.2 - vue-tsc: 1.0.24_typescript@4.9.4 + vue-tsc: 1.0.24_typescript@4.9.5 transitivePeerDependencies: - rollup - vue @@ -4523,7 +4523,7 @@ packages: '@vueuse/core': 9.11.1 '@vueuse/metadata': 9.11.1 local-pkg: 0.4.3 - nuxt: 3.1.1_no2el4fe4ggitllzolcgczmlgq + nuxt: 3.1.1_7rz7g5sqfnn6wuv5lem37retty vue-demi: 0.13.11 transitivePeerDependencies: - '@vue/composition-api' @@ -6355,7 +6355,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/parser': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm debug: 3.2.7 eslint: 8.32.0 eslint-import-resolver-node: 0.3.7 @@ -6363,10 +6363,10 @@ packages: - supports-color dev: true - /eslint-plugin-antfu/0.34.1_7uibuqfxkfaozanbtbziikiqje: + /eslint-plugin-antfu/0.34.1_et5x32uxl7z5ldub3ye5rhlyqm: resolution: {integrity: sha512-UeS1aTUX9rZgknrBT/NyDCSG6dMd6UbiumHdciE62VwOw04dD8cy/p7m+OJZ6WMF3vz0CseJmzzk8q4pca4sEA==} dependencies: - '@typescript-eslint/utils': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/utils': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm transitivePeerDependencies: - eslint - supports-color @@ -6411,7 +6411,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/parser': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -6434,7 +6434,7 @@ packages: - supports-color dev: true - /eslint-plugin-jest/27.2.1_sa4tfo476gi7rdzbz5wa2vwvhe: + /eslint-plugin-jest/27.2.1_7lzpa56u3hsxrw6qqav6cjjoee: resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -6447,8 +6447,8 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.49.0_iu322prlnwsygkcra5kbpy22si - '@typescript-eslint/utils': 5.49.0_7uibuqfxkfaozanbtbziikiqje + '@typescript-eslint/eslint-plugin': 5.49.0_uuava45uwav2f2r3waokl3sbum + '@typescript-eslint/utils': 5.49.0_et5x32uxl7z5ldub3ye5rhlyqm eslint: 8.32.0 transitivePeerDependencies: - supports-color @@ -9410,7 +9410,7 @@ packages: - vue-tsc dev: true - /nuxt/3.1.1_no2el4fe4ggitllzolcgczmlgq: + /nuxt/3.1.1_7rz7g5sqfnn6wuv5lem37retty: resolution: {integrity: sha512-GVdmV88lR01OX0slxTPyTzwQkge7fxNREkx2QW0Lo66fb6aHcJlRXzFMBCOTjas+Ncng6AalIyIiPREEteGKSg==} engines: {node: ^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0} hasBin: true @@ -9420,7 +9420,7 @@ packages: '@nuxt/schema': 3.1.1 '@nuxt/telemetry': 2.1.9 '@nuxt/ui-templates': 1.1.0 - '@nuxt/vite-builder': 3.1.1_khfc6yoidgmzfko3kyvtza3rzq + '@nuxt/vite-builder': 3.1.1_vshnhw7h4tuo6ge5ck2wv7vfrm '@unhead/ssr': 1.0.18 '@vue/reactivity': 3.2.45 '@vue/shared': 3.2.45 @@ -9845,7 +9845,7 @@ packages: - supports-color dev: true - /pinia/2.0.29_typescript@4.9.4: + /pinia/2.0.29_typescript@4.9.5: resolution: {integrity: sha512-5z/KpFecq/cIgfeTnulJXldiLcTITRkTe3N58RKYSj0Pc1EdR6oyCdnf5A9jLoVwBqX5LtHhd0kGlpzWvk9oiQ==} peerDependencies: '@vue/composition-api': ^1.4.0 @@ -9858,7 +9858,7 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.5.0 - typescript: 4.9.4 + typescript: 4.9.5 vue-demi: 0.13.11 /pkg-types/1.0.1: @@ -11615,14 +11615,14 @@ packages: /tslib/2.4.1: resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} - /tsutils/3.21.0_typescript@4.9.4: + /tsutils/3.21.0_typescript@4.9.5: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.9.4 + typescript: 4.9.5 dev: true /tsx/3.12.2: @@ -11699,6 +11699,12 @@ packages: resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} engines: {node: '>=4.2.0'} hasBin: true + dev: true + + /typescript/4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true /ufo/0.8.6: resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==} @@ -12259,6 +12265,58 @@ packages: - terser dev: true + /vite-plugin-checker/0.5.4_h3si5tluig4ewnb7qcro3a3fhu: + resolution: {integrity: sha512-T6y+OHXqwOjGrCErbhzg5x79NQZV46cgLwYTxuMQnDzAfA6skh2i8PIHcKks8ZlxopzbkvMb5vwc2DpNXiHJdg==} + engines: {node: '>=14.16'} + peerDependencies: + eslint: '>=7' + meow: ^9.0.0 + optionator: ^0.9.1 + stylelint: '>=13' + typescript: '*' + vite: '>=2.0.0' + vls: '*' + vti: '*' + vue-tsc: '*' + peerDependenciesMeta: + eslint: + optional: true + meow: + optional: true + optionator: + optional: true + stylelint: + optional: true + typescript: + optional: true + vls: + optional: true + vti: + optional: true + vue-tsc: + optional: true + dependencies: + '@babel/code-frame': 7.18.6 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + chokidar: 3.5.3 + commander: 8.3.0 + eslint: 8.32.0 + fast-glob: 3.2.12 + lodash.debounce: 4.0.8 + lodash.pick: 4.4.0 + npm-run-path: 4.0.1 + strip-ansi: 6.0.1 + tiny-invariant: 1.3.1 + typescript: 4.9.5 + vite: 4.0.4 + vscode-languageclient: 7.0.0 + vscode-languageserver: 7.0.0 + vscode-languageserver-textdocument: 1.0.8 + vscode-uri: 3.0.7 + vue-tsc: 1.0.24_typescript@4.9.5 + dev: true + /vite-plugin-checker/0.5.4_vite@4.0.4: resolution: {integrity: sha512-T6y+OHXqwOjGrCErbhzg5x79NQZV46cgLwYTxuMQnDzAfA6skh2i8PIHcKks8ZlxopzbkvMb5vwc2DpNXiHJdg==} engines: {node: '>=14.16'} @@ -12308,58 +12366,6 @@ packages: vscode-uri: 3.0.7 dev: true - /vite-plugin-checker/0.5.4_x3aldvjfkbjbaq3ogboucfmn4y: - resolution: {integrity: sha512-T6y+OHXqwOjGrCErbhzg5x79NQZV46cgLwYTxuMQnDzAfA6skh2i8PIHcKks8ZlxopzbkvMb5vwc2DpNXiHJdg==} - engines: {node: '>=14.16'} - peerDependencies: - eslint: '>=7' - meow: ^9.0.0 - optionator: ^0.9.1 - stylelint: '>=13' - typescript: '*' - vite: '>=2.0.0' - vls: '*' - vti: '*' - vue-tsc: '*' - peerDependenciesMeta: - eslint: - optional: true - meow: - optional: true - optionator: - optional: true - stylelint: - optional: true - typescript: - optional: true - vls: - optional: true - vti: - optional: true - vue-tsc: - optional: true - dependencies: - '@babel/code-frame': 7.18.6 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - chokidar: 3.5.3 - commander: 8.3.0 - eslint: 8.32.0 - fast-glob: 3.2.12 - lodash.debounce: 4.0.8 - lodash.pick: 4.4.0 - npm-run-path: 4.0.1 - strip-ansi: 6.0.1 - tiny-invariant: 1.3.1 - typescript: 4.9.4 - vite: 4.0.4 - vscode-languageclient: 7.0.0 - vscode-languageserver: 7.0.0 - vscode-languageserver-textdocument: 1.0.8 - vscode-uri: 3.0.7 - vue-tsc: 1.0.24_typescript@4.9.4 - dev: true - /vite-plugin-inspect/0.7.14: resolution: {integrity: sha512-C9V93Yy2yUf941oVxIq93K6T1o0SZxoG8MdmyJsnoNDijOAGHT1rVSVjzF/uKFYvgnvLvaXioaoy6ica6aOS0g==} engines: {node: '>=14'} @@ -12826,7 +12832,7 @@ packages: he: 1.2.0 dev: true - /vue-tsc/1.0.24_typescript@4.9.4: + /vue-tsc/1.0.24_typescript@4.9.5: resolution: {integrity: sha512-mmU1s5SAqE1nByQAiQnao9oU4vX+mSdsgI8H57SfKH6UVzq/jP9+Dbi2GaV+0b4Cn361d2ln8m6xeU60ApiEXg==} hasBin: true peerDependencies: @@ -12834,7 +12840,7 @@ packages: dependencies: '@volar/vue-language-core': 1.0.24 '@volar/vue-typescript': 1.0.24 - typescript: 4.9.4 + typescript: 4.9.5 dev: true /vue-virtual-scroller/2.0.0-beta.7: From 6dc38c7d8e451ae3c39ad7cdd1bdd8cb0efeb726 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 6 Feb 2023 01:34:50 -0800 Subject: [PATCH 003/121] perf: tree-shake dependencies from server (#1647) --- components/common/CommonInputImage.vue | 2 ++ .../modal/ModalMediaPreviewCarousel.vue | 2 +- components/tiptap/TiptapEmojiList.vue | 3 ++ composables/masto/publish.ts | 2 ++ composables/tiptap.ts | 4 +++ composables/tiptap/suggestion.ts | 26 +++++++++------- composables/users.ts | 6 ++-- mocks/class.ts | 3 ++ mocks/prosemirror.ts | 8 +++++ mocks/tiptap.ts | 17 ++++++++++ nuxt.config.ts | 31 +++++++++++++++++-- pages/settings/users/index.vue | 5 +++ 12 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 mocks/class.ts create mode 100644 mocks/prosemirror.ts create mode 100644 mocks/tiptap.ts diff --git a/components/common/CommonInputImage.vue b/components/common/CommonInputImage.vue index 4a002ed2..947cb284 100644 --- a/components/common/CommonInputImage.vue +++ b/components/common/CommonInputImage.vue @@ -35,6 +35,8 @@ const previewImage = ref('') const imageSrc = computed(() => previewImage.value || defaultImage.value) const pickImage = async () => { + if (process.server) + return const image = await fileOpen({ description: 'Image', mimeTypes: props.allowedFileTypes, diff --git a/components/modal/ModalMediaPreviewCarousel.vue b/components/modal/ModalMediaPreviewCarousel.vue index 810185ac..af555b49 100644 --- a/components/modal/ModalMediaPreviewCarousel.vue +++ b/components/modal/ModalMediaPreviewCarousel.vue @@ -21,7 +21,7 @@ const { modelValue } = defineModel<{ const target = ref() const animateTimeout = useTimeout(10) -const reduceMotion = useReducedMotion() +const reduceMotion = process.server ? ref(false) : useReducedMotion() const canAnimate = computed(() => !reduceMotion.value && animateTimeout.value) diff --git a/components/tiptap/TiptapEmojiList.vue b/components/tiptap/TiptapEmojiList.vue index 0efcda9c..8d946899 100644 --- a/components/tiptap/TiptapEmojiList.vue +++ b/components/tiptap/TiptapEmojiList.vue @@ -12,6 +12,9 @@ const { items, command } = defineProps<{ }>() const emojis = computed(() => { + if (process.server) + return [] + return items.map((item: CustomEmoji | Emoji) => { if (isCustomEmoji(item)) { return { diff --git a/composables/masto/publish.ts b/composables/masto/publish.ts index c57ab458..b70daeba 100644 --- a/composables/masto/publish.ts +++ b/composables/masto/publish.ts @@ -150,6 +150,8 @@ export function useUploadMediaAttachment(draftRef: Ref) { } async function pickAttachments() { + if (process.server) + return const mimeTypes = currentInstance.value!.configuration?.mediaAttachments.supportedMimeTypes const files = await fileOpen({ description: 'Attachments', diff --git a/composables/tiptap.ts b/composables/tiptap.ts index 64c1d9da..a9a80dac 100644 --- a/composables/tiptap.ts +++ b/composables/tiptap.ts @@ -1,3 +1,4 @@ +import type { Editor } from '@tiptap/vue-3' import { Extension, useEditor } from '@tiptap/vue-3' import Placeholder from '@tiptap/extension-placeholder' import Document from '@tiptap/extension-document' @@ -27,6 +28,9 @@ export interface UseTiptapOptions { } export function useTiptap(options: UseTiptapOptions) { + if (process.server) + return { editor: ref() } + const { autofocus, content, diff --git a/composables/tiptap/suggestion.ts b/composables/tiptap/suggestion.ts index f359bfc2..f8b3bd4d 100644 --- a/composables/tiptap/suggestion.ts +++ b/composables/tiptap/suggestion.ts @@ -16,18 +16,20 @@ export { Emoji } export type CustomEmoji = (mastodon.v1.CustomEmoji & { custom: true }) export const isCustomEmoji = (emoji: CustomEmoji | Emoji): emoji is CustomEmoji => !!(emoji as CustomEmoji).custom -export const TiptapMentionSuggestion: Partial = { - pluginKey: new PluginKey('mention'), - char: '@', - async items({ query }) { - if (query.length === 0) - return [] +export const TiptapMentionSuggestion: Partial = process.server + ? {} + : { + pluginKey: new PluginKey('mention'), + char: '@', + async items({ query }) { + if (query.length === 0) + return [] - const results = await useMastoClient().v2.search({ q: query, type: 'accounts', limit: 25, resolve: true }) - return results.accounts - }, - render: createSuggestionRenderer(TiptapMentionList), -} + const results = await useMastoClient().v2.search({ q: query, type: 'accounts', limit: 25, resolve: true }) + return results.accounts + }, + render: createSuggestionRenderer(TiptapMentionList), + } export const TiptapHashtagSuggestion: Partial = { pluginKey: new PluginKey('hashtag'), @@ -52,7 +54,7 @@ export const TiptapEmojiSuggestion: Partial = { pluginKey: new PluginKey('emoji'), char: ':', async items({ query }): Promise<(CustomEmoji | Emoji)[]> { - if (query.length === 0) + if (process.server || query.length === 0) return [] if (currentCustomEmojis.value.emojis.length === 0) diff --git a/composables/users.ts b/composables/users.ts index ab69cf5f..48668220 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -19,7 +19,7 @@ import { useAsyncIDBKeyval } from '~/composables/idb' const mock = process.mock -const initializeUsers = async (): Promise | RemovableRef> => { +const initializeUsers = (): Promise | RemovableRef> | Ref | RemovableRef => { let defaultUsers = mock ? [mock.user] : [] // Backward compatibility with localStorage @@ -34,7 +34,7 @@ const initializeUsers = async (): Promise | RemovableRef(defaultUsers) - : await useAsyncIDBKeyval(STORAGE_KEY_USERS, defaultUsers, { deep: true }) + : useAsyncIDBKeyval(STORAGE_KEY_USERS, defaultUsers, { deep: true }) if (removeUsersOnLocalStorage) globalThis.localStorage.removeItem(STORAGE_KEY_USERS) @@ -42,7 +42,7 @@ const initializeUsers = async (): Promise | RemovableRef | RemovableRef : await initializeUsers() const nodes = useLocalStorage>(STORAGE_KEY_NODES, {}, { deep: true }) const currentUserHandle = useLocalStorage(STORAGE_KEY_CURRENT_USER_HANDLE, mock ? mock.user.account.id : '') export const instanceStorage = useLocalStorage>(STORAGE_KEY_SERVERS, mock ? mock.server : {}, { deep: true }) diff --git a/mocks/class.ts b/mocks/class.ts new file mode 100644 index 00000000..93caa691 --- /dev/null +++ b/mocks/class.ts @@ -0,0 +1,3 @@ +export default class SomeClass { + +} diff --git a/mocks/prosemirror.ts b/mocks/prosemirror.ts new file mode 100644 index 00000000..84e65835 --- /dev/null +++ b/mocks/prosemirror.ts @@ -0,0 +1,8 @@ +import proxy from 'unenv/runtime/mock/proxy' + +export const Plugin = proxy +export const PluginKey = proxy +export const Decoration = proxy +export const DecorationSet = proxy + +export { proxy as default } diff --git a/mocks/tiptap.ts b/mocks/tiptap.ts new file mode 100644 index 00000000..9872644b --- /dev/null +++ b/mocks/tiptap.ts @@ -0,0 +1,17 @@ +import proxy from 'unenv/runtime/mock/proxy' + +export const Extension = proxy +export const useEditor = proxy +export const EditorContent = proxy +export const NodeViewContent = proxy +export const NodeViewWrapper = proxy +export const nodeViewProps = proxy +export const Node = proxy +export const mergeAttributes = proxy +export const nodeInputRule = proxy +export const nodePasteRule = proxy +export const VueNodeViewRenderer = proxy +export const findChildren = proxy +export const VueRenderer = proxy + +export { proxy as default } diff --git a/nuxt.config.ts b/nuxt.config.ts index 1f22a4ec..abf34990 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -128,10 +128,10 @@ export default defineNuxtConfig({ }, }, }, - build: { - transpile: ['masto'], - }, nitro: { + alias: { + 'isomorphic-ws': 'unenv/runtime/mock/proxy', + }, esbuild: { options: { target: 'esnext', @@ -143,12 +143,37 @@ export default defineNuxtConfig({ ignore: ['/settings'], }, }, + sourcemap: !isDevelopment, hooks: { 'nitro:config': function (config) { const nuxt = useNuxt() config.virtual = config.virtual || {} config.virtual['#storage-config'] = `export const driver = ${JSON.stringify(nuxt.options.appConfig.storage.driver)}` }, + 'vite:extendConfig': function (config, { isServer }) { + if (isServer) { + const alias = config.resolve!.alias as Record + for (const dep of ['eventemitter3', 'isomorphic-ws']) + alias[dep] = resolve('./mocks/class') + for (const dep of ['shiki-es', 'fuse.js']) + alias[dep] = 'unenv/runtime/mock/proxy' + const resolver = createResolver(import.meta.url) + + config.plugins!.unshift({ + name: 'mock', + enforce: 'pre', + resolveId(id) { + if (id.match(/(^|\/)(@tiptap)\//)) + return resolver.resolve('./mocks/tiptap.ts') + if (id.match(/(^|\/)(prosemirror)/)) + return resolver.resolve('./mocks/prosemirror.ts') + }, + }) + + const noExternal = config.ssr!.noExternal as string[] + noExternal.push('masto', '@fnando/sparkline', 'vue-i18n', '@mastojs/ponyfills') + } + }, }, app: { keepalive: true, diff --git a/pages/settings/users/index.vue b/pages/settings/users/index.vue index 04df33a7..7d667b9d 100644 --- a/pages/settings/users/index.vue +++ b/pages/settings/users/index.vue @@ -12,6 +12,9 @@ useHeadFixed({ const loggedInUsers = useUsers() async function exportTokens() { + if (process.server) + return + if (!confirm('Please aware that the tokens represent the **full access** to your accounts, and should be treated as sensitive information. Are you sure you want to export the tokens?')) return @@ -28,6 +31,8 @@ async function exportTokens() { } async function importTokens() { + if (process.server) + return const file = await fileOpen({ description: 'Token File', mimeTypes: ['application/json'], From 6e7ac248218236cee7ebfb3e1ba4166b2dfdc6f7 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 6 Feb 2023 02:03:52 -0800 Subject: [PATCH 004/121] fix: work around hotfix cloudflare kv storage bug (#1650) --- server/cloudflare-driver.ts | 194 ++++++++++++++++++++++++++++++++++++ server/shared.ts | 4 +- 2 files changed, 195 insertions(+), 3 deletions(-) create mode 100644 server/cloudflare-driver.ts diff --git a/server/cloudflare-driver.ts b/server/cloudflare-driver.ts new file mode 100644 index 00000000..5fe74416 --- /dev/null +++ b/server/cloudflare-driver.ts @@ -0,0 +1,194 @@ +// Temporary hotfix of https://github.com/unjs/unstorage/blob/4d637a117667ae638a6cac657aac139d88a78027/src/drivers/cloudflare-kv-http.ts#L6 + +import { $fetch } from 'ofetch' +import { defineDriver } from 'unstorage' + +const LOG_TAG = '[unstorage] [cloudflare-http] ' + +interface KVAuthAPIToken { + /** + * API Token generated from the [User Profile 'API Tokens' page](https://dash.cloudflare.com/profile/api-tokens) + * of the Cloudflare console. + * @see https://api.cloudflare.com/#getting-started-requests + */ + apiToken: string +} + +interface KVAuthServiceKey { + /** + * A special Cloudflare API key good for a restricted set of endpoints. + * Always begins with "v1.0-", may vary in length. + * May be used to authenticate in place of `apiToken` or `apiKey` and `email`. + * @see https://api.cloudflare.com/#getting-started-requests + */ + userServiceKey: string +} + +interface KVAuthEmailKey { + /** + * Email address associated with your account. + * Should be used along with `apiKey` to authenticate in place of `apiToken`. + */ + email: string + /** + * API key generated on the "My Account" page of the Cloudflare console. + * Should be used along with `email` to authenticate in place of `apiToken`. + * @see https://api.cloudflare.com/#getting-started-requests + */ + apiKey: string +} + +export type KVHTTPOptions = { + /** + * Cloudflare account ID (required) + */ + accountId: string + /** + * The ID of the KV namespace to target (required) + */ + namespaceId: string + /** + * The URL of the Cloudflare API. + * @default https://api.cloudflare.com + */ + apiURL?: string +} & (KVAuthServiceKey | KVAuthAPIToken | KVAuthEmailKey) + +type CloudflareAuthorizationHeaders = { + 'X-Auth-Email': string + 'X-Auth-Key': string + 'X-Auth-User-Service-Key'?: string + Authorization?: `Bearer ${string}` +} | { + 'X-Auth-Email'?: string + 'X-Auth-Key'?: string + 'X-Auth-User-Service-Key': string + Authorization?: `Bearer ${string}` +} | { + 'X-Auth-Email'?: string + 'X-Auth-Key'?: string + 'X-Auth-User-Service-Key'?: string + Authorization: `Bearer ${string}` +} + +export default defineDriver((opts) => { + if (!opts) + throw new Error('Options must be provided.') + + if (!opts.accountId) + throw new Error(`${LOG_TAG}\`accountId\` is required.`) + + if (!opts.namespaceId) + throw new Error(`${LOG_TAG}\`namespaceId\` is required.`) + + let headers: CloudflareAuthorizationHeaders + + if ('apiToken' in opts) { + headers = { Authorization: `Bearer ${opts.apiToken}` } + } + else if ('userServiceKey' in opts) { + headers = { 'X-Auth-User-Service-Key': opts.userServiceKey } + } + else if (opts.email && opts.apiKey) { + headers = { 'X-Auth-Email': opts.email, 'X-Auth-Key': opts.apiKey } + } + else { + throw new Error( + `${LOG_TAG}One of the \`apiToken\`, \`userServiceKey\`, or a combination of \`email\` and \`apiKey\` is required.`, + ) + } + + const apiURL = opts.apiURL || 'https://api.cloudflare.com' + const baseURL = `${apiURL}/client/v4/accounts/${opts.accountId}/storage/kv/namespaces/${opts.namespaceId}` + const kvFetch = $fetch.create({ baseURL, headers }) + + const hasItem = async (key: string) => { + try { + const res = await kvFetch(`/metadata/${key}`) + return res?.success === true + } + catch (err: any) { + if (!err.response) + throw err + if (err.response.status === 404) + return false + throw err + } + } + + const getItem = async (key: string) => { + try { + // Cloudflare API returns with `content-type: application/octet-stream` + return await kvFetch(`/values/${key}`).then(r => r.text()) + } + catch (err: any) { + if (!err.response) + throw err + if (err.response.status === 404) + return null + throw err + } + } + + const setItem = async (key: string, value: any) => { + return await kvFetch(`/values/${key}`, { method: 'PUT', body: value }) + } + + const removeItem = async (key: string) => { + return await kvFetch(`/values/${key}`, { method: 'DELETE' }) + } + + const getKeys = async (base?: string) => { + const keys: string[] = [] + + const params = new URLSearchParams() + if (base) + params.set('prefix', base) + + const firstPage = await kvFetch('/keys', { params }) + firstPage.result.forEach(({ name }: { name: string }) => keys.push(name)) + + const cursor = firstPage.result_info.cursor + if (cursor) + params.set('cursor', cursor) + + while (params.has('cursor')) { + const pageResult = await kvFetch('/keys', { params: Object.fromEntries(params.entries()) }) + pageResult.result.forEach(({ name }: { name: string }) => keys.push(name)) + const pageCursor = pageResult.result_info.cursor + if (pageCursor) + params.set('cursor', pageCursor) + + else + params.delete('cursor') + } + return keys + } + + const clear = async () => { + const keys: string[] = await getKeys() + // Split into chunks of 10000, as the API only allows for 10,000 keys at a time + const chunks = keys.reduce((acc, key, i) => { + if (i % 10000 === 0) + acc.push([]) + acc[acc.length - 1].push(key) + return acc + }, [[]] as string[][]) + // Call bulk delete endpoint with each chunk + await Promise.all(chunks.map((chunk) => { + return kvFetch('/bulk', { + method: 'DELETE', + body: { keys: chunk }, + }) + })) + } + + return { + hasItem, + getItem, + setItem, + removeItem, + getKeys, + clear, + } +}) diff --git a/server/shared.ts b/server/shared.ts index 5a0d97e5..304007a3 100644 --- a/server/shared.ts +++ b/server/shared.ts @@ -1,8 +1,6 @@ // @ts-expect-error unstorage needs to provide backwards-compatible subpath types import _fs from 'unstorage/drivers/fs' // @ts-expect-error unstorage needs to provide backwards-compatible subpath types -import _kv from 'unstorage/drivers/cloudflare-kv-http' -// @ts-expect-error unstorage needs to provide backwards-compatible subpath types import _memory from 'unstorage/drivers/memory' import { stringifyQuery } from 'ufo' @@ -11,6 +9,7 @@ import { $fetch } from 'ofetch' import type { Storage } from 'unstorage' import cached from './cache-driver' +import kv from './cloudflare-driver' // @ts-expect-error virtual import import { env } from '#build-info' @@ -21,7 +20,6 @@ import type { AppInfo } from '~/types' import { APP_NAME } from '~/constants' const fs = _fs as typeof import('unstorage/dist/drivers/fs')['default'] -const kv = _kv as typeof import('unstorage/dist/drivers/cloudflare-kv-http')['default'] const memory = _memory as typeof import('unstorage/dist/drivers/memory')['default'] const storage = useStorage() as Storage From f7a8d471a6f491990e20395f59c0715a35bb3b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Mon, 6 Feb 2023 13:16:24 +0100 Subject: [PATCH 005/121] fix: sign-out and empty content (#1654) --- middleware/auth.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/middleware/auth.ts b/middleware/auth.ts index 40eafd80..d5e38765 100644 --- a/middleware/auth.ts +++ b/middleware/auth.ts @@ -1,3 +1,5 @@ +import type { RouteLocationNormalized } from 'vue-router' + export default defineNuxtRouteMiddleware((to) => { if (process.server) return @@ -5,14 +7,19 @@ export default defineNuxtRouteMiddleware((to) => { if (to.path === '/signin/callback') return - onHydrated(() => { - if (!currentUser.value) { - if (to.path === '/home' && to.query['share-target'] !== undefined) - return navigateTo('/share-target') - else - return navigateTo(`/${currentServer.value}/public/local`) - } - if (to.path === '/') - return navigateTo('/home') - }) + if (isHydrated.value) + return handleAuth(to) + + onHydrated(() => handleAuth(to)) }) + +function handleAuth(to: RouteLocationNormalized) { + if (!currentUser.value) { + if (to.path === '/home' && to.query['share-target'] !== undefined) + return navigateTo('/share-target') + else + return navigateTo(`/${currentServer.value}/public/local`) + } + if (to.path === '/') + return navigateTo('/home') +} From 32cfe6371f1141f9445fe1055128ba5dad44a2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Mon, 6 Feb 2023 23:22:56 +0100 Subject: [PATCH 006/121] fix: handle frozen page lifecycle state (#1658) --- composables/idb/index.ts | 2 +- composables/masto/masto.ts | 3 ++ constants/index.ts | 2 + package.json | 1 + page-lifecycle.d.ts | 17 ++++++++ plugins/page-lifecycle.client.ts | 37 +++++++++++++++++ pnpm-lock.yaml | 6 +++ service-worker/notification.ts | 6 ++- service-worker/web-push-notifications.ts | 12 +++++- utils/elk-idb.ts | 51 ++++++++++++++++++++++++ 10 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 page-lifecycle.d.ts create mode 100644 plugins/page-lifecycle.client.ts create mode 100644 utils/elk-idb.ts diff --git a/composables/idb/index.ts b/composables/idb/index.ts index d71a30cc..e00396c7 100644 --- a/composables/idb/index.ts +++ b/composables/idb/index.ts @@ -1,7 +1,7 @@ import type { MaybeComputedRef, RemovableRef } from '@vueuse/core' import type { Ref } from 'vue' -import { del, get, set, update } from 'idb-keyval' import type { UseIDBOptions } from '@vueuse/integrations/useIDBKeyval' +import { del, get, set, update } from '~/utils/elk-idb' const isIDBSupported = !process.test && typeof indexedDB !== 'undefined' diff --git a/composables/masto/masto.ts b/composables/masto/masto.ts index d64addaa..f212a089 100644 --- a/composables/masto/masto.ts +++ b/composables/masto/masto.ts @@ -106,6 +106,9 @@ export function useStreaming( stream.value = cb(client.value) }) + if (process.client && !process.test) + useNuxtApp().$pageLifecycle.addFrozenListener(cleanup) + tryOnBeforeUnmount(() => isActive.value = false) if (controls) diff --git a/constants/index.ts b/constants/index.ts index 366946d0..c7d28132 100644 --- a/constants/index.ts +++ b/constants/index.ts @@ -3,6 +3,8 @@ export const APP_NAME = 'Elk' export const DEFAULT_POST_CHARS_LIMIT = 500 export const DEFAULT_FONT_SIZE = '15px' +export const ELK_PAGE_LIFECYCLE_FROZEN = 'elk-frozen' + export const STORAGE_KEY_DRAFTS = 'elk-drafts' export const STORAGE_KEY_USERS = 'elk-users' export const STORAGE_KEY_SERVERS = 'elk-servers' diff --git a/package.json b/package.json index baa33002..f46e2764 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "js-yaml": "^4.1.0", "lru-cache": "^7.14.1", "masto": "^5.6.1", + "page-lifecycle": "^0.1.2", "pinia": "^2.0.29", "shiki": "^0.12.1", "shiki-es": "^0.2.0", diff --git a/page-lifecycle.d.ts b/page-lifecycle.d.ts new file mode 100644 index 00000000..963a4bea --- /dev/null +++ b/page-lifecycle.d.ts @@ -0,0 +1,17 @@ +declare module 'page-lifecycle/dist/lifecycle.mjs' { + type PageLifecycleState = 'pageshow' | 'resume' | 'focus' | 'blur' | 'pagehide' | 'unload' | 'visibilitychange' | 'freeze' + + interface PageLifecycleEvent extends Event { + newState: PageLifecycleState + oldState: PageLifecycleState + } + interface PageLifecycle extends EventTarget { + get state(): PageLifecycleState + get pageWasDiscarded(): boolean + addUnsavedChanges: (id: Symbol | any) => void + removeUnsavedChanges: (id: Symbol | any) => void + addEventListener: (type: string, listener: (evt: PageLifecycleEvent) => void) => void + } + const lifecycle: PageLifecycle + export default lifecycle +} diff --git a/plugins/page-lifecycle.client.ts b/plugins/page-lifecycle.client.ts new file mode 100644 index 00000000..8a8d88c1 --- /dev/null +++ b/plugins/page-lifecycle.client.ts @@ -0,0 +1,37 @@ +import lifecycle from 'page-lifecycle/dist/lifecycle.mjs' +import { ELK_PAGE_LIFECYCLE_FROZEN } from '~/constants' +import { closeDatabases } from '~/utils/elk-idb' + +export default defineNuxtPlugin(() => { + const state = ref(lifecycle.state) + const frozenListeners: (() => void)[] = [] + + lifecycle.addEventListener('statechange', (evt) => { + if (evt.newState === 'freeze') + frozenListeners.forEach(listener => listener()) + else + state.value = evt.newState + }) + + const addFrozenListener = (listener: () => void) => { + frozenListeners.push(listener) + } + + if (useAppConfig().pwaEnabled) { + addFrozenListener(() => { + if (navigator.serviceWorker.controller) + navigator.serviceWorker.controller.postMessage(ELK_PAGE_LIFECYCLE_FROZEN) + + closeDatabases() + }) + } + + return { + provide: { + pageLifecycle: reactive({ + state, + addFrozenListener, + }), + }, + } +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8533916e..85a204e0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,6 +94,7 @@ importers: nuxt: 3.1.1 nuxt-security: ^0.10.1 nuxt-vitest: ^0.6.4 + page-lifecycle: ^0.1.2 pinia: ^2.0.29 postcss-nested: ^6.0.0 prettier: ^2.8.3 @@ -155,6 +156,7 @@ importers: js-yaml: 4.1.0 lru-cache: 7.14.1 masto: 5.6.1 + page-lifecycle: 0.1.2 pinia: 2.0.29_typescript@4.9.5 shiki: 0.12.1 shiki-es: 0.2.0 @@ -9667,6 +9669,10 @@ packages: engines: {node: '>=6'} dev: true + /page-lifecycle/0.1.2: + resolution: {integrity: sha512-+3uccYgL0CXG0KSXRxZi4uc2E6mqFWV5HqiJJgcnaJCiS0LqiuJ4vB420N21NFuLvuvLB4Jr5drgQ2NXAXF9Iw==} + dev: false + /param-case/3.0.4: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} dependencies: diff --git a/service-worker/notification.ts b/service-worker/notification.ts index c585ac8d..82b34bd4 100644 --- a/service-worker/notification.ts +++ b/service-worker/notification.ts @@ -1,4 +1,4 @@ -import { get } from 'idb-keyval' +import { closeDatabases, get } from '../utils/elk-idb' import type { MastoNotification, NotificationInfo, PushPayload, UserLogin } from './types' export const findNotification = async ( @@ -104,3 +104,7 @@ function htmlToPlainText(html: string) { return decodeURIComponent(html.replace(//g, '\n').replace(/<\/p>

/g, '\n\n').replace(/<[^>]*>/g, '')) } */ + +export function closeDatabaseConnections() { + closeDatabases() +} diff --git a/service-worker/web-push-notifications.ts b/service-worker/web-push-notifications.ts index 43a48429..f1e66cc9 100644 --- a/service-worker/web-push-notifications.ts +++ b/service-worker/web-push-notifications.ts @@ -1,10 +1,20 @@ /// /// -import { createNotificationOptions, findNotification } from './notification' +import { ELK_PAGE_LIFECYCLE_FROZEN } from '../constants' +import { + closeDatabaseConnections, + createNotificationOptions, + findNotification, +} from './notification' import type { PushPayload } from '~/service-worker/types' declare const self: ServiceWorkerGlobalScope +self.addEventListener('message', (event) => { + if (event.data === ELK_PAGE_LIFECYCLE_FROZEN) + closeDatabaseConnections() +}) + export const onPush = (event: PushEvent) => { const promise = isClientFocused().then((isFocused) => { if (isFocused) diff --git a/utils/elk-idb.ts b/utils/elk-idb.ts new file mode 100644 index 00000000..d7363046 --- /dev/null +++ b/utils/elk-idb.ts @@ -0,0 +1,51 @@ +import { + type UseStore, + del as delIdb, + get as getIdb, + promisifyRequest, + set as setIdb, + update as updateIdb, +} from 'idb-keyval' + +const databases: IDBOpenDBRequest[] = [] + +function createStore(): UseStore { + const storeName = 'keyval' + const request = indexedDB.open('keyval-store') + databases.push(request) + request.onupgradeneeded = () => request.result.createObjectStore(storeName) + const dbp = promisifyRequest(request) + return (txMode, callback) => dbp.then(db => callback(db.transaction(storeName, txMode).objectStore(storeName))) +} + +let defaultGetStoreFunc: UseStore | undefined +function defaultGetStore() { + if (!defaultGetStoreFunc) + defaultGetStoreFunc = createStore() + + return defaultGetStoreFunc +} + +export function get(key: IDBValidKey) { + return getIdb(key, defaultGetStore()) +} + +export function set(key: IDBValidKey, value: any) { + return setIdb(key, value, defaultGetStore()) +} + +export function update(key: IDBValidKey, updater: (oldValue: T | undefined) => T) { + return updateIdb(key, updater, defaultGetStore()) +} + +export function del(key: IDBValidKey) { + return delIdb(key, defaultGetStore()) +} + +export function closeDatabases() { + databases.forEach((db) => { + if (db.result) + db.result.close() + }) + defaultGetStoreFunc = undefined +} From 65bbc7c79073a34822d574cc278fdd239ba175b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Tue, 7 Feb 2023 00:01:30 +0100 Subject: [PATCH 007/121] fix: close databases on page freeze event without pwa (#1662) --- plugins/page-lifecycle.client.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/page-lifecycle.client.ts b/plugins/page-lifecycle.client.ts index 8a8d88c1..a93c49ee 100644 --- a/plugins/page-lifecycle.client.ts +++ b/plugins/page-lifecycle.client.ts @@ -17,14 +17,12 @@ export default defineNuxtPlugin(() => { frozenListeners.push(listener) } - if (useAppConfig().pwaEnabled) { - addFrozenListener(() => { - if (navigator.serviceWorker.controller) - navigator.serviceWorker.controller.postMessage(ELK_PAGE_LIFECYCLE_FROZEN) + addFrozenListener(() => { + if (useAppConfig().pwaEnabled && navigator.serviceWorker.controller) + navigator.serviceWorker.controller.postMessage(ELK_PAGE_LIFECYCLE_FROZEN) - closeDatabases() - }) - } + closeDatabases() + }) return { provide: { From f1087fd270b142a8978b062d650b744b8b4157c6 Mon Sep 17 00:00:00 2001 From: Chris-Robin Ennen Date: Tue, 7 Feb 2023 00:03:16 +0100 Subject: [PATCH 008/121] fix: only count 23 characters per link when composing (#1660) --- components/publish/PublishWidget.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index e6b6ede7..cc4e653b 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -64,7 +64,19 @@ const { editor } = useTiptap({ }) const characterCount = $computed(() => { - let length = stringLength(htmlToText(editor.value?.getHTML() || '')) + const text = htmlToText(editor.value?.getHTML() || '') + + let length = stringLength(text) + + // taken from https://github.com/mastodon/mastodon/blob/07f8b4d1b19f734d04e69daeb4c3421ef9767aac/app/lib/text_formatter.rb + const linkRegex = /(https?:\/\/(www\.)?|xmpp:)\S+/g + + // maximum of 23 chars per link + // https://github.com/elk-zone/elk/issues/1651 + const maxLength = 23 + + for (const [fullMatch] of text.matchAll(linkRegex)) + length -= fullMatch.length - Math.min(maxLength, fullMatch.length) if (draft.mentions) { // + 1 is needed as mentions always need a space seperator at the end From 9e09c9072f98eba8007d3c68321c539c440ff26d Mon Sep 17 00:00:00 2001 From: Peter Budai Date: Tue, 7 Feb 2023 09:12:30 +0100 Subject: [PATCH 009/121] fix(ui): Prevent word-wrap on "Replying To" (#1663) --- components/status/StatusReplyingTo.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/components/status/StatusReplyingTo.vue b/components/status/StatusReplyingTo.vue index 7c0bf147..93730ac7 100644 --- a/components/status/StatusReplyingTo.vue +++ b/components/status/StatusReplyingTo.vue @@ -27,14 +27,15 @@ const account = isSelf ? computed(() => status.account) : useAccountById(status. From 2128d11238b4389735a5e45ffb141e401e819d1c Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 7 Feb 2023 04:10:43 -0800 Subject: [PATCH 010/121] refactor: move single instance config to runtime (#1664) --- .env.example | 2 +- composables/sign-in.ts | 2 +- docs/content/2.deployment/1.netlify.md | 2 +- middleware/1.permalink.global.ts | 2 +- middleware/2.single-instance.global.ts | 2 +- nuxt.config.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 7f682ca8..9b0ba49a 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ NUXT_PUBLIC_TRANSLATE_API= NUXT_PUBLIC_DEFAULT_SERVER= -SINGLE_INSTANCE_SERVER= +NUXT_PUBLIC_SINGLE_INSTANCE= NUXT_PUBLIC_PRIVACY_POLICY_URL= # Production only diff --git a/composables/sign-in.ts b/composables/sign-in.ts index 139d792f..437d8fd7 100644 --- a/composables/sign-in.ts +++ b/composables/sign-in.ts @@ -1,7 +1,7 @@ import type { Ref } from 'vue' export const useSignIn = (input?: Ref) => { - const singleInstanceServer = useAppConfig().singleInstanceServer + const singleInstanceServer = useRuntimeConfig().public.singleInstance const userSettings = useUserSettings() const users = useUsers() const { t } = useI18n() diff --git a/docs/content/2.deployment/1.netlify.md b/docs/content/2.deployment/1.netlify.md index 2184d472..22fe4caf 100644 --- a/docs/content/2.deployment/1.netlify.md +++ b/docs/content/2.deployment/1.netlify.md @@ -45,7 +45,7 @@ There are 5 environment variables to add. | NUXT_CLOUDFLARE_NAMESPACE_ID | This is your CloudFlare KV Namespace ID. You can find it in "Workers > KV". | | NUXT_STORAGE_DRIVER | Because we're using CloudFlare, we'll need to set this to `cloudflare`. | | NUXT_PUBLIC_DEFAULT_SERVER | This is the address of the Mastodon instance that will show up when a user visits your Elk deployment and is not logged in. If you don't make that variable, it will point to `m.webtoo.ls` by default. | -| SINGLE_INSTANCE_SERVER | This can't be set at runtime, but if enabled at build-time it will disable signing in to servers other than the server specified in `NUXT_PUBLIC_DEFAULT_SERVER` | +| NUXT_PUBLIC_SINGLE_INSTANCE | If enabled it will disable signing in to servers other than the server specified in `NUXT_PUBLIC_DEFAULT_SERVER` | | NUXT_PUBLIC_PRIVACY_POLICY_URL | This is the URL to a web page with information on your privacy policy. | That's it! All that's left to do is... diff --git a/middleware/1.permalink.global.ts b/middleware/1.permalink.global.ts index 64c789fa..c6aa8901 100644 --- a/middleware/1.permalink.global.ts +++ b/middleware/1.permalink.global.ts @@ -24,7 +24,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { return // Handle redirecting to new permalink structure for users with old links - if (!useAppConfig().singleInstanceServer && !to.params.server) { + if (!useRuntimeConfig().public.singleInstance && !to.params.server) { return { ...to, params: { diff --git a/middleware/2.single-instance.global.ts b/middleware/2.single-instance.global.ts index 4b12cddd..83bb9a2c 100644 --- a/middleware/2.single-instance.global.ts +++ b/middleware/2.single-instance.global.ts @@ -1,5 +1,5 @@ export default defineNuxtRouteMiddleware(async (to) => { - if (process.server || !useAppConfig().singleInstanceServer) + if (process.server || !useRuntimeConfig().public.singleInstance) return if (to.params.server) { diff --git a/nuxt.config.ts b/nuxt.config.ts index abf34990..d17ad2ec 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -96,7 +96,6 @@ export default defineNuxtConfig({ }, }, appConfig: { - singleInstanceServer: process.env.SINGLE_INSTANCE_SERVER === 'true', storage: { driver: process.env.NUXT_STORAGE_DRIVER ?? (isCI ? 'cloudflare' : 'fs'), }, @@ -115,6 +114,7 @@ export default defineNuxtConfig({ translateApi: '', // Use the instance where Elk has its Mastodon account as the default defaultServer: 'm.webtoo.ls', + singleInstance: false, }, storage: { fsBase: 'node_modules/.cache/app', From 36191c500f04dd2a08f0ee771ed7c0e309aa7102 Mon Sep 17 00:00:00 2001 From: Alexander Harding <2166114+aeharding@users.noreply.github.com> Date: Tue, 7 Feb 2023 08:32:37 -0600 Subject: [PATCH 011/121] fix: prevent videos from clipping when in fullscreen mode (#1397) Co-authored-by: Tomasz Rymkiewicz --- components/status/StatusAttachment.vue | 1 + unocss.config.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 57418fb8..45aa8917 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -104,6 +104,7 @@ const userSettings = useUserSettings() controls rounded-lg object-cover + fullscreen:object-contain :width="attachment.meta?.original?.width" :height="attachment.meta?.original?.height" :style="{ diff --git a/unocss.config.ts b/unocss.config.ts index ad68e32b..0013a084 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -9,6 +9,8 @@ import { transformerVariantGroup, } from 'unocss' +import { variantParentMatcher } from '@unocss/preset-mini/utils' + export default defineConfig({ shortcuts: [ { @@ -119,6 +121,7 @@ export default defineConfig({ layer: 'native-mac', } }, + variantParentMatcher('fullscreen', '@media (display-mode: fullscreen)'), ], rules: [ // scrollbar-hide From 11d179b13b04961a2fb12127043ca2e58f171bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 8 Feb 2023 10:20:58 +0100 Subject: [PATCH 012/121] refactor: upgrade vue macros --- components/common/CommonTooltip.vue | 6 +- package.json | 2 +- pnpm-lock.yaml | 366 +++++++++++++++++++--------- 3 files changed, 252 insertions(+), 122 deletions(-) diff --git a/components/common/CommonTooltip.vue b/components/common/CommonTooltip.vue index 19516ce8..cfba1e66 100644 --- a/components/common/CommonTooltip.vue +++ b/components/common/CommonTooltip.vue @@ -1,9 +1,11 @@