[ci] format

This commit is contained in:
matthewp 2022-03-24 21:09:40 +00:00 committed by GitHub Actions
parent e4025d1f53
commit f5b48bc0ae
13 changed files with 46 additions and 50 deletions

View file

@ -95,8 +95,8 @@ export class App {
status: 200, status: 200,
headers: { headers: {
'Content-Type': 'text/html', 'Content-Type': 'text/html',
'Content-Length': bytes.byteLength.toString() 'Content-Length': bytes.byteLength.toString(),
} },
}); });
} }
@ -126,7 +126,7 @@ export class App {
headers.set('Content-Length', bytes.byteLength.toString()); headers.set('Content-Length', bytes.byteLength.toString());
return new Response(bytes, { return new Response(bytes, {
status: 200, status: 200,
headers headers,
}); });
} }
} }

View file

@ -82,7 +82,6 @@ export function trackPageData(internals: BuildInternals, component: string, page
internals.pagesByViteID.set(viteID(componentURL), pageData); internals.pagesByViteID.set(viteID(componentURL), pageData);
} }
export function* getPageDatasByChunk(internals: BuildInternals, chunk: RenderedChunk): Generator<PageBuildData, void, unknown> { export function* getPageDatasByChunk(internals: BuildInternals, chunk: RenderedChunk): Generator<PageBuildData, void, unknown> {
const pagesByViteID = internals.pagesByViteID; const pagesByViteID = internals.pagesByViteID;
for (const [modulePath] of Object.entries(chunk.modules)) { for (const [modulePath] of Object.entries(chunk.modules)) {

View file

@ -150,8 +150,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
}), }),
...(viteConfig.plugins || []), ...(viteConfig.plugins || []),
// SSR needs to be last // SSR needs to be last
isBuildingToSSR(opts.astroConfig) && isBuildingToSSR(opts.astroConfig) && vitePluginSSR(opts, internals, opts.astroConfig._ctx.adapter!),
vitePluginSSR(opts, internals, opts.astroConfig._ctx.adapter!),
], ],
publicDir: ssr ? false : viteConfig.publicDir, publicDir: ssr ? false : viteConfig.publicDir,
root: viteConfig.root, root: viteConfig.root,

View file

@ -1,4 +1,3 @@
import type { Plugin as VitePlugin } from 'vite'; import type { Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from './internal.js'; import type { BuildInternals } from './internal.js';
import type { StaticBuildOptions } from './types'; import type { StaticBuildOptions } from './types';
@ -42,7 +41,7 @@ export function vitePluginPages(opts: StaticBuildOptions, internals: BuildIntern
for (const renderer of opts.astroConfig._ctx.renderers) { for (const renderer of opts.astroConfig._ctx.renderers) {
const variable = `_renderer${i}`; const variable = `_renderer${i}`;
imports.push(`import ${variable} from '${renderer.serverEntrypoint}';`); imports.push(`import ${variable} from '${renderer.serverEntrypoint}';`);
rendererItems += `Object.assign(${JSON.stringify(renderer)}, { ssr: ${variable} }),` rendererItems += `Object.assign(${JSON.stringify(renderer)}, { ssr: ${variable} }),`;
i++; i++;
} }
@ -53,6 +52,6 @@ export const renderers = [${rendererItems}];`;
return def; return def;
} }
} },
}; };
} }

View file

@ -239,4 +239,3 @@ This file is in BETA. Please test and contribute to the discussion:
</html> </html>
</xsl:template> </xsl:template>
</xsl:stylesheet>`; </xsl:stylesheet>`;

View file

@ -13,7 +13,7 @@ describe('API routes in SSR', () => {
buildOptions: { buildOptions: {
experimentalSsr: true, experimentalSsr: true,
}, },
adapter: testAdapter() adapter: testAdapter(),
}); });
await fixture.build(); await fixture.build();
}); });

View file

@ -91,7 +91,7 @@ export async function loadFixture(inlineConfig) {
const url = new URL('./server/entry.mjs', config.dist); const url = new URL('./server/entry.mjs', config.dist);
const { createApp } = await import(url); const { createApp } = await import(url);
return createApp(); return createApp();
} },
}; };
} }

View file

@ -36,7 +36,7 @@ async function writeWebResponse(res: ServerResponse, webResponse: Response) {
const { status, headers, body } = webResponse; const { status, headers, body } = webResponse;
res.writeHead(status, Object.fromEntries(headers.entries())); res.writeHead(status, Object.fromEntries(headers.entries()));
if (body) { if (body) {
for await(const chunk of (body as unknown as Readable)) { for await (const chunk of body as unknown as Readable) {
res.write(chunk); res.write(chunk);
} }
} }