@Generated(value="jsii-pacmak/1.26.0 (build 7d76e02)", date="2021-04-01T03:13:04.979Z") @Stability(value=Experimental) public interface BundlingOptions extends software.amazon.jsii.JsiiSerializable
| Modifier and Type | Interface and Description |
|---|---|
static class |
BundlingOptions.Builder
A builder for
BundlingOptions |
static class |
BundlingOptions.Jsii$Proxy
An implementation for
BundlingOptions |
| Modifier and Type | Method and Description |
|---|---|
static BundlingOptions.Builder |
builder() |
default String |
getBanner()
(experimental) Use this to insert an arbitrary string at the beginning of generated JavaScript files.
|
default Map<String,String> |
getBuildArgs()
(experimental) Build arguments to pass when building the bundling image.
|
default ICommandHooks |
getCommandHooks()
(experimental) Command hooks.
|
default Map<String,String> |
getDefine()
(experimental) Replace global identifiers with constant expressions.
|
default DockerImage |
getDockerImage()
(experimental) A custom bundling Docker image.
|
default Map<String,String> |
getEnvironment()
(experimental) Environment variables defined when bundling runs.
|
default String |
getEsbuildVersion()
(experimental) The version of esbuild to use when running in a Docker container.
|
default List<String> |
getExternalModules()
(experimental) A list of modules that should be considered as externals (already available in the runtime).
|
default String |
getFooter()
(experimental) Use this to insert an arbitrary string at the end of generated JavaScript files.
|
default Boolean |
getForceDockerBundling()
(experimental) Force bundling in a Docker container even if local bundling is possible.
|
default Boolean |
getKeepNames()
(experimental) Whether to preserve the original `name` values even in minified code.
|
default Map<String,String> |
getLoader()
(experimental) Use loaders to change how a given input file is interpreted.
|
default LogLevel |
getLogLevel()
(experimental) Log level for esbuild.
|
default Boolean |
getMetafile()
(experimental) This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.
|
default Boolean |
getMinify()
(experimental) Whether to minify files when bundling.
|
default List<String> |
getNodeModules()
(experimental) A list of modules that should be installed instead of bundled.
|
default Boolean |
getSourceMap()
(experimental) Whether to include source maps when bundling.
|
default String |
getTarget()
(experimental) Target environment for the generated JavaScript code.
|
default String |
getTsconfig()
(experimental) Normally the esbuild automatically discovers `tsconfig.json` files and reads their contents during a build.
|
@Stability(value=Experimental) @Nullable default String getBanner()
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
@Stability(value=Experimental) @Nullable default Map<String,String> getBuildArgs()
Default: - no build arguments are passed
@Stability(value=Experimental) @Nullable default ICommandHooks getCommandHooks()
Default: - do not run additional commands
@Stability(value=Experimental) @Nullable default Map<String,String> getDefine()
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"); }
@Stability(value=Experimental) @Nullable default DockerImage getDockerImage()
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
@Stability(value=Experimental) @Nullable default Map<String,String> getEnvironment()
Default: - no environment variables are defined.
@Stability(value=Experimental) @Nullable default String getEsbuildVersion()
Default: - latest v0
@Stability(value=Experimental) @Nullable default List<String> getExternalModules()
Default: ['aws-sdk']
@Stability(value=Experimental) @Nullable default String getFooter()
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
@Stability(value=Experimental) @Nullable default Boolean getForceDockerBundling()
This is useful if your function relies on node modules
that should be installed (nodeModules) in a Lambda compatible
environment.
Default: false
@Stability(value=Experimental) @Nullable default Boolean getKeepNames()
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
@Stability(value=Experimental) @Nullable default Map<String,String> getLoader()
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"; }
https://esbuild.github.io/api/#loader@Stability(value=Experimental) @Nullable default LogLevel getLogLevel()
Default: LogLevel.WARNING
@Stability(value=Experimental) @Nullable default Boolean getMetafile()
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
https://esbuild.github.io/api/#metafile@Stability(value=Experimental) @Nullable default Boolean getMinify()
Default: false
@Stability(value=Experimental) @Nullable default List<String> getNodeModules()
Modules are installed in a Lambda compatible environment only when bundling runs in Docker.
Default: - all modules are bundled
@Stability(value=Experimental) @Nullable default Boolean getSourceMap()
Default: false
@Stability(value=Experimental) @Nullable default String getTarget()
Default: - the node version of the runtime
https://esbuild.github.io/api/#target@Stability(value=Experimental) @Nullable default String getTsconfig()
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"; }
@Stability(value=Experimental) static BundlingOptions.Builder builder()
BundlingOptions.Builder of BundlingOptionsCopyright © 2021. All rights reserved.