Skip to content

Commit

Permalink
SvelteKit 2
Browse files Browse the repository at this point in the history
Bump SvelteKit and its associated vite peer dependencies.

Two resulting changes:
- "status" functions now return `never` and throw directly
- Snapshots no longer have escaped quotes. Huh.
  • Loading branch information
isker committed Jan 1, 2024
1 parent b3e7d24 commit 698e67d
Show file tree
Hide file tree
Showing 12 changed files with 634 additions and 337 deletions.
919 changes: 609 additions & 310 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
"license": "MIT",
"devDependencies": {
"@changesets/cli": "2.26.2",
"@sveltejs/adapter-node": "1.3.1",
"@sveltejs/kit": "1.26.0",
"@sveltejs/adapter-node": "2.0.2",
"@sveltejs/kit": "2.0.6",
"@sveltejs/vite-plugin-svelte": "3.0.1",
"@types/lucene": "2.1.5",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
Expand All @@ -49,13 +50,13 @@
"tailwindcss": "3.3.3",
"type-fest": "4.4.0",
"typescript": "5.2.2",
"vite": "4.4.11",
"vitest": "0.34.6"
"vite": "5.0.10",
"vitest": "1.1.0"
},
"dependencies": {
"@badrap/valita": "0.3.0",
"lucene": "2.1.1",
"lucide-svelte": "0.256.1",
"lucide-svelte": "0.303.0",
"pretty-bytes": "6.1.1",
"prom-client": "15.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const load: import("./$types").PageServerLoad = async ({
fetch,
}) => {
if (!file) {
throw error(404);
error(404);
}
const revision = url.searchParams.get("r");
const convertedRepo = configuration.openGrokProjectMappings.get(project);
Expand All @@ -36,7 +36,7 @@ export const load: import("./$types").PageServerLoad = async ({
});

if (fileUrl && (await parent()).preferences.openGrokInstantRedirect) {
throw redirect(301, fileUrl);
redirect(301, fileUrl);
}

return { file, fileUrl };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const load: import("./$types").PageServerLoad = async ({
fetch,
}) => {
if (!file) {
throw error(404);
error(404);
}
const revision = url.searchParams.get("r");
const convertedRepo = configuration.openGrokProjectMappings.get(project);
Expand All @@ -36,7 +36,7 @@ export const load: import("./$types").PageServerLoad = async ({
});

if (fileUrl && (await parent()).preferences.openGrokInstantRedirect) {
throw redirect(301, fileUrl);
redirect(301, fileUrl);
}

return { file, fileUrl };
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(opengrok-compat)/help.jsp/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from "@sveltejs/kit";

export const load: import("./$types").PageServerLoad = () => {
throw redirect(301, "/syntax");
redirect(301, "/syntax");
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const load: import("./$types").PageServerLoad = async ({
});

if (destinationUrl && (await parent()).preferences.openGrokInstantRedirect) {
throw redirect(301, destinationUrl);
redirect(301, destinationUrl);
}

return { file, destinationUrl };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const load: import("./$types").PageServerLoad = async ({
fetch,
}) => {
if (!file) {
throw error(404);
error(404);
}
const revision = url.searchParams.get("r");
const convertedRepo = configuration.openGrokProjectMappings.get(project);
Expand All @@ -36,7 +36,7 @@ export const load: import("./$types").PageServerLoad = async ({
});

if (fileUrl && (await parent()).preferences.openGrokInstantRedirect) {
throw redirect(301, fileUrl);
redirect(301, fileUrl);
}

return { file, fileUrl };
Expand Down
5 changes: 1 addition & 4 deletions src/routes/(opengrok-compat)/search/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ export const load: import("./$types").PageServerLoad = async ({

const { preferences } = await parent();
if (preferences.openGrokInstantRedirect && zoektQuery) {
throw redirect(
301,
`/?${new URLSearchParams({ q: zoektQuery }).toString()}`,
);
redirect(301, `/?${new URLSearchParams({ q: zoektQuery }).toString()}`);
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const load: import("./$types").PageServerLoad = async ({
});

if (destinationUrl && (await parent()).preferences.openGrokInstantRedirect) {
throw redirect(301, destinationUrl);
redirect(301, destinationUrl);
}

return { file, destinationUrl };
Expand Down
14 changes: 7 additions & 7 deletions src/routes/(search-page)/chunk-renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe("renderChunksToLineGroups", () => {
"lineNumber": 20,
"lineTokens": [
{
"text": " \\"strings\\"
"text": " "strings"
",
},
],
Expand All @@ -201,14 +201,14 @@ describe("renderChunksToLineGroups", () => {
"lineNumber": 21,
"lineTokens": [
{
"text": " \\"",
"text": " "",
},
{
"match": true,
"text": "test",
},
{
"text": "ing\\"
"text": "ing"
",
},
],
Expand Down Expand Up @@ -368,7 +368,7 @@ describe("renderChunksToLineGroups", () => {
"lineNumber": 20,
"lineTokens": [
{
"text": " \\"strings\\"
"text": " "strings"
",
},
],
Expand All @@ -377,14 +377,14 @@ describe("renderChunksToLineGroups", () => {
"lineNumber": 21,
"lineTokens": [
{
"text": " \\"",
"text": " "",
},
{
"match": true,
"text": "test",
},
{
"text": "ing\\"
"text": "ing"
",
},
],
Expand Down Expand Up @@ -556,7 +556,7 @@ describe("renderChunksToLineGroups", () => {
"lineNumber": 91,
"lineTokens": [
{
"text": " Content: []byte(\\"foo\\"),",
"text": " Content: []byte("foo"),",
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/routes/metrics/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const GET = (async () => {
// In prod, prom metrics are exposed on a different port on an opt-in basis;
// this is the most generally-useful and not-harmful approach, as you don't
// want to expose /metrics to end users in prod.
throw error(404, "Not found");
error(404, "Not found");
}
return new Response(await registry.metrics(), {
headers: { "content-type": registry.contentType },
Expand Down
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/kit/vite";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";

/** @type {import('@sveltejs/kit').Config} */
const config = {
Expand Down

0 comments on commit 698e67d

Please sign in to comment.