Documentation
¶
Overview ¶
CDK constructs for esbuild, an extremely fast JavaScript bundler
Index ¶
- func EsbuildAsset_IsConstruct(x interface{}) *bool
- func EsbuildCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func EsbuildCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func EsbuildCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func EsbuildCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func EsbuildCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func EsbuildCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func EsbuildCode_FromInline(code *string) awslambda.InlineCode
- func EsbuildSource_Anywhere() *string
- func EsbuildSource_Auto() *string
- func EsbuildSource_Default() *string
- func EsbuildSource_GlobalPaths() *string
- func EsbuildSource_Install() *string
- func EsbuildSource_NodeJs() *string
- func EsbuildSource_PlatformDefault() *string
- func EsbuildSource_SetDefault(val *string)
- func InlineJavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func InlineJavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func InlineJavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func InlineJavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func InlineJavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func InlineJavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func InlineJavaScriptCode_FromInline(code *string) awslambda.InlineCode
- func InlineJsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func InlineJsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func InlineJsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func InlineJsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func InlineJsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func InlineJsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func InlineJsxCode_FromInline(code *string) awslambda.InlineCode
- func InlineTsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func InlineTsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func InlineTsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func InlineTsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func InlineTsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func InlineTsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func InlineTsxCode_FromInline(code *string) awslambda.InlineCode
- func InlineTypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func InlineTypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func InlineTypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func InlineTypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func InlineTypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func InlineTypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func InlineTypeScriptCode_FromInline(code *string) awslambda.InlineCode
- func JavaScriptAsset_IsConstruct(x interface{}) *bool
- func JavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func JavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func JavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func JavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func JavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func JavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func JavaScriptCode_FromInline(code *string) awslambda.InlineCode
- func NewEsbuildAsset_Override(e EsbuildAsset, scope constructs.Construct, id *string, props *AssetProps)
- func NewEsbuildBundler_Override(e EsbuildBundler, entryPoints interface{}, props *BundlerProps)
- func NewEsbuildCode_Override(e EsbuildCode, entryPoints interface{}, props interface{})
- func NewEsbuildSource_Override(e EsbuildSource)
- func NewInlineJavaScriptCode_Override(i InlineJavaScriptCode, code *string, props interface{})
- func NewInlineJsxCode_Override(i InlineJsxCode, code *string, props interface{})
- func NewInlineTsxCode_Override(i InlineTsxCode, code *string, props interface{})
- func NewInlineTypeScriptCode_Override(i InlineTypeScriptCode, code *string, props interface{})
- func NewJavaScriptAsset_Override(j JavaScriptAsset, scope constructs.Construct, id *string, props *AssetProps)
- func NewJavaScriptCode_Override(j JavaScriptCode, entryPoints interface{}, props *JavaScriptCodeProps)
- func NewJavaScriptSource_Override(j JavaScriptSource, entryPoints interface{}, props *JavaScriptSourceProps)
- func NewTypeScriptAsset_Override(t TypeScriptAsset, scope constructs.Construct, id *string, props *AssetProps)
- func NewTypeScriptCode_Override(t TypeScriptCode, entryPoints interface{}, props *TypeScriptCodeProps)
- func NewTypeScriptSource_Override(t TypeScriptSource, entryPoints interface{}, props *TypeScriptSourceProps)
- func TypeScriptAsset_IsConstruct(x interface{}) *bool
- func TypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
- func TypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
- func TypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
- func TypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
- func TypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
- func TypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
- func TypeScriptCode_FromInline(code *string) awslambda.InlineCode
- type AssetProps
- type BuildOptions
- type BundlerProps
- type CodeConfig
- type CompilerOptions
- type EsbuildAsset
- type EsbuildBundler
- type EsbuildCode
- type EsbuildSource
- type InlineJavaScriptCode
- type InlineJsxCode
- type InlineTsxCode
- type InlineTypeScriptCode
- type JavaScriptAsset
- type JavaScriptCode
- type JavaScriptCodeProps
- type JavaScriptSource
- type JavaScriptSourceProps
- type TransformOptions
- type TransformerProps
- type TsconfigOptions
- type TypeScriptAsset
- type TypeScriptCode
- type TypeScriptCodeProps
- type TypeScriptSource
- type TypeScriptSourceProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EsbuildAsset_IsConstruct ¶
func EsbuildAsset_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.
func EsbuildCode_FromAsset ¶
func EsbuildCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path. Experimental.
func EsbuildCode_FromAssetImage ¶
func EsbuildCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.
func EsbuildCode_FromBucket ¶
func EsbuildCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object. Experimental.
func EsbuildCode_FromCfnParameters ¶
func EsbuildCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`. Experimental.
func EsbuildCode_FromDockerBuild ¶
func EsbuildCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image. Experimental.
func EsbuildCode_FromEcrImage ¶
func EsbuildCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code. Experimental.
func EsbuildCode_FromInline ¶
func EsbuildCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code. Experimental.
func EsbuildSource_Anywhere ¶
func EsbuildSource_Anywhere() *string
func EsbuildSource_Auto ¶
func EsbuildSource_Auto() *string
func EsbuildSource_Default ¶
func EsbuildSource_Default() *string
func EsbuildSource_GlobalPaths ¶
func EsbuildSource_GlobalPaths() *string
func EsbuildSource_Install ¶
func EsbuildSource_Install() *string
func EsbuildSource_NodeJs ¶
func EsbuildSource_NodeJs() *string
func EsbuildSource_PlatformDefault ¶
func EsbuildSource_PlatformDefault() *string
func EsbuildSource_SetDefault ¶
func EsbuildSource_SetDefault(val *string)
func InlineJavaScriptCode_FromAsset ¶
func InlineJavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path. Experimental.
func InlineJavaScriptCode_FromAssetImage ¶
func InlineJavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.
func InlineJavaScriptCode_FromBucket ¶
func InlineJavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object. Experimental.
func InlineJavaScriptCode_FromCfnParameters ¶
func InlineJavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`. Experimental.
func InlineJavaScriptCode_FromDockerBuild ¶
func InlineJavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image. Experimental.
func InlineJavaScriptCode_FromEcrImage ¶
func InlineJavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code. Experimental.
func InlineJavaScriptCode_FromInline ¶
func InlineJavaScriptCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code. Experimental.
func InlineJsxCode_FromAsset ¶
func InlineJsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path. Experimental.
func InlineJsxCode_FromAssetImage ¶
func InlineJsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.
func InlineJsxCode_FromBucket ¶
func InlineJsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object. Experimental.
func InlineJsxCode_FromCfnParameters ¶
func InlineJsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`. Experimental.
func InlineJsxCode_FromDockerBuild ¶
func InlineJsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image. Experimental.
func InlineJsxCode_FromEcrImage ¶
func InlineJsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code. Experimental.
func InlineJsxCode_FromInline ¶
func InlineJsxCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code. Experimental.
func InlineTsxCode_FromAsset ¶
func InlineTsxCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path. Experimental.
func InlineTsxCode_FromAssetImage ¶
func InlineTsxCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.
func InlineTsxCode_FromBucket ¶
func InlineTsxCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object. Experimental.
func InlineTsxCode_FromCfnParameters ¶
func InlineTsxCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`. Experimental.
func InlineTsxCode_FromDockerBuild ¶
func InlineTsxCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image. Experimental.
func InlineTsxCode_FromEcrImage ¶
func InlineTsxCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code. Experimental.
func InlineTsxCode_FromInline ¶
func InlineTsxCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code. Experimental.
func InlineTypeScriptCode_FromAsset ¶
func InlineTypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path. Experimental.
func InlineTypeScriptCode_FromAssetImage ¶
func InlineTypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code. Experimental.
func InlineTypeScriptCode_FromBucket ¶
func InlineTypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object. Experimental.
func InlineTypeScriptCode_FromCfnParameters ¶
func InlineTypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`. Experimental.
func InlineTypeScriptCode_FromDockerBuild ¶
func InlineTypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image. Experimental.
func InlineTypeScriptCode_FromEcrImage ¶
func InlineTypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code. Experimental.
func InlineTypeScriptCode_FromInline ¶
func InlineTypeScriptCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code. Experimental.
func JavaScriptAsset_IsConstruct ¶
func JavaScriptAsset_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.
func JavaScriptCode_FromAsset ¶
func JavaScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path.
func JavaScriptCode_FromAssetImage ¶
func JavaScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code.
func JavaScriptCode_FromBucket ¶
func JavaScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object.
func JavaScriptCode_FromCfnParameters ¶
func JavaScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`.
func JavaScriptCode_FromDockerBuild ¶
func JavaScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image.
func JavaScriptCode_FromEcrImage ¶
func JavaScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code.
func JavaScriptCode_FromInline ¶
func JavaScriptCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code.
func NewEsbuildAsset_Override ¶
func NewEsbuildAsset_Override(e EsbuildAsset, scope constructs.Construct, id *string, props *AssetProps)
Experimental.
func NewEsbuildBundler_Override ¶
func NewEsbuildBundler_Override(e EsbuildBundler, entryPoints interface{}, props *BundlerProps)
Experimental.
func NewEsbuildCode_Override ¶
func NewEsbuildCode_Override(e EsbuildCode, entryPoints interface{}, props interface{})
Experimental.
func NewEsbuildSource_Override ¶
func NewEsbuildSource_Override(e EsbuildSource)
func NewInlineJavaScriptCode_Override ¶
func NewInlineJavaScriptCode_Override(i InlineJavaScriptCode, code *string, props interface{})
Experimental.
func NewInlineJsxCode_Override ¶
func NewInlineJsxCode_Override(i InlineJsxCode, code *string, props interface{})
Experimental.
func NewInlineTsxCode_Override ¶
func NewInlineTsxCode_Override(i InlineTsxCode, code *string, props interface{})
Experimental.
func NewInlineTypeScriptCode_Override ¶
func NewInlineTypeScriptCode_Override(i InlineTypeScriptCode, code *string, props interface{})
Experimental.
func NewJavaScriptAsset_Override ¶
func NewJavaScriptAsset_Override(j JavaScriptAsset, scope constructs.Construct, id *string, props *AssetProps)
func NewJavaScriptCode_Override ¶
func NewJavaScriptCode_Override(j JavaScriptCode, entryPoints interface{}, props *JavaScriptCodeProps)
func NewJavaScriptSource_Override ¶
func NewJavaScriptSource_Override(j JavaScriptSource, entryPoints interface{}, props *JavaScriptSourceProps)
func NewTypeScriptAsset_Override ¶
func NewTypeScriptAsset_Override(t TypeScriptAsset, scope constructs.Construct, id *string, props *AssetProps)
func NewTypeScriptCode_Override ¶
func NewTypeScriptCode_Override(t TypeScriptCode, entryPoints interface{}, props *TypeScriptCodeProps)
func NewTypeScriptSource_Override ¶
func NewTypeScriptSource_Override(t TypeScriptSource, entryPoints interface{}, props *TypeScriptSourceProps)
func TypeScriptAsset_IsConstruct ¶
func TypeScriptAsset_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.
func TypeScriptCode_FromAsset ¶
func TypeScriptCode_FromAsset(path *string, options *awss3assets.AssetOptions) awslambda.AssetCode
Loads the function code from a local disk path.
func TypeScriptCode_FromAssetImage ¶
func TypeScriptCode_FromAssetImage(directory *string, props *awslambda.AssetImageCodeProps) awslambda.AssetImageCode
Create an ECR image from the specified asset and bind it as the Lambda code.
func TypeScriptCode_FromBucket ¶
func TypeScriptCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) awslambda.S3Code
Lambda handler code as an S3 object.
func TypeScriptCode_FromCfnParameters ¶
func TypeScriptCode_FromCfnParameters(props *awslambda.CfnParametersCodeProps) awslambda.CfnParametersCode
Creates a new Lambda source defined using CloudFormation parameters.
Returns: a new instance of `CfnParametersCode`.
func TypeScriptCode_FromDockerBuild ¶
func TypeScriptCode_FromDockerBuild(path *string, options *awslambda.DockerBuildAssetOptions) awslambda.AssetCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at `/asset` in the image.
func TypeScriptCode_FromEcrImage ¶
func TypeScriptCode_FromEcrImage(repository awsecr.IRepository, props *awslambda.EcrImageCodeProps) awslambda.EcrImageCode
Use an existing ECR image as the Lambda code.
func TypeScriptCode_FromInline ¶
func TypeScriptCode_FromInline(code *string) awslambda.InlineCode
Inline code for Lambda handler.
Returns: `LambdaInlineCode` with inline code.
Types ¶
type AssetProps ¶
type AssetProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // A path or list or map of paths to the entry points of your code. // // Relative paths are by default resolved from the current working directory. // To change the working directory, see `buildOptions.absWorkingDir`. // // Absolute paths can be used if files are part of the working directory. // // Examples: // - `'src/index.ts'` // - `require.resolve('./lambda')` // - `['src/index.ts', 'src/util.ts']` // - `{one: 'src/two.ts', two: 'src/one.ts'}` EntryPoints interface{} `field:"required" json:"entryPoints" yaml:"entryPoints"` // A hash of this asset, which is available at construction time. // // As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed. // // Defaults to a hash of all files in the resulting bundle. AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"` }
type BuildOptions ¶
type BuildOptions struct { // Documentation: https://esbuild.github.io/api/#working-directory. AbsWorkingDir *string `field:"optional" json:"absWorkingDir" yaml:"absWorkingDir"` // Documentation: https://esbuild.github.io/api/#alias. Alias *map[string]*string `field:"optional" json:"alias" yaml:"alias"` // Documentation: https://esbuild.github.io/api/#allow-overwrite. AllowOverwrite *bool `field:"optional" json:"allowOverwrite" yaml:"allowOverwrite"` // Documentation: https://esbuild.github.io/api/#asset-names. AssetNames *string `field:"optional" json:"assetNames" yaml:"assetNames"` // Documentation: https://esbuild.github.io/api/#banner. Banner *map[string]*string `field:"optional" json:"banner" yaml:"banner"` // Documentation: https://esbuild.github.io/api/#bundle. Bundle *bool `field:"optional" json:"bundle" yaml:"bundle"` // Documentation: https://esbuild.github.io/api/#charset. Charset *string `field:"optional" json:"charset" yaml:"charset"` // Documentation: https://esbuild.github.io/api/#chunk-names. ChunkNames *string `field:"optional" json:"chunkNames" yaml:"chunkNames"` // Documentation: https://esbuild.github.io/api/#color. Color *bool `field:"optional" json:"color" yaml:"color"` // Documentation: https://esbuild.github.io/api/#conditions. Conditions *[]*string `field:"optional" json:"conditions" yaml:"conditions"` // Documentation: https://esbuild.github.io/api/#define. Define *map[string]*string `field:"optional" json:"define" yaml:"define"` // Documentation: https://esbuild.github.io/api/#drop. Drop *[]*string `field:"optional" json:"drop" yaml:"drop"` // Documentation: https://esbuild.github.io/api/#entry-names. EntryNames *string `field:"optional" json:"entryNames" yaml:"entryNames"` // Documentation: https://esbuild.github.io/api/#external. External *[]*string `field:"optional" json:"external" yaml:"external"` Footer *map[string]*string `field:"optional" json:"footer" yaml:"footer"` // Documentation: https://esbuild.github.io/api/#format. Format *string `field:"optional" json:"format" yaml:"format"` // Documentation: https://esbuild.github.io/api/#global-name. GlobalName *string `field:"optional" json:"globalName" yaml:"globalName"` // Documentation: https://esbuild.github.io/api/#ignore-annotations. IgnoreAnnotations *bool `field:"optional" json:"ignoreAnnotations" yaml:"ignoreAnnotations"` // Documentation: https://esbuild.github.io/api/#inject. Inject *[]*string `field:"optional" json:"inject" yaml:"inject"` // Documentation: https://esbuild.github.io/api/#jsx. Jsx *string `field:"optional" json:"jsx" yaml:"jsx"` // Documentation: https://esbuild.github.io/api/#jsx-development. JsxDev *bool `field:"optional" json:"jsxDev" yaml:"jsxDev"` // Documentation: https://esbuild.github.io/api/#jsx-factory. JsxFactory *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"` // Documentation: https://esbuild.github.io/api/#jsx-fragment. JsxFragment *string `field:"optional" json:"jsxFragment" yaml:"jsxFragment"` // Documentation: https://esbuild.github.io/api/#jsx-import-source. JsxImportSource *string `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"` // Documentation: https://esbuild.github.io/api/#jsx-side-effects. JsxSideEffects *bool `field:"optional" json:"jsxSideEffects" yaml:"jsxSideEffects"` // Documentation: https://esbuild.github.io/api/#keep-names. KeepNames *bool `field:"optional" json:"keepNames" yaml:"keepNames"` // Documentation: https://esbuild.github.io/api/#legal-comments. LegalComments *string `field:"optional" json:"legalComments" yaml:"legalComments"` // Documentation: https://esbuild.github.io/api/#loader. Loader *map[string]*string `field:"optional" json:"loader" yaml:"loader"` // Documentation: https://esbuild.github.io/api/#log-level. LogLevel *string `field:"optional" json:"logLevel" yaml:"logLevel"` // Documentation: https://esbuild.github.io/api/#log-limit. LogLimit *float64 `field:"optional" json:"logLimit" yaml:"logLimit"` // Documentation: https://esbuild.github.io/api/#log-override. LogOverride *map[string]*string `field:"optional" json:"logOverride" yaml:"logOverride"` // Documentation: https://esbuild.github.io/api/#main-fields. MainFields *[]*string `field:"optional" json:"mainFields" yaml:"mainFields"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleCache *map[string]interface{} `field:"optional" json:"mangleCache" yaml:"mangleCache"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleProps interface{} `field:"optional" json:"mangleProps" yaml:"mangleProps"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleQuoted *bool `field:"optional" json:"mangleQuoted" yaml:"mangleQuoted"` // Documentation: https://esbuild.github.io/api/#metafile. Metafile *bool `field:"optional" json:"metafile" yaml:"metafile"` // Documentation: https://esbuild.github.io/api/#minify. Minify *bool `field:"optional" json:"minify" yaml:"minify"` // Documentation: https://esbuild.github.io/api/#minify. MinifyIdentifiers *bool `field:"optional" json:"minifyIdentifiers" yaml:"minifyIdentifiers"` // Documentation: https://esbuild.github.io/api/#minify. MinifySyntax *bool `field:"optional" json:"minifySyntax" yaml:"minifySyntax"` // Documentation: https://esbuild.github.io/api/#minify. MinifyWhitespace *bool `field:"optional" json:"minifyWhitespace" yaml:"minifyWhitespace"` // Documentation: https://esbuild.github.io/api/#node-paths. NodePaths *[]*string `field:"optional" json:"nodePaths" yaml:"nodePaths"` // Documentation: https://esbuild.github.io/api/#outbase. Outbase *string `field:"optional" json:"outbase" yaml:"outbase"` // Documentation: https://esbuild.github.io/api/#outdir. Outdir *string `field:"optional" json:"outdir" yaml:"outdir"` // Documentation: https://esbuild.github.io/api/#out-extension. OutExtension *map[string]*string `field:"optional" json:"outExtension" yaml:"outExtension"` // Documentation: https://esbuild.github.io/api/#outfile. Outfile *string `field:"optional" json:"outfile" yaml:"outfile"` // Documentation: https://esbuild.github.io/api/#packages. Packages *string `field:"optional" json:"packages" yaml:"packages"` // Documentation: https://esbuild.github.io/api/#platform. Platform *string `field:"optional" json:"platform" yaml:"platform"` // Documentation: https://esbuild.github.io/api/#preserve-symlinks. PreserveSymlinks *bool `field:"optional" json:"preserveSymlinks" yaml:"preserveSymlinks"` // Documentation: https://esbuild.github.io/api/#public-path. PublicPath *string `field:"optional" json:"publicPath" yaml:"publicPath"` // Documentation: https://esbuild.github.io/api/#pure. Pure *[]*string `field:"optional" json:"pure" yaml:"pure"` // Documentation: https://esbuild.github.io/api/#mangle-props. ReserveProps interface{} `field:"optional" json:"reserveProps" yaml:"reserveProps"` // Documentation: https://esbuild.github.io/api/#resolve-extensions. ResolveExtensions *[]*string `field:"optional" json:"resolveExtensions" yaml:"resolveExtensions"` // Documentation: https://esbuild.github.io/api/#sourcemap. Sourcemap interface{} `field:"optional" json:"sourcemap" yaml:"sourcemap"` // Documentation: https://esbuild.github.io/api/#source-root. SourceRoot *string `field:"optional" json:"sourceRoot" yaml:"sourceRoot"` // Documentation: https://esbuild.github.io/api/#sources-content. SourcesContent *bool `field:"optional" json:"sourcesContent" yaml:"sourcesContent"` // Documentation: https://esbuild.github.io/api/#splitting. Splitting *bool `field:"optional" json:"splitting" yaml:"splitting"` // Documentation: https://esbuild.github.io/api/#supported. Supported *map[string]*bool `field:"optional" json:"supported" yaml:"supported"` // Documentation: https://esbuild.github.io/api/#target. Target interface{} `field:"optional" json:"target" yaml:"target"` // Documentation: https://esbuild.github.io/api/#tree-shaking. TreeShaking *bool `field:"optional" json:"treeShaking" yaml:"treeShaking"` // Documentation: https://esbuild.github.io/api/#tsconfig. Tsconfig *string `field:"optional" json:"tsconfig" yaml:"tsconfig"` // Documentation: https://esbuild.github.io/api/#write. Write *bool `field:"optional" json:"write" yaml:"write"` }
type BundlerProps ¶
type BundlerProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` }
type CodeConfig ¶
type CodeConfig struct { // Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`). // Default: - code is not an ECR container image. // Image *awslambda.CodeImageConfig `field:"optional" json:"image" yaml:"image"` // Inline code (mutually exclusive with `s3Location` and `image`). // Default: - code is not inline code. // InlineCode *string `field:"optional" json:"inlineCode" yaml:"inlineCode"` // The location of the code in S3 (mutually exclusive with `inlineCode` and `image`). // Default: - code is not an s3 location. // S3Location *awss3.Location `field:"optional" json:"s3Location" yaml:"s3Location"` }
Result of binding `Code` into a `Function`.
type CompilerOptions ¶
type CompilerOptions struct { ImportsNotUsedAsValues *string `field:"optional" json:"importsNotUsedAsValues" yaml:"importsNotUsedAsValues"` JsxFactory *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"` JsxFragmentFactory *string `field:"optional" json:"jsxFragmentFactory" yaml:"jsxFragmentFactory"` PreserveValueImports *bool `field:"optional" json:"preserveValueImports" yaml:"preserveValueImports"` UseDefineForClassFields *bool `field:"optional" json:"useDefineForClassFields" yaml:"useDefineForClassFields"` }
type EsbuildAsset ¶
type EsbuildAsset interface { awss3assets.Asset // A hash of this asset, which is available at construction time. // // As this is a plain string, it // can be used in construct IDs in order to enforce creation of a new resource when the content // hash has changed. // Experimental. AssetHash() *string // The path to the asset, relative to the current Cloud Assembly. // // If asset staging is disabled, this will just be the original path. // If asset staging is enabled it will be the staged path. // Experimental. AssetPath() *string // The S3 bucket in which this asset resides. // Experimental. Bucket() awss3.IBucket // Attribute which represents the S3 HTTP URL of this asset. // // Example: // https://s3.us-west-1.amazonaws.com/bucket/key // // Experimental. HttpUrl() *string // Indicates if this asset is a single file. // // Allows constructs to ensure that the // correct file type was used. // Experimental. IsFile() *bool // Indicates if this asset is a zip archive. // // Allows constructs to ensure that the // correct file type was used. // Experimental. IsZipArchive() *bool // The tree node. // Experimental. Node() constructs.Node // Attribute that represents the name of the bucket this asset exists in. // Experimental. S3BucketName() *string // Attribute which represents the S3 object key of this asset. // Experimental. S3ObjectKey() *string // Attribute which represents the S3 URL of this asset. // // Example: // s3://bucket/key // // Experimental. S3ObjectUrl() *string // Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset. // // This can be used by tools such as SAM CLI to provide local // experience such as local invocation and debugging of Lambda functions. // // Asset metadata will only be included if the stack is synthesized with the // "aws:cdk:enable-asset-metadata" context key defined, which is the default // behavior when synthesizing via the CDK Toolkit. // See: https://github.com/aws/aws-cdk/issues/1432 // // Experimental. AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string) // Grants read permissions to the principal on the assets bucket. // Experimental. GrantRead(grantee awsiam.IGrantable) // Returns a string representation of this construct. // Experimental. ToString() *string }
Represents a generic esbuild asset.
You should always use `TypeScriptAsset` or `JavaScriptAsset`. Experimental.
func NewEsbuildAsset ¶
func NewEsbuildAsset(scope constructs.Construct, id *string, props *AssetProps) EsbuildAsset
Experimental.
type EsbuildBundler ¶
type EsbuildBundler interface { // A path or list or map of paths to the entry points of your code. // // Relative paths are by default resolved from the current working directory. // To change the working directory, see `buildOptions.absWorkingDir`. // // Absolute paths can be used if files are part of the working directory. // // Examples: // - `'src/index.ts'` // - `require.resolve('./lambda')` // - `['src/index.ts', 'src/util.ts']` // - `{one: 'src/two.ts', two: 'src/one.ts'}` // Experimental. EntryPoints() interface{} // Deprecated: This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface. Image() awscdk.DockerImage // Implementation of `ILocalBundling` interface, responsible for calling esbuild functions. // Experimental. Local() awscdk.ILocalBundling // Props to change the behaviour of the bundler. // Experimental. Props() *BundlerProps }
Low-level construct that can be used where `BundlingOptions` are required.
This class directly interfaces with esbuild and provides almost no configuration safeguards. Experimental.
func NewEsbuildBundler ¶
func NewEsbuildBundler(entryPoints interface{}, props *BundlerProps) EsbuildBundler
Experimental.
type EsbuildCode ¶
type EsbuildCode interface { awslambda.Code // Experimental. Asset() EsbuildAsset // Experimental. SetAsset(val EsbuildAsset) // A path or list or map of paths to the entry points of your code. // // Relative paths are by default resolved from the current working directory. // To change the working directory, see `buildOptions.absWorkingDir`. // // Absolute paths can be used if files are part of the working directory. // // Examples: // - `'src/index.ts'` // - `require.resolve('./lambda')` // - `['src/index.ts', 'src/util.ts']` // - `{one: 'src/two.ts', two: 'src/one.ts'}` // Experimental. EntryPoints() interface{} // Determines whether this Code is inline code or not. // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). IsInline() *bool // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). SetIsInline(val *bool) // Experimental. Props() *AssetProps // Experimental. SetProps(val *AssetProps) // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. // Experimental. BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions) // Experimental. GetAsset(scope constructs.Construct) EsbuildAsset }
Represents a generic esbuild code bundle.
You should always use `TypeScriptCode` or `JavaScriptCode`. Experimental.
func NewEsbuildCode ¶
func NewEsbuildCode(entryPoints interface{}, props interface{}) EsbuildCode
Experimental.
type EsbuildSource ¶
type EsbuildSource interface { }
func NewEsbuildSource ¶
func NewEsbuildSource() EsbuildSource
type InlineJavaScriptCode ¶
type InlineJavaScriptCode interface { awslambda.InlineCode // Determines whether this Code is inline code or not. // Experimental. IsInline() *bool // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. // Experimental. BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions) }
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.
func NewInlineJavaScriptCode ¶
func NewInlineJavaScriptCode(code *string, props interface{}) InlineJavaScriptCode
Experimental.
type InlineJsxCode ¶
type InlineJsxCode interface { awslambda.InlineCode // Determines whether this Code is inline code or not. // Experimental. IsInline() *bool // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. // Experimental. BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions) }
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.
func NewInlineJsxCode ¶
func NewInlineJsxCode(code *string, props interface{}) InlineJsxCode
Experimental.
type InlineTsxCode ¶
type InlineTsxCode interface { awslambda.InlineCode // Determines whether this Code is inline code or not. // Experimental. IsInline() *bool // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. // Experimental. BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions) }
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.
func NewInlineTsxCode ¶
func NewInlineTsxCode(code *string, props interface{}) InlineTsxCode
Experimental.
type InlineTypeScriptCode ¶
type InlineTypeScriptCode interface { awslambda.InlineCode // Determines whether this Code is inline code or not. // Experimental. IsInline() *bool // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. // Experimental. BindToResource(_resource awscdk.CfnResource, _options *awslambda.ResourceBindOptions) }
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation. Experimental.
func NewInlineTypeScriptCode ¶
func NewInlineTypeScriptCode(code *string, props interface{}) InlineTypeScriptCode
Experimental.
type JavaScriptAsset ¶
type JavaScriptAsset interface { EsbuildAsset // A hash of this asset, which is available at construction time. // // As this is a plain string, it // can be used in construct IDs in order to enforce creation of a new resource when the content // hash has changed. AssetHash() *string // The path to the asset, relative to the current Cloud Assembly. // // If asset staging is disabled, this will just be the original path. // If asset staging is enabled it will be the staged path. AssetPath() *string // The S3 bucket in which this asset resides. Bucket() awss3.IBucket // Attribute which represents the S3 HTTP URL of this asset. // // Example: // https://s3.us-west-1.amazonaws.com/bucket/key // HttpUrl() *string // Indicates if this asset is a single file. // // Allows constructs to ensure that the // correct file type was used. IsFile() *bool // Indicates if this asset is a zip archive. // // Allows constructs to ensure that the // correct file type was used. IsZipArchive() *bool // The tree node. Node() constructs.Node // Attribute that represents the name of the bucket this asset exists in. S3BucketName() *string // Attribute which represents the S3 object key of this asset. S3ObjectKey() *string // Attribute which represents the S3 URL of this asset. // // Example: // s3://bucket/key // S3ObjectUrl() *string // Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset. // // This can be used by tools such as SAM CLI to provide local // experience such as local invocation and debugging of Lambda functions. // // Asset metadata will only be included if the stack is synthesized with the // "aws:cdk:enable-asset-metadata" context key defined, which is the default // behavior when synthesizing via the CDK Toolkit. // See: https://github.com/aws/aws-cdk/issues/1432 // AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string) // Grants read permissions to the principal on the assets bucket. GrantRead(grantee awsiam.IGrantable) // Returns a string representation of this construct. ToString() *string }
Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
The asset can be used by other constructs.
func NewJavaScriptAsset ¶
func NewJavaScriptAsset(scope constructs.Construct, id *string, props *AssetProps) JavaScriptAsset
type JavaScriptCode ¶
type JavaScriptCode interface { EsbuildCode // Experimental. Asset() EsbuildAsset // Experimental. SetAsset(val EsbuildAsset) // A path or list or map of paths to the entry points of your code. // // Relative paths are by default resolved from the current working directory. // To change the working directory, see `buildOptions.absWorkingDir`. // // Absolute paths can be used if files are part of the working directory. // // Examples: // - `'src/index.ts'` // - `require.resolve('./lambda')` // - `['src/index.ts', 'src/util.ts']` // - `{one: 'src/two.ts', two: 'src/one.ts'}` EntryPoints() interface{} // Determines whether this Code is inline code or not. // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). IsInline() *bool // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). SetIsInline(val *bool) // Experimental. Props() *AssetProps // Experimental. SetProps(val *AssetProps) // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions) GetAsset(scope constructs.Construct) EsbuildAsset }
Represents the deployed JavaScript Code.
func NewJavaScriptCode ¶
func NewJavaScriptCode(entryPoints interface{}, props *JavaScriptCodeProps) JavaScriptCode
type JavaScriptCodeProps ¶
type JavaScriptCodeProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // A hash of this asset, which is available at construction time. // // As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed. // // Defaults to a hash of all files in the resulting bundle. AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"` }
type JavaScriptSource ¶
type JavaScriptSource interface { awss3deployment.ISource Asset() interface{} SetAsset(val interface{}) AssetClass() JavaScriptAsset SetAssetClass(val JavaScriptAsset) Props() *AssetProps SetProps(val *AssetProps) // Binds the source to a bucket deployment. Bind(scope constructs.Construct, context *awss3deployment.DeploymentSourceContext) *awss3deployment.SourceConfig }
func NewJavaScriptSource ¶
func NewJavaScriptSource(entryPoints interface{}, props *JavaScriptSourceProps) JavaScriptSource
type JavaScriptSourceProps ¶
type JavaScriptSourceProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // A hash of this asset, which is available at construction time. // // As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed. // // Defaults to a hash of all files in the resulting bundle. AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"` }
type TransformOptions ¶
type TransformOptions struct { Banner *string `field:"optional" json:"banner" yaml:"banner"` // Documentation: https://esbuild.github.io/api/#charset. Charset *string `field:"optional" json:"charset" yaml:"charset"` // Documentation: https://esbuild.github.io/api/#color. Color *bool `field:"optional" json:"color" yaml:"color"` // Documentation: https://esbuild.github.io/api/#define. Define *map[string]*string `field:"optional" json:"define" yaml:"define"` // Documentation: https://esbuild.github.io/api/#drop. Drop *[]*string `field:"optional" json:"drop" yaml:"drop"` // Documentation: https://esbuild.github.io/api/#format. Format *string `field:"optional" json:"format" yaml:"format"` // Documentation: https://esbuild.github.io/api/#global-name. GlobalName *string `field:"optional" json:"globalName" yaml:"globalName"` // Documentation: https://esbuild.github.io/api/#ignore-annotations. IgnoreAnnotations *bool `field:"optional" json:"ignoreAnnotations" yaml:"ignoreAnnotations"` // Documentation: https://esbuild.github.io/api/#jsx. Jsx *string `field:"optional" json:"jsx" yaml:"jsx"` // Documentation: https://esbuild.github.io/api/#jsx-development. JsxDev *bool `field:"optional" json:"jsxDev" yaml:"jsxDev"` // Documentation: https://esbuild.github.io/api/#jsx-factory. JsxFactory *string `field:"optional" json:"jsxFactory" yaml:"jsxFactory"` // Documentation: https://esbuild.github.io/api/#jsx-fragment. JsxFragment *string `field:"optional" json:"jsxFragment" yaml:"jsxFragment"` // Documentation: https://esbuild.github.io/api/#jsx-import-source. JsxImportSource *string `field:"optional" json:"jsxImportSource" yaml:"jsxImportSource"` // Documentation: https://esbuild.github.io/api/#jsx-side-effects. JsxSideEffects *bool `field:"optional" json:"jsxSideEffects" yaml:"jsxSideEffects"` // Documentation: https://esbuild.github.io/api/#keep-names. KeepNames *bool `field:"optional" json:"keepNames" yaml:"keepNames"` // Documentation: https://esbuild.github.io/api/#legal-comments. LegalComments *string `field:"optional" json:"legalComments" yaml:"legalComments"` Loader *string `field:"optional" json:"loader" yaml:"loader"` // Documentation: https://esbuild.github.io/api/#log-level. LogLevel *string `field:"optional" json:"logLevel" yaml:"logLevel"` // Documentation: https://esbuild.github.io/api/#log-limit. LogLimit *float64 `field:"optional" json:"logLimit" yaml:"logLimit"` // Documentation: https://esbuild.github.io/api/#log-override. LogOverride *map[string]*string `field:"optional" json:"logOverride" yaml:"logOverride"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleCache *map[string]interface{} `field:"optional" json:"mangleCache" yaml:"mangleCache"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleProps interface{} `field:"optional" json:"mangleProps" yaml:"mangleProps"` // Documentation: https://esbuild.github.io/api/#mangle-props. MangleQuoted *bool `field:"optional" json:"mangleQuoted" yaml:"mangleQuoted"` // Documentation: https://esbuild.github.io/api/#minify. Minify *bool `field:"optional" json:"minify" yaml:"minify"` // Documentation: https://esbuild.github.io/api/#minify. MinifyIdentifiers *bool `field:"optional" json:"minifyIdentifiers" yaml:"minifyIdentifiers"` // Documentation: https://esbuild.github.io/api/#minify. MinifySyntax *bool `field:"optional" json:"minifySyntax" yaml:"minifySyntax"` // Documentation: https://esbuild.github.io/api/#minify. MinifyWhitespace *bool `field:"optional" json:"minifyWhitespace" yaml:"minifyWhitespace"` // Documentation: https://esbuild.github.io/api/#platform. Platform *string `field:"optional" json:"platform" yaml:"platform"` // Documentation: https://esbuild.github.io/api/#pure. Pure *[]*string `field:"optional" json:"pure" yaml:"pure"` // Documentation: https://esbuild.github.io/api/#mangle-props. ReserveProps interface{} `field:"optional" json:"reserveProps" yaml:"reserveProps"` Sourcefile *string `field:"optional" json:"sourcefile" yaml:"sourcefile"` // Documentation: https://esbuild.github.io/api/#sourcemap. Sourcemap interface{} `field:"optional" json:"sourcemap" yaml:"sourcemap"` // Documentation: https://esbuild.github.io/api/#source-root. SourceRoot *string `field:"optional" json:"sourceRoot" yaml:"sourceRoot"` // Documentation: https://esbuild.github.io/api/#sources-content. SourcesContent *bool `field:"optional" json:"sourcesContent" yaml:"sourcesContent"` // Documentation: https://esbuild.github.io/api/#supported. Supported *map[string]*bool `field:"optional" json:"supported" yaml:"supported"` // Documentation: https://esbuild.github.io/api/#target. Target interface{} `field:"optional" json:"target" yaml:"target"` // Documentation: https://esbuild.github.io/api/#tree-shaking. TreeShaking *bool `field:"optional" json:"treeShaking" yaml:"treeShaking"` TsconfigRaw interface{} `field:"optional" json:"tsconfigRaw" yaml:"tsconfigRaw"` }
type TransformerProps ¶
type TransformerProps struct { // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // Escape hatch to provide the bundler with a custom transform function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however a TransformResult must be returned to integrate with CDK. // Must throw a `TransformFailure` on failure to correctly inform the bundler. // // Returns: esbuild.TransformResult // Default: `esbuild.transformSync` // // Experimental. TransformFn interface{} `field:"optional" json:"transformFn" yaml:"transformFn"` // Transform options passed on to esbuild. // // Please refer to the esbuild Transform API docs for details. // See: https://esbuild.github.io/api/#transform-api // // Experimental. TransformOptions *TransformOptions `field:"optional" json:"transformOptions" yaml:"transformOptions"` }
Experimental.
type TsconfigOptions ¶
type TsconfigOptions struct {
CompilerOptions *CompilerOptions `field:"optional" json:"compilerOptions" yaml:"compilerOptions"`
}
type TypeScriptAsset ¶
type TypeScriptAsset interface { EsbuildAsset // A hash of this asset, which is available at construction time. // // As this is a plain string, it // can be used in construct IDs in order to enforce creation of a new resource when the content // hash has changed. AssetHash() *string // The path to the asset, relative to the current Cloud Assembly. // // If asset staging is disabled, this will just be the original path. // If asset staging is enabled it will be the staged path. AssetPath() *string // The S3 bucket in which this asset resides. Bucket() awss3.IBucket // Attribute which represents the S3 HTTP URL of this asset. // // Example: // https://s3.us-west-1.amazonaws.com/bucket/key // HttpUrl() *string // Indicates if this asset is a single file. // // Allows constructs to ensure that the // correct file type was used. IsFile() *bool // Indicates if this asset is a zip archive. // // Allows constructs to ensure that the // correct file type was used. IsZipArchive() *bool // The tree node. Node() constructs.Node // Attribute that represents the name of the bucket this asset exists in. S3BucketName() *string // Attribute which represents the S3 object key of this asset. S3ObjectKey() *string // Attribute which represents the S3 URL of this asset. // // Example: // s3://bucket/key // S3ObjectUrl() *string // Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset. // // This can be used by tools such as SAM CLI to provide local // experience such as local invocation and debugging of Lambda functions. // // Asset metadata will only be included if the stack is synthesized with the // "aws:cdk:enable-asset-metadata" context key defined, which is the default // behavior when synthesizing via the CDK Toolkit. // See: https://github.com/aws/aws-cdk/issues/1432 // AddResourceMetadata(resource awscdk.CfnResource, resourceProperty *string) // Grants read permissions to the principal on the assets bucket. GrantRead(grantee awsiam.IGrantable) // Returns a string representation of this construct. ToString() *string }
Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
The asset can be used by other constructs.
func NewTypeScriptAsset ¶
func NewTypeScriptAsset(scope constructs.Construct, id *string, props *AssetProps) TypeScriptAsset
type TypeScriptCode ¶
type TypeScriptCode interface { EsbuildCode // Experimental. Asset() EsbuildAsset // Experimental. SetAsset(val EsbuildAsset) // A path or list or map of paths to the entry points of your code. // // Relative paths are by default resolved from the current working directory. // To change the working directory, see `buildOptions.absWorkingDir`. // // Absolute paths can be used if files are part of the working directory. // // Examples: // - `'src/index.ts'` // - `require.resolve('./lambda')` // - `['src/index.ts', 'src/util.ts']` // - `{one: 'src/two.ts', two: 'src/one.ts'}` EntryPoints() interface{} // Determines whether this Code is inline code or not. // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). IsInline() *bool // Deprecated: this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind(). SetIsInline(val *bool) // Experimental. Props() *AssetProps // Experimental. SetProps(val *AssetProps) // Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. // Experimental. Bind(scope constructs.Construct) *awslambda.CodeConfig // Called after the CFN function resource has been created to allow the code class to bind to it. // // Specifically it's required to allow assets to add // metadata for tooling like SAM CLI to be able to find their origins. BindToResource(resource awscdk.CfnResource, options *awslambda.ResourceBindOptions) GetAsset(scope constructs.Construct) EsbuildAsset }
Represents the deployed TypeScript Code.
func NewTypeScriptCode ¶
func NewTypeScriptCode(entryPoints interface{}, props *TypeScriptCodeProps) TypeScriptCode
type TypeScriptCodeProps ¶
type TypeScriptCodeProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // A hash of this asset, which is available at construction time. // // As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed. // // Defaults to a hash of all files in the resulting bundle. AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"` }
type TypeScriptSource ¶
type TypeScriptSource interface { awss3deployment.ISource Asset() interface{} SetAsset(val interface{}) AssetClass() TypeScriptAsset SetAssetClass(val TypeScriptAsset) Props() *AssetProps SetProps(val *AssetProps) // Binds the source to a bucket deployment. Bind(scope constructs.Construct, context *awss3deployment.DeploymentSourceContext) *awss3deployment.SourceConfig }
func NewTypeScriptSource ¶
func NewTypeScriptSource(entryPoints interface{}, props *TypeScriptSourceProps) TypeScriptSource
type TypeScriptSourceProps ¶
type TypeScriptSourceProps struct { // Escape hatch to provide the bundler with a custom build function. // // The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK. // Must throw a `BuildFailure` on failure to correctly inform the bundler. // // Returns: esbuild.BuildResult // Default: `esbuild.buildSync` // // Experimental. BuildFn interface{} `field:"optional" json:"buildFn" yaml:"buildFn"` // Build options passed on to esbuild. Please refer to the esbuild Build API docs for details. // // * `buildOptions.outdir: string` // The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \ // For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \ // *Cannot be used together with `outfile`*. // * `buildOptions.outfile: string` // Relative path to a file inside the CDK asset output directory. // For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \ // *Cannot be used with multiple entryPoints or together with `outdir`.* // * `buildOptions.absWorkingDir: string` // Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \ // If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation). // See: https://esbuild.github.io/api/#build-api // BuildOptions *BuildOptions `field:"optional" json:"buildOptions" yaml:"buildOptions"` // Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs. // // * When provided with a `string` or `array`, all files are copied to the root of asset staging directory. // * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied. // // Therefore the following values for `copyDir` are all equivalent: // “`ts // { copyDir: "path/to/source" } // { copyDir: ["path/to/source"] } // { copyDir: { ".": "path/to/source" } } // { copyDir: { ".": ["path/to/source"] } } // “` // The destination cannot be outside of the asset staging directory. // If you are receiving the error "Cannot copy files to outside of the asset staging directory." // you are likely using `..` or an absolute path as key on the `copyDir` map. // Instead use only relative paths and avoid `..`. CopyDir interface{} `field:"optional" json:"copyDir" yaml:"copyDir"` // Path to the binary used by esbuild. // // This is the same as setting the ESBUILD_BINARY_PATH environment variable. // Experimental. EsbuildBinaryPath *string `field:"optional" json:"esbuildBinaryPath" yaml:"esbuildBinaryPath"` // Absolute path to the esbuild module JS file. // // E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js" // // If not set, the module path will be determined in the following order: // // - Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable // - In TypeScript, fallback to the default Node.js package resolution mechanism // - All other languages (Python, Go, .NET, Java) use an automatic "best effort" resolution mechanism. \ // The exact algorithm of this mechanism is considered an implementation detail and should not be relied on. // If `esbuild` cannot be found, it might be installed dynamically to a temporary location. // To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable. // Default: - `CDK_ESBUILD_MODULE_PATH` or package resolution (see above). // // Experimental. EsbuildModulePath *string `field:"optional" json:"esbuildModulePath" yaml:"esbuildModulePath"` // A hash of this asset, which is available at construction time. // // As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed. // // Defaults to a hash of all files in the resulting bundle. AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"` }
Source Files
¶
- AssetProps.go
- BuildOptions.go
- BundlerProps.go
- CodeConfig.go
- CompilerOptions.go
- EsbuildAsset.go
- EsbuildAsset__checks.go
- EsbuildBundler.go
- EsbuildBundler__checks.go
- EsbuildCode.go
- EsbuildCode__checks.go
- EsbuildSource.go
- InlineJavaScriptCode.go
- InlineJavaScriptCode__checks.go
- InlineJsxCode.go
- InlineJsxCode__checks.go
- InlineTsxCode.go
- InlineTsxCode__checks.go
- InlineTypeScriptCode.go
- InlineTypeScriptCode__checks.go
- JavaScriptAsset.go
- JavaScriptAsset__checks.go
- JavaScriptCode.go
- JavaScriptCodeProps.go
- JavaScriptCode__checks.go
- JavaScriptSource.go
- JavaScriptSourceProps.go
- JavaScriptSource__checks.go
- TransformOptions.go
- TransformerProps.go
- TsconfigOptions.go
- TypeScriptAsset.go
- TypeScriptAsset__checks.go
- TypeScriptCode.go
- TypeScriptCodeProps.go
- TypeScriptCode__checks.go
- TypeScriptSource.go
- TypeScriptSourceProps.go
- TypeScriptSource__checks.go
- main.go