-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
3 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ const name = "mononykus/svelte"; | |
/** force wrapping the actual component in a synthetic one */ | ||
const ssr_island = "?ssr_island"; | ||
|
||
/** Wrapper component for islands to be hydrated, which serialises props. */ | ||
const OneClaw = ( | ||
{ path, name, module_src }: { | ||
path: string; | ||
|
@@ -33,6 +34,7 @@ const OneClaw = ( | |
|
||
const SVELTE_IMPORTS = /(from|import) ['"](?:svelte)(\/?[\w\/-]*)['"]/g; | ||
|
||
/** Convert `svelte/*` imports to `npm:[email protected]/*` */ | ||
const specifiers = (code: string) => | ||
code.replaceAll(SVELTE_IMPORTS, `$1 'npm:svelte@${VERSION}$2'`); | ||
|
||
|
@@ -104,6 +106,7 @@ export const svelte_components = ( | |
}); | ||
|
||
if (generate === "dom" && path.endsWith(".island.svelte")) { | ||
/** Dynamic function to be inlined in the output. */ | ||
const hydrator = (name: string, Component: ComponentType) => { | ||
try { | ||
document.querySelectorAll( | ||
|