UNPKG

cdk-nextjs-standalone

Version:

Deploy a NextJS app to AWS using CDK and OpenNext.

54 lines (53 loc) 1.88 kB
import { Function, FunctionOptions } from 'aws-cdk-lib/aws-lambda'; import { Bucket, IBucket } from 'aws-cdk-lib/aws-s3'; import { Construct } from 'constructs'; import { OptionalAssetProps, OptionalFunctionProps, OptionalNextjsBucketDeploymentProps } from './generated-structs'; import { NextjsProps } from './Nextjs'; import { NextjsBuild } from './NextjsBuild'; export interface NextjsServerOverrides { readonly sourceCodeAssetProps?: OptionalAssetProps; readonly destinationCodeAssetProps?: OptionalAssetProps; readonly functionProps?: OptionalFunctionProps; readonly nextjsBucketDeploymentProps?: OptionalNextjsBucketDeploymentProps; } export type EnvironmentVars = Record<string, string>; export interface NextjsServerProps { /** * @see {@link NextjsProps.environment} */ readonly environment?: NextjsProps['environment']; /** * Override function properties. */ readonly lambda?: FunctionOptions; /** * @see {@link NextjsBuild} */ readonly nextBuild: NextjsBuild; /** * Override props for every construct. */ readonly overrides?: NextjsServerOverrides; /** * @see {@link NextjsProps.quiet} */ readonly quiet?: NextjsProps['quiet']; /** * Static asset bucket. Function needs bucket to read from cache. */ readonly staticAssetBucket: IBucket; } /** * Build a lambda function from a NextJS application to handle server-side rendering, API routes, and image optimization. */ export declare class NextjsServer extends Construct { configBucket?: Bucket; lambdaFunction: Function; private props; private get environment(); constructor(scope: Construct, id: string, props: NextjsServerProps); private createSourceCodeAsset; private createDestinationCodeAsset; private createBucketDeployment; private createFunction; }