@Stability(value=Experimental) @Internal public static final class BundlingOptions.Jsii$Proxy extends software.amazon.jsii.JsiiObject implements BundlingOptions
BundlingOptions
software.amazon.jsii.JsiiObject.InitializationMode
BundlingOptions.Builder, BundlingOptions.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
Jsii$Proxy(software.amazon.jsii.JsiiObjectRef objRef)
Constructor that initializes the object based on values retrieved from the JsiiObject.
|
protected |
Jsii$Proxy(String banner,
Map<String,String> buildArgs,
ICommandHooks commandHooks,
Map<String,String> define,
DockerImage dockerImage,
Map<String,String> environment,
String esbuildVersion,
List<String> externalModules,
String footer,
Boolean forceDockerBundling,
Boolean keepNames,
Map<String,String> loader,
LogLevel logLevel,
Boolean metafile,
Boolean minify,
List<String> nodeModules,
Boolean sourceMap,
String target,
String tsconfig)
Constructor that initializes the object based on literal property values passed by the
BundlingOptions.Builder . |
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.JsonNode |
$jsii$toJson() |
boolean |
equals(Object o) |
String |
getBanner()
(experimental) Use this to insert an arbitrary string at the beginning of generated JavaScript files.
|
Map<String,String> |
getBuildArgs()
(experimental) Build arguments to pass when building the bundling image.
|
ICommandHooks |
getCommandHooks()
(experimental) Command hooks.
|
Map<String,String> |
getDefine()
(experimental) Replace global identifiers with constant expressions.
|
DockerImage |
getDockerImage()
(experimental) A custom bundling Docker image.
|
Map<String,String> |
getEnvironment()
(experimental) Environment variables defined when bundling runs.
|
String |
getEsbuildVersion()
(experimental) The version of esbuild to use when running in a Docker container.
|
List<String> |
getExternalModules()
(experimental) A list of modules that should be considered as externals (already available in the runtime).
|
String |
getFooter()
(experimental) Use this to insert an arbitrary string at the end of generated JavaScript files.
|
Boolean |
getForceDockerBundling()
(experimental) Force bundling in a Docker container even if local bundling is possible.
|
Boolean |
getKeepNames()
(experimental) Whether to preserve the original `name` values even in minified code.
|
Map<String,String> |
getLoader()
(experimental) Use loaders to change how a given input file is interpreted.
|
LogLevel |
getLogLevel()
(experimental) Log level for esbuild.
|
Boolean |
getMetafile()
(experimental) This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.
|
Boolean |
getMinify()
(experimental) Whether to minify files when bundling.
|
List<String> |
getNodeModules()
(experimental) A list of modules that should be installed instead of bundled.
|
Boolean |
getSourceMap()
(experimental) Whether to include source maps when bundling.
|
String |
getTarget()
(experimental) Target environment for the generated JavaScript code.
|
String |
getTsconfig()
(experimental) Normally the esbuild automatically discovers `tsconfig.json` files and reads their contents during a build.
|
int |
hashCode() |
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
builder
protected Jsii$Proxy(software.amazon.jsii.JsiiObjectRef objRef)
objRef
- Reference to the JSII managed object.protected Jsii$Proxy(String banner, Map<String,String> buildArgs, ICommandHooks commandHooks, Map<String,String> define, DockerImage dockerImage, Map<String,String> environment, String esbuildVersion, List<String> externalModules, String footer, Boolean forceDockerBundling, Boolean keepNames, Map<String,String> loader, LogLevel logLevel, Boolean metafile, Boolean minify, List<String> nodeModules, Boolean sourceMap, String target, String tsconfig)
BundlingOptions.Builder
.public final String getBanner()
BundlingOptions
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
getBanner
in interface BundlingOptions
public final Map<String,String> getBuildArgs()
BundlingOptions
Default: - no build arguments are passed
getBuildArgs
in interface BundlingOptions
public final ICommandHooks getCommandHooks()
BundlingOptions
Default: - do not run additional commands
getCommandHooks
in interface BundlingOptions
public final Map<String,String> getDefine()
BundlingOptions
Default: - no replacements are made
Example:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 {"process.env.API_KEY";JSON.stringify("xxx-xxxx-xxx"); }
getDefine
in interface BundlingOptions
public final DockerImage getDockerImage()
BundlingOptions
This image should have esbuild installed globally. If you plan to use nodeModules
it should also have npm
or yarn
depending on the lock file you're using.
See https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-lambda-nodejs/lib/Dockerfile for the default image provided by @aws-cdk/aws-lambda-nodejs.
Default: - use the Docker image provided by
getDockerImage
in interface BundlingOptions
public final Map<String,String> getEnvironment()
BundlingOptions
Default: - no environment variables are defined.
getEnvironment
in interface BundlingOptions
public final String getEsbuildVersion()
BundlingOptions
Default: - latest v0
getEsbuildVersion
in interface BundlingOptions
public final List<String> getExternalModules()
BundlingOptions
Default: ['aws-sdk']
getExternalModules
in interface BundlingOptions
public final String getFooter()
BundlingOptions
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
getFooter
in interface BundlingOptions
public final Boolean getForceDockerBundling()
BundlingOptions
This is useful if your function relies on node modules
that should be installed (nodeModules
) in a Lambda compatible
environment.
Default: false
getForceDockerBundling
in interface BundlingOptions
public final Boolean getKeepNames()
BundlingOptions
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
getKeepNames
in interface BundlingOptions
public final Map<String,String> getLoader()
BundlingOptions
Configuring a loader for a given file type lets you load that file type with
an import
statement or a require
call.
Default: - use esbuild default loaders
Example:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 {".png";"dataurl"; }
getLoader
in interface BundlingOptions
https://esbuild.github.io/api/#loader
public final LogLevel getLogLevel()
BundlingOptions
Default: LogLevel.WARNING
getLogLevel
in interface BundlingOptions
public final Boolean getMetafile()
BundlingOptions
The metadata in this JSON file follows this schema (specified using TypeScript syntax):
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 {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
getMetafile
in interface BundlingOptions
https://esbuild.github.io/api/#metafile
public final Boolean getMinify()
BundlingOptions
Default: false
getMinify
in interface BundlingOptions
public final List<String> getNodeModules()
BundlingOptions
Modules are installed in a Lambda compatible environment only when bundling runs in Docker.
Default: - all modules are bundled
getNodeModules
in interface BundlingOptions
public final Boolean getSourceMap()
BundlingOptions
Default: false
getSourceMap
in interface BundlingOptions
public final String getTarget()
BundlingOptions
Default: - the node version of the runtime
getTarget
in interface BundlingOptions
https://esbuild.github.io/api/#target
public final String getTsconfig()
BundlingOptions
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.
Default: - automatically discovered by `esbuild`
Example:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 {"tsconfig";"path/custom.tsconfig.json"; }
getTsconfig
in interface BundlingOptions
@Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson()
$jsii$toJson
in interface software.amazon.jsii.JsiiSerializable
Copyright © 2021. All rights reserved.