Class BundlingOptions.Jsii$Proxy

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.nodejs.BundlingOptions.Jsii$Proxy
All Implemented Interfaces:
DockerRunOptions, BundlingOptions, software.amazon.jsii.JsiiSerializable
Enclosing interface:
BundlingOptions

@Stability(Stable) @Internal public static final class BundlingOptions.Jsii$Proxy extends software.amazon.jsii.JsiiObject implements BundlingOptions
An implementation for BundlingOptions
  • Constructor Details

    • Jsii$Proxy

      protected Jsii$Proxy(software.amazon.jsii.JsiiObjectRef objRef)
      Constructor that initializes the object based on values retrieved from the JsiiObject.
      Parameters:
      objRef - Reference to the JSII managed object.
    • Jsii$Proxy

      protected Jsii$Proxy(BundlingOptions.Builder builder)
      Constructor that initializes the object based on literal property values passed by the BundlingOptions.Builder.
  • Method Details

    • getAssetHash

      public final String getAssetHash()
      Description copied from interface: BundlingOptions
      Specify a custom hash for this asset.

      For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash.

      NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated.

      Default: - asset hash is calculated based on the bundled output

      Specified by:
      getAssetHash in interface BundlingOptions
    • getBanner

      public final String getBanner()
      Description copied from interface: BundlingOptions
      Use this to insert an arbitrary string at the beginning of generated JavaScript files.

      This is similar to footer which inserts at the end instead of the beginning.

      This is commonly used to insert comments:

      Default: - no comments are passed

      Specified by:
      getBanner in interface BundlingOptions
    • getBuildArgs

      public final Map<String,String> getBuildArgs()
      Description copied from interface: BundlingOptions
      Build arguments to pass when building the bundling image.

      Default: - no build arguments are passed

      Specified by:
      getBuildArgs in interface BundlingOptions
    • getBundleAwsSDK

      public final Boolean getBundleAwsSDK()
      Description copied from interface: BundlingOptions
      Includes AWS SDK in the bundle asset.

      Default: - false if `true` the `aws-sdk` will be included in the asset bundle and not be resolved to the Lambda provided sdk.

      Specified by:
      getBundleAwsSDK in interface BundlingOptions
    • getBundlingFileAccess

      public final BundlingFileAccess getBundlingFileAccess()
      Description copied from interface: BundlingOptions
      Which option to use to copy the source files to the docker container and output files back.

      Default: - BundlingFileAccess.BIND_MOUNT

      Specified by:
      getBundlingFileAccess in interface BundlingOptions
    • getCharset

      public final Charset getCharset()
      Description copied from interface: BundlingOptions
      The charset to use for esbuild's output.

      By default esbuild's output is ASCII-only. Any non-ASCII characters are escaped using backslash escape sequences. Using escape sequences makes the generated output slightly bigger, and also makes it harder to read. If you would like for esbuild to print the original characters without using escape sequences, use Charset.UTF8.

      Default: Charset.ASCII

      Specified by:
      getCharset in interface BundlingOptions
      See Also:
    • getCommandHooks

      public final ICommandHooks getCommandHooks()
      Description copied from interface: BundlingOptions
      Command hooks.

      Default: - do not run additional commands

      Specified by:
      getCommandHooks in interface BundlingOptions
    • getDefine

      public final Map<String,String> getDefine()
      Description copied from interface: BundlingOptions
      Replace global identifiers with constant expressions.

      For example, { 'process.env.DEBUG': 'true' }.

      Another example, { 'process.env.API_KEY': JSON.stringify('xxx-xxxx-xxx') }.

      Default: - no replacements are made

      Specified by:
      getDefine in interface BundlingOptions
    • getDockerImage

      public final DockerImage getDockerImage()
      Description copied from interface: BundlingOptions
      A custom bundling Docker image.

      This image should have esbuild installed globally. If you plan to use nodeModules it should also have npm, yarn or pnpm depending on the lock file you're using.

      See https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-lambda-nodejs/lib/Dockerfile for the default image provided by aws-cdk-lib/aws-lambda-nodejs.

      Default: - use the Docker image provided by aws-cdk-lib/aws-lambda-nodejs

      Specified by:
      getDockerImage in interface BundlingOptions
    • getEsbuildArgs

      public final Map<String,Object> getEsbuildArgs()
      Description copied from interface: BundlingOptions
      Build arguments to pass into esbuild.

      For example, to add the --log-limit flag:

       new NodejsFunction(scope, id, {
         ...
         bundling: {
           esbuildArgs: {
             "--log-limit": "0",
           }
         }
       });
       

      Default: - no additional esbuild arguments are passed

      Specified by:
      getEsbuildArgs in interface BundlingOptions
    • getEsbuildVersion

      public final String getEsbuildVersion()
      Description copied from interface: BundlingOptions
      The version of esbuild to use when running in a Docker container.

      Default: - latest v0

      Specified by:
      getEsbuildVersion in interface BundlingOptions
    • getExternalModules

      public final List<String> getExternalModules()
      Description copied from interface: BundlingOptions
      A list of modules that should be considered as externals (already available in the runtime).

      Default: - no replacements are made

      Specified by:
      getExternalModules in interface BundlingOptions
    • getFooter

      public final String getFooter()
      Description copied from interface: BundlingOptions
      Use this to insert an arbitrary string at the end of generated JavaScript files.

      This is similar to banner which inserts at the beginning instead of the end.

      This is commonly used to insert comments

      Default: - no comments are passed

      Specified by:
      getFooter in interface BundlingOptions
    • getForceDockerBundling

      public final Boolean getForceDockerBundling()
      Description copied from interface: BundlingOptions
      Force bundling in a Docker container even if local bundling is possible.

      This is useful if your function relies on node modules that should be installed (nodeModules) in a Lambda compatible environment.

      Default: false

      Specified by:
      getForceDockerBundling in interface BundlingOptions
    • getFormat

      public final OutputFormat getFormat()
      Description copied from interface: BundlingOptions
      Output format for the generated JavaScript files.

      Default: OutputFormat.CJS

      Specified by:
      getFormat in interface BundlingOptions
    • getInject

      public final List<String> getInject()
      Description copied from interface: BundlingOptions
      This option allows you to automatically replace a global variable with an import from another file.

      Default: - no code is injected

      Specified by:
      getInject in interface BundlingOptions
      See Also:
    • getKeepNames

      public final Boolean getKeepNames()
      Description copied from interface: BundlingOptions
      Whether to preserve the original name values even in minified code.

      In JavaScript the name property on functions and classes defaults to a nearby identifier in the source code.

      However, minification renames symbols to reduce code size and bundling sometimes need to rename symbols to avoid collisions. That changes value of the name property for many of these cases. This is usually fine because the name property is normally only used for debugging. However, some frameworks rely on the name property for registration and binding purposes. If this is the case, you can enable this option to preserve the original name values even in minified code.

      Default: false

      Specified by:
      getKeepNames in interface BundlingOptions
    • getLoader

      public final Map<String,String> getLoader()
      Description copied from interface: BundlingOptions
      Use loaders to change how a given input file is interpreted.

      Configuring a loader for a given file type lets you load that file type with an import statement or a require call.

      For example, { '.png': 'dataurl' }.

      Default: - use esbuild default loaders

      Specified by:
      getLoader in interface BundlingOptions
      See Also:
    • getLogLevel

      public final LogLevel getLogLevel()
      Description copied from interface: BundlingOptions
      Log level for esbuild.

      This is also propagated to the package manager and applies to its specific install command.

      Default: LogLevel.WARNING

      Specified by:
      getLogLevel in interface BundlingOptions
    • getMainFields

      public final List<String> getMainFields()
      Description copied from interface: BundlingOptions
      How to determine the entry point for modules.

      Try ['module', 'main'] to default to ES module versions.

      Default: []

      Specified by:
      getMainFields in interface BundlingOptions
    • getMetafile

      public final Boolean getMetafile()
      Description copied from interface: BundlingOptions
      This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.

      The metadata in this JSON file follows this schema (specified using TypeScript syntax):

       {
         outputs: {
           [path: string]: {
             bytes: number
             inputs: {
               [path: string]: { bytesInOutput: number }
             }
             imports: { path: string }[]
             exports: string[]
           }
         }
       }
       

      This data can then be analyzed by other tools. For example, bundle buddy can consume esbuild's metadata format and generates a treemap visualization of the modules in your bundle and how much space each one takes up.

      Default: false

      Specified by:
      getMetafile in interface BundlingOptions
      See Also:
    • getMinify

      public final Boolean getMinify()
      Description copied from interface: BundlingOptions
      Whether to minify files when bundling.

      Default: false

      Specified by:
      getMinify in interface BundlingOptions
    • getNodeModules

      public final List<String> getNodeModules()
      Description copied from interface: BundlingOptions
      A list of modules that should be installed instead of bundled.

      Modules are installed in a Lambda compatible environment only when bundling runs in Docker.

      Default: - all modules are bundled

      Specified by:
      getNodeModules in interface BundlingOptions
    • getPreCompilation

      public final Boolean getPreCompilation()
      Description copied from interface: BundlingOptions
      Run compilation using tsc before running file through bundling step.

      This usually is not required unless you are using new experimental features that are only supported by typescript's tsc compiler. One example of such feature is emitDecoratorMetadata.

      Default: false

      Specified by:
      getPreCompilation in interface BundlingOptions
    • getSourceMap

      public final Boolean getSourceMap()
      Description copied from interface: BundlingOptions
      Whether to include source maps when bundling.

      Default: false

      Specified by:
      getSourceMap in interface BundlingOptions
    • getSourceMapMode

      public final SourceMapMode getSourceMapMode()
      Description copied from interface: BundlingOptions
      Source map mode to be used when bundling.

      Default: SourceMapMode.DEFAULT

      Specified by:
      getSourceMapMode in interface BundlingOptions
      See Also:
    • getSourcesContent

      public final Boolean getSourcesContent()
      Description copied from interface: BundlingOptions
      Whether to include original source code in source maps when bundling.

      Default: true

      Specified by:
      getSourcesContent in interface BundlingOptions
      See Also:
    • getTarget

      public final String getTarget()
      Description copied from interface: BundlingOptions
      Target environment for the generated JavaScript code.

      Default: - the node version of the runtime

      Specified by:
      getTarget in interface BundlingOptions
      See Also:
    • getTsconfig

      public final String getTsconfig()
      Description copied from interface: BundlingOptions
      Normally the esbuild automatically discovers tsconfig.json files and reads their contents during a build.

      However, you can also configure a custom tsconfig.json file to use instead.

      This is similar to entry path, you need to provide path to your custom tsconfig.json.

      This can be useful if you need to do multiple builds of the same code with different settings.

      For example, { 'tsconfig': 'path/custom.tsconfig.json' }.

      Default: - automatically discovered by `esbuild`

      Specified by:
      getTsconfig in interface BundlingOptions
    • getCommand

      public final List<String> getCommand()
      Description copied from interface: DockerRunOptions
      The command to run in the container.

      Default: - run the command defined in the image

      Specified by:
      getCommand in interface DockerRunOptions
    • getEntrypoint

      public final List<String> getEntrypoint()
      Description copied from interface: DockerRunOptions
      The entrypoint to run in the container.

      Default: - run the entrypoint defined in the image

      Specified by:
      getEntrypoint in interface DockerRunOptions
    • getEnvironment

      public final Map<String,String> getEnvironment()
      Description copied from interface: DockerRunOptions
      The environment variables to pass to the container.

      Default: - no environment variables.

      Specified by:
      getEnvironment in interface DockerRunOptions
    • getNetwork

      public final String getNetwork()
      Description copied from interface: DockerRunOptions
      Docker Networking options.

      Default: - no networking options

      Specified by:
      getNetwork in interface DockerRunOptions
    • getPlatform

      public final String getPlatform()
      Description copied from interface: DockerRunOptions
      Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.

      Example value: linux/amd64

      Default: - no platform specified

      Specified by:
      getPlatform in interface DockerRunOptions
    • getSecurityOpt

      public final String getSecurityOpt()
      Description copied from interface: DockerRunOptions
      Security configuration when running the docker container.

      Default: - no security options

      Specified by:
      getSecurityOpt in interface DockerRunOptions
    • getUser

      public final String getUser()
      Description copied from interface: DockerRunOptions
      The user to use when running the container.

      Default: - root or image default

      Specified by:
      getUser in interface DockerRunOptions
    • getVolumes

      public final List<DockerVolume> getVolumes()
      Description copied from interface: DockerRunOptions
      Docker volumes to mount.

      Default: - no volumes are mounted

      Specified by:
      getVolumes in interface DockerRunOptions
    • getVolumesFrom

      public final List<String> getVolumesFrom()
      Description copied from interface: DockerRunOptions
      Where to mount the specified volumes from.

      Default: - no containers are specified to mount volumes from

      Specified by:
      getVolumesFrom in interface DockerRunOptions
      See Also:
    • getWorkingDirectory

      public final String getWorkingDirectory()
      Description copied from interface: DockerRunOptions
      Working directory inside the container.

      Default: - image default

      Specified by:
      getWorkingDirectory in interface DockerRunOptions
    • $jsii$toJson

      @Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson()
      Specified by:
      $jsii$toJson in interface software.amazon.jsii.JsiiSerializable
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object