import { BucketProps, IBucket } from "aws-cdk-lib/aws-s3"; import { BucketDeployment, BucketDeploymentProps } from "aws-cdk-lib/aws-s3-deployment"; import { Construct } from "constructs"; export interface NextjsStaticAssetsOverrides { readonly bucketProps?: BucketProps; readonly bucketDeploymentProps?: BucketDeploymentProps; } export interface NextjsStaticAssetsProps { /** * Bring your own S3 bucket for static assets. When provided, cdk-nextjs * will skip creating a new bucket and deploy assets to this bucket instead. * Use with `basePath` to isolate assets per branch when sharing a bucket. */ readonly bucket?: IBucket; /** * Directory where the Next.js application is located. * This should contain the .next directory and other build artifacts. */ readonly buildDirectory: string; /** * Build ID from NextjsBuild to track asset versions */ readonly buildId: string; /** * Prefix to the URI path the app will be served at. * @example "/my-base-path" */ readonly basePath?: string; readonly overrides?: NextjsStaticAssetsOverrides; } /** * Creates S3 Bucket for public and _next/static assets and deploys them using S3Deployment. */ export declare class NextjsStaticAssets extends Construct { bucket: IBucket; deployment: BucketDeployment; private stagingDir?; private props; constructor(scope: Construct, id: string, props: NextjsStaticAssetsProps); private createBucket; private createDeployment; /** * Create a staging directory with the correct structure: * - public/ files go to root * - .next/static/ files go to _next/static/ */ private createStagingDirectory; /** * Check if a directory exists */ private directoryExists; }