Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Apr 7, 2023
1 parent fa84f1a commit 8a0336c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions packages/astro/src/core/render/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import type {
SSRLoadedRenderer,
SSRResult,
} from '../../@types/astro';
import { renderSlotToString, stringifyChunk, type ComponentSlots } from '../../runtime/server/index.js';
import {
renderSlotToString,
stringifyChunk,
type ComponentSlots,
} from '../../runtime/server/index.js';
import { renderJSX } from '../../runtime/server/jsx.js';
import { AstroCookies } from '../cookies/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
Expand Down Expand Up @@ -105,7 +109,9 @@ class Slots {
const expression = getFunctionExpression(component);
if (expression) {
const slot = () => expression(...args);
return await renderSlotToString(result, slot).then((res) => (res != null ? String(res) : res));
return await renderSlotToString(result, slot).then((res) =>
res != null ? String(res) : res
);
}
// JSX
if (typeof component === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export {
renderHTMLElement,
renderPage,
renderScriptElement,
renderSlotToString,
renderSlot,
renderSlotToString,
renderStyleElement,
renderTemplate as render,
renderTemplate,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from './astro/index.js';
import { Fragment, Renderer, stringifyChunk } from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { renderSlotToString, renderSlots, type ComponentSlots } from './slot.js';
import { renderSlots, renderSlotToString, type ComponentSlots } from './slot.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';

const rendererAliases = new Map([['solid', 'solid-js']]);
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export { renderComponent, renderComponentToIterable } from './component.js';
export { renderHTMLElement } from './dom.js';
export { maybeRenderHead, renderHead } from './head.js';
export { renderPage } from './page.js';
export { renderSlotToString, renderSlot, type ComponentSlots } from './slot.js';
export { renderSlot, renderSlotToString, type ComponentSlots } from './slot.js';
export { renderScriptElement, renderStyleElement, renderUniqueStylesheet } from './tags.js';
export type { RenderInstruction } from './types';
export { addAttribute, defineScriptVars, voidElementNames } from './util.js';
6 changes: 3 additions & 3 deletions packages/astro/src/runtime/server/render/slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ export function isSlotString(str: string): str is any {
return !!(str as any)[slotString];
}

export async function * renderSlot(
export async function* renderSlot(
result: SSRResult,
slotted: ComponentSlotValue | RenderTemplateResult,
fallback?: ComponentSlotValue | RenderTemplateResult
): AsyncGenerator<any, void, undefined> {
if (slotted) {
let iterator = renderChild(typeof slotted === 'function' ? slotted(result) : slotted);
yield * iterator;
yield* iterator;
}

if (fallback) {
yield * renderSlot(result, fallback);
yield* renderSlot(result, fallback);
}
}

Expand Down

0 comments on commit 8a0336c

Please sign in to comment.