cdkesbuild

package module
v4.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 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 | Python, .NET, & Go | FAQ

View on Construct Hub

Why?

esbuild is an extremely fast bundler and minifier for TypeScript and JavaScript. This package makes esbuild available to deploy AWS Lambda Functions, static websites or publish assets for further usage.

AWS CDK supports esbuild for AWS Lambda Functions, but the implementation cannot be used with other Constructs and doesn't expose all of esbuild's API.

Getting started

Install cdk-esbuild for Node.js using your favorite package manager:

# npm
npm install @mrgrain/cdk-esbuild@4
# Yarn
yarn add @mrgrain/cdk-esbuild@4
# pnpm
pnpm add @mrgrain/cdk-esbuild@4

For Python, .NET or Go, use these commands:

# Python
pip install mrgrain.cdk-esbuild

# .NET
dotnet add package Mrgrain.CdkEsbuild

# Go
go get github.com/mrgrain/cdk-esbuild-go/cdkesbuild/v4

AWS Lambda: Serverless function

💡 See Lambda (TypeScript) and Lambda (Python) for complete working examples of a how to deploy an AWS Lambda Function.

Use TypeScriptCode as the code of a lambda function:

// Example automatically generated from non-compiling source. May contain errors.
bundledCode := cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"))

fn := lambda.NewFunction(stack, jsii.String("MyFunction"), &FunctionProps{
	Runtime: lambda.Runtime.nODEJS_18_X,
	Handler: jsii.String("index.handler"),
	Code: bundledCode,
})

AWS S3: Static Website

💡 See React App (TypeScript) 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:

websiteBundle := cdkesbuild.NewTypeScriptSource(jsii.String("src/index.tsx"))

websiteBucket := s3.NewBucket(stack, jsii.String("WebsiteBucket"), &BucketProps{
	AutoDeleteObjects: jsii.Boolean(true),
	PublicReadAccess: jsii.Boolean(true),
	RemovalPolicy: cdk.RemovalPolicy_DESTROY,
	WebsiteIndexDocument: jsii.String("index.html"),
})

s3deploy.NewBucketDeployment(stack, jsii.String("DeployWebsite"), &BucketDeploymentProps{
	DestinationBucket: websiteBucket,
	Sources: []iSource{
		websiteBundle,
	},
})

Amazon CloudWatch Synthetics: Canary monitoring

💡 See Monitored Website (TypeScript) 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 @aws-cdk/aws-synthetics-alpha which is in developer preview. Please install the package using the respective tool of your language. You may need to update your source code when upgrading to a newer version of this alpha package.

bundledCode := cdkesbuild.NewTypeScriptCode(jsii.String("src/canary.ts"), &TypeScriptCodeProps{
	BuildOptions: &buildOptions{
		Outdir: jsii.String("nodejs/node_modules"),
	},
})

canary := synthetics.NewCanary(stack, jsii.String("MyCanary"), &CanaryProps{
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_2(),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: bundledCode,
		Handler: jsii.String("index.handler"),
	}),
})

Documentation

The package exports various different constructs for use with AWS CDK features. The guiding design principal for this package is "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

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
  • EsbuildProvider implements IBuildProvider and ITransformProvider
    provides the default esbuild API implementation and can be replaced with a custom implementation

API Reference

Auto-generated reference for Constructs, Classes and Structs. This information is also available as part of your IDE's code completion.

Python, .NET, Go

Esbuild requires a platform and architecture specific binary and currently has to be installed with a Node.js package manager like npm.

When using cdk-esbuild with Python, .NET or Go, the package will automatically detect local and global installations of the esbuild npm package. If none can be found, it will fall back to dynamically installing a copy into a temporary location. The exact algorithm of this mechanism must be treated as an implementation detail and should not be relied on. It can however be configured to a certain extent. See the examples below for more details.

This "best effort" approach makes it easy to get started. But is not always desirable, for example in environments with limited network access or when guaranteed repeatability of builds is a concern. You have several options to opt-out of this behavior.

Provide a controlled installation of esbuild

The first step is to install a version of esbuild that is controlled by you.

I strongly recommend to install esbuild as a local package. The easiest approach is to manage an additional Node.js project at the root of your AWS CDK project. esbuild can then be added to the package.json file and it is your responsibility to ensure required setup steps are taken in all environments like development machines and CI/CD systems.

Instead of installing the esbuild package in a local project, it can also be installed globally with npm install -g esbuild or a similar command. This approach might be preferred if a build container is prepared ahead of time, thus avoiding repeated package installation.

Change the automatic package detection

The second step is to make cdk-esbuild aware of your chosen install location. This step is optional, but it's a good idea to have the location or at least the method explicitly defined.

To do this, you can set the esbuildModulePath prop on a EsbuildProvider. Either pass a known, absolute or relative path as value, or use the EsbuildSource helper to set the detection method. Please refer to the EsbuildSource reference for a complete list of available methods.

// Use the standard Node.js algorithm to detect a locally installed package
// Use the standard Node.js algorithm to detect a locally installed package
cdkesbuild.NewEsbuildProvider(&EsbuildProviderProps{
	EsbuildModulePath: cdkesbuild.EsbuildSource_NodeJs(),
})

// Provide an explicit path
// Provide an explicit path
cdkesbuild.NewEsbuildProvider(&EsbuildProviderProps{
	EsbuildModulePath: jsii.String("/home/user/node_modules/esbuild/lib/main.js"),
})

As a no-code approach, the CDK_ESBUILD_MODULE_PATH environment variable can be set in the same way. An advantage of this is that the path can easily be changed for different systems. Setting the env variable can be used with any installation approach, but is typically paired with a global installation of the esbuild package. Note that esbuildModulePath takes precedence.

Override the default detection method

For an AWS CDK app with many instances of TypeScriptCode etc. it would be annoying to change the above for every single one of them. Luckily, the default can be changed for all usages per app:

customModule := cdkesbuild.NewEsbuildProvider(&EsbuildProviderProps{
	EsbuildModulePath: cdkesbuild.EsbuildSource_GlobalPaths(),
})
cdkesbuild.EsbuildProvider_OverrideDefaultProvider(customModule)

Customizing the Esbuild API

This package uses the esbuild JavaScript API. In most situations the default API configuration will be suitable. But sometimes it is required to configure esbuild differently or even provide a custom implementation. Common reasons for this are:

  • Using a pre-installed version of esbuild with Python, .NET or Go
  • If features not supported by the synchronous API are required, e.g. support for plugins
  • If the default version constraints for esbuild are not suitable
  • To use a version of esbuild that is installed by any other means than npm, including Docker

For these scenarios, this package offers customization options and an interface to provide a custom implementation:

var myCustomBuildProvider iBuildProvider

var myCustomTransformProvider iTransformProvider


cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"), &TypeScriptCodeProps{
	BuildProvider: myCustomBuildProvider,
})

cdkesbuild.NewInlineTypeScriptCode(jsii.String("let x: number = 1"), &TransformerProps{
	TransformProvider: myCustomTransformProvider,
})
Esbuild binary path

It is possible to override the binary used by esbuild by setting a property on EsbuildProvider. This is the same as setting the ESBUILD_BINARY_PATH environment variable. Defining the esbuildBinaryPath prop takes precedence.

buildProvider := cdkesbuild.NewEsbuildProvider(&EsbuildProviderProps{
	EsbuildBinaryPath: jsii.String("path/to/esbuild/binary"),
})

// This will use a different esbuild binary
// This will use a different esbuild binary
cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"), &TypeScriptCodeProps{
	BuildProvider: BuildProvider,
})
Esbuild module path

The Node.js module discovery algorithm will normally be used to find the esbuild package. It can be useful to use specify a different module path, for example if a globally installed package should be used instead of a local version.

buildProvider := cdkesbuild.NewEsbuildProvider(&EsbuildProviderProps{
	EsbuildModulePath: jsii.String("/home/user/node_modules/esbuild/lib/main.js"),
})

// This will use a different esbuild module
// This will use a different esbuild module
cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"), &TypeScriptCodeProps{
	BuildProvider: BuildProvider,
})

Alternatively supported by setting the CDK_ESBUILD_MODULE_PATH environment variable, which will apply to all uses. Defining the esbuildModulePath prop takes precedence.

If you are a Python, .NET or Go user, refer to the language specific guide for a more detailed explanation of this feature.

Custom Build and Transform API implementations

💡 See esbuild plugins w/ TypeScript for a complete working example of a custom Build API implementation.

A custom implementation can be provided by implementing IBuildProvider or ITransformProvider:

type customEsbuild struct {
}

func (this *customEsbuild) buildSync(options buildOptions) {}

func (this *customEsbuild) transformSync(code *string, options transformOptions) *string {
	// custom implementation goes here, return transformed code
	return jsii.String("transformed code")
}

// These will use the custom implementation
// These will use the custom implementation
cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"), &TypeScriptCodeProps{
	BuildProvider: NewCustomEsbuild(),
})
cdkesbuild.NewInlineTypeScriptCode(jsii.String("let x: number = 1"), &TransformerProps{
	TransformProvider: NewCustomEsbuild(),
})

Instead of esbuild, the custom methods will be invoked with all computed options. Custom implementations can amend, change or discard any of the options.

The IBuildProvider integration with CDK relies on the outdir/outfile values and it's usually required to use them unchanged.

ITransformProvider must return the transformed code as a string.

Failures and warnings should be printed to stderr and thrown as the respective esbuild error.

Overriding the default implementation providers

The default implementation can also be set for all usages of TypeScriptCode etc. in an AWS CDK app. You can change the default for both APIs at once or set a different implementation for each of them.

myCustomEsbuildProvider := NewMyCustomEsbuildProvider()

cdkesbuild.EsbuildProvider_OverrideDefaultProvider(myCustomEsbuildProvider)
cdkesbuild.EsbuildProvider_OverrideDefaultBuildProvider(myCustomEsbuildProvider)
cdkesbuild.EsbuildProvider_OverrideDefaultTransformationProvider(myCustomEsbuildProvider)

// This will use the custom provider without the need to define it as a prop
// This will use the custom provider without the need to define it as a prop
cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"))

Roadmap & Contributions

The project's roadmap is available on GitHub.

Please submit feature requests as issues to the repository. All contributions are welcome, no matter if they are for already planned or completely new features.

FAQ

Should I use this package in production?

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.

Note that esbuild minor version upgrades are also introduced in minor versions of this package. Since esbuild is pre v1, these versions typically introduce breaking changes and this package will inherit them. To avoid this behavior, add the desired esbuild version as a dependency to your package.

How do I upgrade from cdk-esbuild v3?

Please refer to the v4 release notes for a list of backwards incompatible changes and respective upgrade instructions.

[TS/JS] Why am I getting the error Cannot find module 'esbuild'?

This package depends on esbuild as an optional dependencies. If optional dependencies are not installed automatically on your system (e.g. when using npm v4-6), install esbuild explicitly:

npm install esbuild

[TS/JS] How can I use a different version of esbuild?

Use the override instructions for your package manager to force a specific version, for example:

{
  "overrides": {
    "esbuild": "0.14.7"
  }
}

Build and Transform interfaces are relatively stable across esbuild versions. However if any incompatibilities occur, buildOptions / transformOptions can be cast to any:

bundledCode := cdkesbuild.NewTypeScriptCode(jsii.String("src/handler.ts"), &TypeScriptCodeProps{
	BuildOptions: map[string]*string{
		"unsupportedOption": jsii.String("value"),
	},
})

[Python/.NET/Go] How can I use a different version of esbuild?

Install the desired version of esbuild locally or globally as described in the documentation above.

Build and Transform interfaces are relatively stable across esbuild versions. However if any incompatibilities occur, use the appropriate language features to cast any incompatible buildOptions / transformOptions to the correct types.

Can I use this package in my published AWS CDK Construct?

It is possible to use cdk-esbuild in a published AWS CDK Construct library, but not recommended. Always prefer to ship a compiled .js file or even bundle a zip archive in your package. For AWS Lambda Functions, projen provides an excellent solution.

If you do end up consuming cdk-esbuild, you will have to set buildOptions.absWorkingDir. The easiest way to do this, is to resolve the path based on the directory name of the calling file:

// file: node_modules/construct-library/src/index.ts
const props = {
  buildOptions: {
    absWorkingDir: path.resolve(__dirname, ".."),
    // now: /user/local-app/node_modules/construct-library
  },
};

This will dynamically resolve to the correct path, wherever the package is installed. Please open an issue if you encounter any difficulties.

Can I use this package with AWS CDK v1?

Yes, the 2.x.x line of cdk-esbuild is compatible with AWS CDK v1. You can find the documentation for it on the v2 branch.

However, in line with AWS CDK v2, this version release now only receives security updates and critical bug fixes and support will fully end on June 1, 2023.

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 EsbuildProvider_OverrideDefaultBuildProvider

func EsbuildProvider_OverrideDefaultBuildProvider(provider IBuildProvider)

Set the default implementation for the Build API.

func EsbuildProvider_OverrideDefaultProvider

func EsbuildProvider_OverrideDefaultProvider(provider IEsbuildProvider)

Set the default implementation for both Build and Transformation API.

func EsbuildProvider_OverrideDefaultTransformationProvider

func EsbuildProvider_OverrideDefaultTransformationProvider(provider ITransformProvider)

Set the default implementation for the Transformation API.

func EsbuildSource_Anywhere

func EsbuildSource_Anywhere() *string

Try to find the module in most common paths.

func EsbuildSource_Auto

func EsbuildSource_Auto() *string

First try to find to module, then install it to a temporary location.

func EsbuildSource_GlobalPaths

func EsbuildSource_GlobalPaths() *string

Try to find the module in common global installation paths.

func EsbuildSource_Install

func EsbuildSource_Install() *string

Install the module to a temporary location.

func EsbuildSource_NodeJs

func EsbuildSource_NodeJs() *string

Require module by name, do not attempt to find it anywhere else.

func EsbuildSource_PlatformDefault

func EsbuildSource_PlatformDefault() *string

`EsbuildSource.nodeJs()` for NodeJs, `EsbuildSource.auto()` for all other languages.

func InlineJavaScriptCode_FromAsset

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

Loads the function code from a local disk path.

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.

func InlineJavaScriptCode_FromBucket

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

Lambda handler code as an S3 object.

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`.

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.

func InlineJavaScriptCode_FromEcrImage

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

Use an existing ECR image as the Lambda code.

func InlineJavaScriptCode_FromInline

func InlineJavaScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code.

func InlineTypeScriptCode_FromAsset

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

Loads the function code from a local disk path.

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.

func InlineTypeScriptCode_FromBucket

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

Lambda handler code as an S3 object.

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`.

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.

func InlineTypeScriptCode_FromEcrImage

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

Use an existing ECR image as the Lambda code.

func InlineTypeScriptCode_FromInline

func InlineTypeScriptCode_FromInline(code *string) awslambda.InlineCode

Inline code for Lambda handler.

Returns: `LambdaInlineCode` with inline code.

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 NewEsbuildProvider_Override

func NewEsbuildProvider_Override(e EsbuildProvider, props *EsbuildProviderProps)

func NewInlineJavaScriptCode_Override

func NewInlineJavaScriptCode_Override(i InlineJavaScriptCode, code *string, props *TransformerProps)

func NewInlineTypeScriptCode_Override

func NewInlineTypeScriptCode_Override(i InlineTypeScriptCode, code *string, props *TransformerProps)

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 {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
	// 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/#drop-labels.
	DropLabels *[]*string `field:"optional" json:"dropLabels" yaml:"dropLabels"`
	// 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/#line-limit.
	LineLimit *float64 `field:"optional" json:"lineLimit" yaml:"lineLimit"`
	// 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/#tsconfig-raw.
	TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"`
	// Documentation: https://esbuild.github.io/api/#write.
	Write *bool `field:"optional" json:"write" yaml:"write"`
}

type BundlerProps

type BundlerProps struct {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
}

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 {
	AlwaysStrict            *bool                  `field:"optional" json:"alwaysStrict" yaml:"alwaysStrict"`
	BaseUrl                 *string                `field:"optional" json:"baseUrl" yaml:"baseUrl"`
	ExperimentalDecorators  *bool                  `field:"optional" json:"experimentalDecorators" yaml:"experimentalDecorators"`
	ImportsNotUsedAsValues  *string                `field:"optional" json:"importsNotUsedAsValues" yaml:"importsNotUsedAsValues"`
	Jsx                     *string                `field:"optional" json:"jsx" yaml:"jsx"`
	JsxFactory              *string                `field:"optional" json:"jsxFactory" yaml:"jsxFactory"`
	JsxFragmentFactory      *string                `field:"optional" json:"jsxFragmentFactory" yaml:"jsxFragmentFactory"`
	JsxImportSource         *string                `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"`
	Paths                   *map[string]*[]*string `field:"optional" json:"paths" yaml:"paths"`
	PreserveValueImports    *bool                  `field:"optional" json:"preserveValueImports" yaml:"preserveValueImports"`
	Strict                  *bool                  `field:"optional" json:"strict" yaml:"strict"`
	Target                  *string                `field:"optional" json:"target" yaml:"target"`
	UseDefineForClassFields *bool                  `field:"optional" json:"useDefineForClassFields" yaml:"useDefineForClassFields"`
	VerbatimModuleSyntax    *bool                  `field:"optional" json:"verbatimModuleSyntax" yaml:"verbatimModuleSyntax"`
}

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.
	//
	// For 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.
	//
	// For 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 behavior 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 EsbuildProvider

type EsbuildProvider interface {
	IBuildProvider
	ITransformProvider
	// A method implementing the code build.
	//
	// During synth time, the method will receive all computed `BuildOptions` from the bundler.
	//
	// It MUST implement any output options to integrate correctly and MAY use any other options.
	// On failure, it SHOULD print any warnings & errors to stderr and throw a `BuildFailure` to inform the bundler.
	BuildSync(options *ProviderBuildOptions)
	// A method implementing the inline code transformation.
	//
	// During synth time, the method will receive the inline code and all computed `TransformOptions` from the bundler.
	//
	// MUST return the transformed code as a string to integrate correctly.
	// It MAY use these options to do so.
	// On failure, it SHOULD print any warnings & errors to stderr and throw a `TransformFailure` to inform the bundler.
	TransformSync(input *string, options *ProviderTransformOptions) *string
}

Default esbuild implementation calling esbuild's JavaScript API.

func NewEsbuildProvider

func NewEsbuildProvider(props *EsbuildProviderProps) EsbuildProvider

type EsbuildProviderProps

type EsbuildProviderProps struct {
	// Path to the binary used by esbuild.
	//
	// This is the same as setting the ESBUILD_BINARY_PATH environment variable.
	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.
	//
	// Use the static methods on `EsbuildSource` to customize the default behavior.
	// Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see description).
	//
	EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"`
}

Configure the default EsbuildProvider.

type EsbuildSource

type EsbuildSource interface {
}

type IBuildProvider

type IBuildProvider interface {
	// A method implementing the code build.
	//
	// During synth time, the method will receive all computed `BuildOptions` from the bundler.
	//
	// It MUST implement any output options to integrate correctly and MAY use any other options.
	// On failure, it SHOULD print any warnings & errors to stderr and throw a `BuildFailure` to inform the bundler.
	BuildSync(options *ProviderBuildOptions)
}

Provides an implementation of the esbuild Build API.

func EsbuildProvider_DefaultBuildProvider

func EsbuildProvider_DefaultBuildProvider() IBuildProvider

Get the default implementation for the Build API.

type IEsbuildProvider

type IEsbuildProvider interface {
	IBuildProvider
	ITransformProvider
}

Provides an implementation of the esbuild Build & Transform API.

type ITransformProvider

type ITransformProvider interface {
	// A method implementing the inline code transformation.
	//
	// During synth time, the method will receive the inline code and all computed `TransformOptions` from the bundler.
	//
	// MUST return the transformed code as a string to integrate correctly.
	// It MAY use these options to do so.
	// On failure, it SHOULD print any warnings & errors to stderr and throw a `TransformFailure` to inform the bundler.
	TransformSync(input *string, options *ProviderTransformOptions) *string
}

Provides an implementation of the esbuild Transform API.

func EsbuildProvider_DefaultTransformationProvider

func EsbuildProvider_DefaultTransformationProvider() ITransformProvider

Get the default implementation for the Transformation API.

type InlineJavaScriptCode

type InlineJavaScriptCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	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)
}

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

func NewInlineJavaScriptCode

func NewInlineJavaScriptCode(code *string, props *TransformerProps) InlineJavaScriptCode

type InlineTypeScriptCode

type InlineTypeScriptCode interface {
	awslambda.InlineCode
	// Determines whether this Code is inline code or not.
	IsInline() *bool
	// Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
	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)
}

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

func NewInlineTypeScriptCode

func NewInlineTypeScriptCode(code *string, props *TransformerProps) InlineTypeScriptCode

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.
	//
	// For 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.
	//
	// For 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 {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
	// 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 {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
	// 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 ProviderBuildOptions

type ProviderBuildOptions 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/#drop-labels.
	DropLabels *[]*string `field:"optional" json:"dropLabels" yaml:"dropLabels"`
	// 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/#line-limit.
	LineLimit *float64 `field:"optional" json:"lineLimit" yaml:"lineLimit"`
	// 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/#tsconfig-raw.
	TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"`
	// Documentation: https://esbuild.github.io/api/#write.
	Write *bool `field:"optional" json:"write" yaml:"write"`
	// Documentation: https://esbuild.github.io/api/#entry-points.
	EntryPoints interface{} `field:"optional" json:"entryPoints" yaml:"entryPoints"`
}

type ProviderTransformOptions

type ProviderTransformOptions struct {
	// Documentation: https://esbuild.github.io/api/#banner.
	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"`
	// Documentation: https://esbuild.github.io/api/#drop-labels.
	DropLabels *[]*string `field:"optional" json:"dropLabels" yaml:"dropLabels"`
	// Documentation: https://esbuild.github.io/api/#footer.
	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"`
	// Documentation: https://esbuild.github.io/api/#line-limit.
	LineLimit *float64 `field:"optional" json:"lineLimit" yaml:"lineLimit"`
	// Documentation: https://esbuild.github.io/api/#loader.
	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"`
	// Documentation: https://esbuild.github.io/api/#sourcefile.
	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"`
	// Documentation: https://esbuild.github.io/api/#tsconfig-raw.
	TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"`
}

type TransformOptions

type TransformOptions struct {
	// Documentation: https://esbuild.github.io/api/#banner.
	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"`
	// Documentation: https://esbuild.github.io/api/#drop-labels.
	DropLabels *[]*string `field:"optional" json:"dropLabels" yaml:"dropLabels"`
	// Documentation: https://esbuild.github.io/api/#footer.
	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"`
	// Documentation: https://esbuild.github.io/api/#line-limit.
	LineLimit *float64 `field:"optional" json:"lineLimit" yaml:"lineLimit"`
	// Documentation: https://esbuild.github.io/api/#loader.
	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"`
	// Documentation: https://esbuild.github.io/api/#sourcefile.
	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"`
	// Documentation: https://esbuild.github.io/api/#tsconfig-raw.
	TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"`
}

type TransformerProps

type TransformerProps struct {
	// Transform options passed on to esbuild.
	//
	// Please refer to the esbuild Transform API docs for details.
	// See: https://esbuild.github.io/api/#transform-api
	//
	TransformOptions *TransformOptions `field:"optional" json:"transformOptions" yaml:"transformOptions"`
	// The esbuild Transform API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `ITransformProvider` as an escape hatch.
	// Default: new DefaultEsbuildProvider().
	//
	TransformProvider ITransformProvider `field:"optional" json:"transformProvider" yaml:"transformProvider"`
}

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.
	//
	// For 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.
	//
	// For 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 {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
	// 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 {
	// 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"`
	// The esbuild Build API implementation to be used.
	//
	// Configure the default `EsbuildProvider` for more options or
	// provide a custom `IBuildProvider` as an escape hatch.
	// Default: new EsbuildProvider().
	//
	BuildProvider IBuildProvider `field:"optional" json:"buildProvider" yaml:"buildProvider"`
	// 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:
	// “`
	// { 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"`
	// 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