[ci] format

This commit is contained in:
matthewp 2022-08-15 17:12:41 +00:00 committed by fredkbot
parent b55f76c1ca
commit 5f092230f6
2 changed files with 9 additions and 7 deletions

View file

@ -6,7 +6,12 @@ import { extractDirectives, generateHydrateScript } from '../hydration.js';
import { serializeProps } from '../serialize.js'; import { serializeProps } from '../serialize.js';
import { shorthash } from '../shorthash.js'; import { shorthash } from '../shorthash.js';
import { renderSlot } from './any.js'; import { renderSlot } from './any.js';
import { isAstroComponentFactory, renderAstroComponent, renderTemplate, renderToIterable } from './astro.js'; import {
isAstroComponentFactory,
renderAstroComponent,
renderTemplate,
renderToIterable,
} from './astro.js';
import { Fragment, Renderer } from './common.js'; import { Fragment, Renderer } from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js'; import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js'; import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';

View file

@ -8,7 +8,7 @@ import { renderComponent } from './component.js';
import { maybeRenderHead } from './head.js'; import { maybeRenderHead } from './head.js';
const encoder = new TextEncoder(); const encoder = new TextEncoder();
const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering'); const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering');
type NonAstroPageComponent = { type NonAstroPageComponent = {
name: string; name: string;
@ -16,10 +16,7 @@ type NonAstroPageComponent = {
}; };
function nonAstroPageNeedsHeadInjection(pageComponent: NonAstroPageComponent): boolean { function nonAstroPageNeedsHeadInjection(pageComponent: NonAstroPageComponent): boolean {
return ( return needsHeadRenderingSymbol in pageComponent && !!pageComponent[needsHeadRenderingSymbol];
(needsHeadRenderingSymbol in pageComponent) &&
!!pageComponent[needsHeadRenderingSymbol]
);
} }
export async function renderPage( export async function renderPage(
@ -45,7 +42,7 @@ export async function renderPage(
// This symbol currently exists for md components, but is something that could // This symbol currently exists for md components, but is something that could
// be added for any page-level component that's not an Astro component. // be added for any page-level component that's not an Astro component.
// to signal that head rendering is needed. // to signal that head rendering is needed.
if(nonAstroPageNeedsHeadInjection(componentFactory)) { if (nonAstroPageNeedsHeadInjection(componentFactory)) {
for await (let chunk of maybeRenderHead(result)) { for await (let chunk of maybeRenderHead(result)) {
html += chunk; html += chunk;
} }