From 4a35c505e4914c723ec0d26cd663e7a1d9a86b00 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 6 Nov 2024 14:16:10 +0000 Subject: [PATCH] [ci] format --- packages/integrations/svelte/client-v5.js | 23 +++++++++++------------ packages/integrations/svelte/server-v5.js | 12 ++++++------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/packages/integrations/svelte/client-v5.js b/packages/integrations/svelte/client-v5.js index f2cc647a2b..123e544f61 100644 --- a/packages/integrations/svelte/client-v5.js +++ b/packages/integrations/svelte/client-v5.js @@ -10,7 +10,6 @@ export default (element) => { let $$slots = undefined; let renderFns = {}; - for (const [key, value] of Object.entries(slotted)) { // Legacy slot support $$slots ??= {}; @@ -25,15 +24,15 @@ export default (element) => { })); } // @render support for Svelte ^5.0 - if (key === 'default') { - renderFns.children = createRawSnippet(() => ({ - render: () => `${value}` - })); - } else { - renderFns[key] = createRawSnippet(() => ({ - render: () => `${value}` - })); - } + if (key === 'default') { + renderFns.children = createRawSnippet(() => ({ + render: () => `${value}`, + })); + } else { + renderFns[key] = createRawSnippet(() => ({ + render: () => `${value}`, + })); + } } const bootstrap = client !== 'only' ? hydrate : mount; @@ -42,7 +41,7 @@ export default (element) => { ...props, children, $$slots, - ...renderFns + ...renderFns, }); } else { const component = bootstrap(Component, { @@ -51,7 +50,7 @@ export default (element) => { ...props, children, $$slots, - ...renderFns + ...renderFns, }, }); existingApplications.set(element, component); diff --git a/packages/integrations/svelte/server-v5.js b/packages/integrations/svelte/server-v5.js index 932a52b1ff..a38d382604 100644 --- a/packages/integrations/svelte/server-v5.js +++ b/packages/integrations/svelte/server-v5.js @@ -18,7 +18,7 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) { let children = undefined; let $$slots = undefined; const renderProps = {}; - + for (const [key, value] of Object.entries(slotted)) { // Legacy slot support $$slots ??= {}; @@ -33,10 +33,10 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) { })); } // @render support for Svelte ^5.0 - const slotName = key === 'default' ? 'children' : key; - renderProps[slotName] = createRawSnippet(() => ({ - render: () => `<${tagName}${key !== 'default' ? ` name="${key}"` : ''}>${value}` - })); + const slotName = key === 'default' ? 'children' : key; + renderProps[slotName] = createRawSnippet(() => ({ + render: () => `<${tagName}${key !== 'default' ? ` name="${key}"` : ''}>${value}`, + })); } const result = render(Component, { @@ -44,7 +44,7 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) { ...props, children, $$slots, - ...renderProps + ...renderProps, }, }); return { html: result.body };