feat(website): switch to universal loaders

This commit is contained in:
LukaDev 2024-09-29 15:32:03 +02:00
parent 172ba11443
commit ba0345d58a
4 changed files with 8 additions and 8 deletions

View file

@ -1,7 +1,7 @@
import { fetchRegistryJson, type SearchResponse } from "$lib/registry-api"
import type { PageServerLoad } from "./$types"
import type { PageLoad } from "./$types"
export const load: PageServerLoad = async ({ fetch }) => {
export const load: PageLoad = async ({ fetch }) => {
const { data: packages } = await fetchRegistryJson<SearchResponse>("search", fetch)
return { packages }

View file

@ -4,7 +4,7 @@ import {
type PackageVersionResponse,
} from "$lib/registry-api"
import { error } from "@sveltejs/kit"
import type { LayoutServerLoad } from "./$types"
import type { LayoutLoad } from "./$types"
type FetchPackageOptions = {
scope: string
@ -29,7 +29,7 @@ const fetchPackage = async (fetcher: typeof fetch, options: FetchPackageOptions)
}
}
export const load: LayoutServerLoad = async ({ params }) => {
export const load: LayoutLoad = async ({ params }) => {
const { scope, name, version, target } = params
if (version !== undefined && target === undefined) {

View file

@ -9,7 +9,7 @@ import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
import { createCssVariablesTheme } from "shiki"
import { unified } from "unified"
import type { PageServerLoad } from "./$types"
import type { PageLoad } from "./$types"
const fetchReadme = async (
fetcher: typeof fetch,
@ -37,7 +37,7 @@ const fetchReadme = async (
}
}
export const load: PageServerLoad = async ({ parent }) => {
export const load: PageLoad = async ({ parent }) => {
const { pkg } = await parent()
const { name, version, targets } = pkg

View file

@ -4,9 +4,9 @@ import {
type PackageVersionsResponse,
} from "$lib/registry-api"
import { error } from "@sveltejs/kit"
import type { PageServerLoad } from "./$types"
import type { PageLoad } from "./$types"
export const load: PageServerLoad = async ({ params, fetch }) => {
export const load: PageLoad = async ({ params, fetch }) => {
const { scope, name } = params
try {