migration to SvelteKit 2

This commit is contained in:
Bradley Shellnut 2023-12-15 09:47:22 -08:00
parent 88c230a9dc
commit 5bd28523ee
6 changed files with 431 additions and 497 deletions

View file

@ -23,10 +23,11 @@
"@melt-ui/pp": "^0.1.4",
"@playwright/test": "^1.40.1",
"@resvg/resvg-js": "^2.6.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/adapter-vercel": "^1.0.6",
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/adapter-vercel": "^4.0.0",
"@sveltejs/enhanced-img": "^0.1.6",
"@sveltejs/kit": "^1.30.3",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@zerodevx/svelte-img": "^2.1.0",
@ -58,9 +59,9 @@
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vanilla-lazyload": "^17.8.5",
"vite": "^4.5.1",
"vite": "^5.0.0",
"vite-imagetools": "^5.1.2",
"vitest": "^0.32.4"
"vitest": "^1.0.0"
},
"type": "module",
"engines": {
@ -74,4 +75,4 @@
"ioredis": "^5.3.2",
"nprogress": "^0.2.0"
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ import { fetchArticlesApi } from '$root/routes/api';
export const GET: RequestHandler = async ({ setHeaders, url }: RequestEvent) => {
const page = url?.searchParams?.get('page') || '1';
if (+page > +WALLABAG_MAX_PAGES) {
throw error(404, 'Page does not exist');
error(404, 'Page does not exist');
}
try {
@ -32,6 +32,6 @@ export const GET: RequestHandler = async ({ setHeaders, url }: RequestEvent) =>
}
} catch (e) {
console.error(e);
throw error(404, 'Page does not exist');
error(404, 'Page does not exist');
}
};

View file

@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit';
export const load = async () => {
throw redirect(302, '/articles/1');
redirect(302, '/articles/1');
};

View file

@ -17,9 +17,9 @@ export type ArticlePageLoad = {
export const load: PageServerLoad = async ({ fetch, params, setHeaders, url }) => {
const { page } = params;
if (+page > +WALLABAG_MAX_PAGES) {
throw error(404, {
message: 'Not found'
});
error(404, {
message: 'Not found'
});
}
const resp = await fetch(`/api/articles?page=${page}`);
const { articles, currentPage, totalPages, limit, totalArticles, cacheControl }: ArticlePageLoad =

View file

@ -1,5 +1,5 @@
import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/kit/vite';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { preprocessMeltUI } from '@melt-ui/pp';
import { mdsvex } from 'mdsvex';
import mdsvexConfig from './mdsvex.config.js';