This repository was archived by the owner on Oct 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-132
lines changed
sites/floating-ui-svelte.vercel.app Expand file tree Collapse file tree 3 files changed +21
-132
lines changed Original file line number Diff line number Diff line change 1515 "@sveltejs/vite-plugin-svelte" : " ^5.0.3" ,
1616 "autoprefixer" : " ^10.4.20" ,
1717 "focus-trap" : " ^7.6.2" ,
18- "latest-version" : " ^9.0.0" ,
1918 "lucide-svelte" : " ^0.469.0" ,
2019 "pagefind" : " ^1.3.0" ,
2120 "shiki" : " ^1.24.4" ,
Original file line number Diff line number Diff line change 11import { browser } from "$app/environment" ;
2- import getLatestVersion from "latest-version" ;
32import type { Pagefind } from "vite-plugin-pagefind/types" ;
43
5- export async function load ( ) {
6- const version = await getLatestVersion ( "@skeletonlabs/floating-ui-svelte" ) ;
7- if ( browser ) {
8- // @ts -expect-error - Dynamic import
9- const pagefind : Pagefind = await import ( "/pagefind/pagefind.js" ) ;
10- await pagefind . init ( ) ;
11- return {
12- version,
13- pagefind,
14- } ;
4+ async function getPageFind ( ) {
5+ if ( ! browser ) {
6+ return null ;
157 }
8+ // @ts -expect-error - File will be generated at build time
9+ const pagefind : Pagefind = await import ( "/pagefind/pagefind.js" ) ;
10+ await pagefind . init ( ) ;
11+ return pagefind ;
12+ }
13+
14+ async function getLatestVersion ( fetcher : typeof fetch ) {
15+ const response = await fetcher ( "https://registry.npmjs.org/@skeletonlabs/floating-ui-svelte" ) ;
16+ const data = await response . json ( ) ;
17+ const version = data [ "dist-tags" ] . latest ;
18+ return version ;
19+ }
20+
21+ export async function load ( { fetch } ) {
22+ const version = getLatestVersion ( fetch ) ;
23+ const pagefind = await getPageFind ( ) ;
1624 return {
17- version,
25+ version : version ,
26+ pagefind : pagefind
1827 } ;
1928}
2029
You can’t perform that action at this time.
0 commit comments