import type { ArgumentPlaceholder, Expression, SpreadElement, JSXNamespacedName } from '@babel/types'; import { z } from 'zod'; import { FunctionConfig } from '../../../config.js'; import { InvocationMode } from '../../../function.js'; import { ExtendedRoute, Route } from '../../../utils/routes.js'; import type { ModuleFormat } from '../utils/module_format.js'; export declare const IN_SOURCE_CONFIG_MODULE = "@netlify/functions"; export interface StaticAnalysisResult { config: InSourceConfig; eventSubscriptions?: string[]; excludedRoutes?: Route[]; inputModuleFormat?: ModuleFormat; invocationMode?: InvocationMode; routes?: ExtendedRoute[]; runtimeAPIVersion?: number; } interface FindISCDeclarationsOptions { functionName: string; isServer?: boolean; } export declare const inSourceConfig: z.ZodObject<{ name: z.ZodCatch>; background: z.ZodCatch>; externalNodeModules: z.ZodCatch>>; generator: z.ZodCatch>; includedFiles: z.ZodCatch>>; ignoredNodeModules: z.ZodCatch>>; nodeBundler: z.ZodCatch>>; nodeVersion: z.ZodCatch>; memory: z.ZodOptional>; region: z.ZodOptional>>; schedule: z.ZodCatch>; timeout: z.ZodCatch>; vcpu: z.ZodOptional; method: z.ZodOptional>, z.ZodArray>>]>, z.ZodTransform<("GET" | "POST" | "PUT" | "PATCH" | "OPTIONS" | "DELETE" | "HEAD")[], "GET" | "POST" | "PUT" | "PATCH" | "OPTIONS" | "DELETE" | "HEAD" | ("GET" | "POST" | "PUT" | "PATCH" | "OPTIONS" | "DELETE" | "HEAD")[]>>>; path: z.ZodOptional]>, z.ZodTransform>>; excludedPath: z.ZodOptional]>, z.ZodTransform>>; preferStatic: z.ZodCatch>; rateLimit: z.ZodCatch>; aggregateBy: z.ZodOptional, z.ZodArray>]>>; algorithm: z.ZodOptional>; windowLimit: z.ZodNumber; windowSize: z.ZodNumber; to: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>; export type InSourceConfig = z.infer; export declare const serverConfig: z.ZodObject<{ excludedPath: z.ZodOptional]>, z.ZodTransform>>; includedFiles: z.ZodOptional>; path: z.ZodOptional]>, z.ZodTransform>>; region: z.ZodOptional>>; scale: z.ZodOptional; max: z.ZodOptional; }, z.core.$strict>>; size: z.ZodOptional>>; }, z.core.$strict>; export type ServerConfig = z.infer; /** * Loads a file at a given path, parses it into an AST, and returns a series of * data points, such as in-source configuration properties and other metadata. */ export declare const parseFile: (sourcePath: string, { functionName, isServer }: FindISCDeclarationsOptions) => Promise; /** * Takes a JS/TS source as a string, parses it into an AST, and returns a * series of data points, such as in-source configuration properties and * other metadata. */ export declare const parseSource: (source: string, { functionName, isServer }: FindISCDeclarationsOptions) => StaticAnalysisResult; export declare const augmentFunctionConfig: (mainFile: string, tomlConfig: FunctionConfig, inSourceConfig?: InSourceConfig) => { background?: boolean | undefined; externalNodeModules?: string[] | undefined; generator?: string | undefined; includedFiles?: string[] | undefined; includedFilesBasePath?: string | undefined; ignoredNodeModules?: string[] | undefined; name?: string | undefined; nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined; nodeSourcemap?: boolean | undefined; nodeVersion?: string | undefined; memory?: number | undefined; region?: "cmh" | "dub" | "fra" | "gru" | "iad" | "lhr" | "nrt" | "pdx" | "sfo" | "sin" | "syd" | "yul" | undefined; rustTargetDirectory?: string | undefined; schedule?: string | undefined; timeout?: number | undefined; vcpu?: number | undefined; zipGo?: boolean | undefined; nodeModuleFormat?: "cjs" | "esm" | undefined; } & { name?: string | undefined; background?: boolean | undefined; externalNodeModules?: string[] | undefined; generator?: string | undefined; includedFiles?: string[] | undefined; ignoredNodeModules?: string[] | undefined; nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined; nodeVersion?: string | undefined; memory?: number | undefined; region?: "cmh" | "dub" | "fra" | "gru" | "iad" | "lhr" | "nrt" | "pdx" | "sfo" | "sin" | "syd" | "yul" | undefined; schedule?: string | undefined; timeout?: number | undefined; vcpu?: number | undefined; method?: ("GET" | "POST" | "PUT" | "PATCH" | "OPTIONS" | "DELETE" | "HEAD")[] | undefined; path?: string[] | undefined; excludedPath?: string[] | undefined; preferStatic?: boolean | undefined; rateLimit?: { windowLimit: number; windowSize: number; action?: "rate_limit" | "rewrite" | undefined; aggregateBy?: "domain" | "ip" | ("domain" | "ip")[] | undefined; algorithm?: "sliding_window" | undefined; to?: string | undefined; } | undefined; }; export type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName; export type ISCExportWithCallExpression = { type: 'call-expression'; args: ISCHandlerArg[]; local: string; }; export type ISCExportWithObject = { type: 'object-expression'; object: Record; }; export type ISCExportOther = { type: 'other'; }; export type ISCDefaultExport = { type: 'default'; }; export type ISCExport = ISCExportWithCallExpression | ISCExportWithObject | ISCExportOther | ISCDefaultExport; export {};