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 for addBundle().
    • 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 on platform:

        • "cjs" if platform is "node"
        • "iife" if platform is "browser"
        • "esm" if platform is "neutral"

        Note: If making a bundle to run under node with ESM, set format to "esm" instead of setting platform to "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 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

      • 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"

      • getTsconfigPath

        @Stability(Experimental)
        @Nullable
        default String getTsconfigPath()
        (experimental) The path of the tsconfig.json file to use for bundling.

        Default: "tsconfig.json"