[ci] format
This commit is contained in:
parent
fa84f1a7d2
commit
8a0336c362
5 changed files with 14 additions and 8 deletions
|
@ -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';
|
||||
|
@ -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') {
|
||||
|
|
|
@ -17,8 +17,8 @@ export {
|
|||
renderHTMLElement,
|
||||
renderPage,
|
||||
renderScriptElement,
|
||||
renderSlotToString,
|
||||
renderSlot,
|
||||
renderSlotToString,
|
||||
renderStyleElement,
|
||||
renderTemplate as render,
|
||||
renderTemplate,
|
||||
|
|
|
@ -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']]);
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue