From b5b95e4fb4b4531907dab4b8f06a1b9548fc9fac Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 5 May 2022 16:22:41 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/@types/astro.ts | 6 +++--- packages/astro/src/core/app/index.ts | 2 +- packages/astro/src/core/render/core.ts | 6 ++++-- packages/astro/src/core/render/dev/index.ts | 2 +- packages/astro/src/core/render/result.ts | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index f396699d1..854ed875c 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -132,16 +132,16 @@ export interface AstroGlobal extends AstroGlobalPartial { */ request: Request; /** Information about the outgoing response. This is a standard [ResponseInit](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#init) object - * + * * For example, to change the status code you can set a different status on this object: * ```typescript * Astro.response.status = 404; * ``` - * + * * [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroresponse) */ response: ResponseInit & { - readonly headers: Headers + readonly headers: Headers; }; /** Redirect to another page (**SSR Only**) * diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 2d6554380..261d8f385 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -112,7 +112,7 @@ export class App { let headers = init.headers as Headers; let bytes = this.#encoder.encode(html); headers.set('Content-Type', 'text/html'); - headers.set('Content-Length', bytes.byteLength.toString()) + headers.set('Content-Length', bytes.byteLength.toString()); return new Response(bytes, init); } diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index 333e9eec8..48af241da 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -84,7 +84,9 @@ export interface RenderOptions { export async function render( opts: RenderOptions -): Promise<{ type: 'html'; html: string, response: ResponseInit; } | { type: 'response'; response: Response }> { +): Promise< + { type: 'html'; html: string; response: ResponseInit } | { type: 'response'; response: Response } +> { const { links, logging, @@ -162,6 +164,6 @@ export async function render( return { type: 'html', html, - response: result.response + response: result.response, }; } diff --git a/packages/astro/src/core/render/dev/index.ts b/packages/astro/src/core/render/dev/index.ts index 07af9134f..9b8aaf929 100644 --- a/packages/astro/src/core/render/dev/index.ts +++ b/packages/astro/src/core/render/dev/index.ts @@ -45,7 +45,7 @@ export interface SSROptions { export type ComponentPreload = [SSRLoadedRenderer[], ComponentInstance]; export type RenderResponse = - | { type: 'html'; html: string, response: ResponseInit } + | { type: 'html'; html: string; response: ResponseInit } | { type: 'response'; response: Response }; const svelteStylesRE = /svelte\?svelte&type=style/; diff --git a/packages/astro/src/core/render/result.ts b/packages/astro/src/core/render/result.ts index c72d1ae59..d0f7ef1b7 100644 --- a/packages/astro/src/core/render/result.ts +++ b/packages/astro/src/core/render/result.ts @@ -104,7 +104,7 @@ export function createResult(args: CreateResultArgs): SSRResult { const url = new URL(request.url); const canonicalURL = createCanonicalURL('.' + pathname, site ?? url.origin); - const response: ResponseInit = { + const response: ResponseInit = { status: 200, statusText: 'OK', headers: new Headers(), @@ -215,7 +215,7 @@ ${extra}` renderers, pathname, }, - response + response, }; return result;