migrate to sveltekit 2

This commit is contained in:
Xylight committed 2024-02-10 16:01:04 -08:00
1 parent ff52be7f34
commit a7c1e2a21f
11 files changed
+17 -16

No files matched your search

BIN
View File
Binary file not shown.
+5 -4
View File
@@ -14,9 +14,10 @@
}, },
"devDependencies": { "devDependencies": {
"@catdadcode/svelte-adapter-bun": "^0.5.7", "@catdadcode/svelte-adapter-bun": "^0.5.7",
"@sveltejs/adapter-node": "^1.3.1", "@sveltejs/adapter-node": "^2.0.0",
"@sveltejs/adapter-vercel": "^5.1.0", "@sveltejs/adapter-vercel": "^5.1.0",
"@sveltejs/kit": "^1.24.0", "@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
"@types/markdown-it-container": "^2.0.6", "@types/markdown-it-container": "^2.0.6",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
@@ -37,9 +38,9 @@
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"tslib": "^2.4.1", "tslib": "^2.4.1",
"typescript": "^5.0.0", "typescript": "^5.0.0",
"vite": "^4.3.0", "vite": "^5.0.0",
"vite-plugin-pwa": "^0.16.5", "vite-plugin-pwa": "^0.16.5",
"vitest": "^0.33.0", "vitest": "^1.0.0",
"workbox-window": "^7.0.0" "workbox-window": "^7.0.0"
}, },
"dependencies": { "dependencies": {
+1 -1
View File
@@ -47,7 +47,7 @@ async function customFetch(
if (auth && url) url.searchParams.set('auth', auth) if (auth && url) url.searchParams.set('auth', auth)
const res = await f(url ?? input, init) const res = await f(url ?? input, init)
if (!res.ok) throw error(res.status, await res.text()) if (!res.ok) error(res.status, await res.text());
return res return res
} }
+2 -2
View File
@@ -39,8 +39,8 @@ export async function load({ url, fetch }) {
}, },
} }
} catch (err) { } catch (err) {
throw error(500, { error(500, {
message: 'Failed to fetch homepage.', message: 'Failed to fetch homepage.',
}) });
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export const load = () => { export const load = () => {
throw redirect(300, '/admin/config') redirect(300, '/admin/config');
} }
+1 -1
View File
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit'
export function load({ params }) { export function load({ params }) {
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance. // If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
throw redirect(300, `/comment/${getInstance()}/${params.instance}`) redirect(300, `/comment/${getInstance()}/${params.instance}`);
} }
+2 -2
View File
@@ -8,8 +8,8 @@ export async function load({ params, fetch }) {
id: Number(params.id), id: Number(params.id),
}) })
throw redirect( redirect(
300, 300,
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}` `/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`
) );
} }
+2 -2
View File
@@ -12,8 +12,8 @@ export function load({ params, url }) {
const newUrl = new URL(url) const newUrl = new URL(url)
newUrl.pathname = split.join('/') newUrl.pathname = split.join('/')
throw redirect(300, newUrl.toString()) redirect(300, newUrl.toString());
} }
throw error(404, 'Not found') error(404, 'Not found');
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export const load = async () => { export const load = async () => {
throw redirect(300, '/profile/user') redirect(300, '/profile/user');
} }
+1 -1
View File
@@ -3,6 +3,6 @@ import { redirect } from "@sveltejs/kit";
export const load = () => { export const load = () => {
if (LINKED_INSTANCE_URL) { if (LINKED_INSTANCE_URL) {
throw redirect(300, `/signup/${LINKED_INSTANCE_URL}`) redirect(300, `/signup/${LINKED_INSTANCE_URL}`);
} }
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import node from '@sveltejs/adapter-node'; import node from '@sveltejs/adapter-node';
import bun from '@catdadcode/svelte-adapter-bun' import bun from '@catdadcode/svelte-adapter-bun'
import vercel from '@sveltejs/adapter-vercel' import vercel from '@sveltejs/adapter-vercel'
import { vitePreprocess } from '@sveltejs/kit/vite'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {