0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-13 22:11:20 -05:00

[ci] format

This commit is contained in:
matthewp 2022-09-28 14:57:53 +00:00 committed by fredkbot
parent 87a7cf48e7
commit f4bca41a2d
4 changed files with 16 additions and 14 deletions

View file

@ -5,7 +5,6 @@ import { HTMLBytes, markHTMLString } from '../escape.js';
import { extractDirectives, generateHydrateScript } from '../hydration.js';
import { serializeProps } from '../serialize.js';
import { shorthash } from '../shorthash.js';
import { renderSlot, renderSlots } from './slot.js';
import {
isAstroComponentFactory,
renderAstroComponent,
@ -14,6 +13,7 @@ import {
} from './astro.js';
import { Fragment, Renderer, stringifyChunk } from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { renderSlot, renderSlots } from './slot.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';
const rendererAliases = new Map([['solid', 'solid-js']]);
@ -70,7 +70,9 @@ export async function renderComponent(
case 'html': {
const { slotInstructions, children } = await renderSlots(result, slots);
const html = (Component as any).render({ slots: children });
const hydrationHtml = slotInstructions ? slotInstructions.map(instr => stringifyChunk(result, instr)).join('') : '';
const hydrationHtml = slotInstructions
? slotInstructions.map((instr) => stringifyChunk(result, instr)).join('')
: '';
return markHTMLString(hydrationHtml + html);
}

View file

@ -1,12 +1,12 @@
import { renderTemplate } from './astro.js';
export { renderSlot } from './slot.js';
export { renderAstroComponent, renderTemplate, renderToString } from './astro.js';
export { Fragment, Renderer, stringifyChunk } from './common.js';
export { renderComponent } from './component.js';
export { renderHTMLElement } from './dom.js';
export { maybeRenderHead, renderHead } from './head.js';
export { renderPage } from './page.js';
export { renderSlot } from './slot.js';
export type { RenderInstruction } from './types';
export { addAttribute, defineScriptVars, voidElementNames } from './util.js';

View file

@ -1,8 +1,8 @@
import type { RenderInstruction } from './types.js';
import type { SSRResult } from '../../../@types/astro.js';
import type { RenderInstruction } from './types.js';
import { renderChild } from './any.js';
import { HTMLString, markHTMLString } from '../escape.js';
import { renderChild } from './any.js';
export class SlotString extends HTMLString {
public instructions: null | RenderInstruction[];
@ -33,7 +33,7 @@ export async function renderSlot(_result: any, slotted: string, fallback?: any):
}
interface RenderSlotsResult {
slotInstructions: null | RenderInstruction[],
slotInstructions: null | RenderInstruction[];
children: Record<string, string>;
}