Interface AddBundleOptions
-
- All Superinterfaces:
BundlingOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AddBundleOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-03-28T21:16:43.148Z") @Stability(Experimental) public interface AddBundleOptions extends software.amazon.jsii.JsiiSerializable, BundlingOptions
(experimental) Options foraddBundle().
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAddBundleOptions.BuilderA builder forAddBundleOptionsstatic classAddBundleOptions.Jsii$ProxyAn implementation forAddBundleOptions
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static AddBundleOptions.Builderbuilder()default StringgetBanner()(experimental) Use this to insert an arbitrary string at the beginning of generated JavaScript files.default CharsetgetCharset()(experimental) The charset to use for esbuild's output.default Map<String,String>getDefine()(experimental) Replace global identifiers with constant expressions.default Map<String,Object>getEsbuildArgs()(experimental) Build arguments to pass into esbuild.default BooleangetExecutable()(experimental) Mark the output file as executable.default StringgetFooter()(experimental) Use this to insert an arbitrary string at the end of generated JavaScript files.default StringgetFormat()(experimental) Output format for the generated JavaScript files.default List<String>getInject()(experimental) This option allows you to automatically replace a global variable with an import from another file.default BooleangetKeepNames()(experimental) Whether to preserve the originalnamevalues even in minified code.default Map<String,String>getLoaders()(experimental) Map of file extensions (without dot) and loaders to use for this file type.default BundleLogLevelgetLogLevel()(experimental) Log level for esbuild.default List<String>getMainFields()(experimental) How to determine the entry point for modules.default BooleangetMetafile()(experimental) This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.default BooleangetMinify()(experimental) Whether to minify files when bundling.default StringgetOutfile()(experimental) Bundler output path relative to the asset's output directory.StringgetPlatform()(experimental) esbuild platform.default SourceMapModegetSourceMapMode()(experimental) Source map mode to be used when bundling.default BooleangetSourcesContent()(experimental) Whether to include original source code in source maps when bundling.StringgetTarget()(experimental) esbuild target.default StringgetTsconfigPath()(experimental) The path of the tsconfig.json file to use for bundling.-
Methods inherited from interface io.github.cdklabs.projen.javascript.BundlingOptions
getExternals, getSourcemap, getWatchTask
-
-
-
-
Method Detail
-
getPlatform
@Stability(Experimental) @NotNull String getPlatform()
(experimental) esbuild platform.Example:
"node"
-
getTarget
@Stability(Experimental) @NotNull String getTarget()
(experimental) esbuild target.Example:
"node12"
-
getBanner
@Stability(Experimental) @Nullable default String getBanner()
(experimental) 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
-
getCharset
@Stability(Experimental) @Nullable default Charset getCharset()
(experimental) 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
- See Also:
- https://esbuild.github.io/api/#charset
-
getDefine
@Stability(Experimental) @Nullable default Map<String,String> getDefine()
(experimental) 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
-
getEsbuildArgs
@Stability(Experimental) @Nullable default Map<String,Object> getEsbuildArgs()
(experimental) Build arguments to pass into esbuild.For example, to add the --log-limit flag:
project.bundler.addBundle("./src/hello.ts", { platform: "node", target: "node18", sourcemap: true, format: "esm", esbuildArgs: { "--log-limit": "0", }, });Default: - no additional esbuild arguments are passed
-
getExecutable
@Stability(Experimental) @Nullable default Boolean getExecutable()
(experimental) Mark the output file as executable.Default: false
-
getFooter
@Stability(Experimental) @Nullable default String getFooter()
(experimental) 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
-
getFormat
@Stability(Experimental) @Nullable default String getFormat()
(experimental) Output format for the generated JavaScript files.There are currently three possible values that can be configured:
"iife","cjs", and"esm".If not set (
undefined), esbuild picks an output format for you based onplatform:"cjs"ifplatformis"node""iife"ifplatformis"browser""esm"ifplatformis"neutral"
Note: If making a bundle to run under node with ESM, set
formatto"esm"instead of settingplatformto"neutral".Default: undefined
- See Also:
- https://esbuild.github.io/api/#format
-
getInject
@Stability(Experimental) @Nullable default List<String> getInject()
(experimental) This option allows you to automatically replace a global variable with an import from another file.Default: - no code is injected
- See Also:
- https://esbuild.github.io/api/#inject
-
getKeepNames
@Stability(Experimental) @Nullable default Boolean getKeepNames()
(experimental) Whether to preserve the originalnamevalues even in minified code.In JavaScript the
nameproperty 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
nameproperty for many of these cases. This is usually fine because thenameproperty is normally only used for debugging. However, some frameworks rely on thenameproperty for registration and binding purposes. If this is the case, you can enable this option to preserve the originalnamevalues even in minified code.Default: false
-
getLoaders
@Stability(Experimental) @Nullable default Map<String,String> getLoaders()
(experimental) Map of file extensions (without dot) and loaders to use for this file type.Loaders are appended to the esbuild command by
--loader:.extension=loader
-
getLogLevel
@Stability(Experimental) @Nullable default BundleLogLevel getLogLevel()
(experimental) Log level for esbuild.This is also propagated to the package manager and applies to its specific install command.
Default: LogLevel.WARNING
-
getMainFields
@Stability(Experimental) @Nullable default List<String> getMainFields()
(experimental) How to determine the entry point for modules.Try ['module', 'main'] to default to ES module versions.
Default: []
-
getMetafile
@Stability(Experimental) @Nullable default Boolean getMetafile()
(experimental) 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
- See Also:
- https://esbuild.github.io/api/#metafile
-
getMinify
@Stability(Experimental) @Nullable default Boolean getMinify()
(experimental) Whether to minify files when bundling.Default: false
-
getOutfile
@Stability(Experimental) @Nullable default String getOutfile()
(experimental) Bundler output path relative to the asset's output directory.Default: "index.js"
-
getSourceMapMode
@Stability(Experimental) @Nullable default SourceMapMode getSourceMapMode()
(experimental) Source map mode to be used when bundling.Default: SourceMapMode.DEFAULT
- See Also:
- https://esbuild.github.io/api/#sourcemap
-
getSourcesContent
@Stability(Experimental) @Nullable default Boolean getSourcesContent()
(experimental) Whether to include original source code in source maps when bundling.Default: true
-
getTsconfigPath
@Stability(Experimental) @Nullable default String getTsconfigPath()
(experimental) The path of the tsconfig.json file to use for bundling.Default: "tsconfig.json"
-
builder
@Stability(Experimental) static AddBundleOptions.Builder builder()
- Returns:
- a
AddBundleOptions.BuilderofAddBundleOptions
-
-