mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-05-04 10:33:47 +01:00
feat(website): switch to universal loaders
This commit is contained in:
parent
172ba11443
commit
ba0345d58a
4 changed files with 8 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { fetchRegistryJson, type SearchResponse } from "$lib/registry-api"
|
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)
|
const { data: packages } = await fetchRegistryJson<SearchResponse>("search", fetch)
|
||||||
|
|
||||||
return { packages }
|
return { packages }
|
|
@ -4,7 +4,7 @@ import {
|
||||||
type PackageVersionResponse,
|
type PackageVersionResponse,
|
||||||
} from "$lib/registry-api"
|
} from "$lib/registry-api"
|
||||||
import { error } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
import type { LayoutServerLoad } from "./$types"
|
import type { LayoutLoad } from "./$types"
|
||||||
|
|
||||||
type FetchPackageOptions = {
|
type FetchPackageOptions = {
|
||||||
scope: string
|
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
|
const { scope, name, version, target } = params
|
||||||
|
|
||||||
if (version !== undefined && target === undefined) {
|
if (version !== undefined && target === undefined) {
|
|
@ -9,7 +9,7 @@ import remarkParse from "remark-parse"
|
||||||
import remarkRehype from "remark-rehype"
|
import remarkRehype from "remark-rehype"
|
||||||
import { createCssVariablesTheme } from "shiki"
|
import { createCssVariablesTheme } from "shiki"
|
||||||
import { unified } from "unified"
|
import { unified } from "unified"
|
||||||
import type { PageServerLoad } from "./$types"
|
import type { PageLoad } from "./$types"
|
||||||
|
|
||||||
const fetchReadme = async (
|
const fetchReadme = async (
|
||||||
fetcher: typeof fetch,
|
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 { pkg } = await parent()
|
||||||
const { name, version, targets } = pkg
|
const { name, version, targets } = pkg
|
||||||
|
|
|
@ -4,9 +4,9 @@ import {
|
||||||
type PackageVersionsResponse,
|
type PackageVersionsResponse,
|
||||||
} from "$lib/registry-api"
|
} from "$lib/registry-api"
|
||||||
import { error } from "@sveltejs/kit"
|
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
|
const { scope, name } = params
|
||||||
|
|
||||||
try {
|
try {
|
Loading…
Add table
Reference in a new issue