cdkesbuild

package module
v3.14.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 13 Imported by: 0

README

cdk-esbuild

CDK constructs for esbuild, an extremely fast JavaScript bundler

Getting started | Documentation | API Reference | Upgrading from AWS CDK v1

View on Construct Hub

Why?

esbuild is an extremely fast bundler and minifier for Typescript and JavaScript. This package makes esbuild available to deploy lambda functions, static websites or to publish build artefacts (assets) for further use.

AWS CDK supports esbuild with Lambda Functions. However the implementation cannot be used with any other Constructs and doesn't expose all of esbuild's build interface.

This package is running esbuild directly in Node.js and bypasses Docker which the AWS CDK implementation uses. The approach is quicker and easier to use for Node.js users, but incompatible with other languages.

Production readiness

This package is stable and ready to be used in production, as many do. However esbuild has not yet released a version 1.0.0 and its API is still in active development. Please read the guide on esbuild's production readiness.

Notably upgrades of the esbuild minimum version requirement will be introduced in minor versions of this package and will inherit breaking changes from esbuild.

Getting started

Install cdk-esbuild:

npm install @mrgrain/cdk-esbuild@3

If peer or optional dependencies are not installed automatically (e.g. when using npm v4-6), please use this command to install all of them:

npm install @mrgrain/cdk-esbuild@3 esbuild

AWS Lambda: Serverless function

💡 See Lambda Function for a complete working example of a how to deploy a lambda function.

Use TypeScriptCode as the code of a lambda function:

import * as lambda from "aws-cdk-lib/aws-lambda";
import { TypeScriptCode } from "@mrgrain/cdk-esbuild";

const bundledCode = new TypeScriptCode("src/index.ts");

const fn = new lambda.Function(stack, "MyFunction", {
  runtime: lambda.Runtime.NODEJS_16_X,
  handler: "index.handler",
  code: bundledCode,
});

AWS S3: Static Website

💡 See Static Website with React for a complete working example of a how to deploy a React app to S3.

Use TypeScriptSource as one of the sources of a static website deployment:

import * as s3 from "aws-cdk-lib/aws-s3";
import * as s3deploy from "aws-cdk-lib/aws-s3-deployment";
import { TypeScriptSource } from "@mrgrain/cdk-esbuild";

const websiteBundle = new TypeScriptSource("src/index.tsx");

const websiteBucket = new s3.Bucket(stack, "WebsiteBucket", {
  autoDeleteObjects: true,
  publicReadAccess: true,
  removalPolicy: RemovalPolicy.DESTROY,
  websiteIndexDocument: "index.html",
});

new s3deploy.BucketDeployment(stack, "DeployWebsite", {
  destinationBucket: websiteBucket,
  sources: [websiteBundle],
});

Amazon CloudWatch Synthetics: Canary monitoring

💡 See Monitored Website for a complete working example of a deployed and monitored website.

Synthetics runs a canary to produce traffic to an application for monitoring purposes. Use TypeScriptCode as the code of a Canary test:

ℹ️ This feature depends on the @aws-cdk/aws-synthetics-alpha package which is a developer preview. You may need to update your source code when upgrading to a newer version of this package.

npm i @aws-cdk/aws-synthetics-alpha
import * as synthetics from "@aws-cdk/aws-synthetics-alpha";
import { TypeScriptCode } from "@mrgrain/cdk-esbuild";

const bundledCode = new TypeScriptCode("src/index.ts", {
  buildOptions: {
    outdir: "nodejs/node_modules", // This is required by Synthetics
  },
});

const canary = new synthetics.Canary(stack, "MyCanary", {
  runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_2,
  test: synthetics.Test.custom({
    code: bundledCode,
    handler: "index.handler",
  });
});

Documentation

The package exports various different constructs for use with existing CDK features. A major guiding design principal for this package is to extend, don't replace. Expect constructs that you can provide as props, not complete replacements.

For use in Lambda Functions and Synthetic Canaries, the following classes implement lambda.Code (reference) and synthetics.Code (reference):

  • TypeScriptCode & JavaScriptCode

Inline code is only supported by Lambda:

  • InlineTypeScriptCode & InlineJavaScriptCode
  • InlineTsxCode & InlineJsxCode

For use with S3 bucket deployments, classes implementing s3deploy.ISource (reference):

  • TypeScriptSource & JavaScriptSource

Code and Source constructs seamlessly plug-in to other high-level CDK constructs. They share the same set of parameters, props and build options.

The following classes power the other features. You normally won't have to use them, but they are there if you need them:

  • TypeScriptAsset & JavaScriptAsset implements s3.Asset (reference)
    creates an asset uploaded to S3 which can be referenced by other constructs
  • EsbuildBundler implements core.BundlingOptions (reference)
    provides an interface for a esbuild bundler wherever needed

API Reference

Auto-generated reference for classes and structs. This information is also available as part of your IDE's code completion.

Escape hatches

It's possible that you want to use an implementation of esbuild that's different to the default one. Common reasons are:

  • The current version constraints for esbuild are not suitable
  • To use a version of esbuild that is installed by any other means than npm, including Docker
  • Plugin support is needed for building

For these situations, this package offers an escape hatch to bypass regular the implementation and provide a custom build and transform function.

Esbuild binary path

It is possible to override the binary used by esbuild. The usual way to do this is to set the ESBUILD_BINARY_PATH environment variable. For convenience this package allows to set the binary path as a prop:

new TypeScriptCode("fixtures/handlers/ts-handler.ts", {
  esbuildBinaryPath: "path/to/esbuild/binary"
});
Custom build function

💡 See Using esbuild with plugins for a complete working example of a custom build function using this escape hatch.

Constructs that result in starting a build, take a buildFn as optional prop. While the defined type for this function is any, it must implement the same signature as esbuild's buildSync function.

new TypeScriptCode("fixtures/handlers/ts-handler.ts", {
  buildFn: (options: BuildOptions): BuildResult => {
    try {
      // custom implementation returning BuildResult
    } catch (error) {
      // throw BuildFailure exception here
    }
  },
});

Instead of esbuild, the provided function will be invoked with the calculated build options. The custom build function can amend, change or discard any of these. However integration with CDK relies heavily on the values outdir/outfile are set to and it's usually required to use them unchanged.

Failures have to cause a BuildFailure exception in order to be fully handled.

Custom transform function

Constructs that result in starting a transformation, take a transformFn as optional prop. While the defined type for this function is any, it must implement the same signature as esbuild's transformSync function.

new InlineTypeScriptCode("let x: number = 1", {
  transformFn: (options: TransformOptions): TransformResult => {
    try {
      // custom implementation returning TransformResult
    } catch (error) {
      // throw TransformFailure exception here
    }
  },,
});

Instead of esbuild, the provided function will be invoked with the calculated transform options. The custom transform function can amend, change or discard any of these.

Failures have to cause a TransformFailure exception in order to be fully handled.

Upgrading from AWS CDK v1

This version is compatible with AWS CDK v2. For the previous, AWS CDK v1 compatible release, see cdk-esbuild@v2.

To upgrade from AWS CDK v1 and cdk-esbuild@v2, please follow these steps:

  • This version requires AWS CDK v2. Follow the official migration guide to upgrade.

  • Update the package dependency to v3: npm install --save @mrgrain/cdk-esbuild@^3.0.0

  • esbuild is installed as an optional dependency. If your setup does not automatically install optional dependencies, make sure to add it as an explicit dependency.

  • Any use of InlineCode variations has to be updated. Previously the second parameter was either of type TransformerProps or TransformOptions. Now it must be TransformerProps.
    If the passed value is of type TransformOptions, turn it into the correct type like this:

    const oldOptions: TransformOptions = {...}
    
    new InlineTypeScriptCode('// inline code', {
      transformOptions: oldOptions
    });
    

Versioning

This package follows Semantic Versioning, with the exception of upgrades to esbuild. These will be released as minor versions and often include breaking changes from esbuild.

Npm Tags

Some users prefer to use tags over version ranges. The following stable tags are available for use:

  • cdk-v1, cdk-v2 are provided for the latest release compatible with each version of the AWS CDK.
  • latest is the most recent stable release.

These tags also exist, but usage is strongly not recommended:

  • unstable, next are used for pre-release of the current and next major version respectively.
  • cdk-1.x.x tags have been deprecated in favour of cdk-v1. Use that one instead.

Roadmap & Contributions

The project's roadmap is available on GitHub. Please submit any feature requests as issues to the repository.

All contributions are welcome, no matter if they are for already planned or completely new features.

Library authors

Building a library consumed by other packages that relies on cdk-esbuild might require you to set buildOptions.absWorkingDir. The easiest way to do this, is to resolve based on the directory name of the calling file, and traverse the tree upwards to the root of your library package (that's where package.json and tsconfig.json are):

// file: project/src/index.ts
const props = {
  buildOptions: {
    absWorkingDir: path.resolve(__dirname, ".."), // now: /user/project
  },
};

This will dynamically resolve to the correct path, wherever the package is installed.

Please open an issue if you encounter any difficulties.

Documentation

Overview

CDK constructs for esbuild, an extremely fast JavaScript bundler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EsbuildAsset_IsConstruct

func EsbuildAsset_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func EsbuildCode_FromAsset

func EsbuildCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path. Experimental.

func EsbuildCode_FromAssetImage

func EsbuildCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.

func EsbuildCode_FromBucket

func EsbuildCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object. Experimental.

func EsbuildCode_FromCfnParameters

func EsbuildCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`. Experimental.

func EsbuildCode_FromDockerBuild

func EsbuildCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image. Experimental.

func EsbuildCode_FromEcrImage

func EsbuildCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code. Experimental.

func EsbuildCode_FromInline

func EsbuildCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code. Experimental.

func EsbuildSource_Anywhere

func EsbuildSource_Anywhere() *string

func EsbuildSource_Auto

func EsbuildSource_Auto() *string

func EsbuildSource_Default

func EsbuildSource_Default() *string

func EsbuildSource_GlobalPaths

func EsbuildSource_GlobalPaths() *string

func EsbuildSource_Install

func EsbuildSource_Install() *string

func EsbuildSource_NodeJs

func EsbuildSource_NodeJs() *string

func EsbuildSource_PlatformDefault

func EsbuildSource_PlatformDefault() *string

func EsbuildSource_SetDefault

func EsbuildSource_SetDefault(val *string)

func InlineJavaScriptCode_FromAsset

func InlineJavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path. Experimental.

func InlineJavaScriptCode_FromAssetImage

func InlineJavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.

func InlineJavaScriptCode_FromBucket

func InlineJavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object. Experimental.

func InlineJavaScriptCode_FromCfnParameters

func InlineJavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`. Experimental.

func InlineJavaScriptCode_FromDockerBuild

func InlineJavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image. Experimental.

func InlineJavaScriptCode_FromEcrImage

func InlineJavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code. Experimental.

func InlineJavaScriptCode_FromInline

func InlineJavaScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code. Experimental.

func InlineJsxCode_FromAsset

func InlineJsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path. Experimental.

func InlineJsxCode_FromAssetImage

func InlineJsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.

func InlineJsxCode_FromBucket

func InlineJsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object. Experimental.

func InlineJsxCode_FromCfnParameters

func InlineJsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`. Experimental.

func InlineJsxCode_FromDockerBuild

func InlineJsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image. Experimental.

func InlineJsxCode_FromEcrImage

func InlineJsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code. Experimental.

func InlineJsxCode_FromInline

func InlineJsxCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code. Experimental.

func InlineTsxCode_FromAsset

func InlineTsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path. Experimental.

func InlineTsxCode_FromAssetImage

func InlineTsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.

func InlineTsxCode_FromBucket

func InlineTsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object. Experimental.

func InlineTsxCode_FromCfnParameters

func InlineTsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`. Experimental.

func InlineTsxCode_FromDockerBuild

func InlineTsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image. Experimental.

func InlineTsxCode_FromEcrImage

func InlineTsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code. Experimental.

func InlineTsxCode_FromInline

func InlineTsxCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code. Experimental.

func InlineTypeScriptCode_FromAsset

func InlineTypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path. Experimental.

func InlineTypeScriptCode_FromAssetImage

func InlineTypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.

func InlineTypeScriptCode_FromBucket

func InlineTypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object. Experimental.

func InlineTypeScriptCode_FromCfnParameters

func InlineTypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`. Experimental.

func InlineTypeScriptCode_FromDockerBuild

func InlineTypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image. Experimental.

func InlineTypeScriptCode_FromEcrImage

func InlineTypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code. Experimental.

func InlineTypeScriptCode_FromInline

func InlineTypeScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code. Experimental.

func JavaScriptAsset_IsConstruct

func JavaScriptAsset_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func JavaScriptCode_FromAsset

func JavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path.

func JavaScriptCode_FromAssetImage

func JavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code.

func JavaScriptCode_FromBucket

func JavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object.

func JavaScriptCode_FromCfnParameters

func JavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`.

func JavaScriptCode_FromDockerBuild

func JavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image.

func JavaScriptCode_FromEcrImage

func JavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code.

func JavaScriptCode_FromInline

func JavaScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code.

func NewEsbuildAsset_Override

func NewEsbuildAsset_Override(e EsbuildAsset, scope constructs.Construct, id *string, props *AssetProps)

Experimental.

func NewEsbuildBundler_Override

func NewEsbuildBundler_Override(e EsbuildBundler, entryPoints interface{}, props *BundlerProps)

Experimental.

func NewEsbuildCode_Override

func NewEsbuildCode_Override(e EsbuildCode, entryPoints interface{}, props interface{})

Experimental.

func NewEsbuildSource_Override

func NewEsbuildSource_Override(e EsbuildSource)

func NewInlineJavaScriptCode_Override

func NewInlineJavaScriptCode_Override(i InlineJavaScriptCode, code *string, props interface{})

Experimental.

func NewInlineJsxCode_Override

func NewInlineJsxCode_Override(i InlineJsxCode, code *string, props interface{})

Experimental.

func NewInlineTsxCode_Override

func NewInlineTsxCode_Override(i InlineTsxCode, code *string, props interface{})

Experimental.

func NewInlineTypeScriptCode_Override

func NewInlineTypeScriptCode_Override(i InlineTypeScriptCode, code *string, props interface{})

Experimental.

func NewJavaScriptAsset_Override

func NewJavaScriptAsset_Override(j JavaScriptAsset, scope constructs.Construct, id *string, props *AssetProps)

func NewJavaScriptCode_Override

func NewJavaScriptCode_Override(j JavaScriptCode, entryPoints interface{}, props *JavaScriptCodeProps)

func NewJavaScriptSource_Override

func NewJavaScriptSource_Override(j JavaScriptSource, entryPoints interface{}, props *JavaScriptSourceProps)

func NewTypeScriptAsset_Override

func NewTypeScriptAsset_Override(t TypeScriptAsset, scope constructs.Construct, id *string, props *AssetProps)

func NewTypeScriptCode_Override

func NewTypeScriptCode_Override(t TypeScriptCode, entryPoints interface{}, props *TypeScriptCodeProps)

func NewTypeScriptSource_Override

func NewTypeScriptSource_Override(t TypeScriptSource, entryPoints interface{}, props *TypeScriptSourceProps)

func TypeScriptAsset_IsConstruct

func TypeScriptAsset_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func TypeScriptCode_FromAsset

func TypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode

Loads the function code from a local disk path.

func TypeScriptCode_FromAssetImage

func TypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode

Create an ECR image from the specified asset and bind it as the Lambda code.

func TypeScriptCode_FromBucket

func TypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code

Lambda handler code as an S3 object.

func TypeScriptCode_FromCfnParameters

func TypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode

Creates a new Lambda source defined using CloudFormation parameters.

Returns: a new instance of `CfnParametersCode`.

func TypeScriptCode_FromDockerBuild

func TypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode

Loads the function code from an asset created by a Docker build.

By default, the asset is expected to be located at `/asset` in the image.

func TypeScriptCode_FromEcrImage

func TypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode

Use an existing ECR image as the Lambda code.

func TypeScriptCode_FromInline

func TypeScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code.

Types

type AssetProps

type AssetProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// A path or list or map of paths to the entry points of your code.
	//
	// Relative paths are by default resolved from the current working directory.
	// To change the working directory, see `buildOptions.absWorkingDir`.
	//
	// Absolute paths can be used if files are part of the working directory.
	//
	// Examples:
	//   - `'src/index.ts'`
	//   - `require.resolve('./lambda')`
	//   - `['src/index.ts', 'src/util.ts']`
	//   - `{one: 'src/two.ts', two: 'src/one.ts'}`
	EntryPoints interface{} `field:"required" json:"entryPoints" yaml:"entryPoints"`
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
	//
	// Defaults to a hash of all files in the resulting bundle.
	AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
}

type BuildOptions

type BuildOptions struct {
	// Documentation: https://esbuild.github.io/api/#working-directory.
	AbsWorkingDir *string `field:"optional" json:"absWorkingDir" yaml:"absWorkingDir"`
	// Documentation: https://esbuild.github.io/api/#alias.
	Alias *map[string]*string `field:"optional" json:"alias" yaml:"alias"`
	// Documentation: https://esbuild.github.io/api/#allow-overwrite.
	AllowOverwrite *bool `field:"optional" json:"allowOverwrite" yaml:"allowOverwrite"`
	// Documentation: https://esbuild.github.io/api/#asset-names.
	AssetNames *string `field:"optional" json:"assetNames" yaml:"assetNames"`
	// Documentation: https://esbuild.github.io/api/#banner.
	Banner *map[string]*string `field:"optional" json:"banner" yaml:"banner"`
	// Documentation: https://esbuild.github.io/api/#bundle.
	Bundle *bool `field:"optional" json:"bundle" yaml:"bundle"`
	// Documentation: https://esbuild.github.io/api/#charset.
	Charset *string `field:"optional" json:"charset" yaml:"charset"`
	// Documentation: https://esbuild.github.io/api/#chunk-names.
	ChunkNames *string `field:"optional" json:"chunkNames" yaml:"chunkNames"`
	// Documentation: https://esbuild.github.io/api/#color.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Documentation: https://esbuild.github.io/api/#conditions.
	Conditions *[]*string `field:"optional" json:"conditions" yaml:"conditions"`
	// Documentation: https://esbuild.github.io/api/#define.
	Define *map[string]*string `field:"optional" json:"define" yaml:"define"`
	// Documentation: https://esbuild.github.io/api/#drop.
	Drop *[]*string `field:"optional" json:"drop" yaml:"drop"`
	// Documentation: https://esbuild.github.io/api/#entry-names.
	EntryNames *string `field:"optional" json:"entryNames" yaml:"entryNames"`
	// Documentation: https://esbuild.github.io/api/#external.
	External *[]*string `field:"optional" json:"external" yaml:"external"`
	// Documentation: https://esbuild.github.io/api/#footer.
	Footer *map[string]*string `field:"optional" json:"footer" yaml:"footer"`
	// Documentation: https://esbuild.github.io/api/#format.
	Format *string `field:"optional" json:"format" yaml:"format"`
	// Documentation: https://esbuild.github.io/api/#global-name.
	GlobalName *string `field:"optional" json:"globalName" yaml:"globalName"`
	// Documentation: https://esbuild.github.io/api/#ignore-annotations.
	IgnoreAnnotations *bool `field:"optional" json:"ignoreAnnotations" yaml:"ignoreAnnotations"`
	// Documentation: https://esbuild.github.io/api/#inject.
	Inject *[]*string `field:"optional" json:"inject" yaml:"inject"`
	// Documentation: https://esbuild.github.io/api/#jsx.
	Jsx *string `field:"optional" json:"jsx" yaml:"jsx"`
	// Documentation: https://esbuild.github.io/api/#jsx-development.
	JsxDev *bool `field:"optional" json:"jsxDev" yaml:"jsxDev"`
	// Documentation: https://esbuild.github.io/api/#jsx-factory.
	JsxFactory *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"`
	// Documentation: https://esbuild.github.io/api/#jsx-fragment.
	JsxFragment *string `field:"optional" json:"jsxFragment" yaml:"jsxFragment"`
	// Documentation: https://esbuild.github.io/api/#jsx-import-source.
	JsxImportSource *string `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"`
	// Documentation: https://esbuild.github.io/api/#jsx-side-effects.
	JsxSideEffects *bool `field:"optional" json:"jsxSideEffects" yaml:"jsxSideEffects"`
	// Documentation: https://esbuild.github.io/api/#keep-names.
	KeepNames *bool `field:"optional" json:"keepNames" yaml:"keepNames"`
	// Documentation: https://esbuild.github.io/api/#legal-comments.
	LegalComments *string `field:"optional" json:"legalComments" yaml:"legalComments"`
	// Documentation: https://esbuild.github.io/api/#loader.
	Loader *map[string]*string `field:"optional" json:"loader" yaml:"loader"`
	// Documentation: https://esbuild.github.io/api/#log-level.
	LogLevel *string `field:"optional" json:"logLevel" yaml:"logLevel"`
	// Documentation: https://esbuild.github.io/api/#log-limit.
	LogLimit *float64 `field:"optional" json:"logLimit" yaml:"logLimit"`
	// Documentation: https://esbuild.github.io/api/#log-override.
	LogOverride *map[string]*string `field:"optional" json:"logOverride" yaml:"logOverride"`
	// Documentation: https://esbuild.github.io/api/#main-fields.
	MainFields *[]*string `field:"optional" json:"mainFields" yaml:"mainFields"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleCache *map[string]interface{} `field:"optional" json:"mangleCache" yaml:"mangleCache"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleProps interface{} `field:"optional" json:"mangleProps" yaml:"mangleProps"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleQuoted *bool `field:"optional" json:"mangleQuoted" yaml:"mangleQuoted"`
	// Documentation: https://esbuild.github.io/api/#metafile.
	Metafile *bool `field:"optional" json:"metafile" yaml:"metafile"`
	// Documentation: https://esbuild.github.io/api/#minify.
	Minify *bool `field:"optional" json:"minify" yaml:"minify"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifyIdentifiers *bool `field:"optional" json:"minifyIdentifiers" yaml:"minifyIdentifiers"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifySyntax *bool `field:"optional" json:"minifySyntax" yaml:"minifySyntax"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifyWhitespace *bool `field:"optional" json:"minifyWhitespace" yaml:"minifyWhitespace"`
	// Documentation: https://esbuild.github.io/api/#node-paths.
	NodePaths *[]*string `field:"optional" json:"nodePaths" yaml:"nodePaths"`
	// Documentation: https://esbuild.github.io/api/#outbase.
	Outbase *string `field:"optional" json:"outbase" yaml:"outbase"`
	// Documentation: https://esbuild.github.io/api/#outdir.
	Outdir *string `field:"optional" json:"outdir" yaml:"outdir"`
	// Documentation: https://esbuild.github.io/api/#out-extension.
	OutExtension *map[string]*string `field:"optional" json:"outExtension" yaml:"outExtension"`
	// Documentation: https://esbuild.github.io/api/#outfile.
	Outfile *string `field:"optional" json:"outfile" yaml:"outfile"`
	// Documentation: https://esbuild.github.io/api/#packages.
	Packages *string `field:"optional" json:"packages" yaml:"packages"`
	// Documentation: https://esbuild.github.io/api/#platform.
	Platform *string `field:"optional" json:"platform" yaml:"platform"`
	// Documentation: https://esbuild.github.io/api/#preserve-symlinks.
	PreserveSymlinks *bool `field:"optional" json:"preserveSymlinks" yaml:"preserveSymlinks"`
	// Documentation: https://esbuild.github.io/api/#public-path.
	PublicPath *string `field:"optional" json:"publicPath" yaml:"publicPath"`
	// Documentation: https://esbuild.github.io/api/#pure.
	Pure *[]*string `field:"optional" json:"pure" yaml:"pure"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	ReserveProps interface{} `field:"optional" json:"reserveProps" yaml:"reserveProps"`
	// Documentation: https://esbuild.github.io/api/#resolve-extensions.
	ResolveExtensions *[]*string `field:"optional" json:"resolveExtensions" yaml:"resolveExtensions"`
	// Documentation: https://esbuild.github.io/api/#sourcemap.
	Sourcemap interface{} `field:"optional" json:"sourcemap" yaml:"sourcemap"`
	// Documentation: https://esbuild.github.io/api/#source-root.
	SourceRoot *string `field:"optional" json:"sourceRoot" yaml:"sourceRoot"`
	// Documentation: https://esbuild.github.io/api/#sources-content.
	SourcesContent *bool `field:"optional" json:"sourcesContent" yaml:"sourcesContent"`
	// Documentation: https://esbuild.github.io/api/#splitting.
	Splitting *bool `field:"optional" json:"splitting" yaml:"splitting"`
	// Documentation: https://esbuild.github.io/api/#supported.
	Supported *map[string]*bool `field:"optional" json:"supported" yaml:"supported"`
	// Documentation: https://esbuild.github.io/api/#target.
	Target interface{} `field:"optional" json:"target" yaml:"target"`
	// Documentation: https://esbuild.github.io/api/#tree-shaking.
	TreeShaking *bool `field:"optional" json:"treeShaking" yaml:"treeShaking"`
	// Documentation: https://esbuild.github.io/api/#tsconfig.
	Tsconfig *string `field:"optional" json:"tsconfig" yaml:"tsconfig"`
	// Documentation: https://esbuild.github.io/api/#write.
	Write *bool `field:"optional" json:"write" yaml:"write"`
}

type BundlerProps

type BundlerProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
}

type CodeConfig

type CodeConfig struct {
	// Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`).
	// Default: - code is not an ECR container image.
	//
	Image *awslambda.CodeImageConfig `field:"optional" json:"image" yaml:"image"`
	// Inline code (mutually exclusive with `s3Location` and `image`).
	// Default: - code is not inline code.
	//
	InlineCode *string `field:"optional" json:"inlineCode" yaml:"inlineCode"`
	// The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).
	// Default: - code is not an s3 location.
	//
	S3Location *awss3.Location `field:"optional" json:"s3Location" yaml:"s3Location"`
}

Result of binding `Code` into a `Function`.

type CompilerOptions

type CompilerOptions struct {
	ImportsNotUsedAsValues  *string `field:"optional" json:"importsNotUsedAsValues" yaml:"importsNotUsedAsValues"`
	JsxFactory              *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"`
	JsxFragmentFactory      *string `field:"optional" json:"jsxFragmentFactory" yaml:"jsxFragmentFactory"`
	PreserveValueImports    *bool   `field:"optional" json:"preserveValueImports" yaml:"preserveValueImports"`
	UseDefineForClassFields *bool   `field:"optional" json:"useDefineForClassFields" yaml:"useDefineForClassFields"`
}

type EsbuildAsset

type EsbuildAsset interface {
	awss3assets.Asset
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it
	// can be used in construct IDs in order to enforce creation of a new resource when the content
	// hash has changed.
	// Experimental.
	AssetHash() *string
	// The path to the asset, relative to the current Cloud Assembly.
	//
	// If asset staging is disabled, this will just be the original path.
	// If asset staging is enabled it will be the staged path.
	// Experimental.
	AssetPath() *string
	// The S3 bucket in which this asset resides.
	// Experimental.
	Bucket() awss3.IBucket
	// Attribute which represents the S3 HTTP URL of this asset.
	//
	// Example:
	//   https://s3.us-west-1.amazonaws.com/bucket/key
	//
	// Experimental.
	HttpUrl() *string
	// Indicates if this asset is a single file.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	// Experimental.
	IsFile() *bool
	// Indicates if this asset is a zip archive.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	// Experimental.
	IsZipArchive() *bool
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Attribute that represents the name of the bucket this asset exists in.
	// Experimental.
	S3BucketName() *string
	// Attribute which represents the S3 object key of this asset.
	// Experimental.
	S3ObjectKey() *string
	// Attribute which represents the S3 URL of this asset.
	//
	// Example:
	//   s3://bucket/key
	//
	// Experimental.
	S3ObjectUrl() *string
	// Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
	//
	// This can be used by tools such as SAM CLI to provide local
	// experience such as local invocation and debugging of Lambda functions.
	//
	// Asset metadata will only be included if the stack is synthesized with the
	// "aws:cdk:enable-asset-metadata" context key defined, which is the default
	// behavior when synthesizing via the CDK Toolkit.
	// See: https://github.com/aws/aws-cdk/issues/1432
	//
	// Experimental.
	AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string)
	// Grants read permissions to the principal on the assets bucket.
	// Experimental.
	GrantRead(grantee awsiam.IGrantable)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Represents a generic esbuild asset.

You should always use `TypeScriptAsset` or `JavaScriptAsset`. Experimental.

func NewEsbuildAsset

func NewEsbuildAsset(scope constructs.Construct, id *string, props *AssetProps) EsbuildAsset

Experimental.

type EsbuildBundler

type EsbuildBundler interface {
	// A path or list or map of paths to the entry points of your code.
	//
	// Relative paths are by default resolved from the current working directory.
	// To change the working directory, see `buildOptions.absWorkingDir`.
	//
	// Absolute paths can be used if files are part of the working directory.
	//
	// Examples:
	//   - `'src/index.ts'`
	//   - `require.resolve('./lambda')`
	//   - `['src/index.ts', 'src/util.ts']`
	//   - `{one: 'src/two.ts', two: 'src/one.ts'}`
	// Experimental.
	EntryPoints() interface{}
	// Deprecated: This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface.
	Image() awscdk.DockerImage
	// Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
	// Experimental.
	Local() awscdk.ILocalBundling
	// Props to change the behaviour of the bundler.
	// Experimental.
	Props() *BundlerProps
}

Low-level construct that can be used where `BundlingOptions` are required.

This class directly interfaces with esbuild and provides almost no configuration safeguards. Experimental.

func NewEsbuildBundler

func NewEsbuildBundler(entryPoints interface{}, props *BundlerProps) EsbuildBundler

Experimental.

type EsbuildCode

type EsbuildCode interface {
	awslambda.Code
	// Experimental.
	Asset() EsbuildAsset
	// Experimental.
	SetAsset(val EsbuildAsset)
	// A path or list or map of paths to the entry points of your code.
	//
	// Relative paths are by default resolved from the current working directory.
	// To change the working directory, see `buildOptions.absWorkingDir`.
	//
	// Absolute paths can be used if files are part of the working directory.
	//
	// Examples:
	//   - `'src/index.ts'`
	//   - `require.resolve('./lambda')`
	//   - `['src/index.ts', 'src/util.ts']`
	//   - `{one: 'src/two.ts', two: 'src/one.ts'}`
	// Experimental.
	EntryPoints() interface{}
	// Determines whether this Code is inline code or not.
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	IsInline() *bool
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	SetIsInline(val *bool)
	// Experimental.
	Props() *AssetProps
	// Experimental.
	SetProps(val *AssetProps)
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	// Experimental.
	BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions)
	// Experimental.
	GetAsset(scope constructs.Construct) EsbuildAsset
}

Represents a generic esbuild code bundle.

You should always use `TypeScriptCode` or `JavaScriptCode`. Experimental.

func NewEsbuildCode

func NewEsbuildCode(entryPoints interface{}, props interface{}) EsbuildCode

Experimental.

type EsbuildSource

type EsbuildSource interface {
}

func NewEsbuildSource

func NewEsbuildSource() EsbuildSource

type InlineJavaScriptCode

type InlineJavaScriptCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	// Experimental.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	// Experimental.
	BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions)
}

An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.

func NewInlineJavaScriptCode

func NewInlineJavaScriptCode(code *string, props interface{}) InlineJavaScriptCode

Experimental.

type InlineJsxCode

type InlineJsxCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	// Experimental.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	// Experimental.
	BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions)
}

An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.

func NewInlineJsxCode

func NewInlineJsxCode(code *string, props interface{}) InlineJsxCode

Experimental.

type InlineTsxCode

type InlineTsxCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	// Experimental.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	// Experimental.
	BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions)
}

An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.

func NewInlineTsxCode

func NewInlineTsxCode(code *string, props interface{}) InlineTsxCode

Experimental.

type InlineTypeScriptCode

type InlineTypeScriptCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	// Experimental.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	// Experimental.
	BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions)
}

An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.

func NewInlineTypeScriptCode

func NewInlineTypeScriptCode(code *string, props interface{}) InlineTypeScriptCode

Experimental.

type JavaScriptAsset

type JavaScriptAsset interface {
	EsbuildAsset
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it
	// can be used in construct IDs in order to enforce creation of a new resource when the content
	// hash has changed.
	AssetHash() *string
	// The path to the asset, relative to the current Cloud Assembly.
	//
	// If asset staging is disabled, this will just be the original path.
	// If asset staging is enabled it will be the staged path.
	AssetPath() *string
	// The S3 bucket in which this asset resides.
	Bucket() awss3.IBucket
	// Attribute which represents the S3 HTTP URL of this asset.
	//
	// Example:
	//   https://s3.us-west-1.amazonaws.com/bucket/key
	//
	HttpUrl() *string
	// Indicates if this asset is a single file.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	IsFile() *bool
	// Indicates if this asset is a zip archive.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	IsZipArchive() *bool
	// The tree node.
	Node() constructs.Node
	// Attribute that represents the name of the bucket this asset exists in.
	S3BucketName() *string
	// Attribute which represents the S3 object key of this asset.
	S3ObjectKey() *string
	// Attribute which represents the S3 URL of this asset.
	//
	// Example:
	//   s3://bucket/key
	//
	S3ObjectUrl() *string
	// Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
	//
	// This can be used by tools such as SAM CLI to provide local
	// experience such as local invocation and debugging of Lambda functions.
	//
	// Asset metadata will only be included if the stack is synthesized with the
	// "aws:cdk:enable-asset-metadata" context key defined, which is the default
	// behavior when synthesizing via the CDK Toolkit.
	// See: https://github.com/aws/aws-cdk/issues/1432
	//
	AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string)
	// Grants read permissions to the principal on the assets bucket.
	GrantRead(grantee awsiam.IGrantable)
	// Returns a string representation of this construct.
	ToString() *string
}

Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.

The asset can be used by other constructs.

func NewJavaScriptAsset

func NewJavaScriptAsset(scope constructs.Construct, id *string, props *AssetProps) JavaScriptAsset

type JavaScriptCode

type JavaScriptCode interface {
	EsbuildCode
	// Experimental.
	Asset() EsbuildAsset
	// Experimental.
	SetAsset(val EsbuildAsset)
	// A path or list or map of paths to the entry points of your code.
	//
	// Relative paths are by default resolved from the current working directory.
	// To change the working directory, see `buildOptions.absWorkingDir`.
	//
	// Absolute paths can be used if files are part of the working directory.
	//
	// Examples:
	//   - `'src/index.ts'`
	//   - `require.resolve('./lambda')`
	//   - `['src/index.ts', 'src/util.ts']`
	//   - `{one: 'src/two.ts', two: 'src/one.ts'}`
	EntryPoints() interface{}
	// Determines whether this Code is inline code or not.
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	IsInline() *bool
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	SetIsInline(val *bool)
	// Experimental.
	Props() *AssetProps
	// Experimental.
	SetProps(val *AssetProps)
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions)
	GetAsset(scope constructs.Construct) EsbuildAsset
}

Represents the deployed JavaScript Code.

func NewJavaScriptCode

func NewJavaScriptCode(entryPoints interface{}, props *JavaScriptCodeProps) JavaScriptCode

type JavaScriptCodeProps

type JavaScriptCodeProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
	//
	// Defaults to a hash of all files in the resulting bundle.
	AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
}

type JavaScriptSource

type JavaScriptSource interface {
	awss3deployment.ISource
	Asset() interface{}
	SetAsset(val interface{})
	AssetClass() JavaScriptAsset
	SetAssetClass(val JavaScriptAsset)
	Props() *AssetProps
	SetProps(val *AssetProps)
	// Binds the source to a bucket deployment.
	Bind(scope constructs.Construct, context *awss3deployment.DeploymentSourceContext) *awss3deployment.SourceConfig
}

func NewJavaScriptSource

func NewJavaScriptSource(entryPoints interface{}, props *JavaScriptSourceProps) JavaScriptSource

type JavaScriptSourceProps

type JavaScriptSourceProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
	//
	// Defaults to a hash of all files in the resulting bundle.
	AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
}

type TransformOptions

type TransformOptions struct {
	Banner *string `field:"optional" json:"banner" yaml:"banner"`
	// Documentation: https://esbuild.github.io/api/#charset.
	Charset *string `field:"optional" json:"charset" yaml:"charset"`
	// Documentation: https://esbuild.github.io/api/#color.
	Color *bool `field:"optional" json:"color" yaml:"color"`
	// Documentation: https://esbuild.github.io/api/#define.
	Define *map[string]*string `field:"optional" json:"define" yaml:"define"`
	// Documentation: https://esbuild.github.io/api/#drop.
	Drop   *[]*string `field:"optional" json:"drop" yaml:"drop"`
	Footer *string    `field:"optional" json:"footer" yaml:"footer"`
	// Documentation: https://esbuild.github.io/api/#format.
	Format *string `field:"optional" json:"format" yaml:"format"`
	// Documentation: https://esbuild.github.io/api/#global-name.
	GlobalName *string `field:"optional" json:"globalName" yaml:"globalName"`
	// Documentation: https://esbuild.github.io/api/#ignore-annotations.
	IgnoreAnnotations *bool `field:"optional" json:"ignoreAnnotations" yaml:"ignoreAnnotations"`
	// Documentation: https://esbuild.github.io/api/#jsx.
	Jsx *string `field:"optional" json:"jsx" yaml:"jsx"`
	// Documentation: https://esbuild.github.io/api/#jsx-development.
	JsxDev *bool `field:"optional" json:"jsxDev" yaml:"jsxDev"`
	// Documentation: https://esbuild.github.io/api/#jsx-factory.
	JsxFactory *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"`
	// Documentation: https://esbuild.github.io/api/#jsx-fragment.
	JsxFragment *string `field:"optional" json:"jsxFragment" yaml:"jsxFragment"`
	// Documentation: https://esbuild.github.io/api/#jsx-import-source.
	JsxImportSource *string `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"`
	// Documentation: https://esbuild.github.io/api/#jsx-side-effects.
	JsxSideEffects *bool `field:"optional" json:"jsxSideEffects" yaml:"jsxSideEffects"`
	// Documentation: https://esbuild.github.io/api/#keep-names.
	KeepNames *bool `field:"optional" json:"keepNames" yaml:"keepNames"`
	// Documentation: https://esbuild.github.io/api/#legal-comments.
	LegalComments *string `field:"optional" json:"legalComments" yaml:"legalComments"`
	Loader        *string `field:"optional" json:"loader" yaml:"loader"`
	// Documentation: https://esbuild.github.io/api/#log-level.
	LogLevel *string `field:"optional" json:"logLevel" yaml:"logLevel"`
	// Documentation: https://esbuild.github.io/api/#log-limit.
	LogLimit *float64 `field:"optional" json:"logLimit" yaml:"logLimit"`
	// Documentation: https://esbuild.github.io/api/#log-override.
	LogOverride *map[string]*string `field:"optional" json:"logOverride" yaml:"logOverride"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleCache *map[string]interface{} `field:"optional" json:"mangleCache" yaml:"mangleCache"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleProps interface{} `field:"optional" json:"mangleProps" yaml:"mangleProps"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	MangleQuoted *bool `field:"optional" json:"mangleQuoted" yaml:"mangleQuoted"`
	// Documentation: https://esbuild.github.io/api/#minify.
	Minify *bool `field:"optional" json:"minify" yaml:"minify"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifyIdentifiers *bool `field:"optional" json:"minifyIdentifiers" yaml:"minifyIdentifiers"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifySyntax *bool `field:"optional" json:"minifySyntax" yaml:"minifySyntax"`
	// Documentation: https://esbuild.github.io/api/#minify.
	MinifyWhitespace *bool `field:"optional" json:"minifyWhitespace" yaml:"minifyWhitespace"`
	// Documentation: https://esbuild.github.io/api/#platform.
	Platform *string `field:"optional" json:"platform" yaml:"platform"`
	// Documentation: https://esbuild.github.io/api/#pure.
	Pure *[]*string `field:"optional" json:"pure" yaml:"pure"`
	// Documentation: https://esbuild.github.io/api/#mangle-props.
	ReserveProps interface{} `field:"optional" json:"reserveProps" yaml:"reserveProps"`
	Sourcefile   *string     `field:"optional" json:"sourcefile" yaml:"sourcefile"`
	// Documentation: https://esbuild.github.io/api/#sourcemap.
	Sourcemap interface{} `field:"optional" json:"sourcemap" yaml:"sourcemap"`
	// Documentation: https://esbuild.github.io/api/#source-root.
	SourceRoot *string `field:"optional" json:"sourceRoot" yaml:"sourceRoot"`
	// Documentation: https://esbuild.github.io/api/#sources-content.
	SourcesContent *bool `field:"optional" json:"sourcesContent" yaml:"sourcesContent"`
	// Documentation: https://esbuild.github.io/api/#supported.
	Supported *map[string]*bool `field:"optional" json:"supported" yaml:"supported"`
	// Documentation: https://esbuild.github.io/api/#target.
	Target interface{} `field:"optional" json:"target" yaml:"target"`
	// Documentation: https://esbuild.github.io/api/#tree-shaking.
	TreeShaking *bool       `field:"optional" json:"treeShaking" yaml:"treeShaking"`
	TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"`
}

type TransformerProps

type TransformerProps struct {
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// Escape hatch to provide the bundler with a custom transform function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however a TransformResult must be returned to integrate with CDK.
	// Must throw a `TransformFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.TransformResult
	// Default: `esbuild.transformSync`
	//
	// Experimental.
	TransformFn interface{} `field:"optional" json:"transformFn" yaml:"transformFn"`
	// Transform options passed on to esbuild.
	//
	// Please refer to the esbuild Transform API docs for details.
	// See: https://esbuild.github.io/api/#transform-api
	//
	// Experimental.
	TransformOptions *TransformOptions `field:"optional" json:"transformOptions" yaml:"transformOptions"`
}

Experimental.

type TsconfigOptions

type TsconfigOptions struct {
	CompilerOptions *CompilerOptions `field:"optional" json:"compilerOptions" yaml:"compilerOptions"`
}

type TypeScriptAsset

type TypeScriptAsset interface {
	EsbuildAsset
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it
	// can be used in construct IDs in order to enforce creation of a new resource when the content
	// hash has changed.
	AssetHash() *string
	// The path to the asset, relative to the current Cloud Assembly.
	//
	// If asset staging is disabled, this will just be the original path.
	// If asset staging is enabled it will be the staged path.
	AssetPath() *string
	// The S3 bucket in which this asset resides.
	Bucket() awss3.IBucket
	// Attribute which represents the S3 HTTP URL of this asset.
	//
	// Example:
	//   https://s3.us-west-1.amazonaws.com/bucket/key
	//
	HttpUrl() *string
	// Indicates if this asset is a single file.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	IsFile() *bool
	// Indicates if this asset is a zip archive.
	//
	// Allows constructs to ensure that the
	// correct file type was used.
	IsZipArchive() *bool
	// The tree node.
	Node() constructs.Node
	// Attribute that represents the name of the bucket this asset exists in.
	S3BucketName() *string
	// Attribute which represents the S3 object key of this asset.
	S3ObjectKey() *string
	// Attribute which represents the S3 URL of this asset.
	//
	// Example:
	//   s3://bucket/key
	//
	S3ObjectUrl() *string
	// Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
	//
	// This can be used by tools such as SAM CLI to provide local
	// experience such as local invocation and debugging of Lambda functions.
	//
	// Asset metadata will only be included if the stack is synthesized with the
	// "aws:cdk:enable-asset-metadata" context key defined, which is the default
	// behavior when synthesizing via the CDK Toolkit.
	// See: https://github.com/aws/aws-cdk/issues/1432
	//
	AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string)
	// Grants read permissions to the principal on the assets bucket.
	GrantRead(grantee awsiam.IGrantable)
	// Returns a string representation of this construct.
	ToString() *string
}

Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.

The asset can be used by other constructs.

func NewTypeScriptAsset

func NewTypeScriptAsset(scope constructs.Construct, id *string, props *AssetProps) TypeScriptAsset

type TypeScriptCode

type TypeScriptCode interface {
	EsbuildCode
	// Experimental.
	Asset() EsbuildAsset
	// Experimental.
	SetAsset(val EsbuildAsset)
	// A path or list or map of paths to the entry points of your code.
	//
	// Relative paths are by default resolved from the current working directory.
	// To change the working directory, see `buildOptions.absWorkingDir`.
	//
	// Absolute paths can be used if files are part of the working directory.
	//
	// Examples:
	//   - `'src/index.ts'`
	//   - `require.resolve('./lambda')`
	//   - `['src/index.ts', 'src/util.ts']`
	//   - `{one: 'src/two.ts', two: 'src/one.ts'}`
	EntryPoints() interface{}
	// Determines whether this Code is inline code or not.
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	IsInline() *bool
	// Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
	SetIsInline(val *bool)
	// Experimental.
	Props() *AssetProps
	// Experimental.
	SetProps(val *AssetProps)
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	// Experimental.
	Bind(scope constructs.Construct) *awslambda.CodeConfig
	// Called after the CFN function resource has been created to allow the code class to bind to it.
	//
	// Specifically it's required to allow assets to add
	// metadata for tooling like SAM CLI to be able to find their origins.
	BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions)
	GetAsset(scope constructs.Construct) EsbuildAsset
}

Represents the deployed TypeScript Code.

func NewTypeScriptCode

func NewTypeScriptCode(entryPoints interface{}, props *TypeScriptCodeProps) TypeScriptCode

type TypeScriptCodeProps

type TypeScriptCodeProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
	//
	// Defaults to a hash of all files in the resulting bundle.
	AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
}

type TypeScriptSource

type TypeScriptSource interface {
	awss3deployment.ISource
	Asset() interface{}
	SetAsset(val interface{})
	AssetClass() TypeScriptAsset
	SetAssetClass(val TypeScriptAsset)
	Props() *AssetProps
	SetProps(val *AssetProps)
	// Binds the source to a bucket deployment.
	Bind(scope constructs.Construct, context *awss3deployment.DeploymentSourceContext) *awss3deployment.SourceConfig
}

func NewTypeScriptSource

func NewTypeScriptSource(entryPoints interface{}, props *TypeScriptSourceProps) TypeScriptSource

type TypeScriptSourceProps

type TypeScriptSourceProps struct {
	// Escape hatch to provide the bundler with a custom build function.
	//
	// The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
	// Must throw a `BuildFailure` on failure to correctly inform the bundler.
	//
	// Returns: esbuild.BuildResult
	// Default: `esbuild.buildSync`
	//
	// Experimental.
	BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"`
	// Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
	//
	// * `buildOptions.outdir: string`
	// The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
	// For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
	// *Cannot be used together with `outfile`*.
	// * `buildOptions.outfile: string`
	// Relative path to a file inside the CDK asset output directory.
	// For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
	// *Cannot be used with multiple entryPoints or together with `outdir`.*
	// * `buildOptions.absWorkingDir: string`
	// Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
	// If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
	// See: https://esbuild.github.io/api/#build-api
	//
	BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"`
	// Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
	//
	// * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
	// * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
	//
	// Therefore the following values for `copyDir` are all equivalent:
	// “`ts
	// { copyDir: "path/to/source" }
	// { copyDir: ["path/to/source"] }
	// { copyDir: { ".": "path/to/source" } }
	// { copyDir: { ".": ["path/to/source"] } }
	// “`
	// The destination cannot be outside of the asset staging directory.
	// If you are receiving the error "Cannot copy files to outside of the asset staging directory."
	// you are likely using `..` or an absolute path as key on the `copyDir` map.
	// Instead use only relative paths and avoid `..`.
	CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"`
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	// Experimental.
	EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"`
	// Absolute path to the esbuild module JS file.
	//
	// E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
	//
	// If not set, the module path will be determined in the following order:
	//
	// - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable
	// - In TypeScript, fallback to the default Node.js package resolution mechanism
	// - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \
	//    The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.
	//    If `esbuild` cannot be found, it might be installed dynamically to a temporary location.
	//    To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above).
	//
	// Experimental.
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
	// A hash of this asset, which is available at construction time.
	//
	// As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
	//
	// Defaults to a hash of all files in the resulting bundle.
	AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
}

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL