fix(svelte): add missing components-manifest prop#183
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
comark
@comark/ansi
@comark/html
@comark/nuxt
@comark/react
@comark/svelte
@comark/vue
commit: |
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
I'm out of town until Monday but I do know that at least as is current, the import.meta.glob example does not lazily load components (unless something has changed on the Vite end). import.meta.glob basically performs a buildtime lookup of all available files and inlines them as imports into the file.
I'll take a better look at this on Monday!
|
@elliott-with-the-longest-name-on-github actually the |
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
LGTM, just one nit and one slightly more substantial change to support experimental async
|
Hey @atinux. I don't know how it happened, but I missed the notification. 🤷 @elliott-with-the-longest-name-on-github has already mentioned A few words about my case: I have some Markdown pages, some of which contain custom widgets. I'd like to be able to store these widgets directly in the pages' directories and load them during the build (SSG). Something like: ...

...(The path to the widget may or may not be unique) With |
Co-authored-by: Elliott Johnson <hello@ell.iott.dev>
|
@Serator you don't need to use <script lang="ts">
import { ComarkAsync } from '@comark/svelte/async'
import type { PageData } from './$types'
let { data }: { data: PageData } = $props()
const componentMap: Record<string, () => Promise<any>> = {
'alert': () => import('$lib/components/Alert.svelte'),
'card': () => import('$lib/components/Card.svelte'),
}
const componentsManifest = (name: string) => componentMap[name]?.()
</script>
<article>
<ComarkAsync markdown={data.markdown} {componentsManifest} />
</article> |
🔗 Linked issue
resolves #177
❓ Type of change
📚 Description
We did not have the
components-manifestprop on Svelte's comark components.This PR aims to add them, but my lack of knowledge on Svelte makes me unconfortable right now, I would love a review from @elliott-with-the-longest-name-on-github first 🙏
Maybe @Serator as well?
📝 Checklist
pnpm verifyand it passes.