From f5b48bc0ae4b06da51c1bde0a00dea2eb6e48167 Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 24 Mar 2022 21:09:40 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/app/index.ts | 14 ++++----- packages/astro/src/core/build/generate.ts | 6 ++-- packages/astro/src/core/build/internal.ts | 29 +++++++++---------- packages/astro/src/core/build/static-build.ts | 3 +- .../core/build/vite-plugin-hoisted-scripts.ts | 2 +- .../astro/src/core/build/vite-plugin-pages.ts | 15 +++++----- .../astro/src/core/build/vite-plugin-ssr.ts | 12 ++++---- packages/astro/src/core/util.ts | 1 - .../astro/src/vite-plugin-build-css/index.ts | 4 +-- packages/astro/test/ssr-api-route.test.js | 2 +- packages/astro/test/test-adapter.js | 2 +- packages/astro/test/test-utils.js | 4 +-- packages/integrations/node/src/server.ts | 2 +- 13 files changed, 46 insertions(+), 50 deletions(-) diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 050802ee0..404492398 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -43,9 +43,9 @@ export class App { const mod = this.#manifest.pageMap.get(routeData.component)!; - if(routeData.type === 'page') { + if (routeData.type === 'page') { return this.#renderPage(request, routeData, mod); - } else if(routeData.type === 'endpoint') { + } else if (routeData.type === 'endpoint') { return this.#callEndpoint(request, routeData, mod); } else { throw new Error(`Unsupported route type [${routeData.type}].`); @@ -95,8 +95,8 @@ export class App { status: 200, headers: { 'Content-Type': 'text/html', - 'Content-Length': bytes.byteLength.toString() - } + 'Content-Length': bytes.byteLength.toString(), + }, }); } @@ -113,20 +113,20 @@ export class App { ssr: true, }); - if(result.type === 'response') { + if (result.type === 'response') { return result.response; } else { const body = result.body; const headers = new Headers(); const mimeType = mime.getType(url.pathname); - if(mimeType) { + if (mimeType) { headers.set('Content-Type', mimeType); } const bytes = this.#encoder.encode(body); headers.set('Content-Length', bytes.byteLength.toString()); return new Response(bytes, { status: 200, - headers + headers, }); } } diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index cbd5b3c2b..b4e77a9e0 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -74,7 +74,7 @@ export async function generatePages(result: RollupOutput, opts: StaticBuildOptio const ssrEntryURL = new URL(`./entry.mjs?time=${Date.now()}`, outFolder); const ssrEntry = await import(ssrEntryURL.toString()); - for(const pageData of eachPageData(internals)) { + for (const pageData of eachPageData(internals)) { await generatePage(opts, internals, pageData, ssrEntry); } } @@ -86,7 +86,7 @@ async function generatePage( pageData: PageBuildData, ssrEntry: SingleFileBuiltModule ) { - let timeStart = performance.now(); + let timeStart = performance.now(); const renderers = ssrEntry.renderers; const pageInfo = getPageDataByComponent(internals, pageData.route.component); @@ -95,7 +95,7 @@ async function generatePage( const pageModule = ssrEntry.pageMap.get(pageData.component); - if(!pageModule) { + if (!pageModule) { throw new Error(`Unable to find the module for ${pageData.component}. This is unexpected and likely a bug in Astro, please report.`); } diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index 62186f678..c436b9c5c 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -32,15 +32,15 @@ export interface BuildInternals { chunkToReferenceIdMap: Map; /** - * This is a mapping of pathname to the string source of all collected inline