0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
lilnasy 2023-08-11 14:11:56 +00:00 committed by astrobot-houston
parent f974c95a27
commit 6fafb3d15d
3 changed files with 15 additions and 11 deletions

View file

@ -1,9 +1,9 @@
interface NetlifyLocals { interface NetlifyLocals {
runtime: { runtime: {
/** /**
* On-demand Builders support an optional time to live (TTL) pattern that allows you to set a fixed duration of time after which a cached builder response is invalidated. This allows you to force a refresh of a builder-generated response without a new deploy. * On-demand Builders support an optional time to live (TTL) pattern that allows you to set a fixed duration of time after which a cached builder response is invalidated. This allows you to force a refresh of a builder-generated response without a new deploy.
* @param ttl time to live, in seconds * @param ttl time to live, in seconds
*/ */
setBuildersTtl(ttl: number): void setBuildersTtl(ttl: number): void;
} };
} }

View file

@ -87,8 +87,12 @@ export const createExports = (manifest: SSRManifest, args: Args) => {
let responseTtl = undefined; let responseTtl = undefined;
locals.runtime = builders locals.runtime = builders
? { setBuildersTtl(ttl: number) { responseTtl = ttl } } ? {
: {} setBuildersTtl(ttl: number) {
responseTtl = ttl;
},
}
: {};
const response: Response = await app.render(request, routeData, locals); const response: Response = await app.render(request, routeData, locals);
const responseHeaders = Object.fromEntries(response.headers.entries()); const responseHeaders = Object.fromEntries(response.headers.entries());

View file

@ -12,7 +12,7 @@ describe('Builders', () => {
output: 'server', output: 'server',
adapter: netlifyAdapter({ adapter: netlifyAdapter({
dist: new URL('./fixtures/builders/dist/', import.meta.url), dist: new URL('./fixtures/builders/dist/', import.meta.url),
builders: true builders: true,
}), }),
site: `http://example.com`, site: `http://example.com`,
integrations: [testIntegration()], integrations: [testIntegration()],