diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 8d796c82..530354f9 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -77,7 +77,7 @@ Guidelines: ## SvelteKit configuration -The app uses Svelte's experimental async features and SvelteKit's remote functions. All SvelteKit configuration is passed to the `sveltekit()` plugin in `vite.config.ts` (the newer configuration style, expected to become the default in SvelteKit 3); `svelte.config.js` stays an empty stub so tools that require its presence keep working. The "svelte.config.js is ignored" warning printed by dev/build/check commands is expected with this setup. +The app targets the SvelteKit 3 prerelease line, beginning with `@sveltejs/kit@3.0.0-next.12`. All SvelteKit configuration is passed to the `sveltekit()` plugin in `vite.config.ts`; SvelteKit 3 no longer supports `svelte.config.js`. Internal library imports use the package-level `#lib` subpath alias declared in `package.json`, replacing SvelteKit 2's generated `$lib` alias. The app uses Svelte's experimental async features, SvelteKit remote functions, and explicit environment variables. ```ts sveltekit({ @@ -95,6 +95,8 @@ sveltekit({ **Experimental async** allows `await` in Svelte markup and top-level `await` in ` diff --git a/src/routes/components/LinkPreview.svelte b/src/routes/components/LinkPreview.svelte index c62d5fdd..a08f6598 100644 --- a/src/routes/components/LinkPreview.svelte +++ b/src/routes/components/LinkPreview.svelte @@ -2,6 +2,7 @@ import { get_svedit_context } from '../svedit_context.js'; import { get_app_context } from '../app_context.js'; import { resolve } from '$app/paths'; + import type { PathnameWithSearchOrHash } from '$app/types'; import { serialize_path } from 'svedit'; import Media from './Media.svelte'; @@ -18,7 +19,7 @@ if (!app.has_backend) return null; if (!href) return null; - const api_module = await import('$lib/api.remote.js'); + const api_module = await import('#lib/api.remote.js'); return await api_module.get_internal_link_preview(href); }); @@ -55,7 +56,9 @@ function get_preview_href(href: unknown) { if (typeof href !== 'string') return ''; - return href.startsWith('/') && !href.startsWith('//') ? resolve(href as any) : href; + if (!href.startsWith('/') || href.startsWith('//')) return href; + if (href === '/') return resolve('/'); + return resolve(href.slice(1) as PathnameWithSearchOrHash); } diff --git a/src/routes/components/Media.svelte b/src/routes/components/Media.svelte index d0c6756e..46f20223 100644 --- a/src/routes/components/Media.svelte +++ b/src/routes/components/Media.svelte @@ -2,7 +2,7 @@ import Image from './Image.svelte'; import Video from './Video.svelte'; - import type { PreviewMediaNode } from '$lib/page_metadata.js'; + import type { PreviewMediaNode } from '#lib/page_metadata.js'; // Accepts both document media nodes (Nodes['image'] / Nodes['video']) and // derived preview nodes — anything with the media display shape. diff --git a/src/routes/components/MediaControls.svelte b/src/routes/components/MediaControls.svelte index 8a51695c..482dd36e 100644 --- a/src/routes/components/MediaControls.svelte +++ b/src/routes/components/MediaControls.svelte @@ -1,6 +1,6 @@
- + +