[ci] yarn format

This commit is contained in:
matthewp 2022-02-16 15:13:06 +00:00 committed by GitHub Actions
parent 102161761d
commit b4dcc0f8d3
5 changed files with 21 additions and 21 deletions

View file

@ -7,21 +7,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
export default async function onIdle(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) { export default async function onIdle(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
const cb = async () => { const cb = async () => {
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`); const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
if(roots.length === 0) { if (roots.length === 0) {
throw new Error(`Unable to find the root for the component ${options.name}`); throw new Error(`Unable to find the root for the component ${options.name}`);
} }
let innerHTML: string | null = null; let innerHTML: string | null = null;
let fragment = roots[0].querySelector(`astro-fragment`); let fragment = roots[0].querySelector(`astro-fragment`);
if(fragment == null && roots[0].hasAttribute('tmpl')) { if (fragment == null && roots[0].hasAttribute('tmpl')) {
// If there is no child fragment, check to see if there is a template. // If there is no child fragment, check to see if there is a template.
// This happens if children were passed but the client component did not render any. // This happens if children were passed but the client component did not render any.
let template = roots[0].querySelector(`template[data-astro-template]`); let template = roots[0].querySelector(`template[data-astro-template]`);
if(template) { if (template) {
innerHTML = template.innerHTML; innerHTML = template.innerHTML;
template.remove(); template.remove();
} }
} else if(fragment) { } else if (fragment) {
innerHTML = fragment.innerHTML; innerHTML = fragment.innerHTML;
} }
const hydrate = await getHydrateCallback(); const hydrate = await getHydrateCallback();

View file

@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
*/ */
export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) { export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`); const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
if(roots.length === 0) { if (roots.length === 0) {
throw new Error(`Unable to find the root for the component ${options.name}`); throw new Error(`Unable to find the root for the component ${options.name}`);
} }
let innerHTML: string | null = null; let innerHTML: string | null = null;
let fragment = roots[0].querySelector(`astro-fragment`); let fragment = roots[0].querySelector(`astro-fragment`);
if(fragment == null && roots[0].hasAttribute('tmpl')) { if (fragment == null && roots[0].hasAttribute('tmpl')) {
// If there is no child fragment, check to see if there is a template. // If there is no child fragment, check to see if there is a template.
// This happens if children were passed but the client component did not render any. // This happens if children were passed but the client component did not render any.
let template = roots[0].querySelector(`template[data-astro-template]`); let template = roots[0].querySelector(`template[data-astro-template]`);
if(template) { if (template) {
innerHTML = template.innerHTML; innerHTML = template.innerHTML;
template.remove(); template.remove();
} }
} else if(fragment) { } else if (fragment) {
innerHTML = fragment.innerHTML; innerHTML = fragment.innerHTML;
} }

View file

@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
*/ */
export default async function onMedia(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) { export default async function onMedia(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`); const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
if(roots.length === 0) { if (roots.length === 0) {
throw new Error(`Unable to find the root for the component ${options.name}`); throw new Error(`Unable to find the root for the component ${options.name}`);
} }
let innerHTML: string | null = null; let innerHTML: string | null = null;
let fragment = roots[0].querySelector(`astro-fragment`); let fragment = roots[0].querySelector(`astro-fragment`);
if(fragment == null && roots[0].hasAttribute('tmpl')) { if (fragment == null && roots[0].hasAttribute('tmpl')) {
// If there is no child fragment, check to see if there is a template. // If there is no child fragment, check to see if there is a template.
// This happens if children were passed but the client component did not render any. // This happens if children were passed but the client component did not render any.
let template = roots[0].querySelector(`template[data-astro-template]`); let template = roots[0].querySelector(`template[data-astro-template]`);
if(template) { if (template) {
innerHTML = template.innerHTML; innerHTML = template.innerHTML;
template.remove(); template.remove();
} }
} else if(fragment) { } else if (fragment) {
innerHTML = fragment.innerHTML; innerHTML = fragment.innerHTML;
} }

View file

@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
*/ */
export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) { export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`); const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
if(roots.length === 0) { if (roots.length === 0) {
throw new Error(`Unable to find the root for the component ${options.name}`); throw new Error(`Unable to find the root for the component ${options.name}`);
} }
let innerHTML: string | null = null; let innerHTML: string | null = null;
let fragment = roots[0].querySelector(`astro-fragment`); let fragment = roots[0].querySelector(`astro-fragment`);
if(fragment == null && roots[0].hasAttribute('tmpl')) { if (fragment == null && roots[0].hasAttribute('tmpl')) {
// If there is no child fragment, check to see if there is a template. // If there is no child fragment, check to see if there is a template.
// This happens if children were passed but the client component did not render any. // This happens if children were passed but the client component did not render any.
let template = roots[0].querySelector(`template[data-astro-template]`); let template = roots[0].querySelector(`template[data-astro-template]`);
if(template) { if (template) {
innerHTML = template.innerHTML; innerHTML = template.innerHTML;
template.remove(); template.remove();
} }
} else if(fragment) { } else if (fragment) {
innerHTML = fragment.innerHTML; innerHTML = fragment.innerHTML;
} }
const hydrate = await getHydrateCallback(); const hydrate = await getHydrateCallback();

View file

@ -7,21 +7,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
*/ */
export default async function onVisible(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) { export default async function onVisible(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`); const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
if(roots.length === 0) { if (roots.length === 0) {
throw new Error(`Unable to find the root for the component ${options.name}`); throw new Error(`Unable to find the root for the component ${options.name}`);
} }
let innerHTML: string | null = null; let innerHTML: string | null = null;
let fragment = roots[0].querySelector(`astro-fragment`); let fragment = roots[0].querySelector(`astro-fragment`);
if(fragment == null && roots[0].hasAttribute('tmpl')) { if (fragment == null && roots[0].hasAttribute('tmpl')) {
// If there is no child fragment, check to see if there is a template. // If there is no child fragment, check to see if there is a template.
// This happens if children were passed but the client component did not render any. // This happens if children were passed but the client component did not render any.
let template = roots[0].querySelector(`template[data-astro-template]`); let template = roots[0].querySelector(`template[data-astro-template]`);
if(template) { if (template) {
innerHTML = template.innerHTML; innerHTML = template.innerHTML;
template.remove(); template.remove();
} }
} else if(fragment) { } else if (fragment) {
innerHTML = fragment.innerHTML; innerHTML = fragment.innerHTML;
} }