From 560a5934186bc57e1975e7d8830e6f29b18c7929 Mon Sep 17 00:00:00 2001 From: Arsh Date: Thu, 29 Feb 2024 18:39:09 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/request.ts | 14 +++++++------- .../astro/src/vite-plugin-astro-server/route.ts | 4 ++-- packages/astro/test/core-image.test.js | 8 ++++---- packages/astro/test/test-adapter.js | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index 13b9de4a5995..85e3f5fb35ae 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -16,9 +16,9 @@ export interface CreateRequestOptions { locals?: object | undefined; /** * Whether the request is being created for a static build or for a prerendered page within a hybrid/SSR build, or for emulating one of those in dev mode. - * + * * When `true`, the request will not include search parameters or body, and warn when headers are accessed. - * + * * @default false */ staticLike?: boolean; @@ -36,19 +36,19 @@ export function createRequest({ body = undefined, logger, locals, - staticLike = false + staticLike = false, }: CreateRequestOptions): Request { // headers are made available on the created request only if the request is for a page that will be on-demand rendered - const headersObj = - staticLike ? undefined : - headers instanceof Headers + const headersObj = staticLike + ? undefined + : headers instanceof Headers ? headers : new Headers(Object.entries(headers as Record)); if (typeof url === 'string') url = new URL(url); const imageEndpoint = prependForwardSlash(appendForwardSlash(base)) + '_image'; - + // HACK! astro:assets uses query params for the injected route in `dev` if (staticLike && url.pathname !== imageEndpoint) { url.search = ''; diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 8a737c2af097..19af22ff6a7e 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -185,7 +185,7 @@ export async function handleRoute({ headers: incomingRequest.headers, logger, // no route found, so we assume the default for rendering the 404 page - staticLike: config.output === "static" || config.output === "hybrid", + staticLike: config.output === 'static' || config.output === 'hybrid', }); route = { component: '', @@ -227,7 +227,7 @@ export async function handleRoute({ body, logger, clientAddress: incomingRequest.socket.remoteAddress, - staticLike: config.output === "static" || route.prerender, + staticLike: config.output === 'static' || route.prerender, }); // Set user specified headers to response object. diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js index 3b240e606b0b..590e77000557 100644 --- a/packages/astro/test/core-image.test.js +++ b/packages/astro/test/core-image.test.js @@ -1061,10 +1061,10 @@ describe('astro:image', () => { }); it('serves the image at /_image', async () => { - const params = new URLSearchParams; - params.set("href", "/src/assets/penguin1.jpg?origWidth=207&origHeight=243&origFormat=jpg"); - params.set("f", "webp"); - const response = await fixture.fetch("/some-base/_image?" + String(params)); + const params = new URLSearchParams(); + params.set('href', '/src/assets/penguin1.jpg?origWidth=207&origHeight=243&origFormat=jpg'); + params.set('f', 'webp'); + const response = await fixture.fetch('/some-base/_image?' + String(params)); assert.equal(response.status, 200); assert.equal(response.headers.get('content-type'), 'image/webp'); }); diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js index ba8e7a0c8fec..72c5e0c0f0c9 100644 --- a/packages/astro/test/test-adapter.js +++ b/packages/astro/test/test-adapter.js @@ -78,7 +78,7 @@ export default function ( serverEntrypoint: '@my-ssr', exports: ['manifest', 'createApp'], supportedAstroFeatures: { - serverOutput: "stable" + serverOutput: 'stable', }, ...extendAdapter, });