From d559d1a03668acf277b1d5d263bf7366543f18b6 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 26 Dec 2023 01:34:50 +0100 Subject: [PATCH] chore: upgrade sveltekit to 2.0.0, upgrade svelte to 4.0.0 --- frontend/package.json | 27 +- frontend/src/app.d.ts | 6 +- frontend/src/lib/components/ActiveLink.svelte | 2 +- frontend/src/lib/components/ErrorAlert.svelte | 2 +- frontend/src/lib/components/IconButton.svelte | 2 +- .../lib/components/PartialMemberCard.svelte | 2 +- frontend/src/lib/components/StatusIcon.svelte | 2 +- frontend/src/lib/components/Toast.svelte | 2 +- .../lib/components/edit/EditableField.svelte | 2 +- .../lib/components/edit/EditableName.svelte | 2 +- .../components/edit/EditablePronouns.svelte | 2 +- .../src/lib/components/edit/FieldEntry.svelte | 2 +- .../src/lib/components/edit/FlagButton.svelte | 2 +- .../lib/components/edit/MarkdownHelp.svelte | 2 +- frontend/src/routes/+layout.svelte | 2 +- frontend/src/routes/+page.svelte | 2 +- .../src/routes/@[username]/+page.server.ts | 2 +- frontend/src/routes/@[username]/+page.svelte | 2 +- .../src/routes/@[username]/ProfileFlag.svelte | 2 +- .../src/routes/@[username]/ProfileLink.svelte | 2 +- .../routes/@[username]/ReportButton.svelte | 2 +- .../@[username]/[memberName]/+page.server.ts | 4 +- .../@[username]/[memberName]/+page.svelte | 2 +- .../[memberName]/edit/+layout.svelte | 2 +- .../@[username]/[memberName]/edit/+layout.ts | 4 +- .../[memberName]/edit/+page.svelte | 2 +- .../[memberName]/edit/bio/+page.svelte | 2 +- .../[memberName]/edit/fields/+page.svelte | 2 +- .../[memberName]/edit/flags/+page.svelte | 2 +- .../[memberName]/edit/other/+page.svelte | 2 +- .../[memberName]/edit/pronouns/+page.svelte | 2 +- .../routes/@[username]/badges/Admin.svelte | 2 +- .../routes/@[username]/edit/+layout.svelte | 2 +- .../src/routes/@[username]/edit/+layout.ts | 4 +- .../src/routes/@[username]/edit/+page.svelte | 2 +- .../routes/@[username]/edit/bio/+page.svelte | 2 +- .../@[username]/edit/fields/+page.svelte | 2 +- .../@[username]/edit/flags/+page.svelte | 2 +- .../@[username]/edit/other/+page.svelte | 2 +- .../edit/other/CustomPreference.svelte | 2 +- .../@[username]/edit/other/IconPicker.svelte | 2 +- .../@[username]/edit/pronouns/+page.svelte | 2 +- .../src/routes/[username]/+page.server.ts | 4 +- frontend/src/routes/auth/login/+page.svelte | 2 +- .../src/routes/auth/login/CallbackPage.svelte | 2 +- frontend/src/routes/edit/member/[id]/+page.ts | 4 +- frontend/src/routes/edit/profile/+page.ts | 4 +- frontend/src/routes/nav/Navigation.svelte | 2 +- .../routes/pronouns/[...pronouns]/+page.ts | 4 +- frontend/src/routes/reports/+page.svelte | 2 +- frontend/src/routes/reports/ReportCard.svelte | 2 +- frontend/src/routes/settings/+layout.svelte | 2 +- frontend/src/routes/settings/+layout.ts | 2 +- frontend/src/routes/settings/+page.svelte | 2 +- .../src/routes/settings/auth/+page.svelte | 2 +- .../src/routes/settings/export/+page.svelte | 2 +- frontend/src/routes/settings/export/+page.ts | 2 +- .../src/routes/settings/flags/+page.svelte | 2 +- .../src/routes/settings/flags/Flag.svelte | 2 +- .../src/routes/settings/invites/+page.svelte | 2 +- .../src/routes/settings/members/+page.svelte | 2 +- .../src/routes/settings/tokens/+page.svelte | 2 +- .../src/routes/settings/warnings/+page.svelte | 2 +- frontend/svelte.config.js | 2 +- pnpm-lock.yaml | 1645 ++++++++++++++--- 65 files changed, 1441 insertions(+), 375 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index a460457..1628226 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,11 +12,13 @@ "format": "prettier --plugin-search-dir . --write ." }, "devDependencies": { - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-node": "^1.2.3", - "@sveltejs/kit": "^1.15.0", - "@types/luxon": "^3.2.2", - "@types/markdown-it": "^12.2.3", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-node": "^2.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "@sveltestrap/sveltestrap": "^6.0.5", + "@types/luxon": "^3.3.7", + "@types/markdown-it": "^13.0.7", "@types/node": "^18.15.11", "@types/sanitize-html": "^2.9.0", "@typescript-eslint/eslint-plugin": "^5.57.1", @@ -25,14 +27,13 @@ "eslint-config-prettier": "^8.8.0", "eslint-plugin-svelte3": "^4.0.0", "prettier": "^2.8.7", - "prettier-plugin-svelte": "^2.10.0", - "svelte": "^3.58.0", - "svelte-check": "^3.1.4", + "prettier-plugin-svelte": "^2.10.1", + "svelte": "^4.0.0", + "svelte-check": "^3.4.3", "svelte-hcaptcha": "^0.1.1", - "sveltestrap": "^5.10.0", "tslib": "^2.5.0", - "typescript": "^4.9.5", - "vite": "^4.2.1", + "typescript": "^5.0.0", + "vite": "^5.0.0", "vite-plugin-markdown": "^2.1.0" }, "type": "module", @@ -41,8 +42,8 @@ "@popperjs/core": "^2.11.7", "@sentry/node": "^7.46.0", "base64-arraybuffer": "^1.0.2", - "bootstrap": "5.3.0-alpha1", - "bootstrap-icons": "^1.10.4", + "bootstrap": "^5.3.2", + "bootstrap-icons": "^1.11.2", "jose": "^4.13.1", "luxon": "^3.3.0", "markdown-it": "^13.0.1", diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts index d4759fd..ba59572 100644 --- a/frontend/src/app.d.ts +++ b/frontend/src/app.d.ts @@ -1,15 +1,15 @@ // See https://kit.svelte.dev/docs/types#app -import type { ErrorCode } from "$lib/api/entities"; +import type { APIError, ErrorCode } from "$lib/api/entities"; // for information about these interfaces declare global { namespace App { - interface Error { + type Error = { code: ErrorCode; message?: string | undefined; details?: string | undefined; - } + } | APIError // interface Locals {} // interface PageData {} // interface Platform {} diff --git a/frontend/src/lib/components/ActiveLink.svelte b/frontend/src/lib/components/ActiveLink.svelte index d9bc887..969cfbd 100644 --- a/frontend/src/lib/components/ActiveLink.svelte +++ b/frontend/src/lib/components/ActiveLink.svelte @@ -1,5 +1,5 @@ diff --git a/frontend/src/lib/components/IconButton.svelte b/frontend/src/lib/components/IconButton.svelte index c131a4d..240339a 100644 --- a/frontend/src/lib/components/IconButton.svelte +++ b/frontend/src/lib/components/IconButton.svelte @@ -1,5 +1,5 @@ diff --git a/frontend/src/routes/@[username]/+page.server.ts b/frontend/src/routes/@[username]/+page.server.ts index 447c5e3..1e7b8af 100644 --- a/frontend/src/routes/@[username]/+page.server.ts +++ b/frontend/src/routes/@[username]/+page.server.ts @@ -11,7 +11,7 @@ export const load = async ({ params }) => { return resp; } catch (e) { if ((e as APIError).code === ErrorCode.UserNotFound) { - throw error(404, e as APIError); + error(404, e as APIError); } throw e; diff --git a/frontend/src/routes/@[username]/+page.svelte b/frontend/src/routes/@[username]/+page.svelte index 56542fc..642e715 100644 --- a/frontend/src/routes/@[username]/+page.svelte +++ b/frontend/src/routes/@[username]/+page.svelte @@ -14,7 +14,7 @@ ModalBody, ModalFooter, Tooltip, - } from "sveltestrap"; + } from "@sveltestrap/sveltestrap"; import { DateTime, Duration, FixedOffsetZone, Zone } from "luxon"; import FieldCard from "$lib/components/FieldCard.svelte"; import PronounLink from "$lib/components/PronounLink.svelte"; diff --git a/frontend/src/routes/@[username]/ProfileFlag.svelte b/frontend/src/routes/@[username]/ProfileFlag.svelte index 3ef4c63..6862770 100644 --- a/frontend/src/routes/@[username]/ProfileFlag.svelte +++ b/frontend/src/routes/@[username]/ProfileFlag.svelte @@ -1,6 +1,6 @@ diff --git a/frontend/src/routes/@[username]/[memberName]/edit/fields/+page.svelte b/frontend/src/routes/@[username]/[memberName]/edit/fields/+page.svelte index a77b13a..08a456d 100644 --- a/frontend/src/routes/@[username]/[memberName]/edit/fields/+page.svelte +++ b/frontend/src/routes/@[username]/[memberName]/edit/fields/+page.svelte @@ -1,7 +1,7 @@ diff --git a/frontend/src/routes/@[username]/edit/+layout.svelte b/frontend/src/routes/@[username]/edit/+layout.svelte index 6bcb23b..de6dbf3 100644 --- a/frontend/src/routes/@[username]/edit/+layout.svelte +++ b/frontend/src/routes/@[username]/edit/+layout.svelte @@ -2,7 +2,7 @@ import { setContext } from "svelte"; import { writable } from "svelte/store"; import type { LayoutData } from "./$types"; - import { Button, ButtonGroup, Icon, Nav, NavItem } from "sveltestrap"; + import { Button, ButtonGroup, Icon, Nav, NavItem } from "@sveltestrap/sveltestrap"; import type { MeUser, APIError } from "$lib/api/entities"; import ErrorAlert from "$lib/components/ErrorAlert.svelte"; import { addToast, delToast } from "$lib/toast"; diff --git a/frontend/src/routes/@[username]/edit/+layout.ts b/frontend/src/routes/@[username]/edit/+layout.ts index 2fd9c4c..de77441 100644 --- a/frontend/src/routes/@[username]/edit/+layout.ts +++ b/frontend/src/routes/@[username]/edit/+layout.ts @@ -13,7 +13,7 @@ export const load = async ({ params }) => { const flags = await apiFetchClient("/users/@me/flags"); if (params.username !== user.name) { - throw redirect(303, `/@${user.name}/edit`); + redirect(303, `/@${user.name}/edit`); } return { @@ -22,7 +22,7 @@ export const load = async ({ params }) => { flags, }; } catch (e) { - if ("code" in e) throw error(500, e as APIError); + if ("code" in e) error(500, e as APIError); throw e; } }; diff --git a/frontend/src/routes/@[username]/edit/+page.svelte b/frontend/src/routes/@[username]/edit/+page.svelte index e727633..d5c2aeb 100644 --- a/frontend/src/routes/@[username]/edit/+page.svelte +++ b/frontend/src/routes/@[username]/edit/+page.svelte @@ -3,7 +3,7 @@ import type { Writable } from "svelte/store"; import prettyBytes from "pretty-bytes"; import { encode } from "base64-arraybuffer"; - import { FormGroup, Icon, Input } from "sveltestrap"; + import { FormGroup, Icon, Input } from "@sveltestrap/sveltestrap"; import { userAvatars, type MeUser } from "$lib/api/entities"; import FallbackImage from "$lib/components/FallbackImage.svelte"; import EditableName from "$lib/components/edit/EditableName.svelte"; diff --git a/frontend/src/routes/@[username]/edit/bio/+page.svelte b/frontend/src/routes/@[username]/edit/bio/+page.svelte index 2cbbf38..572fa35 100644 --- a/frontend/src/routes/@[username]/edit/bio/+page.svelte +++ b/frontend/src/routes/@[username]/edit/bio/+page.svelte @@ -4,7 +4,7 @@ import { MAX_DESCRIPTION_LENGTH, type MeUser } from "$lib/api/entities"; import { charCount, renderMarkdown } from "$lib/utils"; import MarkdownHelp from "$lib/components/edit/MarkdownHelp.svelte"; - import { Card, CardBody, CardHeader } from "sveltestrap"; + import { Card, CardBody, CardHeader } from "@sveltestrap/sveltestrap"; const user = getContext>("user"); diff --git a/frontend/src/routes/@[username]/edit/fields/+page.svelte b/frontend/src/routes/@[username]/edit/fields/+page.svelte index f09d89d..9ad8d0a 100644 --- a/frontend/src/routes/@[username]/edit/fields/+page.svelte +++ b/frontend/src/routes/@[username]/edit/fields/+page.svelte @@ -1,7 +1,7 @@ diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/settings/+layout.svelte index fc225ee..1120447 100644 --- a/frontend/src/routes/settings/+layout.svelte +++ b/frontend/src/routes/settings/+layout.svelte @@ -9,7 +9,7 @@ Modal, ModalBody, ModalFooter, - } from "sveltestrap"; + } from "@sveltestrap/sveltestrap"; import { userStore } from "$lib/store"; import { goto } from "$app/navigation"; import { addToast } from "$lib/toast"; diff --git a/frontend/src/routes/settings/+layout.ts b/frontend/src/routes/settings/+layout.ts index 415bf6c..acf0e5e 100644 --- a/frontend/src/routes/settings/+layout.ts +++ b/frontend/src/routes/settings/+layout.ts @@ -40,7 +40,7 @@ export const load = (async ({ parent }) => { }; } catch (e) { if ((e as APIError).code !== ErrorCode.InternalServerError) { - throw redirect(303, "/auth/login"); + redirect(303, "/auth/login"); } throw e; } diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index 92451e1..58f5650 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -23,7 +23,7 @@ ModalFooter, ModalHeader, Table, - } from "sveltestrap"; + } from "@sveltestrap/sveltestrap"; import type { PageData } from "./$types"; import { onMount } from "svelte"; import { DateTime } from "luxon"; diff --git a/frontend/src/routes/settings/auth/+page.svelte b/frontend/src/routes/settings/auth/+page.svelte index 2d03bb5..c55d9bb 100644 --- a/frontend/src/routes/settings/auth/+page.svelte +++ b/frontend/src/routes/settings/auth/+page.svelte @@ -13,7 +13,7 @@ Modal, ModalBody, ModalFooter, - } from "sveltestrap"; + } from "@sveltestrap/sveltestrap"; import type { PageData } from "./$types"; export let data: PageData; diff --git a/frontend/src/routes/settings/export/+page.svelte b/frontend/src/routes/settings/export/+page.svelte index 31f87e7..97733f6 100644 --- a/frontend/src/routes/settings/export/+page.svelte +++ b/frontend/src/routes/settings/export/+page.svelte @@ -1,7 +1,7 @@