mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
[ci] format
This commit is contained in:
parent
9bec6bc410
commit
10550f5ee2
5 changed files with 10 additions and 6 deletions
|
@ -11,8 +11,8 @@ import {
|
||||||
voidElementNames,
|
voidElementNames,
|
||||||
} from './index.js';
|
} from './index.js';
|
||||||
import { HTMLParts } from './render/common.js';
|
import { HTMLParts } from './render/common.js';
|
||||||
import { ScopeFlags } from './render/util.js';
|
|
||||||
import type { ComponentIterable } from './render/component';
|
import type { ComponentIterable } from './render/component';
|
||||||
|
import { ScopeFlags } from './render/util.js';
|
||||||
|
|
||||||
const ClientOnlyPlaceholder = 'astro-client-only';
|
const ClientOnlyPlaceholder = 'astro-client-only';
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ Did you forget to import the component or is it possible there is a typo?`);
|
||||||
props[key] = value;
|
props[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.scope |= ScopeFlags.JSX;
|
result.scope |= ScopeFlags.JSX;
|
||||||
return markHTMLString(await renderToString(result, vnode.type as any, props, slots));
|
return markHTMLString(await renderToString(result, vnode.type as any, props, slots));
|
||||||
}
|
}
|
||||||
case !vnode.type && (vnode.type as any) !== 0:
|
case !vnode.type && (vnode.type as any) !== 0:
|
||||||
|
|
|
@ -3,9 +3,9 @@ import type { HeadAndContent } from './head-and-content';
|
||||||
import type { RenderTemplateResult } from './render-template';
|
import type { RenderTemplateResult } from './render-template';
|
||||||
|
|
||||||
import { HTMLParts } from '../common.js';
|
import { HTMLParts } from '../common.js';
|
||||||
|
import { ScopeFlags } from '../util.js';
|
||||||
import { isHeadAndContent } from './head-and-content.js';
|
import { isHeadAndContent } from './head-and-content.js';
|
||||||
import { renderAstroTemplateResult } from './render-template.js';
|
import { renderAstroTemplateResult } from './render-template.js';
|
||||||
import { ScopeFlags } from '../util.js';
|
|
||||||
|
|
||||||
export type AstroFactoryReturnValue = RenderTemplateResult | Response | HeadAndContent;
|
export type AstroFactoryReturnValue = RenderTemplateResult | Response | HeadAndContent;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ export function* maybeRenderHead(result: SSRResult) {
|
||||||
|
|
||||||
// Don't render the head inside of a JSX component that's inside of an Astro component
|
// Don't render the head inside of a JSX component that's inside of an Astro component
|
||||||
// as the Astro component will be the one to render the head.
|
// as the Astro component will be the one to render the head.
|
||||||
switch(result.scope) {
|
switch (result.scope) {
|
||||||
case ScopeFlags.JSX | ScopeFlags.Slot | ScopeFlags.Astro: {
|
case ScopeFlags.JSX | ScopeFlags.Slot | ScopeFlags.Astro: {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,11 @@ export function isSlotString(str: string): str is any {
|
||||||
return !!(str as any)[slotString];
|
return !!(str as any)[slotString];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function renderSlot(result: SSRResult, slotted: string, fallback?: any): Promise<string> {
|
export async function renderSlot(
|
||||||
|
result: SSRResult,
|
||||||
|
slotted: string,
|
||||||
|
fallback?: any
|
||||||
|
): Promise<string> {
|
||||||
if (slotted) {
|
if (slotted) {
|
||||||
result.scope |= ScopeFlags.Slot;
|
result.scope |= ScopeFlags.Slot;
|
||||||
let iterator = renderChild(slotted);
|
let iterator = renderChild(slotted);
|
||||||
|
|
|
@ -132,5 +132,5 @@ export function renderElement(
|
||||||
export const ScopeFlags = {
|
export const ScopeFlags = {
|
||||||
Astro: 1 << 0,
|
Astro: 1 << 0,
|
||||||
JSX: 1 << 1,
|
JSX: 1 << 1,
|
||||||
Slot: 1 << 2
|
Slot: 1 << 2,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue