0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
matthewp 2023-05-23 19:43:05 +00:00 committed by fredkbot
parent 904131aec3
commit bf2320edb6
3 changed files with 11 additions and 10 deletions

View file

@ -9,6 +9,7 @@ import type {
SSRLoadedRenderer,
SSRResult,
} from '../../@types/astro';
import { isHTMLString } from '../../runtime/server/escape.js';
import {
renderSlotToString,
stringifyChunk,
@ -18,7 +19,6 @@ import { renderJSX } from '../../runtime/server/jsx.js';
import { AstroCookies } from '../cookies/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { warn, type LogOptions } from '../logger/core.js';
import { isHTMLString } from '../../runtime/server/escape.js';
const clientAddressSymbol = Symbol.for('astro.clientAddress');
const responseSentSymbol = Symbol.for('astro.responseSent');
@ -111,12 +111,11 @@ class Slots {
// Astro
const expression = getFunctionExpression(component);
if (expression) {
const slot = async () => isHTMLString(await expression) ? expression : expression(...args)
return await renderSlotToString(result, slot).then((res) =>{
return res != null ? String(res) : res
}
);
const slot = async () =>
isHTMLString(await expression) ? expression : expression(...args);
return await renderSlotToString(result, slot).then((res) => {
return res != null ? String(res) : res;
});
}
// JSX
if (typeof component === 'function') {

View file

@ -7,7 +7,9 @@ import { renderChild } from './any.js';
type RenderTemplateResult = ReturnType<typeof renderTemplate>;
export type ComponentSlots = Record<string, ComponentSlotValue>;
export type ComponentSlotValue = (result: SSRResult) => RenderTemplateResult | Promise<RenderTemplateResult>;
export type ComponentSlotValue = (
result: SSRResult
) => RenderTemplateResult | Promise<RenderTemplateResult>;
const slotString = Symbol.for('astro:slot-string');

View file

@ -40,7 +40,7 @@ describe('set:html', () => {
expect(res.status).to.equal(200);
let html = await res.text();
expect(html).include('Test');
})
});
});
describe('Build', () => {
@ -87,6 +87,6 @@ describe('set:html', () => {
it('test Fragment when Fragment is as a slot', async () => {
let res = await fixture.readFile('/children/index.html');
expect(res).include('Test');
})
});
});
});