mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
[ci] format
This commit is contained in:
parent
56bd88ae75
commit
efbe8fbd5b
3 changed files with 32 additions and 28 deletions
|
@ -120,7 +120,6 @@ export default function vercelServerless({
|
|||
edgeMiddleware = false,
|
||||
maxDuration,
|
||||
}: VercelServerlessConfig = {}): AstroIntegration {
|
||||
|
||||
if (maxDuration) {
|
||||
if (typeof maxDuration !== 'number') {
|
||||
throw new TypeError(`maxDuration must be a number`, { cause: maxDuration });
|
||||
|
@ -143,10 +142,13 @@ export default function vercelServerless({
|
|||
name: PACKAGE_NAME,
|
||||
hooks: {
|
||||
'astro:config:setup': async ({ command, config, updateConfig, injectScript, logger }) => {
|
||||
|
||||
if (maxDuration && maxDuration > 900) {
|
||||
logger.warn(`maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`)
|
||||
logger.warn(`Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`)
|
||||
logger.warn(
|
||||
`maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`
|
||||
);
|
||||
logger.warn(
|
||||
`Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`
|
||||
);
|
||||
}
|
||||
|
||||
if (webAnalytics?.enabled || analytics) {
|
||||
|
@ -272,7 +274,7 @@ You can set functionPerRoute: false to prevent surpassing the limit.`
|
|||
NTF_CACHE,
|
||||
includeFiles: filesToInclude,
|
||||
excludeFiles,
|
||||
maxDuration
|
||||
maxDuration,
|
||||
});
|
||||
routeDefinitions.push({
|
||||
src: route.pattern.source,
|
||||
|
@ -288,7 +290,7 @@ You can set functionPerRoute: false to prevent surpassing the limit.`
|
|||
NTF_CACHE,
|
||||
includeFiles: filesToInclude,
|
||||
excludeFiles,
|
||||
maxDuration
|
||||
maxDuration,
|
||||
});
|
||||
routeDefinitions.push({ src: '/.*', dest: 'render' });
|
||||
}
|
||||
|
@ -331,14 +333,14 @@ You can set functionPerRoute: false to prevent surpassing the limit.`
|
|||
}
|
||||
|
||||
interface CreateFunctionFolderArgs {
|
||||
functionName: string
|
||||
entry: URL
|
||||
config: AstroConfig
|
||||
logger: AstroIntegrationLogger
|
||||
NTF_CACHE: any
|
||||
includeFiles: URL[]
|
||||
excludeFiles?: string[]
|
||||
maxDuration?: number
|
||||
functionName: string;
|
||||
entry: URL;
|
||||
config: AstroConfig;
|
||||
logger: AstroIntegrationLogger;
|
||||
NTF_CACHE: any;
|
||||
includeFiles: URL[];
|
||||
excludeFiles?: string[];
|
||||
maxDuration?: number;
|
||||
}
|
||||
|
||||
async function createFunctionFolder({
|
||||
|
|
|
@ -13,7 +13,9 @@ describe('maxDuration', () => {
|
|||
});
|
||||
|
||||
it('makes it to vercel function configuration', async () => {
|
||||
const vcConfig = JSON.parse(await fixture.readFile('../.vercel/output/functions/render.func/.vc-config.json'));
|
||||
const vcConfig = JSON.parse(
|
||||
await fixture.readFile('../.vercel/output/functions/render.func/.vc-config.json')
|
||||
);
|
||||
expect(vcConfig).to.deep.include({ maxDuration: 60 });
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue