UNPKG

@netlify/zip-it-and-ship-it

Version:
186 lines (185 loc) 7.43 kB
import type { FunctionRegion } from '@netlify/types'; import { z } from 'zod'; import { FunctionSource } from './function.js'; export declare const functionConfigShape: z.ZodObject<{ background: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; externalNodeModules: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; generator: z.ZodCatch<z.ZodOptional<z.ZodString>>; includedFiles: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; includedFilesBasePath: z.ZodCatch<z.ZodOptional<z.ZodString>>; ignoredNodeModules: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; name: z.ZodCatch<z.ZodOptional<z.ZodString>>; nodeBundler: z.ZodCatch<z.ZodOptional<z.ZodNativeEnum<{ readonly ESBUILD: "esbuild"; readonly ESBUILD_ZISI: "esbuild_zisi"; readonly NFT: "nft"; readonly ZISI: "zisi"; readonly NONE: "none"; }>>>; nodeSourcemap: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; nodeVersion: z.ZodCatch<z.ZodOptional<z.ZodString>>; memory: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, unknown>>; region: z.ZodOptional<z.ZodEffects<z.ZodEnum<[FunctionRegion, ...FunctionRegion[]]>, FunctionRegion, unknown>>; rustTargetDirectory: z.ZodCatch<z.ZodOptional<z.ZodString>>; schedule: z.ZodCatch<z.ZodOptional<z.ZodString>>; timeout: z.ZodCatch<z.ZodOptional<z.ZodNumber>>; vcpu: z.ZodOptional<z.ZodNumber>; zipGo: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; nodeModuleFormat: z.ZodCatch<z.ZodOptional<z.ZodNativeEnum<{ readonly COMMONJS: "cjs"; readonly ESM: "esm"; }>>>; }, "strip", z.ZodTypeAny, { name?: string | undefined; background?: boolean | undefined; externalNodeModules?: string[] | undefined; generator?: string | undefined; includedFiles?: string[] | undefined; includedFilesBasePath?: string | undefined; ignoredNodeModules?: string[] | undefined; nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined; nodeSourcemap?: boolean | undefined; nodeVersion?: string | undefined; memory?: number | undefined; region?: FunctionRegion | undefined; rustTargetDirectory?: string | undefined; schedule?: string | undefined; timeout?: number | undefined; vcpu?: number | undefined; zipGo?: boolean | undefined; nodeModuleFormat?: "cjs" | "esm" | undefined; }, { name?: unknown; background?: unknown; externalNodeModules?: unknown; generator?: unknown; includedFiles?: unknown; includedFilesBasePath?: unknown; ignoredNodeModules?: unknown; nodeBundler?: unknown; nodeSourcemap?: unknown; nodeVersion?: unknown; memory?: unknown; region?: unknown; rustTargetDirectory?: unknown; schedule?: unknown; timeout?: unknown; vcpu?: number | undefined; zipGo?: unknown; nodeModuleFormat?: unknown; }>; export declare const functionConfig: z.ZodEffects<z.ZodObject<{ background: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; externalNodeModules: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; generator: z.ZodCatch<z.ZodOptional<z.ZodString>>; includedFiles: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; includedFilesBasePath: z.ZodCatch<z.ZodOptional<z.ZodString>>; ignoredNodeModules: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>; name: z.ZodCatch<z.ZodOptional<z.ZodString>>; nodeBundler: z.ZodCatch<z.ZodOptional<z.ZodNativeEnum<{ readonly ESBUILD: "esbuild"; readonly ESBUILD_ZISI: "esbuild_zisi"; readonly NFT: "nft"; readonly ZISI: "zisi"; readonly NONE: "none"; }>>>; nodeSourcemap: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; nodeVersion: z.ZodCatch<z.ZodOptional<z.ZodString>>; memory: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, unknown>>; region: z.ZodOptional<z.ZodEffects<z.ZodEnum<[FunctionRegion, ...FunctionRegion[]]>, FunctionRegion, unknown>>; rustTargetDirectory: z.ZodCatch<z.ZodOptional<z.ZodString>>; schedule: z.ZodCatch<z.ZodOptional<z.ZodString>>; timeout: z.ZodCatch<z.ZodOptional<z.ZodNumber>>; vcpu: z.ZodOptional<z.ZodNumber>; zipGo: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>; nodeModuleFormat: z.ZodCatch<z.ZodOptional<z.ZodNativeEnum<{ readonly COMMONJS: "cjs"; readonly ESM: "esm"; }>>>; }, "strip", z.ZodTypeAny, { name?: string | undefined; background?: boolean | undefined; externalNodeModules?: string[] | undefined; generator?: string | undefined; includedFiles?: string[] | undefined; includedFilesBasePath?: string | undefined; ignoredNodeModules?: string[] | undefined; nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined; nodeSourcemap?: boolean | undefined; nodeVersion?: string | undefined; memory?: number | undefined; region?: FunctionRegion | undefined; rustTargetDirectory?: string | undefined; schedule?: string | undefined; timeout?: number | undefined; vcpu?: number | undefined; zipGo?: boolean | undefined; nodeModuleFormat?: "cjs" | "esm" | undefined; }, { name?: unknown; background?: unknown; externalNodeModules?: unknown; generator?: unknown; includedFiles?: unknown; includedFilesBasePath?: unknown; ignoredNodeModules?: unknown; nodeBundler?: unknown; nodeSourcemap?: unknown; nodeVersion?: unknown; memory?: unknown; region?: unknown; rustTargetDirectory?: unknown; schedule?: unknown; timeout?: unknown; vcpu?: number | undefined; zipGo?: unknown; nodeModuleFormat?: unknown; }>, { name?: string | undefined; background?: boolean | undefined; externalNodeModules?: string[] | undefined; generator?: string | undefined; includedFiles?: string[] | undefined; includedFilesBasePath?: string | undefined; ignoredNodeModules?: string[] | undefined; nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined; nodeSourcemap?: boolean | undefined; nodeVersion?: string | undefined; memory?: number | undefined; region?: FunctionRegion | undefined; rustTargetDirectory?: string | undefined; schedule?: string | undefined; timeout?: number | undefined; vcpu?: number | undefined; zipGo?: boolean | undefined; nodeModuleFormat?: "cjs" | "esm" | undefined; }, { name?: unknown; background?: unknown; externalNodeModules?: unknown; generator?: unknown; includedFiles?: unknown; includedFilesBasePath?: unknown; ignoredNodeModules?: unknown; nodeBundler?: unknown; nodeSourcemap?: unknown; nodeVersion?: unknown; memory?: unknown; region?: unknown; rustTargetDirectory?: unknown; schedule?: unknown; timeout?: unknown; vcpu?: number | undefined; zipGo?: unknown; nodeModuleFormat?: unknown; }>; type FunctionConfig = z.infer<typeof functionConfigShape>; type GlobPattern = string; type Config = Record<GlobPattern, FunctionConfig>; type FunctionWithoutConfig = Omit<FunctionSource, 'config'>; declare const getConfigForFunction: ({ config, configFileDirectories, func, }: { config?: Config; configFileDirectories?: string[]; func: FunctionWithoutConfig; }) => Promise<FunctionConfig>; export { Config, FunctionConfig, FunctionWithoutConfig, getConfigForFunction };